@tokenoftrust/storefront-runner 2.4.85 → 2.4.86

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 (46) hide show
  1. package/apps/storefront/package.json +1 -1
  2. package/apps/storefront/src/components/{apps → integrations/storefront/apps}/AppWidgetFrame.astro +1 -1
  3. package/apps/storefront/src/config/devTenantSeed.ts +1 -1
  4. package/apps/storefront/src/layouts/Layout.astro +3 -3
  5. package/apps/storefront/src/lib/apps/orders/orderForwardReceiver.ts +2 -2
  6. package/apps/storefront/src/lib/apps/orders/orderMapper.ts +1 -1
  7. package/apps/storefront/src/lib/{apps → integrations/apps}/appVersionStore.ts +1 -1
  8. package/apps/storefront/src/lib/{apps → integrations/apps}/credentials.ts +1 -1
  9. package/apps/storefront/src/lib/{apps → integrations/apps}/orders/idempotency.ts +1 -1
  10. package/apps/storefront/src/lib/{apps → integrations/apps}/registryAccess.ts +2 -2
  11. package/apps/storefront/src/lib/{apps → integrations/apps}/registryService.ts +1 -1
  12. package/apps/storefront/src/lib/{integration → integrations/integration}/browserEnvironment.ts +1 -1
  13. package/apps/storefront/src/lib/{integration → integrations/integration}/managedInstallDeclarations.ts +1 -1
  14. package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/deliveryEngine.ts +1 -1
  15. package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/deliveryStore.ts +1 -1
  16. package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/emit.ts +2 -2
  17. package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/getDispatcher.ts +2 -2
  18. package/apps/storefront/src/middleware/controlPlane.ts +1 -1
  19. package/apps/storefront/src/middleware/renderChain.ts +5 -5
  20. package/apps/storefront/src/pages/index.astro +3 -3
  21. package/apps/storefront/src/pages/products/[handle].astro +3 -3
  22. package/docs/widget-library-guide.md +1 -1
  23. package/package.json +1 -1
  24. package/packages/public-runtime/src/customization-scripts.ts +1 -1
  25. /package/apps/storefront/src/components/{WidgetFrame.astro → integrations/storefront/WidgetFrame.astro} +0 -0
  26. /package/apps/storefront/src/lib/{apps → integrations/apps}/gatewayKeys.ts +0 -0
  27. /package/apps/storefront/src/lib/{apps → integrations/apps}/gtmMigrationDraft.ts +0 -0
  28. /package/apps/storefront/src/lib/{apps → integrations/apps}/orders/customerHash.ts +0 -0
  29. /package/apps/storefront/src/lib/{apps → integrations/apps}/routeParams.ts +0 -0
  30. /package/apps/storefront/src/lib/{apps → integrations/apps}/scopes.ts +0 -0
  31. /package/apps/storefront/src/lib/{apps → integrations/apps}/widgets/eligibility.ts +0 -0
  32. /package/apps/storefront/src/lib/{apps → integrations/apps}/widgets/frameProps.ts +0 -0
  33. /package/apps/storefront/src/lib/{apps → integrations/apps}/widgets/launchToken.ts +0 -0
  34. /package/apps/storefront/src/lib/{apps → integrations/apps}/widgets/placements.ts +0 -0
  35. /package/apps/storefront/src/lib/{apps → integrations/apps}/widgets/renderSlot.ts +0 -0
  36. /package/apps/storefront/src/lib/{integration → integrations/integration}/bakedManagedInstalls.ts +0 -0
  37. /package/apps/storefront/src/lib/{integration → integrations/integration}/nonceStamp.ts +0 -0
  38. /package/apps/storefront/src/lib/{integration → integrations/integration}/renderIntegrationState.ts +0 -0
  39. /package/apps/storefront/src/lib/{integration → integrations/integration}/stageDestinationIds.ts +0 -0
  40. /package/apps/storefront/src/lib/{integration → integrations/integration}/tenantAnalyticsDeclarations.ts +0 -0
  41. /package/apps/storefront/src/lib/{integration → integrations/integration}/tenantDeclarations.ts +0 -0
  42. /package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/cloudflareQueueDispatcher.ts +0 -0
  43. /package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/deliveryMapper.ts +0 -0
  44. /package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/dispatcher.ts +0 -0
  45. /package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/endpointGuard.ts +0 -0
  46. /package/apps/storefront/src/lib/{webhooks → integrations/webhooks}/events.ts +0 -0
@@ -14,7 +14,7 @@
14
14
  "preview": "wrangler dev",
15
15
  "typecheck": "astro check && tsc --noEmit",
