@apollosproject/web-embeds 0.1.563 → 0.1.564

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 (2) hide show
  1. package/README.md +28 -4
  2. package/package.json +2 -1
package/README.md CHANGED
@@ -60,7 +60,10 @@ Apollos session and no `personOriginId` is passed.
60
60
  apollos("init", { slug: "your-church-slug" });
61
61
 
62
62
  // After (with migration detection — Rock RMS example)
63
- apollos("init", { slug: "your-church-slug", personOriginId: "${CurrentPerson.Id}" });
63
+ apollos("init", {
64
+ slug: "your-church-slug",
65
+ personOriginId: "${CurrentPerson.Id}",
66
+ });
64
67
  ```
65
68
 
66
69
  If the id isn't known at `init` time, the embed also reads a `personoriginid`
@@ -83,10 +86,31 @@ npm run build
83
86
 
84
87
  ### Crossroads test page
85
88
 
86
- The `public/crossroads-test/` directory contains a demo giving page. The embed base URL and church slug are configurable via env vars:
89
+ The `public/crossroads-test/` directory contains a demo giving page. The embed base URL, church slug, and embed script URL are configurable via env vars and injected into the `*.template.html` files:
87
90
 
88
- - **Local dev:** Create `.env` in `apps/web-embeds-v2/` (see `.env.example`). Run `npm run inject-config` or `npm run dev` to generate `index.html` from the template.
89
- - **GitHub Pages:** Set `APOLLOS_EMBED_BASE_URL` and `APOLLOS_EMBED_CHURCH_SLUG` in repo Settings → Variables and secrets → Actions. The workflow deploys on push to `main` when crossroads-test files change. Enable Pages in Settings → Pages → Source: GitHub Actions. The same deploy publishes both `index.html` (giving page) and `giving-history.html` (giving history page with Recurring Gifts → modal); use `/` and `/giving-history.html` on your Pages URL.
91
+ - **Local dev:** Create `.env` in `apps/web-embeds-v2/` (see `.env.example`). Run `npm run inject-config` or `npm run dev` to generate `index.html` / `giving-history.html` from the templates. The generated `*.html` files are gitignored — only the `*.template.html` sources are committed.
92
+
93
+ ## Demo site (hosted)
94
+
95
+ The demo pages in `public/` are deployed to a persistent URL via **Vercel**, which also creates a preview deployment for every pull request that touches this app.
96
+
97
+ - **What's deployed:** the entire `public/` folder (so any file added there is picked up automatically) plus a fresh `dist/embed.js` built from that branch — so PR previews reflect the actual embed behavior of the change. The `crossroads-test` templates are injected at build time.
98
+ - **Build:** `yarn build:site` runs `inject-embed-config.js` → `vite build` → `scripts/build-demo-site.mjs`, which assembles the `site/` output directory (mirrors the dev-server layout: `public/` files at the web root, the widget at `/dist/embed.js`). `site/` is gitignored.
99
+ - **Pages:** `/` is a menu (`public/index.html`) linking to each demo — `/demo.html` (embed playground), `/crossroads-test/` (giving), `/crossroads-test/giving-history.html` (recurring gifts → modal). Add a link to the menu whenever you add a new host page to `public/`.
100
+
101
+ **One-time Vercel project setup** (dashboard, per the [Vercel monorepo docs](https://vercel.com/docs/monorepos)):
102
+
103
+ 1. **New Project** → import this repo → set **Root Directory** to `apps/web-embeds-v2`.
104
+ 2. Framework Preset: **Other** (build/install/output come from `vercel.json`).
105
+ 3. Add **Environment Variables** (Production + Preview):
106
+ - `APOLLOS_EMBED_BASE_URL` — the web-app origin the embeds point at (e.g. `https://apollos.app`)
107
+ - `APOLLOS_EMBED_CHURCH_SLUG` — demo church slug (e.g. `apollos-demo`)
108
+ - `APOLLOS_EMBED_SCRIPT_URL` — leave as `/dist/embed.js` to use the bundle built on this deploy, or set a CDN URL to pin a published version.
109
+ 4. Under Settings → Git, enable **"Only build when there are changes in the Root Directory"** so unrelated commits don't redeploy.
110
+
111
+ Production (the `main` branch) is the persistent URL; each PR gets its own preview URL commented on the PR.
112
+
113
+ > Note: `demo.html` / `search-demo.html` are dev harnesses that resolve the embedded web app from the page's own origin, so on the hosted site they'll only render fully against a same-origin backend. The `crossroads-test` pages are the fully-configured showcase (backend wired via the env vars above).
90
114
 
91
115
  ## Publishing
92
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollosproject/web-embeds",
3
- "version": "0.1.563",
3
+ "version": "0.1.564",
4
4
  "description": "Next-generation embeddable widget system for Apollos",
5
5
  "type": "module",
6
6
  "main": "./widget/embed.js",
@@ -19,6 +19,7 @@
19
19
  "inject-config": "node scripts/inject-embed-config.js",
20
20
  "dev": "node scripts/inject-embed-config.js && vite",
21
21
  "build": "tsc && vite build && node scripts/build.cjs",
22
+ "build:site": "node scripts/inject-embed-config.js && vite build && node scripts/build-demo-site.mjs",
22
23
  "preview": "vite preview",
23
24
  "type-check": "tsc --noEmit",
24
25
  "test": "vitest",