@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,167 +0,0 @@
1
- /**
2
- * Client behavior for the owner's "Grant access" section of /dashboard/<appDomain>/team:
3
- * ship-on-behalf or customer contact access, granted to a person by email, time-limited and
4
- * revocable, through POST/GET/DELETE /api/grants/principal.
5
- *
6
- * Served as a STATIC same-origin file (public/), same CSP rationale as
7
- * dashboard-team.js — see that file's header. Only wires up when the section is present
8
- * (store owner only).
9
- */
10
- (function () {
11
- const $ = (id) => document.getElementById(id);
12
- const body = $("delegations");
13
- if (!body) return; // section not rendered (not the owner) — nothing to wire up
14
- const tenant = body.dataset.tenant;
15
-
16
- const DAY = 24 * 60 * 60 * 1000;
17
- /** Expiry choices per capability; the server enforces the same bounds. */
18
- const TTL_CHOICES = {
19
- "ship-on-behalf": [[7 * DAY, "In 7 days"], [30 * DAY, "In 30 days", true], [90 * DAY, "In 90 days"]],
20
- "customer-contact-read": [[1 * DAY, "In 1 day", true], [3 * DAY, "In 3 days"], [7 * DAY, "In 7 days"]],
21
- };
22
- const LABELS = { "ship-on-behalf": "Ship on behalf", "customer-contact-read": "Customer contacts" };
23
-
24
- function capability() {
25
- const el = $("delegateCapability");
26
- return el && TTL_CHOICES[el.value] ? el.value : "ship-on-behalf";
27
- }
28
-
29
- function fillTtl() {
30
- const ttlEl = $("delegateTtl");
31
- if (!ttlEl) return;
32
- ttlEl.replaceChildren();
33
- for (const [ms, label, selected] of TTL_CHOICES[capability()]) {
34
- const opt = document.createElement("option");
35
- opt.value = String(ms);
36
- opt.textContent = label;
37
- if (selected) opt.selected = true;
38
- ttlEl.appendChild(opt);
39
- }
40
- }
41
-
42
- function showMsg(kind, text) {
43
- const el = $("delegateMsg");
44
- el.className = "msg " + kind;
45
- el.textContent = text;
46
- }
47
-
48
- function renderRows(grants) {
49
- body.replaceChildren();
50
- if (!grants || !grants.length) {
51
- const tr = document.createElement("tr");
52
- const td = document.createElement("td");
53
- td.colSpan = 4; td.className = "muted";
54
- td.textContent = "No active grants.";
55
- tr.appendChild(td); body.appendChild(tr);
56
- return;
57
- }
58
- for (const g of grants) {
59
- const tr = document.createElement("tr");
60
- const dev = document.createElement("td");
61
- // tot20 names the grantee by an opaque id; storefront adds the email for grants made here.
62
- dev.textContent = (g.principal && g.principal.email) || "Granted outside this page (email not recorded)";
63
- if (!(g.principal && g.principal.email)) dev.className = "muted";
64
- const cap = document.createElement("td");
65
- cap.textContent = LABELS[g.capability] || g.capability || "";
66
- const exp = document.createElement("td");
67
- exp.textContent = g.expiresAt ? new Date(g.expiresAt).toLocaleString() : "";
68
- const act = document.createElement("td");
69
- act.className = "act";
70
- const revokeBtn = document.createElement("button");
71
- revokeBtn.type = "button";
72
- revokeBtn.className = "rowbtn";
73
- revokeBtn.textContent = "Revoke";
74
- revokeBtn.addEventListener("click", () => revoke(g.ref, dev.textContent, cap.textContent, revokeBtn));
75
- act.appendChild(revokeBtn);
76
- tr.appendChild(dev); tr.appendChild(cap); tr.appendChild(exp); tr.appendChild(act);
77
- body.appendChild(tr);
78
- }
79
- }
80
-
81
- function renderError(msg) {
82
- body.replaceChildren();
83
- const tr = document.createElement("tr");
84
- const td = document.createElement("td");
85
- td.colSpan = 4; td.className = "muted";
86
- td.textContent = msg;
87
- tr.appendChild(td); body.appendChild(tr);
88
- }
89
-
90
- async function loadDelegations() {
91
- try {
92
- const res = await fetch("/api/grants/principal?tenant=" + encodeURIComponent(tenant), {
93
- headers: { accept: "application/json" },
94
- });
95
- const data = await res.json().catch(() => ({}));
96
- if (res.ok) renderRows(data.grants);
97
- else renderError("Couldn't load grants (HTTP " + res.status + "). Reload to try again.");
98
- } catch (e) {
99
- renderError("Couldn't load grants. Reload to try again.");
100
- }
101
- }
102
-
103
- async function revoke(ref, email, label, btn) {
104
- if (!ref) return;
105
- if (!confirm("Revoke " + (email || "this person") + "'s " + (label || "access") + " access?")) return;
106
- if (btn) btn.disabled = true;
107
- try {
108
- const res = await fetch("/api/grants/principal", {
109
- method: "DELETE",
110
- headers: { "content-type": "application/json", accept: "application/json" },
111
- body: JSON.stringify({ tenant, ref }),
112
- });
113
- const data = await res.json().catch(() => ({}));
114
- if (res.ok) {
115
- showMsg("ok", "Revoked " + (email || "") + "'s access.");
116
- loadDelegations();
117
- } else {
118
- showMsg("err", data.error || ("Couldn't revoke (HTTP " + res.status + ")."));
119
- if (btn) btn.disabled = false;
120
- }
121
- } catch (e) {
122
- showMsg("err", "Couldn't revoke: " + (e && e.message ? e.message : e));
123
- if (btn) btn.disabled = false;
124
- }
125
- }
126
-
127
- async function grant() {
128
- const email = $("delegateEmail").value.trim();
129
- if (!email) { showMsg("err", "Enter an email."); return; }
130
- const cap = capability();
131
- const ttlEl = $("delegateTtl");
132
- const ttlMs = ttlEl ? Number(ttlEl.value) : TTL_CHOICES[cap][0][0];
133
- const btn = $("delegateBtn");
134
- btn.disabled = true;
135
- showMsg("", "Granting…");
136
- try {
137
- const res = await fetch("/api/grants/principal", {
138
- method: "POST",
139
- headers: { "content-type": "application/json", accept: "application/json" },
140
- body: JSON.stringify({ tenant, email, capability: cap, ttlMs }),
141
- });
142
- const data = await res.json().catch(() => ({}));
143
- if (res.ok) {
144
- showMsg("ok", "Granted " + LABELS[cap].toLowerCase() + " access to " + email + ".");
145
- $("delegateEmail").value = "";
146
- loadDelegations();
147
- } else {
148
- showMsg("err", data.message || data.error || ("Grant failed (HTTP " + res.status + ")."));
149
- }
150
- } catch (e) {
151
- showMsg("err", "Grant failed: " + (e && e.message ? e.message : e));
152
- } finally {
153
- btn.disabled = false;
154
- }
155
- }
156
-
157
- const delegateBtn = $("delegateBtn");
158
- const emailInput = $("delegateEmail");
159
- if (delegateBtn && emailInput) {
160
- delegateBtn.addEventListener("click", grant);
161
- emailInput.addEventListener("keydown", (e) => { if (e.key === "Enter") grant(); });
162
- }
163
- const capEl = $("delegateCapability");
164
- if (capEl) capEl.addEventListener("change", fillTtl);
165
- fillTtl();
166
- loadDelegations();
167
- })();
@@ -1,356 +0,0 @@
1
- /**
2
- * Client behavior for /dashboard/<appDomain>/team (#8425 Stage 0).
3
- *
4
- * Served as a STATIC same-origin file (public/) and referenced via
5
- * <script src="/js/dashboard-team.js">, so the strict production CSP allows it via
6
- * `script-src 'self'` — no nonce, no per-build hash. (An inline <script> here is
7
- * blocked: Astro's `is:inline` drops the templated nonce, and a processed inline
8
- * script needs its content-hash pinned in cspStaticHashes on every change. An
9
- * external 'self' file avoids both.)
10
- *
11
- * The tenant appDomain is read from the members-table `data-tenant` attribute (no
12
- * server-injected values), so this file is fully static.
13
- */
14
- (function () {
15
- const $ = (id) => document.getElementById(id);
16
- const membersBody = $("members");
17
- if (!membersBody) return;
18
- const tenant = membersBody.dataset.tenant;
19
-
20
- // One verdict from tot-mcp's access_explain, rendered the same everywhere: the Team row,
21
- // the invite result and the resend result. `verified` is `true` or the failure object.
22
- function verdictParts(verdict) {
23
- if (verdict === true || (verdict && verdict.state === "verified")) {
24
- return { cls: "ok", label: "Active", why: "" };
25
- }
26
- const v = verdict || { state: "unavailable", reason: "not verified" };
27
- if (v.state === "awaiting-acceptance") {
28
- return v.inviteStatus === "accepted"
29
- ? { cls: "pend", label: "Accepted — not signed in", why: v.reason + " " + v.fix }
30
- : { cls: "pend", label: "Pending", why: "Waiting for the developer to accept and sign in." };
31
- }
32
- if (v.state === "broken") {
33
- return { cls: "bad", label: "Not resolving", why: v.reason + " Fix: " + v.fix };
34
- }
35
- return { cls: "pend", label: "Unverified", why: "Couldn't check: " + (v.reason || "unknown") + "." };
36
- }
37
-
38
- function renderAccessCell(td, verdict) {
39
- const parts = verdictParts(verdict);
40
- td.replaceChildren();
41
- const label = document.createElement("span");
42
- label.className = "access " + parts.cls;
43
- label.textContent = parts.label;
44
- td.appendChild(label);
45
- if (parts.why) {
46
- const why = document.createElement("span");
47
- why.className = "access-why";
48
- why.textContent = parts.why;
49
- td.appendChild(why);
50
- }
51
- }
52
-
53
- async function checkAccess(email, td, btn) {
54
- if (btn) btn.disabled = true;
55
- td.replaceChildren();
56
- td.textContent = "Checking…";
57
- td.className = "muted";
58
- try {
59
- const q = "tenant=" + encodeURIComponent(tenant) + "&email=" + encodeURIComponent(email);
60
- const res = await fetch("/api/grants/team-access?" + q, { headers: { accept: "application/json" } });
61
- const body = await res.json().catch(() => ({}));
62
- td.className = "";
63
- renderAccessCell(td, res.ok ? body.access
64
- : { state: "unavailable", reason: body.error || ("HTTP " + res.status) });
65
- } catch (e) {
66
- td.className = "";
67
- renderAccessCell(td, { state: "unavailable", reason: e && e.message ? e.message : String(e) });
68
- } finally {
69
- if (btn) btn.disabled = false;
70
- }
71
- }
72
-
73
- // The invite / resend result: green only when tot-mcp proved the grant resolves; a
74
- // broken grant is red with its step and fix and never reads as "invited".
75
- function showVerdict(email, verdict, sentLine) {
76
- const parts = verdictParts(verdict);
77
- const wrap = document.createElement("div");
78
- const tag = document.createElement("span");
79
- tag.className = "advice";
80
- tag.textContent = "tot-mcp advice";
81
- wrap.appendChild(tag);
82
- const line = document.createElement("p");
83
- line.style.margin = ".2rem 0 0";
84
- if (parts.cls === "ok") {
85
- line.textContent = sentLine + " Access verified — " +
86
- ((verdict && verdict.capability) || "preview-access") + " resolves for " + email + ".";
87
- wrap.appendChild(line);
88
- showMsg("ok", wrap);
89
- return;
90
- }
91
- if (parts.cls === "pend") {
92
- line.textContent = sentLine + " " + parts.why;
93
- wrap.appendChild(line);
94
- showMsg("ok", wrap);
95
- return;
96
- }
97
- line.textContent = "Access for " + email + " will not work yet (step: " + verdict.failedStep +
98
- "). " + verdict.reason + " Fix: " + verdict.fix + " No invite email was sent.";
99
- wrap.appendChild(line);
100
- showMsg("err", wrap);
101
- }
102
-
103
- function renderMembers(members) {
104
- membersBody.replaceChildren();
105
- if (!members || !members.length) {
106
- const tr = document.createElement("tr");
107
- const td = document.createElement("td");
108
- td.colSpan = 4; td.className = "muted";
109
- td.textContent = "No developers invited yet.";
110
- tr.appendChild(td); membersBody.appendChild(tr);
111
- return;
112
- }
113
- for (const m of members) {
114
- const tr = document.createElement("tr");
115
- const dev = document.createElement("td");
116
- dev.textContent = m.developer;
117
- const roles = document.createElement("td");
118
- roles.textContent = (m.roles || []).join(", ") || "developer";
119
- const access = document.createElement("td");
120
- const act = document.createElement("td");
121
- act.className = "act";
122
- const checkBtn = document.createElement("button");
123
- checkBtn.type = "button";
124
- checkBtn.className = "rowbtn";
125
- checkBtn.textContent = "Check access";
126
- checkBtn.title = "Check whether " + m.developer + "'s access resolves right now";
127
- checkBtn.style.marginRight = ".4rem";
128
- checkBtn.addEventListener("click", () => checkAccess(m.developer, access, checkBtn));
129
- act.appendChild(checkBtn);
130
- const btn = document.createElement("button");
131
- btn.type = "button";
132
- btn.className = "rowbtn";
133
- btn.textContent = "Resend invite";
134
- btn.title = "Re-send the sign-in email to " + m.developer;
135
- btn.addEventListener("click", () => resend(m.developer, btn));
136
- act.appendChild(btn);
137
- if (m.inviteId) {
138
- const revokeBtn = document.createElement("button");
139
- revokeBtn.type = "button";
140
- revokeBtn.className = "rowbtn";
141
- revokeBtn.textContent = "Revoke";
142
- revokeBtn.title = "Revoke " + m.developer + "'s access to this vendor";
143
- revokeBtn.style.marginLeft = ".4rem";
144
- revokeBtn.addEventListener("click", () => revoke(m.developer, m.inviteId, revokeBtn));
145
- act.appendChild(revokeBtn);
146
- }
147
- tr.appendChild(dev); tr.appendChild(roles); tr.appendChild(access); tr.appendChild(act);
148
- membersBody.appendChild(tr);
149
- checkAccess(m.developer, access, checkBtn);
150
- }
151
- }
152
-
153
- async function revoke(email, inviteId, btn) {
154
- if (!confirm("Revoke " + email + "'s access to this vendor?")) return;
155
- if (btn) btn.disabled = true;
156
- showMsg("", "Revoking " + email + "'s access…");
157
- try {
158
- const res = await fetch("/api/grants/team-revoke", {
159
- method: "POST",
160
- headers: { "content-type": "application/json", accept: "application/json" },
161
- body: JSON.stringify({ tenant, inviteId, email }),
162
- });
163
- const body = await res.json().catch(() => ({}));
164
- if (res.ok) {
165
- showMsg("ok", "Revoked " + email + "'s access.");
166
- loadMembers();
167
- } else {
168
- showMsg("err", body.error || ("Couldn't revoke (HTTP " + res.status + ")."));
169
- if (btn) btn.disabled = false;
170
- }
171
- } catch (e) {
172
- showMsg("err", "Couldn't revoke: " + (e && e.message ? e.message : e));
173
- if (btn) btn.disabled = false;
174
- }
175
- }
176
-
177
- async function resend(email, btn) {
178
- if (btn) btn.disabled = true;
179
- showMsg("", "Re-sending the sign-in email to " + email + "…");
180
- try {
181
- const res = await fetch("/api/grants/team-invite", {
182
- method: "POST",
183
- headers: { "content-type": "application/json", accept: "application/json" },
184
- body: JSON.stringify({ tenant, email }),
185
- });
186
- const body = await res.json().catch(() => ({}));
187
- if (res.ok) {
188
- const who = body.developer || email;
189
- showVerdict(who, body.verified, "Re-sent the sign-in email to " + who + ".");
190
- loadMembers();
191
- } else {
192
- showMsg("err", body.error || ("Couldn't resend (HTTP " + res.status + ")."));
193
- }
194
- } catch (e) {
195
- showMsg("err", "Couldn't resend: " + (e && e.message ? e.message : e));
196
- } finally {
197
- if (btn) btn.disabled = false;
198
- }
199
- }
200
-
201
- function renderError(msg) {
202
- membersBody.replaceChildren();
203
- const tr = document.createElement("tr");
204
- const td = document.createElement("td");
205
- td.colSpan = 4; td.className = "muted";
206
- td.textContent = msg;
207
- tr.appendChild(td); membersBody.appendChild(tr);
208
- }
209
-
210
- async function loadMembers() {
211
- try {
212
- const res = await fetch("/api/grants/team-members?tenant=" + encodeURIComponent(tenant), {
213
- headers: { accept: "application/json" },
214
- });
215
- const body = await res.json().catch(() => ({}));
216
- if (res.ok) renderMembers(body.members);
217
- else renderError(body.error || ("Couldn't load members (HTTP " + res.status + ")."));
218
- } catch (e) {
219
- renderError("Couldn't load members: " + (e && e.message ? e.message : e));
220
- }
221
- }
222
-
223
- function showMsg(kind, text, targetId) {
224
- const el = $(targetId || "msg");
225
- el.className = "msg " + kind;
226
- el.replaceChildren();
227
- if (typeof text === "string") {
228
- el.textContent = text;
229
- return;
230
- }
231
- if (text && text.nodeType) el.appendChild(text);
232
- }
233
-
234
- function showProvisionPrompt(message) {
235
- const wrap = document.createElement("div");
236
- const line = document.createElement("p");
237
- line.style.margin = "0 0 .6rem";
238
- line.textContent = message || "This store's repo isn't provisioned yet.";
239
- const btn = document.createElement("button");
240
- btn.type = "button";
241
- btn.id = "provisionBtn";
242
- btn.className = "secondary";
243
- btn.textContent = "Provision now?";
244
- btn.title = "Create the store repo on this environment, then retry the invite";
245
- btn.addEventListener("click", () => provisionStore(btn, { successHint: "Click Send invite again." }));
246
- wrap.appendChild(line);
247
- wrap.appendChild(btn);
248
- showMsg("err", wrap);
249
- }
250
-
251
- // Shared by the invite dead-end's one-shot "Provision now?" button AND the
252
- // persistent "Repair store connection" button below — same idempotent
253
- // POST /api/grants/provision-store, which re-asserts the repo AND its webhooks
254
- // on every call, even when the repo is already provisioned.
255
- async function provisionStore(btn, opts) {
256
- opts = opts || {};
257
- const targetId = opts.targetId || "msg";
258
- if (btn) btn.disabled = true;
259
- showMsg("", opts.pendingMessage || "Provisioning store repo…", targetId);
260
- try {
261
- const res = await fetch("/api/grants/provision-store", {
262
- method: "POST",
263
- headers: { "content-type": "application/json", accept: "application/json" },
264
- body: JSON.stringify({ tenant, confirm: true }),
265
- });
266
- const body = await res.json().catch(() => ({}));
267
- if (res.ok) {
268
- const created = body.created ? "created" : "already present";
269
- showMsg(
270
- "ok",
271
- "Store repo " + created + " for " + (body.tenant || tenant) + "." +
272
- (opts.successHint ? " " + opts.successHint : ""),
273
- targetId,
274
- );
275
- } else {
276
- showMsg("err", body.error || ("Provision failed (HTTP " + res.status + ")."), targetId);
277
- }
278
- } catch (e) {
279
- showMsg("err", "Provision failed: " + (e && e.message ? e.message : e), targetId);
280
- } finally {
281
- if (btn) btn.disabled = false;
282
- }
283
- }
284
-
285
- async function invite() {
286
- const email = $("email").value.trim();
287
- if (!email) { showMsg("err", "Enter a developer email."); return; }
288
- const btn = $("inviteBtn");
289
- btn.disabled = true;
290
- showMsg("", "Sending…");
291
- try {
292
- // The role selector always shows Developer + Contributor (a plain member may
293
- // self-request Contributor — tot20 honors it, handoff
294
- // 2026-08-22-tot20-contributor-role); Admin/Owner render only for ToT staff
295
- // (#8453) — tot20 ignores those two from a plain member and pins to developer.
296
- const roleEl = $("role");
297
- const role = roleEl && roleEl.value ? roleEl.value : undefined;
298
- const noteEl = $("note");
299
- const note = noteEl && noteEl.value.trim() ? noteEl.value.trim() : undefined;
300
- const payload = { tenant, email };
301
- if (role) payload.role = role;
302
- if (note) payload.note = note;
303
- const res = await fetch("/api/grants/team-invite", {
304
- method: "POST",
305
- headers: { "content-type": "application/json", accept: "application/json" },
306
- body: JSON.stringify(payload),
307
- });
308
- const body = await res.json().catch(() => ({}));
309
- if (res.ok) {
310
- const already = body.changed === false;
311
- const who = body.developer || email;
312
- showVerdict(who, body.verified,
313
- (already ? "Already a developer — re-sent the sign-in email to " : "Invited ") + who + ".");
314
- $("email").value = "";
315
- if (noteEl) noteEl.value = "";
316
- loadMembers();
317
- } else if (
318
- res.status === 409 &&
319
- (body.code === "store-not-provisioned" || body.reason === "storeNotProvisioned")
320
- ) {
321
- showProvisionPrompt(body.error);
322
- } else {
323
- showMsg("err", body.error || ("Invite failed (HTTP " + res.status + ")."));
324
- }
325
- } catch (e) {
326
- showMsg("err", "Invite failed: " + (e && e.message ? e.message : e));
327
- } finally {
328
- btn.disabled = false;
329
- }
330
- }
331
-
332
- // The invite form now shows for members AND ToT staff (#8453), but wire the invite
333
- // handlers only when the form is present (defensive). The members list always loads.
334
- const inviteBtn = $("inviteBtn");
335
- const emailInput = $("email");
336
- if (inviteBtn && emailInput) {
337
- inviteBtn.addEventListener("click", invite);
338
- emailInput.addEventListener("keydown", (e) => { if (e.key === "Enter") invite(); });
339
- }
340
-
341
- // Persistent repair affordance: the invite dead-end's "Provision now?" button only
342
- // ever appears as a 409 reaction, so once a repo is `provisioned: true` that path
343
- // can never recur — leaving no self-service way to re-run the same idempotent
344
- // repair (e.g. when the repo's registered webhook has drifted). This button is
345
- // always available, independent of invite state.
346
- const repairBtn = $("repairBtn");
347
- if (repairBtn) {
348
- repairBtn.addEventListener("click", () => provisionStore(repairBtn, {
349
- targetId: "repairMsg",
350
- pendingMessage: "Repairing store connection…",
351
- successHint: "Webhooks re-synced.",
352
- }));
353
- }
354
-
355
- loadMembers();
356
- })();
@@ -1,115 +0,0 @@
1
- /**
2
- * Client behavior for the ToT-STAFF vendor search + enter on /dashboard (#8425).
3
- *
4
- * Served as a STATIC same-origin file (public/) and referenced via
5
- * <script src="/js/dashboard-vendor-search.js">, so the strict production CSP
6
- * allows it via `script-src 'self'` — no nonce, no per-build hash. (An inline
7
- * <script> is blocked: Astro's `is:inline` drops the templated nonce, and a
8
- * processed inline script needs its content-hash pinned in cspStaticHashes on
9
- * every change. An external 'self' file avoids both — mirrors dashboard-team.js.)
10
- *
11
- * Two session-authed, staff-gated endpoints (no server-injected values, so this
12
- * file is fully static):
13
- * GET /api/dashboard/vendor-search?q=<prefix> → { vendors: [{appDomain, displayName}] }
14
- * POST /api/dashboard/enter-vendor {vendorAppDomain} → { ok, redirect } (writes audit)
15
- */
16
- (function () {
17
- const $ = (id) => document.getElementById(id);
18
- const input = $("vendorSearch");
19
- if (!input) return; // non-staff page — nothing to wire.
20
- const results = $("vendorResults");
21
- const msg = $("vendorSearchMsg");
22
-
23
- let seq = 0; // guards against out-of-order responses (last query wins).
24
- let timer = null;
25
-
26
- function showMsg(text, isErr) {
27
- msg.textContent = text || "";
28
- msg.className = isErr ? "err" : "";
29
- }
30
-
31
- function clearResults() {
32
- results.replaceChildren();
33
- }
34
-
35
- function renderResults(vendors) {
36
- clearResults();
37
- if (!vendors || !vendors.length) {
38
- showMsg("No matching vendors.");
39
- return;
40
- }
41
- showMsg("");
42
- for (const v of vendors) {
43
- const li = document.createElement("li");
44
- const btn = document.createElement("button");
45
- btn.type = "button";
46
- btn.dataset.appdomain = v.appDomain;
47
- const dn = document.createElement("span");
48
- dn.className = "dn";
49
- dn.textContent = v.displayName || v.appDomain;
50
- const ad = document.createElement("span");
51
- ad.className = "ad";
52
- ad.textContent = v.appDomain;
53
- btn.appendChild(dn);
54
- btn.appendChild(ad);
55
- btn.addEventListener("click", () => enter(v.appDomain, btn));
56
- li.appendChild(btn);
57
- results.appendChild(li);
58
- }
59
- }
60
-
61
- async function search(q) {
62
- const mine = ++seq;
63
- try {
64
- const res = await fetch("/api/dashboard/vendor-search?q=" + encodeURIComponent(q), {
65
- headers: { accept: "application/json" },
66
- });
67
- if (mine !== seq) return; // a newer query superseded this one.
68
- const body = await res.json().catch(() => ({}));
69
- if (res.ok) {
70
- renderResults(body.vendors);
71
- } else {
72
- clearResults();
73
- showMsg(body.error || "Search failed (HTTP " + res.status + ").", true);
74
- }
75
- } catch (e) {
76
- if (mine !== seq) return;
77
- clearResults();
78
- showMsg("Search failed: " + (e && e.message ? e.message : e), true);
79
- }
80
- }
81
-
82
- async function enter(appDomain, btn) {
83
- if (btn) btn.disabled = true;
84
- showMsg("Entering " + appDomain + "…");
85
- try {
86
- const res = await fetch("/api/dashboard/enter-vendor", {
87
- method: "POST",
88
- headers: { "content-type": "application/json", accept: "application/json" },
89
- body: JSON.stringify({ vendorAppDomain: appDomain }),
90
- });
91
- const body = await res.json().catch(() => ({}));
92
- if (res.ok && body.redirect) {
93
- window.location.assign(body.redirect);
94
- return;
95
- }
96
- showMsg(body.error || "Couldn't enter that vendor (HTTP " + res.status + ").", true);
97
- } catch (e) {
98
- showMsg("Couldn't enter: " + (e && e.message ? e.message : e), true);
99
- } finally {
100
- if (btn) btn.disabled = false;
101
- }
102
- }
103
-
104
- input.addEventListener("input", () => {
105
- const q = input.value.trim();
106
- if (timer) clearTimeout(timer);
107
- if (!q) {
108
- seq++; // cancel any in-flight render.
109
- clearResults();
110
- showMsg("");
111
- return;
112
- }
113
- timer = setTimeout(() => search(q), 200); // debounce keystrokes.
114
- });
115
- })();
@@ -1,26 +0,0 @@
1
- ---
2
- /**
3
- * <AsyncStylesheet> — loads a non-critical stylesheet without blocking render,
4
- * and without FOUC, under the storefront's strict CSP (see lib/content/shared/asyncCss.ts for
5
- * why this can't be the usual `onload="this.rel='stylesheet'"` attribute
6
- * trick). Use for CSS a page doesn't need for first paint — e.g. a below-fold
7
- * section, an optional widget, a print stylesheet's screen equivalent. Do NOT
8
- * use it for chrome/header/nav CSS that must be present before paint to avoid
9
- * a visible flash.
10
- *
11
- * Renders a `<link rel="preload">` tagged for the shared swap script
12
- * (Layout.astro renders `ASYNC_CSS_SWAP_JS` once per page — it flips every
13
- * such link to `rel="stylesheet"` after it's fetched) plus a `<noscript>`
14
- * fallback so the styles still apply with JS disabled.
15
- */
16
- import { ASYNC_CSS_ATTR } from "@/lib/content/shared/asyncCss";
17
-
18
- interface Props {
19
- href: string;
20
- }
21
- const { href } = Astro.props;
22
- const swapAttr = { [ASYNC_CSS_ATTR]: true };
23
- ---
24
-
25
- <link rel="preload" as="style" href={href} {...swapAttr} />
26
- <noscript><link rel="stylesheet" href={href} /></noscript>