@wildo-ai/external-connectors-public 1.1.2 → 1.1.3

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 (111) hide show
  1. package/dist/esm/.native.tsbuildinfo +1 -0
  2. package/dist/esm/app/compose-frontend-app-providers.d.ts.map +1 -1
  3. package/dist/esm/app/compose-frontend-app-providers.js +5 -2
  4. package/dist/esm/app/compose-frontend-app-providers.js.map +1 -1
  5. package/dist/esm/app/compose-hydrated-frontend-app-providers.d.ts +33 -0
  6. package/dist/esm/app/compose-hydrated-frontend-app-providers.d.ts.map +1 -0
  7. package/dist/esm/app/compose-hydrated-frontend-app-providers.js +41 -0
  8. package/dist/esm/app/compose-hydrated-frontend-app-providers.js.map +1 -0
  9. package/dist/esm/app/engine-frontend-app-provider-registry.d.ts.map +1 -1
  10. package/dist/esm/app/engine-frontend-app-provider-registry.js +4 -0
  11. package/dist/esm/app/engine-frontend-app-provider-registry.js.map +1 -1
  12. package/dist/esm/app/frontend-app-provider-module.types.d.ts +128 -15
  13. package/dist/esm/app/frontend-app-provider-module.types.d.ts.map +1 -1
  14. package/dist/esm/app/frontend-app-provider-module.types.js +7 -6
  15. package/dist/esm/app/frontend-app-provider-module.types.js.map +1 -1
  16. package/dist/esm/app/index.d.ts +4 -0
  17. package/dist/esm/app/index.d.ts.map +1 -1
  18. package/dist/esm/app/index.js +4 -0
  19. package/dist/esm/app/index.js.map +1 -1
  20. package/dist/esm/companion-exports.d.ts +47 -0
  21. package/dist/esm/companion-exports.d.ts.map +1 -1
  22. package/dist/esm/companion-exports.js +99 -5
  23. package/dist/esm/companion-exports.js.map +1 -1
  24. package/dist/esm/engine-frontend-providers-package.d.ts +7 -0
  25. package/dist/esm/engine-frontend-providers-package.d.ts.map +1 -0
  26. package/dist/esm/engine-frontend-providers-package.js +7 -0
  27. package/dist/esm/engine-frontend-providers-package.js.map +1 -0
  28. package/dist/esm/providers/algolia/algolia.frontend-techdoc.module.d.ts.map +1 -1
  29. package/dist/esm/providers/algolia/algolia.frontend-techdoc.module.js +26 -4
  30. package/dist/esm/providers/algolia/algolia.frontend-techdoc.module.js.map +1 -1
  31. package/dist/esm/providers/apple/apple.frontend-app.module.d.ts.map +1 -1
  32. package/dist/esm/providers/apple/apple.frontend-app.module.js +16 -4
  33. package/dist/esm/providers/apple/apple.frontend-app.module.js.map +1 -1
  34. package/dist/esm/providers/github/github.frontend-app.module.d.ts.map +1 -1
  35. package/dist/esm/providers/github/github.frontend-app.module.js +15 -4
  36. package/dist/esm/providers/github/github.frontend-app.module.js.map +1 -1
  37. package/dist/esm/providers/google/google.frontend-app.module.d.ts.map +1 -1
  38. package/dist/esm/providers/google/google.frontend-app.module.js +16 -4
  39. package/dist/esm/providers/google/google.frontend-app.module.js.map +1 -1
  40. package/dist/esm/providers/microsoft/microsoft.frontend-app.module.d.ts.map +1 -1
  41. package/dist/esm/providers/microsoft/microsoft.frontend-app.module.js +15 -4
  42. package/dist/esm/providers/microsoft/microsoft.frontend-app.module.js.map +1 -1
  43. package/dist/esm/providers/posthog/posthog.frontend-website.module.d.ts +19 -0
  44. package/dist/esm/providers/posthog/posthog.frontend-website.module.d.ts.map +1 -1
  45. package/dist/esm/providers/posthog/posthog.frontend-website.module.js +65 -4
  46. package/dist/esm/providers/posthog/posthog.frontend-website.module.js.map +1 -1
  47. package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.d.ts.map +1 -1
  48. package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js +24 -4
  49. package/dist/esm/providers/recaptcha/recaptcha.frontend-website.module.js.map +1 -1
  50. package/dist/esm/providers/sentry/index.d.ts +0 -2
  51. package/dist/esm/providers/sentry/index.d.ts.map +0 -1
  52. package/dist/esm/providers/sentry/index.js +0 -2
  53. package/dist/esm/providers/sentry/index.js.map +0 -1
  54. package/dist/esm/providers/sentry/sentry.frontend-app.module.d.ts +57 -0
  55. package/dist/esm/providers/sentry/sentry.frontend-app.module.d.ts.map +1 -0
  56. package/dist/esm/providers/sentry/sentry.frontend-app.module.js +141 -0
  57. package/dist/esm/providers/sentry/sentry.frontend-app.module.js.map +1 -0
  58. package/dist/esm/providers/sentry/sentry.frontend-website.module.d.ts +27 -0
  59. package/dist/esm/providers/sentry/sentry.frontend-website.module.d.ts.map +1 -1
  60. package/dist/esm/providers/sentry/sentry.frontend-website.module.js +79 -4
  61. package/dist/esm/providers/sentry/sentry.frontend-website.module.js.map +1 -1
  62. package/dist/esm/providers/stripe/stripe.frontend-app.module.d.ts.map +1 -1
  63. package/dist/esm/providers/stripe/stripe.frontend-app.module.js +15 -4
  64. package/dist/esm/providers/stripe/stripe.frontend-app.module.js.map +1 -1
  65. package/dist/esm/shared/activate-frontend-provider-sdks.d.ts +88 -0
  66. package/dist/esm/shared/activate-frontend-provider-sdks.d.ts.map +1 -0
  67. package/dist/esm/shared/activate-frontend-provider-sdks.js +110 -0
  68. package/dist/esm/shared/activate-frontend-provider-sdks.js.map +1 -0
  69. package/dist/esm/shared/frontend-provider-surface.types.d.ts +365 -0
  70. package/dist/esm/shared/frontend-provider-surface.types.d.ts.map +1 -0
  71. package/dist/esm/shared/frontend-provider-surface.types.js +82 -0
  72. package/dist/esm/shared/frontend-provider-surface.types.js.map +1 -0
  73. package/dist/esm/shared/hydrate-frontend-providers.d.ts +150 -0
  74. package/dist/esm/shared/hydrate-frontend-providers.d.ts.map +1 -0
  75. package/dist/esm/shared/hydrate-frontend-providers.js +298 -0
  76. package/dist/esm/shared/hydrate-frontend-providers.js.map +1 -0
  77. package/dist/esm/techdoc/compose-frontend-techdoc-providers.d.ts.map +1 -1
  78. package/dist/esm/techdoc/compose-frontend-techdoc-providers.js +5 -2
  79. package/dist/esm/techdoc/compose-frontend-techdoc-providers.js.map +1 -1
  80. package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.d.ts +33 -0
  81. package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.d.ts.map +1 -0
  82. package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.js +41 -0
  83. package/dist/esm/techdoc/compose-hydrated-frontend-techdoc-providers.js.map +1 -0
  84. package/dist/esm/techdoc/frontend-techdoc-provider-module.types.d.ts +61 -4
  85. package/dist/esm/techdoc/frontend-techdoc-provider-module.types.d.ts.map +1 -1
  86. package/dist/esm/techdoc/frontend-techdoc-provider-module.types.js +5 -3
  87. package/dist/esm/techdoc/frontend-techdoc-provider-module.types.js.map +1 -1
  88. package/dist/esm/techdoc/index.d.ts +4 -0
  89. package/dist/esm/techdoc/index.d.ts.map +1 -1
  90. package/dist/esm/techdoc/index.js +4 -0
  91. package/dist/esm/techdoc/index.js.map +1 -1
  92. package/dist/esm/website/compose-frontend-website-providers.d.ts.map +1 -1
  93. package/dist/esm/website/compose-frontend-website-providers.js +5 -2
  94. package/dist/esm/website/compose-frontend-website-providers.js.map +1 -1
  95. package/dist/esm/website/compose-hydrated-frontend-website-providers.d.ts +33 -0
  96. package/dist/esm/website/compose-hydrated-frontend-website-providers.d.ts.map +1 -0
  97. package/dist/esm/website/compose-hydrated-frontend-website-providers.js +41 -0
  98. package/dist/esm/website/compose-hydrated-frontend-website-providers.js.map +1 -0
  99. package/dist/esm/website/engine-frontend-website-provider-registry.d.ts.map +1 -1
  100. package/dist/esm/website/engine-frontend-website-provider-registry.js +5 -1
  101. package/dist/esm/website/engine-frontend-website-provider-registry.js.map +1 -1
  102. package/dist/esm/website/frontend-website-provider-module.types.d.ts +63 -3
  103. package/dist/esm/website/frontend-website-provider-module.types.d.ts.map +1 -1
  104. package/dist/esm/website/frontend-website-provider-module.types.js +7 -2
  105. package/dist/esm/website/frontend-website-provider-module.types.js.map +1 -1
  106. package/dist/esm/website/index.d.ts +4 -0
  107. package/dist/esm/website/index.d.ts.map +1 -1
  108. package/dist/esm/website/index.js +4 -0
  109. package/dist/esm/website/index.js.map +1 -1
  110. package/dist/tsconfig.build.tsbuildinfo +1 -1
  111. package/package.json +15 -3
