Repository navigation
docs(widget): publish an accurate integrator guide - #144
Merged
Merged
Conversation
The build emits `embed.js` (vite.config.ts `entryFileNames`), not `sahaj-atlas.js`, and r2wc dash-cases the `apiKey` prop to `api-key` — so copy-pasting the README's own snippet gave a host a 404 script tag followed by an attribute the element never observes. `README.md:183` already used `api-key`, so the file contradicted itself. Refs #93 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`docs/embedding.md` is now the host-facing reference: the snippet, all nine attributes, sizing in both modes, the URL shape and the foreign-anchor case, the complete CSP contract, the browser floor, the style-tag ids, privacy, the evergreen-update story and a troubleshooting table. Every claim is derived from the code it describes, and the two deploy-time values were read out of the LIVE bundle rather than guessed: the locale JSON is compiled to `https://sahajatlas.com/locales/` and the API to `https://cloud.sydevelopers.com/api`. That first one is the two-origin story — a host loading the script from `pages.dev` still fetches strings from `sahajatlas.com`, so `connect-src` needs it either way. Three CSP entries were missing everywhere and each one hard-breaks something: `connect-src` for SahajCloud (no data at all), `worker-src blob:` (mapbox-gl boots its worker from a blob: URL — verified in mapbox-gl 3.28.1), and `img-src data:` (the map ships its pins as inline SVG). `script-src api.mapbox.com` is added for the RTL-text plugin. `*.tiles.mapbox.com` is deliberately NOT listed — nothing in the shipped map library references it. The README's CSP section is replaced by a pointer rather than a second copy: a partial table beside a complete one is how the two drift. Its privacy section stays put and the guide links to it. demo.html's hardcoded api-key was dead — SahajCloud answers 403 to it, exactly as it does to no key at all, so the harness could not run and looked like a code failure. It is now a named placeholder pointing at VITE_SAHAJCLOUD_API_KEY. Closes #93 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
A host-visible change is not finished when the code lands — `docs/embedding.md` and `CHANGELOG.md` are the only documentation an embedding site ever reads, and the CSP table is the part that breaks silently: a new origin, a new `<style>` injection or a worker means somebody's policy has to grow, and they find out by their page going blank rather than by our build failing. Refs #93 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Deploying sahajatlas-design with
|
| Latest commit: |
d35bb4b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c3340598.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://docs-integrator-guide.sahajatlas-design.pages.dev |
Deploying sahajatlas with
|
| Latest commit: |
d35bb4b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5cdfe36d.sahajatlas.pages.dev |
| Branch Preview URL: | https://docs-integrator-guide.sahajatlas.pages.dev |
Every one of them was a **bold summary sentence**, not a table row — the confident generalisation is the thing this ticket exists to break, and the rows underneath were right in all five cases. - "Only Turnstile, ipwho.is and Sentry degrade gracefully" contradicted six of our own rows. A strict-CSP host reads that and over-allows, which is the exact cost for this audience. Replaced with the five genuinely load-bearing entries and "everything else costs only the feature in its row". - The `img-src` widget-origin row described a request that does not exist: the only images are CMS photography and the flags CDN, icons are inline SVG, and `bg-circle-pattern` is defined but never used so Tailwind emits nothing. Removed from the table and the policy block — an unjustifiable row teaches readers to skim the justified ones. - Mapbox and Swiper register no `@font-face` at all; we register three. That sentence was inherited verbatim from the old README, so it had been wrong as long as the broken snippet was. The true statement is stronger: they are named `Sahaj Raleway` rather than `Raleway` precisely so they cannot override a host that self-hosts Raleway, and `@font-face` is the one rule that cannot be scoped. - The doubled-script row had the wrong symptom. `customElements.get` makes the second copy a no-op and the widget renders normally, so a reader with a blank widget chased it and found nothing. Re-pointed at the console message, and it now says identical URLs are deduped by the module map — so the guard fires on the sahajatlas.com vs pages.dev mismatch this guide already warns about. - README said `*.ingest.sentry.io`, the precise pattern the guide flags as a silent-block trap, in the section that links to the guide for the full detail. Also: the locale precedence chain was missing `?locale=`; the browser table was missing iOS Safari 16.4; the Sentry payload also carries `navigator.userAgent`. The locale-JSON origin claim STANDS — it was read from the deployed bundle, not the local one — but now says it comes from `VITE_HOST` at build time and carries the two curl commands to re-verify it, so the next reader knows it is a deployment fact rather than a source fact. Refs #93 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Two conflicts, both from #146 editing the very sections this branch moved. README.md — #146 enriched the inline sizing section with #107's container-responsive behaviour; this branch had replaced that block with a pointer to docs/embedding.md. Kept the pointer, and ported #146's new facts INTO the guide's own "Sizing the element" section rather than dropping them: map-less now adapts to the element rather than the viewport, touch affordances deliberately follow the device instead, and map mode warns in the console when it is given a slot it cannot use. demo.html — #146 added the full-page-slot warning to the same comment where this branch replaced the dead API key with a placeholder. Kept both: the warning reads first, then the key instruction. The 1cf076ab literal stays gone; SahajCloud answers 403 to it, so restoring it would put the harness back to looking broken for a reason unrelated to the code under test. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This was referenced Aug 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #93.
The README's embed snippet was wrong on both of its lines, and had been for months: it named
sahaj-atlas.js(the build emitsembed.js) andapikey(r2wc dash-cases the prop, so the element only observesapi-key). A host copy-pasting it got a 404 script tag followed by an attribute that is never read — and then the "not set up correctly" screen.README.md:183already usedapi-key, so the file contradicted itself. That fix is the first commit, on its own.The rest publishes
docs/embedding.md, the host-facing reference the repo has never had.Everything is derived from the code, not from the ticket
Six waves of hardening landed since #93 was written, so the ticket and the readiness report are both stale in places. Every claim was checked against the source, and the two values that only exist at deploy time were read out of the live production bundle: locale JSON is compiled to
https://sahajatlas.com/locales/, and the API tohttps://cloud.sydevelopers.com/api.That first one is the two-origin story: a host loading the script from
pages.devstill fetches its strings fromsahajatlas.com, soconnect-srcneeds it either way. Blocked, every label renders as its raw dotted key — which reads like a broken translation, not a blocked request. The guide now also says that value comes fromVITE_HOSTat build time and carries the two curl commands to re-verify it, so the next reader knows it is a deployment fact rather than a source fact.The CSP contract, finished
The README's table covered Turnstile, Fathom, Sentry,
style-src 'unsafe-inline', self-hosted fonts and the flags CDN, and honestly said it "does not yet cover the map's own origins". It now does. Three entries were missing everywhere, and each one hard-breaks something:connect-src https://cloud.sydevelopers.comworker-src blob:URL.createObjectURL(new Blob(…)), verified in the installed source; there is no non-blob path in this buildimg-src data:Also added:
script-src https://api.mapbox.com(the RTL-text plugin, loaded on demand from inside the worker — workers inherit the document's policy) andevents.mapbox.com. Each row carries why and what a host sees when it's blocked.*.tiles.mapbox.comis deliberately NOT listed, though the readiness report and older Mapbox guidance name it: nothing in the shipped map library references that host. Listing origins we can't justify is how a table stops being read.Also in the guide
analytics,geolocationanderror-reportingarrived with fix(i18n): production hygiene for logging, locales, and storage #95/feat(widget): wire sentry into the error-reporting seam #108. Including the spelling rule that bites: only"false"and"0"disable, sogeolocation="no"does nothing.#/!/gb/londonis what hosts observe;#!/gb/londonis the boot spelling; both are accepted. The old "first Back press does nothing" caveat is gone, not documented — mount is areplaceStatenow.#respondputs the widget in memory routing. It renders fine, but its route isn't in the URL, so deep links out of it aren't shareable — and feat(widget): make memory-mode routing linkable where it matters #115's share block offers no link rather than the host's article URL.position: fixed; inset: 0and wants a full-page slot;map="false"collapses to zero height unless the host sizes it.<style id="sahaj-atlas-style">, sogetElementByIdfinds only the first. There is a second id too,sahaj-atlas-fonts. Neither fact was written down anywhere.Two deliberate calls
The README's CSP section is replaced by a pointer, not duplicated. A partial table beside a complete one is exactly how the two drift. Its privacy section stays where it is and the guide links to it.
demo.html's hardcodedapi-keywas dead — SahajCloud answers 403 to it, identically to sending no key at all (verified against the live API), so the harness could not run and failed in a way that looked like a code fault. It is now a named placeholder pointing atVITE_SAHAJCLOUD_API_KEY. The#respondanchor added in #92 is kept.Review: completed, five defects fixed
A correctness review ran over the whole diff after the PR was opened. It confirmed the attribute table, the sizing claims, the URL shape, the browser floor, the one-per-page rule and the storage table — and found six defects, five of them real. Every wrong claim was a bold summary sentence, not a table row; the rows underneath were right in all five cases, which is a useful thing to know about where this kind of doc rots.
ipwho.isand Sentry degrade gracefully"img-srcwidget-origin rowbg-circle-patternis defined but never used so Tailwind emits nothing. Removed from the table and the policy block.@font-facenames"Sahaj Ralewayrather thanRalewayprecisely so they cannot override a host that self-hosts Raleway.sahajatlas.comvspages.devmismatch.README.md:91*.ingest.sentry.io*.sentry.io.Also taken from its nits: the
localeprecedence chain was missing?locale=, the browser table was missing iOS Safari 16.4, and the Sentry payload also carriesnavigator.userAgent.The one finding not accepted was its CRITICAL on the locale-JSON origin, which argued
VITE_HOSTmight not besahajatlas.combecause the checked-indist/compileshttp://localhost:5173. That is a local build carrying the committed.env; the claim was made against the deployed bundle and re-confirmed. Its secondary suggestion was taken — the guide now says where the value comes from and how to re-verify it.Verification
pnpm buildrun to confirm the emitted filename really isdist/embed.jsat the root.embed.js; the deployed chunks were grepped for their baked-in origins; the demo key was tested against the real API.src/**and the installedmapbox-gl/r2wc.src/**changes — docs only, as the ticket requires.Could not be verified without a live deploy
Stated as conditional in the guide rather than asserted:
VITE_FATHOM_IDandVITE_SENTRY_DSN(both dashboard-set), so whether the Fathom and Sentry rows are live today*.sentry.ioand explains why*.ingest.sentry.iois a trap)script.jsimagedelivery.netas the image origin — CMS data, not pinned by the bundlestyle-src-attr: reasoned from source to be unnecessary, not browser-verified🤖 Generated with Claude Code