Repository navigation
Description
Summary
The host-facing documentation actively misleads integrators. The README's embed snippet fails on both of its two lines, the CSP guidance covers 3 directives when the real contract is ~a dozen (including the hardest ask, style-src 'unsafe-inline', which appears nowhere), no attribute reference exists (two of the six attributes are documented in no host-facing doc), and there is no sizing guidance, browser-support statement, privacy disclosure, or troubleshooting section. The closest thing to an integrator guide today is a comment block in demo.html. Fix the snippet and publish a dedicated, accurate integrator guide. (Release-readiness blockers 5 and 6.)
Current behavior
The README snippet is wrong twice (README.md:8-9):
<script type="module" src="https://sahajatlas.pages.dev/sahaj-atlas.js"></script>
<sahaj-atlas apikey="…"></sahaj-atlas>sahaj-atlas.jsdoes not exist — the build emitsembed.js(vite.config.ts:32-34:entryFileNamesreturns'embed.js'for the widget entry). Copy-paste yields a 404.apikeyis never observed — r2wc dash-cases theapiKeyprop toapi-key(src/Widget.tsx:104-111). A host that gets past the 404 lands on the "not set up correctly" config-error screen.demo.html:25has it right (<sahaj-atlas api-key="…">).
The CSP guidance documents 3 directives (README.md:15-37: script-src/frame-src for Turnstile, img-src for flags); the real contract compiled from code + the shipped bundle (readiness report §3.4) is:
| Directive | Values |
|---|---|
script-src |
widget origin; blob: (mapbox-gl workers); challenges.cloudflare.com (Turnstile); cdn.usefathom.com (only if built with Fathom) |
worker-src (+child-src) |
blob: |
style-src |
'unsafe-inline' (CSS-in-JS injection, no nonce — the hardest, currently undocumented ask) + fonts.googleapis.com (runtime @import) |
font-src |
fonts.gstatic.com |
img-src |
data: (marker sprites); blob:; api.mapbox.com; SahajCloud image origin(s) (cloud.sydevelopers.com / imagedelivery.net); react-circle-flags.pages.dev |
connect-src |
cloud.sydevelopers.com; sahajatlas.com (locale JSON — a different origin from the script); api.mapbox.com, events.mapbox.com, *.tiles.mapbox.com; ipwho.is; challenges.cloudflare.com; cdn.usefathom.com (conditional) |
frame-src |
challenges.cloudflare.com |
Only Turnstile degrades gracefully when blocked (mailto fallback); everything else fails blank or unstyled with no guidance.
Missing entirely from host-facing docs:
- Attribute reference — six attributes exist (
api-key,locale,map,base-path,primary-color,secondary-color;src/Widget.tsx:104-111);primary-color/secondary-colorappear in NO host-facing doc. - Sizing guidance — map mode renders
position: fixed; inset: 0, taking over the viewport regardless of the element's size, so it effectively requires a full-page slot (report §5);map="false"requires the host to size the element or it collapses to zero height (currently stated only in ademo.htmlcomment, lines 33-34). - Browser floor — the build targets Baseline Widely Available 2026-01-01: Chrome/Edge 111+, Firefox 114+, Safari 16.4+ (
vite.config.ts:20-23comment); stated nowhere host-facing. #anchor-conflict + history caveats — a pre-existing host#anchor(e.g.#respond,#comment-123) currently renders the widget blank (src/Widget.tsx:56-67; report blocker 2), and the mount-time hash write pushes one history entry. Both need documenting until fixed, and the guide's wording reconciled with whatever the sibling fix ships.- Privacy disclosures — Fathom analytics (if enabled in the build),
ipwho.isIP geolocation, i18next's defaultlocalStoragewrite, and the runtime Google Fonts@importare all undisclosed to hosts (report §3.5) — a GDPR exposure surface for EU clients. - The stable
sahaj-atlas-stylestyle-tag id as an integration point —vite.config.ts:10-16deliberately pinsattributes: { id: 'sahaj-atlas-style' }because "host sites key off this exact style-tag id", yet no host-facing doc mentions it. - Cache-skew note — a stale host-side-cached
embed.jsimports hashed chunk names the CDN no longer serves → hard 404, widget dead with no fallback (report §4). - Troubleshooting section and the
sahajatlas.comvssahajatlas.pages.devorigin story (locale JSON loads from a different origin than the script; the production bundle bakes insahajatlas.com).
Proposed changes
- Fix the
README.mdembed snippet:embed.js+api-key. - Add a dedicated integrator guide (suggest
docs/embedding.md— thedocs/directory does not exist yet — or a substantial README section, linked from the README either way) covering:- the correct embed snippet and the two-origin story (
sahajatlas.pages.dev/sahajatlas.com— script vs locale JSON), - a full attribute table for all six attributes (name, type, default, behavior — including
map="false"andbase-pathboot routes), - the complete CSP table above, with the reason per directive and which failures degrade gracefully vs fail blank,
- sizing guidance (map mode = full-page slot;
map="false"= host sizes the element,display:block;height:…), - the browser-support statement (Baseline 2026 floors),
- the
#anchor+ mount-time-history caveats, - privacy disclosures (Fathom, ipwho.is, localStorage, Google Fonts),
- the stable
sahaj-atlas-stylestyle-tag id, - the cache-skew note and pointer to the versioning story,
- a troubleshooting section (404 on script, config-error screen, blank widget on
#anchorURLs, unstyled/pinless widget under strict CSP, missing flags).
- the correct embed snippet and the two-origin story (
- Align
demo.html's comment block with the guide (point to it; remove now-duplicated caveats or keep them consistent).
Note on concurrent CSP changes: sibling release-hardening tickets may change the CSP origin set (self-hosting fonts would remove the two Google Fonts origins; an error reporter would add an ingest origin). This guide documents the current state; each origin-changing sibling carries its own criterion to update the table, and final reconciliation happens at merge.
Acceptance criteria
- The README embed snippet references
embed.jsand usesapi-key— copy-pasting it (with a real key) produces a working widget, not a 404 or the config-error screen - An integrator guide exists (e.g.
docs/embedding.md) and is linked from the README - Attribute table documents all six attributes from
src/Widget.tsx:104-111, includingprimary-colorandsecondary-color - The CSP section reproduces the full contract (every directive/value in the table above, matching what the current code actually requires — spot-check
style-src 'unsafe-inline',worker-src blob:, and thesahajatlas.comconnect-srcentry are present), and notes which blocked directives degrade gracefully vs fail blank - Sizing guidance covers both modes (map = full-page slot;
map="false"= host-sized element) - Browser floor stated (Chrome/Edge 111+, Firefox 114+, Safari 16.4+)
-
#anchor-conflict and mount-time history caveats documented - Privacy disclosures cover Fathom, ipwho.is, localStorage, and Google Fonts
- The
sahaj-atlas-stylestyle-tag id and the cache-skew failure mode are documented - A troubleshooting section maps the common failure symptoms to causes
-
demo.htmlcomments do not contradict the guide - No source (
src/**) changes — this ticket is docs-only - Lint + typecheck + test:run pass
- Write an implementation report to
.claude/reports/<issue-number>-<short-slug>.md— in the MAIN checkout at /Users/devindra/Documents/Projects/SahajAtlasWeb even when implementing from a worktree (the folder is gitignored) — covering what changed, what was deliberately NOT changed, and which readiness-report findings are resolved
Files affected
README.md(fix snippet, replace/expand the CSP section, link the guide)demo.html(align comments with the guide)docs/embedding.md(new — newdocs/directory)
Parallel implementation: this ticket OWNS the files listed above; sibling release-hardening tickets run concurrently — avoid edits outside owned files except strictly additive ones.
References
.claude/reports/RELEASE_READINESS.md§3.4 (full CSP table), §3.5 (privacy), §4 (cache skew), §5 (sizing), §9 (docs/monitoring), Appendix D; ship-blockers 5 and 6README.md:8-9(broken snippet),README.md:15-37(partial CSP)vite.config.ts:32-34(embed.jsentry name),vite.config.ts:10-16(sahaj-atlas-styleid),vite.config.ts:20-23(browser floor)src/Widget.tsx:104-111(the six r2wc props),src/Widget.tsx:56-67(hash mount guard)demo.html:25(correctapi-keyusage),demo.html:33-34(sizing note to be promoted)
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
Ardnived commentedon Aug 7, 2026
Correction from #92: the documented hash URL shape is wrong
While implementing #92 we pinned react-router's actual behaviour with a test that mounts a real
HashRouter(src/lib/shape/hash.router.test.tsx), and the URL shape this guide is meant to document is not what the readiness report (or this issue) assumed:#!/gb/london— that spelling is real, but transient.!to/!, so the address bar reads#/!/gb/london.So a host page — and anyone copying a link out of the address bar — will overwhelmingly see the
#/!/…form. The integrator guide should document#/!/…as the shape hosts will observe, note#!/…as the accepted boot/base-pathspelling, and avoid presenting either as the only form. Both are accepted on the way in (mountRoute,src/lib/shape/hash.ts).Two related behaviours to document, also from #92
#respond, the widget renders normally but routes in memory and writes nothing to the URL. Consequence worth stating plainly for integrators: in that mode the widget's internal route is not reflected in the address bar, so deep links out of the widget are not shareable from the URL bar on such a page.replaceState, absolutised against the current location so a host<base href>can't redirect it). The old "first Back press appears to do nothing" caveat is gone and should not be written into the guide.demo.htmlalso gained an#respondanchor target in #92 for manual verification — worth keeping when this ticket edits that file.chore(build): add a package version and a changelog (#143)
docs(widget): correct five claims the review caught
docs(widget): publish an accurate integrator guide (#144)