16
16
  "astro": "astro",
17
- "test": "NODE_OPTIONS=--experimental-sqlite vitest run --exclude src/lib/apps/v84CleanCloneReplay.test.ts --exclude src/lib/apps/v84NonportableRouteDogfood.test.ts --exclude src/lib/apps/v84CloneLifecycleEvidence.test.ts && NODE_OPTIONS=--experimental-sqlite vitest run src/lib/apps/v84CleanCloneReplay.test.ts src/lib/apps/v84NonportableRouteDogfood.test.ts src/lib/apps/v84CloneLifecycleEvidence.test.ts --fileParallelism=false && pnpm run test:pipeline && pnpm run test:pipeline-faults"
17
+ "test": "NODE_OPTIONS=--experimental-sqlite vitest run --exclude src/lib/integrations/apps/v84CleanCloneReplay.test.ts --exclude src/lib/integrations/apps/v84NonportableRouteDogfood.test.ts --exclude src/lib/integrations/apps/v84CloneLifecycleEvidence.test.ts && NODE_OPTIONS=--experimental-sqlite vitest run src/lib/integrations/apps/v84CleanCloneReplay.test.ts src/lib/integrations/apps/v84NonportableRouteDogfood.test.ts src/lib/integrations/apps/v84CloneLifecycleEvidence.test.ts --fileParallelism=false && pnpm run test:pipeline && pnpm run test:pipeline-faults"
18
18
  },
