2.1.140 • Published 4 months ago

@apollosproject/canvas-embeds v2.1.140

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

Apollos Embeds

Apollos React Embeds are pre-built, reusable components designed to integrate seamlessly into third-party websites such as Webflow. These widgets provide functionality for authentication, content feeds, and search features, creating a unified and engaging user experience across platforms.


Getting Started with Apollos Embeds

1. Adding Script Tags to Your Website

To enable the Apollos Embeds, include the following scripts and stylesheets in your website's code. For Webflow users, add them to the Custom Code section under Footer Code:

<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@apollosproject/canvas-embeds@latest/widget/index.css"
/>
<script
  defer
  src="https://cdn.jsdelivr.net/npm/@apollosproject/canvas-embeds@latest/widget/index.min.js"
></script>

3. Understanding Embed Modes

There are three primary modes in which Apollos Embeds can be used:

  • Apollos Site Mode
  • Container Mode
  • Legacy Modal Mode

Apollos Site Mode

In the Apollos Site Mode, all embeds link to the external Apollos site. This mode is recommended for users who want to maintain a consistent user experience across platforms, and it is the default mode for all embeds.

Container Mode

In the Container Mode, embeds are displayed within a container on the host website. This mode is recommended for users who want to keep users on their website while providing Apollos functionality. This mode also enables the user to cleanly integrate Apollos content into their website, while also applying custom styles.

To enable the Container Mode, add the data-apollos-path="/apollos" attribute to the script tag:

<script
  defer
  src="https://cdn.jsdelivr.net/npm/@apollosproject/canvas-embeds@latest/widget/index.min.js"
  data-apollos-route="/apollos"
></script>

On the host website, visiting any feed or content will navigate to the /apollos path on the host website. This path (which is customizable) should contain a div with the ID apollos-widget-container to display the embed content. This container should be styled to match the host website's design.

Legacy Modal Mode

In the Legacy Modal Mode, embeds are displayed in a modal window on the host website. This mode is recommended for users who want to keep users on their website while providing Apollos functionality. All embeds will be displayed in a modal window, with navigation state being tracked via URL search params.

To enable the Legacy Modal Mode, add the data-apollos-modal="true" attribute to the script tag:

<script
  defer
  src="https://cdn.jsdelivr.net/npm/@apollosproject/canvas-embeds@latest/widget/index.min.js"
  data-apollos-modal="true"
></script>

