@tokenoftrust/storefront-runner 2.5.6 → 3.0.0

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 (79) hide show
  1. package/agency-kit/tools/lib/public-binaries.mjs +95 -0
  2. package/apps/storefront/astro.config.mjs +7 -0
  3. package/apps/storefront/env.d.ts +3 -0
  4. package/apps/storefront/src/components/catalog/storefront/ProductCard.astro +5 -4
  5. package/apps/storefront/src/components/catalog/storefront/commerce/PriceDisplay.astro +2 -1
  6. package/apps/storefront/src/components/catalog/storefront/islands/SearchTypeahead.tsx +17 -20
  7. package/apps/storefront/src/components/catalog/storefront/islands/VariantSelector.tsx +13 -21
  8. package/apps/storefront/src/components/catalog/storefront/plp/Pagination.astro +9 -5
  9. package/apps/storefront/src/components/checkout/storefront/commerce/CheckoutLoader.astro +18 -6
  10. package/apps/storefront/src/components/compliance/storefront/islands/CheckoutComplianceGate.tsx +19 -4
  11. package/apps/storefront/src/components/content/storefront/Badge.astro +1 -0
  12. package/apps/storefront/src/components/content/storefront/blog/BlogIndexView.astro +10 -1
  13. package/apps/storefront/src/components/publication/storefront/islands/CatalogQueryView.tsx +321 -0
  14. package/apps/storefront/src/config/declaredTenantConfig.ts +59 -27
  15. package/apps/storefront/src/config/devTenantSeed.ts +2 -1
  16. package/apps/storefront/src/layouts/Layout.astro +1 -1
  17. package/apps/storefront/src/lib/access/auth/gatePage.ts +29 -14
  18. package/apps/storefront/src/lib/access/shared/publicAccess.ts +95 -0
  19. package/apps/storefront/src/lib/access/shared/tenantRouting.ts +19 -0
  20. package/apps/storefront/src/lib/catalog/shared/catalogIndex.ts +109 -0
  21. package/apps/storefront/src/lib/catalog/shared/catalogQueryView.ts +60 -0
  22. package/apps/storefront/src/lib/catalog/shared/collectionPaging.ts +78 -0
  23. package/apps/storefront/src/lib/catalog/shared/stockStatus.ts +23 -0
  24. package/apps/storefront/src/lib/catalog/tot/query.ts +8 -0
  25. package/apps/storefront/src/lib/checkout/browser/checkoutRequirementsForm.ts +54 -0
  26. package/apps/storefront/src/lib/checkout/commerce/checkoutHandoffRoute.ts +103 -35
  27. package/apps/storefront/src/lib/checkout/commerce/checkoutRequirements.ts +88 -0
  28. package/apps/storefront/src/lib/checkout/commerce/finalCartAuthorization.ts +2 -0
  29. package/apps/storefront/src/lib/checkout/commerce/sharedStoreAdmission.ts +95 -0
  30. package/apps/storefront/src/lib/checkout/shared/lazyCheckoutLoader.ts +191 -0
  31. package/apps/storefront/src/lib/compliance/browser/checkoutVerificationFlow.ts +9 -0
  32. package/apps/storefront/src/lib/compliance/enforcement.ts +7 -5
  33. package/apps/storefront/src/lib/content/seo/structuredData.ts +12 -3
  34. package/apps/storefront/src/lib/content/storyblok/provider.ts +4 -2
  35. package/apps/storefront/src/lib/observability/shared/serverTiming.ts +110 -0
  36. package/apps/storefront/src/lib/publication/shared/edgeCache.ts +3 -4
  37. package/apps/storefront/src/lib/publication/shared/staticQuery.ts +64 -0
  38. package/apps/storefront/src/middleware/controlPlane.ts +14 -11
  39. package/apps/storefront/src/middleware/index.ts +33 -12
  40. package/apps/storefront/src/middleware/renderChain.ts +52 -26
  41. package/apps/storefront/src/pages/[...slug].astro +3 -0
  42. package/apps/storefront/src/pages/api/commerce/final-cart-authorization.ts +112 -42
  43. package/apps/storefront/src/pages/api/compliance/preflight.ts +61 -13
  44. package/apps/storefront/src/pages/blog/author/[author].astro +1 -1
  45. package/apps/storefront/src/pages/blog/category/[category].astro +1 -1
  46. package/apps/storefront/src/pages/blog/tag/[tag].astro +1 -1
  47. package/apps/storefront/src/pages/catalog-index.json.ts +20 -0
  48. package/apps/storefront/src/pages/collections/[handle]/page/[n].astro +28 -0
  49. package/apps/storefront/src/pages/collections/[handle].astro +13 -198
  50. package/apps/storefront/src/pages/collections/_CollectionView.astro +251 -0
  51. package/apps/storefront/src/pages/collections/index.astro +1 -1
  52. package/apps/storefront/src/pages/products/[handle].astro +10 -5
  53. package/apps/storefront/src/pages/search.astro +33 -33
  54. package/apps/storefront/src/pages/sitemap.xml.ts +7 -1
  55. package/apps/storefront/vitest.config.cts +3 -0
  56. package/package.json +1 -1
  57. package/packages/cli/src/declared-config.mjs +318 -32
  58. package/packages/cli/src/publication-spaces.mjs +1 -1
  59. package/packages/public-runtime/package.json +1 -0
  60. package/packages/public-runtime/schemas/publication-space/v1/manifest.schema.json +1 -1
  61. package/packages/public-runtime/schemas/publication-space/v1/normalized-mount.schema.json +1 -1
  62. package/packages/public-runtime/src/activity/catalog.ts +8 -1
  63. package/packages/public-runtime/src/candidate-index.ts +5 -0
  64. package/packages/public-runtime/src/capabilities.ts +12 -9
  65. package/packages/public-runtime/src/capture-rewrites.ts +687 -0
  66. package/packages/public-runtime/src/checkout-orders.ts +6 -7
  67. package/packages/public-runtime/src/checkout.ts +190 -6
  68. package/packages/public-runtime/src/compliance/evaluate.ts +7 -3
  69. package/packages/public-runtime/src/compliance/profile.ts +90 -14
  70. package/packages/public-runtime/src/compliance-coherence.d.mts +10 -1
  71. package/packages/public-runtime/src/compliance-coherence.mjs +129 -29
  72. package/packages/public-runtime/src/customization-runtime.ts +64 -2
  73. package/packages/public-runtime/src/declared-tenant-config.d.mts +13 -2
  74. package/packages/public-runtime/src/declared-tenant-config.mjs +83 -1
  75. package/packages/public-runtime/src/image-preview-rewrite-overlay.ts +13 -37
  76. package/packages/public-runtime/src/membership.ts +3 -0
  77. package/packages/public-runtime/src/publication-space.ts +1 -0
  78. package/packages/public-runtime/src/tenant.ts +28 -4
  79. package/scripts/tenant/validate.mjs +17 -8
