@tokenoftrust/storefront-runner 7.3.2 → 7.5.1

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 (420) hide show
  1. package/agency-kit/tools/lib/catalog-model/files.mjs +11 -4
  2. package/agency-kit/tools/lib/catalog-model/model.mjs +5 -1
  3. package/agency-kit/tools/lib/redirect-shadows.mjs +261 -0
  4. package/apps/storefront/astro.config.mjs +8 -2
  5. package/apps/storefront/package.json +1 -2
  6. package/apps/storefront/src/components/catalog/storefront/ProductCard.astro +20 -6
  7. package/apps/storefront/src/components/catalog/storefront/islands/ImageGallery.tsx +17 -6
  8. package/apps/storefront/src/components/compliance/storefront/islands/CheckoutComplianceGate.tsx +1 -32
  9. package/apps/storefront/src/config/compliance/rulesets.ts +1 -1
  10. package/apps/storefront/src/layouts/Layout.astro +17 -0
  11. package/apps/storefront/src/lib/access/auth/agentRoles.ts +20 -0
  12. package/apps/storefront/src/lib/access/auth/agentSessionGate.ts +32 -8
  13. package/apps/storefront/src/lib/access/auth/brokerAssertion.ts +16 -2
  14. package/apps/storefront/src/lib/access/auth/contactReaderAuthority.ts +39 -0
  15. package/apps/storefront/src/lib/access/auth/loginGate.ts +15 -17
  16. package/apps/storefront/src/lib/access/dashboard/staffAdmission.ts +5 -0
  17. package/apps/storefront/src/lib/access/dashboard/tenantSelection.ts +2 -0
  18. package/apps/storefront/src/lib/access/shared/capability.ts +14 -6
  19. package/apps/storefront/src/lib/access/shared/generated/capabilityCatalog.generated.ts +161 -0
  20. package/apps/storefront/src/lib/activity/activityScope.ts +36 -0
  21. package/apps/storefront/src/lib/activity/recordActivity.ts +23 -1
  22. package/apps/storefront/src/lib/activity/serverFanOut.ts +31 -0
  23. package/apps/storefront/src/lib/activity/store.ts +9 -3
  24. package/apps/storefront/src/lib/checkout/agent/checkoutProtocol.ts +196 -0
  25. package/apps/storefront/src/lib/checkout/agent/checkoutSession.ts +296 -0
  26. package/apps/storefront/src/lib/checkout/agent/webBotAuth.ts +347 -0
  27. package/apps/storefront/src/lib/checkout/commerce/cardCartForm.ts +2 -0
  28. package/apps/storefront/src/lib/checkout/commerce/cartSession.ts +109 -12
  29. package/apps/storefront/src/lib/checkout/commerce/checkoutHandoffRoute.ts +53 -25
  30. package/apps/storefront/src/lib/checkout/commerce/finalCartAuthorization.ts +48 -6
  31. package/apps/storefront/src/lib/checkout/proposal/cartProposal.ts +388 -0
  32. package/apps/storefront/src/lib/checkout/proposal/listMatcher.ts +149 -0
  33. package/apps/storefront/src/lib/checkout/proposal/proposalRoutes.ts +522 -0
  34. package/apps/storefront/src/lib/checkout/proposal/reviewHtml.ts +100 -0
  35. package/apps/storefront/src/lib/compliance/browser/checkoutVerificationFlow.ts +26 -2
  36. package/apps/storefront/src/lib/content/shared/redirects.ts +21 -4
  37. package/apps/storefront/src/lib/publication/shared/edgeCache.ts +5 -2
  38. package/apps/storefront/src/lib/publication/shared/previewAnnotations/renderDecorator.ts +15 -8
  39. package/apps/storefront/src/lib/publication/shared/runtimeEnv.ts +1 -1
  40. package/apps/storefront/src/middleware/controlPlane.ts +15 -1
  41. package/apps/storefront/src/middleware/index.ts +7 -3
  42. package/apps/storefront/src/middleware/renderChain.ts +46 -33
  43. package/apps/storefront/src/pages/api/cart-proposal/confirm.ts +12 -0
  44. package/apps/storefront/src/pages/api/cart-proposal/review.ts +26 -0
  45. package/apps/storefront/src/pages/api/commerce/checkout-sessions/[id].ts +9 -0
  46. package/apps/storefront/src/pages/api/commerce/checkout-sessions.ts +8 -0
  47. package/apps/storefront/src/pages/api/commerce/final-cart-authorization.ts +29 -6
  48. package/apps/storefront/src/pages/api/compliance/preflight.ts +25 -1
  49. package/apps/storefront/src/pages/products/[handle].astro +2 -15
  50. package/apps/storefront/tsconfig.astro.json +11 -0
  51. package/package.json +1 -1
  52. package/packages/public-runtime/src/activity/README.md +12 -0
  53. package/packages/public-runtime/src/activity/catalog.ts +7 -0
  54. package/packages/public-runtime/src/activity/event.ts +19 -0
  55. package/packages/public-runtime/src/activity/redaction.ts +31 -2
  56. package/packages/public-runtime/src/catalog-files.ts +3 -2
  57. package/packages/public-runtime/src/checkout-orders.ts +18 -19
  58. package/packages/public-runtime/src/checkout.ts +70 -0
  59. package/packages/public-runtime/src/compliance/evaluate.ts +60 -1
  60. package/packages/public-runtime/src/compliance/index.ts +1 -1
  61. package/packages/public-runtime/src/compliance/pact-report.ts +184 -3
  62. package/packages/public-runtime/src/compliance/profile.ts +268 -20
  63. package/packages/public-runtime/src/compliance/ruleset.ts +42 -0
  64. package/packages/public-runtime/src/customization-runtime.ts +1 -1
  65. package/packages/public-runtime/src/product.ts +9 -1
  66. package/packages/public-runtime/src/publication-content-redirects.ts +16 -3
  67. package/packages/public-runtime/tests/fixtures/compliance-decisions.golden.json +252 -52
  68. package/pnpm-lock.runner.yaml +0 -15
  69. package/scripts/tenant/materialize-tenant-content.mjs +3 -0
  70. package/scripts/tenant/validate.mjs +128 -0
  71. package/apps/storefront/dev-plugins/dev-publish.mjs +0 -55
  72. package/apps/storefront/drizzle.config.apps.ts +0 -13
  73. package/apps/storefront/integrations/preview-annotations-client-bundle.mjs +0 -80
  74. package/apps/storefront/migrations-apps/0000_fast_millenium_guard.sql +0 -129
  75. package/apps/storefront/migrations-apps/0001_woozy_lyja.sql +0 -22
  76. package/apps/storefront/migrations-apps/0002_good_switch.sql +0 -26
  77. package/apps/storefront/migrations-apps/0003_mute_marauders.sql +0 -12
  78. package/apps/storefront/migrations-apps/0004_deep_morph.sql +0 -36
  79. package/apps/storefront/migrations-apps/0005_common_mystique.sql +0 -23
  80. package/apps/storefront/migrations-apps/0006_broad_microchip.sql +0 -16
  81. package/apps/storefront/migrations-apps/0007_brave_outlaw_kid.sql +0 -15
  82. package/apps/storefront/migrations-apps/0008_blue_dazzler.sql +0 -11
  83. package/apps/storefront/migrations-apps/0009_bored_shinobi_shaw.sql +0 -15
  84. package/apps/storefront/migrations-apps/0010_ws4_verified_provider_measurement.sql +0 -35
  85. package/apps/storefront/migrations-apps/0011_dt_tracking_tenant_databases.sql +0 -23
  86. package/apps/storefront/migrations-apps/0012_test_destinations.sql +0 -29
  87. package/apps/storefront/migrations-apps/0013_publication_space_editorial.sql +0 -64
  88. package/apps/storefront/migrations-apps/0014_retire_candidate_ledger.sql +0 -12
  89. package/apps/storefront/migrations-apps/0015_merchant_calculation_settings.sql +0 -31
  90. package/apps/storefront/migrations-apps/0016_scrappy_commerce_contract.sql +0 -166
  91. package/apps/storefront/migrations-apps/0017_commerce_durable_projection.sql +0 -28
  92. package/apps/storefront/migrations-apps/0018_commerce_provider_cart_identity.sql +0 -13
  93. package/apps/storefront/migrations-apps/0019_commerce_source_authority.sql +0 -23
  94. package/apps/storefront/migrations-apps/0020_contact_messages.sql +0 -18
  95. package/apps/storefront/migrations-apps/0021_contact_vault.sql +0 -166
  96. package/apps/storefront/migrations-apps/0022_contact_vault_fields.sql +0 -342
  97. package/apps/storefront/migrations-apps/0023_principal_grant_contacts.sql +0 -15
  98. package/apps/storefront/migrations-apps/0024_order_contact_erasure_state.sql +0 -22
  99. package/apps/storefront/migrations-apps/0025_shipment_audit_order_lookup.sql +0 -2
  100. package/apps/storefront/migrations-apps/0026_fulfillment_assignment.sql +0 -44
  101. package/apps/storefront/migrations-apps/0027_app_contact_authority.sql +0 -70
  102. package/apps/storefront/migrations-apps/0028_app_jwk_and_candidates.sql +0 -133
  103. package/apps/storefront/migrations-apps/0029_inventory_locations_wms.sql +0 -38
  104. package/apps/storefront/migrations-apps/0030_assignment_split_shipments.sql +0 -149
  105. package/apps/storefront/migrations-apps/meta/0000_snapshot.json +0 -843
  106. package/apps/storefront/migrations-apps/meta/0001_snapshot.json +0 -990
  107. package/apps/storefront/migrations-apps/meta/0002_snapshot.json +0 -1160
  108. package/apps/storefront/migrations-apps/meta/0003_snapshot.json +0 -1235
  109. package/apps/storefront/migrations-apps/meta/0004_snapshot.json +0 -1474
  110. package/apps/storefront/migrations-apps/meta/0005_snapshot.json +0 -1617
  111. package/apps/storefront/migrations-apps/meta/0006_snapshot.json +0 -1716
  112. package/apps/storefront/migrations-apps/meta/0007_snapshot.json +0 -1812
  113. package/apps/storefront/migrations-apps/meta/0008_snapshot.json +0 -1881
  114. package/apps/storefront/migrations-apps/meta/0009_snapshot.json +0 -1979
  115. package/apps/storefront/migrations-apps/meta/_journal.json +0 -76
  116. package/apps/storefront/perf/README.md +0 -64
  117. package/apps/storefront/perf/assert-budgets.ts +0 -159
  118. package/apps/storefront/platform-reconcile-tenants.json +0 -3
  119. package/apps/storefront/playwright.config.ts +0 -23
  120. package/apps/storefront/public/js/dashboard-access-banner.js +0 -53
  121. package/apps/storefront/public/js/dashboard-apps.js +0 -183
  122. package/apps/storefront/public/js/dashboard-contact-capture.js +0 -52
  123. package/apps/storefront/public/js/dashboard-delegate.js +0 -167
  124. package/apps/storefront/public/js/dashboard-team.js +0 -356
  125. package/apps/storefront/public/js/dashboard-vendor-search.js +0 -115
  126. package/apps/storefront/src/components/content/storefront/AsyncStylesheet.astro +0 -26
  127. package/apps/storefront/src/components/integrations/storefront/WidgetFrame.astro +0 -34
  128. package/apps/storefront/src/config/adminTenantLookup.ts +0 -35
  129. package/apps/storefront/src/config/evidenceTenantRoster.ts +0 -25
  130. package/apps/storefront/src/config/staffProvisionProjection.ts +0 -24
  131. package/apps/storefront/src/config/storeName.ts +0 -34
  132. package/apps/storefront/src/lib/access/admin/README.md +0 -122
  133. package/apps/storefront/src/lib/access/admin/adminShell.ts +0 -281
  134. package/apps/storefront/src/lib/access/admin/envelope.ts +0 -9
  135. package/apps/storefront/src/lib/access/admin/viewmodels/settings.ts +0 -64
  136. package/apps/storefront/src/lib/access/auth/adminApiGuard.ts +0 -66
  137. package/apps/storefront/src/lib/access/auth/adminEntry.ts +0 -126
  138. package/apps/storefront/src/lib/access/auth/mcpClientAssertion.ts +0 -217
  139. package/apps/storefront/src/lib/access/auth/operatorSession.ts +0 -120
  140. package/apps/storefront/src/lib/access/dashboard/agentStoreEntry.ts +0 -253
  141. package/apps/storefront/src/lib/access/dashboard/delegateGate.ts +0 -130
  142. package/apps/storefront/src/lib/access/dashboard/staffStoreEntry.ts +0 -153
  143. package/apps/storefront/src/lib/access/dashboard/staffVendorAccess.ts +0 -474
  144. package/apps/storefront/src/lib/access/dashboard/vendorQuery.ts +0 -61
  145. package/apps/storefront/src/lib/access/fixtures/settings.ts +0 -67
  146. package/apps/storefront/src/lib/access/fixtures/tenants.ts +0 -29
  147. package/apps/storefront/src/lib/access/notifications/magicLinkInviteEmail.ts +0 -62
  148. package/apps/storefront/src/lib/access/shared/grantContactLookup.ts +0 -97
  149. package/apps/storefront/src/lib/access/shared/principalGrants.ts +0 -775
  150. package/apps/storefront/src/lib/activity/alerts.ts +0 -426
  151. package/apps/storefront/src/lib/activity/candidateSubmitLease.ts +0 -87
  152. package/apps/storefront/src/lib/activity/changeActorAttribution.ts +0 -181
  153. package/apps/storefront/src/lib/activity/evidence/evidenceReference.ts +0 -32
  154. package/apps/storefront/src/lib/activity/fixtures/evidence.ts +0 -99
  155. package/apps/storefront/src/lib/activity/query.ts +0 -403
  156. package/apps/storefront/src/lib/activity/uiActor.ts +0 -152
  157. package/apps/storefront/src/lib/admin/services/mock/index.ts +0 -12
  158. package/apps/storefront/src/lib/assets/addons/catalog.ts +0 -60
  159. package/apps/storefront/src/lib/assets/addons/storeEntitlements.ts +0 -260
  160. package/apps/storefront/src/lib/assets/durableAssetsRoute.ts +0 -65
  161. package/apps/storefront/src/lib/assets/durableR2.ts +0 -473
  162. package/apps/storefront/src/lib/assets/durableR2Bindings.ts +0 -33
  163. package/apps/storefront/src/lib/automation/admin/viewmodels/aiWorkflows.ts +0 -65
  164. package/apps/storefront/src/lib/automation/ai/approvalMode.ts +0 -20
  165. package/apps/storefront/src/lib/automation/ai/askEnvelope.ts +0 -47
  166. package/apps/storefront/src/lib/automation/ai/audit.ts +0 -12
  167. package/apps/storefront/src/lib/automation/ai/operationalRuns.ts +0 -155
  168. package/apps/storefront/src/lib/automation/ai/recommendation.ts +0 -20
  169. package/apps/storefront/src/lib/automation/fixtures/aiWorkflows.ts +0 -59
  170. package/apps/storefront/src/lib/catalog/admin/catalogSettingsClient.ts +0 -250
  171. package/apps/storefront/src/lib/catalog/admin/catalogSettingsFields.ts +0 -134
  172. package/apps/storefront/src/lib/catalog/admin/catalogSettingsPreview.ts +0 -37
  173. package/apps/storefront/src/lib/catalog/admin/catalogSettingsPricingView.ts +0 -39
  174. package/apps/storefront/src/lib/catalog/admin/catalogSettingsRuleView.ts +0 -44
  175. package/apps/storefront/src/lib/catalog/admin/catalogSettingsSkuView.ts +0 -21
  176. package/apps/storefront/src/lib/catalog/admin/catalogSettingsState.ts +0 -132
  177. package/apps/storefront/src/lib/catalog/admin/productSetupPhoto.ts +0 -23
  178. package/apps/storefront/src/lib/catalog/admin/productsTabClient.ts +0 -193
  179. package/apps/storefront/src/lib/catalog/admin/services/catalogProducts.ts +0 -32
  180. package/apps/storefront/src/lib/catalog/admin/viewmodels/catalogProducts.ts +0 -164
  181. package/apps/storefront/src/lib/catalog/admin/viewmodels/products.ts +0 -267
  182. package/apps/storefront/src/lib/catalog/fixtures/products.ts +0 -105
  183. package/apps/storefront/src/lib/catalog/tot/syncState.ts +0 -111
  184. package/apps/storefront/src/lib/checkout/admin/checkoutStyleInput.ts +0 -172
  185. package/apps/storefront/src/lib/checkout/admin/checkoutStyleTarget.ts +0 -65
  186. package/apps/storefront/src/lib/checkout/browser/checkoutExciseForm.ts +0 -152
  187. package/apps/storefront/src/lib/checkout/browser/checkoutRequirementsForm.ts +0 -72
  188. package/apps/storefront/src/lib/checkout/browser/checkoutStyleForm.ts +0 -110
  189. package/apps/storefront/src/lib/checkout/browser/settingDraftActions.ts +0 -367
  190. package/apps/storefront/src/lib/checkout/commerce/checkoutSettings.ts +0 -246
  191. package/apps/storefront/src/lib/checkout/fixtures/checkoutSettings.ts +0 -77
  192. package/apps/storefront/src/lib/content/blog/markdown.ts +0 -174
  193. package/apps/storefront/src/lib/content/chrome/examples/tokenoftrust.chrome-assignments.example.json +0 -6
  194. package/apps/storefront/src/lib/content/chrome/examples/tokenoftrust.chrome.example.json +0 -79
  195. package/apps/storefront/src/lib/content/index.ts +0 -27
  196. package/apps/storefront/src/lib/content/the-build/readingTime.ts +0 -35
  197. package/apps/storefront/src/lib/content/the-build/toc.ts +0 -95
  198. package/apps/storefront/src/lib/customers/admin/viewmodels/customers.ts +0 -56
  199. package/apps/storefront/src/lib/customers/contactVault/blindIndex.ts +0 -28
  200. package/apps/storefront/src/lib/customers/contactVault/contactAudit.ts +0 -149
  201. package/apps/storefront/src/lib/customers/contactVault/dataKeys.ts +0 -283
  202. package/apps/storefront/src/lib/customers/contactVault/fieldEnvelope.ts +0 -88
  203. package/apps/storefront/src/lib/customers/contactVault/isolateMetrics.ts +0 -37
  204. package/apps/storefront/src/lib/customers/contactVault/kms.ts +0 -292
  205. package/apps/storefront/src/lib/customers/contactVault/retention.ts +0 -302
  206. package/apps/storefront/src/lib/customers/contactVault/retentionPolicy.ts +0 -290
  207. package/apps/storefront/src/lib/customers/contactVault/zip3.ts +0 -24
  208. package/apps/storefront/src/lib/customers/fixtures/customers.ts +0 -86
  209. package/apps/storefront/src/lib/developer-experience/admin/memoizeByEnvelope.ts +0 -27
  210. package/apps/storefront/src/lib/developer-experience/admin/seed.ts +0 -54
  211. package/apps/storefront/src/lib/developer-experience/dev/activityIngestToken.ts +0 -85
  212. package/apps/storefront/src/lib/developer-experience/dev/activityStore.ts +0 -82
  213. package/apps/storefront/src/lib/developer-experience/dev/agentGrantAttestation.ts +0 -74
  214. package/apps/storefront/src/lib/developer-experience/dev/ai-widget-client.js +0 -308
  215. package/apps/storefront/src/lib/developer-experience/dev/apiBase.ts +0 -17
  216. package/apps/storefront/src/lib/developer-experience/dev/cliSignInCode.ts +0 -124
  217. package/apps/storefront/src/lib/developer-experience/dev/cockpit/ask.ts +0 -49
  218. package/apps/storefront/src/lib/developer-experience/dev/cockpit/clickToSource.ts +0 -71
  219. package/apps/storefront/src/lib/developer-experience/dev/cockpit/copyCommand.ts +0 -227
  220. package/apps/storefront/src/lib/developer-experience/dev/cockpit/files.ts +0 -249
  221. package/apps/storefront/src/lib/developer-experience/dev/cockpit/hostedActivity.ts +0 -500
  222. package/apps/storefront/src/lib/developer-experience/dev/cockpit/infoPopover.ts +0 -12
  223. package/apps/storefront/src/lib/developer-experience/dev/cockpit/mcpCopy.ts +0 -34
  224. package/apps/storefront/src/lib/developer-experience/dev/cockpit/monitor.ts +0 -107
  225. package/apps/storefront/src/lib/developer-experience/dev/cockpit/stepper.ts +0 -116
  226. package/apps/storefront/src/lib/developer-experience/dev/cockpit/themeToggle.ts +0 -23
  227. package/apps/storefront/src/lib/developer-experience/dev/livePreview.ts +0 -77
  228. package/apps/storefront/src/lib/developer-experience/dev/obstacleStore.ts +0 -214
  229. package/apps/storefront/src/lib/developer-experience/dev/previewStatus.ts +0 -87
  230. package/apps/storefront/src/lib/developer-experience/dev/rendezvousBroker.ts +0 -226
  231. package/apps/storefront/src/lib/developer-experience/dev/runtimeStore.ts +0 -291
  232. package/apps/storefront/src/lib/developer-experience/dev/storeStatus.ts +0 -142
  233. package/apps/storefront/src/lib/developer-experience/dev/subjectReissue.ts +0 -67
  234. package/apps/storefront/src/lib/developer-experience/fixtures/regulated-commerce-truth/index.ts +0 -540
  235. package/apps/storefront/src/lib/developer-experience/fixtures/ws3-readonly-clone-preflight/index.ts +0 -495
  236. package/apps/storefront/src/lib/engagement/contact/contactMessages.ts +0 -671
  237. package/apps/storefront/src/lib/engagement/contact/messagesTabClient.ts +0 -175
  238. package/apps/storefront/src/lib/engagement/contact/submission.ts +0 -112
  239. package/apps/storefront/src/lib/engagement/messaging/messagesClient.ts +0 -149
  240. package/apps/storefront/src/lib/engagement/newsletter/digest.ts +0 -117
  241. package/apps/storefront/src/lib/engagement/newsletter/resendClient.ts +0 -79
  242. package/apps/storefront/src/lib/engagement/newsletter/send.ts +0 -265
  243. package/apps/storefront/src/lib/engagement/social/golive.ts +0 -212
  244. package/apps/storefront/src/lib/engagement/social/notify.ts +0 -32
  245. package/apps/storefront/src/lib/engagement/social/tokenStore.ts +0 -171
  246. package/apps/storefront/src/lib/fulfillment/admin/commerceDesk.ts +0 -180
  247. package/apps/storefront/src/lib/fulfillment/admin/commerceDeskRouting.ts +0 -45
  248. package/apps/storefront/src/lib/fulfillment/admin/viewmodels/fulfillment.ts +0 -1071
  249. package/apps/storefront/src/lib/fulfillment/appShipmentEvidence.ts +0 -271
  250. package/apps/storefront/src/lib/fulfillment/carrierEvidence.ts +0 -105
  251. package/apps/storefront/src/lib/fulfillment/commerceProjection.ts +0 -157
  252. package/apps/storefront/src/lib/fulfillment/commerceReadback.ts +0 -60
  253. package/apps/storefront/src/lib/fulfillment/commerceRecovery.ts +0 -84
  254. package/apps/storefront/src/lib/fulfillment/commerceRuntime.ts +0 -41
  255. package/apps/storefront/src/lib/fulfillment/fulfillmentService.ts +0 -2842
  256. package/apps/storefront/src/lib/fulfillment/readiness.ts +0 -217
  257. package/apps/storefront/src/lib/fulfillment/splitShipments.ts +0 -388
  258. package/apps/storefront/src/lib/fulfillment/syntheticPreviewOrders.ts +0 -292
  259. package/apps/storefront/src/lib/integrations/apps/appContactAuthority.ts +0 -27
  260. package/apps/storefront/src/lib/integrations/apps/appContactConsents.ts +0 -118
  261. package/apps/storefront/src/lib/integrations/apps/appInstallEnv.ts +0 -28
  262. package/apps/storefront/src/lib/integrations/apps/gtmMigrationDraft.ts +0 -103
  263. package/apps/storefront/src/lib/integrations/apps/inventoryWrite.ts +0 -906
  264. package/apps/storefront/src/lib/integrations/apps/orders/customerHash.ts +0 -28
  265. package/apps/storefront/src/lib/integrations/apps/orders/idempotency.ts +0 -100
  266. package/apps/storefront/src/lib/integrations/apps/reports/salesVelocityReport.ts +0 -96
  267. package/apps/storefront/src/lib/integrations/apps/routeParams.ts +0 -45
  268. package/apps/storefront/src/lib/integrations/webhooks/cloudflareQueueDispatcher.ts +0 -82
  269. package/apps/storefront/src/lib/integrations/webhooks/commercePayloads.ts +0 -159
  270. package/apps/storefront/src/lib/integrations/webhooks/deliveryEngine.ts +0 -379
  271. package/apps/storefront/src/lib/integrations/webhooks/deliveryMapper.ts +0 -34
  272. package/apps/storefront/src/lib/integrations/webhooks/deliveryStore.ts +0 -903
  273. package/apps/storefront/src/lib/integrations/webhooks/dispatcher.ts +0 -168
  274. package/apps/storefront/src/lib/integrations/webhooks/emit.ts +0 -245
  275. package/apps/storefront/src/lib/integrations/webhooks/events.ts +0 -105
  276. package/apps/storefront/src/lib/integrations/webhooks/getDispatcher.ts +0 -77
  277. package/apps/storefront/src/lib/integrations/webhooks/orderFulfilledClaim.ts +0 -75
  278. package/apps/storefront/src/lib/measurement/admin/analyticsRegionPolicy.ts +0 -151
  279. package/apps/storefront/src/lib/measurement/admin/analyticsRegionsClient.ts +0 -84
  280. package/apps/storefront/src/lib/measurement/admin/consentSettingsClient.ts +0 -113
  281. package/apps/storefront/src/lib/measurement/analytics/index.ts +0 -44
  282. package/apps/storefront/src/lib/measurement/attribution/attributionService.ts +0 -206
  283. package/apps/storefront/src/lib/measurement/attribution/orderConversionD1.ts +0 -150
  284. package/apps/storefront/src/lib/measurement/attribution/verifiedProviderMeasurement.ts +0 -118
  285. package/apps/storefront/src/lib/measurement/tracking/interactionCollector.ts +0 -205
  286. package/apps/storefront/src/lib/measurement/tracking/pruneRollup.ts +0 -260
  287. package/apps/storefront/src/lib/measurement/tracking/tenantReadAccess.ts +0 -138
  288. package/apps/storefront/src/lib/measurement/tracking-writeback/rewriteTrackingIds.ts +0 -175
  289. package/apps/storefront/src/lib/measurement/tracking-writeback/writebackCandidate.ts +0 -110
  290. package/apps/storefront/src/lib/observability/diag/capture.ts +0 -162
  291. package/apps/storefront/src/lib/observability/diag/consoleLine.ts +0 -76
  292. package/apps/storefront/src/lib/observability/diag/debugConsole.ts +0 -118
  293. package/apps/storefront/src/lib/observability/diag/debugMode.ts +0 -163
  294. package/apps/storefront/src/lib/observability/diag/debugWindow.ts +0 -111
  295. package/apps/storefront/src/lib/observability/diag/redact.ts +0 -17
  296. package/apps/storefront/src/lib/observability/diag/reference.ts +0 -148
  297. package/apps/storefront/src/lib/observability/diag/referenceStore.ts +0 -113
  298. package/apps/storefront/src/lib/observability/diag/report.ts +0 -110
  299. package/apps/storefront/src/lib/observability/diag/serverResponseTime.ts +0 -91
  300. package/apps/storefront/src/lib/observability/diag/session.ts +0 -93
  301. package/apps/storefront/src/lib/observability/monitoring/manifest.ts +0 -301
  302. package/apps/storefront/src/lib/observability/performance/lighthouseReport.ts +0 -109
  303. package/apps/storefront/src/lib/observability/performance/rumAlert.ts +0 -179
  304. package/apps/storefront/src/lib/orders/admin/orderActions.ts +0 -556
  305. package/apps/storefront/src/lib/orders/admin/orderClient.ts +0 -248
  306. package/apps/storefront/src/lib/orders/admin/orderSource.ts +0 -410
  307. package/apps/storefront/src/lib/orders/admin/services/orders.ts +0 -922
  308. package/apps/storefront/src/lib/orders/admin/viewmodels/orders.ts +0 -135
  309. package/apps/storefront/src/lib/orders/data/commerceCallerConfig.ts +0 -37
  310. package/apps/storefront/src/lib/orders/data/ledgerContractOrders.ts +0 -148
  311. package/apps/storefront/src/lib/orders/data/orderForwardReceiver.ts +0 -532
  312. package/apps/storefront/src/lib/orders/data/orderMapper.ts +0 -454
  313. package/apps/storefront/src/lib/orders/data/ordersStore.ts +0 -623
  314. package/apps/storefront/src/lib/orders/data/sourceAuthorityContract.ts +0 -380
  315. package/apps/storefront/src/lib/orders/data/sourceAuthorityStore.ts +0 -830
  316. package/apps/storefront/src/lib/orders/fixtures/orders.ts +0 -186
  317. package/apps/storefront/src/lib/orders/providers/foxyOrderClient.ts +0 -207
  318. package/apps/storefront/src/lib/orders/vault/appRecipientRead.ts +0 -222
  319. package/apps/storefront/src/lib/orders/vault/contactIntake.ts +0 -63
  320. package/apps/storefront/src/lib/orders/vault/contactRoutes.ts +0 -110
  321. package/apps/storefront/src/lib/orders/vault/kmsEnv.ts +0 -11
  322. package/apps/storefront/src/lib/orders/vault/orderContact.ts +0 -96
  323. package/apps/storefront/src/lib/orders/vault/orderContactVault.ts +0 -1427
  324. package/apps/storefront/src/lib/orders/vault/vault-test-support.ts +0 -258
  325. package/apps/storefront/src/lib/publication/d1/schema-apps.ts +0 -808
  326. package/apps/storefront/src/lib/publication/notifications/candidateConflictEmail.ts +0 -80
  327. package/apps/storefront/src/lib/publication/servingMode.ts +0 -52
  328. package/apps/storefront/src/lib/publication/shared/previewAnnotations/moduleAsset.ts +0 -65
  329. package/apps/storefront/src/lib/publication/shared/routedApiParam.ts +0 -38
  330. package/apps/storefront/src/lib/reporting/admin/viewmodels/reporting.ts +0 -34
  331. package/apps/storefront/src/lib/reporting/fixtures/reporting.ts +0 -51
  332. package/apps/storefront/src/lib/subscriptions/admin/viewmodels/subscriptions.ts +0 -106
  333. package/apps/storefront/src/lib/subscriptions/fixtures/subscriptions.ts +0 -398
  334. package/apps/storefront/src/pages/api/admin/activity-alerts.ts +0 -58
  335. package/apps/storefront/src/pages/api/admin/commerce-readiness.ts +0 -172
  336. package/apps/storefront/src/pages/api/admin/fulfillment/batches.ts +0 -59
  337. package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id]/address.ts +0 -66
  338. package/apps/storefront/src/pages/api/admin/fulfillment/orders/[id].ts +0 -118
  339. package/apps/storefront/src/pages/api/admin/fulfillment/orders/contact-search.ts +0 -26
  340. package/apps/storefront/src/pages/api/admin/fulfillment/orders/contacts.ts +0 -22
  341. package/apps/storefront/src/pages/api/admin/interaction-insights.ts +0 -101
  342. package/apps/storefront/src/pages/api/admin/orders/[id].ts +0 -63
  343. package/apps/storefront/src/pages/api/admin/orders.ts +0 -65
  344. package/apps/storefront/src/pages/api/contact.ts +0 -144
  345. package/apps/storefront/src/scheduled/contactVaultSweep.ts +0 -113
  346. package/apps/storefront/src/styles/admin.css +0 -1161
  347. package/apps/storefront/test/pipeline/fake-preview-services.ts +0 -288
  348. package/apps/storefront/test/pipeline/harness.ts +0 -209
  349. package/apps/storefront/test/pipeline/intake-worker.mjs +0 -14
  350. package/apps/storefront/test/pipeline/matrix-faults.ts +0 -366
  351. package/apps/storefront/test/pipeline/pipeline-host.ts +0 -418
  352. package/apps/storefront/test/pipeline/pool-config.cjs +0 -85
  353. package/apps/storefront/test/pipeline/publish-kinds.ts +0 -279
  354. package/apps/storefront/test/pipeline/synthetic-job.ts +0 -303
  355. package/apps/storefront/test/pipeline-faults/matrix-lib.ts +0 -696
  356. package/apps/storefront/vitest.config.cts +0 -44
  357. package/apps/storefront/vitest.faults.config.cts +0 -13
  358. package/apps/storefront/vitest.workers.config.cts +0 -7
  359. package/packages/feedback/fixtures/v1/expected-findings.json +0 -16
  360. package/packages/feedback/fixtures/v1/feedback-action/invalid/carries-transport-credential.json +0 -14
  361. package/packages/feedback/fixtures/v1/feedback-action/invalid/control-char-in-description.json +0 -13
  362. package/packages/feedback/fixtures/v1/feedback-action/invalid/legacy-schema-version.json +0 -13
  363. package/packages/feedback/fixtures/v1/feedback-action/invalid/page-path-with-query.json +0 -14
  364. package/packages/feedback/fixtures/v1/feedback-action/invalid/title-too-short.json +0 -13
  365. package/packages/feedback/fixtures/v1/feedback-action/valid/element-problem.json +0 -33
  366. package/packages/feedback/fixtures/v1/feedback-action/valid/page-comment.json +0 -20
  367. package/packages/feedback/fixtures/v1/feedback-action/valid/region-improvement.json +0 -24
  368. package/packages/feedback/fixtures/v1/feedback-action/valid/text-selection-feature.json +0 -30
  369. package/packages/feedback/fixtures/v1/submission-receipt/invalid/accepted-at-not-utc.json +0 -9
  370. package/packages/feedback/fixtures/v1/submission-receipt/invalid/bad-feedback-id.json +0 -9
  371. package/packages/feedback/fixtures/v1/submission-receipt/invalid/legacy-contract-version.json +0 -9
  372. package/packages/feedback/fixtures/v1/submission-receipt/invalid/missing-replayed.json +0 -8
  373. package/packages/feedback/fixtures/v1/submission-receipt/valid/accepted.json +0 -9
  374. package/packages/feedback/fixtures/v1/submission-receipt/valid/fractional-seconds.json +0 -9
  375. package/packages/feedback/fixtures/v1/submission-receipt/valid/replayed.json +0 -9
  376. package/packages/feedback/fixtures/v1/target-evidence/invalid/page-kind-claims-structure.json +0 -6
  377. package/packages/feedback/fixtures/v1/target-evidence/invalid/path-too-deep.json +0 -17
  378. package/packages/feedback/fixtures/v1/target-evidence/invalid/relative-region-out-of-range.json +0 -11
  379. package/packages/feedback/fixtures/v1/target-evidence/invalid/selector-uses-class.json +0 -7
  380. package/packages/feedback/fixtures/v1/target-evidence/invalid/source-precision-without-anchor.json +0 -6
  381. package/packages/feedback/fixtures/v1/target-evidence/valid/element-structure.json +0 -21
  382. package/packages/feedback/fixtures/v1/target-evidence/valid/host-iframe.json +0 -14
  383. package/packages/feedback/fixtures/v1/target-evidence/valid/source-anchor.json +0 -12
  384. package/packages/feedback/fixtures/v1/target-evidence/valid/text-selection.json +0 -26
  385. package/packages/feedback/package.json +0 -35
  386. package/packages/feedback/scripts/build-player.mjs +0 -28
  387. package/packages/feedback/src/index.ts +0 -1
  388. package/packages/feedback/src/primitives/composer.ts +0 -639
  389. package/packages/feedback/src/primitives/dialog.ts +0 -263
  390. package/packages/feedback/src/primitives/hostAdapter.ts +0 -116
  391. package/packages/feedback/src/primitives/index.ts +0 -10
  392. package/packages/feedback/src/primitives/launcher.ts +0 -200
  393. package/packages/feedback/src/primitives/picker.ts +0 -663
  394. package/packages/feedback/src/primitives/redaction.ts +0 -204
  395. package/packages/feedback/src/primitives/selection.ts +0 -49
  396. package/packages/feedback/src/primitives/shiftAccelerator.ts +0 -160
  397. package/packages/feedback/src/primitives/styles.ts +0 -77
  398. package/packages/feedback/src/primitives/surface.ts +0 -124
  399. package/packages/feedback/src/primitives/target.ts +0 -293
  400. package/packages/feedback/src/tour/canonical.ts +0 -27
  401. package/packages/feedback/src/tour/index.ts +0 -3
  402. package/packages/feedback/src/tour/player/browser.ts +0 -5
  403. package/packages/feedback/src/tour/player/host.ts +0 -12
  404. package/packages/feedback/src/tour/player/index.ts +0 -205
  405. package/packages/feedback/src/tour/player/manifest.ts +0 -76
  406. package/packages/feedback/src/tour/player/player.css +0 -130
  407. package/packages/feedback/src/tour/player/resolver.ts +0 -12
  408. package/packages/feedback/src/tour/player/surface.ts +0 -295
  409. package/packages/feedback/src/tour/player/types.ts +0 -8
  410. package/packages/feedback/src/tour/resolve/core.ts +0 -267
  411. package/packages/feedback/src/tour/resolve/dom.ts +0 -115
  412. package/packages/feedback/src/tour/resolve/index.ts +0 -29
  413. package/packages/feedback/src/tour/sanitize.ts +0 -76
  414. package/packages/feedback/src/tour/schema.ts +0 -362
  415. package/packages/feedback/src/v1/guards.ts +0 -335
  416. package/packages/feedback/src/v1/index.ts +0 -3
  417. package/packages/feedback/src/v1/protectedSurfaces.ts +0 -32
  418. package/packages/feedback/src/v1/types.ts +0 -177
  419. package/packages/feedback/tsconfig.json +0 -9
  420. package/packages/feedback/vitest.config.cts +0 -21