### 4. Adding the Embed Divs Navigate to the design section of your Webflow site
and add a `div` element for each embed you plan to use. Currently supported
embeds include: - **Auth**: Handles user authentication. - **FeatureFeed**:
Displays curated content feeds. - **Search**: Enables search functionality with
optional profile modal customization. Each `div` should include the
`apollos-widget` class to activate the embed functionality. Example: ```html
<div class="apollos-widget" data-type="Auth" data-church="example_church"></div>
<div
  class="apollos-widget"
  data-type="FeatureFeed"
  data-church="example_church"
></div>
<div
  class="apollos-widget"
  data-type="Search"
  data-hide-apollos-auth="true"
  data-church="example_church"
  data-search-profile-size="365px"
></div>

Webflow embed example


5. Customizing Embeds with Attributes

Use data-attributes (or Custom Attributes in Webflow) to customize the behavior and appearance of each embed.

AttributeDescription
data-typeSpecifies the type of embed (Auth, FeatureFeed, Search).
data-churchSets the church slug (e.g., bayside).
data-search-profile-size(Optional) Customizes the width of the search profile modal.
data-feature-feed(FeatureFeed) Displays content for a specific feed.
data-hide-apollos-auth(Optional) Hides the Apollos Auth Profile functionality

Example for a FeatureFeed embed:

<div
  class="apollos-widget"
  data-type="FeatureFeed"
  data-church="example_church"
  data-feature-feed="FeatureFeed:unique-id"
  data-modal="true"
></div>

Auth embed attributes

FeatureFeed embed attributes


6. Understanding Church Slugs

Church slugs uniquely identify the organization whose content is displayed. If you’re unsure of your slug, contact a developer or administrator.

!NOTE Replace [INSERT_CHURCH_SLUG_HERE] with your church's unique identifier (or slug). Contact a developer if you need assistance obtaining a church slug.


For Developers

Background

This package was originally part of the apollos-embeds repository and involved significant duplication of frontend code, components, and GraphQL queries. To unify our web frontend development, we created canvas-ui-web as a component library. The apollos-embeds project has been moved into this repository to coexist with our other web platforms.

The original version of web-embeds was heavily dependent on modal presentation. This new package retains selective use of modals while encouraging users to navigate to Apollos microsites, which run on New Web.

How It Works

Embeds are bundled as index.js and index.css in the /widget folder and distributed via jsDelivr. By including these on the webpage, users can access these embeds. Placing an apollos-widget div on the page triggers the web embed functionality.


Local Development

To work on this package locally, ensure you have a valid Feature Feed ID. Use index.html for testing with examples. Keep in mind that embeds from different churches on the same page may cause conflicts, so ensure you only use one church per page. You should be running apollos-cluster as well as this entire repo by running yarn dev.

Testing Embeds Locally

Use the index.html file for testing. Open http://localhost:5174 in your browser to view changes.

Example embed for testing:

<div
  data-type="FeatureFeed"
  data-church="apollos_demo"
  data-feature-feed="FeatureFeed:caf294f0-cd0e-4486-95e7-fa11bd5fb1c5"
  data-modal="true"
  class="apollos-widget"
></div>

To test changes, open http://localhost:5174 in your browser.


Caching

To test caching in local development, modify the Apollo client configuration by commenting out the x-cache-me-not header in:

src/client/apollosApiLink.js

'x-cache-me-not': 1,

jsDelivr Cache Busting

If you need to force jsDelivr to fetch the latest version of a file, you can manually purge the cache by accessing the purge subdomain of the file's URL. This command clears the cached version of the file from jsDelivr's CDN.

yarn flush

Advanced Configuration

Supported Embeds and Attributes

Embed TypeKey Attributes
Authdata-church
FeatureFeeddata-church, data-feature-feed
Searchdata-church, data-search-profile-size
data-hide-apollos-auth

Path Routing

For advanced routing options, use:

  • data-use-path-router="true" for enabling path-based routing.
  • data-apollos-id-param="true" for custom ID handling.
2.1.140

4 months ago

2.1.139

4 months ago

2.1.138

4 months ago

2.1.137

4 months ago

2.1.136

4 months ago

2.1.135

4 months ago

2.1.134

4 months ago

2.1.133

4 months ago

2.1.132

4 months ago

2.1.131

4 months ago

2.1.130

4 months ago

2.1.129

4 months ago

2.1.128

4 months ago

2.1.127

4 months ago

2.1.126

4 months ago

2.1.125

4 months ago

2.1.124

4 months ago

2.1.123

4 months ago

2.1.122

5 months ago

2.1.121

5 months ago

2.1.120

5 months ago

2.1.119

5 months ago

2.1.118

5 months ago

2.1.117

5 months ago

2.1.116

5 months ago

2.1.115

5 months ago

2.1.114

5 months ago

2.1.113

5 months ago

2.1.112

5 months ago

2.1.111

5 months ago

2.1.110

5 months ago

2.1.109

5 months ago

2.1.108

5 months ago

2.1.107

5 months ago

2.1.106

5 months ago

2.1.105

5 months ago

2.1.104

5 months ago

2.1.103

5 months ago

2.1.102

5 months ago

2.1.101

5 months ago

2.1.100

5 months ago

2.1.99

5 months ago

2.1.98

5 months ago

2.1.97

5 months ago

2.1.96

5 months ago

2.1.95

5 months ago

2.1.94

5 months ago

2.1.93

5 months ago

2.1.92

5 months ago

2.1.91

5 months ago

2.1.90

5 months ago

2.1.89

5 months ago

2.1.88

5 months ago

2.1.87

5 months ago

2.1.86

5 months ago

2.1.85

5 months ago

2.1.84

5 months ago

2.1.83

5 months ago

2.1.82

6 months ago

2.1.81

6 months ago

2.1.80

6 months ago

2.1.79

6 months ago

2.1.78

6 months ago

2.1.77

6 months ago

2.1.76

6 months ago

2.1.75

6 months ago

2.1.74

6 months ago

2.1.73

6 months ago

2.1.72

6 months ago

2.1.71

6 months ago

2.1.70

6 months ago

2.1.69

6 months ago

2.1.68

6 months ago

2.1.67

6 months ago

2.1.66

6 months ago

2.1.65

6 months ago

2.1.64

6 months ago

2.1.63

6 months ago

2.1.62

6 months ago

2.1.61

6 months ago

2.1.60

6 months ago

2.1.59

6 months ago

2.1.58

6 months ago

2.1.57

6 months ago

2.1.56

6 months ago

2.1.55

6 months ago

2.1.54

6 months ago

2.1.53

6 months ago

2.1.52

6 months ago

2.1.51

7 months ago

2.1.50

7 months ago

2.1.49

7 months ago

2.1.48

7 months ago

2.1.47

7 months ago

2.1.46

7 months ago

2.1.45

7 months ago

2.1.44

7 months ago

2.1.43

7 months ago

2.1.42

7 months ago

2.1.41

7 months ago

2.1.40

7 months ago

2.1.39

7 months ago

2.1.38

7 months ago

2.1.37

7 months ago

2.1.36

7 months ago

2.1.35

7 months ago

2.1.34

7 months ago

2.1.33

7 months ago

2.1.32

7 months ago

2.1.31

8 months ago

2.1.30

8 months ago

2.1.29

8 months ago

2.1.28

8 months ago

2.1.27

8 months ago

2.1.26

8 months ago

2.1.25

8 months ago

2.1.24

8 months ago

2.1.23

8 months ago

2.1.22

8 months ago

2.1.21

8 months ago

2.1.20

8 months ago

2.1.19

8 months ago

2.1.18

8 months ago

2.1.17

8 months ago

2.1.16

8 months ago

2.1.15

8 months ago

2.1.14

8 months ago

2.1.13

8 months ago

2.1.12

8 months ago

2.1.11

8 months ago

2.1.10

8 months ago

2.1.9

8 months ago

2.1.8

8 months ago

2.1.7

8 months ago

2.1.6

8 months ago

2.1.5

8 months ago

2.1.4

8 months ago

2.1.3

8 months ago

2.1.2

8 months ago

2.1.1

8 months ago