@wildo-ai/external-connectors-public 1.1.11 → 1.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/esm/app/compose-frontend-app-providers.d.ts.map +1 -1
  2. package/dist/esm/app/compose-frontend-app-providers.js.map +1 -1
  3. package/dist/esm/app/compose-hydrated-frontend-app-providers.d.ts.map +1 -1
  4. package/dist/esm/app/compose-hydrated-frontend-app-providers.js.map +1 -1
  5. package/dist/esm/app/engine-frontend-app-provider-registry.d.ts.map +1 -1
  6. package/dist/esm/app/engine-frontend-app-provider-registry.js.map +1 -1
  7. package/dist/esm/app/frontend-app-provider-module.types.d.ts.map +1 -1
  8. package/dist/esm/app/frontend-app-provider-module.types.js.map +1 -1
  9. package/dist/esm/app/frontend-app-provider-registry.types.d.ts.map +1 -1
  10. package/dist/esm/app/frontend-app-provider-registry.types.js.map +1 -1
  11. package/dist/esm/app/index.d.ts.map +1 -1
  12. package/dist/esm/app/index.js.map +1 -1
  13. package/dist/esm/companion-exports.d.ts.map +1 -1
  14. package/dist/esm/companion-exports.js +36 -1
  15. package/dist/esm/companion-exports.js.map +1 -1
  16. package/dist/esm/engine-frontend-providers-package.d.ts.map +1 -1
  17. package/dist/esm/engine-frontend-providers-package.js.map +1 -1
  18. package/dist/esm/providers/dropbox/dropbox.frontend-app.module.d.ts.map +1 -1
  19. package/dist/esm/providers/dropbox/dropbox.frontend-app.module.js +19 -2
  20. package/dist/esm/providers/dropbox/dropbox.frontend-app.module.js.map +1 -1
  21. package/dist/esm/providers/dropbox/index.d.ts.map +1 -1
  22. package/dist/esm/providers/dropbox/index.js.map +1 -1
  23. package/dist/esm/providers/google-drive/google-drive.frontend-app.module.d.ts.map +1 -1
  24. package/dist/esm/providers/google-drive/google-drive.frontend-app.module.js +21 -3
  25. package/dist/esm/providers/google-drive/google-drive.frontend-app.module.js.map +1 -1
  26. package/dist/esm/providers/google-drive/index.d.ts.map +1 -1
  27. package/dist/esm/providers/google-drive/index.js.map +1 -1
  28. package/dist/esm/providers/google-places/google-places.frontend-app.module.d.ts.map +1 -1
  29. package/dist/esm/providers/google-places/google-places.frontend-app.module.js +8 -2
  30. package/dist/esm/providers/google-places/google-places.frontend-app.module.js.map +1 -1
  31. package/dist/esm/providers/microsoft-onedrive/index.d.ts.map +1 -1
  32. package/dist/esm/providers/microsoft-onedrive/index.js.map +1 -1
  33. package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.d.ts.map +1 -1
  34. package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.js +26 -3
  35. package/dist/esm/providers/microsoft-onedrive/microsoft-onedrive.frontend-app.module.js.map +1 -1
  36. package/dist/esm/providers/recaptcha/index.d.ts.map +1 -1
  37. package/dist/esm/providers/recaptcha/index.js.map +1 -1
  38. package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.d.ts.map +1 -1
  39. package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js +11 -3
  40. package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js.map +1 -1
  41. package/dist/esm/shared/activate-frontend-provider-sdks.d.ts.map +1 -1
  42. package/dist/esm/shared/activate-frontend-provider-sdks.js.map +1 -1
  43. package/dist/esm/shared/frontend-provider-consent.d.ts +7 -0
  44. package/dist/esm/shared/frontend-provider-consent.d.ts.map +1 -1
  45. package/dist/esm/shared/frontend-provider-consent.js +2 -0
  46. package/dist/esm/shared/frontend-provider-consent.js.map +1 -1
  47. package/dist/esm/shared/frontend-provider-on-demand.d.ts.map +1 -1
  48. package/dist/esm/shared/frontend-provider-on-demand.js.map +1 -1
  49. package/dist/esm/shared/frontend-provider-surface.types.d.ts.map +1 -1
  50. package/dist/esm/shared/frontend-provider-surface.types.js.map +1 -1
  51. package/dist/esm/shared/hydrate-frontend-providers.d.ts.map +1 -1
  52. package/dist/esm/shared/hydrate-frontend-providers.js.map +1 -1
  53. package/dist/esm/shared/load-frontend-provider-scripts.d.ts.map +1 -1
  54. package/dist/esm/shared/load-frontend-provider-scripts.js.map +1 -1
  55. package/dist/esm/shared/provider-component-registry.d.ts.map +1 -1
  56. package/dist/esm/shared/provider-component-registry.js.map +1 -1
  57. package/dist/esm/techdoc/compose-frontend-techdoc-providers.d.ts.map +1 -1
  58. package/dist/esm/techdoc/compose-frontend-techdoc-providers.js.map +1 -1
  59. package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.d.ts.map +1 -1
  60. package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.js.map +1 -1
  61. package/dist/esm/techdoc/engine-frontend-techdoc-provider-registry.d.ts.map +1 -1
  62. package/dist/esm/techdoc/engine-frontend-techdoc-provider-registry.js.map +1 -1
  63. package/dist/esm/techdoc/frontend-techdoc-provider-module.types.d.ts.map +1 -1
  64. package/dist/esm/techdoc/frontend-techdoc-provider-module.types.js.map +1 -1
  65. package/dist/esm/techdoc/frontend-techdoc-provider-registry.types.d.ts.map +1 -1
  66. package/dist/esm/techdoc/frontend-techdoc-provider-registry.types.js.map +1 -1
  67. package/dist/esm/techdoc/index.d.ts.map +1 -1
  68. package/dist/esm/techdoc/index.js.map +1 -1
  69. package/dist/esm/website/compose-frontend-website-providers.d.ts.map +1 -1
  70. package/dist/esm/website/compose-frontend-website-providers.js.map +1 -1
  71. package/dist/esm/website/compose-hydrated-frontend-website-providers.d.ts.map +1 -1
  72. package/dist/esm/website/compose-hydrated-frontend-website-providers.js.map +1 -1
  73. package/dist/esm/website/engine-frontend-website-provider-registry.d.ts.map +1 -1
  74. package/dist/esm/website/engine-frontend-website-provider-registry.js.map +1 -1
  75. package/dist/esm/website/frontend-website-provider-module.types.d.ts.map +1 -1
  76. package/dist/esm/website/frontend-website-provider-module.types.js.map +1 -1
  77. package/dist/esm/website/frontend-website-provider-registry.types.d.ts.map +1 -1
  78. package/dist/esm/website/frontend-website-provider-registry.types.js.map +1 -1
  79. package/dist/esm/website/index.d.ts.map +1 -1
  80. package/dist/esm/website/index.js.map +1 -1
  81. package/dist/tsconfig.build.tsbuildinfo +1 -0
  82. package/package.json +7 -6
