@popgrids/embed 0.0.7 → 0.0.8
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.
- package/AGENTS.md +9 -3
- package/dist/loader.js +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -133,13 +133,19 @@ through the monorepo's changesets flow; see "Releasing ui and embed" in the root
|
|
|
133
133
|
and `build` on every PR that touches it.
|
|
134
134
|
- The published package ships both entries: `.` (the library, deps external) and `./embed` /
|
|
135
135
|
`dist/embed.js` (the self-contained CDN bundle, also the `unpkg`/`jsdelivr` target), plus
|
|
136
|
-
`dist/loader.js`.
|
|
136
|
+
`dist/loader.js`. `pnpm run dev` doesn't rebuild the loader: it always points at the CDN, so
|
|
137
|
+
local demos load `dist/embed.js` directly.
|
|
137
138
|
- **Customer sites load releases from `cdn.popgrids.io`**, never from `main`. After a release,
|
|
138
139
|
`.github/workflows/embed-cdn.yml` copies the npm tarball's `embed.js`, its map and `loader.js` to
|
|
139
140
|
`embed/<version>/` in the `popgrids` R2 bucket (cached for a year), then that `loader.js` to
|
|
140
141
|
`embed.js` (cached 5 minutes). To roll back, run that workflow by hand with an earlier version
|
|
141
142
|
(0.0.7 or later; older releases have no loader). It uses the `CLOUDFLARE_R2_API_TOKEN` secret, an
|
|
142
|
-
R2 token scoped to the `popgrids` bucket
|
|
143
|
-
|
|
143
|
+
R2 token scoped to the `popgrids` bucket. That token can write anywhere in the bucket, which
|
|
144
|
+
also serves the marketing videos, so the workflow's object keys are fixed: `embed.js` and
|
|
145
|
+
`embed/<version>/`, nothing else.
|
|
146
|
+
- **CORS:** the loader loads the bundle as a cross-origin module, which browsers refuse without
|
|
147
|
+
`Access-Control-Allow-Origin`. A Transform Rule in the `popgrids.io` zone (Rules → Transform
|
|
148
|
+
Rules → Modify Response Header) sets `Access-Control-Allow-Origin: *` on `cdn.popgrids.io`
|
|
149
|
+
paths starting with `/embed`. Without it, every customer embed fails silently.
|
|
144
150
|
|
|
145
151
|
Issues, triage labels, domain docs, and Plan Mode are shared across the monorepo; see the root `AGENTS.md`.
|
package/dist/loader.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){var e=document.currentScript;if(e instanceof HTMLScriptElement&&e.dataset.key)if(e.closest(`head`))console.warn(`PopGrids: the embed script is in <head>, so there's nowhere to show the Grid. Move the script to where the Grid should appear, or add a <pop-grid> element there.`);else{let t=document.createElement(`pop-grid`);for(let{name:n,value:r}of Array.from(e.attributes))n.startsWith(`data-`)&&t.setAttribute(n,r);e.after(t)}
|
|
1
|
+
(function(){var e=document.currentScript;if(e instanceof HTMLScriptElement&&e.dataset.key)if(e.closest(`head`))console.warn(`PopGrids: the embed script is in <head>, so there's nowhere to show the Grid. Move the script to where the Grid should appear, or add a <pop-grid> element there.`);else{let t=document.createElement(`pop-grid`);for(let{name:n,value:r}of Array.from(e.attributes))n.startsWith(`data-`)&&t.setAttribute(n,r);e.after(t)}var t=new URL(`..`,`https://cdn.popgrids.io/embed/0.0.8/embed.js`).href;if(!customElements.get(`pop-grid`)&&!document.querySelector(`script[type="module"][src^="${t}"]`)){let e=document.createElement(`script`);e.type=`module`,e.src=`https://cdn.popgrids.io/embed/0.0.8/embed.js`,document.head.append(e)}})();
|