19
19
  "dependencies": {
20
20
  "@astrojs/cloudflare": "^14.0.1",
@@ -10,7 +10,7 @@
10
10
  * `<iframe>` for the parent-side `mountWidgetPostMessageBridge()`
11
11
  * (`@tot/public-runtime`) to scan for.
12
12
  */
13
- import { buildAppWidgetFrameAttrs, type AppWidgetFrameProps } from "@/lib/apps/widgets/frameProps.js";
13
+ import { buildAppWidgetFrameAttrs, type AppWidgetFrameProps } from "@/lib/integrations/apps/widgets/frameProps.js";
14
14
 
15
15
  type Props = AppWidgetFrameProps;
16
16
 
@@ -28,7 +28,7 @@
28
28
  import type { DeepPartial, TenantConfig, ThemeTokens } from "@tot/public-runtime";
29
29
  import { SHARED_DEMO_CHECKOUT } from "@tot/public-runtime";
30
30
  import { rootPublicationSpaceConfig } from "./publicationSpaceConfig";
31
- import { loadTenantAnalyticsDeclarations } from "@/lib/integration/tenantAnalyticsDeclarations";
31
+ import { loadTenantAnalyticsDeclarations } from "@/lib/integrations/integration/tenantAnalyticsDeclarations";
32
32
 
33
33
  /** Per-dir overrides the resolver derives from disk before synthesis. */
34
34
  export interface DevTenantHints {
@@ -38,9 +38,9 @@ import { bindManagedCartAnchors, managedCartHref } from "@/lib/chrome/managedCar
38
38
  import type { HeaderVariant, FooterVariant } from "@/lib/chrome/model";
39
39
  import { renderIntegrationPhases, INTERACTION_TRACKING_BOOT_JS } from "@tot/public-runtime";
40
40
  import { readViewerSession } from "@/lib/auth/route";
41
- import AppWidgetFrame from "@/components/apps/AppWidgetFrame.astro";
42
- import { getRegistryService } from "@/lib/apps/registryAccess.js";
43
- import { renderWidgetSlot } from "@/lib/apps/widgets/renderSlot.js";
41
+ import AppWidgetFrame from "@/components/integrations/storefront/apps/AppWidgetFrame.astro";
42
+ import { getRegistryService } from "@/lib/integrations/apps/registryAccess.js";
43
+ import { renderWidgetSlot } from "@/lib/integrations/apps/widgets/renderSlot.js";
44
44
 
45
45
  interface Props {
46
46
  title: string;
@@ -33,8 +33,8 @@
33
33
  * see `docs/private-apps/order-forward-contract.md` for the full rationale.
34
34
  */
35
35
  import { OrdersStore, ScrappyOrderLedger, type OrderLineItem, type OrderStatus, type Order } from "./ordersStore.js";
36
- import { emitWebhookEvent } from "../../webhooks/emit.js";
37
- import type { WebhookTopic } from "../../webhooks/deliveryStore.js";
36
+ import { emitWebhookEvent } from "../../integrations/webhooks/emit.js";
37
+ import type { WebhookTopic } from "../../integrations/webhooks/deliveryStore.js";
38
38
  import type { Queryable } from "../../d1/catalog.js";
39
39
  import {
40
40
  createLocalJWKSet,
@@ -8,7 +8,7 @@
8
8
  * internals — and never lets a raw customer identifier leave this module:
9
9
  * customer identity is always the per-(tenant, install) `customerHash`.
10
10
  */
11
- import { customerHash } from "./customerHash.js";
11
+ import { customerHash } from "../../integrations/apps/orders/customerHash.js";
12
12
  import type { FoxyOrder, FoxyOrderLineItem } from "./foxyOrderClient.js";
13
13
  import {
14
14
  COMPLIANCE_STATES,
@@ -37,7 +37,7 @@ import type {
37
37
  NormalizedContribution,
38
38
  } from "@tot/public-runtime";
39
39
  import { findForbiddenFields } from "@tot/public-runtime";
40
- import type { Queryable, QueryStatement } from "../d1/catalog.js";
40
+ import type { Queryable, QueryStatement } from "../../d1/catalog.js";
41
41
 
42
42
  /**
43
43
  * One managed-app version's COMPLETE restorable facet set — everything a rollback
@@ -19,7 +19,7 @@
19
19
  */
20
20
  import { sha256Hex } from "@tot/public-runtime";
21
21
  import type { CredentialPort, IssuedCredential } from "./registryService.js";
22
- import type { Queryable } from "../d1/catalog.js";
22
+ import type { Queryable } from "../../d1/catalog.js";
23
23
 
24
24
  /** `IssuedCredential` plus the one-time plaintext secret — never stored, never re-returned. */
25
25
  export type IssuedCredentialSecret = IssuedCredential & { secret: string };
@@ -14,7 +14,7 @@
14
14
  * idempotent write route can reuse this.
15
15
  */
16
16
  import { sha256Hex } from "@tot/public-runtime";
17
- import type { Queryable } from "../../d1/catalog.js";
17
+ import type { Queryable } from "../../../d1/catalog.js";
18
18
 
19
19
  export type IdempotencyCheck =
20
20
  | { status: "proceed" }
@@ -16,8 +16,8 @@
16
16
  import { AppRegistryService } from "./registryService.js";
17
17
  import { D1CredentialStore } from "./credentials.js";
18
18
  import { DEFAULT_APP_GATEWAY_KID, APP_GATEWAY_KID_ENV } from "./gatewayKeys.js";
19
- import { fromD1 } from "../d1/catalog.js";
20
- import { readD1, readEnv } from "../env.js";
19
+ import { fromD1 } from "../../d1/catalog.js";
20
+ import { readD1, readEnv } from "../../env.js";
21
21
 
22
22
  /**
23
23
  * No-store JSON response — install/rotate bodies carry a one-time client
@@ -70,7 +70,7 @@ import {
70
70
  type PlanIntegrationEntry,
71
71
  type PlanIntegrationConsent,
72
72
  } from "@tot/public-runtime";
73
- import type { Queryable } from "../d1/catalog.js";
73
+ import type { Queryable } from "../../d1/catalog.js";
74
74
 
75
75
  export type AppInstallStatus = "active" | "suspended" | "uninstalled";
76
76
 
@@ -23,7 +23,7 @@ import { isAdminPath } from "@/lib/auth/loginGate";
23
23
  import {
24
24
  resolveIntegrationRenderState,
25
25
  type IntegrationRenderState,
26
- } from "@/lib/integration/renderIntegrationState";
26
+ } from "@/lib/integrations/integration/renderIntegrationState";
27
27
 
28
28
  /**
29
29
  * The non-secret render revision: the commit SHA this build was cut from (baked at
@@ -11,7 +11,7 @@ import {
11
11
  type IntegrationDeclarationInput,
12
12
  } from "@tot/public-runtime";
13
13
  import { AppVersionStore } from "../apps/appVersionStore.js";
14
- import type { Queryable } from "../d1/catalog.js";
14
+ import type { Queryable } from "../../d1/catalog.js";
15
15
  import { migrateLegacyDestinationIds, parseStageDestinationIds } from "./stageDestinationIds.js";
16
16
 
17
17
  const MANAGED_KIND = "managed-analytics-v1";
@@ -28,7 +28,7 @@ import { buildCloudEventEnvelope } from "./events.js";
28
28
  import { computeBackoffDelaySeconds, MAX_DELIVERY_ATTEMPTS, type AttemptOutcome } from "./dispatcher.js";
29
29
  import { validateWebhookEndpoint } from "./endpointGuard.js";
30
30
  import { COMMERCE_SCHEDULER } from "@tot/public-runtime";
31
- import type { Queryable } from "../d1/catalog.js";
31
+ import type { Queryable } from "../../d1/catalog.js";
32
32
 
33
33
  /** Bounded per-attempt timeout — a hung receiver must not hold a dispatcher slot open indefinitely. */
34
34
  const DEFAULT_TIMEOUT_MS = 10_000;
@@ -39,7 +39,7 @@
39
39
  * the delivery via `getOrThrowDelivery` before returning it, the same
40
40
  * read-after-write discipline `AppRegistryService` uses.
41
41
  */
42
- import type { Queryable } from "../d1/catalog.js";
42
+ import type { Queryable } from "../../d1/catalog.js";
43
43
 
44
44
  /** Mirrors the `Delivery.topic` / CloudEvents channel enum in the D1/D2 contract. */
45
45
  export type WebhookTopic =
@@ -50,8 +50,8 @@ import { TOPIC_REQUIRED_SCOPE } from "./events.js";
50
50
  import { getDispatcher } from "./getDispatcher.js";
51
51
  import { getRegistryService } from "../apps/registryAccess.js";
52
52
  import type { AppInstall } from "../apps/registryService.js";
53
- import { fromD1 } from "../d1/catalog.js";
54
- import { readD1 } from "../env.js";
53
+ import { fromD1 } from "../../d1/catalog.js";
54
+ import { readD1 } from "../../env.js";
55
55
 
56
56
  /** Contract-scoped payload schema version — `asyncapi.yaml`'s `dataschemaversion` is `const: "1"` for V1. */
57
57
  const DATASCHEMA_VERSION = "1";
@@ -22,8 +22,8 @@ import { AppRegistryService } from "../apps/registryService.js";
22
22
  import { D1CredentialStore } from "../apps/credentials.js";
23
23
  import { DEFAULT_APP_GATEWAY_KID, APP_GATEWAY_KID_ENV } from "../apps/gatewayKeys.js";
24
24
  import { json } from "../apps/registryAccess.js";
25
- import { fromD1, type Queryable } from "../d1/catalog.js";
26
- import { readD1, readEnv, readQueue } from "../env.js";
25
+ import { fromD1, type Queryable } from "../../d1/catalog.js";
26
+ import { readD1, readEnv, readQueue } from "../../env.js";
27
27
  import { COMMERCE_SCHEDULER } from "@tot/public-runtime";
28
28
 
29
29
  /** Binding name `getDispatcher()` checks to pick the Cloudflare Queues adapter. Not yet declared in `wrangler.toml`. */
@@ -10,7 +10,7 @@ import type { APIContext, MiddlewareNext } from "astro";
10
10
  import { readEnv, readD1, readKv } from "@/lib/env";
11
11
  import { fromD1, type D1Like } from "@/lib/d1/catalog";
12
12
  import { readCurrentTenantConsentConfig } from "@/lib/apps/consentConfigRead";
13
- import { loadActiveManagedInstallDeclarations } from "@/lib/integration/managedInstallDeclarations";
13
+ import { loadActiveManagedInstallDeclarations } from "@/lib/integrations/integration/managedInstallDeclarations";
14
14
  import { buildTenantConsentBroker, verifyPreviewToken } from "@tot/public-runtime";
15
15
  import { tenantIsDeclaredPublic } from "@/config/tenants";
16
16
  import type {
@@ -64,7 +64,7 @@ import {
64
64
  verifyConsentSnapshotSig,
65
65
  resolveNativeGa4SandboxUrl,
66
66
  } from "@tot/public-runtime";
67
- import { readBakedManagedInstalls } from "@/lib/integration/bakedManagedInstalls";
67
+ import { readBakedManagedInstalls } from "@/lib/integrations/integration/bakedManagedInstalls";
68
68
  import { readWithImagePreviewRewriteOverlay } from "@tot/public-runtime/image-preview-rewrite-overlay";
69
69
  import type {
70
70
  CapabilityConfig,
@@ -84,24 +84,24 @@ import {
84
84
  HTML_CACHE_POLICY_CAPTURE_PROBE,
85
85
  } from "@tot/public-runtime";
86
86
  import { publicationContentRedirectLocationV1 } from "@tot/public-runtime/publication-content-redirects";
87
- import { loadTenantIntegrationDeclarations } from "@/lib/integration/tenantDeclarations";
87
+ import { loadTenantIntegrationDeclarations } from "@/lib/integrations/integration/tenantDeclarations";
88
88
  import { resolveTenantCommerce } from "@/lib/checkoutCommerce";
89
89
  import {
90
90
  requestBrowserEnvironment,
91
91
  previewBrowserEnvironment,
92
92
  deriveSiteSurface,
93
93
  cspHeaderName,
94
- } from "@/lib/integration/browserEnvironment";
94
+ } from "@/lib/integrations/integration/browserEnvironment";
95
95
  import {
96
96
  carriesLiveNonce,
97
97
  freshNonce,
98
98
  isErrorPageReroute,
99
99
  stampResponseNonce,
100
- } from "@/lib/integration/nonceStamp";
100
+ } from "@/lib/integrations/integration/nonceStamp";
101
101
  import {
102
102
  composeIntegrationDeclarations,
103
103
  resolveIntegrationRenderState,
104
- } from "@/lib/integration/renderIntegrationState";
104
+ } from "@/lib/integrations/integration/renderIntegrationState";
105
105
  import { recordActivity } from "@/lib/activity/recordActivity";
106
106
  import { middlewareRewriteTargetV1 } from "./routeBranch.js";
107
107
  import { declaredTenantOrigins } from "@/lib/tenantOrigins";
@@ -21,9 +21,9 @@ import TierCards from "@/components/membership/storefront/membership/TierCards.a
21
21
  import { withBase } from "@/lib/basePath";
22
22
  import { rawHtmlPolicy, rawHtmlResponse } from "@/lib/rawMarketingHtml";
23
23
  import { renderRawComplianceTop, renderRawComplianceBottom } from "@/lib/compliance/rawComplianceNotices";
24
- import AppWidgetFrame from "@/components/apps/AppWidgetFrame.astro";
25
- import { getRegistryService } from "@/lib/apps/registryAccess.js";
26
- import { renderWidgetSlot } from "@/lib/apps/widgets/renderSlot.js";
24
+ import AppWidgetFrame from "@/components/integrations/storefront/apps/AppWidgetFrame.astro";
25
+ import { getRegistryService } from "@/lib/integrations/apps/registryAccess.js";
26
+ import { renderWidgetSlot } from "@/lib/integrations/apps/widgets/renderSlot.js";
27
27
  import type { CatalogCollection, CatalogProduct } from "@tot/public-runtime";
28
28
  import {
29
29
  isMarketingBlock,
@@ -49,9 +49,9 @@ import { productPageType, structuredDataProfile } from "@/lib/seo/structuredData
49
49
  import { pageUrlForm } from "@/lib/seo/urlForm";
50
50
  import { sourceSeoTitle } from "@/lib/seo/documentTitle";
51
51
  import { shippingPolicyPath } from "@/lib/commerce/shippingPolicy";
52
- import AppWidgetFrame from "@/components/apps/AppWidgetFrame.astro";
53
- import { getRegistryService } from "@/lib/apps/registryAccess.js";
54
- import { renderWidgetSlot } from "@/lib/apps/widgets/renderSlot.js";
52
+ import AppWidgetFrame from "@/components/integrations/storefront/apps/AppWidgetFrame.astro";
53
+ import { getRegistryService } from "@/lib/integrations/apps/registryAccess.js";
54
+ import { renderWidgetSlot } from "@/lib/integrations/apps/widgets/renderSlot.js";
55
55
 
56
56
  const { handle } = Astro.params;
57
57
  const { tenant, tot, canonicalBase, basePath, apiBasePath, commerce } = Astro.locals;
@@ -1317,7 +1317,7 @@ Shared primitives composed by the higher-level widgets, plus the homepage hero.
1317
1317
  <Img src={image?.url} rehosted={image?.rehosted} seed={image?.id ?? handle} alt={title} width={800} height={1000} sizes="(min-width:1024px) 25vw, 100vw" priority />
1318
1318
  ```
1319
1319
 
1320
- ### WidgetFrame (`components/WidgetFrame.astro`)
1320
+ ### WidgetFrame (`components/integrations/storefront/WidgetFrame.astro`)
1321
1321
 
1322
1322
  - **Purpose:** Renders a tenant-registered widget (`isolation: "sandbox"`) in a sandboxed iframe —
1323
1323
  `allow-scripts` without `allow-same-origin` puts it in an opaque origin (can't read page
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "2.4.85",
3
+ "version": "2.4.86",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Tenant browser-script vocabulary the renderer needs: the slot / strategy /
3
3
  * isolation constants, the CSP hash helper, and the sandboxed widget iframe
4
- * attributes the renderer draws (`components/WidgetFrame.astro`).
4
+ * attributes the renderer draws (`components/integrations/storefront/WidgetFrame.astro`).
5
5
  *
6
6
  * Dependency-free + Workers-portable (Web Crypto, btoa).
7
7
  */