@@ -1 +1 @@
1
- {"version":3,"file":"sentry.frontend-website.module.js","sourceRoot":"","sources":["../../../../../src/providers/sentry/sentry.frontend-website.module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAG9C,MAAM,CAAC,MAAM,6BAA6B,GAAkC;IAC1E,QAAQ,EAAE;QACR,GAAG,EAAE,QAAQ;QACb,mBAAmB,EAAE,gCAAgC,CAAC,QAAQ,CAAC;KAChE;IACD,oBAAoB,EAAE,CAAC,2BAA2B,CAAC,yBAAyB,CAAC;IAC7E,SAAS,EAAE,CAAC,yBAAyB,CAAC,YAAY,CAAC;IACnD,YAAY,EAAE;QACZ,eAAe,EAAE,0BAA0B;QAC3C,cAAc,EAAE,IAAI;KACrB;CACF,CAAC","sourcesContent":["import {\n BUILTIN_PROVIDER_CAPABILITY,\n BUILTIN_PROVIDER_PROTOCOL,\n buildProviderDisplayNameLabelKey,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendWebsiteProviderModule } from '../../website/frontend-website-provider-module.types';\n\nexport const SentryFrontendWebsiteProvider: FrontendWebsiteProviderModule = {\n metadata: {\n ref: 'sentry',\n displayNameLabelKey: buildProviderDisplayNameLabelKey('sentry'),\n },\n providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.FRONTEND_ERROR_MONITORING],\n protocols: [BUILTIN_PROVIDER_PROTOCOL.FRONTEND_SDK],\n publicConfig: {\n integrationKind: 'browser-error-monitoring',\n websiteRuntime: true,\n },\n};\n"]}
1
+ {"version":3,"file":"sentry.frontend-website.module.js","sourceRoot":"","sources":["../../../../../src/providers/sentry/sentry.frontend-website.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,YAAY,EACZ,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sCAAsC,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAkC;IAC1E,QAAQ,EAAE,sBAAsB,CAAC;QAC/B,GAAG,EAAE,QAAQ;QACb,WAAW,EAAE,sCAAsC;QACnD,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,MAAM,EAAE,sBAAsB;KAC/B,CAAC;IACF,oBAAoB,EAAE,CAAC,2BAA2B,CAAC,yBAAyB,CAAC;IAC7E,SAAS,EAAE,CAAC,yBAAyB,CAAC,YAAY,CAAC;IACnD,YAAY,EAAE;QACZ,eAAe,EAAE,0BAA0B;QAC3C,cAAc,EAAE,IAAI;KACrB;IACD,GAAG,EAAE;QACH,cAAc,EAAE;YACd,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,EAAE,+BAA+B,CAAC,OAAO,EAAE;SAC5E;KACF;IACD,GAAG,EAAE;QACH,UAAU,EAAE,EAAE,WAAW,EAAE,iBAAiB,EAAE;QAC9C,KAAK,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,YAAY,EAAE;YAC1C,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC;YAC7B,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAChD,MAAM,IAAI,KAAK,CACb,aAAa,WAAW,2EAA2E;sBACjG,iGAAiG;sBACjG,0EAA0E,CAC7E,CAAC;YACJ,CAAC;YAED,uEAAuE;YACvE,0EAA0E;YAC1E,0EAA0E;YAC1E,wEAAwE;YACxE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;YAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;YAEpC,OAAO;gBACL,MAAM,EAAE,MAAM;gBACd,UAAU,EAAE,KAAK,IAAI,EAAE;oBACrB,MAAM,MAAM,EAAE,KAAK,EAAE,CAAC;gBACxB,CAAC;aACF,CAAC;QACJ,CAAC;KACF;IACD;;;;;;;;;;;OAWG;IACH,iBAAiB,EAAE;QACjB,gBAAgB,EAAE,CAAC,uBAAuB,CAAC,WAAW,EAAE,uBAAuB,CAAC,aAAa,CAAC;QAC9F,iBAAiB,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC;QAC/B,qBAAqB,EAAE,2BAA2B;KACnD;CACF,CAAC","sourcesContent":["import { ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME } from '../../engine-frontend-providers-package';\nimport {\n ProviderDeploymentModel,\n BUILTIN_PROVIDER_CAPABILITY,\n BUILTIN_PROVIDER_PROTOCOL,\n ProviderFrontendCspOriginBucket,\n ProviderTier,\n defineProviderMetadata,\n ENGINE_PROVIDER_ORIGIN,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendWebsiteProviderModule } from '../../website/frontend-website-provider-module.types';\n\n/**\n * Sentry browser error monitoring for the marketing website.\n *\n * `FRONTEND_SDK` was a LABEL on this module until #332: the website resolved\n * this provider's ref, stamped it into a `data-*` attribute on the page root,\n * and loaded nothing. It now declares the package, loads it on demand and\n * starts it.\n *\n * ## The DSN, and why the CSP origin is DERIVED rather than listed\n *\n * Sentry sends to the host inside the DSN, and a DSN is per APPLICATION and\n * often per ENVIRONMENT — `https://<key>@o0.ingest.<region>.sentry.io/<id>`.\n * No static list on this module can contain it. Listing a vendor's public\n * ingest hostnames here instead would be a guess about someone else's\n * infrastructure, wrong for every self-hosted Sentry, and wrong in production\n * only.\n *\n * So the module declares WHERE the origin is rather than WHAT it is, and the\n * CLI reads it out of the application's own `publicConfig.dsn` when it composes\n * that service's policy. The application authors the DSN once, and the origin\n * it implies cannot drift from it.\n *\n * The application supplies `dsn` by mapping this contribution in its own\n * `provider-contributions.ts`; without one the SDK would start and collect\n * nothing, so activation refuses instead — the runner isolates that failure and\n * reports it, and no other provider is affected.\n */\nexport const SentryFrontendWebsiteProvider: FrontendWebsiteProviderModule = {\n metadata: defineProviderMetadata({\n ref: 'sentry',\n packageName: ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME,\n tier: ProviderTier.MAIN,\n origin: ENGINE_PROVIDER_ORIGIN,\n }),\n providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.FRONTEND_ERROR_MONITORING],\n protocols: [BUILTIN_PROVIDER_PROTOCOL.FRONTEND_SDK],\n publicConfig: {\n integrationKind: 'browser-error-monitoring',\n websiteRuntime: true,\n },\n csp: {\n derivedOrigins: [\n { publicConfigKey: 'dsn', bucket: ProviderFrontendCspOriginBucket.CONNECT },\n ],\n },\n sdk: {\n descriptor: { packageName: '@sentry/browser' },\n async activate({ providerRef, publicConfig }) {\n const dsn = publicConfig.dsn;\n if (typeof dsn !== 'string' || dsn.length === 0) {\n throw new Error(\n `Provider \"${providerRef}\" needs a Sentry DSN in its publicConfig.dsn. Without one the SDK starts `\n + 'and reports nothing, which is indistinguishable from a healthy site. Supply it by mapping this '\n + \"provider's contribution in the application's own provider-contributions.\",\n );\n }\n\n // DYNAMIC on purpose: `@sentry/browser` is a declared OPTIONAL peer of\n // this package, so it becomes its own chunk and only a surface that turns\n // Sentry on pays for it. A static import would land it in every page that\n // touches this closure and break outright wherever it is not installed.\n const Sentry = await import('@sentry/browser');\n const client = Sentry.init({ dsn });\n\n return {\n handle: client,\n deactivate: async () => {\n await client?.close();\n },\n };\n },\n },\n /**\n * Researched 2026-09-06; this vendor has NO backend counterpart to mirror.\n *\n * Legal entity from Sentry's own DPA — `Functional Software, Inc.` trading as Sentry. Regions are\n * the vendor's OWN identifiers, which are the API subdomains rather than cloud labels: `us`\n * (Iowa, `us.sentry.io`) and `de` (Frankfurt, `de.sentry.io`). Written that way deliberately —\n * mapping a vendor's datacentre onto an AWS-style label is the jurisdiction determination the\n * schema declines to model.\n *\n * The only frontend provider here declaring BOTH deployment models: self-hosted Sentry is a real\n * product, so an operator can run it themselves and the region then becomes theirs.\n */\n complianceProfile: {\n deploymentModels: [ProviderDeploymentModel.SELF_HOSTED, ProviderDeploymentModel.VENDOR_HOSTED],\n processingRegions: ['us', 'de'],\n vendorLegalEntityName: 'Functional Software, Inc.',\n },\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.frontend-app.module.d.ts","sourceRoot":"","sources":["../../../../../src/providers/stripe/stripe.frontend-app.module.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,eAAO,MAAM,yBAAyB,EAAE,yBAUvC,CAAC"}
1
+ {"version":3,"file":"stripe.frontend-app.module.d.ts","sourceRoot":"","sources":["../../../../../src/providers/stripe/stripe.frontend-app.module.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAE9F,eAAO,MAAM,yBAAyB,EAAE,yBAoBvC,CAAC"}
@@ -1,13 +1,24 @@
1
- import { BUILTIN_PROVIDER_CAPABILITY, BUILTIN_PROVIDER_PROTOCOL, buildProviderDisplayNameLabelKey, } from '@wildo-ai/saas-models/public-runtime';
1
+ import { ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME } from '../../engine-frontend-providers-package.js';
2
+ import { ProviderDeploymentModel, BUILTIN_PROVIDER_CAPABILITY, BUILTIN_PROVIDER_PROTOCOL, defineProviderMetadata, ENGINE_PROVIDER_ORIGIN, ProviderTier } from '@wildo-ai/saas-models/public-runtime';
2
3
  export const StripeFrontendAppProvider = {
3
- metadata: {
4
+ metadata: defineProviderMetadata({
4
5
  ref: 'stripe',
5
- displayNameLabelKey: buildProviderDisplayNameLabelKey('stripe'),
6
- },
6
+ packageName: ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME,
7
+ tier: ProviderTier.MAIN,
8
+ origin: ENGINE_PROVIDER_ORIGIN,
9
+ }),
7
10
  providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.BILLING],
8
11
  protocols: [BUILTIN_PROVIDER_PROTOCOL.BILLING_PROVIDER],
9
12
  publicConfig: {
10
13
  billingProviderRef: 'stripe',
11
14
  },
15
+ /**
16
+ * Mirrors the authored `stripe` BACKEND profile.
17
+ */
18
+ complianceProfile: {
19
+ deploymentModels: [ProviderDeploymentModel.VENDOR_HOSTED],
20
+ processingRegions: ['us-east-1', 'eu-west-1'],
21
+ vendorLegalEntityName: 'Stripe, Inc.',
22
+ },
12
23
  };
13
24
  //# sourceMappingURL=stripe.frontend-app.module.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stripe.frontend-app.module.js","sourceRoot":"","sources":["../../../../../src/providers/stripe/stripe.frontend-app.module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,yBAAyB,EACzB,gCAAgC,GACjC,MAAM,sCAAsC,CAAC;AAG9C,MAAM,CAAC,MAAM,yBAAyB,GAA8B;IAClE,QAAQ,EAAE;QACR,GAAG,EAAE,QAAQ;QACb,mBAAmB,EAAE,gCAAgC,CAAC,QAAQ,CAAC;KAChE;IACD,oBAAoB,EAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC;IAC3D,SAAS,EAAE,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;IACvD,YAAY,EAAE;QACZ,kBAAkB,EAAE,QAAQ;KAC7B;CACF,CAAC","sourcesContent":["import {\n BUILTIN_PROVIDER_CAPABILITY,\n BUILTIN_PROVIDER_PROTOCOL,\n buildProviderDisplayNameLabelKey,\n} from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendAppProviderModule } from '../../app/frontend-app-provider-module.types';\n\nexport const StripeFrontendAppProvider: FrontendAppProviderModule = {\n metadata: {\n ref: 'stripe',\n displayNameLabelKey: buildProviderDisplayNameLabelKey('stripe'),\n },\n providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.BILLING],\n protocols: [BUILTIN_PROVIDER_PROTOCOL.BILLING_PROVIDER],\n publicConfig: {\n billingProviderRef: 'stripe',\n },\n};\n"]}
1
+ {"version":3,"file":"stripe.frontend-app.module.js","sourceRoot":"","sources":["../../../../../src/providers/stripe/stripe.frontend-app.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sCAAsC,EAAE,MAAM,yCAAyC,CAAC;AACjG,OAAO,EACL,uBAAuB,EAAE,2BAA2B,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAG9L,MAAM,CAAC,MAAM,yBAAyB,GAA8B;IAClE,QAAQ,EAAE,sBAAsB,CAAC;QAC/B,GAAG,EAAE,QAAQ;QACb,WAAW,EAAE,sCAAsC;QACnD,IAAI,EAAE,YAAY,CAAC,IAAI;QACvB,MAAM,EAAE,sBAAsB;KAC/B,CAAC;IACF,oBAAoB,EAAE,CAAC,2BAA2B,CAAC,OAAO,CAAC;IAC3D,SAAS,EAAE,CAAC,yBAAyB,CAAC,gBAAgB,CAAC;IACvD,YAAY,EAAE;QACZ,kBAAkB,EAAE,QAAQ;KAC7B;IACD;;OAEG;IACH,iBAAiB,EAAE;QACjB,gBAAgB,EAAE,CAAC,uBAAuB,CAAC,aAAa,CAAC;QACzD,iBAAiB,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC;QAC7C,qBAAqB,EAAE,cAAc;KACtC;CACF,CAAC","sourcesContent":["import { ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME } from '../../engine-frontend-providers-package';\nimport {\n ProviderDeploymentModel, BUILTIN_PROVIDER_CAPABILITY, BUILTIN_PROVIDER_PROTOCOL, defineProviderMetadata, ENGINE_PROVIDER_ORIGIN, ProviderTier } from '@wildo-ai/saas-models/public-runtime';\nimport type { FrontendAppProviderModule } from '../../app/frontend-app-provider-module.types';\n\nexport const StripeFrontendAppProvider: FrontendAppProviderModule = {\n metadata: defineProviderMetadata({\n ref: 'stripe',\n packageName: ENGINE_FRONTEND_PROVIDERS_PACKAGE_NAME,\n tier: ProviderTier.MAIN,\n origin: ENGINE_PROVIDER_ORIGIN,\n }),\n providerCapabilities: [BUILTIN_PROVIDER_CAPABILITY.BILLING],\n protocols: [BUILTIN_PROVIDER_PROTOCOL.BILLING_PROVIDER],\n publicConfig: {\n billingProviderRef: 'stripe',\n },\n /**\n * Mirrors the authored `stripe` BACKEND profile.\n */\n complianceProfile: {\n deploymentModels: [ProviderDeploymentModel.VENDOR_HOSTED],\n processingRegions: ['us-east-1', 'eu-west-1'],\n vendorLegalEntityName: 'Stripe, Inc.',\n },\n};\n"]}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Running the CODE half: loading and starting every live provider's vendor SDK.
3
+ *
4
+ * `FRONTEND_SDK` was a LABEL before this. Three engine providers declared the
5
+ * protocol (Sentry, PostHog, reCAPTCHA), the website resolved their refs and
6
+ * stamped them into `data-*` attributes on the page root, and no consumer
7
+ * anywhere loaded a vendor SDK. This is the consumer.
8
+ *
9
+ * ## Why one runner for three bundlers
10
+ *
11
+ * Vite, Astro and Docusaurus disagree about almost everything except one thing:
12
+ * a dynamic `import()` inside a module they have bundled becomes a lazily
13
+ * fetched chunk. So the framework owns *when* activation happens and the
14
+ * provider owns *what* it does — `activate()` performs both the import and the
15
+ * vendor's own initialization, because otherwise every surface would grow a
16
+ * switch over vendors.
17
+ *
18
+ * ## Browser only, and deliberately so
19
+ *
20
+ * Two of the three surfaces server-render (Astro and Docusaurus both execute
21
+ * page modules in Node at build time). A vendor SDK started there would run
22
+ * against a `window` that does not exist, or worse, would start a live
23
+ * analytics client inside a build process. The runner refuses off-browser and
24
+ * says so, rather than letting each surface remember to guard.
25
+ */
26
+ import type { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';
27
+ import type { ProviderFrontendSdk, ProviderFrontendSdkActivation } from './frontend-provider-surface.types';
28
+ /** Why an SDK activation did not happen, or did not survive. */
29
+ export declare enum FrontendProviderSdkActivationDiagnosticKind {
30
+ /**
31
+ * Activation was attempted outside a browser. Nothing ran; this is the
32
+ * expected outcome during an Astro or Docusaurus server render, and the
33
+ * surface should activate again on the client.
34
+ */
35
+ SKIPPED_OFF_BROWSER = "SKIPPED_OFF_BROWSER",
36
+ /** The provider's `activate()` threw or rejected. Its SDK is not running. */
37
+ ACTIVATION_FAILED = "ACTIVATION_FAILED",
38
+ /** A provider's `deactivate()` threw. The surface has no way to retry it. */
39
+ DEACTIVATION_FAILED = "DEACTIVATION_FAILED"
40
+ }
41
+ export interface FrontendProviderSdkActivationDiagnostic {
42
+ readonly kind: FrontendProviderSdkActivationDiagnosticKind;
43
+ readonly providerRef: string;
44
+ readonly message: string;
45
+ readonly cause?: unknown;
46
+ }
47
+ /** The DATA+CODE shape this runner needs off a hydrated provider module. */
48
+ interface SdkBearingProviderModule {
49
+ metadata: {
50
+ ref: string;
51
+ };
52
+ publicConfig?: Readonly<Record<string, unknown>>;
53
+ sdk?: ProviderFrontendSdk;
54
+ }
55
+ export interface ActivateFrontendProviderSdksInput {
56
+ readonly surface: AppFrontendType;
57
+ /** The hydrated provider modules for this surface, in registry order. */
58
+ readonly modules: Iterable<SdkBearingProviderModule>;
59
+ readonly onDiagnostic?: (diagnostic: FrontendProviderSdkActivationDiagnostic) => void;
60
+ /**
61
+ * Escape hatch for tests and for a surface that legitimately renders in a
62
+ * non-DOM host. Defaults to a real `window` check; nothing else in this
63
+ * package inspects the global scope.
64
+ */
65
+ readonly isBrowser?: () => boolean;
66
+ }
67
+ /**
68
+ * The live SDKs of one surface, and the single door that stops them.
69
+ *
70
+ * A started SDK that cannot be stopped cannot honour a consent withdrawal and
71
+ * accumulates one live client per hot reload, which is why `deactivateAll`
72
+ * exists here rather than being left to each caller to assemble.
73
+ */
74
+ export interface ActivatedFrontendProviderSdks {
75
+ readonly activations: ReadonlyMap<string, ProviderFrontendSdkActivation>;
76
+ deactivateAll(): Promise<void>;
77
+ }
78
+ /**
79
+ * Activates every declared SDK among `modules`, in iteration order, and returns
80
+ * the live handles keyed by provider ref.
81
+ *
82
+ * One provider's failure never stops another's: an error-monitoring SDK that
83
+ * fails to load must not take the analytics SDK — or the page — with it. Each
84
+ * failure is reported and the run continues.
85
+ */
86
+ export declare function activateFrontendProviderSdks(input: ActivateFrontendProviderSdksInput): Promise<ActivatedFrontendProviderSdks>;
87
+ export {};
88
+ //# sourceMappingURL=activate-frontend-provider-sdks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activate-frontend-provider-sdks.d.ts","sourceRoot":"","sources":["../../../../src/shared/activate-frontend-provider-sdks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,KAAK,EACV,mBAAmB,EACnB,6BAA6B,EAC9B,MAAM,mCAAmC,CAAC;AAE3C,gEAAgE;AAChE,oBAAY,2CAA2C;IACrD;;;;OAIG;IACH,mBAAmB,wBAAwB;IAC3C,6EAA6E;IAC7E,iBAAiB,sBAAsB;IACvC,6EAA6E;IAC7E,mBAAmB,wBAAwB;CAC5C;AAED,MAAM,WAAW,uCAAuC;IACtD,QAAQ,CAAC,IAAI,EAAE,2CAA2C,CAAC;IAC3D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,4EAA4E;AAC5E,UAAU,wBAAwB;IAChC,QAAQ,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,GAAG,CAAC,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,wBAAwB,CAAC,CAAC;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,uCAAuC,KAAK,IAAI,CAAC;IACtF;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;CACpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IACzE,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAMD;;;;;;;GAOG;AACH,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,iCAAiC,GACvC,OAAO,CAAC,6BAA6B,CAAC,CAgExC"}
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Running the CODE half: loading and starting every live provider's vendor SDK.
3
+ *
4
+ * `FRONTEND_SDK` was a LABEL before this. Three engine providers declared the
5
+ * protocol (Sentry, PostHog, reCAPTCHA), the website resolved their refs and
6
+ * stamped them into `data-*` attributes on the page root, and no consumer
7
+ * anywhere loaded a vendor SDK. This is the consumer.
8
+ *
9
+ * ## Why one runner for three bundlers
10
+ *
11
+ * Vite, Astro and Docusaurus disagree about almost everything except one thing:
12
+ * a dynamic `import()` inside a module they have bundled becomes a lazily
13
+ * fetched chunk. So the framework owns *when* activation happens and the
14
+ * provider owns *what* it does — `activate()` performs both the import and the
15
+ * vendor's own initialization, because otherwise every surface would grow a
16
+ * switch over vendors.
17
+ *
18
+ * ## Browser only, and deliberately so
19
+ *
20
+ * Two of the three surfaces server-render (Astro and Docusaurus both execute
21
+ * page modules in Node at build time). A vendor SDK started there would run
22
+ * against a `window` that does not exist, or worse, would start a live
23
+ * analytics client inside a build process. The runner refuses off-browser and
24
+ * says so, rather than letting each surface remember to guard.
25
+ */
26
+ /** Why an SDK activation did not happen, or did not survive. */
27
+ export var FrontendProviderSdkActivationDiagnosticKind;
28
+ (function (FrontendProviderSdkActivationDiagnosticKind) {
29
+ /**
30
+ * Activation was attempted outside a browser. Nothing ran; this is the
31
+ * expected outcome during an Astro or Docusaurus server render, and the
32
+ * surface should activate again on the client.
33
+ */
34
+ FrontendProviderSdkActivationDiagnosticKind["SKIPPED_OFF_BROWSER"] = "SKIPPED_OFF_BROWSER";
35
+ /** The provider's `activate()` threw or rejected. Its SDK is not running. */
36
+ FrontendProviderSdkActivationDiagnosticKind["ACTIVATION_FAILED"] = "ACTIVATION_FAILED";
37
+ /** A provider's `deactivate()` threw. The surface has no way to retry it. */
38
+ FrontendProviderSdkActivationDiagnosticKind["DEACTIVATION_FAILED"] = "DEACTIVATION_FAILED";
39
+ })(FrontendProviderSdkActivationDiagnosticKind || (FrontendProviderSdkActivationDiagnosticKind = {}));
40
+ function defaultIsBrowser() {
41
+ return typeof globalThis !== 'undefined' && typeof globalThis.window !== 'undefined';
42
+ }
43
+ /**
44
+ * Activates every declared SDK among `modules`, in iteration order, and returns
45
+ * the live handles keyed by provider ref.
46
+ *
47
+ * One provider's failure never stops another's: an error-monitoring SDK that
48
+ * fails to load must not take the analytics SDK — or the page — with it. Each
49
+ * failure is reported and the run continues.
50
+ */
51
+ export async function activateFrontendProviderSdks(input) {
52
+ const raise = (diagnostic) => {
53
+ input.onDiagnostic?.(diagnostic);
54
+ };
55
+ const activations = new Map();
56
+ const isBrowser = input.isBrowser ?? defaultIsBrowser;
57
+ for (const module of input.modules) {
58
+ const sdk = module.sdk;
59
+ if (sdk === undefined)
60
+ continue;
61
+ const providerRef = module.metadata.ref;
62
+ if (!isBrowser()) {
63
+ raise({
64
+ kind: FrontendProviderSdkActivationDiagnosticKind.SKIPPED_OFF_BROWSER,
65
+ providerRef,
66
+ message: `Provider "${providerRef}" declares the SDK package "${sdk.descriptor.packageName}" but activation was `
67
+ + 'requested outside a browser, so nothing was loaded. Activate again on the client.',
68
+ });
69
+ continue;
70
+ }
71
+ try {
72
+ activations.set(providerRef, await sdk.activate({
73
+ providerRef,
74
+ surface: input.surface,
75
+ publicConfig: module.publicConfig ?? {},
76
+ }));
77
+ }
78
+ catch (cause) {
79
+ raise({
80
+ kind: FrontendProviderSdkActivationDiagnosticKind.ACTIVATION_FAILED,
81
+ providerRef,
82
+ message: `Provider "${providerRef}" failed to activate its SDK package "${sdk.descriptor.packageName}". Its `
83
+ + 'capability is unavailable on this surface; every other provider was still activated.',
84
+ cause,
85
+ });
86
+ }
87
+ }
88
+ return {
89
+ activations,
90
+ async deactivateAll() {
91
+ for (const [providerRef, activation] of activations) {
92
+ if (activation.deactivate === undefined)
93
+ continue;
94
+ try {
95
+ await activation.deactivate();
96
+ }
97
+ catch (cause) {
98
+ raise({
99
+ kind: FrontendProviderSdkActivationDiagnosticKind.DEACTIVATION_FAILED,
100
+ providerRef,
101
+ message: `Provider "${providerRef}" failed to deactivate its SDK; it may still be running.`,
102
+ cause,
103
+ });
104
+ }
105
+ }
106
+ activations.clear();
107
+ },
108
+ };
109
+ }
110
+ //# sourceMappingURL=activate-frontend-provider-sdks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activate-frontend-provider-sdks.js","sourceRoot":"","sources":["../../../../src/shared/activate-frontend-provider-sdks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAQH,gEAAgE;AAChE,MAAM,CAAN,IAAY,2CAWX;AAXD,WAAY,2CAA2C;IACrD;;;;OAIG;IACH,0FAA2C,CAAA;IAC3C,6EAA6E;IAC7E,sFAAuC,CAAA;IACvC,6EAA6E;IAC7E,0FAA2C,CAAA;AAC7C,CAAC,EAXW,2CAA2C,KAA3C,2CAA2C,QAWtD;AAyCD,SAAS,gBAAgB;IACvB,OAAO,OAAO,UAAU,KAAK,WAAW,IAAI,OAAQ,UAAmC,CAAC,MAAM,KAAK,WAAW,CAAC;AACjH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAwC;IAExC,MAAM,KAAK,GAAG,CAAC,UAAmD,EAAQ,EAAE;QAC1E,KAAK,CAAC,YAAY,EAAE,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC,CAAC;IACF,MAAM,WAAW,GAAG,IAAI,GAAG,EAAyC,CAAC;IACrE,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,gBAAgB,CAAC;IAEtD,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACvB,IAAI,GAAG,KAAK,SAAS;YAAE,SAAS;QAEhC,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC;QAExC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;YACjB,KAAK,CAAC;gBACJ,IAAI,EAAE,2CAA2C,CAAC,mBAAmB;gBACrE,WAAW;gBACX,OAAO,EACL,aAAa,WAAW,+BAA+B,GAAG,CAAC,UAAU,CAAC,WAAW,uBAAuB;sBACtG,mFAAmF;aACxF,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QAED,IAAI,CAAC;YACH,WAAW,CAAC,GAAG,CACb,WAAW,EACX,MAAM,GAAG,CAAC,QAAQ,CAAC;gBACjB,WAAW;gBACX,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,YAAY,EAAE,MAAM,CAAC,YAAY,IAAI,EAAE;aACxC,CAAC,CACH,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,KAAK,CAAC;gBACJ,IAAI,EAAE,2CAA2C,CAAC,iBAAiB;gBACnE,WAAW;gBACX,OAAO,EACL,aAAa,WAAW,yCAAyC,GAAG,CAAC,UAAU,CAAC,WAAW,SAAS;sBAClG,sFAAsF;gBAC1F,KAAK;aACN,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,OAAO;QACL,WAAW;QACX,KAAK,CAAC,aAAa;YACjB,KAAK,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,IAAI,WAAW,EAAE,CAAC;gBACpD,IAAI,UAAU,CAAC,UAAU,KAAK,SAAS;oBAAE,SAAS;gBAClD,IAAI,CAAC;oBACH,MAAM,UAAU,CAAC,UAAU,EAAE,CAAC;gBAChC,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,KAAK,CAAC;wBACJ,IAAI,EAAE,2CAA2C,CAAC,mBAAmB;wBACrE,WAAW;wBACX,OAAO,EAAE,aAAa,WAAW,0DAA0D;wBAC3F,KAAK;qBACN,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;YACD,WAAW,CAAC,KAAK,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Running the CODE half: loading and starting every live provider's vendor SDK.\n *\n * `FRONTEND_SDK` was a LABEL before this. Three engine providers declared the\n * protocol (Sentry, PostHog, reCAPTCHA), the website resolved their refs and\n * stamped them into `data-*` attributes on the page root, and no consumer\n * anywhere loaded a vendor SDK. This is the consumer.\n *\n * ## Why one runner for three bundlers\n *\n * Vite, Astro and Docusaurus disagree about almost everything except one thing:\n * a dynamic `import()` inside a module they have bundled becomes a lazily\n * fetched chunk. So the framework owns *when* activation happens and the\n * provider owns *what* it does — `activate()` performs both the import and the\n * vendor's own initialization, because otherwise every surface would grow a\n * switch over vendors.\n *\n * ## Browser only, and deliberately so\n *\n * Two of the three surfaces server-render (Astro and Docusaurus both execute\n * page modules in Node at build time). A vendor SDK started there would run\n * against a `window` that does not exist, or worse, would start a live\n * analytics client inside a build process. The runner refuses off-browser and\n * says so, rather than letting each surface remember to guard.\n */\n\nimport type { AppFrontendType } from '@wildo-ai/saas-models/public-runtime';\nimport type {\n ProviderFrontendSdk,\n ProviderFrontendSdkActivation,\n} from './frontend-provider-surface.types';\n\n/** Why an SDK activation did not happen, or did not survive. */\nexport enum FrontendProviderSdkActivationDiagnosticKind {\n /**\n * Activation was attempted outside a browser. Nothing ran; this is the\n * expected outcome during an Astro or Docusaurus server render, and the\n * surface should activate again on the client.\n */\n SKIPPED_OFF_BROWSER = 'SKIPPED_OFF_BROWSER',\n /** The provider's `activate()` threw or rejected. Its SDK is not running. */\n ACTIVATION_FAILED = 'ACTIVATION_FAILED',\n /** A provider's `deactivate()` threw. The surface has no way to retry it. */\n DEACTIVATION_FAILED = 'DEACTIVATION_FAILED',\n}\n\nexport interface FrontendProviderSdkActivationDiagnostic {\n readonly kind: FrontendProviderSdkActivationDiagnosticKind;\n readonly providerRef: string;\n readonly message: string;\n readonly cause?: unknown;\n}\n\n/** The DATA+CODE shape this runner needs off a hydrated provider module. */\ninterface SdkBearingProviderModule {\n metadata: { ref: string };\n publicConfig?: Readonly<Record<string, unknown>>;\n sdk?: ProviderFrontendSdk;\n}\n\nexport interface ActivateFrontendProviderSdksInput {\n readonly surface: AppFrontendType;\n /** The hydrated provider modules for this surface, in registry order. */\n readonly modules: Iterable<SdkBearingProviderModule>;\n readonly onDiagnostic?: (diagnostic: FrontendProviderSdkActivationDiagnostic) => void;\n /**\n * Escape hatch for tests and for a surface that legitimately renders in a\n * non-DOM host. Defaults to a real `window` check; nothing else in this\n * package inspects the global scope.\n */\n readonly isBrowser?: () => boolean;\n}\n\n/**\n * The live SDKs of one surface, and the single door that stops them.\n *\n * A started SDK that cannot be stopped cannot honour a consent withdrawal and\n * accumulates one live client per hot reload, which is why `deactivateAll`\n * exists here rather than being left to each caller to assemble.\n */\nexport interface ActivatedFrontendProviderSdks {\n readonly activations: ReadonlyMap<string, ProviderFrontendSdkActivation>;\n deactivateAll(): Promise<void>;\n}\n\nfunction defaultIsBrowser(): boolean {\n return typeof globalThis !== 'undefined' && typeof (globalThis as { window?: unknown }).window !== 'undefined';\n}\n\n/**\n * Activates every declared SDK among `modules`, in iteration order, and returns\n * the live handles keyed by provider ref.\n *\n * One provider's failure never stops another's: an error-monitoring SDK that\n * fails to load must not take the analytics SDK — or the page — with it. Each\n * failure is reported and the run continues.\n */\nexport async function activateFrontendProviderSdks(\n input: ActivateFrontendProviderSdksInput,\n): Promise<ActivatedFrontendProviderSdks> {\n const raise = (diagnostic: FrontendProviderSdkActivationDiagnostic): void => {\n input.onDiagnostic?.(diagnostic);\n };\n const activations = new Map<string, ProviderFrontendSdkActivation>();\n const isBrowser = input.isBrowser ?? defaultIsBrowser;\n\n for (const module of input.modules) {\n const sdk = module.sdk;\n if (sdk === undefined) continue;\n\n const providerRef = module.metadata.ref;\n\n if (!isBrowser()) {\n raise({\n kind: FrontendProviderSdkActivationDiagnosticKind.SKIPPED_OFF_BROWSER,\n providerRef,\n message:\n `Provider \"${providerRef}\" declares the SDK package \"${sdk.descriptor.packageName}\" but activation was `\n + 'requested outside a browser, so nothing was loaded. Activate again on the client.',\n });\n continue;\n }\n\n try {\n activations.set(\n providerRef,\n await sdk.activate({\n providerRef,\n surface: input.surface,\n publicConfig: module.publicConfig ?? {},\n }),\n );\n } catch (cause) {\n raise({\n kind: FrontendProviderSdkActivationDiagnosticKind.ACTIVATION_FAILED,\n providerRef,\n message:\n `Provider \"${providerRef}\" failed to activate its SDK package \"${sdk.descriptor.packageName}\". Its `\n + 'capability is unavailable on this surface; every other provider was still activated.',\n cause,\n });\n }\n }\n\n return {\n activations,\n async deactivateAll(): Promise<void> {\n for (const [providerRef, activation] of activations) {\n if (activation.deactivate === undefined) continue;\n try {\n await activation.deactivate();\n } catch (cause) {\n raise({\n kind: FrontendProviderSdkActivationDiagnosticKind.DEACTIVATION_FAILED,\n providerRef,\n message: `Provider \"${providerRef}\" failed to deactivate its SDK; it may still be running.`,\n cause,\n });\n }\n }\n activations.clear();\n },\n };\n}\n"]}
@@ -0,0 +1,365 @@
1
+ /**
2
+ * The EXECUTABLE half of a frontend provider's surface — the part that cannot
3
+ * cross a JSON channel, and therefore the part that defines the second channel.
4
+ *
5
+ * ## The two channels, and why there have to be two
6
+ *
7
+ * A frontend provider reaches a page through:
8
+ *
9
+ * - the **DATA** channel — `FrontendProviderEntry`, projected by the backend
10
+ * into `/application-config` and materialized into the generated
11
+ * frontend-services artifact. JSON end to end. It answers *which providers
12
+ * are live for this service, in this environment*;
13
+ * - the **CODE** channel — the provider package's own facet barrel, reaching
14
+ * the bundle through a generated `frontend-providers.generated.ts` that the
15
+ * app / website / techdoc build imports. It answers *what code exists in
16
+ * this bundle*.
17
+ *
18
+ * Before this split there was one channel and a cast: the registry took a JSON
19
+ * entry and asserted it was a module. That cast was true only for as long as the
20
+ * module type had nothing but strings on it — the moment a provider needed to
21
+ * load an SDK or register a component, the field would have been dropped by
22
+ * `JSON.stringify` with no error anywhere, and the provider would have looked
23
+ * declared and done nothing.
24
+ *
25
+ * So: everything in this file is CODE and never leaves the bundle, everything in
26
+ * `provider-frontend-surface.shared.schemas.ts` (in `@wildo-ai/saas-models`) is
27
+ * DATA and never carries a function, and `sdk` deliberately has a foot in both —
28
+ * a `descriptor` the CLI and the CSP composer can read, and an `activate()` only
29
+ * a browser can run.
30
+ *
31
+ * Added by slice S4a of epic #337 (issue #332).
32
+ */
33
+ import type { AppFrontendType, ProviderFrontendComponentDescriptor, ProviderFrontendSdkDescriptor } from '@wildo-ai/saas-models/public-runtime';
34
+ import { ProviderFrontendSelectionDelivery } from '@wildo-ai/saas-models/public-runtime';
35
+ /**
36
+ * What a surface tells a provider when it activates its SDK.
37
+ *
38
+ * Deliberately small, because it must mean the same thing under Vite, Astro and
39
+ * Docusaurus. Anything a single bundler can offer and the others cannot (a Vite
40
+ * `import.meta.env`, an Astro locals object, a Docusaurus plugin context) would
41
+ * make a provider that works on one surface and silently misbehaves on another,
42
+ * which is the failure this whole slice exists to remove.
43
+ */
44
+ export interface ProviderFrontendSdkActivationContext {
45
+ /** The provider's own `ref`, so a provider can label its vendor-side telemetry. */
46
+ readonly providerRef: string;
47
+ /** Which of the three frontend surfaces is activating it. */
48
+ readonly surface: AppFrontendType;
49
+ /**
50
+ * The provider's public configuration, as served on the DATA channel and
51
+ * already validated against the module's own `publicConfigSchema` when it
52
+ * declares one. A provider therefore never has to re-coerce it at the use
53
+ * site — which is what the app was doing, per-site, by hand.
54
+ */
55
+ readonly publicConfig: Readonly<Record<string, unknown>>;
56
+ }
57
+ /**
58
+ * The result of activating a provider's SDK.
59
+ *
60
+ * `deactivate` is the paired path, and it is optional only because some vendor
61
+ * SDKs genuinely offer no teardown. Where one exists it must be declared: an
62
+ * analytics or error-monitoring SDK that can be started and never stopped
63
+ * cannot honour a consent withdrawal, and a surface that hot-reloads would
64
+ * accumulate one live client per reload.
65
+ */
66
+ export interface ProviderFrontendSdkActivation {
67
+ /**
68
+ * The vendor handle the surface may hold — a `Sentry` namespace, a `posthog`
69
+ * instance, a picker factory. `unknown` on purpose: this package must not
70
+ * know any vendor's type, and a consumer that needs one narrows it at the
71
+ * point where it also knows which provider it asked for.
72
+ */
73
+ readonly handle: unknown;
74
+ readonly deactivate?: () => void | Promise<void>;
75
+ }
76
+ /**
77
+ * A provider's vendor SDK: which package it is (DATA), and how to load and start
78
+ * it (CODE).
79
+ *
80
+ * `activate` owns BOTH the dynamic import and the vendor's initialization call,
81
+ * as one function rather than two. The alternative — a `load()` returning the
82
+ * namespace and an `initialize(handle, config)` beside it — puts the vendor's
83
+ * own start-up contract in the surface's hands, and every surface would then
84
+ * carry a growing switch over vendors. One function keeps that knowledge where
85
+ * it belongs: inside the provider package.
86
+ *
87
+ * The import inside `activate` must be a DYNAMIC `import()`. That is what makes
88
+ * the SDK a separate chunk in all three bundlers, and it is what lets the
89
+ * bundle-isolation policy tell a declared optional dependency from a static one
90
+ * that would land in every page's initial payload.
91
+ */
92
+ export interface ProviderFrontendSdk {
93
+ /** The DATA half — mirrored onto the provider entry so the CLI can see it without executing anything. */
94
+ readonly descriptor: ProviderFrontendSdkDescriptor;
95
+ activate(context: ProviderFrontendSdkActivationContext): Promise<ProviderFrontendSdkActivation>;
96
+ }
97
+ /**
98
+ * A component a provider contributes, keyed by the CAPABILITY it fills.
99
+ *
100
+ * Loaded on demand, like an SDK and for the same reason: a picker nobody opens
101
+ * should cost nothing, and a bundle should not carry every provider's UI.
102
+ *
103
+ * ## Why the loaded value is `unknown` here
104
+ *
105
+ * This package ships into three browser bundles and its bare-specifier
106
+ * allow-list holds ONE entry. Typing the result as `React.ComponentType` would
107
+ * put `react` in the closure of a package whose whole discipline is that it has
108
+ * no renderer — and a provider module is DATA plus loaders; what a loader
109
+ * RETURNS is the consuming surface's business, not this package's.
110
+ *
111
+ * A provider author loses nothing: any `() => Promise<React.ComponentType<P>>`
112
+ * satisfies this type, so authors keep their own props type and the surface
113
+ * narrows once, where React actually lives.
114
+ *
115
+ * ## Why capability-keyed and not component-type-keyed
116
+ *
117
+ * The engine's own component slots are a CLOSED `FrontendComponentType` enum
118
+ * times a preset. Provider capabilities are an OPEN vocabulary an application
119
+ * extends by module augmentation. Forcing provider components through the
120
+ * closed enum would mean an engine edit for every new provider capability,
121
+ * which is precisely what the open vocabulary exists to avoid.
122
+ */
123
+ export type ProviderFrontendComponentLoader = () => Promise<unknown>;
124
+ /**
125
+ * One component a provider contributes: how to load it (CODE) and what it
126
+ * commits to (DATA).
127
+ *
128
+ * Both halves in one declaration, deliberately, and it mirrors `sdk`. A loader
129
+ * alone was the first shape — `components: { FRONTEND_FILE_PICKER: () => … }` —
130
+ * and it could not answer the question a surface asks FIRST: what will a
131
+ * selection from this component contain? That has to be readable without
132
+ * downloading the component, because the framework decides how to route the
133
+ * result before it decides to mount anything, and because a reviewer reading a
134
+ * provider's manifest should see the answer without running a browser.
135
+ *
136
+ * Everything except `load` is projected onto the provider's DATA entry by
137
+ * `projectFrontendProviderContribution`, exactly as `sdk.descriptor` is.
138
+ */
139
+ export interface ProviderFrontendComponentDeclaration extends ProviderFrontendComponentDescriptor {
140
+ /**
141
+ * Loads the component on demand. Must resolve the COMPONENT, not the module:
142
+ * `async () => (await import('./Picker')).Picker`, never
143
+ * `() => import('./Picker')`. The registry detects and reports the second
144
+ * shape, because a module namespace passed to React renders nothing and the
145
+ * stack trace points at React rather than at the provider.
146
+ */
147
+ readonly load: ProviderFrontendComponentLoader;
148
+ }
149
+ /**
150
+ * The components a provider offers, by capability token.
151
+ *
152
+ * A provider may claim a capability without shipping a component — declaring
153
+ * `FRONTEND_FILE_PICKER` and offering only constraints is a real and supported
154
+ * shape — so this map is not required to cover `providerCapabilities`.
155
+ */
156
+ export type ProviderFrontendComponents = Readonly<Record<string, ProviderFrontendComponentDeclaration>>;
157
+ /**
158
+ * What a provider's file picker hands back for ONE chosen file.
159
+ *
160
+ * The three arms are the three answers to issue #383 (Q5), and the union exists
161
+ * because the decision was **per vendor**: a picker for a credentialed vendor
162
+ * and a picker for a vendor with a browser-safe public token genuinely cannot
163
+ * return the same thing, and both must ship.
164
+ *
165
+ * `kind` is not a runtime choice. Each arm corresponds to exactly one
166
+ * `ProviderFrontendSelectionDelivery`, the provider DECLARES which one it emits,
167
+ * and the framework refuses a selection whose `kind` contradicts that
168
+ * declaration. Without the refusal the union would be the hedge the decision
169
+ * rejected — a contract that says "one of these three, we will find out at
170
+ * runtime" is not a contract an application's file field can be written
171
+ * against.
172
+ */
173
+ export type ProviderFileSelection = {
174
+ /** @see ProviderFrontendSelectionDelivery.REMOTE_REFERENCE */
175
+ readonly kind: ProviderFrontendSelectionDelivery.REMOTE_REFERENCE;
176
+ /** Opaque to everything in the browser. Only the application backend can resolve it. */
177
+ readonly externalId: string;
178
+ /** What to show the user before the backend has resolved anything. */
179
+ readonly displayName?: string;
180
+ readonly mimeType?: string;
181
+ readonly sizeBytes?: number;
182
+ } | {
183
+ /** @see ProviderFrontendSelectionDelivery.BROWSER_READABLE_FILE */
184
+ readonly kind: ProviderFrontendSelectionDelivery.BROWSER_READABLE_FILE;
185
+ readonly file: File;
186
+ } | {
187
+ /** @see ProviderFrontendSelectionDelivery.BROWSER_READABLE_URL */
188
+ readonly kind: ProviderFrontendSelectionDelivery.BROWSER_READABLE_URL;
189
+ /** Fetchable by the browser. Its origin must be admitted by the surface's composed CSP. */
190
+ readonly url: string;
191
+ readonly displayName?: string;
192
+ readonly mimeType?: string;
193
+ readonly sizeBytes?: number;
194
+ };
195
+ /**
196
+ * The constraints a framework file field imposes on a picker.
197
+ *
198
+ * Resolved by the framework — schema metadata first, then the provider's own
199
+ * `publicConfig` through the capability's named schema — so a picker never
200
+ * re-reads either. `maxSize` is BYTES; a provider stating megabytes in its
201
+ * public config (`maxFileSizeMb`) is converted before it reaches here.
202
+ *
203
+ * ## Why the field names are these and not clearer ones
204
+ *
205
+ * They are the framework file field's OWN names: `resolveFormFieldFileProviderConstraints`
206
+ * in `@wildo-ai/saas-frontend-lib` produces exactly this shape and its
207
+ * `ResolvedFormFieldFileProviderConstraints` is an alias of this type, so there
208
+ * is one source rather than two spellings of one contract.
209
+ *
210
+ * That is not tidiness. The first draft of this interface called the size cap
211
+ * `maxSizeBytes` while the resolver called it `maxSize` — both BYTES, both
212
+ * optional — and TypeScript accepts the assignment: the weak-type check is
213
+ * satisfied by the two names that DO match, so wiring the resolver into a picker
214
+ * would have compiled and silently dropped the size cap. A picker would then
215
+ * accept files the field rejects, and the user finds out after choosing one.
216
+ */
217
+ export interface ProviderFilePickerConstraints {
218
+ /**
219
+ * A MUTABLE array, deliberately: `@wildo-ai/zod-decorators`' MIME helpers
220
+ * (`isMimeTypeAllowed`, `buildAcceptAttribute`) take `string[]`, and this
221
+ * type's whole reason for existing is to BE the framework file field's own
222
+ * shape rather than a second one. A `readonly string[]` here would be a
223
+ * better type in isolation and would force a cast at every one of those call
224
+ * sites, which is how the drift this interface prevents starts again.
225
+ */
226
+ allowedMimeTypes?: string[];
227
+ /** BYTES, not megabytes. */
228
+ maxSize?: number;
229
+ maxFiles?: number;
230
+ }
231
+ /**
232
+ * The props every `FRONTEND_FILE_PICKER` component receives.
233
+ *
234
+ * Declared in this package, not in the frontend library, because BOTH sides need
235
+ * it and only one of them may depend on React: a provider package authors a
236
+ * component against this type, and the framework surface mounts it against the
237
+ * same type. Nothing here is a React type, so the package's one-entry
238
+ * bare-specifier allow-list is untouched.
239
+ *
240
+ * `onSelect` takes an ARRAY even for a single-file field. A picker that supports
241
+ * multi-select otherwise needs a second callback or a hidden convention, and a
242
+ * field that allows one file can reject a second selection with a message
243
+ * instead of silently keeping whichever arrived first — which is what a
244
+ * single-value callback forces it to do.
245
+ */
246
+ export interface ProviderFilePickerProps {
247
+ /** The provider's own `ref`, so a picker can label what it renders without being told twice. */
248
+ readonly providerRef: string;
249
+ /**
250
+ * The provider's public configuration, already validated against the module's
251
+ * `publicConfigSchema` when it declares one. A picker never re-coerces it.
252
+ */
253
+ readonly publicConfig: Readonly<Record<string, unknown>>;
254
+ readonly constraints: ProviderFilePickerConstraints;
255
+ /**
256
+ * An access token for THIS provider, on behalf of the current user, when the
257
+ * application has one.
258
+ *
259
+ * Optional, and its absence is a real state rather than a defect: a picker
260
+ * that authenticates through its own vendor popup (OneDrive's does) needs
261
+ * nothing here, and an application that has not connected a user's account to
262
+ * this provider has nothing to give. A picker that does need one must call
263
+ * this and report through `onError` when it is absent — never fall back to a
264
+ * token from `publicConfig`, which is served to every browser.
265
+ *
266
+ * Supplying it is the account-connection surface's job (issue #333), which
267
+ * does not exist yet; until it does, the framework passes nothing and a picker
268
+ * that requires a token says so. The prop is declared now so that the
269
+ * dependency is VISIBLE in the contract rather than discovered by whoever
270
+ * writes the second picker.
271
+ */
272
+ getAccessToken?(): Promise<string | undefined>;
273
+ /**
274
+ * Called with everything the user chose. May be called once with several
275
+ * files; must not be called after `onCancel`.
276
+ */
277
+ onSelect(selections: readonly ProviderFileSelection[]): void;
278
+ /** The user dismissed the picker without choosing. */
279
+ onCancel(): void;
280
+ /**
281
+ * The picker could not run — the vendor SDK failed to load, a grant was
282
+ * refused, the vendor returned an error. Reported rather than thrown: a throw
283
+ * inside a picker's own event handler does not reach a React error boundary,
284
+ * so it would be a surface that silently stops responding.
285
+ */
286
+ onError(error: Error): void;
287
+ }
288
+ /**
289
+ * Minimal structural view of a Standard Schema v1 validator.
290
+ *
291
+ * Declared here rather than imported, for two reasons that both matter:
292
+ *
293
+ * 1. `@wildo-ai/external-connectors-public` ships into three browser bundles
294
+ * and its bare-specifier allow-list holds exactly one entry. Importing
295
+ * `zod` to type one optional field would widen that allow-list for a
296
+ * TYPE — a runtime cost paid for a compile-time need.
297
+ * 2. Standard Schema is a cross-library contract (Zod 4, Valibot, ArkType all
298
+ * implement it), so typing the field this way lets a provider package
299
+ * validate with whatever it already depends on instead of forcing Zod on
300
+ * every provider author. Zod 4 schemas satisfy this interface as-is.
301
+ *
302
+ * Only the success/issue discrimination is modelled, because only that is used:
303
+ * the surface asks "is this public config valid, and if not, what is wrong".
304
+ */
305
+ export interface ProviderFrontendPublicConfigIssue {
306
+ readonly message: string;
307
+ /**
308
+ * Standard Schema permits a path segment to be either a key or a
309
+ * `{ key }` wrapper; both shapes are accepted so a validator from any
310
+ * implementing library reads correctly.
311
+ */
312
+ readonly path?: ReadonlyArray<PropertyKey | {
313
+ readonly key: PropertyKey;
314
+ }>;
315
+ }
316
+ export interface ProviderFrontendPublicConfigSuccess<TOutput> {
317
+ readonly value: TOutput;
318
+ readonly issues?: undefined;
319
+ }
320
+ export interface ProviderFrontendPublicConfigFailure {
321
+ readonly issues: ReadonlyArray<ProviderFrontendPublicConfigIssue>;
322
+ }
323
+ export type ProviderFrontendPublicConfigResult<TOutput> = ProviderFrontendPublicConfigSuccess<TOutput> | ProviderFrontendPublicConfigFailure;
324
+ export interface ProviderFrontendPublicConfigSchema<TOutput = unknown> {
325
+ readonly '~standard': {
326
+ readonly version: 1;
327
+ readonly vendor: string;
328
+ validate(value: unknown): ProviderFrontendPublicConfigResult<TOutput> | Promise<ProviderFrontendPublicConfigResult<TOutput>>;
329
+ };
330
+ }
331
+ /**
332
+ * Strips a provider's component declarations down to the half a JSON channel
333
+ * can carry.
334
+ *
335
+ * ONE named source, reachable from every facet barrel, because there are THREE
336
+ * sites that turn a frontend module into a wire entry and they must not hold
337
+ * three opinions: `projectFrontendProviderContribution` (the companion
338
+ * discovery walk, which feeds the generated artifact), the backend's fallback
339
+ * projection in `frontend-bootstrap.backend.service.ts` (what an application
340
+ * serves when no sync has run), and the hydration join, which takes the CODE
341
+ * side whole and needs no stripping at all.
342
+ *
343
+ * The failure a second opinion produces is the one that surface's own comments
344
+ * already name for the CSP footprint: a provider's declaration would appear on
345
+ * the entry when a sync had run and vanish when it had not — a difference no
346
+ * consumer can see and only production can punish.
347
+ *
348
+ * Returns `undefined` for a provider with no components rather than `{}`, so
349
+ * "contributes none" keeps one spelling, the way an absent `sdk` does.
350
+ *
351
+ * ## Why it lives in a browser-bound file
352
+ *
353
+ * Both callers are Node — the companion discovery walk and the backend's
354
+ * fallback projection — and this file's header says everything in it is CODE
355
+ * that never leaves the bundle. The placement is still right: the facet barrels
356
+ * are the only surface BOTH callers can reach (the backend imports
357
+ * `/app`, `/techdoc` and `/website`, never `/companion`), and putting it
358
+ * anywhere else would mean either a fourth subpath for one function or a second
359
+ * copy — which is the exact defect it exists to prevent. It is a pure function
360
+ * with no imports and no state, so a bundler that keeps it keeps a dozen lines.
361
+ */
362
+ export declare function projectFrontendComponentDescriptors(components: Readonly<Record<string, ProviderFrontendComponentDescriptor & {
363
+ readonly load?: unknown;
364
+ }>> | undefined): Record<string, ProviderFrontendComponentDescriptor> | undefined;
365
+ //# sourceMappingURL=frontend-provider-surface.types.d.ts.map