@@ -23,6 +23,7 @@
23
23
  * ArtifactPath)` overrides the build-time `TenantConfig.capabilities` default.
24
24
  */
25
25
  import type { TenantConfig } from "./tenant.js";
26
+ import { resolveObligationIds } from "./compliance-obligations.js";
26
27
 
27
28
  export interface CapabilityState {
28
29
  enabled: boolean;
@@ -70,24 +71,26 @@ export function capabilitiesArtifactPath(tenantId: string): string {
70
71
  /**
71
72
  * Resolve the non-negotiable compliance floor for a tenant. This is intentionally
72
73
  * narrower than feature defaults: it says only what MUST remain on for the site
73
- * to be publishable.
74
+ * to be publishable. Each capability is required exactly when the obligation
75
+ * registry (`resolveObligationIds`) applies the duty it serves.
74
76
  */
75
77
  export function resolveComplianceObligations(
76
78
  tenant: Pick<TenantConfig, "compliance" | "siteType">,
77
79
  ): CapabilityObligations {
80
+ const owed = new Set(resolveObligationIds(tenant));
78
81
  return {
79
82
  cartCheckout: { required: false },
80
- ageVerification: tenant.compliance?.minAge
83
+ ageVerification: owed.has("age_gate")
81
84
  ? {
82
85
  required: true,
83
- reason: `Tenant requires age/identity verification for ${tenant.compliance.minAge}+ access.`,
86
+ reason: `Tenant requires age/identity verification for ${tenant.compliance?.minAge}+ access.`,
84
87
  }
85
88
  : { required: false },
86
- exciseTax: tenant.compliance?.nicotineWarning
89
+ exciseTax: owed.has("excise")
87
90
  ? {
88
91
  required: true,
89
92
  reason:
90
- "Tenant sells nicotine/vape products and must keep excise-tax collection enabled at checkout.",
93
+ "Tenant sells excise-taxed products (`compliance.nicotineWarning` or `compliance.exciseTax`) and must keep excise-tax collection enabled at checkout.",
91
94
  }
92
95
  : { required: false },
93
96
  };
@@ -130,18 +133,18 @@ export function resolveCapabilities(
130
133
  override?: Partial<CapabilityConfig> | null,
131
134
  ): CapabilityConfig {
132
135
  const c = tenant.capabilities;
136
+ const owed = new Set(resolveObligationIds(tenant));
133
137
  const base: CapabilityConfig = {
134
138
  // Commerce tenants get a cart by default; marketing tenants don't.
135
139
  cartCheckout: {
136
140
  enabled: c?.cartCheckout?.enabled ?? tenant.siteType !== "marketing",
137
141
  },
138
- // Regulated tenants (an age minimum) verify by default.
142
+ // A tenant that owes a duty has the capability serving it on by default.
139
143
  ageVerification: {
140
- enabled: c?.ageVerification?.enabled ?? !!tenant.compliance?.minAge,
144
+ enabled: c?.ageVerification?.enabled ?? owed.has("age_gate"),
141
145
  },
142
- // Nicotine/vape tenants collect excise by default.
143
146
  exciseTax: {
144
- enabled: c?.exciseTax?.enabled ?? !!tenant.compliance?.nicotineWarning,
147
+ enabled: c?.exciseTax?.enabled ?? owed.has("excise"),
145
148
  },
146
149
  };
147
150
  const requested = override