@@ -1 +1 @@
1
- {"version":3,"file":"load-frontend-provider-scripts.js","sourceRoot":"","sources":["../../../../src/shared/load-frontend-provider-scripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE9G;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,4BAA4B,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,kCAAkC,CAAC;AAElF,4GAA4G;AAC5G,MAAM,CAAN,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC,4FAA4F;IAC5F,8CAAmB,CAAA;IACnB,wFAAwF;IACxF,4CAAiB,CAAA;IACjB;;;;;OAKG;IACH,4CAAiB,CAAA;AACnB,CAAC,EAZW,uBAAuB,KAAvB,uBAAuB,QAYlC;AAqBD;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA0D;IAE1D,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,SAAS,GAA6B,EAAE,CAAC;IAC/C,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,mHAAmH;QACnH,kHAAkH;QAClH,gHAAgH;QAChH,iHAAiH;QACjH,wGAAwG;QACxG,EAAE;QACF,mHAAmH;QACnH,8GAA8G;QAC9G,+EAA+E;QAC/E,gIAAgI;QAChI,IAAI,iCAAiC,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS;QACrE,IAAI,CAAC,4BAA4B,CAAC,QAAQ,EAAE,EAAE,CAAC;YAAE,SAAS;QAC1D,KAAK,MAAM,WAAW,IAAI,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE,C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C,GAAG,CAC/B,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAC3B,MAAM,OAAO,GACX,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACvG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAClD,CAAC,CAAC,CACH,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,uBAAuB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;QAC9G,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,uBAAuB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC1H,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Loading what a provider actually declared, instead of naming it — on EVERY\n * frontend surface, from one copy.\n *\n * This is the consumer for the DATA half of a provider's executable surface: the\n * `scripts` it declares (#332). It serves the case a dynamic `import()` cannot: a\n * vendor that ships a global-installing `<script>` tag rather than an npm module\n * (the Google API loader behind the Drive Picker, Microsoft's OneDrive picker,\n * reCAPTCHA, tag managers, chat widgets, the CDN distributions of most analytics\n * SDKs). The npm half — `sdk.activate` — lives beside it in\n * `activate-frontend-provider-sdks.ts`; a provider that declares both gets its\n * scripts from here and its SDK from there.\n *\n * ## Why this lives here and not in each surface\n *\n * It first shipped inside `@wildo-ai/saas-website` only, and that is exactly how\n * the SaaS application came to declare `https://apis.google.com/js/api.js` for\n * its Drive Picker and never inject it: the picker then failed with \"The Google\n * API script has not loaded\" on the one surface that offers it. A DOM mutation\n * that several surfaces perform must have one implementation, because a second\n * copy eventually disagrees about idempotence — which is how a vendor tag gets\n * loaded twice, and a vendor tag loaded twice initialises twice.\n *\n * ## Injecting is not enough: why `loadProviderScripts` AWAITS\n *\n * A dynamically created `<script>` is fetched and executed asynchronously. A\n * component that mounts in the same tick as the injection — or a second later,\n * on a slow network — reads the vendor global before the tag has executed and\n * sees nothing. So \"the script is in the document\" and \"what the script installs\n * is present\" are different facts, and only the second makes a dependent\n * component usable. `loadProviderScripts` resolves on the second.\n *\n * The state lives ON THE ELEMENT (`PROVIDER_SCRIPT_STATE_ATTRIBUTE`), not in a\n * module-level map, and that is the part that has to be right: a bundle can hold\n * two instances of this module (two chunks, a hot reload, a website island and a\n * shared vendor chunk), and a `load` event fires exactly once. A caller arriving\n * after the event can never observe it again, so the element itself must record\n * that it happened. The listeners that record it are attached at injection,\n * before the browser can possibly have fetched the file.\n */\n\nimport type { ProviderFrontendScriptDeclaration } from '@wildo-ai/saas-models/public-runtime';\nimport { consentPurposesRequiredByProvider, isProviderPermittedByConsent } from './frontend-provider-consent';\n\n/**\n * Marks a `<script>` this module owns, so a re-render, a client-side route\n * change or a second mount finds it instead of appending a duplicate. The value\n * is the declaring provider's ref.\n */\nexport const PROVIDER_SCRIPT_MARKER_ATTRIBUTE = 'data-wildo-provider-script';\n\n/**\n * Records, on the element itself, how far a provider script has got. Its values\n * are exactly `ProviderScriptLoadState`. See the module note for why the state\n * cannot live anywhere else.\n */\nexport const PROVIDER_SCRIPT_STATE_ATTRIBUTE = 'data-wildo-provider-script-state';\n\n/** How far a provider-owned `<script>` element has got. The one source for the state attribute's values. */\nexport enum ProviderScriptLoadState {\n /** Injected; neither `load` nor `error` has fired yet. A caller awaiting it must listen. */\n LOADING = 'loading',\n /** `load` fired: the script executed, so whatever global it installs is now present. */\n LOADED = 'loaded',\n /**\n * `error` fired: a network failure, a CSP refusal, or a Subresource Integrity\n * mismatch. The element is left in place and NOT retried in this document — a\n * vendor script can fail after partially executing, and a second copy could\n * initialise over the first. A reload is the retry.\n */\n FAILED = 'failed',\n}\n\nexport interface DeclaredProviderScript {\n readonly providerRef: string;\n readonly declaration: ProviderFrontendScriptDeclaration;\n}\n\n/**\n * The shape this module needs off a provider module. Every facet's module type\n * (app, website, techdoc) and every DATA entry satisfies it, so one collector\n * serves all three surfaces.\n */\nexport interface ScriptBearingProviderModule {\n readonly metadata: { readonly ref: string };\n readonly scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /** Read to decide whether the provider rests on consent — see `frontend-provider-consent.ts`. */\n readonly providerCapabilities?: ReadonlyArray<string>;\n /** The provider's own purposes beyond its capabilities' floor (#1702) — read by the same decision. */\n readonly consentPurposes?: ReadonlyArray<string>;\n}\n\n/**\n * Every script declared by the given providers, in iteration order, with the\n * declaring ref kept beside each one so a failure can name it.\n *\n * `undefined` collects nothing: a surface with no hydrated registry declares no\n * scripts, and asking it to special-case that would be one more place to forget.\n */\nexport function collectDeclaredProviderScripts(\n modules: Iterable<ScriptBearingProviderModule> | undefined,\n): ReadonlyArray<DeclaredProviderScript> {\n if (modules === undefined) return [];\n\n const collected: DeclaredProviderScript[] = [];\n for (const provider of modules) {\n // Unlike an SDK, an injected script cannot be stopped, so a provider that rests on ANY consent purpose contributes\n // no script at all, granted or not (#1704): a withdrawal must stop what the grant started, and nothing can stop a\n // script once it ran. Such a vendor loads its script from inside a stoppable `sdk.activate`. The projection and\n // hydration refuse the same shape; this is the runner's own copy of the rule, so a hand-built module list cannot\n // reach a page with one. (The component registry applies it to the scripts that load with a component.)\n //\n // That is also why this takes no granted purposes (it did until #1704's review): with every consent-based provider\n // skipped, no grant could change what is collected. The permission check below still FAILS CLOSED on a broken\n // classification, asked with no grant, which is the only question left for it.\n // assurance-control: WILDO.PRIVACY.CONSENT_ENFORCEMENT — no consent-based provider injects a script a withdrawal could not stop\n if (consentPurposesRequiredByProvider(provider).length > 0) continue;\n if (!isProviderPermittedByConsent(provider, [])) continue;\n for (const declaration of provider.scripts ?? []) {\n collected.push({ providerRef: provider.metadata.ref, declaration });\n }\n }\n return collected;\n}\n\nexport interface InjectProviderScriptsResult {\n /** Refs whose script this call added. */\n readonly injected: ReadonlyArray<string>;\n /** Refs whose script was already present, so nothing was added. */\n readonly alreadyPresent: ReadonlyArray<string>;\n}\n\n/**\n * Finds the element this module owns for one `src`, if any.\n *\n * Matched by reading the attribute rather than by a selector carrying the URL: a\n * `src` can contain characters a CSS selector would have to escape, and an\n * escaping bug here would show up as a duplicated vendor tag — two analytics\n * clients, two sets of events — rather than as an error.\n */\nfunction findOwnedScript(targetDocument: Document, src: string): HTMLScriptElement | undefined {\n return [...targetDocument.querySelectorAll<HTMLScriptElement>(`script[${PROVIDER_SCRIPT_MARKER_ATTRIBUTE}]`)]\n .find((element) => element.getAttribute('src') === src);\n}\n\n/**\n * Creates and appends one provider script, with its state tracking attached\n * BEFORE it is appended — so no `load` or `error` can fire unrecorded.\n */\nfunction appendOwnedScript(targetDocument: Document, script: DeclaredProviderScript): HTMLScriptElement {\n const { providerRef, declaration } = script;\n const element = targetDocument.createElement('script');\n element.src = declaration.src;\n element.setAttribute(PROVIDER_SCRIPT_MARKER_ATTRIBUTE, providerRef);\n element.setAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE, ProviderScriptLoadState.LOADING);\n element.addEventListener(\n 'load',\n () => element.setAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE, ProviderScriptLoadState.LOADED),\n { once: true },\n );\n element.addEventListener(\n 'error',\n () => element.setAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE, ProviderScriptLoadState.FAILED),\n { once: true },\n );\n\n if (declaration.integrity !== undefined) {\n element.integrity = declaration.integrity;\n }\n if (declaration.crossOrigin !== undefined) {\n element.crossOrigin = declaration.crossOrigin;\n }\n // `async` defaults to TRUE when the declaration says nothing: a third-party\n // tag that blocks parsing is the most common way a provider costs a page its\n // paint metrics. Both flags are set explicitly rather than left to the\n // element's defaults: a dynamically created script is `async` by default, so\n // `defer: true` alone would be silently ignored without the paired\n // `async = false`.\n element.async = declaration.async ?? declaration.defer !== true;\n element.defer = declaration.defer ?? false;\n\n targetDocument.head.appendChild(element);\n return element;\n}\n\n/**\n * Adds each declared script to the document, once, WITHOUT waiting for any of\n * them. For a surface that needs the tags present and depends on nothing they\n * install synchronously (an analytics tag on a marketing page).\n *\n * Idempotent by `src`: a declaration whose element is already in the document is\n * skipped. Callers may therefore run this on every mount without tracking state.\n */\nexport function injectProviderScripts(\n scripts: ReadonlyArray<DeclaredProviderScript>,\n targetDocument: Document,\n): InjectProviderScriptsResult {\n const injected: string[] = [];\n const alreadyPresent: string[] = [];\n\n for (const script of scripts) {\n if (findOwnedScript(targetDocument, script.declaration.src) !== undefined) {\n alreadyPresent.push(script.providerRef);\n continue;\n }\n appendOwnedScript(targetDocument, script);\n injected.push(script.providerRef);\n }\n\n return { injected, alreadyPresent };\n}\n\n/** One declared script that did not load. Reported, never thrown. */\nexport interface ProviderScriptLoadFailure {\n readonly providerRef: string;\n readonly src: string;\n readonly message: string;\n}\n\nexport interface ProviderScriptLoadOutcome {\n /** Every script that has executed, whether this call injected it or found it already loaded. */\n readonly loaded: ReadonlyArray<DeclaredProviderScript>;\n /** Every script that failed, now or in an earlier call. Empty means everything asked for is present. */\n readonly failed: ReadonlyArray<ProviderScriptLoadFailure>;\n}\n\nfunction failureOf(script: DeclaredProviderScript): ProviderScriptLoadFailure {\n return {\n providerRef: script.providerRef,\n src: script.declaration.src,\n message:\n `Provider \"${script.providerRef}\" declares the script \"${script.declaration.src}\" and it failed to load `\n + '(network failure, a Content-Security-Policy refusal, or an integrity mismatch). Whatever it installs is '\n + 'not present on this surface.',\n };\n}\n\n/**\n * Waits for one owned element to settle. An element already `LOADED` or `FAILED`\n * answers immediately; a `LOADING` one is listened to.\n *\n * An element carrying the marker but NO state attribute was injected by\n * something that did not track it (an older copy of this module). Its `load`\n * event may already have fired and cannot be observed again, so waiting would\n * hang forever on an element that is very likely loaded; it is therefore treated\n * as loaded, and a script that really failed will surface as the vendor global\n * being absent at its use site — which every consumer must already handle.\n */\nfunction settle(element: HTMLScriptElement): Promise<ProviderScriptLoadState.LOADED | ProviderScriptLoadState.FAILED> {\n const state = element.getAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE);\n if (state === ProviderScriptLoadState.FAILED) return Promise.resolve(ProviderScriptLoadState.FAILED);\n if (state !== ProviderScriptLoadState.LOADING) return Promise.resolve(ProviderScriptLoadState.LOADED);\n\n return new Promise((resolve) => {\n const onLoad = (): void => {\n element.removeEventListener('error', onError);\n resolve(ProviderScriptLoadState.LOADED);\n };\n const onError = (): void => {\n element.removeEventListener('load', onLoad);\n resolve(ProviderScriptLoadState.FAILED);\n };\n element.addEventListener('load', onLoad, { once: true });\n element.addEventListener('error', onError, { once: true });\n });\n}\n\n/**\n * Adds each declared script to the document once and resolves when every one of\n * them has EXECUTED or failed — for a caller that depends on what the scripts\n * install (a picker component that reads `window.gapi` when it mounts).\n *\n * Idempotent by `src`, exactly like `injectProviderScripts`, and correct however\n * the element came to exist: a second caller — including one from another module\n * instance — awaits an element still loading, resolves immediately for one\n * already loaded, and reports one that already failed. It never throws: one\n * provider's broken CDN must not become an exception in a render path, and the\n * caller decides what a failure means for it.\n *\n * It does not time out. A request that neither completes nor errors is ended by\n * the browser's own network timeout, which fires `error`; a second, shorter\n * timer here would declare a slow network a broken provider.\n */\nexport async function loadProviderScripts(\n scripts: ReadonlyArray<DeclaredProviderScript>,\n targetDocument: Document,\n): Promise<ProviderScriptLoadOutcome> {\n const settled = await Promise.all(\n scripts.map(async (script) => {\n const element =\n findOwnedScript(targetDocument, script.declaration.src) ?? appendOwnedScript(targetDocument, script);\n return { script, state: await settle(element) };\n }),\n );\n\n return {\n loaded: settled.filter((entry) => entry.state === ProviderScriptLoadState.LOADED).map((entry) => entry.script),\n failed: settled.filter((entry) => entry.state === ProviderScriptLoadState.FAILED).map((entry) => failureOf(entry.script)),\n };\n}\n"]}
1
+ {"version":3,"file":"load-frontend-provider-scripts.js","sourceRoot":"","sources":["../../../src/shared/load-frontend-provider-scripts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAGH,OAAO,EAAE,iCAAiC,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAE9G;;;;GAIG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,4BAA4B,CAAC;AAE7E;;;;GAIG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,kCAAkC,CAAC;AAElF,4GAA4G;AAC5G,MAAM,CAAN,IAAY,uBAYX;AAZD,WAAY,uBAAuB;IACjC,4FAA4F;IAC5F,8CAAmB,CAAA;IACnB,wFAAwF;IACxF,4CAAiB,CAAA;IACjB;;;;;OAKG;IACH,4CAAiB,CAAA;AACnB,CAAC,EAZW,uBAAuB,KAAvB,uBAAuB,QAYlC;AAqBD;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAC5C,OAA0D;IAE1D,IAAI,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,CAAC;IAErC,MAAM,SAAS,GAA6B,EAAE,CAAC;IAC/C,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,CAAC;QAC/B,mHAAmH;QACnH,kHAAkH;QAClH,gHAAgH;QAChH,iHAAiH;QACjH,wGAAwG;QACxG,EAAE;QACF,mHAAmH;QACnH,8GAA8G;QAC9G,+EAA+E;QAC/E,gIAAgI;QAChI,IAAI,iCAAiC,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC;YAAE,SAAS;QACrE,IAAI,CAAC,4BAA4B,CAAC,QAAQ,EAAE,EAAE,CAAC;YAAE,SAAS;QAC1D,KAAK,MAAM,WAAW,IAAI,QAAQ,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YACjD,SAAS,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE,QAAQ,C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E,EAAE;QAC3B,MAAM,OAAO,GACX,eAAe,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;QACvG,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAClD,CAAC,CAAC,CACH,CAAC;IAEF,OAAO;QACL,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,uBAAuB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;QAC9G,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,uBAAuB,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;KAC1H,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Loading what a provider actually declared, instead of naming it — on EVERY\n * frontend surface, from one copy.\n *\n * This is the consumer for the DATA half of a provider's executable surface: the\n * `scripts` it declares (#332). It serves the case a dynamic `import()` cannot: a\n * vendor that ships a global-installing `<script>` tag rather than an npm module\n * (the Google API loader behind the Drive Picker, Microsoft's OneDrive picker,\n * reCAPTCHA, tag managers, chat widgets, the CDN distributions of most analytics\n * SDKs). The npm half — `sdk.activate` — lives beside it in\n * `activate-frontend-provider-sdks.ts`; a provider that declares both gets its\n * scripts from here and its SDK from there.\n *\n * ## Why this lives here and not in each surface\n *\n * It first shipped inside `@wildo-ai/saas-website` only, and that is exactly how\n * the SaaS application came to declare `https://apis.google.com/js/api.js` for\n * its Drive Picker and never inject it: the picker then failed with \"The Google\n * API script has not loaded\" on the one surface that offers it. A DOM mutation\n * that several surfaces perform must have one implementation, because a second\n * copy eventually disagrees about idempotence — which is how a vendor tag gets\n * loaded twice, and a vendor tag loaded twice initialises twice.\n *\n * ## Injecting is not enough: why `loadProviderScripts` AWAITS\n *\n * A dynamically created `<script>` is fetched and executed asynchronously. A\n * component that mounts in the same tick as the injection — or a second later,\n * on a slow network — reads the vendor global before the tag has executed and\n * sees nothing. So \"the script is in the document\" and \"what the script installs\n * is present\" are different facts, and only the second makes a dependent\n * component usable. `loadProviderScripts` resolves on the second.\n *\n * The state lives ON THE ELEMENT (`PROVIDER_SCRIPT_STATE_ATTRIBUTE`), not in a\n * module-level map, and that is the part that has to be right: a bundle can hold\n * two instances of this module (two chunks, a hot reload, a website island and a\n * shared vendor chunk), and a `load` event fires exactly once. A caller arriving\n * after the event can never observe it again, so the element itself must record\n * that it happened. The listeners that record it are attached at injection,\n * before the browser can possibly have fetched the file.\n */\n\nimport type { ProviderFrontendScriptDeclaration } from '@wildo-ai/saas-models/public-runtime';\nimport { consentPurposesRequiredByProvider, isProviderPermittedByConsent } from './frontend-provider-consent';\n\n/**\n * Marks a `<script>` this module owns, so a re-render, a client-side route\n * change or a second mount finds it instead of appending a duplicate. The value\n * is the declaring provider's ref.\n */\nexport const PROVIDER_SCRIPT_MARKER_ATTRIBUTE = 'data-wildo-provider-script';\n\n/**\n * Records, on the element itself, how far a provider script has got. Its values\n * are exactly `ProviderScriptLoadState`. See the module note for why the state\n * cannot live anywhere else.\n */\nexport const PROVIDER_SCRIPT_STATE_ATTRIBUTE = 'data-wildo-provider-script-state';\n\n/** How far a provider-owned `<script>` element has got. The one source for the state attribute's values. */\nexport enum ProviderScriptLoadState {\n /** Injected; neither `load` nor `error` has fired yet. A caller awaiting it must listen. */\n LOADING = 'loading',\n /** `load` fired: the script executed, so whatever global it installs is now present. */\n LOADED = 'loaded',\n /**\n * `error` fired: a network failure, a CSP refusal, or a Subresource Integrity\n * mismatch. The element is left in place and NOT retried in this document — a\n * vendor script can fail after partially executing, and a second copy could\n * initialise over the first. A reload is the retry.\n */\n FAILED = 'failed',\n}\n\nexport interface DeclaredProviderScript {\n readonly providerRef: string;\n readonly declaration: ProviderFrontendScriptDeclaration;\n}\n\n/**\n * The shape this module needs off a provider module. Every facet's module type\n * (app, website, techdoc) and every DATA entry satisfies it, so one collector\n * serves all three surfaces.\n */\nexport interface ScriptBearingProviderModule {\n readonly metadata: { readonly ref: string };\n readonly scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /** Read to decide whether the provider rests on consent — see `frontend-provider-consent.ts`. */\n readonly providerCapabilities?: ReadonlyArray<string>;\n /** The provider's own purposes beyond its capabilities' floor (#1702) — read by the same decision. */\n readonly consentPurposes?: ReadonlyArray<string>;\n}\n\n/**\n * Every script declared by the given providers, in iteration order, with the\n * declaring ref kept beside each one so a failure can name it.\n *\n * `undefined` collects nothing: a surface with no hydrated registry declares no\n * scripts, and asking it to special-case that would be one more place to forget.\n */\nexport function collectDeclaredProviderScripts(\n modules: Iterable<ScriptBearingProviderModule> | undefined,\n): ReadonlyArray<DeclaredProviderScript> {\n if (modules === undefined) return [];\n\n const collected: DeclaredProviderScript[] = [];\n for (const provider of modules) {\n // Unlike an SDK, an injected script cannot be stopped, so a provider that rests on ANY consent purpose contributes\n // no script at all, granted or not (#1704): a withdrawal must stop what the grant started, and nothing can stop a\n // script once it ran. Such a vendor loads its script from inside a stoppable `sdk.activate`. The projection and\n // hydration refuse the same shape; this is the runner's own copy of the rule, so a hand-built module list cannot\n // reach a page with one. (The component registry applies it to the scripts that load with a component.)\n //\n // That is also why this takes no granted purposes (it did until #1704's review): with every consent-based provider\n // skipped, no grant could change what is collected. The permission check below still FAILS CLOSED on a broken\n // classification, asked with no grant, which is the only question left for it.\n // assurance-control: WILDO.PRIVACY.CONSENT_ENFORCEMENT — no consent-based provider injects a script a withdrawal could not stop\n if (consentPurposesRequiredByProvider(provider).length > 0) continue;\n if (!isProviderPermittedByConsent(provider, [])) continue;\n for (const declaration of provider.scripts ?? []) {\n collected.push({ providerRef: provider.metadata.ref, declaration });\n }\n }\n return collected;\n}\n\nexport interface InjectProviderScriptsResult {\n /** Refs whose script this call added. */\n readonly injected: ReadonlyArray<string>;\n /** Refs whose script was already present, so nothing was added. */\n readonly alreadyPresent: ReadonlyArray<string>;\n}\n\n/**\n * Finds the element this module owns for one `src`, if any.\n *\n * Matched by reading the attribute rather than by a selector carrying the URL: a\n * `src` can contain characters a CSS selector would have to escape, and an\n * escaping bug here would show up as a duplicated vendor tag — two analytics\n * clients, two sets of events — rather than as an error.\n */\nfunction findOwnedScript(targetDocument: Document, src: string): HTMLScriptElement | undefined {\n return [...targetDocument.querySelectorAll<HTMLScriptElement>(`script[${PROVIDER_SCRIPT_MARKER_ATTRIBUTE}]`)]\n .find((element) => element.getAttribute('src') === src);\n}\n\n/**\n * Creates and appends one provider script, with its state tracking attached\n * BEFORE it is appended — so no `load` or `error` can fire unrecorded.\n */\nfunction appendOwnedScript(targetDocument: Document, script: DeclaredProviderScript): HTMLScriptElement {\n const { providerRef, declaration } = script;\n const element = targetDocument.createElement('script');\n element.src = declaration.src;\n element.setAttribute(PROVIDER_SCRIPT_MARKER_ATTRIBUTE, providerRef);\n element.setAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE, ProviderScriptLoadState.LOADING);\n element.addEventListener(\n 'load',\n () => element.setAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE, ProviderScriptLoadState.LOADED),\n { once: true },\n );\n element.addEventListener(\n 'error',\n () => element.setAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE, ProviderScriptLoadState.FAILED),\n { once: true },\n );\n\n if (declaration.integrity !== undefined) {\n element.integrity = declaration.integrity;\n }\n if (declaration.crossOrigin !== undefined) {\n element.crossOrigin = declaration.crossOrigin;\n }\n // `async` defaults to TRUE when the declaration says nothing: a third-party\n // tag that blocks parsing is the most common way a provider costs a page its\n // paint metrics. Both flags are set explicitly rather than left to the\n // element's defaults: a dynamically created script is `async` by default, so\n // `defer: true` alone would be silently ignored without the paired\n // `async = false`.\n element.async = declaration.async ?? declaration.defer !== true;\n element.defer = declaration.defer ?? false;\n\n targetDocument.head.appendChild(element);\n return element;\n}\n\n/**\n * Adds each declared script to the document, once, WITHOUT waiting for any of\n * them. For a surface that needs the tags present and depends on nothing they\n * install synchronously (an analytics tag on a marketing page).\n *\n * Idempotent by `src`: a declaration whose element is already in the document is\n * skipped. Callers may therefore run this on every mount without tracking state.\n */\nexport function injectProviderScripts(\n scripts: ReadonlyArray<DeclaredProviderScript>,\n targetDocument: Document,\n): InjectProviderScriptsResult {\n const injected: string[] = [];\n const alreadyPresent: string[] = [];\n\n for (const script of scripts) {\n if (findOwnedScript(targetDocument, script.declaration.src) !== undefined) {\n alreadyPresent.push(script.providerRef);\n continue;\n }\n appendOwnedScript(targetDocument, script);\n injected.push(script.providerRef);\n }\n\n return { injected, alreadyPresent };\n}\n\n/** One declared script that did not load. Reported, never thrown. */\nexport interface ProviderScriptLoadFailure {\n readonly providerRef: string;\n readonly src: string;\n readonly message: string;\n}\n\nexport interface ProviderScriptLoadOutcome {\n /** Every script that has executed, whether this call injected it or found it already loaded. */\n readonly loaded: ReadonlyArray<DeclaredProviderScript>;\n /** Every script that failed, now or in an earlier call. Empty means everything asked for is present. */\n readonly failed: ReadonlyArray<ProviderScriptLoadFailure>;\n}\n\nfunction failureOf(script: DeclaredProviderScript): ProviderScriptLoadFailure {\n return {\n providerRef: script.providerRef,\n src: script.declaration.src,\n message:\n `Provider \"${script.providerRef}\" declares the script \"${script.declaration.src}\" and it failed to load `\n + '(network failure, a Content-Security-Policy refusal, or an integrity mismatch). Whatever it installs is '\n + 'not present on this surface.',\n };\n}\n\n/**\n * Waits for one owned element to settle. An element already `LOADED` or `FAILED`\n * answers immediately; a `LOADING` one is listened to.\n *\n * An element carrying the marker but NO state attribute was injected by\n * something that did not track it (an older copy of this module). Its `load`\n * event may already have fired and cannot be observed again, so waiting would\n * hang forever on an element that is very likely loaded; it is therefore treated\n * as loaded, and a script that really failed will surface as the vendor global\n * being absent at its use site — which every consumer must already handle.\n */\nfunction settle(element: HTMLScriptElement): Promise<ProviderScriptLoadState.LOADED | ProviderScriptLoadState.FAILED> {\n const state = element.getAttribute(PROVIDER_SCRIPT_STATE_ATTRIBUTE);\n if (state === ProviderScriptLoadState.FAILED) return Promise.resolve(ProviderScriptLoadState.FAILED);\n if (state !== ProviderScriptLoadState.LOADING) return Promise.resolve(ProviderScriptLoadState.LOADED);\n\n return new Promise((resolve) => {\n const onLoad = (): void => {\n element.removeEventListener('error', onError);\n resolve(ProviderScriptLoadState.LOADED);\n };\n const onError = (): void => {\n element.removeEventListener('load', onLoad);\n resolve(ProviderScriptLoadState.FAILED);\n };\n element.addEventListener('load', onLoad, { once: true });\n element.addEventListener('error', onError, { once: true });\n });\n}\n\n/**\n * Adds each declared script to the document once and resolves when every one of\n * them has EXECUTED or failed — for a caller that depends on what the scripts\n * install (a picker component that reads `window.gapi` when it mounts).\n *\n * Idempotent by `src`, exactly like `injectProviderScripts`, and correct however\n * the element came to exist: a second caller — including one from another module\n * instance — awaits an element still loading, resolves immediately for one\n * already loaded, and reports one that already failed. It never throws: one\n * provider's broken CDN must not become an exception in a render path, and the\n * caller decides what a failure means for it.\n *\n * It does not time out. A request that neither completes nor errors is ended by\n * the browser's own network timeout, which fires `error`; a second, shorter\n * timer here would declare a slow network a broken provider.\n */\nexport async function loadProviderScripts(\n scripts: ReadonlyArray<DeclaredProviderScript>,\n targetDocument: Document,\n): Promise<ProviderScriptLoadOutcome> {\n const settled = await Promise.all(\n scripts.map(async (script) => {\n const element =\n findOwnedScript(targetDocument, script.declaration.src) ?? appendOwnedScript(targetDocument, script);\n return { script, state: await settle(element) };\n }),\n );\n\n return {\n loaded: settled.filter((entry) => entry.state === ProviderScriptLoadState.LOADED).map((entry) => entry.script),\n failed: settled.filter((entry) => entry.state === ProviderScriptLoadState.FAILED).map((entry) => failureOf(entry.script)),\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"provider-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CAAC,UAAU,GAAG,OAAO,KAAK,0BAA0B,CAAC,UAAU,CAAC,CAE7G;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE;IAC5D,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,sBAAsB,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,0BAA0B,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC3E,GAAG,MAAM,IAAI,CA+Bb"}
1
+ {"version":3,"file":"provider-component-registry.d.ts","sourceRoot":"","sources":["../../../src/shared/provider-component-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,mCAAmC,EACnC,iCAAiC,EAClC,MAAM,sCAAsC,CAAC;AAG9C,OAAO,EAKL,KAAK,iCAAiC,EACvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,yBAAyB,EAC/B,MAAM,kCAAkC,CAAC;AAG1C,2HAA2H;AAE3H,qFAAqF;AACrF,MAAM,MAAM,uBAAuB,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;AAE7D,kEAAkE;AAClE,oBAAY,+BAA+B;IACzC;;;;OAIG;IACH,sBAAsB,2BAA2B;IACjD,uGAAuG;IACvG,WAAW,gBAAgB;IAC3B;;;OAGG;IACH,+BAA+B,oCAAoC;IACnE;;;;;OAKG;IACH,uBAAuB,4BAA4B;IACnD;;;;OAIG;IACH,qBAAqB,0BAA0B;I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,aAAa,CAAC,sBAAsB,CAAC,CAMvC;AAED,6HAA6H;AAE7H;;;GAGG;AACH,oBAAY,uBAAuB;IACjC,8EAA8E;IAC9E,IAAI,SAAS;IACb,8EAA8E;IAC9E,OAAO,YAAY;IACnB;;;OAGG;IACH,KAAK,UAAU;IACf;;;OAGG;IACH,WAAW,gBAAgB;IAC3B;;;;OAIG;IACH,gBAAgB,qBAAqB;CACtC;AAED,MAAM,WAAW,0BAA0B,CAAC,UAAU,GAAG,OAAO;IAC9D,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,UAAU,GAAG,IAAI,CAAC;IACtC,oFAAoF;IACpF,QAAQ,CAAC,sBAAsB,EAAE,SAAS,cAAc,EAAE,CAAC;CAC5D;AAMD,qDAAqD;AACrD,wBAAgB,8BAA8B,CAAC,UAAU,GAAG,OAAO,KAAK,0BAA0B,CAAC,UAAU,CAAC,CAE7G;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,KAAK,EAAE;IAC5D,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC,UAAU,CAAC,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC;IACxC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,sBAAsB,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,0BAA0B,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CAC3E,GAAG,MAAM,IAAI,CA+Bb"}
@@ -1 +1 @@
1
- {"version":3,"file":"provider-component-registry.js","sourceRoot":"","sources":["../../../../src/shared/provider-component-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAQH,OAAO,EAAE,mBAAmB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ourcesContent":["/**\n * Components contributed by PROVIDERS, keyed by the capability each fills — the ONE registry every\n * browser surface builds from a provider's `components` declaration (#380, #1703).\n *\n * ## Why it lives here, below all three surfaces\n *\n * A provider declares its components once, on its frontend module (`components[capability]`), and\n * the application, the marketing website and the documentation site all have to honour that one\n * declaration. Until #1703 the registry lived in `saas-frontend-lib`, which neither the website nor\n * the documentation site may import (their bundle-isolation walks refuse the SaaS-app stack), so a\n * website form could not use a provider component at all — an address lookup on a contact form\n * (#561) had nowhere to load from. Putting a second copy in each surface was the rejected\n * alternative: the key, the consent gate, the \"loader returned a module namespace\" refusal and the\n * script-before-component rule would then be three implementations that drift apart, and the\n * one-declaration-per-provider contract would stop being true in practice.\n *\n * So the registry is renderer-free and lives in this package, which all three surfaces already\n * depend on. Nothing in it imports React: the component type is a type parameter each surface fills\n * (`React.ComponentType<never>` in all three today), and \"is this renderable\" is checked\n * structurally, which is all React itself can check before a render.\n *\n * ## Why it is a sibling of the application's `ComponentRegistryService`, not an extension\n *\n * The two answer different questions, and the difference is in the KEY, the cardinality and the\n * lifecycle:\n *\n * - `ComponentRegistryService` keys `componentType:preset[:category]` over a CLOSED enum the engine\n * owns. Exactly one component answers a key, resolution is synchronous, and a missing\n * registration is a startup refusal.\n * - This registry keys `capability:providerRef`. The capability half is closed\n * (`ProviderCapability`), but the PROVIDER half is not engine-owned at all: refs arrive from\n * engine modules, generated packages and application packages, discovered per deployment.\n * SEVERAL providers may answer one capability, the component arrives asynchronously, and none of\n * it is required for the surface to mount.\n *\n * ## Several providers, and no silent winner\n *\n * `listProviders` returns every provider offering a component for a capability, in registration\n * order, and nothing here picks one. Resolution USED to be first-match, so a Drive picker and a\n * Dropbox picker could not coexist and the winner depended on map order. A surface with two\n * providers has a choice to present; a registry that answered it would be making a product decision\n * in a lookup table.\n *\n * ## Never during a server render\n *\n * The website renders on the server (Astro) and the documentation site prerenders at build\n * (Docusaurus). A provider component must never be imported or executed there: its loader reaches\n * vendor code through a dynamic `import()`, and running it in a build would put a vendor's code in\n * the build process and, worse, its markup in the static HTML every visitor downloads before\n * consenting to anything. The surfaces only resolve from an effect, which never runs on a server —\n * and `resolve` refuses on its own when there is no browser document\n * (`NOT_IN_A_BROWSER`), so a host that calls it from a server path is stopped at the one place\n * every load goes through rather than trusted to remember.\n */\n\nimport type {\n ConsentPurpose,\n ProviderCapability,\n ProviderFrontendComponentDescriptor,\n ProviderFrontendScriptDeclaration,\n} from '@wildo-ai/saas-models/public-runtime';\nimport { describeThrownValue } from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n consentBasedProviderStopRefusal,\n describeProviderConsentRefusal,\n isProviderPermittedByConsent,\n missingConsentPurposesForProvider,\n type ConsentClassifiableProviderModule,\n} from './frontend-provider-consent';\nimport {\n collectDeclaredProviderScripts,\n loadProviderScripts,\n type DeclaredProviderScript,\n type ProviderScriptLoadOutcome,\n} from './load-frontend-provider-scripts';\nimport { projectFrontendComponentDescriptor } from './frontend-provider-surface.types';\n\n/** @wildo_source:part:start external-connectors.provider-component-registry facet:kind:api facet:audience:app-developer */\n\n/** A loader as a provider module declares it: on demand, returning the component. */\nexport type ProviderComponentLoader = () => Promise<unknown>;\n\n/** Why a provider component could not be registered or loaded. */\nexport enum ProviderComponentDiagnosticKind {\n /**\n * A second registration arrived for one capability AND provider. The first is kept: a duplicate is\n * a wiring mistake, and swapping the live component under a mounted surface would be worse than\n * ignoring it.\n */\n DUPLICATE_REGISTRATION = 'DUPLICATE_REGISTRATION',\n /** The loader threw or rejected. That provider's component is unavailable; others are not affected. */\n LOAD_FAILED = 'LOAD_FAILED',\n /**\n * The loader resolved something that is not a component. Almost always a loader returning a MODULE\n * NAMESPACE — `() => import('./Picker')` — where it should return the component itself.\n */\n LOADED_VALUE_IS_NOT_A_COMPONENT = 'LOADED_VALUE_IS_NOT_A_COMPONENT',\n /**\n * A live provider DECLARES a component for a capability and nothing supplies its loader — neither\n * the module (`components[cap].load`) nor the surface's facet library (a loader contribution). The\n * declaration is DATA a reviewer can read; without code behind it the surface would offer a\n * component that cannot open. Not registered, and reported once at startup.\n */\n DECLARED_WITHOUT_LOADER = 'DECLARED_WITHOUT_LOADER',\n /**\n * BOTH the module and the facet library supplied a loader for one `capability:providerRef`. The\n * module's wins — it is the provider's own word — and the collision is reported, because the engine\n * never authors both and two loaders for one declaration is the map-order ambiguity #380 removed.\n */\n LOADER_SUPPLIED_TWICE = 'LOADER_SUPPLIED_TWICE',\n /**\n * A `<script>` the declaring provider needs did not load — a network failure, a\n * Content-Security-Policy refusal, or an integrity mismatch. The component resolves `null`, and that\n * answer is CACHED exactly like `LOAD_FAILED`: the failed element stays in the document and is not\n * retried this session (a vendor script can fail after partially executing, and a second copy could\n * initialise over the first). A component whose vendor global is absent is not usable, and handing\n * it back would only move the failure into its own mount, where nothing can name the provider's\n * declaration as the cause.\n */\n SCRIPT_LOAD_FAILED = 'SCRIPT_LOAD_FAILED',\n /**\n * The provider rests on a consent purpose the person has not granted, or its consent classification\n * is broken, so neither its component nor its scripts were loaded (#1702). NOT cached: a grant given\n * a moment later must be able to load it, which is the difference from every failure above.\n */\n WITHHELD_PENDING_CONSENT = 'WITHHELD_PENDING_CONSENT',\n /**\n * `resolve` was called where there is no browser document — a server render (the website) or a\n * build-time prerender (the documentation site). Nothing was loaded and nothing is cached: the same\n * registry asked again in the browser loads normally (#1703).\n */\n NOT_IN_A_BROWSER = 'NOT_IN_A_BROWSER',\n /**\n * The provider rests on a consent purpose AND its registration carries `<script>` tags (#1704). A script,\n * once executed, cannot be stopped when that consent is withdrawn, so such a registration is never\n * registered: neither its component nor its scripts can load. Projection already refuses the module and\n * hydration withholds it; this is the same predicate (`consentBasedProviderStopRefusal`) at the registry,\n * so a hand-built module list cannot reach a page with one either.\n */\n CONSENT_BASED_PROVIDER_NOT_STOPPABLE = 'CONSENT_BASED_PROVIDER_NOT_STOPPABLE',\n}\n\nexport interface ProviderComponentDiagnostic {\n readonly kind: ProviderComponentDiagnosticKind;\n readonly capability: string;\n readonly providerRef: string;\n readonly message: string;\n readonly cause?: unknown;\n}\n\nexport interface ProviderComponentRegistration {\n readonly capability: ProviderCapability;\n readonly providerRef: string;\n readonly load: ProviderComponentLoader;\n /**\n * What the provider DECLARED about this component — today, what a selection from it contains. Kept\n * beside the loader rather than looked up from the DATA entry at the use site, because a surface\n * needs it BEFORE it decides to load anything, and because the two would then be two sources for\n * one fact.\n */\n readonly descriptor: ProviderFrontendComponentDescriptor;\n /**\n * The third-party `<script>` tags the DECLARING PROVIDER needs (its module's `scripts`), loaded\n * before the component is handed back. Absent means the component depends on no script.\n */\n readonly scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /**\n * What the DECLARING PROVIDER rests on for consent — its capabilities and its own module-level\n * purposes (#1702). Consent is a property of the provider, not of one component. Required, so a\n * registration cannot be built that forgot the question.\n */\n readonly consent: ConsentClassifiableProviderModule;\n}\n\n/** Whether a provider's component may load for the purposes granted, and what would permit it. */\nexport interface ProviderComponentConsentRequirement {\n /** True when the component may load now. */\n readonly permitted: boolean;\n /**\n * The purposes the person would have to grant. Empty when `permitted`, AND when no grant could\n * permit it (a capability no browser may host, a purpose outside the vocabulary) — which is why\n * `permitted` exists.\n */\n readonly missingPurposes: readonly ConsentPurpose[];\n}\n\n/**\n * Loads a provider's declared scripts and resolves once each has executed or failed. Never rejects:\n * failures come back in the outcome.\n */\nexport type ProviderComponentScriptLoader = (\n scripts: ReadonlyArray<DeclaredProviderScript>,\n) => Promise<ProviderScriptLoadOutcome>;\n\nexport interface ProviderComponentRegistry<TComponent = unknown> {\n /**\n * Every provider offering a component for this capability, in registration order. Synchronous ON\n * PURPOSE: a surface has to render its chooser before any component is loaded.\n */\n listProviders(capability: ProviderCapability): ReadonlyArray<string>;\n /** Whether this exact provider offers a component for this capability. */\n has(capability: ProviderCapability, providerRef: string): boolean;\n /**\n * Every provider with at least one registered component. A surface reads it to load such a provider's\n * `<script>` tags WITH its component rather than at startup — see `collectProviderScriptsWithoutComponents`.\n */\n providersWithComponents(): ReadonlySet<string>;\n /**\n * What the provider declared about its component, without loading it — `undefined` when this\n * provider offers none for this capability. Synchronous: a routing decision that had to await a\n * download would mean downloading a component to find out whether the surface can use it.\n */\n describe(capability: ProviderCapability, providerRef: string): ProviderFrontendComponentDescriptor | undefined;\n /**\n * Whether this provider's component may load for the purposes granted (#1702) — `undefined` when\n * the provider offers none. Synchronous, so a surface can render a consent-required state without\n * downloading anything.\n */\n consentRequirement(\n capability: ProviderCapability,\n providerRef: string,\n grantedConsentPurposes: readonly ConsentPurpose[],\n ): ProviderComponentConsentRequirement | undefined;\n /**\n * Loads one provider's component AND the scripts its provider declares, in parallel, and hands the\n * component back only once both are present. The loader runs at most once per pair, and a failure\n * of either half is reported and returns `null` rather than throwing into a render.\n *\n * CONSENT-GATED (#1702): a provider resting on a purpose not in `grantedConsentPurposes` loads\n * nothing and resolves `null` with `WITHHELD_PENDING_CONSENT`. The grant defaults to NONE: a caller\n * that holds no person's answer must not load consent-based code on an assumed one.\n *\n * BROWSER-ONLY (#1703): with no browser document it loads nothing and resolves `null` with\n * `NOT_IN_A_BROWSER`. Neither refusal is cached.\n */\n resolve(\n capability: ProviderCapability,\n providerRef: string,\n grantedConsentPurposes?: readonly ConsentPurpose[],\n ): Promise<TComponent | null>;\n}\n\nexport interface CreateProviderComponentRegistryInput {\n readonly registrations?: Iterable<ProviderComponentRegistration>;\n readonly onDiagnostic?: (diagnostic: ProviderComponentDiagnostic) => void;\n /**\n * How declared scripts are loaded. Defaults to the shared injector on the live `document`;\n * injectable so a test can settle a script without a network.\n */\n readonly loadScripts?: ProviderComponentScriptLoader;\n /**\n * Whether a browser document is present. Defaults to `typeof document !== 'undefined'`, read on\n * every `resolve`. Injectable only so a test can stand for a server render inside a DOM test\n * environment; a host must not pass `() => true` to force a load on a server.\n */\n readonly hasBrowserDocument?: () => boolean;\n}\n\n/** @wildo_source:part:end external-connectors.provider-component-registry */\n\n/**\n * Whether this runtime has a browser document to load into. Read at CALL time — a module evaluated\n * on a server and later in a browser must answer for where it is running NOW.\n */\nfunction hasBrowserDocument(): boolean {\n return typeof document !== 'undefined';\n}\n\n/**\n * The default script loader: the shared `loadProviderScripts` against the live `document`, read at\n * call time rather than at registry construction. Only reached after `resolve` has established that\n * a document exists.\n */\nconst loadProviderScriptsIntoDocument: ProviderComponentScriptLoader = (scripts) => loadProviderScripts(scripts, document);\n\nfunction isModuleNamespace(value: unknown): boolean {\n return (\n typeof value === 'object'\n && value !== null\n && (value as { [Symbol.toStringTag]?: unknown })[Symbol.toStringTag] === 'Module'\n );\n}\n\n/**\n * A React component is a function, or an object for `memo` / `forwardRef` / `lazy`. Anything else —\n * a namespace, a string, a plain data object — cannot be rendered, and finding out at render time\n * means a blank surface with a stack trace pointing at React rather than at the provider.\n */\nfunction looksLikeComponent(value: unknown): boolean {\n return typeof value === 'function' || (typeof value === 'object' && value !== null);\n}\n\n/**\n * Builds a provider-component registry. `TComponent` is the surface's component type; the registry\n * checks renderability structurally and never renders anything itself.\n */\nexport function createProviderComponentRegistry<TComponent = unknown>(\n input?: CreateProviderComponentRegistryInput,\n): ProviderComponentRegistry<TComponent> {\n const raise = (diagnostic: ProviderComponentDiagnostic): void => {\n input?.onDiagnostic?.(diagnostic);\n };\n const loaders = new Map<string, ProviderComponentLoader>();\n const scriptsByKey = new Map<string, ReadonlyArray<ProviderFrontendScriptDeclaration>>();\n const loadScripts = input?.loadScripts ?? loadProviderScriptsIntoDocument;\n const inBrowser = input?.hasBrowserDocument ?? hasBrowserDocument;\n const descriptors = new Map<string, ProviderFrontendComponentDescriptor>();\n const consentSubjects = new Map<string, ConsentClassifiableProviderModule>();\n const byCapability = new Map<string, string[]>();\n const loaded = new Map<string, Promise<TComponent | null>>();\n const keyOf = (capability: string, providerRef: string): string => `${capability}:${providerRef}`;\n\n for (const registration of input?.registrations ?? []) {\n const key = keyOf(registration.capability, registration.providerRef);\n if (loaders.has(key)) {\n raise({\n kind: ProviderComponentDiagnosticKind.DUPLICATE_REGISTRATION,\n capability: registration.capability,\n providerRef: registration.providerRef,\n message:\n `Provider \"${registration.providerRef}\" registered a component for \"${registration.capability}\" `\n + 'more than once. The first registration is kept.',\n });\n continue;\n }\n\n // The #1704 stop rule, here because this is where a registration's scripts are loaded.\n const stopRefusal = consentBasedProviderStopRefusal(registration.providerRef, {\n ...registration.consent,\n ...(registration.scripts !== undefined ? { scripts: registration.scripts } : {}),\n });\n if (stopRefusal !== undefined) {\n raise({\n kind: ProviderComponentDiagnosticKind.CONSENT_BASED_PROVIDER_NOT_STOPPABLE,\n capability: registration.capability,\n providerRef: registration.providerRef,\n message: `${stopRefusal} Its \"${registration.capability}\" component is not offered.`,\n });\n continue;\n }\n\n loaders.set(key, registration.load);\n if (registration.scripts !== undefined && registration.scripts.length > 0) {\n scriptsByKey.set(key, registration.scripts);\n }\n descriptors.set(key, registration.descriptor);\n consentSubjects.set(key, registration.consent);\n const providers = byCapability.get(registration.capability) ?? [];\n providers.push(registration.providerRef);\n byCapability.set(registration.capability, providers);\n }\n\n return {\n listProviders(capability) {\n return byCapability.get(capability) ?? [];\n },\n\n has(capability, providerRef) {\n return loaders.has(keyOf(capability, providerRef));\n },\n\n providersWithComponents() {\n return new Set([...byCapability.values()].flat());\n },\n\n describe(capability, providerRef) {\n return descriptors.get(keyOf(capability, providerRef));\n },\n\n consentRequirement(capability, providerRef, grantedConsentPurposes) {\n const subject = consentSubjects.get(keyOf(capability, providerRef));\n if (subject === undefined) return undefined;\n const permitted = isProviderPermittedByConsent(subject, grantedConsentPurposes);\n return { permitted, missingPurposes: permitted ? [] : missingConsentPurposesForProvider(subject, grantedConsentPurposes) };\n },\n\n resolve(capability, providerRef, grantedConsentPurposes = []) {\n const key = keyOf(capability, providerRef);\n const load = loaders.get(key);\n if (load === undefined) return Promise.resolve(null);\n\n // The server-render refusal comes FIRST (#1703): nothing about a provider — not its consent\n // answer, not its cache — is worth consulting where its code must not run at all. Not cached,\n // so the same registry loads normally once asked in the browser.\n if (!inBrowser()) {\n raise({\n kind: ProviderComponentDiagnosticKind.NOT_IN_A_BROWSER,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\"'s \"${capability}\" component was requested where there is no browser document `\n + '(a server render or a build-time prerender). Nothing was loaded; resolve it from an effect.',\n });\n return Promise.resolve(null);\n }\n\n // The consent gate comes BEFORE the cache (#1702): a component loaded under one grant must not\n // be handed to a caller holding a narrower one — the person may have withdrawn in between — and\n // a withheld answer is never cached, so a grant given a moment later loads it.\n const consentSubject = consentSubjects.get(key) ?? {};\n if (!isProviderPermittedByConsent(consentSubject, grantedConsentPurposes)) {\n raise({\n kind: ProviderComponentDiagnosticKind.WITHHELD_PENDING_CONSENT,\n capability,\n providerRef,\n message: `${describeProviderConsentRefusal(providerRef, consentSubject, grantedConsentPurposes)} `\n + `Its \"${capability}\" component and scripts were not loaded.`,\n });\n return Promise.resolve(null);\n }\n\n const cached = loaded.get(key);\n if (cached !== undefined) return cached;\n\n const declaredScripts = scriptsByKey.get(key) ?? [];\n\n const pending = (async (): Promise<TComponent | null> => {\n // Both halves start together: the component chunk and the vendor loader are independent\n // downloads, and serialising them would make every first open wait for their SUM.\n //\n // Each half is started through `Promise.resolve().then(...)` so a loader that throws\n // SYNCHRONOUSLY is still a reported failure rather than an exception escaping `resolve`, and a\n // script loader that breaks its never-rejects contract is still a SCRIPT_LOAD_FAILED rather\n // than an unhandled rejection in a render path.\n const scriptsToLoad: ReadonlyArray<DeclaredProviderScript> = declaredScripts.map((declaration) => ({ providerRef, declaration }));\n const [componentResult, scriptOutcome] = await Promise.all([\n Promise.resolve().then(load).then(\n (value): { readonly ok: true; readonly value: unknown } => ({ ok: true, value }),\n (cause: unknown): { readonly ok: false; readonly cause: unknown } => ({ ok: false, cause }),\n ),\n scriptsToLoad.length === 0\n ? Promise.resolve<ProviderScriptLoadOutcome | undefined>(undefined)\n : Promise.resolve().then(() => loadScripts(scriptsToLoad)).catch((cause: unknown): ProviderScriptLoadOutcome => ({\n loaded: [],\n failed: scriptsToLoad.map(({ declaration }) => ({\n providerRef,\n src: declaration.src,\n message: `The script loader failed before reporting an outcome: ${describeThrownValue(cause)}`,\n })),\n })),\n ]);\n\n // Reported independently so a first open that fails on BOTH halves names both causes.\n for (const failure of scriptOutcome?.failed ?? []) {\n raise({\n kind: ProviderComponentDiagnosticKind.SCRIPT_LOAD_FAILED,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" cannot offer its \"${capability}\" component: a script it declares did not load. `\n + failure.message,\n });\n }\n\n if (componentResult.ok === false) {\n raise({\n kind: ProviderComponentDiagnosticKind.LOAD_FAILED,\n capability,\n providerRef,\n message: `Provider \"${providerRef}\" failed to load its \"${capability}\" component.`,\n cause: componentResult.cause,\n });\n return null;\n }\n\n if ((scriptOutcome?.failed.length ?? 0) > 0) return null;\n\n const value = componentResult.value;\n\n if (isModuleNamespace(value)) {\n raise({\n kind: ProviderComponentDiagnosticKind.LOADED_VALUE_IS_NOT_A_COMPONENT,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" returned a MODULE for its \"${capability}\" component instead of the `\n // No relative specifier appears in this text on purpose: the build finalizer rewrites\n // anything shaped like `import('./x')` — string contents included — to `import('./x.js')`.\n + 'component itself. Return the named export from the loader — `async () => (await import(…)).Picker` — '\n + 'rather than the module namespace `() => import(…)`.',\n });\n return null;\n }\n\n if (!looksLikeComponent(value)) {\n raise({\n kind: ProviderComponentDiagnosticKind.LOADED_VALUE_IS_NOT_A_COMPONENT,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" returned a ${typeof value} for its \"${capability}\" component. A React `\n + 'component is a function, or an object for memo / forwardRef / lazy.',\n });\n return null;\n }\n\n return value as TComponent;\n })();\n\n // Cached even when it resolves to null: a loader — or a script — that failed once must not be\n // retried on every render of a chooser that lists it.\n loaded.set(key, pending);\n return pending;\n },\n };\n}\n\n/** The shape the registration derivation needs off a hydrated provider module, on any surface. */\nexport interface ComponentBearingProviderModule {\n metadata: { ref: string };\n /** Read, with `consentPurposes`, to carry the provider's consent classification onto each registration (#1702). */\n providerCapabilities?: ReadonlyArray<string>;\n consentPurposes?: ReadonlyArray<string>;\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n components?: Readonly<Record<string, ProviderFrontendComponentDescriptor & { load?: ProviderComponentLoader }>>;\n}\n\n/** @wildo_source:part:start external-connectors.provider-component-loader-contribution facet:kind:api facet:audience:app-developer */\n\n/**\n * A loader the SURFACE'S FACET LIBRARY supplies for a component a provider module declares — the\n * second of the two doors, and the one every engine-shipped component uses (#394).\n *\n * An engine provider module lives in this deliberately renderer-free package and cannot name a\n * loader that reaches a React component: that would close a package cycle. The library that owns\n * the component contributes the loader instead:\n *\n * - the application: `presets-components`, through `contributeProviderComponentLoaders`;\n * - the website: the page bridge's `providerComponentLoaders` dependency;\n * - the documentation site: `DocsFrontendProviders`' `providerComponentLoaders` prop.\n *\n * A provider PACKAGE that ships its own component uses `components[cap].load` instead. Both doors\n * exist, the engine authors exactly one per declaration, and a collision is reported.\n */\nexport interface ProviderComponentLoaderContribution {\n readonly capability: ProviderCapability;\n readonly providerRef: string;\n readonly load: ProviderComponentLoader;\n}\n\n/** @wildo_source:part:end external-connectors.provider-component-loader-contribution */\n\n/** The key a loader contribution and a registration share: `capability:providerRef`. */\nexport function providerComponentLoaderKey(capability: string, providerRef: string): string {\n return `${capability}:${providerRef}`;\n}\n\n/**\n * Indexes loader contributions by `capability:providerRef`. A later contribution for one key\n * replaces an earlier one: a facet library is one author, and the last thing it said is what it\n * means.\n */\nexport function indexProviderComponentLoaderContributions(\n contributions: Iterable<ProviderComponentLoaderContribution> | undefined,\n): ReadonlyMap<string, ProviderComponentLoaderContribution> {\n const index = new Map<string, ProviderComponentLoaderContribution>();\n for (const contribution of contributions ?? []) {\n index.set(providerComponentLoaderKey(contribution.capability, contribution.providerRef), contribution);\n }\n return index;\n}\n\n/**\n * Turns the live provider modules of a surface into registrations, joining each declared component\n * to its loader — from the module when it carries one, else from the facet library's contributions.\n *\n * Order follows the modules' iteration order, which is the order the service declared its providers,\n * so `listProviders` is stable across reloads.\n *\n * A declaration nothing can load is NOT registered — a surface must offer only what can render — and\n * is reported through `onDiagnostic` instead, once, at startup.\n */\nexport function collectProviderComponentRegistrations(\n modules: Iterable<ComponentBearingProviderModule>,\n input?: {\n readonly contributedLoaders?: ReadonlyMap<string, ProviderComponentLoaderContribution>;\n readonly onDiagnostic?: (diagnostic: ProviderComponentDiagnostic) => void;\n },\n): ProviderComponentRegistration[] {\n const registrations: ProviderComponentRegistration[] = [];\n const contributed = input?.contributedLoaders ?? new Map<string, ProviderComponentLoaderContribution>();\n\n for (const module of modules) {\n for (const [capability, declaration] of Object.entries(module.components ?? {})) {\n const providerRef = module.metadata.ref;\n const supplied = contributed.get(providerComponentLoaderKey(capability, providerRef));\n\n if (declaration.load !== undefined && supplied !== undefined) {\n input?.onDiagnostic?.({\n kind: ProviderComponentDiagnosticKind.LOADER_SUPPLIED_TWICE,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" carries its own loader for \"${capability}\" AND the facet library contributed `\n + \"one. The module's is used; remove one of the two.\",\n });\n }\n\n const load = declaration.load ?? supplied?.load;\n if (load === undefined) {\n input?.onDiagnostic?.({\n kind: ProviderComponentDiagnosticKind.DECLARED_WITHOUT_LOADER,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" declares a \"${capability}\" component and nothing supplies its loader — `\n + 'neither the module nor the facet library. It is not offered. An engine-shipped component is '\n + 'registered by the surface\\'s facet library (presets-components for the application, the page '\n + \"bridge's `providerComponentLoaders` for the website, `DocsFrontendProviders`' \"\n + '`providerComponentLoaders` for the documentation site); a provider package supplies '\n + '`components[capability].load`.',\n });\n continue;\n }\n\n registrations.push({\n capability: capability as ProviderCapability,\n providerRef,\n load,\n // Only the declared half, never the whole declaration: `load` is already carried beside it.\n // The same projection the served entry uses, so the ENFORCED copy (delivery, an address lookup's\n // place-id retention and its declared operations, session token and attribution — #1702, #561) and the\n // copy a reviewer reads cannot carry different fields.\n descriptor: projectFrontendComponentDescriptor(declaration),\n // The PROVIDER's consent inputs, copied rather than referenced so a later mutation of the\n // module cannot widen what the registry already decided to gate on.\n consent: {\n providerCapabilities: [...(module.providerCapabilities ?? [])],\n ...(module.consentPurposes !== undefined ? { consentPurposes: [...module.consentPurposes] } : {}),\n },\n // The PROVIDER's scripts, not the component's: a module declares scripts once, and the\n // component is the first of its code to run on this surface — so it is what they load with.\n ...(module.scripts !== undefined && module.scripts.length > 0 ? { scripts: module.scripts } : {}),\n });\n }\n }\n\n return registrations;\n}\n\n/**\n * The scripts a surface must load at STARTUP: those declared by live providers that contribute NO\n * registered component. A provider with a registered component loads its scripts when that\n * component is first resolved — so no page pays for an address lookup's vendor loader on a page with no\n * form — and one without never will, so its scripts load at startup. The same rule on every surface: the\n * application passes its registrations, the website and the documentation site pass\n * `providersWithComponents()` as `{ providerRef }` entries.\n */\nexport function collectProviderScriptsWithoutComponents(\n modules: Iterable<ComponentBearingProviderModule>,\n registrations: Iterable<Pick<ProviderComponentRegistration, 'providerRef'>>,\n): ReadonlyArray<DeclaredProviderScript> {\n const providersWithComponents = new Set<string>();\n for (const registration of registrations) providersWithComponents.add(registration.providerRef);\n return collectDeclaredProviderScripts(\n [...modules].filter((module) => !providersWithComponents.has(module.metadata.ref)),\n );\n}\n\n/** @wildo_source:part:start external-connectors.provider-component-load-state facet:kind:api facet:audience:app-developer */\n\n/**\n * Why a provider component is not on screen yet — ONE vocabulary for the application, the website and\n * the documentation site, so a surface's rendering of each state means the same thing everywhere.\n */\nexport enum ProviderComponentStatus {\n /** No provider was chosen, or none offers a component for this capability. */\n NONE = 'NONE',\n /** The component, or a script its provider declares, is still downloading. */\n LOADING = 'LOADING',\n /**\n * The component is loaded AND every `<script>` its provider declares has executed — so a component\n * that reads a vendor global on mount finds it. Never READY on the component alone.\n */\n READY = 'READY',\n /**\n * The loader failed, returned something unrenderable, or a script the provider declares did not\n * load. The registry has already reported why; a surface should fall back rather than retry.\n */\n UNAVAILABLE = 'UNAVAILABLE',\n /**\n * The provider rests on consent the person has not granted, so NOTHING of it was downloaded (#1702).\n * `missingConsentPurposes` names what would permit it. A surface renders a consent-required state\n * here, never a blank.\n */\n CONSENT_REQUIRED = 'CONSENT_REQUIRED',\n}\n\nexport interface ProviderComponentLoadState<TComponent = unknown> {\n readonly status: ProviderComponentStatus;\n readonly Component: TComponent | null;\n /** The purposes to grant. Non-empty exactly when `status` is `CONSENT_REQUIRED`. */\n readonly missingConsentPurposes: readonly ConsentPurpose[];\n}\n\n/** @wildo_source:part:end external-connectors.provider-component-load-state */\n\nconst NO_MISSING_PURPOSES: readonly ConsentPurpose[] = Object.freeze([]);\n\n/** The state before anything is chosen or loaded. */\nexport function idleProviderComponentLoadState<TComponent = unknown>(): ProviderComponentLoadState<TComponent> {\n return { status: ProviderComponentStatus.NONE, Component: null, missingConsentPurposes: NO_MISSING_PURPOSES };\n}\n\n/**\n * Starts loading one provider's component and reports each state change — the whole decision a\n * surface hook makes, written once so the three surfaces cannot come to disagree about it.\n *\n * Consent is asked BEFORE anything is downloaded, so a provider waiting on consent costs the page\n * nothing and the surface can say why. A classification no grant can satisfy is not\n * CONSENT_REQUIRED — offering a grant that would change nothing is a false promise — so it falls\n * through to `resolve`, which refuses it with a diagnostic, and reads as UNAVAILABLE.\n *\n * Returns a cancel function: a person can switch provider while one is still downloading, and the\n * slower answer must not arrive last and replace the one they chose. Call it only from an effect —\n * that is what keeps it off a server render.\n */\nexport function startProviderComponentLoad<TComponent>(input: {\n readonly registry: ProviderComponentRegistry<TComponent> | undefined;\n readonly capability: ProviderCapability;\n readonly providerRef: string | undefined;\n readonly grantedConsentPurposes: readonly ConsentPurpose[];\n readonly onState: (state: ProviderComponentLoadState<TComponent>) => void;\n}): () => void {\n const { registry, capability, providerRef, grantedConsentPurposes, onState } = input;\n // NONE, not UNAVAILABLE, for a provider that offers no component here — one the environment left off,\n // or a ref the page named that nothing registered. UNAVAILABLE means a load was tried and failed, and\n // telling a person to \"try again later\" about a component that does not exist would never come true.\n if (registry === undefined || providerRef === undefined || !registry.has(capability, providerRef)) {\n onState(idleProviderComponentLoadState<TComponent>());\n return () => undefined;\n }\n\n const requirement = registry.consentRequirement(capability, providerRef, grantedConsentPurposes);\n if (requirement !== undefined && !requirement.permitted && requirement.missingPurposes.length > 0) {\n onState({ status: ProviderComponentStatus.CONSENT_REQUIRED, Component: null, missingConsentPurposes: requirement.missingPurposes });\n return () => undefined;\n }\n\n let current = true;\n onState({ status: ProviderComponentStatus.LOADING, Component: null, missingConsentPurposes: NO_MISSING_PURPOSES });\n\n void registry.resolve(capability, providerRef, grantedConsentPurposes).then((Component) => {\n if (!current) return;\n onState(\n Component === null\n ? { status: ProviderComponentStatus.UNAVAILABLE, Component: null, missingConsentPurposes: NO_MISSING_PURPOSES }\n : { status: ProviderComponentStatus.READY, Component, missingConsentPurposes: NO_MISSING_PURPOSES },\n );\n });\n\n return () => {\n current = false;\n };\n}\n"]}
1
+ {"version":3,"file":"provider-component-registry.js","sourceRoot":"","sources":["../../../src/shared/provider-component-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AAQH,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E,OAAO,EACL,+BAA+B,EAC/B,8BAA8B,EAC9B,4BAA4B,EAC5B,iCAAiC,GAElC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,8BAA8B,EAC9B,mBAAmB,GAGpB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAC;AAOvF,kEAAkE;AAClE,MAAM,CAAN,IAAY,+BAyDX;AAzDD,WAAY,+BAA+B;IACzC;;;;OAIG;IACH,oFAAiD,CAAA;IACjD,uGAAuG;IACvG,8DAA2B,CAAA;IAC3B;;;OAGG;IACH,sGAAmE,CAAA;IACnE;;;;;OAKG;IACH,sFAAmD,CAAA;IACnD;;;;OA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CAAC,CAAC;QACpI,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC;IACzB,CAAC;IAED,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,EAAE,uBAAuB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CAAC,CAAC;IAEnH,KAAK,QAAQ,CAAC,OAAO,CAAC,UAAU,EAAE,WAAW,EAAE,sBAAsB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE;QACxF,IAAI,CAAC,OAAO;YAAE,OAAO;QACrB,OAAO,CACL,SAAS,KAAK,IAAI;YAChB,CAAC,CAAC,EAAE,MAAM,EAAE,uBAAuB,CAAC,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,sBAAsB,EAAE,mBAAmB,EAAE;YAC/G,CAAC,CAAC,EAAE,MAAM,EAAE,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,CACtG,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,GAAG,EAAE;QACV,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Components contributed by PROVIDERS, keyed by the capability each fills — the ONE registry every\n * browser surface builds from a provider's `components` declaration (#380, #1703).\n *\n * ## Why it lives here, below all three surfaces\n *\n * A provider declares its components once, on its frontend module (`components[capability]`), and\n * the application, the marketing website and the documentation site all have to honour that one\n * declaration. Until #1703 the registry lived in `saas-frontend-lib`, which neither the website nor\n * the documentation site may import (their bundle-isolation walks refuse the SaaS-app stack), so a\n * website form could not use a provider component at all — an address lookup on a contact form\n * (#561) had nowhere to load from. Putting a second copy in each surface was the rejected\n * alternative: the key, the consent gate, the \"loader returned a module namespace\" refusal and the\n * script-before-component rule would then be three implementations that drift apart, and the\n * one-declaration-per-provider contract would stop being true in practice.\n *\n * So the registry is renderer-free and lives in this package, which all three surfaces already\n * depend on. Nothing in it imports React: the component type is a type parameter each surface fills\n * (`React.ComponentType<never>` in all three today), and \"is this renderable\" is checked\n * structurally, which is all React itself can check before a render.\n *\n * ## Why it is a sibling of the application's `ComponentRegistryService`, not an extension\n *\n * The two answer different questions, and the difference is in the KEY, the cardinality and the\n * lifecycle:\n *\n * - `ComponentRegistryService` keys `componentType:preset[:category]` over a CLOSED enum the engine\n * owns. Exactly one component answers a key, resolution is synchronous, and a missing\n * registration is a startup refusal.\n * - This registry keys `capability:providerRef`. The capability half is closed\n * (`ProviderCapability`), but the PROVIDER half is not engine-owned at all: refs arrive from\n * engine modules, generated packages and application packages, discovered per deployment.\n * SEVERAL providers may answer one capability, the component arrives asynchronously, and none of\n * it is required for the surface to mount.\n *\n * ## Several providers, and no silent winner\n *\n * `listProviders` returns every provider offering a component for a capability, in registration\n * order, and nothing here picks one. Resolution USED to be first-match, so a Drive picker and a\n * Dropbox picker could not coexist and the winner depended on map order. A surface with two\n * providers has a choice to present; a registry that answered it would be making a product decision\n * in a lookup table.\n *\n * ## Never during a server render\n *\n * The website renders on the server (Astro) and the documentation site prerenders at build\n * (Docusaurus). A provider component must never be imported or executed there: its loader reaches\n * vendor code through a dynamic `import()`, and running it in a build would put a vendor's code in\n * the build process and, worse, its markup in the static HTML every visitor downloads before\n * consenting to anything. The surfaces only resolve from an effect, which never runs on a server —\n * and `resolve` refuses on its own when there is no browser document\n * (`NOT_IN_A_BROWSER`), so a host that calls it from a server path is stopped at the one place\n * every load goes through rather than trusted to remember.\n */\n\nimport type {\n ConsentPurpose,\n ProviderCapability,\n ProviderFrontendComponentDescriptor,\n ProviderFrontendScriptDeclaration,\n} from '@wildo-ai/saas-models/public-runtime';\nimport { describeThrownValue } from '@wildo-ai/saas-models/public-runtime';\n\nimport {\n consentBasedProviderStopRefusal,\n describeProviderConsentRefusal,\n isProviderPermittedByConsent,\n missingConsentPurposesForProvider,\n type ConsentClassifiableProviderModule,\n} from './frontend-provider-consent';\nimport {\n collectDeclaredProviderScripts,\n loadProviderScripts,\n type DeclaredProviderScript,\n type ProviderScriptLoadOutcome,\n} from './load-frontend-provider-scripts';\nimport { projectFrontendComponentDescriptor } from './frontend-provider-surface.types';\n\n/** @wildo_source:part:start external-connectors.provider-component-registry facet:kind:api facet:audience:app-developer */\n\n/** A loader as a provider module declares it: on demand, returning the component. */\nexport type ProviderComponentLoader = () => Promise<unknown>;\n\n/** Why a provider component could not be registered or loaded. */\nexport enum ProviderComponentDiagnosticKind {\n /**\n * A second registration arrived for one capability AND provider. The first is kept: a duplicate is\n * a wiring mistake, and swapping the live component under a mounted surface would be worse than\n * ignoring it.\n */\n DUPLICATE_REGISTRATION = 'DUPLICATE_REGISTRATION',\n /** The loader threw or rejected. That provider's component is unavailable; others are not affected. */\n LOAD_FAILED = 'LOAD_FAILED',\n /**\n * The loader resolved something that is not a component. Almost always a loader returning a MODULE\n * NAMESPACE — `() => import('./Picker')` — where it should return the component itself.\n */\n LOADED_VALUE_IS_NOT_A_COMPONENT = 'LOADED_VALUE_IS_NOT_A_COMPONENT',\n /**\n * A live provider DECLARES a component for a capability and nothing supplies its loader — neither\n * the module (`components[cap].load`) nor the surface's facet library (a loader contribution). The\n * declaration is DATA a reviewer can read; without code behind it the surface would offer a\n * component that cannot open. Not registered, and reported once at startup.\n */\n DECLARED_WITHOUT_LOADER = 'DECLARED_WITHOUT_LOADER',\n /**\n * BOTH the module and the facet library supplied a loader for one `capability:providerRef`. The\n * module's wins — it is the provider's own word — and the collision is reported, because the engine\n * never authors both and two loaders for one declaration is the map-order ambiguity #380 removed.\n */\n LOADER_SUPPLIED_TWICE = 'LOADER_SUPPLIED_TWICE',\n /**\n * A `<script>` the declaring provider needs did not load — a network failure, a\n * Content-Security-Policy refusal, or an integrity mismatch. The component resolves `null`, and that\n * answer is CACHED exactly like `LOAD_FAILED`: the failed element stays in the document and is not\n * retried this session (a vendor script can fail after partially executing, and a second copy could\n * initialise over the first). A component whose vendor global is absent is not usable, and handing\n * it back would only move the failure into its own mount, where nothing can name the provider's\n * declaration as the cause.\n */\n SCRIPT_LOAD_FAILED = 'SCRIPT_LOAD_FAILED',\n /**\n * The provider rests on a consent purpose the person has not granted, or its consent classification\n * is broken, so neither its component nor its scripts were loaded (#1702). NOT cached: a grant given\n * a moment later must be able to load it, which is the difference from every failure above.\n */\n WITHHELD_PENDING_CONSENT = 'WITHHELD_PENDING_CONSENT',\n /**\n * `resolve` was called where there is no browser document — a server render (the website) or a\n * build-time prerender (the documentation site). Nothing was loaded and nothing is cached: the same\n * registry asked again in the browser loads normally (#1703).\n */\n NOT_IN_A_BROWSER = 'NOT_IN_A_BROWSER',\n /**\n * The provider rests on a consent purpose AND its registration carries `<script>` tags (#1704). A script,\n * once executed, cannot be stopped when that consent is withdrawn, so such a registration is never\n * registered: neither its component nor its scripts can load. Projection already refuses the module and\n * hydration withholds it; this is the same predicate (`consentBasedProviderStopRefusal`) at the registry,\n * so a hand-built module list cannot reach a page with one either.\n */\n CONSENT_BASED_PROVIDER_NOT_STOPPABLE = 'CONSENT_BASED_PROVIDER_NOT_STOPPABLE',\n}\n\nexport interface ProviderComponentDiagnostic {\n readonly kind: ProviderComponentDiagnosticKind;\n readonly capability: string;\n readonly providerRef: string;\n readonly message: string;\n readonly cause?: unknown;\n}\n\nexport interface ProviderComponentRegistration {\n readonly capability: ProviderCapability;\n readonly providerRef: string;\n readonly load: ProviderComponentLoader;\n /**\n * What the provider DECLARED about this component — today, what a selection from it contains. Kept\n * beside the loader rather than looked up from the DATA entry at the use site, because a surface\n * needs it BEFORE it decides to load anything, and because the two would then be two sources for\n * one fact.\n */\n readonly descriptor: ProviderFrontendComponentDescriptor;\n /**\n * The third-party `<script>` tags the DECLARING PROVIDER needs (its module's `scripts`), loaded\n * before the component is handed back. Absent means the component depends on no script.\n */\n readonly scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /**\n * What the DECLARING PROVIDER rests on for consent — its capabilities and its own module-level\n * purposes (#1702). Consent is a property of the provider, not of one component. Required, so a\n * registration cannot be built that forgot the question.\n */\n readonly consent: ConsentClassifiableProviderModule;\n}\n\n/** Whether a provider's component may load for the purposes granted, and what would permit it. */\nexport interface ProviderComponentConsentRequirement {\n /** True when the component may load now. */\n readonly permitted: boolean;\n /**\n * The purposes the person would have to grant. Empty when `permitted`, AND when no grant could\n * permit it (a capability no browser may host, a purpose outside the vocabulary) — which is why\n * `permitted` exists.\n */\n readonly missingPurposes: readonly ConsentPurpose[];\n}\n\n/**\n * Loads a provider's declared scripts and resolves once each has executed or failed. Never rejects:\n * failures come back in the outcome.\n */\nexport type ProviderComponentScriptLoader = (\n scripts: ReadonlyArray<DeclaredProviderScript>,\n) => Promise<ProviderScriptLoadOutcome>;\n\nexport interface ProviderComponentRegistry<TComponent = unknown> {\n /**\n * Every provider offering a component for this capability, in registration order. Synchronous ON\n * PURPOSE: a surface has to render its chooser before any component is loaded.\n */\n listProviders(capability: ProviderCapability): ReadonlyArray<string>;\n /** Whether this exact provider offers a component for this capability. */\n has(capability: ProviderCapability, providerRef: string): boolean;\n /**\n * Every provider with at least one registered component. A surface reads it to load such a provider's\n * `<script>` tags WITH its component rather than at startup — see `collectProviderScriptsWithoutComponents`.\n */\n providersWithComponents(): ReadonlySet<string>;\n /**\n * What the provider declared about its component, without loading it — `undefined` when this\n * provider offers none for this capability. Synchronous: a routing decision that had to await a\n * download would mean downloading a component to find out whether the surface can use it.\n */\n describe(capability: ProviderCapability, providerRef: string): ProviderFrontendComponentDescriptor | undefined;\n /**\n * Whether this provider's component may load for the purposes granted (#1702) — `undefined` when\n * the provider offers none. Synchronous, so a surface can render a consent-required state without\n * downloading anything.\n */\n consentRequirement(\n capability: ProviderCapability,\n providerRef: string,\n grantedConsentPurposes: readonly ConsentPurpose[],\n ): ProviderComponentConsentRequirement | undefined;\n /**\n * Loads one provider's component AND the scripts its provider declares, in parallel, and hands the\n * component back only once both are present. The loader runs at most once per pair, and a failure\n * of either half is reported and returns `null` rather than throwing into a render.\n *\n * CONSENT-GATED (#1702): a provider resting on a purpose not in `grantedConsentPurposes` loads\n * nothing and resolves `null` with `WITHHELD_PENDING_CONSENT`. The grant defaults to NONE: a caller\n * that holds no person's answer must not load consent-based code on an assumed one.\n *\n * BROWSER-ONLY (#1703): with no browser document it loads nothing and resolves `null` with\n * `NOT_IN_A_BROWSER`. Neither refusal is cached.\n */\n resolve(\n capability: ProviderCapability,\n providerRef: string,\n grantedConsentPurposes?: readonly ConsentPurpose[],\n ): Promise<TComponent | null>;\n}\n\nexport interface CreateProviderComponentRegistryInput {\n readonly registrations?: Iterable<ProviderComponentRegistration>;\n readonly onDiagnostic?: (diagnostic: ProviderComponentDiagnostic) => void;\n /**\n * How declared scripts are loaded. Defaults to the shared injector on the live `document`;\n * injectable so a test can settle a script without a network.\n */\n readonly loadScripts?: ProviderComponentScriptLoader;\n /**\n * Whether a browser document is present. Defaults to `typeof document !== 'undefined'`, read on\n * every `resolve`. Injectable only so a test can stand for a server render inside a DOM test\n * environment; a host must not pass `() => true` to force a load on a server.\n */\n readonly hasBrowserDocument?: () => boolean;\n}\n\n/** @wildo_source:part:end external-connectors.provider-component-registry */\n\n/**\n * Whether this runtime has a browser document to load into. Read at CALL time — a module evaluated\n * on a server and later in a browser must answer for where it is running NOW.\n */\nfunction hasBrowserDocument(): boolean {\n return typeof document !== 'undefined';\n}\n\n/**\n * The default script loader: the shared `loadProviderScripts` against the live `document`, read at\n * call time rather than at registry construction. Only reached after `resolve` has established that\n * a document exists.\n */\nconst loadProviderScriptsIntoDocument: ProviderComponentScriptLoader = (scripts) => loadProviderScripts(scripts, document);\n\nfunction isModuleNamespace(value: unknown): boolean {\n return (\n typeof value === 'object'\n && value !== null\n && (value as { [Symbol.toStringTag]?: unknown })[Symbol.toStringTag] === 'Module'\n );\n}\n\n/**\n * A React component is a function, or an object for `memo` / `forwardRef` / `lazy`. Anything else —\n * a namespace, a string, a plain data object — cannot be rendered, and finding out at render time\n * means a blank surface with a stack trace pointing at React rather than at the provider.\n */\nfunction looksLikeComponent(value: unknown): boolean {\n return typeof value === 'function' || (typeof value === 'object' && value !== null);\n}\n\n/**\n * Builds a provider-component registry. `TComponent` is the surface's component type; the registry\n * checks renderability structurally and never renders anything itself.\n */\nexport function createProviderComponentRegistry<TComponent = unknown>(\n input?: CreateProviderComponentRegistryInput,\n): ProviderComponentRegistry<TComponent> {\n const raise = (diagnostic: ProviderComponentDiagnostic): void => {\n input?.onDiagnostic?.(diagnostic);\n };\n const loaders = new Map<string, ProviderComponentLoader>();\n const scriptsByKey = new Map<string, ReadonlyArray<ProviderFrontendScriptDeclaration>>();\n const loadScripts = input?.loadScripts ?? loadProviderScriptsIntoDocument;\n const inBrowser = input?.hasBrowserDocument ?? hasBrowserDocument;\n const descriptors = new Map<string, ProviderFrontendComponentDescriptor>();\n const consentSubjects = new Map<string, ConsentClassifiableProviderModule>();\n const byCapability = new Map<string, string[]>();\n const loaded = new Map<string, Promise<TComponent | null>>();\n const keyOf = (capability: string, providerRef: string): string => `${capability}:${providerRef}`;\n\n for (const registration of input?.registrations ?? []) {\n const key = keyOf(registration.capability, registration.providerRef);\n if (loaders.has(key)) {\n raise({\n kind: ProviderComponentDiagnosticKind.DUPLICATE_REGISTRATION,\n capability: registration.capability,\n providerRef: registration.providerRef,\n message:\n `Provider \"${registration.providerRef}\" registered a component for \"${registration.capability}\" `\n + 'more than once. The first registration is kept.',\n });\n continue;\n }\n\n // The #1704 stop rule, here because this is where a registration's scripts are loaded.\n const stopRefusal = consentBasedProviderStopRefusal(registration.providerRef, {\n ...registration.consent,\n ...(registration.scripts !== undefined ? { scripts: registration.scripts } : {}),\n });\n if (stopRefusal !== undefined) {\n raise({\n kind: ProviderComponentDiagnosticKind.CONSENT_BASED_PROVIDER_NOT_STOPPABLE,\n capability: registration.capability,\n providerRef: registration.providerRef,\n message: `${stopRefusal} Its \"${registration.capability}\" component is not offered.`,\n });\n continue;\n }\n\n loaders.set(key, registration.load);\n if (registration.scripts !== undefined && registration.scripts.length > 0) {\n scriptsByKey.set(key, registration.scripts);\n }\n descriptors.set(key, registration.descriptor);\n consentSubjects.set(key, registration.consent);\n const providers = byCapability.get(registration.capability) ?? [];\n providers.push(registration.providerRef);\n byCapability.set(registration.capability, providers);\n }\n\n return {\n listProviders(capability) {\n return byCapability.get(capability) ?? [];\n },\n\n has(capability, providerRef) {\n return loaders.has(keyOf(capability, providerRef));\n },\n\n providersWithComponents() {\n return new Set([...byCapability.values()].flat());\n },\n\n describe(capability, providerRef) {\n return descriptors.get(keyOf(capability, providerRef));\n },\n\n consentRequirement(capability, providerRef, grantedConsentPurposes) {\n const subject = consentSubjects.get(keyOf(capability, providerRef));\n if (subject === undefined) return undefined;\n const permitted = isProviderPermittedByConsent(subject, grantedConsentPurposes);\n return { permitted, missingPurposes: permitted ? [] : missingConsentPurposesForProvider(subject, grantedConsentPurposes) };\n },\n\n resolve(capability, providerRef, grantedConsentPurposes = []) {\n const key = keyOf(capability, providerRef);\n const load = loaders.get(key);\n if (load === undefined) return Promise.resolve(null);\n\n // The server-render refusal comes FIRST (#1703): nothing about a provider — not its consent\n // answer, not its cache — is worth consulting where its code must not run at all. Not cached,\n // so the same registry loads normally once asked in the browser.\n if (!inBrowser()) {\n raise({\n kind: ProviderComponentDiagnosticKind.NOT_IN_A_BROWSER,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\"'s \"${capability}\" component was requested where there is no browser document `\n + '(a server render or a build-time prerender). Nothing was loaded; resolve it from an effect.',\n });\n return Promise.resolve(null);\n }\n\n // The consent gate comes BEFORE the cache (#1702): a component loaded under one grant must not\n // be handed to a caller holding a narrower one — the person may have withdrawn in between — and\n // a withheld answer is never cached, so a grant given a moment later loads it.\n const consentSubject = consentSubjects.get(key) ?? {};\n if (!isProviderPermittedByConsent(consentSubject, grantedConsentPurposes)) {\n raise({\n kind: ProviderComponentDiagnosticKind.WITHHELD_PENDING_CONSENT,\n capability,\n providerRef,\n message: `${describeProviderConsentRefusal(providerRef, consentSubject, grantedConsentPurposes)} `\n + `Its \"${capability}\" component and scripts were not loaded.`,\n });\n return Promise.resolve(null);\n }\n\n const cached = loaded.get(key);\n if (cached !== undefined) return cached;\n\n const declaredScripts = scriptsByKey.get(key) ?? [];\n\n const pending = (async (): Promise<TComponent | null> => {\n // Both halves start together: the component chunk and the vendor loader are independent\n // downloads, and serialising them would make every first open wait for their SUM.\n //\n // Each half is started through `Promise.resolve().then(...)` so a loader that throws\n // SYNCHRONOUSLY is still a reported failure rather than an exception escaping `resolve`, and a\n // script loader that breaks its never-rejects contract is still a SCRIPT_LOAD_FAILED rather\n // than an unhandled rejection in a render path.\n const scriptsToLoad: ReadonlyArray<DeclaredProviderScript> = declaredScripts.map((declaration) => ({ providerRef, declaration }));\n const [componentResult, scriptOutcome] = await Promise.all([\n Promise.resolve().then(load).then(\n (value): { readonly ok: true; readonly value: unknown } => ({ ok: true, value }),\n (cause: unknown): { readonly ok: false; readonly cause: unknown } => ({ ok: false, cause }),\n ),\n scriptsToLoad.length === 0\n ? Promise.resolve<ProviderScriptLoadOutcome | undefined>(undefined)\n : Promise.resolve().then(() => loadScripts(scriptsToLoad)).catch((cause: unknown): ProviderScriptLoadOutcome => ({\n loaded: [],\n failed: scriptsToLoad.map(({ declaration }) => ({\n providerRef,\n src: declaration.src,\n message: `The script loader failed before reporting an outcome: ${describeThrownValue(cause)}`,\n })),\n })),\n ]);\n\n // Reported independently so a first open that fails on BOTH halves names both causes.\n for (const failure of scriptOutcome?.failed ?? []) {\n raise({\n kind: ProviderComponentDiagnosticKind.SCRIPT_LOAD_FAILED,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" cannot offer its \"${capability}\" component: a script it declares did not load. `\n + failure.message,\n });\n }\n\n if (componentResult.ok === false) {\n raise({\n kind: ProviderComponentDiagnosticKind.LOAD_FAILED,\n capability,\n providerRef,\n message: `Provider \"${providerRef}\" failed to load its \"${capability}\" component.`,\n cause: componentResult.cause,\n });\n return null;\n }\n\n if ((scriptOutcome?.failed.length ?? 0) > 0) return null;\n\n const value = componentResult.value;\n\n if (isModuleNamespace(value)) {\n raise({\n kind: ProviderComponentDiagnosticKind.LOADED_VALUE_IS_NOT_A_COMPONENT,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" returned a MODULE for its \"${capability}\" component instead of the `\n // No relative specifier appears in this text on purpose: the build finalizer rewrites\n // anything shaped like `import('./x')` — string contents included — to `import('./x.js')`.\n + 'component itself. Return the named export from the loader — `async () => (await import(…)).Picker` — '\n + 'rather than the module namespace `() => import(…)`.',\n });\n return null;\n }\n\n if (!looksLikeComponent(value)) {\n raise({\n kind: ProviderComponentDiagnosticKind.LOADED_VALUE_IS_NOT_A_COMPONENT,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" returned a ${typeof value} for its \"${capability}\" component. A React `\n + 'component is a function, or an object for memo / forwardRef / lazy.',\n });\n return null;\n }\n\n return value as TComponent;\n })();\n\n // Cached even when it resolves to null: a loader — or a script — that failed once must not be\n // retried on every render of a chooser that lists it.\n loaded.set(key, pending);\n return pending;\n },\n };\n}\n\n/** The shape the registration derivation needs off a hydrated provider module, on any surface. */\nexport interface ComponentBearingProviderModule {\n metadata: { ref: string };\n /** Read, with `consentPurposes`, to carry the provider's consent classification onto each registration (#1702). */\n providerCapabilities?: ReadonlyArray<string>;\n consentPurposes?: ReadonlyArray<string>;\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n components?: Readonly<Record<string, ProviderFrontendComponentDescriptor & { load?: ProviderComponentLoader }>>;\n}\n\n/** @wildo_source:part:start external-connectors.provider-component-loader-contribution facet:kind:api facet:audience:app-developer */\n\n/**\n * A loader the SURFACE'S FACET LIBRARY supplies for a component a provider module declares — the\n * second of the two doors, and the one every engine-shipped component uses (#394).\n *\n * An engine provider module lives in this deliberately renderer-free package and cannot name a\n * loader that reaches a React component: that would close a package cycle. The library that owns\n * the component contributes the loader instead:\n *\n * - the application: `presets-components`, through `contributeProviderComponentLoaders`;\n * - the website: the page bridge's `providerComponentLoaders` dependency;\n * - the documentation site: `DocsFrontendProviders`' `providerComponentLoaders` prop.\n *\n * A provider PACKAGE that ships its own component uses `components[cap].load` instead. Both doors\n * exist, the engine authors exactly one per declaration, and a collision is reported.\n */\nexport interface ProviderComponentLoaderContribution {\n readonly capability: ProviderCapability;\n readonly providerRef: string;\n readonly load: ProviderComponentLoader;\n}\n\n/** @wildo_source:part:end external-connectors.provider-component-loader-contribution */\n\n/** The key a loader contribution and a registration share: `capability:providerRef`. */\nexport function providerComponentLoaderKey(capability: string, providerRef: string): string {\n return `${capability}:${providerRef}`;\n}\n\n/**\n * Indexes loader contributions by `capability:providerRef`. A later contribution for one key\n * replaces an earlier one: a facet library is one author, and the last thing it said is what it\n * means.\n */\nexport function indexProviderComponentLoaderContributions(\n contributions: Iterable<ProviderComponentLoaderContribution> | undefined,\n): ReadonlyMap<string, ProviderComponentLoaderContribution> {\n const index = new Map<string, ProviderComponentLoaderContribution>();\n for (const contribution of contributions ?? []) {\n index.set(providerComponentLoaderKey(contribution.capability, contribution.providerRef), contribution);\n }\n return index;\n}\n\n/**\n * Turns the live provider modules of a surface into registrations, joining each declared component\n * to its loader — from the module when it carries one, else from the facet library's contributions.\n *\n * Order follows the modules' iteration order, which is the order the service declared its providers,\n * so `listProviders` is stable across reloads.\n *\n * A declaration nothing can load is NOT registered — a surface must offer only what can render — and\n * is reported through `onDiagnostic` instead, once, at startup.\n */\nexport function collectProviderComponentRegistrations(\n modules: Iterable<ComponentBearingProviderModule>,\n input?: {\n readonly contributedLoaders?: ReadonlyMap<string, ProviderComponentLoaderContribution>;\n readonly onDiagnostic?: (diagnostic: ProviderComponentDiagnostic) => void;\n },\n): ProviderComponentRegistration[] {\n const registrations: ProviderComponentRegistration[] = [];\n const contributed = input?.contributedLoaders ?? new Map<string, ProviderComponentLoaderContribution>();\n\n for (const module of modules) {\n for (const [capability, declaration] of Object.entries(module.components ?? {})) {\n const providerRef = module.metadata.ref;\n const supplied = contributed.get(providerComponentLoaderKey(capability, providerRef));\n\n if (declaration.load !== undefined && supplied !== undefined) {\n input?.onDiagnostic?.({\n kind: ProviderComponentDiagnosticKind.LOADER_SUPPLIED_TWICE,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" carries its own loader for \"${capability}\" AND the facet library contributed `\n + \"one. The module's is used; remove one of the two.\",\n });\n }\n\n const load = declaration.load ?? supplied?.load;\n if (load === undefined) {\n input?.onDiagnostic?.({\n kind: ProviderComponentDiagnosticKind.DECLARED_WITHOUT_LOADER,\n capability,\n providerRef,\n message:\n `Provider \"${providerRef}\" declares a \"${capability}\" component and nothing supplies its loader — `\n + 'neither the module nor the facet library. It is not offered. An engine-shipped component is '\n + 'registered by the surface\\'s facet library (presets-components for the application, the page '\n + \"bridge's `providerComponentLoaders` for the website, `DocsFrontendProviders`' \"\n + '`providerComponentLoaders` for the documentation site); a provider package supplies '\n + '`components[capability].load`.',\n });\n continue;\n }\n\n registrations.push({\n capability: capability as ProviderCapability,\n providerRef,\n load,\n // Only the declared half, never the whole declaration: `load` is already carried beside it.\n // The same projection the served entry uses, so the ENFORCED copy (delivery, an address lookup's\n // place-id retention and its declared operations, session token and attribution — #1702, #561) and the\n // copy a reviewer reads cannot carry different fields.\n descriptor: projectFrontendComponentDescriptor(declaration),\n // The PROVIDER's consent inputs, copied rather than referenced so a later mutation of the\n // module cannot widen what the registry already decided to gate on.\n consent: {\n providerCapabilities: [...(module.providerCapabilities ?? [])],\n ...(module.consentPurposes !== undefined ? { consentPurposes: [...module.consentPurposes] } : {}),\n },\n // The PROVIDER's scripts, not the component's: a module declares scripts once, and the\n // component is the first of its code to run on this surface — so it is what they load with.\n ...(module.scripts !== undefined && module.scripts.length > 0 ? { scripts: module.scripts } : {}),\n });\n }\n }\n\n return registrations;\n}\n\n/**\n * The scripts a surface must load at STARTUP: those declared by live providers that contribute NO\n * registered component. A provider with a registered component loads its scripts when that\n * component is first resolved — so no page pays for an address lookup's vendor loader on a page with no\n * form — and one without never will, so its scripts load at startup. The same rule on every surface: the\n * application passes its registrations, the website and the documentation site pass\n * `providersWithComponents()` as `{ providerRef }` entries.\n */\nexport function collectProviderScriptsWithoutComponents(\n modules: Iterable<ComponentBearingProviderModule>,\n registrations: Iterable<Pick<ProviderComponentRegistration, 'providerRef'>>,\n): ReadonlyArray<DeclaredProviderScript> {\n const providersWithComponents = new Set<string>();\n for (const registration of registrations) providersWithComponents.add(registration.providerRef);\n return collectDeclaredProviderScripts(\n [...modules].filter((module) => !providersWithComponents.has(module.metadata.ref)),\n );\n}\n\n/** @wildo_source:part:start external-connectors.provider-component-load-state facet:kind:api facet:audience:app-developer */\n\n/**\n * Why a provider component is not on screen yet — ONE vocabulary for the application, the website and\n * the documentation site, so a surface's rendering of each state means the same thing everywhere.\n */\nexport enum ProviderComponentStatus {\n /** No provider was chosen, or none offers a component for this capability. */\n NONE = 'NONE',\n /** The component, or a script its provider declares, is still downloading. */\n LOADING = 'LOADING',\n /**\n * The component is loaded AND every `<script>` its provider declares has executed — so a component\n * that reads a vendor global on mount finds it. Never READY on the component alone.\n */\n READY = 'READY',\n /**\n * The loader failed, returned something unrenderable, or a script the provider declares did not\n * load. The registry has already reported why; a surface should fall back rather than retry.\n */\n UNAVAILABLE = 'UNAVAILABLE',\n /**\n * The provider rests on consent the person has not granted, so NOTHING of it was downloaded (#1702).\n * `missingConsentPurposes` names what would permit it. A surface renders a consent-required state\n * here, never a blank.\n */\n CONSENT_REQUIRED = 'CONSENT_REQUIRED',\n}\n\nexport interface ProviderComponentLoadState<TComponent = unknown> {\n readonly status: ProviderComponentStatus;\n readonly Component: TComponent | null;\n /** The purposes to grant. Non-empty exactly when `status` is `CONSENT_REQUIRED`. */\n readonly missingConsentPurposes: readonly ConsentPurpose[];\n}\n\n/** @wildo_source:part:end external-connectors.provider-component-load-state */\n\nconst NO_MISSING_PURPOSES: readonly ConsentPurpose[] = Object.freeze([]);\n\n/** The state before anything is chosen or loaded. */\nexport function idleProviderComponentLoadState<TComponent = unknown>(): ProviderComponentLoadState<TComponent> {\n return { status: ProviderComponentStatus.NONE, Component: null, missingConsentPurposes: NO_MISSING_PURPOSES };\n}\n\n/**\n * Starts loading one provider's component and reports each state change — the whole decision a\n * surface hook makes, written once so the three surfaces cannot come to disagree about it.\n *\n * Consent is asked BEFORE anything is downloaded, so a provider waiting on consent costs the page\n * nothing and the surface can say why. A classification no grant can satisfy is not\n * CONSENT_REQUIRED — offering a grant that would change nothing is a false promise — so it falls\n * through to `resolve`, which refuses it with a diagnostic, and reads as UNAVAILABLE.\n *\n * Returns a cancel function: a person can switch provider while one is still downloading, and the\n * slower answer must not arrive last and replace the one they chose. Call it only from an effect —\n * that is what keeps it off a server render.\n */\nexport function startProviderComponentLoad<TComponent>(input: {\n readonly registry: ProviderComponentRegistry<TComponent> | undefined;\n readonly capability: ProviderCapability;\n readonly providerRef: string | undefined;\n readonly grantedConsentPurposes: readonly ConsentPurpose[];\n readonly onState: (state: ProviderComponentLoadState<TComponent>) => void;\n}): () => void {\n const { registry, capability, providerRef, grantedConsentPurposes, onState } = input;\n // NONE, not UNAVAILABLE, for a provider that offers no component here — one the environment left off,\n // or a ref the page named that nothing registered. UNAVAILABLE means a load was tried and failed, and\n // telling a person to \"try again later\" about a component that does not exist would never come true.\n if (registry === undefined || providerRef === undefined || !registry.has(capability, providerRef)) {\n onState(idleProviderComponentLoadState<TComponent>());\n return () => undefined;\n }\n\n const requirement = registry.consentRequirement(capability, providerRef, grantedConsentPurposes);\n if (requirement !== undefined && !requirement.permitted && requirement.missingPurposes.length > 0) {\n onState({ status: ProviderComponentStatus.CONSENT_REQUIRED, Component: null, missingConsentPurposes: requirement.missingPurposes });\n return () => undefined;\n }\n\n let current = true;\n onState({ status: ProviderComponentStatus.LOADING, Component: null, missingConsentPurposes: NO_MISSING_PURPOSES });\n\n void registry.resolve(capability, providerRef, grantedConsentPurposes).then((Component) => {\n if (!current) return;\n onState(\n Component === null\n ? { status: ProviderComponentStatus.UNAVAILABLE, Component: null, missingConsentPurposes: NO_MISSING_PURPOSES }\n : { status: ProviderComponentStatus.READY, Component, missingConsentPurposes: NO_MISSING_PURPOSES },\n );\n });\n\n return () => {\n current = false;\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-frontend-techdoc-providers.d.ts","sourceRoot":"","sources":["../../../../src/techdoc/compose-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC3B,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,GAAG,SAAS,EAAE,aAAa,CAAC,uCAAuC,CAAC,GACnE,+BAA+B,CAQjC"}
1
+ {"version":3,"file":"compose-frontend-techdoc-providers.d.ts","sourceRoot":"","sources":["../../../src/techdoc/compose-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC3B,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,GAAG,SAAS,EAAE,aAAa,CAAC,uCAAuC,CAAC,GACnE,+BAA+B,CAQjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-frontend-techdoc-providers.js","sourceRoot":"","sources":["../../../../src/techdoc/compose-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAC9B,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAe9C,MAAM,UAAU,+BAA+B,CAC7C,GAAG,SAAiE;IAEpE,MAAM,QAAQ,GAAG,uBAAuB,CAGtC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAChC,wFAAwF;IACxF,2BAA2B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * `composeFrontendTechdocProviders` — frontend-techdoc-facet wrapper\n * around the generic `composeProviderRegistry` core. See\n * `@wildo-ai/saas-models/external-providers/compose-provider-registry.shared`\n * for behavior, conflict policy, and indexing semantics.\n */\n\nimport { composeProviderRegistry,\n assertProviderTierCoherence,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type {\n FrontendTechdocProviderRef,\n FrontendTechdocProviderRegistry,\n} from './frontend-techdoc-provider-registry.types';\n\nexport interface FrontendTechdocProviderRegistryFragment {\n readonly modules: ReadonlyMap<\n FrontendTechdocProviderRef,\n FrontendTechdocProviderModule\n >;\n}\n\nexport function composeFrontendTechdocProviders(\n ...fragments: ReadonlyArray<FrontendTechdocProviderRegistryFragment>\n): FrontendTechdocProviderRegistry {\n const registry = composeProviderRegistry<\n FrontendTechdocProviderRef,\n FrontendTechdocProviderModule\n >('FrontendTechdoc', fragments);\n // #328 — the tier rule holds on every facet: a CATALOGUE provider binds no engine slot.\n assertProviderTierCoherence('FrontendTechdoc', registry.modules.values());\n return registry;\n}\n"]}
1
+ {"version":3,"file":"compose-frontend-techdoc-providers.js","sourceRoot":"","sources":["../../../src/techdoc/compose-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAC9B,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAe9C,MAAM,UAAU,+BAA+B,CAC7C,GAAG,SAAiE;IAEpE,MAAM,QAAQ,GAAG,uBAAuB,CAGtC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAChC,wFAAwF;IACxF,2BAA2B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * `composeFrontendTechdocProviders` — frontend-techdoc-facet wrapper\n * around the generic `composeProviderRegistry` core. See\n * `@wildo-ai/saas-models/external-providers/compose-provider-registry.shared`\n * for behavior, conflict policy, and indexing semantics.\n */\n\nimport { composeProviderRegistry,\n assertProviderTierCoherence,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type {\n FrontendTechdocProviderRef,\n FrontendTechdocProviderRegistry,\n} from './frontend-techdoc-provider-registry.types';\n\nexport interface FrontendTechdocProviderRegistryFragment {\n readonly modules: ReadonlyMap<\n FrontendTechdocProviderRef,\n FrontendTechdocProviderModule\n >;\n}\n\nexport function composeFrontendTechdocProviders(\n ...fragments: ReadonlyArray<FrontendTechdocProviderRegistryFragment>\n): FrontendTechdocProviderRegistry {\n const registry = composeProviderRegistry<\n FrontendTechdocProviderRef,\n FrontendTechdocProviderModule\n >('FrontendTechdoc', fragments);\n // #328 — the tier rule holds on every facet: a CATALOGUE provider binds no engine slot.\n assertProviderTierCoherence('FrontendTechdoc', registry.modules.values());\n return registry;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-hydrated-frontend-techdoc-providers.d.ts","sourceRoot":"","sources":["../../../../src/techdoc/compose-hydrated-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,6BAA6B,CAAC,6BAA6B,CAAC,GAClE,+BAA+B,CA2BjC"}
1
+ {"version":3,"file":"compose-hydrated-frontend-techdoc-providers.d.ts","sourceRoot":"","sources":["../../../src/techdoc/compose-hydrated-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,6BAA6B,CAAC,6BAA6B,CAAC,GAClE,+BAA+B,CA2BjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-hydrated-frontend-techdoc-providers.js","sourceRoot":"","sources":["../../../../src/techdoc/compose-hydrated-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAc9C;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,KAAmE;IAEnE,MAAM,QAAQ,GAAG,8BAA8B,CAAgC,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;QACnC,GAAiC;QACjC;YACE,GAAG,MAAM;YACT,wEAAwE;YACxE,sEAAsE;YACtE,kEAAkE;YAClE,0EAA0E;YAC1E,6EAA6E;YAC7E,gEAAgE;YAChE,iEAAiE;YACjE,oFAAoF;YACpF,mEAAmE;YACnE,6CAA6C;YAC7C,oBAAoB,EAAE,MAAM,CAAC,oBAAyD;YACtF,SAAS,EAAE,MAAM,CAAC,SAA4C;YAC9D,iGAAiG;YACjG,kGAAkG;YAClG,8DAA8D;YAC9D,eAAe,EAAE,MAAM,CAAC,eAA4D;SACrF;KACF,CAAC,CACH,CAAC;IACF,OAAO,+BAA+B,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/**\n * Hydration for the technical doc facet: the DATA channel joined with the\n * CODE channel, composed into the same registry every consumer already reads.\n *\n * `composeFrontendTechdocProviders` (the fragment-composition core) is unchanged and still the\n * single place the tier rule runs. What is added here is the step BEFORE it —\n * building each module from its served entry and, where the bundle carries it,\n * the provider package's own module — so the registry is no longer produced by\n * casting a JSON entry to a module type.\n *\n * See `../shared/hydrate-frontend-providers.ts` for the join rule and the\n * diagnostics it raises.\n */\n\nimport type { ConsentPurpose, ProviderCapability, ProviderProtocol } from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type {\n FrontendTechdocProviderRef,\n FrontendTechdocProviderRegistry,\n} from './frontend-techdoc-provider-registry.types';\nimport { composeFrontendTechdocProviders } from './compose-frontend-techdoc-providers';\nimport {\n hydrateFrontendProviderModules,\n type HydrateFrontendProvidersInput,\n} from '../shared/hydrate-frontend-providers';\n\n/**\n * The shape of `generatedFrontendProviderModules` in a\n * `frontend-providers.generated.ts` written by `wildo config sync` for a\n * technical doc service.\n *\n * The key is the provider's `ref` and must equal `module.metadata.ref`; the\n * join refuses a mismatch rather than binding one provider's code to another's\n * configuration. Config sync emits an empty map for a service with no providers,\n * keeping its startup import stable when the last provider is removed.\n */\nexport type GeneratedTechdocProviderModules = Readonly<Record<string, FrontendTechdocProviderModule>>;\n\n/**\n * Joins the served provider entries with the bundle's generated modules and\n * composes the result.\n */\nexport function composeHydratedFrontendTechdocProviders(\n input: HydrateFrontendProvidersInput<FrontendTechdocProviderModule>,\n): FrontendTechdocProviderRegistry {\n const hydrated = hydrateFrontendProviderModules<FrontendTechdocProviderModule>(input);\n const modules = new Map<FrontendTechdocProviderRef, FrontendTechdocProviderModule>(\n [...hydrated].map(([ref, module]) => [\n ref as FrontendTechdocProviderRef,\n {\n ...module,\n // The ONE narrowing on this path, and it is an unchecked cast: the wire\n // carries `string`, the module type is the capability/protocol union.\n // It was left unchecked because that union was extended by module\n // augmentation, so its members did not exist at runtime — no longer true:\n // `ProviderCapability` is the built-in set since #502 and `ProviderProtocol`\n // is `BuiltinProviderProtocol`, and both sets exist at runtime.\n // A runtime check is now possible and not yet written. What does\n // have teeth still runs: `composeFrontendTechdocProviders` applies the tier rule to\n // every composed module, which is the check that decides whether a\n // capability may bind an engine slot at all.\n providerCapabilities: module.providerCapabilities as ReadonlyArray<ProviderCapability>,\n protocols: module.protocols as ReadonlyArray<ProviderProtocol>,\n // Unchecked for the same reason, and safe for a stronger one (#1702): the consent decision reads\n // these as strings and FAILS CLOSED on any that is not a `ConsentPurpose`, so a wrong member here\n // withholds the provider rather than widening what it may do.\n consentPurposes: module.consentPurposes as ReadonlyArray<ConsentPurpose> | undefined,\n },\n ]),\n );\n return composeFrontendTechdocProviders({ modules });\n}\n"]}
1
+ {"version":3,"file":"compose-hydrated-frontend-techdoc-providers.js","sourceRoot":"","sources":["../../../src/techdoc/compose-hydrated-frontend-techdoc-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAc9C;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,KAAmE;IAEnE,MAAM,QAAQ,GAAG,8BAA8B,CAAgC,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;QACnC,GAAiC;QACjC;YACE,GAAG,MAAM;YACT,wEAAwE;YACxE,sEAAsE;YACtE,kEAAkE;YAClE,0EAA0E;YAC1E,6EAA6E;YAC7E,gEAAgE;YAChE,iEAAiE;YACjE,oFAAoF;YACpF,mEAAmE;YACnE,6CAA6C;YAC7C,oBAAoB,EAAE,MAAM,CAAC,oBAAyD;YACtF,SAAS,EAAE,MAAM,CAAC,SAA4C;YAC9D,iGAAiG;YACjG,kGAAkG;YAClG,8DAA8D;YAC9D,eAAe,EAAE,MAAM,CAAC,eAA4D;SACrF;KACF,CAAC,CACH,CAAC;IACF,OAAO,+BAA+B,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/**\n * Hydration for the technical doc facet: the DATA channel joined with the\n * CODE channel, composed into the same registry every consumer already reads.\n *\n * `composeFrontendTechdocProviders` (the fragment-composition core) is unchanged and still the\n * single place the tier rule runs. What is added here is the step BEFORE it —\n * building each module from its served entry and, where the bundle carries it,\n * the provider package's own module — so the registry is no longer produced by\n * casting a JSON entry to a module type.\n *\n * See `../shared/hydrate-frontend-providers.ts` for the join rule and the\n * diagnostics it raises.\n */\n\nimport type { ConsentPurpose, ProviderCapability, ProviderProtocol } from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type {\n FrontendTechdocProviderRef,\n FrontendTechdocProviderRegistry,\n} from './frontend-techdoc-provider-registry.types';\nimport { composeFrontendTechdocProviders } from './compose-frontend-techdoc-providers';\nimport {\n hydrateFrontendProviderModules,\n type HydrateFrontendProvidersInput,\n} from '../shared/hydrate-frontend-providers';\n\n/**\n * The shape of `generatedFrontendProviderModules` in a\n * `frontend-providers.generated.ts` written by `wildo config sync` for a\n * technical doc service.\n *\n * The key is the provider's `ref` and must equal `module.metadata.ref`; the\n * join refuses a mismatch rather than binding one provider's code to another's\n * configuration. Config sync emits an empty map for a service with no providers,\n * keeping its startup import stable when the last provider is removed.\n */\nexport type GeneratedTechdocProviderModules = Readonly<Record<string, FrontendTechdocProviderModule>>;\n\n/**\n * Joins the served provider entries with the bundle's generated modules and\n * composes the result.\n */\nexport function composeHydratedFrontendTechdocProviders(\n input: HydrateFrontendProvidersInput<FrontendTechdocProviderModule>,\n): FrontendTechdocProviderRegistry {\n const hydrated = hydrateFrontendProviderModules<FrontendTechdocProviderModule>(input);\n const modules = new Map<FrontendTechdocProviderRef, FrontendTechdocProviderModule>(\n [...hydrated].map(([ref, module]) => [\n ref as FrontendTechdocProviderRef,\n {\n ...module,\n // The ONE narrowing on this path, and it is an unchecked cast: the wire\n // carries `string`, the module type is the capability/protocol union.\n // It was left unchecked because that union was extended by module\n // augmentation, so its members did not exist at runtime — no longer true:\n // `ProviderCapability` is the built-in set since #502 and `ProviderProtocol`\n // is `BuiltinProviderProtocol`, and both sets exist at runtime.\n // A runtime check is now possible and not yet written. What does\n // have teeth still runs: `composeFrontendTechdocProviders` applies the tier rule to\n // every composed module, which is the check that decides whether a\n // capability may bind an engine slot at all.\n providerCapabilities: module.providerCapabilities as ReadonlyArray<ProviderCapability>,\n protocols: module.protocols as ReadonlyArray<ProviderProtocol>,\n // Unchecked for the same reason, and safe for a stronger one (#1702): the consent decision reads\n // these as strings and FAILS CLOSED on any that is not a `ConsentPurpose`, so a wrong member here\n // withholds the provider rather than widening what it may do.\n consentPurposes: module.consentPurposes as ReadonlyArray<ConsentPurpose> | undefined,\n },\n ]),\n );\n return composeFrontendTechdocProviders({ modules });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"engine-frontend-techdoc-provider-registry.d.ts","sourceRoot":"","sources":["../../../../src/techdoc/engine-frontend-techdoc-provider-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AA2BpG,eAAO,MAAM,6CAA6C,EAAE,uCAO3D,CAAC;AAEF,eAAO,MAAM,qCAAqC,sFAEjD,CAAC"}
1
+ {"version":3,"file":"engine-frontend-techdoc-provider-registry.d.ts","sourceRoot":"","sources":["../../../src/techdoc/engine-frontend-techdoc-provider-registry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AA2BpG,eAAO,MAAM,6CAA6C,EAAE,uCAO3D,CAAC;AAEF,eAAO,MAAM,qCAAqC,sFAEjD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"engine-frontend-techdoc-provider-registry.js","sourceRoot":"","sources":["../../../../src/techdoc/engine-frontend-techdoc-provider-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAKvF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,wBAAwB,GAA6C,EAAE,CAAC;AAE9E,MAAM,CAAC,MAAM,6CAA6C,GAA4C;IACpG,OAAO,EAAE,IAAI,GAAG,CACd,wBAAwB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QACzC,QAAQ,CAAC,QAAQ,CAAC,GAAiC;QACnD,QAAQ;KACT,CAAC,CACH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,+BAA+B,CAClF,6CAA6C,CAC9C,CAAC","sourcesContent":["import { composeFrontendTechdocProviders } from './compose-frontend-techdoc-providers';\nimport type { FrontendTechdocProviderRegistryFragment } from './compose-frontend-techdoc-providers';\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type { FrontendTechdocProviderRef } from './frontend-techdoc-provider-registry.types';\n\n/**\n * The engine's documentation-site browser modules — none today, and that is a decision (#1737).\n *\n * The one that stood here, Algolia DocSearch, declared `FRONTEND_SEARCH` and loaded nothing: no SDK,\n * no script, no component, and nothing in the documentation runtime read it. So an application that\n * turned it on got no search, while the catalogue and the companion counted documentation search as\n * covered. It was removed rather than delivered, because the documentation site already has a search\n * that needs no vendor: the consumer-documentation pipeline renders `indexes/search.json` and the\n * site's own `src/pages/search.tsx` searches it in the browser (plus the API reference's index). That\n * search holds no key, sends no reader's query to a third party, needs no consent and no CSP origin.\n *\n * Rejected: projecting an Algolia `appId` / search-only `apiKey` / `indexName` into the generated\n * Docusaurus configuration. DocSearch in Docusaurus is build-time theme configuration\n * (`themeConfig.algolia`, `@docusaurus/theme-search-algolia`), not a runtime SDK, so delivering it\n * would have meant a second search beside the working one, a crawler and index an operator must run,\n * and a new recipient of every reader's queries for the privacy notice. An application that wants\n * DocSearch anyway configures its own `docusaurus.config.ts`, where Docusaurus documents it.\n * spec-cite: https://docusaurus.io/docs/search — \"add an `algolia` field in your `themeConfig`\" (fetched 2026-09-28)\n *\n * The list stays so a browser module with real documentation-site code has one place to be added.\n */\nconst frontendTechdocProviders: readonly FrontendTechdocProviderModule[] = [];\n\nexport const EngineFrontendTechdocProviderRegistryFragment: FrontendTechdocProviderRegistryFragment = {\n modules: new Map(\n frontendTechdocProviders.map((provider) => [\n provider.metadata.ref as FrontendTechdocProviderRef,\n provider,\n ]),\n ),\n};\n\nexport const EngineFrontendTechdocProviderRegistry = composeFrontendTechdocProviders(\n EngineFrontendTechdocProviderRegistryFragment,\n);\n"]}
1
+ {"version":3,"file":"engine-frontend-techdoc-provider-registry.js","sourceRoot":"","sources":["../../../src/techdoc/engine-frontend-techdoc-provider-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAKvF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,wBAAwB,GAA6C,EAAE,CAAC;AAE9E,MAAM,CAAC,MAAM,6CAA6C,GAA4C;IACpG,OAAO,EAAE,IAAI,GAAG,CACd,wBAAwB,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC;QACzC,QAAQ,CAAC,QAAQ,CAAC,GAAiC;QACnD,QAAQ;KACT,CAAC,CACH;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qCAAqC,GAAG,+BAA+B,CAClF,6CAA6C,CAC9C,CAAC","sourcesContent":["import { composeFrontendTechdocProviders } from './compose-frontend-techdoc-providers';\nimport type { FrontendTechdocProviderRegistryFragment } from './compose-frontend-techdoc-providers';\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type { FrontendTechdocProviderRef } from './frontend-techdoc-provider-registry.types';\n\n/**\n * The engine's documentation-site browser modules — none today, and that is a decision (#1737).\n *\n * The one that stood here, Algolia DocSearch, declared `FRONTEND_SEARCH` and loaded nothing: no SDK,\n * no script, no component, and nothing in the documentation runtime read it. So an application that\n * turned it on got no search, while the catalogue and the companion counted documentation search as\n * covered. It was removed rather than delivered, because the documentation site already has a search\n * that needs no vendor: the consumer-documentation pipeline renders `indexes/search.json` and the\n * site's own `src/pages/search.tsx` searches it in the browser (plus the API reference's index). That\n * search holds no key, sends no reader's query to a third party, needs no consent and no CSP origin.\n *\n * Rejected: projecting an Algolia `appId` / search-only `apiKey` / `indexName` into the generated\n * Docusaurus configuration. DocSearch in Docusaurus is build-time theme configuration\n * (`themeConfig.algolia`, `@docusaurus/theme-search-algolia`), not a runtime SDK, so delivering it\n * would have meant a second search beside the working one, a crawler and index an operator must run,\n * and a new recipient of every reader's queries for the privacy notice. An application that wants\n * DocSearch anyway configures its own `docusaurus.config.ts`, where Docusaurus documents it.\n * spec-cite: https://docusaurus.io/docs/search — \"add an `algolia` field in your `themeConfig`\" (fetched 2026-09-28)\n *\n * The list stays so a browser module with real documentation-site code has one place to be added.\n */\nconst frontendTechdocProviders: readonly FrontendTechdocProviderModule[] = [];\n\nexport const EngineFrontendTechdocProviderRegistryFragment: FrontendTechdocProviderRegistryFragment = {\n modules: new Map(\n frontendTechdocProviders.map((provider) => [\n provider.metadata.ref as FrontendTechdocProviderRef,\n provider,\n ]),\n ),\n};\n\nexport const EngineFrontendTechdocProviderRegistry = composeFrontendTechdocProviders(\n EngineFrontendTechdocProviderRegistryFragment,\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-techdoc-provider-module.types.d.ts","sourceRoot":"","sources":["../../../../src/techdoc/frontend-techdoc-provider-module.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEtG,OAAO,KAAK,EACV,uCAAuC,EACvC,iCAAiC,EACjC,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,0BAA0B,EAC1B,kCAAkC,EAClC,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAEnD,+HAA+H;AAC/H,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,oBAAoB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD;;;;;;;;;;OAUG;IACH,GAAG,CAAC,EAAE,uCAAuC,CAAC;IAC9C;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,iCAAiC,CAAC,CAAC;IAC3D;;;OAGG;IACH,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,kCAAkC,CAAC;IACxD;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACjD;AACD,kFAAkF"}
1
+ {"version":3,"file":"frontend-techdoc-provider-module.types.d.ts","sourceRoot":"","sources":["../../../src/techdoc/frontend-techdoc-provider-module.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEtG,OAAO,KAAK,EACV,uCAAuC,EACvC,iCAAiC,EACjC,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EACV,0BAA0B,EAC1B,kCAAkC,EAClC,mBAAmB,EACpB,MAAM,2CAA2C,CAAC;AAEnD,+HAA+H;AAC/H,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,oBAAoB,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACxD,SAAS,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;IAC3C,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD;;;;;;;;;;OAUG;IACH,GAAG,CAAC,EAAE,uCAAuC,CAAC;IAC9C;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,iCAAiC,CAAC,CAAC;IAC3D;;;OAGG;IACH,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC;;;;;;;;;;;;;OAaG;IACH,kBAAkB,CAAC,EAAE,kCAAkC,CAAC;IACxD;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,yBAAyB,CAAC;IAC9C;;;;;;;;;OASG;IACH,eAAe,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,CAAC;CACjD;AACD,kFAAkF"}
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-techdoc-provider-module.types.js","sourceRoot":"","sources":["../../../../src/techdoc/frontend-techdoc-provider-module.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAiGH,kFAAkF","sourcesContent":["/**\n * `FrontendTechdocProviderModule` — browser-bound facet for the\n * `AppFrontendType.TECH_DOC` surface (`@wildo-ai/saas-technical-doc`).\n *\n * Same shape as `FrontendAppProviderModule` but a distinct type so the\n * facet boundary is type-enforced. Authored providers explicitly opt\n * into techdoc visibility by exporting a `<ref>FrontendTechdocProvider`\n * — the techdoc bundle never sees the SaaS-app providers and vice\n * versa.\n *\n * The module is the CODE half of a provider's frontend surface; its DATA half\n * is `FrontendProviderEntry`, read from the materialized frontend-services\n * artifact at build time. The two are joined by\n * `composeHydratedFrontendTechdocProviders`.\n *\n * I18n resolution belongs to the consuming techdoc surface: provider\n * metadata should stay locale-neutral and expose translation-ready keys,\n * not localized prose baked into generated/runtime artifacts.\n */\n\nimport type { ConsentPurpose, ProviderComplianceProfile } from '@wildo-ai/saas-models/public-runtime';\n\nimport type {\n ProviderFrontendCspFootprintDeclaration,\n ProviderFrontendScriptDeclaration,\n ProviderMetadata,\n ProviderCapability,\n ProviderProtocol,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type {\n ProviderFrontendComponents,\n ProviderFrontendPublicConfigSchema,\n ProviderFrontendSdk,\n} from '../shared/frontend-provider-surface.types';\n\n/** @wildo_source:part:start external-connectors.techdoc.frontend-provider-module facet:layer:frontend facet:family:provider */\nexport interface FrontendTechdocProviderModule {\n metadata: ProviderMetadata;\n providerCapabilities: ReadonlyArray<ProviderCapability>;\n protocols: ReadonlyArray<ProviderProtocol>;\n publicConfig?: Readonly<Record<string, unknown>>;\n /**\n * Origins this provider needs the technical doc's composed CSP to admit.\n *\n * DATA: projected onto the provider entry and read by `resolveCspPolicy`'s\n * provider layer, per service and per environment.\n *\n * Name only the buckets you reach. For an endpoint you cannot know — one the\n * application configures — declare `derivedOrigins` instead and the framework\n * reads it out of your own `publicConfig`; see the app facet's module type for\n * the worked shape.\n */\n csp?: ProviderFrontendCspFootprintDeclaration;\n /**\n * Third-party `<script>` tags the surface must add for this provider — the\n * case a dynamic `import()` cannot serve, because the vendor ships a\n * global-installing tag rather than an npm module (reCAPTCHA is the one this\n * facet already has). Each declared `src`'s origin MUST also appear in\n * `csp.scriptOrigins` — `projectFrontendProviderContribution` refuses the\n * provider otherwise, because the policy it contributes to would block its own\n * script, and only where CSP enforces, so the failure would first appear in\n * production.\n */\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /**\n * The provider's vendor SDK: which package (DATA) and how to load and start\n * it (CODE). `activate` must reach its package through a DYNAMIC `import()`.\n */\n sdk?: ProviderFrontendSdk;\n /**\n * Components this provider contributes, keyed by the capability each fills\n * and loaded on demand. CODE: it reaches a bundle only through the generated\n * `frontend-providers.generated.ts`, never through the JSON entry.\n *\n * Several providers may offer a component for ONE capability — two file\n * pickers, two meeting embeds — and that is the point: the surface presents\n * the choice rather than silently taking whichever the registry happened to\n * index first.\n */\n components?: ProviderFrontendComponents;\n /**\n * Validator for this provider's own `publicConfig`, as a Standard Schema v1\n * value (a Zod 4 schema satisfies it as-is). Validated once at hydration, so\n * no use site has to coerce `Record<string, unknown>` by hand.\n *\n * MANDATORY for an authored module (#1705): its declared keys are the only\n * list that bounds what a browser is served, so a module without one — or\n * with one whose keys cannot be read without running it (use\n * `defineFrontendPublicConfigSchema` or a Zod object) — is refused at\n * projection, at `wildo config sync` and at hydration. It stays OPTIONAL in\n * this type on purpose: the same type describes a HYDRATED registry entry, and\n * a provider the service declares but whose code this bundle does not carry is\n * data-only and has no schema to hold. The three runtime refusals are the gate.\n */\n publicConfigSchema?: ProviderFrontendPublicConfigSchema;\n /**\n * The vendor's deployment model, processing regions and legal entity (#345).\n *\n * Same contract, same optionality and same reasoning as `FrontendAppProviderModule`: this module\n * runs in the data subject's browser and reaches the vendor directly, so it is a third-party\n * recipient a processor register must name. See `ProviderComplianceProfileSchema`.\n */\n complianceProfile?: ProviderComplianceProfile;\n /**\n * Consent purposes THIS VENDOR rests on beyond its capabilities' floor (#1702). DATA.\n *\n * ADDITIVE: the provider rests on the union of these and the floor\n * `PROVIDER_CAPABILITY_FRONTEND_CONSENT_CLASSIFICATION` gives each declared capability, so nothing\n * written here can lower what a capability requires. Declare it when the vendor's own processing goes\n * beyond the service the person asked for — Google reCAPTCHA is the measured case, a captcha whose\n * vendor also analyses the visitor for its own purposes — and leave it out otherwise. A consent-based\n * provider's SDK, scripts and components are all withheld until the person grants these.\n */\n consentPurposes?: ReadonlyArray<ConsentPurpose>;\n}\n/** @wildo_source:part:end external-connectors.techdoc.frontend-provider-module */\n"]}
1
+ {"version":3,"file":"frontend-techdoc-provider-module.types.js","sourceRoot":"","sources":["../../../src/techdoc/frontend-techdoc-provider-module.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAiGH,kFAAkF","sourcesContent":["/**\n * `FrontendTechdocProviderModule` — browser-bound facet for the\n * `AppFrontendType.TECH_DOC` surface (`@wildo-ai/saas-technical-doc`).\n *\n * Same shape as `FrontendAppProviderModule` but a distinct type so the\n * facet boundary is type-enforced. Authored providers explicitly opt\n * into techdoc visibility by exporting a `<ref>FrontendTechdocProvider`\n * — the techdoc bundle never sees the SaaS-app providers and vice\n * versa.\n *\n * The module is the CODE half of a provider's frontend surface; its DATA half\n * is `FrontendProviderEntry`, read from the materialized frontend-services\n * artifact at build time. The two are joined by\n * `composeHydratedFrontendTechdocProviders`.\n *\n * I18n resolution belongs to the consuming techdoc surface: provider\n * metadata should stay locale-neutral and expose translation-ready keys,\n * not localized prose baked into generated/runtime artifacts.\n */\n\nimport type { ConsentPurpose, ProviderComplianceProfile } from '@wildo-ai/saas-models/public-runtime';\n\nimport type {\n ProviderFrontendCspFootprintDeclaration,\n ProviderFrontendScriptDeclaration,\n ProviderMetadata,\n ProviderCapability,\n ProviderProtocol,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type {\n ProviderFrontendComponents,\n ProviderFrontendPublicConfigSchema,\n ProviderFrontendSdk,\n} from '../shared/frontend-provider-surface.types';\n\n/** @wildo_source:part:start external-connectors.techdoc.frontend-provider-module facet:layer:frontend facet:family:provider */\nexport interface FrontendTechdocProviderModule {\n metadata: ProviderMetadata;\n providerCapabilities: ReadonlyArray<ProviderCapability>;\n protocols: ReadonlyArray<ProviderProtocol>;\n publicConfig?: Readonly<Record<string, unknown>>;\n /**\n * Origins this provider needs the technical doc's composed CSP to admit.\n *\n * DATA: projected onto the provider entry and read by `resolveCspPolicy`'s\n * provider layer, per service and per environment.\n *\n * Name only the buckets you reach. For an endpoint you cannot know — one the\n * application configures — declare `derivedOrigins` instead and the framework\n * reads it out of your own `publicConfig`; see the app facet's module type for\n * the worked shape.\n */\n csp?: ProviderFrontendCspFootprintDeclaration;\n /**\n * Third-party `<script>` tags the surface must add for this provider — the\n * case a dynamic `import()` cannot serve, because the vendor ships a\n * global-installing tag rather than an npm module (reCAPTCHA is the one this\n * facet already has). Each declared `src`'s origin MUST also appear in\n * `csp.scriptOrigins` — `projectFrontendProviderContribution` refuses the\n * provider otherwise, because the policy it contributes to would block its own\n * script, and only where CSP enforces, so the failure would first appear in\n * production.\n */\n scripts?: ReadonlyArray<ProviderFrontendScriptDeclaration>;\n /**\n * The provider's vendor SDK: which package (DATA) and how to load and start\n * it (CODE). `activate` must reach its package through a DYNAMIC `import()`.\n */\n sdk?: ProviderFrontendSdk;\n /**\n * Components this provider contributes, keyed by the capability each fills\n * and loaded on demand. CODE: it reaches a bundle only through the generated\n * `frontend-providers.generated.ts`, never through the JSON entry.\n *\n * Several providers may offer a component for ONE capability — two file\n * pickers, two meeting embeds — and that is the point: the surface presents\n * the choice rather than silently taking whichever the registry happened to\n * index first.\n */\n components?: ProviderFrontendComponents;\n /**\n * Validator for this provider's own `publicConfig`, as a Standard Schema v1\n * value (a Zod 4 schema satisfies it as-is). Validated once at hydration, so\n * no use site has to coerce `Record<string, unknown>` by hand.\n *\n * MANDATORY for an authored module (#1705): its declared keys are the only\n * list that bounds what a browser is served, so a module without one — or\n * with one whose keys cannot be read without running it (use\n * `defineFrontendPublicConfigSchema` or a Zod object) — is refused at\n * projection, at `wildo config sync` and at hydration. It stays OPTIONAL in\n * this type on purpose: the same type describes a HYDRATED registry entry, and\n * a provider the service declares but whose code this bundle does not carry is\n * data-only and has no schema to hold. The three runtime refusals are the gate.\n */\n publicConfigSchema?: ProviderFrontendPublicConfigSchema;\n /**\n * The vendor's deployment model, processing regions and legal entity (#345).\n *\n * Same contract, same optionality and same reasoning as `FrontendAppProviderModule`: this module\n * runs in the data subject's browser and reaches the vendor directly, so it is a third-party\n * recipient a processor register must name. See `ProviderComplianceProfileSchema`.\n */\n complianceProfile?: ProviderComplianceProfile;\n /**\n * Consent purposes THIS VENDOR rests on beyond its capabilities' floor (#1702). DATA.\n *\n * ADDITIVE: the provider rests on the union of these and the floor\n * `PROVIDER_CAPABILITY_FRONTEND_CONSENT_CLASSIFICATION` gives each declared capability, so nothing\n * written here can lower what a capability requires. Declare it when the vendor's own processing goes\n * beyond the service the person asked for — Google reCAPTCHA is the measured case, a captcha whose\n * vendor also analyses the visitor for its own purposes — and leave it out otherwise. A consent-based\n * provider's SDK, scripts and components are all withheld until the person grants these.\n */\n consentPurposes?: ReadonlyArray<ConsentPurpose>;\n}\n/** @wildo_source:part:end external-connectors.techdoc.frontend-provider-module */\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-techdoc-provider-registry.types.d.ts","sourceRoot":"","sources":["../../../../src/techdoc/frontend-techdoc-provider-registry.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG;IAChD,QAAQ,CAAC,OAAO,EAAE,4BAA4B,CAAC;CAChD,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC3B,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;IAEF,gBAAgB,CACd,GAAG,EAAE,0BAA0B,GAC9B,6BAA6B,GAAG,SAAS,CAAC;IAE7C,gCAAgC,CAC9B,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAAC,6BAA6B,CAAC,CAAC;IAEhD,gCAAgC,CAC9B,kBAAkB,EAAE,kBAAkB,GACrC,6BAA6B,GAAG,SAAS,CAAC;CAC9C"}
1
+ {"version":3,"file":"frontend-techdoc-provider-registry.types.d.ts","sourceRoot":"","sources":["../../../src/techdoc/frontend-techdoc-provider-registry.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAE/E,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG;IAChD,QAAQ,CAAC,OAAO,EAAE,4BAA4B,CAAC;CAChD,CAAC;AAEF,MAAM,WAAW,+BAA+B;IAC9C,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC3B,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;IAEF,gBAAgB,CACd,GAAG,EAAE,0BAA0B,GAC9B,6BAA6B,GAAG,SAAS,CAAC;IAE7C,gCAAgC,CAC9B,kBAAkB,EAAE,kBAAkB,GACrC,aAAa,CAAC,6BAA6B,CAAC,CAAC;IAEhD,gCAAgC,CAC9B,kBAAkB,EAAE,kBAAkB,GACrC,6BAA6B,GAAG,SAAS,CAAC;CAC9C"}
@@ -1 +1 @@
1
- {"version":3,"file":"frontend-techdoc-provider-registry.types.js","sourceRoot":"","sources":["../../../../src/techdoc/frontend-techdoc-provider-registry.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * `FrontendTechdocProviderRegistry` — composed techdoc-facet catalog.\n *\n * Mirrors `FrontendAppProviderRegistry` for the `TECH_DOC` frontend\n * type. Phase 0 ships the type only.\n */\n\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type { ProviderCapability } from '@wildo-ai/saas-models/public-runtime';\n\nexport type FrontendTechdocProviderRef = string & {\n readonly __brand: 'FrontendTechdocProviderRef';\n};\n\nexport interface FrontendTechdocProviderRegistry {\n readonly modules: ReadonlyMap<\n FrontendTechdocProviderRef,\n FrontendTechdocProviderModule\n >;\n\n getProviderByRef(\n ref: FrontendTechdocProviderRef,\n ): FrontendTechdocProviderModule | undefined;\n\n getProvidersByProviderCapability(\n providerCapability: ProviderCapability,\n ): ReadonlyArray<FrontendTechdocProviderModule>;\n\n findProviderByProviderCapability(\n providerCapability: ProviderCapability,\n ): FrontendTechdocProviderModule | undefined;\n}\n"]}
1
+ {"version":3,"file":"frontend-techdoc-provider-registry.types.js","sourceRoot":"","sources":["../../../src/techdoc/frontend-techdoc-provider-registry.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * `FrontendTechdocProviderRegistry` — composed techdoc-facet catalog.\n *\n * Mirrors `FrontendAppProviderRegistry` for the `TECH_DOC` frontend\n * type. Phase 0 ships the type only.\n */\n\nimport type { FrontendTechdocProviderModule } from './frontend-techdoc-provider-module.types';\nimport type { ProviderCapability } from '@wildo-ai/saas-models/public-runtime';\n\nexport type FrontendTechdocProviderRef = string & {\n readonly __brand: 'FrontendTechdocProviderRef';\n};\n\nexport interface FrontendTechdocProviderRegistry {\n readonly modules: ReadonlyMap<\n FrontendTechdocProviderRef,\n FrontendTechdocProviderModule\n >;\n\n getProviderByRef(\n ref: FrontendTechdocProviderRef,\n ): FrontendTechdocProviderModule | undefined;\n\n getProvidersByProviderCapability(\n providerCapability: ProviderCapability,\n ): ReadonlyArray<FrontendTechdocProviderModule>;\n\n findProviderByProviderCapability(\n providerCapability: ProviderCapability,\n ): FrontendTechdocProviderModule | undefined;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/techdoc/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/techdoc/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/techdoc/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC","sourcesContent":["/**\n * Public surface of `@wildo-ai/external-connectors-public/techdoc`.\n *\n * Browser-bound, no secrets. Phase 1 wires `composeFrontendTechdocProviders`.\n */\n\nexport * from './frontend-techdoc-provider-module.types';\nexport * from './frontend-techdoc-provider-registry.types';\nexport * from './compose-frontend-techdoc-providers';\nexport * from './engine-frontend-techdoc-provider-registry';\nexport * from './compose-hydrated-frontend-techdoc-providers';\nexport * from '../shared/frontend-provider-surface.types';\nexport * from '../shared/hydrate-frontend-providers';\nexport * from '../shared/activate-frontend-provider-sdks';\nexport * from '../shared/load-frontend-provider-scripts';\nexport * from '../shared/frontend-provider-consent';\nexport * from '../shared/provider-component-registry';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/techdoc/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,0CAA0C,CAAC;AACzD,cAAc,4CAA4C,CAAC;AAC3D,cAAc,sCAAsC,CAAC;AACrD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,0CAA0C,CAAC;AACzD,cAAc,qCAAqC,CAAC;AACpD,cAAc,uCAAuC,CAAC","sourcesContent":["/**\n * Public surface of `@wildo-ai/external-connectors-public/techdoc`.\n *\n * Browser-bound, no secrets. Phase 1 wires `composeFrontendTechdocProviders`.\n */\n\nexport * from './frontend-techdoc-provider-module.types';\nexport * from './frontend-techdoc-provider-registry.types';\nexport * from './compose-frontend-techdoc-providers';\nexport * from './engine-frontend-techdoc-provider-registry';\nexport * from './compose-hydrated-frontend-techdoc-providers';\nexport * from '../shared/frontend-provider-surface.types';\nexport * from '../shared/hydrate-frontend-providers';\nexport * from '../shared/activate-frontend-provider-sdks';\nexport * from '../shared/load-frontend-provider-scripts';\nexport * from '../shared/frontend-provider-consent';\nexport * from '../shared/provider-component-registry';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-frontend-website-providers.d.ts","sourceRoot":"","sources":["../../../../src/website/compose-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC3B,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,GAAG,SAAS,EAAE,aAAa,CAAC,uCAAuC,CAAC,GACnE,+BAA+B,CAQjC"}
1
+ {"version":3,"file":"compose-frontend-website-providers.d.ts","sourceRoot":"","sources":["../../../src/website/compose-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EACV,0BAA0B,EAC1B,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,OAAO,EAAE,WAAW,CAC3B,0BAA0B,EAC1B,6BAA6B,CAC9B,CAAC;CACH;AAED,wBAAgB,+BAA+B,CAC7C,GAAG,SAAS,EAAE,aAAa,CAAC,uCAAuC,CAAC,GACnE,+BAA+B,CAQjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-frontend-website-providers.js","sourceRoot":"","sources":["../../../../src/website/compose-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAC9B,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAe9C,MAAM,UAAU,+BAA+B,CAC7C,GAAG,SAAiE;IAEpE,MAAM,QAAQ,GAAG,uBAAuB,CAGtC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAChC,wFAAwF;IACxF,2BAA2B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * `composeFrontendWebsiteProviders` — frontend-website-facet wrapper\n * around the generic `composeProviderRegistry` core. See\n * `@wildo-ai/saas-models/external-providers/compose-provider-registry.shared`\n * for behavior, conflict policy, and indexing semantics.\n */\n\nimport { composeProviderRegistry,\n assertProviderTierCoherence,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendWebsiteProviderModule } from './frontend-website-provider-module.types';\nimport type {\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderRegistry,\n} from './frontend-website-provider-registry.types';\n\nexport interface FrontendWebsiteProviderRegistryFragment {\n readonly modules: ReadonlyMap<\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderModule\n >;\n}\n\nexport function composeFrontendWebsiteProviders(\n ...fragments: ReadonlyArray<FrontendWebsiteProviderRegistryFragment>\n): FrontendWebsiteProviderRegistry {\n const registry = composeProviderRegistry<\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderModule\n >('FrontendWebsite', fragments);\n // #328 — the tier rule holds on every facet: a CATALOGUE provider binds no engine slot.\n assertProviderTierCoherence('FrontendWebsite', registry.modules.values());\n return registry;\n}\n"]}
1
+ {"version":3,"file":"compose-frontend-website-providers.js","sourceRoot":"","sources":["../../../src/website/compose-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,uBAAuB,EAC9B,2BAA2B,GAC5B,MAAM,sCAAsC,CAAC;AAe9C,MAAM,UAAU,+BAA+B,CAC7C,GAAG,SAAiE;IAEpE,MAAM,QAAQ,GAAG,uBAAuB,CAGtC,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAChC,wFAAwF;IACxF,2BAA2B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC1E,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["/**\n * `composeFrontendWebsiteProviders` — frontend-website-facet wrapper\n * around the generic `composeProviderRegistry` core. See\n * `@wildo-ai/saas-models/external-providers/compose-provider-registry.shared`\n * for behavior, conflict policy, and indexing semantics.\n */\n\nimport { composeProviderRegistry,\n assertProviderTierCoherence,\n} from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendWebsiteProviderModule } from './frontend-website-provider-module.types';\nimport type {\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderRegistry,\n} from './frontend-website-provider-registry.types';\n\nexport interface FrontendWebsiteProviderRegistryFragment {\n readonly modules: ReadonlyMap<\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderModule\n >;\n}\n\nexport function composeFrontendWebsiteProviders(\n ...fragments: ReadonlyArray<FrontendWebsiteProviderRegistryFragment>\n): FrontendWebsiteProviderRegistry {\n const registry = composeProviderRegistry<\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderModule\n >('FrontendWebsite', fragments);\n // #328 — the tier rule holds on every facet: a CATALOGUE provider binds no engine slot.\n assertProviderTierCoherence('FrontendWebsite', registry.modules.values());\n return registry;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-hydrated-frontend-website-providers.d.ts","sourceRoot":"","sources":["../../../../src/website/compose-hydrated-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,6BAA6B,CAAC,6BAA6B,CAAC,GAClE,+BAA+B,CA2BjC"}
1
+ {"version":3,"file":"compose-hydrated-frontend-website-providers.d.ts","sourceRoot":"","sources":["../../../src/website/compose-hydrated-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAC9F,OAAO,KAAK,EAEV,+BAA+B,EAChC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,sCAAsC,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,+BAA+B,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAEtG;;;GAGG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,6BAA6B,CAAC,6BAA6B,CAAC,GAClE,+BAA+B,CA2BjC"}
@@ -1 +1 @@
1
- {"version":3,"file":"compose-hydrated-frontend-website-providers.js","sourceRoot":"","sources":["../../../../src/website/compose-hydrated-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAc9C;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,KAAmE;IAEnE,MAAM,QAAQ,GAAG,8BAA8B,CAAgC,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;QACnC,GAAiC;QACjC;YACE,GAAG,MAAM;YACT,wEAAwE;YACxE,sEAAsE;YACtE,kEAAkE;YAClE,0EAA0E;YAC1E,6EAA6E;YAC7E,gEAAgE;YAChE,iEAAiE;YACjE,oFAAoF;YACpF,mEAAmE;YACnE,6CAA6C;YAC7C,oBAAoB,EAAE,MAAM,CAAC,oBAAyD;YACtF,SAAS,EAAE,MAAM,CAAC,SAA4C;YAC9D,iGAAiG;YACjG,kGAAkG;YAClG,8DAA8D;YAC9D,eAAe,EAAE,MAAM,CAAC,eAA4D;SACrF;KACF,CAAC,CACH,CAAC;IACF,OAAO,+BAA+B,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/**\n * Hydration for the marketing website facet: the DATA channel joined with the\n * CODE channel, composed into the same registry every consumer already reads.\n *\n * `composeFrontendWebsiteProviders` (the fragment-composition core) is unchanged and still the\n * single place the tier rule runs. What is added here is the step BEFORE it —\n * building each module from its served entry and, where the bundle carries it,\n * the provider package's own module — so the registry is no longer produced by\n * casting a JSON entry to a module type.\n *\n * See `../shared/hydrate-frontend-providers.ts` for the join rule and the\n * diagnostics it raises.\n */\n\nimport type { ConsentPurpose, ProviderCapability, ProviderProtocol } from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendWebsiteProviderModule } from './frontend-website-provider-module.types';\nimport type {\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderRegistry,\n} from './frontend-website-provider-registry.types';\nimport { composeFrontendWebsiteProviders } from './compose-frontend-website-providers';\nimport {\n hydrateFrontendProviderModules,\n type HydrateFrontendProvidersInput,\n} from '../shared/hydrate-frontend-providers';\n\n/**\n * The shape of `generatedFrontendProviderModules` in a\n * `frontend-providers.generated.ts` written by `wildo config sync` for a\n * marketing website service.\n *\n * The key is the provider's `ref` and must equal `module.metadata.ref`; the\n * join refuses a mismatch rather than binding one provider's code to another's\n * configuration. Config sync emits an empty map for a service with no providers,\n * keeping its startup import stable when the last provider is removed.\n */\nexport type GeneratedWebsiteProviderModules = Readonly<Record<string, FrontendWebsiteProviderModule>>;\n\n/**\n * Joins the served provider entries with the bundle's generated modules and\n * composes the result.\n */\nexport function composeHydratedFrontendWebsiteProviders(\n input: HydrateFrontendProvidersInput<FrontendWebsiteProviderModule>,\n): FrontendWebsiteProviderRegistry {\n const hydrated = hydrateFrontendProviderModules<FrontendWebsiteProviderModule>(input);\n const modules = new Map<FrontendWebsiteProviderRef, FrontendWebsiteProviderModule>(\n [...hydrated].map(([ref, module]) => [\n ref as FrontendWebsiteProviderRef,\n {\n ...module,\n // The ONE narrowing on this path, and it is an unchecked cast: the wire\n // carries `string`, the module type is the capability/protocol union.\n // It was left unchecked because that union was extended by module\n // augmentation, so its members did not exist at runtime — no longer true:\n // `ProviderCapability` is the built-in set since #502 and `ProviderProtocol`\n // is `BuiltinProviderProtocol`, and both sets exist at runtime.\n // A runtime check is now possible and not yet written. What does\n // have teeth still runs: `composeFrontendWebsiteProviders` applies the tier rule to\n // every composed module, which is the check that decides whether a\n // capability may bind an engine slot at all.\n providerCapabilities: module.providerCapabilities as ReadonlyArray<ProviderCapability>,\n protocols: module.protocols as ReadonlyArray<ProviderProtocol>,\n // Unchecked for the same reason, and safe for a stronger one (#1702): the consent decision reads\n // these as strings and FAILS CLOSED on any that is not a `ConsentPurpose`, so a wrong member here\n // withholds the provider rather than widening what it may do.\n consentPurposes: module.consentPurposes as ReadonlyArray<ConsentPurpose> | undefined,\n },\n ]),\n );\n return composeFrontendWebsiteProviders({ modules });\n}\n"]}
1
+ {"version":3,"file":"compose-hydrated-frontend-website-providers.js","sourceRoot":"","sources":["../../../src/website/compose-hydrated-frontend-website-providers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EACL,8BAA8B,GAE/B,MAAM,sCAAsC,CAAC;AAc9C;;;GAGG;AACH,MAAM,UAAU,uCAAuC,CACrD,KAAmE;IAEnE,MAAM,QAAQ,GAAG,8BAA8B,CAAgC,KAAK,CAAC,CAAC;IACtF,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,CAAC,GAAG,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC;QACnC,GAAiC;QACjC;YACE,GAAG,MAAM;YACT,wEAAwE;YACxE,sEAAsE;YACtE,kEAAkE;YAClE,0EAA0E;YAC1E,6EAA6E;YAC7E,gEAAgE;YAChE,iEAAiE;YACjE,oFAAoF;YACpF,mEAAmE;YACnE,6CAA6C;YAC7C,oBAAoB,EAAE,MAAM,CAAC,oBAAyD;YACtF,SAAS,EAAE,MAAM,CAAC,SAA4C;YAC9D,iGAAiG;YACjG,kGAAkG;YAClG,8DAA8D;YAC9D,eAAe,EAAE,MAAM,CAAC,eAA4D;SACrF;KACF,CAAC,CACH,CAAC;IACF,OAAO,+BAA+B,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/**\n * Hydration for the marketing website facet: the DATA channel joined with the\n * CODE channel, composed into the same registry every consumer already reads.\n *\n * `composeFrontendWebsiteProviders` (the fragment-composition core) is unchanged and still the\n * single place the tier rule runs. What is added here is the step BEFORE it —\n * building each module from its served entry and, where the bundle carries it,\n * the provider package's own module — so the registry is no longer produced by\n * casting a JSON entry to a module type.\n *\n * See `../shared/hydrate-frontend-providers.ts` for the join rule and the\n * diagnostics it raises.\n */\n\nimport type { ConsentPurpose, ProviderCapability, ProviderProtocol } from '@wildo-ai/saas-models/public-runtime';\n\nimport type { FrontendWebsiteProviderModule } from './frontend-website-provider-module.types';\nimport type {\n FrontendWebsiteProviderRef,\n FrontendWebsiteProviderRegistry,\n} from './frontend-website-provider-registry.types';\nimport { composeFrontendWebsiteProviders } from './compose-frontend-website-providers';\nimport {\n hydrateFrontendProviderModules,\n type HydrateFrontendProvidersInput,\n} from '../shared/hydrate-frontend-providers';\n\n/**\n * The shape of `generatedFrontendProviderModules` in a\n * `frontend-providers.generated.ts` written by `wildo config sync` for a\n * marketing website service.\n *\n * The key is the provider's `ref` and must equal `module.metadata.ref`; the\n * join refuses a mismatch rather than binding one provider's code to another's\n * configuration. Config sync emits an empty map for a service with no providers,\n * keeping its startup import stable when the last provider is removed.\n */\nexport type GeneratedWebsiteProviderModules = Readonly<Record<string, FrontendWebsiteProviderModule>>;\n\n/**\n * Joins the served provider entries with the bundle's generated modules and\n * composes the result.\n */\nexport function composeHydratedFrontendWebsiteProviders(\n input: HydrateFrontendProvidersInput<FrontendWebsiteProviderModule>,\n): FrontendWebsiteProviderRegistry {\n const hydrated = hydrateFrontendProviderModules<FrontendWebsiteProviderModule>(input);\n const modules = new Map<FrontendWebsiteProviderRef, FrontendWebsiteProviderModule>(\n [...hydrated].map(([ref, module]) => [\n ref as FrontendWebsiteProviderRef,\n {\n ...module,\n // The ONE narrowing on this path, and it is an unchecked cast: the wire\n // carries `string`, the module type is the capability/protocol union.\n // It was left unchecked because that union was extended by module\n // augmentation, so its members did not exist at runtime — no longer true:\n // `ProviderCapability` is the built-in set since #502 and `ProviderProtocol`\n // is `BuiltinProviderProtocol`, and both sets exist at runtime.\n // A runtime check is now possible and not yet written. What does\n // have teeth still runs: `composeFrontendWebsiteProviders` applies the tier rule to\n // every composed module, which is the check that decides whether a\n // capability may bind an engine slot at all.\n providerCapabilities: module.providerCapabilities as ReadonlyArray<ProviderCapability>,\n protocols: module.protocols as ReadonlyArray<ProviderProtocol>,\n // Unchecked for the same reason, and safe for a stronger one (#1702): the consent decision reads\n // these as strings and FAILS CLOSED on any that is not a `ConsentPurpose`, so a wrong member here\n // withholds the provider rather than widening what it may do.\n consentPurposes: module.consentPurposes as ReadonlyArray<ConsentPurpose> | undefined,\n },\n ]),\n );\n return composeFrontendWebsiteProviders({ modules });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"engine-frontend-website-provider-registry.d.ts","sourceRoot":"","sources":["../../../../src/website/engine-frontend-website-provider-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AAOpG,eAAO,MAAM,6CAA6C,EAAE,uCAO3D,CAAC;AAEF,eAAO,MAAM,qCAAqC,sFAEjD,CAAC"}
1
+ {"version":3,"file":"engine-frontend-website-provider-registry.d.ts","sourceRoot":"","sources":["../../../src/website/engine-frontend-website-provider-registry.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uCAAuC,EAAE,MAAM,sCAAsC,CAAC;AAOpG,eAAO,MAAM,6CAA6C,EAAE,uCAO3D,CAAC;AAEF,eAAO,MAAM,qCAAqC,sFAEjD,CAAC"}