@@ -1,174 +0,0 @@
1
- /**
2
- * Minimal, dependency-free Markdown -> sanitized HTML for the admin blog editor
3
- * (see docs/plans/2026-08-21-blog-platform-workstream.md). The storefront
4
- * ships no markdown library (see the "No new deps" convention in §1), and the
5
- * migration package's `sanitize-html` is a node-only devtool — so authoring from
6
- * the admin gets this small hand-rolled renderer instead.
7
- *
8
- * SAFETY: the output is fed to `set:html` in the reader route
9
- * (`the-build/[slug].astro`), so it must never emit author-supplied HTML
10
- * verbatim. All text is HTML-escaped BEFORE any tag is emitted, only the tag set
11
- * this renderer produces can appear, and link hrefs / image `src`s are
12
- * scheme-checked (`http(s)`/`mailto`/site-relative/anchor only — `javascript:`
13
- * etc. fall back to plain text). Admin is already gated, but escaping is
14
- * defense-in-depth.
15
- *
16
- * SCOPE (v1): headings, bold, italic, inline code, fenced code, links, images,
17
- * blockquotes, unordered/ordered lists, horizontal rules, paragraphs. NOT a
18
- * CommonMark implementation — no nested lists or tables.
19
- */
20
-
21
- // A control char that never appears in authored prose and is untouched by
22
- // escapeHtml — a collision-free placeholder while code spans are set aside.
23
- const CODE_MARK = String.fromCharCode(0);
24
- const CODE_RE = new RegExp(`${CODE_MARK}(\\d+)${CODE_MARK}`, "g");
25
-
26
- function escapeHtml(s: string): string {
27
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
28
- }
29
-
30
- // Closes the one gap `escapeHtml` leaves open for attribute interpolation.
31
- // The url substring reaching this point has ALREADY passed through the single
32
- // escapeHtml(t) pass over the whole inline text (renderInline escapes before
33
- // running the link regex), so `&`/`<`/`>` are already entity-encoded — only
34
- // `"`/`'` remain untouched. Re-running full escapeHtml here would double-encode
35
- // those already-escaped entities, so this only needs to close the quote gap.
36
- function escapeAttrQuotes(s: string): string {
37
- return s.replace(/"/g, "&quot;").replace(/'/g, "&#39;");
38
- }
39
-
40
- // Only permit hrefs that can't execute script. Text is already escaped by the
41
- // time a URL reaches here, so a `javascript:`/`data:` payload arrives intact and
42
- // is rejected -> the link renders as its (escaped) label text instead. Quote/
43
- // angle-bracket characters are rejected outright (second line of defense on
44
- // top of escapeAttrQuotes at the call site) so an attribute-breakout payload
45
- // never matches the scheme allowlist in the first place.
46
- function sanitizeUrl(url: string): string | null {
47
- const u = url.trim();
48
- if (/["'<>]/.test(u)) return null;
49
- // `//host/path` is protocol-relative — a browser resolves it to an absolute
50
- // cross-origin URL using the current scheme, so it must NOT be accepted
51
- // under the "site-relative" `/` allowance (only a single, non-doubled slash
52
- // is genuinely site-relative).
53
- if (/^\/\//.test(u)) return null;
54
- return /^(https?:\/\/|mailto:|\/|#)/i.test(u) ? u : null;
55
- }
56
-
57
- // Inline spans, applied to already-block-split text. Code spans are extracted
58
- // first (and their contents escaped) so emphasis/link syntax inside `code` is
59
- // left literal; everything else is escaped, then link/bold/italic tags are woven
60
- // back in, then the code spans are restored.
61
- function renderInline(text: string): string {
62
- const codes: string[] = [];
63
- let t = text.replace(/`([^`]+)`/g, (_m, code: string) => {
64
- codes.push(`<code>${escapeHtml(code)}</code>`);
65
- return `${CODE_MARK}${codes.length - 1}${CODE_MARK}`;
66
- });
67
- t = escapeHtml(t);
68
- // Images before links: `![alt](url)` embeds a link-like `[alt](url)` span, so
69
- // the link regex would otherwise claim it. Each emitted `<img>` is stashed in
70
- // `codes` (same placeholder machinery as code spans) so the later link and
71
- // emphasis passes can't reach into its `src`/`alt` attribute values — an
72
- // `alt` of `a*b*c` must stay literal inside the attribute, not sprout an
73
- // `<em>`. `src` is scheme-checked (data:/protocol-relative rejected) and both
74
- // attribute values are quote-encoded on top of the whole-text escapeHtml pass.
75
- t = t.replace(/!\[([^\]]*)\]\(([^)\s]+)\)/g, (_m, alt: string, url: string) => {
76
- const safe = sanitizeUrl(url);
77
- if (!safe) return alt;
78
- const img = `<img src="${escapeAttrQuotes(safe)}" alt="${escapeAttrQuotes(alt)}" loading="lazy" decoding="async">`;
79
- codes.push(img);
80
- return `${CODE_MARK}${codes.length - 1}${CODE_MARK}`;
81
- });
82
- t = t.replace(/\[([^\]]+)\]\(([^)\s]+)\)/g, (_m, label: string, url: string) => {
83
- const safe = sanitizeUrl(url);
84
- return safe ? `<a href="${escapeAttrQuotes(safe)}">${label}</a>` : label;
85
- });
86
- t = t
87
- .replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>")
88
- .replace(/__([^_]+)__/g, "<strong>$1</strong>");
89
- t = t
90
- .replace(/\*([^*]+)\*/g, "<em>$1</em>")
91
- .replace(/(^|[^a-zA-Z0-9])_([^_]+)_(?=[^a-zA-Z0-9]|$)/g, "$1<em>$2</em>");
92
- return t.replace(CODE_RE, (_m, i: string) => codes[Number(i)]!);
93
- }
94
-
95
- const isBlank = (l: string): boolean => l.trim() === "";
96
- const startsBlock = (l: string): boolean =>
97
- /^```/.test(l) ||
98
- /^#{1,6}\s+/.test(l) ||
99
- /^>\s?/.test(l) ||
100
- /^\s*[-*+]\s+/.test(l) ||
101
- /^\s*\d+\.\s+/.test(l) ||
102
- /^\s*(-{3,}|\*{3,}|_{3,})\s*$/.test(l);
103
-
104
- export function renderMarkdown(md: string): string {
105
- const lines = md.replace(/\r\n?/g, "\n").split("\n");
106
- const out: string[] = [];
107
- let i = 0;
108
-
109
- while (i < lines.length) {
110
- const line = lines[i]!;
111
-
112
- if (isBlank(line)) {
113
- i++;
114
- continue;
115
- }
116
-
117
- const fence = line.match(/^```\s*([a-zA-Z0-9_-]*)\s*$/);
118
- if (fence) {
119
- const buf: string[] = [];
120
- i++;
121
- while (i < lines.length && !/^```\s*$/.test(lines[i]!)) buf.push(lines[i++]!);
122
- i++; // consume closing fence (tolerate an unterminated block at EOF)
123
- const cls = fence[1] ? ` class="language-${fence[1]}"` : "";
124
- out.push(`<pre><code${cls}>${escapeHtml(buf.join("\n"))}</code></pre>`);
125
- continue;
126
- }
127
-
128
- const heading = line.match(/^(#{1,6})\s+(.*)$/);
129
- if (heading) {
130
- const level = heading[1]!.length;
131
- out.push(`<h${level}>${renderInline(heading[2]!.trim())}</h${level}>`);
132
- i++;
133
- continue;
134
- }
135
-
136
- if (/^\s*(-{3,}|\*{3,}|_{3,})\s*$/.test(line)) {
137
- out.push("<hr>");
138
- i++;
139
- continue;
140
- }
141
-
142
- if (/^>\s?/.test(line)) {
143
- const buf: string[] = [];
144
- while (i < lines.length && /^>\s?/.test(lines[i]!)) buf.push(lines[i++]!.replace(/^>\s?/, ""));
145
- out.push(`<blockquote>${renderMarkdown(buf.join("\n"))}</blockquote>`);
146
- continue;
147
- }
148
-
149
- if (/^\s*[-*+]\s+/.test(line)) {
150
- const items: string[] = [];
151
- while (i < lines.length && /^\s*[-*+]\s+/.test(lines[i]!)) {
152
- items.push(lines[i++]!.replace(/^\s*[-*+]\s+/, "").trim());
153
- }
154
- out.push(`<ul>${items.map((it) => `<li>${renderInline(it)}</li>`).join("")}</ul>`);
155
- continue;
156
- }
157
-
158
- if (/^\s*\d+\.\s+/.test(line)) {
159
- const items: string[] = [];
160
- while (i < lines.length && /^\s*\d+\.\s+/.test(lines[i]!)) {
161
- items.push(lines[i++]!.replace(/^\s*\d+\.\s+/, "").trim());
162
- }
163
- out.push(`<ol>${items.map((it) => `<li>${renderInline(it)}</li>`).join("")}</ol>`);
164
- continue;
165
- }
166
-
167
- const buf: string[] = [];
168
- while (i < lines.length && !isBlank(lines[i]!) && !startsBlock(lines[i]!)) buf.push(lines[i++]!);
169
- const text = buf.join(" ").trim();
170
- if (text) out.push(`<p>${renderInline(text)}</p>`);
171
- }
172
-
173
- return out.join("\n");
174
- }
@@ -1,6 +0,0 @@
1
- {
2
- "assignments": {
3
- "/contact/contact-sales": { "headerVariant": "minimal" },
4
- "/contact/contact-sales/thank-you": { "headerVariant": "minimal", "footerVariant": "minimal" }
5
- }
6
- }
@@ -1,79 +0,0 @@
1
- {
2
- "lang": "en",
3
- "head": {
4
- "favicon": "/tenants/tokenoftrust.com/favicon.png",
5
- "themeStylesheets": ["/tenants/tokenoftrust.com/themes/tot-navy.css"]
6
- },
7
- "sharedMarketingCss": true,
8
- "header": {
9
- "variant": "primary",
10
- "brand": {
11
- "href": "/",
12
- "label": "Token of Trust",
13
- "logo": {
14
- "src": "/tenants/tokenoftrust.com/logo-wordmark.png",
15
- "alt": "Token of Trust",
16
- "width": 180,
17
- "height": 32
18
- }
19
- },
20
- "nav": [
21
- { "id": "nav-platform", "action": "nav-platform", "label": "Platform", "href": "/#platform" },
22
- { "id": "nav-industries", "action": "nav-industries", "label": "Industries", "href": "/#industries" },
23
- { "id": "nav-resources", "action": "nav-resources", "label": "Resources", "href": "https://help.tokenoftrust.com", "external": true },
24
- { "id": "nav-pricing", "action": "nav-pricing", "label": "Pricing", "href": "https://tokenoftrust.com/pricing/", "external": true },
25
- { "id": "nav-login", "action": "nav-login", "label": "Login", "href": "https://app.tokenoftrust.com", "external": true }
26
- ],
27
- "ctas": [
28
- { "id": "cta-book-demo", "action": "cta-book-demo", "label": "Book Demo", "href": "https://tokenoftrust.com/contact/", "variant": "secondary" },
29
- { "id": "cta-start-free", "action": "cta-start-for-free", "label": "Start For Free", "href": "https://app.tokenoftrust.com", "variant": "primary" }
30
- ]
31
- },
32
- "footer": {
33
- "variant": "default",
34
- "brand": {
35
- "text": "Customer verification and compliance for regulated ecommerce. 200+ countries. We will never sell your data."
36
- },
37
- "columns": [
38
- {
39
- "title": "Platform",
40
- "links": [
41
- { "id": "ftr-platform-idv", "action": "nav-identity-verification", "label": "Identity Verification", "href": "/#platform" },
42
- { "id": "ftr-platform-age", "action": "nav-age-assurance", "label": "Age Assurance", "href": "/#platform" },
43
- { "id": "ftr-platform-fraud", "action": "nav-fraud-prevention", "label": "Fraud Prevention", "href": "/#platform" },
44
- { "id": "ftr-platform-evidence", "action": "nav-compliance-evidence", "label": "Compliance Evidence", "href": "/#platform" },
45
- { "id": "ftr-platform-aml", "action": "nav-aml-pact-act-tax", "label": "AML · PACT Act · Tax", "href": "/#platform" }
46
- ]
47
- },
48
- {
49
- "title": "Industries",
50
- "links": [
51
- { "id": "ftr-industries-alcohol", "action": "nav-alcohol", "label": "Alcohol", "href": "/#industries" },
52
- { "id": "ftr-industries-vape", "action": "nav-tobacco-and-vape", "label": "Tobacco & Vape", "href": "/#industries" },
53
- { "id": "ftr-industries-age-restricted", "action": "nav-age-restricted-goods", "label": "Age-Restricted Goods", "href": "/#industries" },
54
- { "id": "ftr-industries-marketplaces", "action": "nav-marketplaces", "label": "Marketplaces", "href": "/#industries" }
55
- ]
56
- },
57
- {
58
- "title": "Company",
59
- "links": [
60
- { "id": "ftr-company-pricing", "action": "nav-pricing", "label": "Pricing", "href": "https://tokenoftrust.com/pricing/", "external": true },
61
- { "id": "ftr-company-contact", "action": "nav-contact-sales", "label": "Contact Sales", "href": "https://tokenoftrust.com/contact/", "external": true },
62
- { "id": "ftr-company-resources", "action": "nav-resources", "label": "Resources", "href": "https://help.tokenoftrust.com", "external": true },
63
- { "id": "ftr-company-login", "action": "nav-login", "label": "Login", "href": "https://app.tokenoftrust.com", "external": true }
64
- ]
65
- },
66
- {
67
- "title": "Legal",
68
- "links": [
69
- { "id": "ftr-legal-privacy", "action": "nav-privacy-policy", "label": "Privacy Policy", "href": "https://tokenoftrust.com/privacy/", "external": true },
70
- { "id": "ftr-legal-terms", "action": "nav-terms", "label": "Terms", "href": "https://tokenoftrust.com/terms/", "external": true }
71
- ]
72
- }
73
- ],
74
- "social": [],
75
- "bottom": {
76
- "note": "GDPR · CCPA · PIPEDA compliant. 256-bit SSL. We will never sell your data."
77
- }
78
- }
79
- }
@@ -1,27 +0,0 @@
1
- /**
2
- * Structured content contracts — ONE import surface for the
3
- * data-driven framework widgets, so tenant content (JSON) and the .astro
4
- * components share a single typed vocabulary and a tenant never copies HTML/CSS.
5
- *
6
- * New contracts: rich text, callouts, needs-review, prose/policy sections,
7
- * trust strip. Re-exported here alongside the tier/comparison contracts already
8
- * defined in lib/membership/model, so a membership page and a policy page
9
- * import from the same place. (The <BrandGrid> `Brand` contract lives with its
10
- * component in components/catalog/storefront/commerce/BrandGrid.astro.)
11
- */
12
- export * from "./richtext.js";
13
- export * from "./callout.js";
14
- export * from "./needsReview.js";
15
- export * from "./prose.js";
16
- export * from "./trustStrip.js";
17
-
18
- // Reused tier contracts — surfaced here so all structured widgets share
19
- // one contract entry point.
20
- export type {
21
- Tier,
22
- TierFigure,
23
- TierFeature,
24
- TierCta,
25
- ComparisonRow,
26
- } from "@/lib/membership/model";
27
- export { isIllustrative } from "@/lib/membership/model";
@@ -1,35 +0,0 @@
1
- // Estimated reading time for a post's rendered HTML (B1.5). Pure + Node-free
2
- // (parse5 is Workers-safe), so it's unit-testable and usable on any render path.
3
- import { parseFragment } from "parse5";
4
-
5
- /** Minimal structural view of a parse5 node (duck-typed, as scripts/dev/locate.mjs does). */
6
- interface P5Node {
7
- nodeName: string;
8
- tagName?: string;
9
- value?: string;
10
- childNodes?: P5Node[];
11
- }
12
-
13
- const WORDS_PER_MINUTE = 225;
14
-
15
- function collectText(node: P5Node, out: string[]): void {
16
- if (node.nodeName === "#text") {
17
- if (node.value) out.push(node.value);
18
- return;
19
- }
20
- // Non-visible/text-irrelevant subtrees never count toward reading time.
21
- if (node.tagName === "script" || node.tagName === "style") return;
22
- for (const child of node.childNodes ?? []) collectText(child, out);
23
- }
24
-
25
- /**
26
- * Reading time in whole minutes: visible word count / 225 wpm, rounded up, min 1.
27
- * Ignores markup, script, and style content.
28
- */
29
- export function readingTime(html: string): number {
30
- const frag = parseFragment(html ?? "") as unknown as P5Node;
31
- const parts: string[] = [];
32
- collectText(frag, parts);
33
- const words = parts.join(" ").trim().split(/\s+/).filter(Boolean);
34
- return Math.max(1, Math.ceil(words.length / WORDS_PER_MINUTE));
35
- }
@@ -1,95 +0,0 @@
1
- // Table of contents for a post's rendered HTML (B1.5): parse h2/h3 headings and
2
- // derive stable anchor ids. Pure + Node-free (parse5 is Workers-safe).
3
- //
4
- // `toc()` and `htmlWithHeadingIds()` derive ids from the SAME deterministic pass
5
- // (`annotate`), so a render path can feed `htmlWithHeadingIds(post.contentHtml)`
6
- // to `set:html` and `toc(post.contentHtml)` to the aside and the anchors line up.
7
- import { parseFragment, serialize } from "parse5";
8
- import { slugifyHeading } from "../prose.js";
9
-
10
- /** Minimal structural view of a parse5 node (duck-typed, as scripts/dev/locate.mjs does). */
11
- interface P5Node {
12
- nodeName: string;
13
- tagName?: string;
14
- value?: string;
15
- attrs?: { name: string; value: string }[];
16
- childNodes?: P5Node[];
17
- }
18
-
19
- export interface TocEntry {
20
- id: string;
21
- text: string;
22
- level: 2 | 3;
23
- }
24
-
25
- function textOf(node: P5Node): string {
26
- if (node.nodeName === "#text") return node.value ?? "";
27
- return (node.childNodes ?? []).map(textOf).join("");
28
- }
29
-
30
- function getId(node: P5Node): string | undefined {
31
- return node.attrs?.find((a) => a.name === "id")?.value?.trim() || undefined;
32
- }
33
-
34
- function* headings(node: P5Node): Generator<P5Node> {
35
- for (const child of node.childNodes ?? []) {
36
- if (child.tagName === "h2" || child.tagName === "h3") yield child;
37
- yield* headings(child);
38
- }
39
- }
40
-
41
- interface AnnotatedHeading {
42
- node: P5Node;
43
- id: string;
44
- text: string;
45
- level: 2 | 3;
46
- }
47
-
48
- /**
49
- * Walk headings in document order, assigning each a unique anchor id: an
50
- * author-supplied `id` is kept as-is; otherwise the slugified text, de-duped
51
- * with a numeric suffix on collision. Empty headings are skipped.
52
- */
53
- function* annotate(root: P5Node): Generator<AnnotatedHeading> {
54
- const seen = new Map<string, number>();
55
- for (const node of headings(root)) {
56
- const text = textOf(node).replace(/\s+/g, " ").trim();
57
- if (!text) continue;
58
- const level: 2 | 3 = node.tagName === "h2" ? 2 : 3;
59
- const explicit = getId(node);
60
- let id: string;
61
- if (explicit) {
62
- id = explicit;
63
- seen.set(id, (seen.get(id) ?? 0) + 1);
64
- } else {
65
- const base = slugifyHeading(text) || "section";
66
- const n = seen.get(base) ?? 0;
67
- seen.set(base, n + 1);
68
- id = n === 0 ? base : `${base}-${n + 1}`;
69
- }
70
- yield { node, id, text, level };
71
- }
72
- }
73
-
74
- /** TOC entries (one per h2/h3) with stable anchor ids, in document order. */
75
- export function toc(html: string): TocEntry[] {
76
- const frag = parseFragment(html ?? "") as unknown as P5Node;
77
- return [...annotate(frag)].map(({ id, text, level }) => ({ id, text, level }));
78
- }
79
-
80
- /**
81
- * The same HTML with anchor ids added to any h2/h3 that lacks one (author ids
82
- * untouched). Returns the input unchanged when every heading already has an id,
83
- * so posts without generated anchors are byte-for-byte preserved.
84
- */
85
- export function htmlWithHeadingIds(html: string): string {
86
- const frag = parseFragment(html ?? "") as unknown as P5Node;
87
- let changed = false;
88
- for (const { node, id } of annotate(frag)) {
89
- if (!getId(node)) {
90
- node.attrs = [...(node.attrs ?? []), { name: "id", value: id }];
91
- changed = true;
92
- }
93
- }
94
- return changed ? serialize(frag as never) : (html ?? "");
95
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * Customers view model (baseline §Customers) — directory + detail, and the
3
- * `Valuable But Blocked` first-class reach-out/unblock queue.
4
- */
5
-
6
- export type VerificationState = "verified" | "pending" | "blocked" | "not_required";
7
-
8
- export type CustomerSegment = "new" | "returning" | "vip";
9
-
10
- export interface CustomerRow {
11
- id: string;
12
- name: string;
13
- email: string;
14
- orderCount: number;
15
- lifetimeValue: number;
16
- lastOrderAt: string | null;
17
- segment: CustomerSegment;
18
- supportFlags: string[];
19
- verificationState: VerificationState;
20
- }
21
-
22
- export type BlockedReason = "verification" | "destination" | "address" | "support";
23
-
24
- export interface CustomerBlockedQueueRow {
25
- customerId: string;
26
- name: string;
27
- recoverableValue: number;
28
- blocker: BlockedReason;
29
- blockerDetail: string;
30
- action: string;
31
- }
32
-
33
- export interface CustomerOrderRef {
34
- orderId: string;
35
- placedAt: string;
36
- total: number;
37
- }
38
-
39
- export interface CustomerActivityEvent {
40
- title: string;
41
- detail: string;
42
- at: string;
43
- }
44
-
45
- export interface CustomerDetail extends CustomerRow {
46
- orders: CustomerOrderRef[];
47
- activity: CustomerActivityEvent[];
48
- notes: string[];
49
- }
50
-
51
- export interface CustomersViewModel {
52
- targetTenant: string;
53
- directory: CustomerRow[];
54
- detailsById: Record<string, CustomerDetail>;
55
- valuableButBlocked: CustomerBlockedQueueRow[];
56
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * Blind indexes for exact-match contact search: base64url HMAC-SHA256 of a normalized value under
3
- * the tenant's blind-index data key, so equal values match within one tenant and stage and never
4
- * across tenants. Normalization is part of the index contract: changing it orphans every stored
5
- * index.
6
- */
7
-
8
- /** Trim, NFKC, lowercase. Null when nothing remains. */
9
- export function normalizeEmail(value: string): string | null {
10
- const normalized = value.trim().normalize("NFKC").toLowerCase();
11
- return normalized === "" ? null : normalized;
12
- }
13
-
14
- /** NFKC, then a leading '+' (if the trimmed value starts with one) and ASCII digits only. Null when no digit remains. */
15
- export function normalizePhone(value: string): string | null {
16
- const folded = value.normalize("NFKC").trim();
17
- const digits = folded.replace(/[^0-9]/g, "");
18
- if (digits === "") return null;
19
- return folded.startsWith("+") ? `+${digits}` : digits;
20
- }
21
-
22
- /** base64url (no padding) HMAC-SHA256 of an already-normalized value. */
23
- export async function blindIndex(hmacKey: CryptoKey, normalized: string): Promise<string> {
24
- const mac = new Uint8Array(await crypto.subtle.sign("HMAC", hmacKey, new TextEncoder().encode(normalized) as BufferSource));
25
- let binary = "";
26
- for (const byte of mac) binary += String.fromCharCode(byte);
27
- return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
28
- }
@@ -1,149 +0,0 @@
1
- /**
2
- * The contact access audit (`contact_access_audit`, append-only): every read, list and erase of
3
- * sealed customer contact writes its row BEFORE anything is decrypted. Staff rows carry the
4
- * 30-per-hour quota in the same statement, so concurrent reads can never pass it together.
5
- * Rows hold opaque ids, codes and times only — never a contact field or a searched value. A list
6
- * or search row names the record ids it returned (comma-joined in record_id, at most
7
- * {@link AUDIT_RECORD_IDS_MAX}) and their count; an erase row names the field groups it cleared.
8
- */
9
-
10
- export type VaultStage = "preview" | "publication";
11
-
12
- export const STAFF_READS_PER_HOUR = 30;
13
- /** The most ids one list or search audit row names; every list and search is capped at or below it. */
14
- export const AUDIT_RECORD_IDS_MAX = 200;
15
-
16
- /** A list or search row's record_id: the returned ids comma-joined, or null when it returned none. */
17
- export function auditRecordIds(ids: readonly string[]): string | null {
18
- if (ids.length > AUDIT_RECORD_IDS_MAX) throw new Error("contact audit: too many record ids");
19
- return ids.length === 0 ? null : ids.join(",");
20
- }
21
- /** The quota window. A row counts while its `at` is strictly after `now - HOUR_MS`: one exactly an hour old no longer counts. */
22
- export const HOUR_MS = 3_600_000;
23
-
24
- export interface ContactActor {
25
- actorId: string;
26
- role: "owner" | "staff";
27
- reasonCode?: string;
28
- ticketRef?: string;
29
- }
30
-
31
- export interface AuditStatement {
32
- sql: string;
33
- params: readonly unknown[];
34
- }
35
-
36
- /** The SQL surface the audit needs; D1's `fromD1` and the sqlite test harness both satisfy it. */
37
- export interface AuditDb {
38
- all<T = Record<string, unknown>>(sql: string, ...params: unknown[]): Promise<T[]>;
39
- }
40
-
41
- /**
42
- * The audit insert. RETURNING tells admitted from refused (quota, or `requireRow` absent); an
43
- * error means the audit could not be written.
44
- */
45
- export function auditStatement(input: {
46
- auditId: string;
47
- tenantId: string;
48
- stage: VaultStage;
49
- recordKind: "order-contact" | "contact-message";
50
- recordId: string | null;
51
- recordCount?: number;
52
- groups?: readonly string[];
53
- actor: ContactActor;
54
- action: "read" | "list" | "erase" | "search";
55
- now: Date;
56
- requireRow?: AuditStatement;
57
- }): AuditStatement {
58
- const { auditId, tenantId, stage, recordKind, recordId, actor, action, now } = input;
59
- const recordCount = input.recordCount ?? null;
60
- const groups = input.groups && input.groups.length > 0 ? [...input.groups].sort().join(",") : null;
61
- const hourAgo = new Date(now.getTime() - HOUR_MS).toISOString();
62
- const params: unknown[] = [
63
- auditId, tenantId, stage, recordKind, recordId, recordCount, now.toISOString(), actor.actorId, actor.role,
64
- actor.role === "staff" ? actor.reasonCode ?? null : null,
65
- actor.role === "staff" ? actor.ticketRef ?? null : null,
66
- action, groups,
67
- actor.role, tenantId, actor.actorId, hourAgo, STAFF_READS_PER_HOUR,
68
- ];
69
- const requireRow = input.requireRow ? ` AND EXISTS (${input.requireRow.sql})` : "";
70
- if (input.requireRow) params.push(...input.requireRow.params);
71
- return {
72
- sql: `INSERT INTO contact_access_audit
73
- (audit_id, tenant_id, stage, record_kind, record_id, record_count, at, actor_id, actor_role, reason_code, ticket_ref, action, groups, outcome)
74
- SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'admitted'
75
- WHERE (? = 'owner' OR (SELECT COUNT(*) FROM contact_access_audit
76
- WHERE tenant_id = ? AND actor_id = ? AND actor_role = 'staff' AND at > ?) < ?)${requireRow}
77
- RETURNING audit_id`,
78
- params,
79
- };
80
- }
81
-
82
- /** Run the audit insert alone: "admitted", "quota" (no row inserted) or "unavailable" (error). */
83
- export async function admitAudit(db: AuditDb, statement: AuditStatement): Promise<"admitted" | "quota" | "unavailable"> {
84
- try {
85
- const rows = await db.all(statement.sql, ...statement.params);
86
- return rows.length === 1 ? "admitted" : "quota";
87
- } catch {
88
- return "unavailable";
89
- }
90
- }
91
-
92
- /** Admitted app recipient reads per install and tenant per hour. */
93
- export const APP_CONTACT_READS_PER_HOUR = 300;
94
- export const APP_CONTACT_PURPOSE = "fulfillment-shipping";
95
-
96
- /**
97
- * The app-access audit insert (`app_contact_access_audit`): the recipient read's admission and its
98
- * only write. It inserts one row only when, at that instant, the install is active on the tenant
99
- * holding `scope`, the assignment is the install's active assignment of the order, the order still
100
- * stands at `eventVersion` (the version its releasability was computed at), a live consent covers
101
- * (install, tenant, stage, purpose), and the install has fewer than
102
- * {@link APP_CONTACT_READS_PER_HOUR} admitted rows on the tenant in the last hour.
103
- */
104
- export function appAuditStatement(input: {
105
- auditId: string;
106
- installId: string;
107
- tenantId: string;
108
- stage: VaultStage;
109
- orderId: string;
110
- assignmentId: string;
111
- eventVersion: number;
112
- scope: string;
113
- now: Date;
114
- }): AuditStatement {
115
- const { auditId, installId, tenantId, stage, orderId, assignmentId, eventVersion, scope, now } = input;
116
- const at = now.toISOString();
117
- const hourAgo = new Date(now.getTime() - HOUR_MS).toISOString();
118
- return {
119
- sql: `INSERT INTO app_contact_access_audit (audit_id, install_id, tenant_id, stage, order_id, purpose, at, outcome)
120
- SELECT ?, ?, ?, ?, ?, '${APP_CONTACT_PURPOSE}', ?, 'admitted'
121
- WHERE EXISTS (SELECT 1 FROM app_installs AS ai
122
- WHERE ai.install_id = ? AND ai.tenant_id = ? AND ai.status = 'active'
123
- AND EXISTS (SELECT 1 FROM json_each(ai.scopes) WHERE json_each.value = ?))
124
- AND EXISTS (SELECT 1 FROM fulfillment_assignments AS fa
125
- WHERE fa.assignment_id = ? AND fa.tenant_id = ? AND fa.stage = ? AND fa.order_id = ?
126
- AND fa.install_id = ? AND fa.state = 'active')
127
- AND EXISTS (SELECT 1 FROM scrappy_commerce_orders AS o
128
- WHERE o.tenant_id = ? AND o.stage = ? AND o.order_id = ? AND o.event_version = ?)
129
- AND EXISTS (SELECT 1 FROM app_contact_consents AS c
130
- WHERE c.install_id = ? AND c.tenant_id = ? AND c.stage = ? AND c.purpose = '${APP_CONTACT_PURPOSE}'
131
- AND c.revoked_at IS NULL AND c.expires_at > ?)
132
- AND (SELECT COUNT(*) FROM app_contact_access_audit AS q
133
- WHERE q.install_id = ? AND q.tenant_id = ? AND q.at > ?) < ?
134
- RETURNING audit_id`,
135
- params: [
136
- auditId, installId, tenantId, stage, orderId, at,
137
- installId, tenantId, scope,
138
- assignmentId, tenantId, stage, orderId, installId,
139
- tenantId, stage, orderId, eventVersion,
140
- installId, tenantId, stage, at,
141
- installId, tenantId, hourAgo, APP_CONTACT_READS_PER_HOUR,
142
- ],
143
- };
144
- }
145
-
146
- /** The same insert without RETURNING, for use inside a batch whose later statements check the row. */
147
- export function batchAuditStatement(statement: AuditStatement): AuditStatement {
148
- return { sql: statement.sql.replace(/\s*RETURNING audit_id$/, ""), params: statement.params };
149
- }