@wildo-ai/saas-website 1.1.7 → 1.1.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/dist/esm/astro/blog-post-bridge.d.ts.map +1 -1
- package/dist/esm/astro/blog-post-bridge.js.map +1 -1
- package/dist/esm/astro/blog-post-head.renderer.d.ts.map +1 -1
- package/dist/esm/astro/bridge-runtime.d.ts.map +1 -1
- package/dist/esm/astro/bridge-runtime.js.map +1 -1
- package/dist/esm/astro/collect-expected-label-keys.d.ts.map +1 -1
- package/dist/esm/astro/headers-renderer.d.ts.map +1 -1
- package/dist/esm/astro/i18n-routing.helper.d.ts.map +1 -1
- package/dist/esm/astro/label-pack-loader.d.ts.map +1 -1
- package/dist/esm/astro/label-pack-loader.js.map +1 -1
- package/dist/esm/astro/llms-txt-server.d.ts.map +1 -1
- package/dist/esm/astro/pick-labels-for-page.d.ts.map +1 -1
- package/dist/esm/astro/robots-renderer.d.ts.map +1 -1
- package/dist/esm/astro/robots-renderer.js.map +1 -1
- package/dist/esm/astro/sitemap-coverage.d.ts.map +1 -1
- package/dist/esm/astro/structured-data.renderer.d.ts.map +1 -1
- package/dist/esm/astro/website-page-head.renderer.d.ts.map +1 -1
- package/dist/esm/astro/website-page-head.renderer.js.map +1 -1
- package/dist/esm/astro/website-page-runtime.helper.d.ts.map +1 -1
- package/dist/esm/astro/website-site-context.d.ts.map +1 -1
- package/dist/esm/astro/website-site-context.js.map +1 -1
- package/dist/esm/astro-island.d.ts.map +1 -1
- package/dist/esm/astro.d.ts.map +1 -1
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/components/low-level/WebsiteInternalButton.d.ts.map +1 -1
- package/dist/esm/components/low-level/WebsiteInternalLink.d.ts.map +1 -1
- package/dist/esm/config/define-website-config.d.ts.map +1 -1
- package/dist/esm/config/define-website-config.js.map +1 -1
- package/dist/esm/config/index.d.ts.map +1 -1
- package/dist/esm/config/load-website-config.d.ts.map +1 -1
- package/dist/esm/config/load-website-config.js.map +1 -1
- package/dist/esm/config/load-website-pricing-catalog.d.ts.map +1 -1
- package/dist/esm/config/load-website-pricing-catalog.js.map +1 -1
- package/dist/esm/config/load-website-site-context.d.ts.map +1 -1
- package/dist/esm/config/load-website-site-context.js.map +1 -1
- package/dist/esm/config/wildo-website-config.schemas.d.ts.map +1 -1
- package/dist/esm/config-loader.d.ts.map +1 -1
- package/dist/esm/config-loader.js.map +1 -1
- package/dist/esm/core/anonymous-session/InboundContactForm.d.ts.map +1 -1
- package/dist/esm/core/anonymous-session/InboundContactForm.js.map +1 -1
- package/dist/esm/core/anonymous-session/inbound-contact-form.schema.d.ts.map +1 -1
- package/dist/esm/core/anonymous-session/inbound-contact-form.schema.js.map +1 -1
- package/dist/esm/core/anonymous-session/website-anonymous-session-client.d.ts.map +1 -1
- package/dist/esm/core/anonymous-session/website-anonymous-session-client.js.map +1 -1
- package/dist/esm/core/anonymous-session/website-submission-challenge.d.ts.map +1 -1
- package/dist/esm/core/anonymous-session/website-submission-challenge.js.map +1 -1
- package/dist/esm/core/consent/WebsiteConsentBanner.d.ts.map +1 -1
- package/dist/esm/core/consent/WebsiteConsentBanner.js.map +1 -1
- package/dist/esm/core/consent/WebsiteConsentContext.d.ts.map +1 -1
- package/dist/esm/core/consent/WebsiteConsentGate.d.ts.map +1 -1
- package/dist/esm/core/consent/useWebsiteConsent.d.ts.map +1 -1
- package/dist/esm/core/consent/website-consent-storage.d.ts.map +1 -1
- package/dist/esm/core/contexts/WebsitePageContext.d.ts.map +1 -1
- package/dist/esm/core/contexts/WebsiteRuntimeContext.d.ts.map +1 -1
- package/dist/esm/core/contexts/WebsiteRuntimeContext.js.map +1 -1
- package/dist/esm/core/contexts/WebsiteSectionContext.d.ts.map +1 -1
- package/dist/esm/core/contexts/useWebsitePage.d.ts.map +1 -1
- package/dist/esm/core/contexts/useWebsiteRuntime.d.ts.map +1 -1
- package/dist/esm/core/contexts/useWebsiteRuntime.js.map +1 -1
- package/dist/esm/core/contexts/useWebsiteSection.d.ts.map +1 -1
- package/dist/esm/core/external-providers/WebsiteProviderComponent.d.ts.map +1 -1
- package/dist/esm/core/external-providers/WebsiteProviderComponent.js.map +1 -1
- package/dist/esm/core/external-providers/frontend-provider-registry.website.d.ts.map +1 -1
- package/dist/esm/core/external-providers/provider-component-registry.website.d.ts.map +1 -1
- package/dist/esm/core/external-providers/provider-component-registry.website.js.map +1 -1
- package/dist/esm/core/external-providers/useWebsiteProviderComponent.d.ts.map +1 -1
- package/dist/esm/core/external-providers/useWebsiteProviderComponent.js.map +1 -1
- package/dist/esm/core/external-providers/useWebsiteProviderScripts.d.ts.map +1 -1
- package/dist/esm/core/external-providers/useWebsiteProviderScripts.js.map +1 -1
- package/dist/esm/core/external-providers/website-provider-sdk-activations.d.ts.map +1 -1
- package/dist/esm/core/external-providers/website-provider-sdk-activations.js.map +1 -1
- package/dist/esm/core/factories/define-website-page-manifest.d.ts.map +1 -1
- package/dist/esm/core/factories/define-website-section.d.ts.map +1 -1
- package/dist/esm/core/factories/define-website-section.js.map +1 -1
- package/dist/esm/core/hooks/useWebsiteDesignTokens.d.ts.map +1 -1
- package/dist/esm/core/hooks/useWebsiteLabel.d.ts.map +1 -1
- package/dist/esm/core/layouts/WebsitePageLayout.d.ts.map +1 -1
- package/dist/esm/core/layouts/WebsitePageLayout.js.map +1 -1
- package/dist/esm/core/layouts/WebsiteSection.d.ts.map +1 -1
- package/dist/esm/core/routing/internal-routing.utils.d.ts.map +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/mdx/BlogPost.d.ts.map +1 -1
- package/dist/esm/mdx/blog-post-collection.config.d.ts.map +1 -1
- package/dist/esm/mdx/blog-post-frontmatter-source.d.ts.map +1 -1
- package/dist/esm/mdx/index.d.ts.map +1 -1
- package/dist/esm/mdx.d.ts.map +1 -1
- package/dist/esm/schemas/blog/blog-post-frontmatter.shared.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/design-tokens/website-design-tokens.shared.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/design-tokens/website-design-tokens.shared.schemas.js.map +1 -1
- package/dist/esm/schemas/label-keys/website-consent-label-keys.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/label-keys/website-label-key.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/label-keys/website-provider-component-label-keys.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/label-keys/website-provider-component-label-keys.schemas.js.map +1 -1
- package/dist/esm/schemas/manifests/website-page-manifest.shared.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.d.ts +3 -3
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/manifests/website-root-config.shared.schemas.js.map +1 -1
- package/dist/esm/schemas/refs/page-ref.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/refs/section-ref.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/sections/website-section-category.shared.d.ts.map +1 -1
- package/dist/esm/schemas/sections/website-section-definition.shared.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/sections/website-section-definition.shared.schemas.js.map +1 -1
- package/dist/esm/schemas/structured-data/pricing-offer-structured-data.shared.d.ts.map +1 -1
- package/dist/esm/schemas/structured-data/pricing-offer-structured-data.shared.js.map +1 -1
- package/dist/esm/schemas/structured-data/structured-data-reconciliation.shared.d.ts.map +1 -1
- package/dist/esm/schemas/structured-data/structured-data-reconciliation.shared.js.map +1 -1
- package/dist/esm/schemas/structured-data/website-structured-data.shared.schemas.d.ts.map +1 -1
- package/dist/esm/schemas/structured-data/website-structured-data.shared.schemas.js.map +1 -1
- package/dist/esm/schemas/validators/label-pack.validator.d.ts.map +1 -1
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website-submission-challenge.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"website-submission-challenge.js","sourceRoot":"","sources":["../../../../../src/core/anonymous-session/website-submission-challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,2BAA2B,EAC3B,uCAAuC,EACvC,8BAA8B,EAC9B,+BAA+B,EAC/B,iCAAiC,EACjC,qBAAqB,EACrB,yBAAyB,GAG1B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,gCAAgC,EAAE,MAAM,wDAAwD,CAAC;AAC1G,OAAO,EAAE,4BAA4B,EAAsC,MAAM,oCAAoC,CAAC;AAWtH,mHAAmH;AACnH,MAAM,UAAU,mCAAmC;IACjD,wHAAwH;IACxH,MAAM,OAAO,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,gCAAgC,EAAE,CAAC;IACnD,MAAM,eAAe,GAAG,OAAO,EAAE,wBAAwB,EAAE,gCAAgC,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,KAAK,SAAS,CAAC;IACxJ,OAAO,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,QAAQ,CAAC,2BAA2B,CAAC,gBAAgB,CAAC;eACpH,qBAAqB,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,OAAO;YACL,eAAe;YACf,GAAG,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,MAA6B,EAAE,EAAE,CAAC;SACnJ,CAAC;IACJ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AI,KAAK,8BAA8B,CAAC,OAAO,CAAC;AAC7G,CAAC;AACD,+DAA+D","sourcesContent":["/**\n * The answer a public website form sends with its submission when the application protects it with a captcha (#1735), to\n * any operation that declares a submission challenge (#1985).\n *\n * Two answers, one header (`x-submission-challenge-response`), chosen in the visitor's browser:\n *\n * - the consented captcha vendor's TOKEN, when its browser part is running on the page (it starts only once the\n * visitor grants the purpose the vendor rests on — Google reCAPTCHA rests on ANALYTICS);\n * - otherwise the engine's PROOF OF WORK: a challenge fetched from the backend and solved here. Consent-exempt —\n * nothing is stored in the browser and nothing reaches a third party — so a visitor who declined still submits.\n *\n * The backend requires one of the two whenever it declares a captcha provider, and refuses a submission with neither.\n * A site that declares none sends nothing. A refused vendor token is retried ONCE with the proof of work (a low score or\n * an unreachable vendor must not lock a real person out); see {@link isSubmissionChallengeRefusal}.\n */\nimport { useContext, useMemo } from 'react';\nimport {\n BUILTIN_PROVIDER_CAPABILITY,\n SUBMISSION_CHALLENGE_PROOF_OF_WORK_PATH,\n SubmissionChallengeRefusalCode,\n SubmissionChallengeResponseKind,\n encodeSubmissionChallengeResponse,\n isFrontendCaptchaSink,\n solveProofOfWorkChallenge,\n type FrontendCaptchaSink,\n type ProofOfWorkChallenge,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport { WebsiteRuntimeContext } from '../contexts/WebsiteRuntimeContext';\nimport { useWebsiteProviderSdkActivations } from '../external-providers/website-provider-sdk-activations';\nimport { WebsiteAnonymousRequestError, type WebsiteAnonymousSessionClient } from './website-anonymous-session-client';\n\n/** @wildo_source:part:start saas.website.submission-challenge facet:layer:frontend facet:audience:app-developer */\n/** What a form knows about the page's captcha when it submits. */\nexport interface WebsiteSubmissionChallengeSource {\n /** This website declares a captcha provider, so its public forms answer a challenge. */\n readonly captchaDeclared: boolean;\n /** The captcha vendor RUNNING on the page — present only once the visitor consented and it started. */\n readonly runningCaptcha?: { readonly providerRef: string; readonly sink: FrontendCaptchaSink };\n}\n\n/** The challenge source of the current page: its declared captcha provider and, if started, its running client. */\nexport function useWebsiteSubmissionChallengeSource(): WebsiteSubmissionChallengeSource {\n // Read without `useWebsiteRuntime`'s throw: a form rendered outside a page (a test, a storybook) simply has no captcha.\n const runtime = useContext(WebsiteRuntimeContext);\n const running = useWebsiteProviderSdkActivations();\n const captchaDeclared = runtime?.frontendProviderRegistry?.findProviderByProviderCapability(BUILTIN_PROVIDER_CAPABILITY.FRONTEND_CAPTCHA) !== undefined;\n return useMemo(() => {\n const captcha = running.find((entry) => entry.providerCapabilities.includes(BUILTIN_PROVIDER_CAPABILITY.FRONTEND_CAPTCHA)\n && isFrontendCaptchaSink(entry.activation.handle));\n return {\n captchaDeclared,\n ...(captcha === undefined ? {} : { runningCaptcha: { providerRef: captcha.providerRef, sink: captcha.activation.handle as FrontendCaptchaSink } }),\n };\n }, [captchaDeclared, running]);\n}\n\n/**\n * The encoded answer to send, or `undefined` when this site asks for none. `proofOfWorkOnly` skips the vendor (the\n * retry after a refused token). Throws only when the proof-of-work challenge cannot be fetched or solved; the caller\n * then shows its ordinary failure and does not submit unanswered (`InboundContactForm` shows its `errorMessage`).\n */\nexport async function obtainSubmissionChallengeAnswer(params: {\n readonly source: WebsiteSubmissionChallengeSource;\n /**\n * The action the operation the form posts to DECLARES in its `submissionChallenge` (#1985): the engine's\n * `SubmissionChallengeAction.INBOUND_CONTACT` for `/inbound-contacts`, your own action for your own operation. A token\n * minted for any other action is refused.\n */\n readonly action: string;\n readonly client: Pick<WebsiteAnonymousSessionClient, 'getPublic'>;\n readonly proofOfWorkOnly?: boolean;\n readonly signal?: AbortSignal;\n}): Promise<string | undefined> {\n const { source, action, client, proofOfWorkOnly = false, signal } = params;\n if (!proofOfWorkOnly && source.runningCaptcha !== undefined) {\n const token = await source.runningCaptcha.sink.execute(action);\n if (token !== undefined) {\n return encodeSubmissionChallengeResponse({\n kind: SubmissionChallengeResponseKind.PROVIDER_TOKEN,\n providerRef: source.runningCaptcha.providerRef,\n token,\n });\n }\n }\n if (!source.captchaDeclared && !proofOfWorkOnly) return undefined;\n const challenge = await client.getPublic<ProofOfWorkChallenge>(SUBMISSION_CHALLENGE_PROOF_OF_WORK_PATH);\n const answer = await solveProofOfWorkChallenge(challenge, { signal });\n if (answer === undefined) throw new Error('The proof-of-work challenge could not be solved.');\n return encodeSubmissionChallengeResponse(answer);\n}\n\n/** Whether a failed submission was refused at its challenge — the one refusal a form answers again, with the proof of work. */\nexport function isSubmissionChallengeRefusal(error: unknown): boolean {\n if (!(error instanceof WebsiteAnonymousRequestError)) return false;\n const code = error.errorCode;\n return code === SubmissionChallengeRefusalCode.REQUIRED || code === SubmissionChallengeRefusalCode.REFUSED;\n}\n/** @wildo_source:part:end saas.website.submission-challenge */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteConsentBanner.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsiteConsentBanner.d.ts","sourceRoot":"","sources":["../../../../../src/core/consent/WebsiteConsentBanner.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAyF1E,wBAAgB,oBAAoB,IAAI,SAAS,CAyHhD;AAED,sGAAsG;AACtG,wBAAgB,4BAA4B,IAAI,SAAS,CAQxD;AACD,yDAAyD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteConsentBanner.js","sourceRoot":"","sources":["../../../../src/core/consent/WebsiteConsentBanner.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAG1E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kEAAkE,CAAC;AAC5G,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC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@wildo-ai/saas-models/public-runtime';\n\nimport { websiteDesignTokenCssVar } from '../../schemas/design-tokens/website-design-tokens.shared.schemas';\nimport { useWebsiteLabelByKey } from '../hooks/useWebsiteLabel';\nimport { WebsiteConsentStatus } from './WebsiteConsentContext';\nimport { useWebsiteConsent } from './useWebsiteConsent';\nimport {\n WebsiteConsentLabelSlot,\n websiteConsentLabelKey,\n websiteConsentPurposeDescriptionLabelKey,\n websiteConsentPurposeLabelKey,\n} from '../../schemas/label-keys/website-consent-label-keys.schemas';\n\n/**\n * @wildo_source:part:start saas.website.consent.banner facet:layer:core facet:family:website\n *\n * `WebsiteConsentBanner` — the framework's default visitor consent panel (#534).\n *\n * Rendered by `WebsitePageLayout` when the site runs a consent-based provider and the visitor has not\n * decided, or re-opened the panel. A site replaces it by passing `consentBannerComponent` to its bridge\n * island; a replacement reads `useWebsiteConsent()` exactly as this one does and must keep its three\n * properties:\n *\n * 1. **No box is pre-ticked.** A pre-ticked box is not a choice.\n * 2. **Declining is as easy as accepting**, and is RECORDED — so the panel does not return on every page.\n * 3. **Only purposes in use are offered** (`purposesInUse`), each named by its label.\n *\n * Styled only through the site's `--website-*` design tokens, like the skip link, so it needs no\n * stylesheet and cannot be shadowed by a utility class.\n */\nfunction useWebsiteConsentSlotLabel(slot: WebsiteConsentLabelSlot): string {\n return useWebsiteLabelByKey(websiteConsentLabelKey(slot));\n}\n\n/**\n * Every row has the SAME shape: the control, then the name on its line, then the explanation beneath\n * the NAME rather than beneath the control — a two-column grid, so the second line starts where the\n * first line's words do and the row stays scannable.\n *\n * That includes the row that cannot be changed, which carries a real checkbox, CHECKED and DISABLED,\n * rather than a text status. A person scanning the panel reads DOWN the column of controls, and a row\n * whose control is missing does not read as \"cannot be changed\" — it reads as a row that was\n * forgotten. A checked, disabled box says it in the vocabulary the rest of the list already uses, and\n * a screen reader announces \"checked, unavailable\" without any extra words.\n */\nconst ROW_STYLE: React.CSSProperties = {\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n columnGap: '0.625rem',\n alignItems: 'center',\n padding: '0.5rem 0.75rem',\n borderBottom: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n};\n\nconst ROW_DESCRIPTION_STYLE: React.CSSProperties = { margin: 0, gridColumn: 2, fontSize: '0.75rem', opacity: 0.8 };\n\n/** Slightly larger than a default box: this is the one control the whole panel exists to offer. */\nconst ROW_CONTROL_STYLE: React.CSSProperties = { width: '1.15rem', height: '1.15rem' };\n\n/**\n * One purpose: its NAME, what agreeing to it MEANS for this visitor, and the control.\n *\n * The explanation is the half that was missing. A tick box labelled \"Analytics\" is a category, not\n * something a visitor can weigh, and consent is only valid if it is informed — which is why every\n * specialized consent platform pairs the two and why the label key is derived from the vocabulary,\n * so a purpose can never arrive with a name and no explanation.\n */\nfunction PurposeChoice({ purpose, checked, onChange }: { purpose: ConsentPurpose; checked: boolean; onChange: (checked: boolean) => void }): ReactNode {\n const label = useWebsiteLabelByKey(websiteConsentPurposeLabelKey(purpose));\n const description = useWebsiteLabelByKey(websiteConsentPurposeDescriptionLabelKey(purpose));\n return (\n <label data-website-consent-purpose={purpose} style={{ ...ROW_STYLE, cursor: 'pointer' }}>\n <input type=\"checkbox\" checked={checked} style={ROW_CONTROL_STYLE} onChange={(event) => onChange(event.target.checked)} />\n <span style={{ fontWeight: 600 }}>{label}</span>\n <span style={ROW_DESCRIPTION_STYLE}>{description}</span>\n </label>\n );\n}\n\nconst BUTTON_STYLE: React.CSSProperties = {\n padding: '0.5rem 1rem',\n borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem'),\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n background: websiteDesignTokenCssVar('colors', 'background', '#fff'),\n color: websiteDesignTokenCssVar('colors', 'foreground', '#000'),\n cursor: 'pointer',\n};\n\nexport function WebsiteConsentBanner(): ReactNode {\n const consent = useWebsiteConsent();\n const headingId = useId();\n const [selected, setSelected] = useState<readonly ConsentPurpose[]>(consent.grantedPurposes);\n // Re-seed from the stored decision each time the panel is re-opened, so it shows what is in force.\n useEffect(() => setSelected(consent.grantedPurposes), [consent.grantedPurposes, consent.isSettingsOpen]);\n\n const title = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.TITLE);\n const description = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.DESCRIPTION);\n const acceptAll = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.ACCEPT_ALL);\n const declineAll = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.DECLINE_ALL);\n const save = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.SAVE);\n const essentialTitle = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.ESSENTIAL_TITLE);\n const essentialDescription = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.ESSENTIAL_DESCRIPTION);\n\n const offered = consent.purposesInUse;\n // Purposes the panel does not offer keep their stored grant; offered ones are granted exactly when ticked.\n const choose = (chosen: readonly ConsentPurpose[]): void =>\n consent.decide([...consent.grantedPurposes.filter((purpose) => !offered.includes(purpose)), ...chosen]);\n\n return (\n <section\n role=\"region\"\n aria-labelledby={headingId}\n data-website-consent-banner={consent.status === WebsiteConsentStatus.UNDECIDED ? 'undecided' : 'settings'}\n style={{\n /*\n * BOTTOM-RIGHT CORNER, and the three properties together are what make that work on a phone\n * too. `left` and `right` both bound the box to the viewport with a gutter; `maxWidth` caps it\n * on a wide screen; `marginLeft: auto` pushes the remaining slack to the left so the box hugs\n * the right edge. On a narrow screen the gutters bind before the cap does and it simply spans\n * the width — a corner popup that overflowed a phone would be worse than a bar.\n *\n * Inline styles, not a media query: this ships into a static marketing page with no stylesheet\n * of its own, which is the same constraint that keeps the rest of this file inline.\n */\n position: 'fixed',\n left: '1rem',\n right: '1rem',\n bottom: '1rem',\n zIndex: 9000,\n maxWidth: '30rem',\n marginLeft: 'auto',\n /*\n * The panel never exceeds the viewport, and its ACTIONS are never what gets cut off: the rows\n * scroll inside `maxHeight`, the buttons sit outside that box. A panel that grows with its\n * content pushes accept and reject off the bottom of a short screen — and a refusal that\n * cannot be reached is a refusal that was not offered, whatever the markup says. `dvh` rather\n * than `vh` because a mobile browser's toolbars make `vh` taller than the visible page.\n */\n maxHeight: '85dvh',\n padding: '0.875rem 1rem',\n display: 'flex',\n flexDirection: 'column',\n gap: '0.625rem',\n background: websiteDesignTokenCssVar('colors', 'surface', '#fff'),\n color: websiteDesignTokenCssVar('colors', 'surfaceForeground', '#000'),\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n borderRadius: websiteDesignTokenCssVar('radii', 'lg', '0.5rem'),\n }}\n >\n <h2 id={headingId} style={{ margin: 0, fontSize: '1.125rem' }}>{title}</h2>\n <p style={{ margin: 0 }}>{description}</p>\n {/* `data-website-consent-rows` is the scroll box's own hook. A test anchoring on a style\n substring instead matched the ROW (whose grid template also contains \"auto\") and asserted\n nothing — the same vacuous pin the app tier already had to repair. */}\n <div\n data-website-consent-rows=\"\"\n style={{ minHeight: 0, flex: 1, overflowY: 'auto', border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`, borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem') }}\n >\n {/*\n * The always-active row, first, carrying a CHECKED and DISABLED box. It is not a purpose the\n * visitor decides — which is exactly why it is stated: a panel listing only the optional\n * purposes leaves them unable to see what is happening on the site at all, which is the\n * question they opened it to answer.\n *\n * It carried a text status instead until 2026-09-20, on the argument that a disabled control\n * invites a click that cannot work. The reversal: a visitor scans DOWN the column of boxes,\n * and a gap there does not read as \"cannot be changed\", it reads as a row that was\n * forgotten. A disabled box says it in the vocabulary the rest of the list already uses.\n */}\n <div data-website-consent-essential=\"\" style={ROW_STYLE}>\n {/*\n * `aria-label`, because this row is a `div` rather than a `<label>` — nothing else names\n * the control, and a checkbox with no accessible name is announced as an unlabelled\n * checkbox. Its own note claimed AT would announce \"checked, unavailable\"; it announced\n * no words at all.\n *\n * `readOnly` is gone: it is inert on a checkbox per HTML, and leaving it invites a later\n * reader to delete `disabled` believing the lock survives.\n */}\n <input type=\"checkbox\" checked disabled aria-label={essentialTitle} style={ROW_CONTROL_STYLE} />\n <span style={{ fontWeight: 600 }}>{essentialTitle}</span>\n <span style={ROW_DESCRIPTION_STYLE}>{essentialDescription}</span>\n </div>\n {offered.map((purpose) => (\n <PurposeChoice\n key={purpose}\n purpose={purpose}\n checked={selected.includes(purpose)}\n onChange={(checked) => setSelected((current) => (checked ? [...current.filter((entry) => entry !== purpose), purpose] : current.filter((entry) => entry !== purpose)))}\n />\n ))}\n </div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem', justifyContent: 'flex-end' }}>\n <button type=\"button\" style={BUTTON_STYLE} onClick={() => choose([])}>{declineAll}</button>\n {/*\n * SAVE appears only when a MIXED choice exists to save — two or more purposes in use.\n *\n * With one purpose the button is unanswerable: \"decline all\" and \"accept all\" already cover\n * the whole space, so a third action beside them describes nothing a visitor can picture and\n * reads as a question rather than an answer. Derived from the offered set, so a site that\n * adds a second purpose gets the control with no edit here.\n */}\n {offered.length > 1 && (\n <button type=\"button\" style={BUTTON_STYLE} onClick={() => choose(selected.filter((purpose) => offered.includes(purpose)))}>{save}</button>\n )}\n <button type=\"button\" style={BUTTON_STYLE} onClick={() => choose(offered)}>{acceptAll}</button>\n </div>\n </section>\n );\n}\n\n/** The reopen affordance: always reachable once a visitor decided, so every choice can be changed. */\nexport function WebsiteConsentSettingsButton(): ReactNode {\n const consent = useWebsiteConsent();\n const manage = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.MANAGE);\n return (\n <button type=\"button\" data-website-consent-manage=\"\" style={BUTTON_STYLE} onClick={consent.openSettings}>\n {manage}\n </button>\n );\n}\n/** @wildo_source:part:end saas.website.consent.banner */\n"]}
|
|
1
|
+
{"version":3,"file":"WebsiteConsentBanner.js","sourceRoot":"","sources":["../../../../../src/core/consent/WebsiteConsentBanner.tsx"],"names":[],"mappings":";AAAA,OAAc,EA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AAG,0BAA0B,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;IAC1E,OAAO,CACL,iBAAQ,IAAI,EAAC,QAAQ,iCAA6B,EAAE,EAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,YACpG,MAAM,GACA,CACV,CAAC;AACJ,CAAC","sourcesContent":["import React, { useEffect, useId, useState, type ReactNode } from 'react';\nimport type { ConsentPurpose } from '@wildo-ai/saas-models/public-runtime';\n\nimport { websiteDesignTokenCssVar } from '../../schemas/design-tokens/website-design-tokens.shared.schemas';\nimport { useWebsiteLabelByKey } from '../hooks/useWebsiteLabel';\nimport { WebsiteConsentStatus } from './WebsiteConsentContext';\nimport { useWebsiteConsent } from './useWebsiteConsent';\nimport {\n WebsiteConsentLabelSlot,\n websiteConsentLabelKey,\n websiteConsentPurposeDescriptionLabelKey,\n websiteConsentPurposeLabelKey,\n} from '../../schemas/label-keys/website-consent-label-keys.schemas';\n\n/**\n * @wildo_source:part:start saas.website.consent.banner facet:layer:core facet:family:website\n *\n * `WebsiteConsentBanner` — the framework's default visitor consent panel (#534).\n *\n * Rendered by `WebsitePageLayout` when the site runs a consent-based provider and the visitor has not\n * decided, or re-opened the panel. A site replaces it by passing `consentBannerComponent` to its bridge\n * island; a replacement reads `useWebsiteConsent()` exactly as this one does and must keep its three\n * properties:\n *\n * 1. **No box is pre-ticked.** A pre-ticked box is not a choice.\n * 2. **Declining is as easy as accepting**, and is RECORDED — so the panel does not return on every page.\n * 3. **Only purposes in use are offered** (`purposesInUse`), each named by its label.\n *\n * Styled only through the site's `--website-*` design tokens, like the skip link, so it needs no\n * stylesheet and cannot be shadowed by a utility class.\n */\nfunction useWebsiteConsentSlotLabel(slot: WebsiteConsentLabelSlot): string {\n return useWebsiteLabelByKey(websiteConsentLabelKey(slot));\n}\n\n/**\n * Every row has the SAME shape: the control, then the name on its line, then the explanation beneath\n * the NAME rather than beneath the control — a two-column grid, so the second line starts where the\n * first line's words do and the row stays scannable.\n *\n * That includes the row that cannot be changed, which carries a real checkbox, CHECKED and DISABLED,\n * rather than a text status. A person scanning the panel reads DOWN the column of controls, and a row\n * whose control is missing does not read as \"cannot be changed\" — it reads as a row that was\n * forgotten. A checked, disabled box says it in the vocabulary the rest of the list already uses, and\n * a screen reader announces \"checked, unavailable\" without any extra words.\n */\nconst ROW_STYLE: React.CSSProperties = {\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n columnGap: '0.625rem',\n alignItems: 'center',\n padding: '0.5rem 0.75rem',\n borderBottom: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n};\n\nconst ROW_DESCRIPTION_STYLE: React.CSSProperties = { margin: 0, gridColumn: 2, fontSize: '0.75rem', opacity: 0.8 };\n\n/** Slightly larger than a default box: this is the one control the whole panel exists to offer. */\nconst ROW_CONTROL_STYLE: React.CSSProperties = { width: '1.15rem', height: '1.15rem' };\n\n/**\n * One purpose: its NAME, what agreeing to it MEANS for this visitor, and the control.\n *\n * The explanation is the half that was missing. A tick box labelled \"Analytics\" is a category, not\n * something a visitor can weigh, and consent is only valid if it is informed — which is why every\n * specialized consent platform pairs the two and why the label key is derived from the vocabulary,\n * so a purpose can never arrive with a name and no explanation.\n */\nfunction PurposeChoice({ purpose, checked, onChange }: { purpose: ConsentPurpose; checked: boolean; onChange: (checked: boolean) => void }): ReactNode {\n const label = useWebsiteLabelByKey(websiteConsentPurposeLabelKey(purpose));\n const description = useWebsiteLabelByKey(websiteConsentPurposeDescriptionLabelKey(purpose));\n return (\n <label data-website-consent-purpose={purpose} style={{ ...ROW_STYLE, cursor: 'pointer' }}>\n <input type=\"checkbox\" checked={checked} style={ROW_CONTROL_STYLE} onChange={(event) => onChange(event.target.checked)} />\n <span style={{ fontWeight: 600 }}>{label}</span>\n <span style={ROW_DESCRIPTION_STYLE}>{description}</span>\n </label>\n );\n}\n\nconst BUTTON_STYLE: React.CSSProperties = {\n padding: '0.5rem 1rem',\n borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem'),\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n background: websiteDesignTokenCssVar('colors', 'background', '#fff'),\n color: websiteDesignTokenCssVar('colors', 'foreground', '#000'),\n cursor: 'pointer',\n};\n\nexport function WebsiteConsentBanner(): ReactNode {\n const consent = useWebsiteConsent();\n const headingId = useId();\n const [selected, setSelected] = useState<readonly ConsentPurpose[]>(consent.grantedPurposes);\n // Re-seed from the stored decision each time the panel is re-opened, so it shows what is in force.\n useEffect(() => setSelected(consent.grantedPurposes), [consent.grantedPurposes, consent.isSettingsOpen]);\n\n const title = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.TITLE);\n const description = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.DESCRIPTION);\n const acceptAll = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.ACCEPT_ALL);\n const declineAll = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.DECLINE_ALL);\n const save = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.SAVE);\n const essentialTitle = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.ESSENTIAL_TITLE);\n const essentialDescription = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.ESSENTIAL_DESCRIPTION);\n\n const offered = consent.purposesInUse;\n // Purposes the panel does not offer keep their stored grant; offered ones are granted exactly when ticked.\n const choose = (chosen: readonly ConsentPurpose[]): void =>\n consent.decide([...consent.grantedPurposes.filter((purpose) => !offered.includes(purpose)), ...chosen]);\n\n return (\n <section\n role=\"region\"\n aria-labelledby={headingId}\n data-website-consent-banner={consent.status === WebsiteConsentStatus.UNDECIDED ? 'undecided' : 'settings'}\n style={{\n /*\n * BOTTOM-RIGHT CORNER, and the three properties together are what make that work on a phone\n * too. `left` and `right` both bound the box to the viewport with a gutter; `maxWidth` caps it\n * on a wide screen; `marginLeft: auto` pushes the remaining slack to the left so the box hugs\n * the right edge. On a narrow screen the gutters bind before the cap does and it simply spans\n * the width — a corner popup that overflowed a phone would be worse than a bar.\n *\n * Inline styles, not a media query: this ships into a static marketing page with no stylesheet\n * of its own, which is the same constraint that keeps the rest of this file inline.\n */\n position: 'fixed',\n left: '1rem',\n right: '1rem',\n bottom: '1rem',\n zIndex: 9000,\n maxWidth: '30rem',\n marginLeft: 'auto',\n /*\n * The panel never exceeds the viewport, and its ACTIONS are never what gets cut off: the rows\n * scroll inside `maxHeight`, the buttons sit outside that box. A panel that grows with its\n * content pushes accept and reject off the bottom of a short screen — and a refusal that\n * cannot be reached is a refusal that was not offered, whatever the markup says. `dvh` rather\n * than `vh` because a mobile browser's toolbars make `vh` taller than the visible page.\n */\n maxHeight: '85dvh',\n padding: '0.875rem 1rem',\n display: 'flex',\n flexDirection: 'column',\n gap: '0.625rem',\n background: websiteDesignTokenCssVar('colors', 'surface', '#fff'),\n color: websiteDesignTokenCssVar('colors', 'surfaceForeground', '#000'),\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n borderRadius: websiteDesignTokenCssVar('radii', 'lg', '0.5rem'),\n }}\n >\n <h2 id={headingId} style={{ margin: 0, fontSize: '1.125rem' }}>{title}</h2>\n <p style={{ margin: 0 }}>{description}</p>\n {/* `data-website-consent-rows` is the scroll box's own hook. A test anchoring on a style\n substring instead matched the ROW (whose grid template also contains \"auto\") and asserted\n nothing — the same vacuous pin the app tier already had to repair. */}\n <div\n data-website-consent-rows=\"\"\n style={{ minHeight: 0, flex: 1, overflowY: 'auto', border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`, borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem') }}\n >\n {/*\n * The always-active row, first, carrying a CHECKED and DISABLED box. It is not a purpose the\n * visitor decides — which is exactly why it is stated: a panel listing only the optional\n * purposes leaves them unable to see what is happening on the site at all, which is the\n * question they opened it to answer.\n *\n * It carried a text status instead until 2026-09-20, on the argument that a disabled control\n * invites a click that cannot work. The reversal: a visitor scans DOWN the column of boxes,\n * and a gap there does not read as \"cannot be changed\", it reads as a row that was\n * forgotten. A disabled box says it in the vocabulary the rest of the list already uses.\n */}\n <div data-website-consent-essential=\"\" style={ROW_STYLE}>\n {/*\n * `aria-label`, because this row is a `div` rather than a `<label>` — nothing else names\n * the control, and a checkbox with no accessible name is announced as an unlabelled\n * checkbox. Its own note claimed AT would announce \"checked, unavailable\"; it announced\n * no words at all.\n *\n * `readOnly` is gone: it is inert on a checkbox per HTML, and leaving it invites a later\n * reader to delete `disabled` believing the lock survives.\n */}\n <input type=\"checkbox\" checked disabled aria-label={essentialTitle} style={ROW_CONTROL_STYLE} />\n <span style={{ fontWeight: 600 }}>{essentialTitle}</span>\n <span style={ROW_DESCRIPTION_STYLE}>{essentialDescription}</span>\n </div>\n {offered.map((purpose) => (\n <PurposeChoice\n key={purpose}\n purpose={purpose}\n checked={selected.includes(purpose)}\n onChange={(checked) => setSelected((current) => (checked ? [...current.filter((entry) => entry !== purpose), purpose] : current.filter((entry) => entry !== purpose)))}\n />\n ))}\n </div>\n <div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem', justifyContent: 'flex-end' }}>\n <button type=\"button\" style={BUTTON_STYLE} onClick={() => choose([])}>{declineAll}</button>\n {/*\n * SAVE appears only when a MIXED choice exists to save — two or more purposes in use.\n *\n * With one purpose the button is unanswerable: \"decline all\" and \"accept all\" already cover\n * the whole space, so a third action beside them describes nothing a visitor can picture and\n * reads as a question rather than an answer. Derived from the offered set, so a site that\n * adds a second purpose gets the control with no edit here.\n */}\n {offered.length > 1 && (\n <button type=\"button\" style={BUTTON_STYLE} onClick={() => choose(selected.filter((purpose) => offered.includes(purpose)))}>{save}</button>\n )}\n <button type=\"button\" style={BUTTON_STYLE} onClick={() => choose(offered)}>{acceptAll}</button>\n </div>\n </section>\n );\n}\n\n/** The reopen affordance: always reachable once a visitor decided, so every choice can be changed. */\nexport function WebsiteConsentSettingsButton(): ReactNode {\n const consent = useWebsiteConsent();\n const manage = useWebsiteConsentSlotLabel(WebsiteConsentLabelSlot.MANAGE);\n return (\n <button type=\"button\" data-website-consent-manage=\"\" style={BUTTON_STYLE} onClick={consent.openSettings}>\n {manage}\n </button>\n );\n}\n/** @wildo_source:part:end saas.website.consent.banner */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteConsentContext.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsiteConsentContext.d.ts","sourceRoot":"","sources":["../../../../../src/core/consent/WebsiteConsentContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA4D,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAS3E;;;;;;;;;;;;;GAaG;AACH,oBAAY,oBAAoB;IAC9B,6FAA6F;IAC7F,SAAS,cAAc;IACvB,8EAA8E;IAC9E,OAAO,YAAY;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,oBAAoB,CAAC;IAC7B;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB,uDAAuD;IACvD,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qFAAqF;IACrF,aAAa,EAAE,SAAS,cAAc,EAAE,CAAC;IACzC,iFAAiF;IACjF,cAAc,EAAE,OAAO,CAAC;IACxB,oCAAoC;IACpC,UAAU,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC;IACjD,qGAAqG;IACrG,MAAM,EAAE,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,KAAK,IAAI,CAAC;IAC7D,kEAAkE;IAClE,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,yDAAyD;IACzD,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAA0D,CAAC;AAE9I;;;;;;;GAOG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;;;;OASG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACjF;AAED,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,SAAS,cAAc,EAAE,CAAC;IACzC;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,sBAAsB,CAAC;IAClC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,2BAA2B,GAAG,SAAS,CAkEpH;AACD,0DAA0D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteConsentGate.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsiteConsentGate.d.ts","sourceRoot":"","sources":["../../../../../src/core/consent/WebsiteConsentGate.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAI3E;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,uBAAuB;IACtC,oEAAoE;IACpE,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,qGAAqG;IACrG,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,kBAAkB,CAAC,EAAE,OAAO,EAAE,QAAe,EAAE,QAAQ,EAAE,EAAE,uBAAuB,GAAG,SAAS,CAI7G;AACD,uDAAuD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteConsent.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteConsent.d.ts","sourceRoot":"","sources":["../../../../../src/core/consent/useWebsiteConsent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAyB,KAAK,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAEjG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,CAM9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website-consent-storage.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"website-consent-storage.d.ts","sourceRoot":"","sources":["../../../../../src/core/consent/website-consent-storage.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EAGf,MAAM,sCAAsC,CAAC;AA+B9C,4DAA4D;AAC5D,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IACpD,mHAAmH;IACnH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,6BAA6B,kCAAkC,CAAC;AAW7E,8EAA8E;AAC9E,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,OAAO,GAAG,IAAuB,GAAG,2BAA2B,GAAG,IAAI,CAkBxH;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,GAAG,GAAE,IAAiB,EACtB,OAAO,GAAE,OAAO,GAAG,IAAuB,GACzC,2BAA2B,CAc7B;AAED,gHAAgH;AAChH,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAW/E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsitePageContext.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsitePageContext.d.ts","sourceRoot":"","sources":["../../../../../src/core/contexts/WebsitePageContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAE1E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,OAAO,EAAE,cAAc,CAAC;CACzB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,OAAO,CAAC,uBAAuB,GAAG,IAAI,CACxB,CAAC;AAEtD,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,uBAAuB,CAAC;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,0BAA0B,CAAC,EACzC,KAAK,EACL,QAAQ,GACT,EAAE,+BAA+B,GAAG,SAAS,CAM7C;yBATe,0BAA0B;;;AAW1C,uDAAuD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteRuntimeContext.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsiteRuntimeContext.d.ts","sourceRoot":"","sources":["../../../../../src/core/contexts/WebsiteRuntimeContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjF,OAAO,KAAK,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEpG,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kEAAkE,CAAC;AAC5G,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,0DAA0D,CAAC;AAChH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,2DAA2D,CAAC;AAClH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAC1F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4DAA4D,CAAC;AAC1G,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2DG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;;;;;;;;OASG;IACH,aAAa,EAAE,iBAAiB,CAAC;IACjC;;;;;;;;;;;;;;;;;;OAkBG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;;;OAMG;IACH,UAAU,EAAE,uBAAuB,CAAC;IACpC;;;;;;;;;;;;;;;OAeG;IACH,yBAAyB,EAAE,eAAe,CAAC;IAC3C;;;;;OAKG;IACH,wBAAwB,CAAC,EAAE,+BAA+B,CAAC;IAC3D;;;;;;OAMG;IACH,yBAAyB,CAAC,EAAE,gCAAgC,CAAC;IAC7D;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,aAAa,CAAC;IACvC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;OASG;IACH,cAAc,CAAC,EAAE,oBAAoB,CAAC;CACvC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAC3B,CAAC;AAEzD,MAAM,WAAW,kCAAkC;IACjD,KAAK,EAAE,0BAA0B,CAAC;IAClC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,KAAK,EACL,QAAQ,GACT,EAAE,kCAAkC,GAAG,SAAS,CAMhD;yBATe,6BAA6B;;;AAW7C,0DAA0D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteRuntimeContext.js","sourceRoot":"","sources":["../../../../src/core/contexts/WebsiteRuntimeContext.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAsC,MAAM,OAAO,CAAC;AAqMjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAChC,aAAa,CAAoC,IAAI,CAAC,CAAC;AAOzD;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,EAC5C,KAAK,EACL,QAAQ,GAC2B;IACnC,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC;AACD,6BAA6B,CAAC,WAAW,GAAG,+BAA+B,CAAC","sourcesContent":["import React, { createContext, type ComponentType, type ReactNode } from 'react';\n\nimport type { AvailableLanguage, PublicPricingCatalog } from '@wildo-ai/saas-models/public-runtime';\n\nimport type { WebsiteDesignTokens } from '../../schemas/design-tokens/website-design-tokens.shared.schemas';\nimport type { FrontendWebsiteProviderRegistry } from '../external-providers/frontend-provider-registry.website';\nimport type { WebsiteProviderComponentRegistry } from '../external-providers/provider-component-registry.website';\nimport type { WebsiteLabelKey } from '../../schemas/label-keys/website-label-key.schemas';\nimport type { WebsiteNavigationConfig } from '../../schemas/manifests/website-root-config.shared.schemas';\nimport type { LabelPack } from '../../schemas/validators/label-pack.validator';\n\n/**\n * @wildo_source:part:start saas.website.runtime.context facet:layer:core facet:family:website\n *\n * `WebsiteRuntimeContext` — site-wide runtime state for the marketing\n * surface. Created **once per page render** by the host adapter: the\n * page's `.astro` frontmatter loads the site context and the resolved label\n * pack, and its bridge island (`createWebsitePageBridgeIsland`) calls\n * `<WebsiteRuntimeContextProvider value={…}>` around the page tree.\n *\n * **Why \"runtime\" and not \"config\"**: the values here are the\n * locale-resolved subset of `WebsiteRootConfig` — only the active\n * locale's label pack travels with the React tree (the other locales\n * live in their own per-locale static builds). A `*Config` name would\n * suggest the full multi-locale surface is in scope.\n *\n * **Three pieces of state**:\n *\n * - `locale` — the currently-rendering locale. Sections that need\n * locale-aware formatting (number/date in marketing copy is rare\n * but legitimate) read it via `useWebsiteRuntime()`.\n * - `labelPack` — the locale-resolved flat key→string map, validated\n * against the manifest by `validateLabelPackAgainstManifest` at\n * build start. Consumed by `useWebsiteLabel` and\n * `useWebsiteLabelByKey`.\n * - `designTokens` — the `WebsiteDesignTokens` from\n * `WebsiteRootConfig.designTokens`. Consumed by\n * `useWebsiteDesignTokens` and by the Phase 5 CSS emitter that\n * materializes them as `--website-*` custom properties on the\n * `<WebsitePageLayout>` root.\n * - `navigation` — the `WebsiteNavigationConfig` from\n * `WebsiteRootConfig.navigation`. Carried in the runtime context\n * (rather than as a separate `WebsiteNavigationContext`) because\n * `<WebsitePageLayout>` already reads runtime state and\n * header/footer slots are inseparable from \"the site is rendering\n * right now\". A second context for two component refs would split\n * the host-adapter's wiring surface without buying isolation.\n * - `frontendProviderRegistry` — optional website-facing public provider\n * registry hydrated from the materialized provider artifact for the\n * concrete `STATIC_WEBSITE` service. This keeps analytics / captcha /\n * browser-monitoring integrations on the same frontend-provider\n * contract the SaaS app now uses, instead of inventing a website-only\n * metadata seam.\n *\n * **Why the hook lives in a separate file**: React Fast Refresh only\n * preserves state for a module whose every export is a component, so\n * a module mixing components with plain functions loses its HMR\n * boundary. This file holds the two things that must be identical\n * objects at runtime — the context and the provider component that\n * writes it — while `useWebsiteRuntime` sits alone in\n * `useWebsiteRuntime.ts`. A section author editing a component that\n * merely READS the runtime therefore never remounts the provider.\n *\n * Until 2026-09-09 this paragraph described a different arrangement:\n * that only the bare context was kept here and the provider lived in\n * a file of its own. No such file has ever existed — the provider is\n * exported below — and splitting it out would be the wrong shape\n * anyway, since `useContext` matches on object identity.\n * prose-referent-waiver: the retired file name is quoted only to retire it.\n * The claim named `WebsiteRuntimeContextProvider.tsx`.\n */\nexport interface WebsiteRuntimeContextValue {\n /**\n * The currently-rendering locale. Marketing-site routing emits one\n * static build per locale (D8), so this value is constant per build\n * — never re-renders mid-session.\n */\n locale: AvailableLanguage;\n /**\n * The site's default locale (mirrors `WebsiteRootConfig.defaultLocale`).\n * Carried in the runtime context so client-tier components — namely\n * `WebsiteInternalLink` (Phase 6 fix H-β) — can compute the correct\n * locale-prefixed pathname (`/pricing` on the EN site,\n * `/fr/pricing` on the FR site) without re-importing the root\n * config. Plumbing it through the runtime keeps the routing rule\n * a framework-internal concern: section authors NEVER hand-prefix\n * paths.\n */\n defaultLocale: AvailableLanguage;\n /**\n * Origin of the application this marketing site sends visitors INTO — the\n * marketing → product handoff target, authored once as\n * `WildoMarketingWebsiteConfig.appOrigin` (#493).\n *\n * Carried here for exactly the reason `defaultLocale` above is: a\n * `wildo.website.config.ts` is Node-loaded and therefore invisible to a\n * client island, so before this a site resolved the app origin a SECOND\n * time from a public build-time environment variable it could read in the\n * browser — one host authored twice, in two files, with no mechanical link\n * between the copies. That is how a marketing site comes to point at the\n * wrong environment: a defect nobody notices until a customer follows the\n * link.\n *\n * Threading it through the runtime keeps the handoff a framework-internal\n * concern, the same way threading `defaultLocale` kept locale-prefixing one:\n * section authors never hand-assemble the product URL, and there is one\n * place to change it.\n */\n appOrigin?: string;\n /**\n * Flat `Record<string, string>` label pack for the active locale.\n * Lookup keys MUST be fully-composed `website.<page>.<section>.<slot>`\n * strings; consumers that hold leaf paths use `useWebsiteLabel(leaf)`\n * which composes the full key against the page+section context.\n */\n labelPack: LabelPack;\n /**\n * Design-token bundle for the active site. Same object referenced\n * by `WebsiteRootConfig.designTokens`; passed by reference (not\n * cloned) so token-aware components can rely on referential\n * stability across renders.\n */\n designTokens: WebsiteDesignTokens;\n /**\n * Site-wide navigation slot bindings (header / footer components).\n * Same object referenced by `WebsiteRootConfig.navigation`. Read\n * by `<WebsitePageLayout>` to render the chrome around each page's\n * `<main>` content; per-page `header` / `footer` props on\n * `<WebsitePageLayout>` override these defaults.\n */\n navigation: WebsiteNavigationConfig;\n /**\n * Fully-composed label key the framework reads to render the\n * \"Skip to main content\" affordance as the FIRST focusable element\n * on every page (Phase 6 third audit fix M-α). Mirrors\n * `WebsiteRootConfig.skipToMainContentLabelKey`. Carried in the\n * runtime context (NOT re-derived from the root config inside\n * `WebsitePageLayout`) for two reasons:\n * - The layout is a client-tier React component; it cannot import\n * the consumer's `WEBSITE_ROOT_CONFIG` symbol without dragging\n * server-only code (manifest registry, page components) into\n * the client bundle.\n * - Threading the key through the runtime keeps the layout's\n * contract symmetric with how every other localized text on the\n * page is sourced (label pack + key), so the skip link is\n * translated automatically without any per-locale branching.\n */\n skipToMainContentLabelKey: WebsiteLabelKey;\n /**\n * Website-facing public providers for the active static website\n * service. Optional so older tests and provider-free sites can omit\n * it, but when present it is the canonical frontend-safe provider\n * catalog for analytics / captcha / browser-monitoring slices.\n */\n frontendProviderRegistry?: FrontendWebsiteProviderRegistry;\n /**\n * Components the live providers contribute, keyed `capability:providerRef` (#1703) — the same\n * registry the application builds, from the same `components` declaration. Built by the page bridge\n * once per island from `frontendProviderRegistry`; read through `useWebsiteProviderComponent` and\n * rendered by `WebsiteProviderComponent`. Optional for the same reason as the registry above: a\n * provider-free site, or a test runtime, has none, and every slot then renders nothing.\n */\n providerComponentRegistry?: WebsiteProviderComponentRegistry;\n /**\n * Replaces the framework's visitor consent panel (#534). Reads `useWebsiteConsent()`; see\n * `WebsiteConsentBanner` for the three properties a replacement must keep. Absent uses the default.\n * Closed over by the bridge rather than passed as an island prop, like `navigation`, because a\n * component cannot cross Astro's serialization boundary.\n */\n consentBannerComponent?: ComponentType;\n /**\n * Backend API origin (WITHOUT a trailing slash) that anonymous-capture\n * sections POST to when constructing a `WebsiteAnonymousSessionClient`\n * (lead / draft-note forms). Sourced from\n * `WildoMarketingWebsiteConfig.apiOrigin` and passed as a\n * JSON-serializable island prop (the `.astro` page resolves the\n * per-environment value and forwards it).\n *\n * Optional because only pages that host an anonymous-capture section\n * need it — brochure pages omit it. A capture section that reads\n * `undefined` here surfaces a loud misconfiguration rather than\n * silently failing to submit.\n */\n apiOrigin?: string;\n /**\n * The application's public pricing catalogue (#1835), derived at build time from the billing\n * catalogue the backend sells from — so a pricing section states the prices the application\n * actually charges instead of a hand copy of them. Node-loaded\n * (`loadWebsitePricingCatalog` on `/config-loader`) and carried as an island prop for the\n * reason `appOrigin` above is. Read it with `useWebsitePricingCatalog()`.\n *\n * Optional because only pricing pages need it; a section that reads it on a page that did not\n * pass it fails loudly rather than rendering no plans.\n */\n pricingCatalog?: PublicPricingCatalog;\n}\n\n/**\n * Bare React context. Default `null` — `useWebsiteRuntime()` throws\n * with a clear error message when invoked outside of\n * `<WebsiteRuntimeContextProvider>`. The defensive throw is preferred\n * over a silent default value so a missing provider is detected at\n * the first hook call rather than at render time when a missing\n * label silently renders as the key string.\n */\nexport const WebsiteRuntimeContext: React.Context<WebsiteRuntimeContextValue | null> =\n createContext<WebsiteRuntimeContextValue | null>(null);\n\nexport interface WebsiteRuntimeContextProviderProps {\n value: WebsiteRuntimeContextValue;\n children: ReactNode;\n}\n\n/**\n * Provider component. Authored as a thin wrapper so consumers do NOT\n * have to import `WebsiteRuntimeContext.Provider` directly — the\n * provider component carries the documented authoring API and is the\n * Fast-Refresh-stable surface section authors compose against.\n */\nexport function WebsiteRuntimeContextProvider({\n value,\n children,\n}: WebsiteRuntimeContextProviderProps): ReactNode {\n return (\n <WebsiteRuntimeContext.Provider value={value}>\n {children}\n </WebsiteRuntimeContext.Provider>\n );\n}\nWebsiteRuntimeContextProvider.displayName = 'WebsiteRuntimeContextProvider';\n/** @wildo_source:part:end saas.website.runtime.context */\n"]}
|
|
1
|
+
{"version":3,"file":"WebsiteRuntimeContext.js","sourceRoot":"","sources":["../../../../../src/core/contexts/WebsiteRuntimeContext.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,aAAa,EAAsC,MAAM,OAAO,CAAC;AAqMjF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAChC,aAAa,CAAoC,IAAI,CAAC,CAAC;AAOzD;;;;;GAKG;AACH,MAAM,UAAU,6BAA6B,CAAC,EAC5C,KAAK,EACL,QAAQ,GAC2B;IACnC,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC;AACD,6BAA6B,CAAC,WAAW,GAAG,+BAA+B,CAAC","sourcesContent":["import React, { createContext, type ComponentType, type ReactNode } from 'react';\n\nimport type { AvailableLanguage, PublicPricingCatalog } from '@wildo-ai/saas-models/public-runtime';\n\nimport type { WebsiteDesignTokens } from '../../schemas/design-tokens/website-design-tokens.shared.schemas';\nimport type { FrontendWebsiteProviderRegistry } from '../external-providers/frontend-provider-registry.website';\nimport type { WebsiteProviderComponentRegistry } from '../external-providers/provider-component-registry.website';\nimport type { WebsiteLabelKey } from '../../schemas/label-keys/website-label-key.schemas';\nimport type { WebsiteNavigationConfig } from '../../schemas/manifests/website-root-config.shared.schemas';\nimport type { LabelPack } from '../../schemas/validators/label-pack.validator';\n\n/**\n * @wildo_source:part:start saas.website.runtime.context facet:layer:core facet:family:website\n *\n * `WebsiteRuntimeContext` — site-wide runtime state for the marketing\n * surface. Created **once per page render** by the host adapter: the\n * page's `.astro` frontmatter loads the site context and the resolved label\n * pack, and its bridge island (`createWebsitePageBridgeIsland`) calls\n * `<WebsiteRuntimeContextProvider value={…}>` around the page tree.\n *\n * **Why \"runtime\" and not \"config\"**: the values here are the\n * locale-resolved subset of `WebsiteRootConfig` — only the active\n * locale's label pack travels with the React tree (the other locales\n * live in their own per-locale static builds). A `*Config` name would\n * suggest the full multi-locale surface is in scope.\n *\n * **Three pieces of state**:\n *\n * - `locale` — the currently-rendering locale. Sections that need\n * locale-aware formatting (number/date in marketing copy is rare\n * but legitimate) read it via `useWebsiteRuntime()`.\n * - `labelPack` — the locale-resolved flat key→string map, validated\n * against the manifest by `validateLabelPackAgainstManifest` at\n * build start. Consumed by `useWebsiteLabel` and\n * `useWebsiteLabelByKey`.\n * - `designTokens` — the `WebsiteDesignTokens` from\n * `WebsiteRootConfig.designTokens`. Consumed by\n * `useWebsiteDesignTokens` and by the Phase 5 CSS emitter that\n * materializes them as `--website-*` custom properties on the\n * `<WebsitePageLayout>` root.\n * - `navigation` — the `WebsiteNavigationConfig` from\n * `WebsiteRootConfig.navigation`. Carried in the runtime context\n * (rather than as a separate `WebsiteNavigationContext`) because\n * `<WebsitePageLayout>` already reads runtime state and\n * header/footer slots are inseparable from \"the site is rendering\n * right now\". A second context for two component refs would split\n * the host-adapter's wiring surface without buying isolation.\n * - `frontendProviderRegistry` — optional website-facing public provider\n * registry hydrated from the materialized provider artifact for the\n * concrete `STATIC_WEBSITE` service. This keeps analytics / captcha /\n * browser-monitoring integrations on the same frontend-provider\n * contract the SaaS app now uses, instead of inventing a website-only\n * metadata seam.\n *\n * **Why the hook lives in a separate file**: React Fast Refresh only\n * preserves state for a module whose every export is a component, so\n * a module mixing components with plain functions loses its HMR\n * boundary. This file holds the two things that must be identical\n * objects at runtime — the context and the provider component that\n * writes it — while `useWebsiteRuntime` sits alone in\n * `useWebsiteRuntime.ts`. A section author editing a component that\n * merely READS the runtime therefore never remounts the provider.\n *\n * Until 2026-09-09 this paragraph described a different arrangement:\n * that only the bare context was kept here and the provider lived in\n * a file of its own. No such file has ever existed — the provider is\n * exported below — and splitting it out would be the wrong shape\n * anyway, since `useContext` matches on object identity.\n * prose-referent-waiver: the retired file name is quoted only to retire it.\n * The claim named `WebsiteRuntimeContextProvider.tsx`.\n */\nexport interface WebsiteRuntimeContextValue {\n /**\n * The currently-rendering locale. Marketing-site routing emits one\n * static build per locale (D8), so this value is constant per build\n * — never re-renders mid-session.\n */\n locale: AvailableLanguage;\n /**\n * The site's default locale (mirrors `WebsiteRootConfig.defaultLocale`).\n * Carried in the runtime context so client-tier components — namely\n * `WebsiteInternalLink` (Phase 6 fix H-β) — can compute the correct\n * locale-prefixed pathname (`/pricing` on the EN site,\n * `/fr/pricing` on the FR site) without re-importing the root\n * config. Plumbing it through the runtime keeps the routing rule\n * a framework-internal concern: section authors NEVER hand-prefix\n * paths.\n */\n defaultLocale: AvailableLanguage;\n /**\n * Origin of the application this marketing site sends visitors INTO — the\n * marketing → product handoff target, authored once as\n * `WildoMarketingWebsiteConfig.appOrigin` (#493).\n *\n * Carried here for exactly the reason `defaultLocale` above is: a\n * `wildo.website.config.ts` is Node-loaded and therefore invisible to a\n * client island, so before this a site resolved the app origin a SECOND\n * time from a public build-time environment variable it could read in the\n * browser — one host authored twice, in two files, with no mechanical link\n * between the copies. That is how a marketing site comes to point at the\n * wrong environment: a defect nobody notices until a customer follows the\n * link.\n *\n * Threading it through the runtime keeps the handoff a framework-internal\n * concern, the same way threading `defaultLocale` kept locale-prefixing one:\n * section authors never hand-assemble the product URL, and there is one\n * place to change it.\n */\n appOrigin?: string;\n /**\n * Flat `Record<string, string>` label pack for the active locale.\n * Lookup keys MUST be fully-composed `website.<page>.<section>.<slot>`\n * strings; consumers that hold leaf paths use `useWebsiteLabel(leaf)`\n * which composes the full key against the page+section context.\n */\n labelPack: LabelPack;\n /**\n * Design-token bundle for the active site. Same object referenced\n * by `WebsiteRootConfig.designTokens`; passed by reference (not\n * cloned) so token-aware components can rely on referential\n * stability across renders.\n */\n designTokens: WebsiteDesignTokens;\n /**\n * Site-wide navigation slot bindings (header / footer components).\n * Same object referenced by `WebsiteRootConfig.navigation`. Read\n * by `<WebsitePageLayout>` to render the chrome around each page's\n * `<main>` content; per-page `header` / `footer` props on\n * `<WebsitePageLayout>` override these defaults.\n */\n navigation: WebsiteNavigationConfig;\n /**\n * Fully-composed label key the framework reads to render the\n * \"Skip to main content\" affordance as the FIRST focusable element\n * on every page (Phase 6 third audit fix M-α). Mirrors\n * `WebsiteRootConfig.skipToMainContentLabelKey`. Carried in the\n * runtime context (NOT re-derived from the root config inside\n * `WebsitePageLayout`) for two reasons:\n * - The layout is a client-tier React component; it cannot import\n * the consumer's `WEBSITE_ROOT_CONFIG` symbol without dragging\n * server-only code (manifest registry, page components) into\n * the client bundle.\n * - Threading the key through the runtime keeps the layout's\n * contract symmetric with how every other localized text on the\n * page is sourced (label pack + key), so the skip link is\n * translated automatically without any per-locale branching.\n */\n skipToMainContentLabelKey: WebsiteLabelKey;\n /**\n * Website-facing public providers for the active static website\n * service. Optional so older tests and provider-free sites can omit\n * it, but when present it is the canonical frontend-safe provider\n * catalog for analytics / captcha / browser-monitoring slices.\n */\n frontendProviderRegistry?: FrontendWebsiteProviderRegistry;\n /**\n * Components the live providers contribute, keyed `capability:providerRef` (#1703) — the same\n * registry the application builds, from the same `components` declaration. Built by the page bridge\n * once per island from `frontendProviderRegistry`; read through `useWebsiteProviderComponent` and\n * rendered by `WebsiteProviderComponent`. Optional for the same reason as the registry above: a\n * provider-free site, or a test runtime, has none, and every slot then renders nothing.\n */\n providerComponentRegistry?: WebsiteProviderComponentRegistry;\n /**\n * Replaces the framework's visitor consent panel (#534). Reads `useWebsiteConsent()`; see\n * `WebsiteConsentBanner` for the three properties a replacement must keep. Absent uses the default.\n * Closed over by the bridge rather than passed as an island prop, like `navigation`, because a\n * component cannot cross Astro's serialization boundary.\n */\n consentBannerComponent?: ComponentType;\n /**\n * Backend API origin (WITHOUT a trailing slash) that anonymous-capture\n * sections POST to when constructing a `WebsiteAnonymousSessionClient`\n * (lead / draft-note forms). Sourced from\n * `WildoMarketingWebsiteConfig.apiOrigin` and passed as a\n * JSON-serializable island prop (the `.astro` page resolves the\n * per-environment value and forwards it).\n *\n * Optional because only pages that host an anonymous-capture section\n * need it — brochure pages omit it. A capture section that reads\n * `undefined` here surfaces a loud misconfiguration rather than\n * silently failing to submit.\n */\n apiOrigin?: string;\n /**\n * The application's public pricing catalogue (#1835), derived at build time from the billing\n * catalogue the backend sells from — so a pricing section states the prices the application\n * actually charges instead of a hand copy of them. Node-loaded\n * (`loadWebsitePricingCatalog` on `/config-loader`) and carried as an island prop for the\n * reason `appOrigin` above is. Read it with `useWebsitePricingCatalog()`.\n *\n * Optional because only pricing pages need it; a section that reads it on a page that did not\n * pass it fails loudly rather than rendering no plans.\n */\n pricingCatalog?: PublicPricingCatalog;\n}\n\n/**\n * Bare React context. Default `null` — `useWebsiteRuntime()` throws\n * with a clear error message when invoked outside of\n * `<WebsiteRuntimeContextProvider>`. The defensive throw is preferred\n * over a silent default value so a missing provider is detected at\n * the first hook call rather than at render time when a missing\n * label silently renders as the key string.\n */\nexport const WebsiteRuntimeContext: React.Context<WebsiteRuntimeContextValue | null> =\n createContext<WebsiteRuntimeContextValue | null>(null);\n\nexport interface WebsiteRuntimeContextProviderProps {\n value: WebsiteRuntimeContextValue;\n children: ReactNode;\n}\n\n/**\n * Provider component. Authored as a thin wrapper so consumers do NOT\n * have to import `WebsiteRuntimeContext.Provider` directly — the\n * provider component carries the documented authoring API and is the\n * Fast-Refresh-stable surface section authors compose against.\n */\nexport function WebsiteRuntimeContextProvider({\n value,\n children,\n}: WebsiteRuntimeContextProviderProps): ReactNode {\n return (\n <WebsiteRuntimeContext.Provider value={value}>\n {children}\n </WebsiteRuntimeContext.Provider>\n );\n}\nWebsiteRuntimeContextProvider.displayName = 'WebsiteRuntimeContextProvider';\n/** @wildo_source:part:end saas.website.runtime.context */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteSectionContext.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsiteSectionContext.d.ts","sourceRoot":"","sources":["../../../../../src/core/contexts/WebsiteSectionContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAiB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,UAAU,EAAE,iBAAiB,CAAC;IAC9B;;;;;OAKG;IACH,QAAQ,EAAE,sBAAsB,CAAC;CAClC;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAC3B,CAAC;AAEzD,MAAM,WAAW,kCAAkC;IACjD,KAAK,EAAE,0BAA0B,CAAC;IAClC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,KAAK,EACL,QAAQ,GACT,EAAE,kCAAkC,GAAG,SAAS,CAMhD;yBATe,6BAA6B;;;AAW7C,0DAA0D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsitePage.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsitePage.d.ts","sourceRoot":"","sources":["../../../../../src/core/contexts/useWebsitePage.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAE9B;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,uBAAuB,CAUxD;AACD,wDAAwD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteRuntime.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteRuntime.d.ts","sourceRoot":"","sources":["../../../../../src/core/contexts/useWebsiteRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,CAW9D;AACD,2DAA2D;AAE3D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,IAAI,oBAAoB,CAU/D;AACD,mEAAmE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteRuntime.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteRuntime.js","sourceRoot":"","sources":["../../../../../src/core/contexts/useWebsiteRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAInC,OAAO,EACL,qBAAqB,GAEtB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,KAAK,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAChD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,6EAA6E;YAC3E,gGAAgG;YAChG,+FAA+F;YAC/F,sCAAsC,CACzC,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AACD,2DAA2D;AAE3D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,wBAAwB;IACtC,MAAM,EAAE,cAAc,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC/C,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CACb,6GAA6G;cACzG,mHAAmH;cACnH,oEAAoE,CACzE,CAAC;IACJ,CAAC;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AACD,mEAAmE","sourcesContent":["import { useContext } from 'react';\n\nimport type { PublicPricingCatalog } from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n WebsiteRuntimeContext,\n type WebsiteRuntimeContextValue,\n} from './WebsiteRuntimeContext';\n\n/**\n * @wildo_source:part:start saas.website.use-runtime.hook facet:layer:core facet:family:website\n *\n * `useWebsiteRuntime()` — read access to the\n * `WebsiteRuntimeContextValue`. Throws if invoked outside of a\n * `<WebsiteRuntimeContextProvider>` so a missing host adapter is\n * detected at the first hook call (fail-loud).\n *\n * Section authors usually do NOT call this directly — prefer the\n * higher-level hooks (`useWebsiteLabel`, `useWebsiteLabelByKey`,\n * `useWebsiteDesignTokens`) which expose only the slice they need.\n * Direct access is reserved for layout primitives and locale-aware\n * formatters that legitimately need the active locale or the raw\n * label pack.\n */\nexport function useWebsiteRuntime(): WebsiteRuntimeContextValue {\n const value = useContext(WebsiteRuntimeContext);\n if (value === null) {\n throw new Error(\n '[useWebsiteRuntime] must be called inside <WebsiteRuntimeContextProvider>. ' +\n 'In Astro pages this is provided by the page\\'s bridge island (`createWebsitePageBridgeIsland` ' +\n 'from @wildo-ai/saas-website/astro-island) — make sure the page renders its bridge instead of ' +\n 'rendering React components directly.',\n );\n }\n return value;\n}\n/** @wildo_source:part:end saas.website.use-runtime.hook */\n\n/**\n * @wildo_source:part:start saas.website.use-pricing-catalog.hook facet:layer:core facet:family:website facet:audience:app-developer\n *\n * `useWebsitePricingCatalog()` — the application's public pricing catalogue, for a pricing section.\n *\n * The plans, their prices, which one is recommended, how much of each price may be stated, and which\n * are announced but not yet on sale — all derived at build time from the billing catalogue the\n * backend sells from. A pricing section renders from THIS and never keeps its own copy of a price:\n * a copy is a price that will disagree with the one the application charges.\n *\n * Throws when the page did not pass the catalogue to its bridge island: a pricing section with no\n * plans would silently state that the application sells nothing. The page's `.astro` frontmatter\n * loads it with `loadWebsitePricingCatalog()` from `@wildo-ai/saas-website/config-loader` and passes\n * it as the island's `pricingCatalog` prop.\n */\nexport function useWebsitePricingCatalog(): PublicPricingCatalog {\n const { pricingCatalog } = useWebsiteRuntime();\n if (pricingCatalog === undefined) {\n throw new Error(\n '[useWebsitePricingCatalog] this page did not pass a pricing catalogue to its bridge island. In the page\\'s '\n + '`.astro` frontmatter, load it with `await loadWebsitePricingCatalog()` (the @wildo-ai/saas-website/config-loader '\n + 'subpath) and pass `pricingCatalog={pricingCatalog}` to the island.',\n );\n }\n return pricingCatalog;\n}\n/** @wildo_source:part:end saas.website.use-pricing-catalog.hook */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteSection.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteSection.d.ts","sourceRoot":"","sources":["../../../../../src/core/contexts/useWebsiteSection.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,CAW9D;AACD,2DAA2D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteProviderComponent.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"WebsiteProviderComponent.d.ts","sourceRoot":"","sources":["../../../../../src/core/external-providers/WebsiteProviderComponent.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9C,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AA6D/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,6BAA6B,CAAC,MAAM,SAAS,MAAM;IAClE,0EAA0E;IAC1E,UAAU,EAAE,kBAAkB,CAAC;IAC/B,2EAA2E;IAC3E,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,gFAAgF;IAChF,cAAc,EAAE,MAAM,CAAC;IACvB,2GAA2G;IAC3G,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;QAAC,mBAAmB,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,SAAS,CAAC;CAC/H;AAED,wBAAgB,wBAAwB,CAAC,MAAM,SAAS,MAAM,EAAE,EAC9D,UAAU,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,qBAAqB,GACtB,EAAE,6BAA6B,CAAC,MAAM,CAAC,GAAG,SAAS,CAgCnD;AACD,kEAAkE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebsiteProviderComponent.js","sourceRoot":"","sources":["../../../../src/core/external-providers/WebsiteProviderComponent.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S,CAAC,CAAC,CAAC,KAAC,mBAAmB,IAAC,OAAO,EAAE,OAAO,CAAC,YAAY,GAAI,CAAC,CAAC,CAAC,IAAI,IACrH,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { type ReactNode } from 'react';\nimport { ProviderComponentStatus } from '@wildo-ai/external-connectors-public/website';\nimport type { ConsentPurpose, ProviderCapability } from '@wildo-ai/saas-models/public-runtime';\n\nimport { websiteDesignTokenCssVar } from '../../schemas/design-tokens/website-design-tokens.shared.schemas';\nimport {\n WebsiteConsentLabelSlot,\n websiteConsentLabelKey,\n websiteConsentPurposeLabelKey,\n} from '../../schemas/label-keys/website-consent-label-keys.schemas';\nimport {\n WebsiteProviderComponentLabelSlot,\n websiteProviderComponentLabelKey,\n} from '../../schemas/label-keys/website-provider-component-label-keys.schemas';\nimport { useWebsiteConsent } from '../consent/useWebsiteConsent';\nimport { useWebsiteLabelByKey } from '../hooks/useWebsiteLabel';\nimport { useWebsiteProviderComponent } from './useWebsiteProviderComponent';\n\nconst STATE_STYLE: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: '0.5rem',\n padding: '0.75rem',\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem'),\n};\n\nconst BUTTON_STYLE: React.CSSProperties = {\n alignSelf: 'flex-start',\n padding: '0.5rem 1rem',\n borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem'),\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n background: websiteDesignTokenCssVar('colors', 'background', '#fff'),\n color: websiteDesignTokenCssVar('colors', 'foreground', '#000'),\n cursor: 'pointer',\n};\n\nfunction PurposeName({ purpose }: { purpose: ConsentPurpose }): ReactNode {\n return <li data-website-provider-component-purpose={purpose}>{useWebsiteLabelByKey(websiteConsentPurposeLabelKey(purpose))}</li>;\n}\n\n/**\n * The words announced for a refusal. Rendered INTO the always-present live region, so a screen reader\n * announces the change when it happens; a region inserted already filled is often not announced at all.\n */\nfunction RefusalStatement({ status, missingPurposes }: { status: ProviderComponentStatus; missingPurposes: readonly ConsentPurpose[] }): ReactNode {\n const consentRequired = useWebsiteLabelByKey(websiteProviderComponentLabelKey(WebsiteProviderComponentLabelSlot.CONSENT_REQUIRED));\n const unavailable = useWebsiteLabelByKey(websiteProviderComponentLabelKey(WebsiteProviderComponentLabelSlot.UNAVAILABLE));\n if (status === ProviderComponentStatus.UNAVAILABLE) return <p style={{ margin: 0 }}>{unavailable}</p>;\n return (\n <>\n <p style={{ margin: 0 }}>{consentRequired}</p>\n <ul style={{ margin: 0 }}>\n {missingPurposes.map((purpose) => <PurposeName key={purpose} purpose={purpose} />)}\n </ul>\n </>\n );\n}\n\nfunction ManageConsentButton({ onClick }: { onClick: () => void }): ReactNode {\n return <button type=\"button\" style={BUTTON_STYLE} onClick={onClick}>{useWebsiteLabelByKey(websiteConsentLabelKey(WebsiteConsentLabelSlot.MANAGE))}</button>;\n}\n\n/**\n * @wildo_source:part:start saas.website.provider-component.slot facet:layer:core facet:family:website\n *\n * `<WebsiteProviderComponent>` — places ONE provider's component on a website page (#1703): an\n * address lookup on a contact form, a vendor widget on a marketing page. The component comes from the\n * provider's own `components[capability]` declaration, the same one the application reads, through\n * the website's provider-component registry.\n *\n * What it guarantees, so a page does not have to:\n *\n * - **Nothing of the vendor reaches the static HTML.** The component loads from an effect, which never\n * runs during the Astro server render, and the registry itself refuses to load where there is no\n * browser document. The server renders only the reserved box.\n * - **No layout shift.** `reservedMinHeight` applies to the box in EVERY state — the server\n * placeholder, loading, the refusals and the loaded component — so the page does not jump when the\n * component arrives. Set it to the component's rendered height.\n * - **The vendor's scripts load with the component**, not on every page: the layout injects at startup\n * only the scripts of providers that contribute no component.\n * - **Consent before download.** A provider resting on a purpose the visitor has not granted downloads\n * nothing; the box states that the feature is off, names the purposes it rests on, and offers the\n * consent panel (`openSettings`). Granting there loads the component in place.\n * - **Announced, and operable by keyboard.** The box holds a `role=\"status\"` live region from the first\n * render, so a refusal is announced when it appears; the consent button sits outside it, so it is not\n * read out as part of the message, and is a real button.\n * - **A failure says so.** A component that could not load renders the site's `unavailable` wording,\n * never a blank. A provider that offers no component here (left off in this environment) renders the\n * empty box, since there is nothing to retry.\n *\n * The words come from the site's label pack: `website.chrome.provider-component.consent-required` and\n * `.unavailable` are framework-owned keys every pack must carry, and the purpose names and the button\n * reuse the consent panel's keys. Pass `renderConsentRequired` to word the refusal in the page's own\n * chrome instead; it receives the missing purposes and the action that opens the panel, and then owns\n * its own announcement.\n *\n * It does not choose a provider. Pass the ref the page chose — `useWebsiteProviderComponentChoices`\n * lists the candidates — or `undefined` while nothing is chosen.\n */\nexport interface WebsiteProviderComponentProps<TProps extends object> {\n /** The capability the component fills, e.g. `FRONTEND_ADDRESS_LOOKUP`. */\n capability: ProviderCapability;\n /** The provider the page chose, or `undefined` while nothing is chosen. */\n providerRef: string | undefined;\n /** The props the loaded component receives — the capability's slot contract. */\n componentProps: TProps;\n /** CSS length reserved for the box in every state, so the page does not shift when the component loads. */\n reservedMinHeight?: string;\n /** Replaces the default consent-required state. */\n renderConsentRequired?: (input: { missingPurposes: readonly ConsentPurpose[]; openConsentSettings: () => void }) => ReactNode;\n}\n\nexport function WebsiteProviderComponent<TProps extends object>({\n capability,\n providerRef,\n componentProps,\n reservedMinHeight,\n renderConsentRequired,\n}: WebsiteProviderComponentProps<TProps>): ReactNode {\n const consent = useWebsiteConsent();\n const { status, Component, missingConsentPurposes } = useWebsiteProviderComponent(capability, providerRef);\n\n const isReady = status === ProviderComponentStatus.READY && Component !== null;\n const isConsentRequired = status === ProviderComponentStatus.CONSENT_REQUIRED;\n const isUnavailable = status === ProviderComponentStatus.UNAVAILABLE;\n const useDefaultRefusal = isUnavailable || (isConsentRequired && renderConsentRequired === undefined);\n // The registry cannot know a capability's props; the page states them through `componentProps`.\n const Loaded = isReady ? (Component as unknown as React.ComponentType<TProps>) : null;\n\n return (\n <div\n data-website-provider-component={capability}\n data-website-provider-component-state={status}\n aria-busy={status === ProviderComponentStatus.LOADING ? true : undefined}\n style={reservedMinHeight !== undefined ? { minHeight: reservedMinHeight } : undefined}\n >\n {Loaded !== null ? <Loaded {...componentProps} /> : null}\n {isConsentRequired && renderConsentRequired !== undefined\n ? renderConsentRequired({ missingPurposes: missingConsentPurposes, openConsentSettings: consent.openSettings })\n : null}\n {Loaded === null ? (\n <div style={useDefaultRefusal ? STATE_STYLE : undefined}>\n <div role=\"status\">\n {useDefaultRefusal ? <RefusalStatement status={status} missingPurposes={missingConsentPurposes} /> : null}\n </div>\n {isConsentRequired && renderConsentRequired === undefined ? <ManageConsentButton onClick={consent.openSettings} /> : null}\n </div>\n ) : null}\n </div>\n );\n}\n/** @wildo_source:part:end saas.website.provider-component.slot */\n"]}
|
|
1
|
+
{"version":3,"file":"WebsiteProviderComponent.js","sourceRoot":"","sources":["../../../../../src/core/external-providers/WebsiteProviderComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAGvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,kEAAkE,CAAC;AAC5G,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,6BAA6B,GAC9B,MAAM,6DAA6D,CAAC;AACrE,OAAO,EACL,iCAAiC,EACjC,gCAAgC,GACjC,MAAM,wEAAwE,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,MAAM,WAAW,GAAwB;IACvC,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,QAAQ;IACb,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,aAAa,wBAAwB,CAAC,QAAQ,E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,EAAE,CAAC,CAAC,CAAC,SAAS,aAEpF,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,KAAC,MAAM,OAAK,cAAc,GAAI,CAAC,CAAC,CAAC,IAAI,EACvD,iBAAiB,IAAI,qBAAqB,KAAK,SAAS;gBACvD,CAAC,CAAC,qBAAqB,CAAC,EAAE,eAAe,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;gBAC/G,CAAC,CAAC,IAAI,EACP,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,CACjB,eAAK,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,aACrD,cAAK,IAAI,EAAC,QAAQ,YACf,iBAAiB,CAAC,CAAC,CAAC,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,eAAe,EAAE,sBAAsB,GAAI,CAAC,CAAC,CAAC,IAAI,GACrG,EACL,iBAAiB,IAAI,qBAAqB,KAAK,SAAS,CAAC,CAAC,CAAC,KAAC,mBAAmB,IAAC,OAAO,EAAE,OAAO,CAAC,YAAY,GAAI,CAAC,CAAC,CAAC,IAAI,IACrH,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC","sourcesContent":["import React, { type ReactNode } from 'react';\nimport { ProviderComponentStatus } from '@wildo-ai/external-connectors-public/website';\nimport type { ConsentPurpose, ProviderCapability } from '@wildo-ai/saas-models/public-runtime';\n\nimport { websiteDesignTokenCssVar } from '../../schemas/design-tokens/website-design-tokens.shared.schemas';\nimport {\n WebsiteConsentLabelSlot,\n websiteConsentLabelKey,\n websiteConsentPurposeLabelKey,\n} from '../../schemas/label-keys/website-consent-label-keys.schemas';\nimport {\n WebsiteProviderComponentLabelSlot,\n websiteProviderComponentLabelKey,\n} from '../../schemas/label-keys/website-provider-component-label-keys.schemas';\nimport { useWebsiteConsent } from '../consent/useWebsiteConsent';\nimport { useWebsiteLabelByKey } from '../hooks/useWebsiteLabel';\nimport { useWebsiteProviderComponent } from './useWebsiteProviderComponent';\n\nconst STATE_STYLE: React.CSSProperties = {\n display: 'flex',\n flexDirection: 'column',\n gap: '0.5rem',\n padding: '0.75rem',\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem'),\n};\n\nconst BUTTON_STYLE: React.CSSProperties = {\n alignSelf: 'flex-start',\n padding: '0.5rem 1rem',\n borderRadius: websiteDesignTokenCssVar('radii', 'md', '0.375rem'),\n border: `1px solid ${websiteDesignTokenCssVar('colors', 'border', '#ccc')}`,\n background: websiteDesignTokenCssVar('colors', 'background', '#fff'),\n color: websiteDesignTokenCssVar('colors', 'foreground', '#000'),\n cursor: 'pointer',\n};\n\nfunction PurposeName({ purpose }: { purpose: ConsentPurpose }): ReactNode {\n return <li data-website-provider-component-purpose={purpose}>{useWebsiteLabelByKey(websiteConsentPurposeLabelKey(purpose))}</li>;\n}\n\n/**\n * The words announced for a refusal. Rendered INTO the always-present live region, so a screen reader\n * announces the change when it happens; a region inserted already filled is often not announced at all.\n */\nfunction RefusalStatement({ status, missingPurposes }: { status: ProviderComponentStatus; missingPurposes: readonly ConsentPurpose[] }): ReactNode {\n const consentRequired = useWebsiteLabelByKey(websiteProviderComponentLabelKey(WebsiteProviderComponentLabelSlot.CONSENT_REQUIRED));\n const unavailable = useWebsiteLabelByKey(websiteProviderComponentLabelKey(WebsiteProviderComponentLabelSlot.UNAVAILABLE));\n if (status === ProviderComponentStatus.UNAVAILABLE) return <p style={{ margin: 0 }}>{unavailable}</p>;\n return (\n <>\n <p style={{ margin: 0 }}>{consentRequired}</p>\n <ul style={{ margin: 0 }}>\n {missingPurposes.map((purpose) => <PurposeName key={purpose} purpose={purpose} />)}\n </ul>\n </>\n );\n}\n\nfunction ManageConsentButton({ onClick }: { onClick: () => void }): ReactNode {\n return <button type=\"button\" style={BUTTON_STYLE} onClick={onClick}>{useWebsiteLabelByKey(websiteConsentLabelKey(WebsiteConsentLabelSlot.MANAGE))}</button>;\n}\n\n/**\n * @wildo_source:part:start saas.website.provider-component.slot facet:layer:core facet:family:website\n *\n * `<WebsiteProviderComponent>` — places ONE provider's component on a website page (#1703): an\n * address lookup on a contact form, a vendor widget on a marketing page. The component comes from the\n * provider's own `components[capability]` declaration, the same one the application reads, through\n * the website's provider-component registry.\n *\n * What it guarantees, so a page does not have to:\n *\n * - **Nothing of the vendor reaches the static HTML.** The component loads from an effect, which never\n * runs during the Astro server render, and the registry itself refuses to load where there is no\n * browser document. The server renders only the reserved box.\n * - **No layout shift.** `reservedMinHeight` applies to the box in EVERY state — the server\n * placeholder, loading, the refusals and the loaded component — so the page does not jump when the\n * component arrives. Set it to the component's rendered height.\n * - **The vendor's scripts load with the component**, not on every page: the layout injects at startup\n * only the scripts of providers that contribute no component.\n * - **Consent before download.** A provider resting on a purpose the visitor has not granted downloads\n * nothing; the box states that the feature is off, names the purposes it rests on, and offers the\n * consent panel (`openSettings`). Granting there loads the component in place.\n * - **Announced, and operable by keyboard.** The box holds a `role=\"status\"` live region from the first\n * render, so a refusal is announced when it appears; the consent button sits outside it, so it is not\n * read out as part of the message, and is a real button.\n * - **A failure says so.** A component that could not load renders the site's `unavailable` wording,\n * never a blank. A provider that offers no component here (left off in this environment) renders the\n * empty box, since there is nothing to retry.\n *\n * The words come from the site's label pack: `website.chrome.provider-component.consent-required` and\n * `.unavailable` are framework-owned keys every pack must carry, and the purpose names and the button\n * reuse the consent panel's keys. Pass `renderConsentRequired` to word the refusal in the page's own\n * chrome instead; it receives the missing purposes and the action that opens the panel, and then owns\n * its own announcement.\n *\n * It does not choose a provider. Pass the ref the page chose — `useWebsiteProviderComponentChoices`\n * lists the candidates — or `undefined` while nothing is chosen.\n */\nexport interface WebsiteProviderComponentProps<TProps extends object> {\n /** The capability the component fills, e.g. `FRONTEND_ADDRESS_LOOKUP`. */\n capability: ProviderCapability;\n /** The provider the page chose, or `undefined` while nothing is chosen. */\n providerRef: string | undefined;\n /** The props the loaded component receives — the capability's slot contract. */\n componentProps: TProps;\n /** CSS length reserved for the box in every state, so the page does not shift when the component loads. */\n reservedMinHeight?: string;\n /** Replaces the default consent-required state. */\n renderConsentRequired?: (input: { missingPurposes: readonly ConsentPurpose[]; openConsentSettings: () => void }) => ReactNode;\n}\n\nexport function WebsiteProviderComponent<TProps extends object>({\n capability,\n providerRef,\n componentProps,\n reservedMinHeight,\n renderConsentRequired,\n}: WebsiteProviderComponentProps<TProps>): ReactNode {\n const consent = useWebsiteConsent();\n const { status, Component, missingConsentPurposes } = useWebsiteProviderComponent(capability, providerRef);\n\n const isReady = status === ProviderComponentStatus.READY && Component !== null;\n const isConsentRequired = status === ProviderComponentStatus.CONSENT_REQUIRED;\n const isUnavailable = status === ProviderComponentStatus.UNAVAILABLE;\n const useDefaultRefusal = isUnavailable || (isConsentRequired && renderConsentRequired === undefined);\n // The registry cannot know a capability's props; the page states them through `componentProps`.\n const Loaded = isReady ? (Component as unknown as React.ComponentType<TProps>) : null;\n\n return (\n <div\n data-website-provider-component={capability}\n data-website-provider-component-state={status}\n aria-busy={status === ProviderComponentStatus.LOADING ? true : undefined}\n style={reservedMinHeight !== undefined ? { minHeight: reservedMinHeight } : undefined}\n >\n {Loaded !== null ? <Loaded {...componentProps} /> : null}\n {isConsentRequired && renderConsentRequired !== undefined\n ? renderConsentRequired({ missingPurposes: missingConsentPurposes, openConsentSettings: consent.openSettings })\n : null}\n {Loaded === null ? (\n <div style={useDefaultRefusal ? STATE_STYLE : undefined}>\n <div role=\"status\">\n {useDefaultRefusal ? <RefusalStatement status={status} missingPurposes={missingConsentPurposes} /> : null}\n </div>\n {isConsentRequired && renderConsentRequired === undefined ? <ManageConsentButton onClick={consent.openSettings} /> : null}\n </div>\n ) : null}\n </div>\n );\n}\n/** @wildo_source:part:end saas.website.provider-component.slot */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontend-provider-registry.website.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"frontend-provider-registry.website.d.ts","sourceRoot":"","sources":["../../../../../src/core/external-providers/frontend-provider-registry.website.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,8CAA8C,CAAC;AAExG,YAAY,EACV,6BAA6B,EAC7B,0BAA0B,EAC1B,+BAA+B,EAC/B,+BAA+B,GAChC,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,8CAA8C,CAAC;AAEpG,MAAM,WAAW,0CAA0C;IACzD,yEAAyE;IACzE,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,+BAA+B,CAAC;IACnD,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,mCAAmC,KAAK,IAAI,CAAC;CACnF;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACnD,KAAK,CAAC,EAAE,0CAA0C,GACjD,+BAA+B,CAMjC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-component-registry.website.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"provider-component-registry.website.d.ts","sourceRoot":"","sources":["../../../../../src/core/external-providers/provider-component-registry.website.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAW,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC/B,MAAM,8CAA8C,CAAC;AAEtD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAEnF,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAE9C,sEAAsE;AACtE,MAAM,MAAM,4BAA4B,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;AAEhE,gGAAgG;AAChG,MAAM,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,4BAA4B,CAAC,CAAC;AAEvG,MAAM,WAAW,2CAA2C;IAC1D,kFAAkF;IAClF,QAAQ,CAAC,gBAAgB,EAAE,+BAA+B,GAAG,SAAS,CAAC;IACvE,mFAAmF;IACnF,QAAQ,CAAC,wBAAwB,CAAC,EAAE,QAAQ,CAAC,mCAAmC,CAAC,CAAC;IAClF;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,2BAA2B,KAAK,IAAI,CAAC;CAC3E;AAWD,uFAAuF;AACvF,wBAAgB,sCAAsC,CACpD,KAAK,EAAE,2CAA2C,GACjD,gCAAgC,CAOlC;AAED,4GAA4G;AAC5G,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,wBAAwB,EAAE,+BAA+B,CAAC;IACnE,QAAQ,CAAC,yBAAyB,EAAE,gCAAgC,CAAC;CACtE;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,KAAK,EAAE;IAClD,QAAQ,CAAC,iBAAiB,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC/D,QAAQ,CAAC,uBAAuB,EAAE,+BAA+B,GAAG,SAAS,CAAC;IAC9E,QAAQ,CAAC,wBAAwB,EAAE,QAAQ,CAAC,mCAAmC,CAAC,GAAG,SAAS,CAAC;CAC9F,GAAG,yBAAyB,CAe5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider-component-registry.website.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"provider-component-registry.website.js","sourceRoot":"","sources":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B;YACxB,yBAAyB,EAAE,sCAAsC,CAAC;gBAChE,gBAAgB,EAAE,wBAAwB;gBAC1C,GAAG,CAAC,wBAAwB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,wBAAwB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAChF,CAAC;SACH,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,wBAAwB,CAAC,CAAC,CAAC;AAC7E,CAAC","sourcesContent":["/**\n * The website's provider-component registry (#1703): the SAME registry the application builds, from\n * the SAME `components` declaration, over the website's live provider modules.\n *\n * A provider declares its components once, on its frontend module. Before this, the website facet\n * type accepted `components` and nothing on the website read it, so a contact form could not host an\n * address lookup (#561) and a marketing page could not host any provider component at all. The\n * registry is `createProviderComponentRegistry` from `@wildo-ai/external-connectors-public/website`\n * — keyed `capability:providerRef`, consent-gated, script-before-component and browser-only — and\n * this file only feeds it the website's two inputs:\n *\n * - the HYDRATED website provider registry (both channels joined, so a provider not live for this\n * website service contributes no component);\n * - the loaders the site's facet library contributes for components an engine provider module\n * declares but cannot import (the module lives in a renderer-free package), handed in through the\n * page bridge's `providerComponentLoaders` rather than through module-level state, because the\n * bridge is the website's one construction site and can carry it explicitly.\n *\n * Nothing is loaded here. A component loads when a `WebsiteProviderComponent` slot asks for it, from\n * an effect — never during the Astro server render.\n */\n\nimport { useMemo, type ComponentType } from 'react';\nimport {\n collectProviderComponentRegistrations,\n createProviderComponentRegistry,\n indexProviderComponentLoaderContributions,\n type ProviderComponentDiagnostic,\n type ProviderComponentLoaderContribution,\n type ProviderComponentRegistry,\n} from '@wildo-ai/external-connectors-public/website';\n\nimport type { FrontendProvidersBlock } from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n createFrontendWebsiteProviderRegistry,\n type FrontendWebsiteProviderRegistry,\n type GeneratedWebsiteProviderModules,\n} from './frontend-provider-registry.website';\n\n/** A component type the website's registry hands back once loaded. */\nexport type WebsiteProviderComponentType = ComponentType<never>;\n\n/** The website's provider-component registry: the shared registry, holding React components. */\nexport type WebsiteProviderComponentRegistry = ProviderComponentRegistry<WebsiteProviderComponentType>;\n\nexport interface CreateWebsiteProviderComponentRegistryInput {\n /** The hydrated website provider registry; absent on a site with no providers. */\n readonly providerRegistry: FrontendWebsiteProviderRegistry | undefined;\n /** Loaders the site's facet library contributes for engine-declared components. */\n readonly providerComponentLoaders?: Iterable<ProviderComponentLoaderContribution>;\n /**\n * Where a registration or load problem is reported. Defaults to `console.warn`: the website runtime\n * has no logger service, and a provider component that cannot be offered is a developer-facing fact\n * that must not be silent.\n */\n readonly onDiagnostic?: (diagnostic: ProviderComponentDiagnostic) => void;\n}\n\nfunction warnProviderComponentDiagnostic(diagnostic: ProviderComponentDiagnostic): void {\n // Reported in the BROWSER only. The registry is built during the server render or prerender too, once per\n // page, and a declaration nothing can load would otherwise fill the build log with one warning per page\n // for a fact the first page already stated. The browser is where somebody can see and act on it.\n if (typeof document === 'undefined') return;\n // eslint-disable-next-line no-console\n console.warn(`[wildo-provider-component] ${diagnostic.kind}: ${diagnostic.message}`);\n}\n\n/** Builds the website's provider-component registry from its live provider modules. */\nexport function createWebsiteProviderComponentRegistry(\n input: CreateWebsiteProviderComponentRegistryInput,\n): WebsiteProviderComponentRegistry {\n const onDiagnostic = input.onDiagnostic ?? warnProviderComponentDiagnostic;\n const registrations = collectProviderComponentRegistrations(input.providerRegistry?.modules.values() ?? [], {\n contributedLoaders: indexProviderComponentLoaderContributions(input.providerComponentLoaders),\n onDiagnostic,\n });\n return createProviderComponentRegistry<WebsiteProviderComponentType>({ registrations, onDiagnostic });\n}\n\n/** What a page bridge builds once per island: the hydrated provider registry and its component registry. */\nexport interface WebsiteProviderRegistries {\n readonly frontendProviderRegistry: FrontendWebsiteProviderRegistry;\n readonly providerComponentRegistry: WebsiteProviderComponentRegistry;\n}\n\n/**\n * Builds both registries for a page bridge, MEMOISED on their inputs.\n *\n * Memoised because the component registry caches each loaded component: a registry rebuilt on every\n * render would forget what it loaded, hand every slot a new registry identity, and make each slot's\n * load effect run again — a download loop. The inputs are an island prop (`frontendProviders`, fixed\n * for the island's life) and two module-load-time bridge dependencies, so in practice this builds\n * once per island.\n */\nexport function useWebsiteProviderRegistries(input: {\n readonly frontendProviders: FrontendProvidersBlock | undefined;\n readonly frontendProviderModules: GeneratedWebsiteProviderModules | undefined;\n readonly providerComponentLoaders: Iterable<ProviderComponentLoaderContribution> | undefined;\n}): WebsiteProviderRegistries {\n const { frontendProviders, frontendProviderModules, providerComponentLoaders } = input;\n return useMemo(() => {\n const frontendProviderRegistry = createFrontendWebsiteProviderRegistry({\n entries: frontendProviders,\n modules: frontendProviderModules,\n });\n return {\n frontendProviderRegistry,\n providerComponentRegistry: createWebsiteProviderComponentRegistry({\n providerRegistry: frontendProviderRegistry,\n ...(providerComponentLoaders !== undefined ? { providerComponentLoaders } : {}),\n }),\n };\n }, [frontendProviders, frontendProviderModules, providerComponentLoaders]);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteProviderComponent.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteProviderComponent.d.ts","sourceRoot":"","sources":["../../../../../src/core/external-providers/useWebsiteProviderComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,8CAA8C,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,uCAAuC,CAAC;AAE1F,oGAAoG;AACpG,MAAM,MAAM,6BAA6B,GAAG,0BAA0B,CAAC,4BAA4B,CAAC,CAAC;AAErG;;;;GAIG;AACH,wBAAgB,kCAAkC,CAAC,UAAU,EAAE,kBAAkB,GAAG,aAAa,CAAC,MAAM,CAAC,CAGxG;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,kBAAkB,EAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,6BAA6B,CAuB/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteProviderComponent.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteProviderComponent.js","sourceRoot":"","sources":["../../../../../src/core/external-providers/useWebsiteProviderComponent.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,GAE3B,MAAM,8CAA8C,CAAC;AAGtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAMlE;;;;GAIG;AACH,MAAM,UAAU,kCAAkC,CAAC,UAA8B;IAC/E,MAAM,EAAE,yBAAyB,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC1D,OAAO,yBAAyB,EAAE,aAAa,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CACzC,UAA8B,EAC9B,WAA+B;IAE/B,MAAM,EAAE,yBAAyB,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC1D,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgC,GAAG,EAAE,CAAC,8BAA8B,EAAgC,CAAC,CAAC;IAExI,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YACxB,QAAQ,CAAC,8BAA8B,EAAgC,CAAC,CAAC;YACzE,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,0BAA0B,CAAC;YAChC,QAAQ,EAAE,yBAAyB;YACnC,UAAU;YACV,WAAW;YACX,sBAAsB,EAAE,OAAO,CAAC,eAAe;YAC/C,OAAO,EAAE,QAAQ;SAClB,CAAC,CAAC;QACH,sGAAsG;QACtG,uDAAuD;IACzD,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,OAAO,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC;IAEzF,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["/**\n * Reading provider-contributed components on the website (#1703) — the website's counterpart of the\n * application's `useProviderComponentChoices` / `useProviderComponent`, over the same registry and\n * the same status vocabulary (`ProviderComponentStatus`).\n *\n * Two differences from the application, both about WHO answers:\n *\n * - the consent grant is the VISITOR's decision from `WebsiteConsentContext`, not a signed-in\n * person's stored preference;\n * - nothing starts before that decision has been read from storage (`isResolved`). The server render\n * and the first client render read no storage, and asking the registry then would report a\n * consent-required state to a visitor who already agreed, flashing the refusal on every page.\n *\n * Neither hook picks a provider: when several providers offer a component for one capability,\n * choosing is the page's job.\n */\n\nimport { useEffect, useState } from 'react';\nimport {\n idleProviderComponentLoadState,\n startProviderComponentLoad,\n type ProviderComponentLoadState,\n} from '@wildo-ai/external-connectors-public/website';\nimport type { ProviderCapability } from '@wildo-ai/saas-models/public-runtime';\n\nimport { useWebsiteConsent } from '../consent/useWebsiteConsent';\nimport { useWebsiteRuntime } from '../contexts/useWebsiteRuntime';\nimport type { WebsiteProviderComponentType } from './provider-component-registry.website';\n\n/** What `useWebsiteProviderComponent` returns: the shared load state, holding a React component. */\nexport type WebsiteProviderComponentState = ProviderComponentLoadState<WebsiteProviderComponentType>;\n\n/**\n * The providers that are BOTH live for this website service and carry a component for this\n * capability, in the order the service declared them. Synchronous, so a page can render its choice\n * on the first frame.\n */\nexport function useWebsiteProviderComponentChoices(capability: ProviderCapability): ReadonlyArray<string> {\n const { providerComponentRegistry } = useWebsiteRuntime();\n return providerComponentRegistry?.listProviders(capability) ?? [];\n}\n\n/**\n * Loads one provider's component for a capability, once the visitor's consent decision is known.\n *\n * Pass `undefined` for the ref while nothing is chosen. The load runs in an effect, so it never runs\n * during the Astro server render; `CONSENT_REQUIRED` means nothing of the provider was downloaded,\n * and granting the missing purposes through the consent panel loads it without a re-mount.\n */\nexport function useWebsiteProviderComponent(\n capability: ProviderCapability,\n providerRef: string | undefined,\n): WebsiteProviderComponentState {\n const { providerComponentRegistry } = useWebsiteRuntime();\n const consent = useWebsiteConsent();\n const grantedKey = [...consent.grantedPurposes].sort().join(',');\n const [state, setState] = useState<WebsiteProviderComponentState>(() => idleProviderComponentLoadState<WebsiteProviderComponentType>());\n\n useEffect(() => {\n if (!consent.isResolved) {\n setState(idleProviderComponentLoadState<WebsiteProviderComponentType>());\n return undefined;\n }\n return startProviderComponentLoad({\n registry: providerComponentRegistry,\n capability,\n providerRef,\n grantedConsentPurposes: consent.grantedPurposes,\n onState: setState,\n });\n // `grantedPurposes` is read through `grantedKey`: keyed by the granted SET, not the array's identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [capability, providerRef, providerComponentRegistry, consent.isResolved, grantedKey]);\n\n return state;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteProviderScripts.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"useWebsiteProviderScripts.d.ts","sourceRoot":"","sources":["../../../../../src/core/external-providers/useWebsiteProviderScripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAUH,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAC5F,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,oCAAoC,CAAC;AAUvF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,+BAA+B,GAAG,SAAS;AACrD;;;;GAIG;AACH,iBAAiB,CAAC,EAAE,gCAAgC,GACnD,IAAI,CAcN;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,+BAA+B,GAAG,SAAS;AACrD;;;;;GAKG;AACH,sBAAsB,EAAE,SAAS,cAAc,EAAE,GAChD,aAAa,CAAC,4BAA4B,CAAC,CAM7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWebsiteProviderScripts.js","sourceRoot":"","sources":["../../../../src/core/external-providers/useWebsiteProviderScripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,iCAAiC,EACjC,uCAAuC,EACvC,qBAAqB,GACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,eAAe,EAAuB,MAAM,sCAAsC,CAAC;AAK5F;;;GAGG;AACH,SAAS,UAAU,CAAC,sBAAiD;IACnE,OAAO,CAAC,GAAG,sBAAsB,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAAqD;AACrD;;;;GAIG;AACH,iBAAoD;IAEpD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,QAAQ,KAAK,WAAW;YAAE,OAAO;QAE5C,MAAM,cAAc,GAAG,CAAC,GAAG,CAAC,iBAAiB,EAAE,uBAAuB,EAAE,IAAI,EAAE,CAAC,CAAC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C,MAAM,EAAE,EAAE;gBACpC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC/D,OAAO,UAAU,KAAK,SAAS;oBAC7B,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YACjH,CAAC,CAAC,CAAC,CAAC;QACN,CAAC,CACF,CAAC;QACF,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,EAAE,CAAC;QACT,CAAC,CAAC;QACF,oGAAoG;IACtG,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * The website's executable-surface hooks: load what the live providers declared.\n *\n * Two mechanisms, one per kind of vendor. `useWebsiteProviderScripts` adds the\n * `<script>` tags a provider declared — the case a dynamic `import()` cannot\n * serve, and the dominant one on a marketing site. `useWebsiteProviderSdks`\n * activates the npm SDK of any provider that ships one, which reaches this\n * bundle through the CODE channel.\n *\n * Both are effect-only, and that is not incidental: this is an Astro site, so\n * page modules execute in Node at build time. Injecting into a document that\n * does not exist would throw, and starting a vendor SDK there would run a live\n * analytics client inside a build.\n *\n * Both come from `@wildo-ai/external-connectors-public/website`. The script\n * injector lives there rather than here so the SaaS application, the technical\n * doc and this site run ONE copy of it: a second copy of a DOM mutation\n * eventually disagrees about idempotence, which is how a vendor tag gets loaded\n * twice. It first shipped here alone, and that is how the application came to\n * declare its Drive Picker's Google API script and never inject it.\n *\n * ## Client-side injection, and the alternative that was rejected\n *\n * This is an Astro static site, so the \"obvious\" home for a third-party tag is\n * the built HTML `<head>`. That was rejected for now: the set of live providers\n * is per SERVICE and per ENVIRONMENT, resolved from the materialized artifact,\n * while the built HTML is one artifact shared across deploys of the same build.\n * Baking the tags in would make the build environment-specific — the same class\n * of coupling the DATA channel exists to avoid. Injecting from the client keeps\n * one build correct everywhere, at the cost of the tag arriving after hydration.\n * Revisit if a provider ever needs to run before first paint.\n */\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n activateFrontendProviderSdks,\n collectProviderScriptsWithoutComponents,\n consentPurposesRequiredByProvider,\n createFrontendProviderSdkActivationLane,\n injectProviderScripts,\n} from '@wildo-ai/external-connectors-public/website';\nimport { AppFrontendType, type ConsentPurpose } from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendWebsiteProviderRegistry } from './frontend-provider-registry.website';\nimport type { WebsiteProviderComponentRegistry } from './provider-component-registry.website';\nimport type { WebsiteProviderSdkActivation } from './website-provider-sdk-activations';\n\n/**\n * A stable key for a granted-purpose set, so an effect re-runs when the SET changes and not when a new\n * array with the same members is handed in.\n */\nfunction grantedKey(grantedConsentPurposes: readonly ConsentPurpose[]): string {\n return [...grantedConsentPurposes].sort().join(',');\n}\n\n/**\n * Injects the `<script>` tags of the live providers that rest on NO consent purpose and render no component.\n *\n * No consent input, deliberately (#1704): an executed `<script>` cannot be stopped, so a provider that rests on a\n * purpose must ship as a stoppable SDK (started on the grant and stopped on withdrawal by\n * {@link useWebsiteProviderSdks}); a consent-based module declaring `scripts` is refused at projection and skipped by\n * the collector. No grant could change what this injects.\n */\nexport function useWebsiteProviderScripts(\n registry: FrontendWebsiteProviderRegistry | undefined,\n /**\n * The website's provider-component registry (#1703). A provider with a registered component loads its\n * scripts WITH that component, when a page first shows it — so an address lookup's vendor loader is\n * not downloaded on every page of the site, only on the one with the form. This hook injects the rest.\n */\n componentRegistry?: WebsiteProviderComponentRegistry,\n): void {\n useEffect(() => {\n if (typeof document === 'undefined') return;\n\n const withComponents = [...(componentRegistry?.providersWithComponents() ?? [])].map((providerRef) => ({ providerRef }));\n const scripts = collectProviderScriptsWithoutComponents(registry?.modules.values() ?? [], withComponents);\n if (scripts.length === 0) return;\n\n injectProviderScripts(scripts, document);\n // Deliberately no teardown. A vendor tag installs a global and often starts\n // work immediately; removing the element undoes neither, so a cleanup that\n // removed it would only make the next mount inject a SECOND copy of an\n // already-running script. Idempotence by `src` is the real guard.\n }, [registry, componentRegistry]);\n}\n\n/**\n * Loads and starts the npm SDK of every live provider that declares one.\n *\n * Unlike a script tag, an SDK activation IS undone on unmount where the vendor\n * offers a teardown — an analytics client that cannot be stopped cannot honour\n * a consent withdrawal, and accumulates one instance per view transition.\n */\nexport function useWebsiteProviderSdks(\n registry: FrontendWebsiteProviderRegistry | undefined,\n /**\n * The purposes the visitor granted (#534). Providers are activated in TWO groups on purpose: those that\n * rest on no purpose (error monitoring, captcha) are started once and never restarted by a consent\n * change, while the consent-based ones start when their purpose is granted and are DEACTIVATED when it\n * is withdrawn — which is the only way a withdrawal stops a running analytics client.\n */\n grantedConsentPurposes: readonly ConsentPurpose[],\n): ReadonlyArray<WebsiteProviderSdkActivation> {\n const consentFree = useProviderSdkGroup(registry, false, []);\n const consentBased = useProviderSdkGroup(registry, true, grantedConsentPurposes);\n // The providers RUNNING on this page, both groups, published by the page layout (#1735): a form reads the captcha\n // vendor's handle from here. Emptied the moment a group stops, so nothing holds a handle past a withdrawal.\n return useMemo(() => [...consentFree, ...consentBased], [consentFree, consentBased]);\n}\n\nfunction useProviderSdkGroup(\n registry: FrontendWebsiteProviderRegistry | undefined,\n consentBased: boolean,\n grantedConsentPurposes: readonly ConsentPurpose[],\n): ReadonlyArray<WebsiteProviderSdkActivation> {\n const [running, setRunning] = useState<ReadonlyArray<WebsiteProviderSdkActivation>>([]);\n // Keyed by the grants this group's providers actually rest on, so changing an unrelated purpose does\n // not stop and restart a running analytics client.\n const relevant = registry === undefined\n ? []\n : [...registry.modules.values()]\n .filter((module) => (consentPurposesRequiredByProvider(module).length > 0) === consentBased)\n .flatMap((module) => consentPurposesRequiredByProvider(module))\n .filter((purpose) => grantedConsentPurposes.includes(purpose));\n const key = grantedKey(relevant);\n // One lane per group for the page's lifetime: a start waits for the previous stop.\n const lane = useRef(createFrontendProviderSdkActivationLane());\n useEffect(() => {\n if (registry === undefined) return;\n const modules = [...registry.modules.values()].filter(\n (module) => (consentPurposesRequiredByProvider(module).length > 0) === consentBased,\n );\n if (modules.length === 0) return;\n\n // Through the group's lane, so a start never overlaps the previous stop of the same page-global vendor (#1704): a\n // visitor who grants, withdraws and grants again while the bundle downloads must not have the first run's stop\n // switch off the second run's client. The stop also covers an unmount mid-download.\n const stop = lane.current.start(\n () => activateFrontendProviderSdks({\n surface: AppFrontendType.STATIC_WEBSITE,\n modules,\n grantedConsentPurposes,\n onDiagnostic: (diagnostic) => {\n // The website runtime has no logger service, and a provider that cannot\n // start is a developer-facing fact that must not be silent.\n // eslint-disable-next-line no-console\n console.warn(`[wildo-provider-sdk] ${diagnostic.kind}: ${diagnostic.message}`);\n },\n }),\n (result) => {\n setRunning(modules.flatMap((module) => {\n const activation = result.activations.get(module.metadata.ref);\n return activation === undefined\n ? []\n : [{ providerRef: module.metadata.ref, providerCapabilities: [...module.providerCapabilities], activation }];\n }));\n },\n );\n return () => {\n setRunning([]);\n stop();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by the granted SET, see grantedKey.\n }, [registry, consentBased, key]);\n return running;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"useWebsiteProviderScripts.js","sourceRoot":"","sources":["../../../../../src/core/external-providers/useWebsiteProviderScripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,EACL,4BAA4B,EAC5B,uCAAuC,EACvC,iCAAiC,EACjC,uCAAuC,EACvC,qBAAqB,GACtB,MAAM,8CAA8C,CAAC;AACtD,OAAO,E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FAAoF;QACpF,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAC7B,GAAG,EAAE,CAAC,4BAA4B,CAAC;YACjC,OAAO,EAAE,eAAe,CAAC,cAAc;YACvC,OAAO;YACP,sBAAsB;YACtB,YAAY,EAAE,CAAC,UAAU,EAAE,EAAE;gBAC3B,wEAAwE;gBACxE,4DAA4D;gBAC5D,sCAAsC;gBACtC,OAAO,CAAC,IAAI,CAAC,wBAAwB,UAAU,CAAC,IAAI,KAAK,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC;YACjF,CAAC;SACF,CAAC,EACF,CAAC,MAAM,EAAE,EAAE;YACT,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACpC,MAAM,UAAU,GAAG,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC/D,OAAO,UAAU,KAAK,SAAS;oBAC7B,CAAC,CAAC,EAAE;oBACJ,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,EAAE,CAAC,GAAG,MAAM,CAAC,oBAAoB,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC;YACjH,CAAC,CAAC,CAAC,CAAC;QACN,CAAC,CACF,CAAC;QACF,OAAO,GAAG,EAAE;YACV,UAAU,CAAC,EAAE,CAAC,CAAC;YACf,IAAI,EAAE,CAAC;QACT,CAAC,CAAC;QACF,oGAAoG;IACtG,CAAC,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC,CAAC;IAClC,OAAO,OAAO,CAAC;AACjB,CAAC","sourcesContent":["/**\n * The website's executable-surface hooks: load what the live providers declared.\n *\n * Two mechanisms, one per kind of vendor. `useWebsiteProviderScripts` adds the\n * `<script>` tags a provider declared — the case a dynamic `import()` cannot\n * serve, and the dominant one on a marketing site. `useWebsiteProviderSdks`\n * activates the npm SDK of any provider that ships one, which reaches this\n * bundle through the CODE channel.\n *\n * Both are effect-only, and that is not incidental: this is an Astro site, so\n * page modules execute in Node at build time. Injecting into a document that\n * does not exist would throw, and starting a vendor SDK there would run a live\n * analytics client inside a build.\n *\n * Both come from `@wildo-ai/external-connectors-public/website`. The script\n * injector lives there rather than here so the SaaS application, the technical\n * doc and this site run ONE copy of it: a second copy of a DOM mutation\n * eventually disagrees about idempotence, which is how a vendor tag gets loaded\n * twice. It first shipped here alone, and that is how the application came to\n * declare its Drive Picker's Google API script and never inject it.\n *\n * ## Client-side injection, and the alternative that was rejected\n *\n * This is an Astro static site, so the \"obvious\" home for a third-party tag is\n * the built HTML `<head>`. That was rejected for now: the set of live providers\n * is per SERVICE and per ENVIRONMENT, resolved from the materialized artifact,\n * while the built HTML is one artifact shared across deploys of the same build.\n * Baking the tags in would make the build environment-specific — the same class\n * of coupling the DATA channel exists to avoid. Injecting from the client keeps\n * one build correct everywhere, at the cost of the tag arriving after hydration.\n * Revisit if a provider ever needs to run before first paint.\n */\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n activateFrontendProviderSdks,\n collectProviderScriptsWithoutComponents,\n consentPurposesRequiredByProvider,\n createFrontendProviderSdkActivationLane,\n injectProviderScripts,\n} from '@wildo-ai/external-connectors-public/website';\nimport { AppFrontendType, type ConsentPurpose } from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendWebsiteProviderRegistry } from './frontend-provider-registry.website';\nimport type { WebsiteProviderComponentRegistry } from './provider-component-registry.website';\nimport type { WebsiteProviderSdkActivation } from './website-provider-sdk-activations';\n\n/**\n * A stable key for a granted-purpose set, so an effect re-runs when the SET changes and not when a new\n * array with the same members is handed in.\n */\nfunction grantedKey(grantedConsentPurposes: readonly ConsentPurpose[]): string {\n return [...grantedConsentPurposes].sort().join(',');\n}\n\n/**\n * Injects the `<script>` tags of the live providers that rest on NO consent purpose and render no component.\n *\n * No consent input, deliberately (#1704): an executed `<script>` cannot be stopped, so a provider that rests on a\n * purpose must ship as a stoppable SDK (started on the grant and stopped on withdrawal by\n * {@link useWebsiteProviderSdks}); a consent-based module declaring `scripts` is refused at projection and skipped by\n * the collector. No grant could change what this injects.\n */\nexport function useWebsiteProviderScripts(\n registry: FrontendWebsiteProviderRegistry | undefined,\n /**\n * The website's provider-component registry (#1703). A provider with a registered component loads its\n * scripts WITH that component, when a page first shows it — so an address lookup's vendor loader is\n * not downloaded on every page of the site, only on the one with the form. This hook injects the rest.\n */\n componentRegistry?: WebsiteProviderComponentRegistry,\n): void {\n useEffect(() => {\n if (typeof document === 'undefined') return;\n\n const withComponents = [...(componentRegistry?.providersWithComponents() ?? [])].map((providerRef) => ({ providerRef }));\n const scripts = collectProviderScriptsWithoutComponents(registry?.modules.values() ?? [], withComponents);\n if (scripts.length === 0) return;\n\n injectProviderScripts(scripts, document);\n // Deliberately no teardown. A vendor tag installs a global and often starts\n // work immediately; removing the element undoes neither, so a cleanup that\n // removed it would only make the next mount inject a SECOND copy of an\n // already-running script. Idempotence by `src` is the real guard.\n }, [registry, componentRegistry]);\n}\n\n/**\n * Loads and starts the npm SDK of every live provider that declares one.\n *\n * Unlike a script tag, an SDK activation IS undone on unmount where the vendor\n * offers a teardown — an analytics client that cannot be stopped cannot honour\n * a consent withdrawal, and accumulates one instance per view transition.\n */\nexport function useWebsiteProviderSdks(\n registry: FrontendWebsiteProviderRegistry | undefined,\n /**\n * The purposes the visitor granted (#534). Providers are activated in TWO groups on purpose: those that\n * rest on no purpose (error monitoring, captcha) are started once and never restarted by a consent\n * change, while the consent-based ones start when their purpose is granted and are DEACTIVATED when it\n * is withdrawn — which is the only way a withdrawal stops a running analytics client.\n */\n grantedConsentPurposes: readonly ConsentPurpose[],\n): ReadonlyArray<WebsiteProviderSdkActivation> {\n const consentFree = useProviderSdkGroup(registry, false, []);\n const consentBased = useProviderSdkGroup(registry, true, grantedConsentPurposes);\n // The providers RUNNING on this page, both groups, published by the page layout (#1735): a form reads the captcha\n // vendor's handle from here. Emptied the moment a group stops, so nothing holds a handle past a withdrawal.\n return useMemo(() => [...consentFree, ...consentBased], [consentFree, consentBased]);\n}\n\nfunction useProviderSdkGroup(\n registry: FrontendWebsiteProviderRegistry | undefined,\n consentBased: boolean,\n grantedConsentPurposes: readonly ConsentPurpose[],\n): ReadonlyArray<WebsiteProviderSdkActivation> {\n const [running, setRunning] = useState<ReadonlyArray<WebsiteProviderSdkActivation>>([]);\n // Keyed by the grants this group's providers actually rest on, so changing an unrelated purpose does\n // not stop and restart a running analytics client.\n const relevant = registry === undefined\n ? []\n : [...registry.modules.values()]\n .filter((module) => (consentPurposesRequiredByProvider(module).length > 0) === consentBased)\n .flatMap((module) => consentPurposesRequiredByProvider(module))\n .filter((purpose) => grantedConsentPurposes.includes(purpose));\n const key = grantedKey(relevant);\n // One lane per group for the page's lifetime: a start waits for the previous stop.\n const lane = useRef(createFrontendProviderSdkActivationLane());\n useEffect(() => {\n if (registry === undefined) return;\n const modules = [...registry.modules.values()].filter(\n (module) => (consentPurposesRequiredByProvider(module).length > 0) === consentBased,\n );\n if (modules.length === 0) return;\n\n // Through the group's lane, so a start never overlaps the previous stop of the same page-global vendor (#1704): a\n // visitor who grants, withdraws and grants again while the bundle downloads must not have the first run's stop\n // switch off the second run's client. The stop also covers an unmount mid-download.\n const stop = lane.current.start(\n () => activateFrontendProviderSdks({\n surface: AppFrontendType.STATIC_WEBSITE,\n modules,\n grantedConsentPurposes,\n onDiagnostic: (diagnostic) => {\n // The website runtime has no logger service, and a provider that cannot\n // start is a developer-facing fact that must not be silent.\n // eslint-disable-next-line no-console\n console.warn(`[wildo-provider-sdk] ${diagnostic.kind}: ${diagnostic.message}`);\n },\n }),\n (result) => {\n setRunning(modules.flatMap((module) => {\n const activation = result.activations.get(module.metadata.ref);\n return activation === undefined\n ? []\n : [{ providerRef: module.metadata.ref, providerCapabilities: [...module.providerCapabilities], activation }];\n }));\n },\n );\n return () => {\n setRunning([]);\n stop();\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps -- keyed by the granted SET, see grantedKey.\n }, [registry, consentBased, key]);\n return running;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website-provider-sdk-activations.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"website-provider-sdk-activations.d.ts","sourceRoot":"","sources":["../../../../../src/core/external-providers/website-provider-sdk-activations.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAElG,6HAA6H;AAC7H,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,oBAAoB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrD,QAAQ,CAAC,UAAU,EAAE,6BAA6B,CAAC;CACpD;AAED,eAAO,MAAM,oCAAoC,kEAAiE,CAAC;AAEnH,sHAAsH;AACtH,wBAAgB,gCAAgC,IAAI,aAAa,CAAC,4BAA4B,CAAC,CAE9F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"website-provider-sdk-activations.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"website-provider-sdk-activations.js","sourceRoot":"","sources":["../../../../../src/core/external-providers/website-provider-sdk-activations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAUlD,MAAM,CAAC,MAAM,oCAAoC,GAAG,aAAa,CAA8C,EAAE,CAAC,CAAC;AAEnH,sHAAsH;AACtH,MAAM,UAAU,gCAAgC;IAC9C,OAAO,UAAU,CAAC,oCAAoC,CAAC,CAAC;AAC1D,CAAC","sourcesContent":["/**\n * The provider SDKs RUNNING on this website page (#1735), published by the page layout.\n *\n * A section reaches a running vendor through here rather than through a global — the contact form asks the consented\n * captcha vendor for a token this way. The list is emptied the moment a provider is stopped (a consent withdrawal, a\n * navigation), so a consumer that reads it at the moment it needs a handle never holds one past a withdrawal.\n */\nimport { createContext, useContext } from 'react';\nimport type { ProviderFrontendSdkActivation } from '@wildo-ai/external-connectors-public/website';\n\n/** One running provider: its ref, the capabilities it serves, and its activation (whose `handle` is the vendor's client). */\nexport interface WebsiteProviderSdkActivation {\n readonly providerRef: string;\n readonly providerCapabilities: ReadonlyArray<string>;\n readonly activation: ProviderFrontendSdkActivation;\n}\n\nexport const WebsiteProviderSdkActivationsContext = createContext<ReadonlyArray<WebsiteProviderSdkActivation>>([]);\n\n/** The provider SDKs running on this page, in declaration order. Empty outside a page layout and before any start. */\nexport function useWebsiteProviderSdkActivations(): ReadonlyArray<WebsiteProviderSdkActivation> {\n return useContext(WebsiteProviderSdkActivationsContext);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-website-page-manifest.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"define-website-page-manifest.d.ts","sourceRoot":"","sources":["../../../../../src/core/factories/define-website-page-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,4BAA4B,EAC7B,MAAM,8DAA8D,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhF;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,8BAA8B,CAAC,MAAM;IACpD,GAAG,EAAE,cAAc,GAAG,MAAM,CAAC;IAC7B,SAAS,EAAE,oBAAoB,GAAG,MAAM,CAAC;IACzC,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACrC,WAAW,EAAE,SAAS,CAAC,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC;IACrD,aAAa,EAAE,wBAAwB,CAAC;IACxC,SAAS,CAAC,EAAE,4BAA4B,CAAC;IACzC,GAAG,CAAC,EAAE,oBAAoB,CAAC;CAC5B;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB,CAAC,MAAM,CAC9C,SAAQ,IAAI,CAAC,mBAAmB,EAAE,eAAe,CAAC;IAClD,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACtE,KAAK,EAAE,8BAA8B,CAAC,MAAM,CAAC,GAC5C,wBAAwB,CAAC,MAAM,CAAC,CAmBlC;AACD,yEAAyE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-website-section.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"define-website-section.d.ts","sourceRoot":"","sources":["../../../../../src/core/factories/define-website-section.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG3C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kEAAkE,CAAC;AACjH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wDAAwD,CAAC;AACrG,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oDAAoD,CAAC;AAC1F,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,sEAAsE,CAAC;AAExH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,yBAAyB,CAAC,MAAM;IAC/C,UAAU,EAAE,iBAAiB,GAAG,MAAM,CAAC;IACvC,QAAQ,EAAE,sBAAsB,CAAC;IACjC,iBAAiB,EAAE,SAAS,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC;IACzD,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,2BAA2B,CAAC;CACvD;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,6BAA6B,CAAC,MAAM,CACnD,SAAQ,IAAI,CAAC,wBAAwB,EAAE,WAAW,GAAG,mBAAmB,CAAC;IACzE,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,2BAA2B,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EACzC,KAAK,EAAE,yBAAyB,CAAC,MAAM,CAAC,GACvC,6BAA6B,CAAC,MAAM,CAAC,CAoBvC;AACD,mEAAmE"}
|