@apollosproject/web-embeds 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +91 -0
  2. package/package.json +51 -0
  3. package/widget/embed.js +166 -0
package/README.md ADDED
@@ -0,0 +1,91 @@
1
+ # Apollos Web Embeds v2
2
+
3
+ Next-generation embeddable widget system for Apollos that enables churches to provide their congregation with instant access to church resources, AI-powered search, and key actions directly from their website.
4
+
5
+ ## Quick Start
6
+
7
+ ### Installation
8
+
9
+ Add the following script tag before the closing `</body>` tag:
10
+
11
+ ```html
12
+ <script>
13
+ (function (w, d, s, o, f, js, fjs) {
14
+ w["ApollosEmbed"] = o;
15
+ w[o] =
16
+ w[o] ||
17
+ function () {
18
+ (w[o].q = w[o].q || []).push(arguments);
19
+ };
20
+ js = d.createElement(s);
21
+ fjs = d.getElementsByTagName(s)[0];
22
+ js.id = o;
23
+ js.src = f;
24
+ js.async = 1;
25
+ fjs.parentNode.insertBefore(js, fjs);
26
+ })(
27
+ window,
28
+ document,
29
+ "script",
30
+ "apollos",
31
+ "https://embed.apollos.com/v2/embed.js"
32
+ );
33
+
34
+ apollos("init", {
35
+ slug: "your-church-slug",
36
+ });
37
+ </script>
38
+ ```
39
+
40
+ ### Link Interception (Primary Use Case)
41
+
42
+ The simplest way to use the embed is through automatic link interception. Any link on your website pointing to your church's Apollos URL will automatically open in the embed:
43
+
44
+ ```html
45
+ <a href="https://apollos.com/your-church/give">Give Now</a>
46
+ <a href="https://apollos.com/your-church/events">View Events</a>
47
+ ```
48
+
49
+ ## Development
50
+
51
+ ```bash
52
+ # Install dependencies
53
+ npm install
54
+
55
+ # Start dev server
56
+ npm run dev
57
+
58
+ # Build for production
59
+ npm run build
60
+ ```
61
+
62
+ ## Publishing
63
+
64
+ This app publishes to the npm package **`@apollosproject/web-embeds`** (separate from `@apollosproject/canvas-embeds`).
65
+
66
+ **CDN URL:**
67
+ `https://cdn.jsdelivr.net/npm/@apollosproject/web-embeds@latest/widget/embed.js`
68
+
69
+ ### Automatic deploy
70
+
71
+ On push to `main`, the GitHub workflow syncs the published version from npm (if any), bumps the version (patch by default), runs `npm publish` (which triggers `prepublishOnly` to build), and purges the jsDelivr cache for `@apollosproject/web-embeds`.
72
+
73
+ ### Manual deploy
74
+
75
+ From the repo root (after `yarn` install):
76
+
77
+ 1. `cd apps/web-embeds-v2`
78
+ 2. Optionally sync to the last published version: `yarn version --new-version $(npm show @apollosproject/web-embeds version) --no-git-tag-version`
79
+ 3. Bump the version: `yarn bump` (patch by default, or `yarn bump:prerelease` for prerelease)
80
+ 4. Publish: `npm publish` (runs `prepublishOnly` to build and verify)
81
+ 5. Purge jsDelivr cache: `yarn flush`
82
+
83
+ Skipping the publish step means users will still get the previous version; skipping the flush step delays propagation until jsDelivr’s cache expires.
84
+
85
+ ## Documentation
86
+
87
+ See the full [Product Requirements Document](../../docs/PRD-web-embeds-v2.md) for detailed specifications.
88
+
89
+ ## License
90
+
91
+ MIT
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@apollosproject/web-embeds",
3
+ "version": "0.1.0",
4
+ "description": "Next-generation embeddable widget system for Apollos",
5
+ "type": "module",
6
+ "main": "./widget/embed.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "widget/embed.js"
10
+ ],
11
+ "publishConfig": {
12
+ "access": "public"
13
+ },
14
+ "scripts": {
15
+ "dev": "vite",
16
+ "build": "tsc && vite build && node scripts/build.cjs",
17
+ "preview": "vite preview",
18
+ "type-check": "tsc --noEmit",
19
+ "lint": "eslint src --ext .ts,.tsx",
20
+ "bump": "sh scripts/bump.sh",
21
+ "bump:prerelease": "sh scripts/bump.sh prerelease",
22
+ "flush": "sh scripts/flush-cdn-cache.sh",
23
+ "prepublishOnly": "npx tsc && npx vite build && node scripts/build.cjs && ([ -s widget/embed.js ] || (echo \"Web embed bundle missing. Build failed.\" && exit 1))"
24
+ },
25
+ "dependencies": {
26
+ "react": "^18.2.0",
27
+ "react-dom": "^18.2.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/react": "^18.2.0",
31
+ "@types/react-dom": "^18.2.0",
32
+ "@vitejs/plugin-react": "^4.2.1",
33
+ "autoprefixer": "^10.4.19",
34
+ "cssnano": "^7.0.0",
35
+ "postcss": "^8.4.38",
36
+ "tailwindcss": "^3.4.3",
37
+ "tailwindcss-scoped-preflight": "^3.5.7",
38
+ "typescript": "^5.3.3",
39
+ "vite": "^5.0.11",
40
+ "vite-plugin-css-injected-by-js": "^3.5.0"
41
+ },
42
+ "keywords": [
43
+ "apollos",
44
+ "embed",
45
+ "widget",
46
+ "iframe",
47
+ "church"
48
+ ],
49
+ "author": "Apollos Team",
50
+ "license": "MIT"
51
+ }