@tokenoftrust/storefront-runner 2.0.2 → 2.0.4

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 (254) hide show
  1. package/apps/storefront/.astro/content.d.ts +159 -0
  2. package/apps/storefront/.astro/integrations/_astrojs_cloudflare/cloudflare.d.ts +1 -0
  3. package/apps/storefront/.astro/types.d.ts +3 -0
  4. package/apps/storefront/node_modules/.bin/acorn +43 -0
  5. package/apps/storefront/node_modules/.bin/astro +43 -0
  6. package/apps/storefront/node_modules/.bin/astro-check +43 -0
  7. package/apps/storefront/node_modules/.bin/browserslist +43 -0
  8. package/apps/storefront/node_modules/.bin/cf-wrangler +43 -0
  9. package/apps/storefront/node_modules/.bin/depcruise +43 -0
  10. package/apps/storefront/node_modules/.bin/depcruise-baseline +43 -0
  11. package/apps/storefront/node_modules/.bin/depcruise-fmt +43 -0
  12. package/apps/storefront/node_modules/.bin/depcruise-wrap-stream-in-html +43 -0
  13. package/apps/storefront/node_modules/.bin/dependency-cruise +43 -0
  14. package/apps/storefront/node_modules/.bin/dependency-cruiser +43 -0
  15. package/apps/storefront/node_modules/.bin/drizzle-kit +43 -0
  16. package/apps/storefront/node_modules/.bin/esbuild +43 -0
  17. package/apps/storefront/node_modules/.bin/jiti +43 -0
  18. package/apps/storefront/node_modules/.bin/playwright +43 -0
  19. package/apps/storefront/node_modules/.bin/playwright-core +43 -0
  20. package/apps/storefront/node_modules/.bin/prettier +43 -0
  21. package/apps/storefront/node_modules/.bin/rollup +43 -0
  22. package/apps/storefront/node_modules/.bin/tsc +43 -0
  23. package/apps/storefront/node_modules/.bin/tsserver +43 -0
  24. package/apps/storefront/node_modules/.bin/tsx +43 -0
  25. package/apps/storefront/node_modules/.bin/vite +43 -0
  26. package/apps/storefront/node_modules/.bin/vitest +43 -0
  27. package/apps/storefront/node_modules/.bin/workerd +43 -0
  28. package/apps/storefront/node_modules/.bin/wrangler +43 -0
  29. package/apps/storefront/node_modules/.bin/wrangler2 +43 -0
  30. package/apps/storefront/node_modules/.bin/yaml +43 -0
  31. package/apps/storefront/node_modules/.vite/deps/@astrojs_preact_client__js.js +58 -0
  32. package/apps/storefront/node_modules/.vite/deps/@astrojs_preact_client__js.js.map +1 -0
  33. package/apps/storefront/node_modules/.vite/deps/@astrojs_preact_n_@preact_signals.js +741 -0
  34. package/apps/storefront/node_modules/.vite/deps/@astrojs_preact_n_@preact_signals.js.map +1 -0
  35. package/apps/storefront/node_modules/.vite/deps/@astrojs_preact_server__js.js +2549 -0
  36. package/apps/storefront/node_modules/.vite/deps/@astrojs_preact_server__js.js.map +1 -0
  37. package/apps/storefront/node_modules/.vite/deps/_metadata.json +150 -0
  38. package/apps/storefront/node_modules/.vite/deps/astro-BIHuWFxm.js +434 -0
  39. package/apps/storefront/node_modules/.vite/deps/astro-BIHuWFxm.js.map +1 -0
  40. package/apps/storefront/node_modules/.vite/deps/astro_n_aria-query.js +6390 -0
  41. package/apps/storefront/node_modules/.vite/deps/astro_n_aria-query.js.map +1 -0
  42. package/apps/storefront/node_modules/.vite/deps/astro_n_axobject-query.js +2705 -0
  43. package/apps/storefront/node_modules/.vite/deps/astro_n_axobject-query.js.map +1 -0
  44. package/apps/storefront/node_modules/.vite/deps/astro_n_html-escaper.js +65 -0
  45. package/apps/storefront/node_modules/.vite/deps/astro_n_html-escaper.js.map +1 -0
  46. package/apps/storefront/node_modules/.vite/deps/astro_runtime_client_dev-toolbar_entrypoint__js.js +455 -0
  47. package/apps/storefront/node_modules/.vite/deps/astro_runtime_client_dev-toolbar_entrypoint__js.js.map +1 -0
  48. package/apps/storefront/node_modules/.vite/deps/audit-DKDpcdEI.js +1535 -0
  49. package/apps/storefront/node_modules/.vite/deps/audit-DKDpcdEI.js.map +1 -0
  50. package/apps/storefront/node_modules/.vite/deps/highlight-B9UoX1wa.js +48 -0
  51. package/apps/storefront/node_modules/.vite/deps/highlight-B9UoX1wa.js.map +1 -0
  52. package/apps/storefront/node_modules/.vite/deps/icons-BWi2wI9n.js +42 -0
  53. package/apps/storefront/node_modules/.vite/deps/icons-BWi2wI9n.js.map +1 -0
  54. package/apps/storefront/node_modules/.vite/deps/package.json +3 -0
  55. package/apps/storefront/node_modules/.vite/deps/preact.js +310 -0
  56. package/apps/storefront/node_modules/.vite/deps/preact.js.map +1 -0
  57. package/apps/storefront/node_modules/.vite/deps/preact_compat.js +420 -0
  58. package/apps/storefront/node_modules/.vite/deps/preact_compat.js.map +1 -0
  59. package/apps/storefront/node_modules/.vite/deps/preact_compat_jsx-runtime.js +4 -0
  60. package/apps/storefront/node_modules/.vite/deps/preact_debug.js +236 -0
  61. package/apps/storefront/node_modules/.vite/deps/preact_debug.js.map +1 -0
  62. package/apps/storefront/node_modules/.vite/deps/preact_devtools.js +12 -0
  63. package/apps/storefront/node_modules/.vite/deps/preact_devtools.js.map +1 -0
  64. package/apps/storefront/node_modules/.vite/deps/preact_hooks.js +192 -0
  65. package/apps/storefront/node_modules/.vite/deps/preact_hooks.js.map +1 -0
  66. package/apps/storefront/node_modules/.vite/deps/preact_jsx-dev-runtime.js +3 -0
  67. package/apps/storefront/node_modules/.vite/deps/preact_jsx-runtime.js +92 -0
  68. package/apps/storefront/node_modules/.vite/deps/preact_jsx-runtime.js.map +1 -0
  69. package/apps/storefront/node_modules/.vite/deps/preact_test-utils.js +59 -0
  70. package/apps/storefront/node_modules/.vite/deps/preact_test-utils.js.map +1 -0
  71. package/apps/storefront/node_modules/.vite/deps/rolldown-runtime-BPOCksWG.js +24 -0
  72. package/apps/storefront/node_modules/.vite/deps/settings-BVDV0Roj.js +189 -0
  73. package/apps/storefront/node_modules/.vite/deps/settings-BVDV0Roj.js.map +1 -0
  74. package/apps/storefront/node_modules/.vite/deps/static-html-DveYqwMo.js +13 -0
  75. package/apps/storefront/node_modules/.vite/deps/static-html-DveYqwMo.js.map +1 -0
  76. package/apps/storefront/node_modules/.vite/deps/toolbar-B3VIHCXg.js +458 -0
  77. package/apps/storefront/node_modules/.vite/deps/toolbar-B3VIHCXg.js.map +1 -0
  78. package/apps/storefront/node_modules/.vite/deps/ui-library-BK6ricUd.js +1016 -0
  79. package/apps/storefront/node_modules/.vite/deps/ui-library-BK6ricUd.js.map +1 -0
  80. package/apps/storefront/node_modules/.vite/deps/window-BvxDenKN.js +32 -0
  81. package/apps/storefront/node_modules/.vite/deps/window-BvxDenKN.js.map +1 -0
  82. package/apps/storefront/node_modules/.vite/deps/xray-YFiRUU0Z.js +113 -0
  83. package/apps/storefront/node_modules/.vite/deps/xray-YFiRUU0Z.js.map +1 -0
  84. package/apps/storefront/node_modules/.vite/deps_ssr/_metadata.json +8 -0
  85. package/apps/storefront/node_modules/.vite/deps_ssr/package.json +3 -0
  86. package/apps/storefront/src/layouts/Layout.astro +1 -1
  87. package/apps/storefront/src/lib/apps/registryAccess.ts +45 -0
  88. package/apps/storefront/src/lib/auth/adminEntry.ts +4 -4
  89. package/apps/storefront/src/lib/shared/capability.ts +68 -0
  90. package/apps/storefront/src/lib/shared/developerInvites.ts +1250 -0
  91. package/apps/storefront/src/lib/shared/invitePreflight.ts +123 -0
  92. package/apps/storefront/src/lib/webhooks/deliveryEngine.ts +38 -4
  93. package/apps/storefront/src/lib/webhooks/emit.ts +1 -1
  94. package/apps/storefront/src/lib/webhooks/getDispatcher.ts +1 -1
  95. package/apps/storefront/src/pages/api/auth/magic-exchange.ts +1 -1
  96. package/apps/storefront/src/pages/index.astro +1 -1
  97. package/apps/storefront/src/pages/products/[handle].astro +1 -1
  98. package/package.json +1 -1
  99. package/packages/public-runtime/node_modules/.bin/tsc +43 -0
  100. package/packages/public-runtime/node_modules/.bin/tsserver +43 -0
  101. package/packages/public-runtime/node_modules/.bin/vitest +43 -0
  102. package/pnpm-workspace.yaml +3 -0
  103. package/scripts/lib/tenant-dirs.mjs +80 -0
  104. package/scripts/tenant/lint-embeds.mjs +180 -0
  105. package/scripts/tenant/materialize-tenant-content.mjs +533 -0
  106. package/scripts/tenant/validate.mjs +837 -0
  107. package/apps/storefront/scripts/build-v84-clean-clone-standalone.mjs +0 -68
  108. package/apps/storefront/scripts/deny-v84-clean-clone-standalone-capabilities.mjs +0 -111
  109. package/apps/storefront/scripts/deny-v84-dogfood-capabilities.mjs +0 -2
  110. package/apps/storefront/scripts/deny-v84-lifecycle-capabilities.mjs +0 -247
  111. package/apps/storefront/scripts/dogfood-v84-nonportable-routes.ts +0 -73
  112. package/apps/storefront/scripts/fixed-v84-native-install-producer.ts +0 -79
  113. package/apps/storefront/scripts/generated/v84-clean-clone-replay.bundle.mjs +0 -10982
  114. package/apps/storefront/scripts/import-v84-through-ws2.ts +0 -38
  115. package/apps/storefront/scripts/initialize-v84-lifecycle-tooling-dependency.ts +0 -2
  116. package/apps/storefront/scripts/initialize-v84-lifecycle-tooling.ts +0 -4
  117. package/apps/storefront/scripts/install-v84-native-through-ws1.ts +0 -185
  118. package/apps/storefront/scripts/prove-clone-isolation.ts +0 -506
  119. package/apps/storefront/scripts/replay-v84-clean-clone-pass.ts +0 -148
  120. package/apps/storefront/scripts/replay-v84-clean-clone-standalone.ts +0 -35
  121. package/apps/storefront/scripts/replay-v84-clean-clone.ts +0 -214
  122. package/apps/storefront/scripts/run-fixed-v84-native-install-producer.mjs +0 -18
  123. package/apps/storefront/scripts/run-v84-clone-isolation-proof.mjs +0 -18
  124. package/apps/storefront/scripts/run-v84-clone-lifecycle-proof.mjs +0 -18
  125. package/apps/storefront/scripts/run-v84-import-through-ws2-proof.mjs +0 -17
  126. package/apps/storefront/scripts/run-v84-nonportable-route-dogfood.mjs +0 -15
  127. package/apps/storefront/scripts/sanitize-v84-proof-environment.mjs +0 -21
  128. package/apps/storefront/scripts/v84CleanCloneGraphPin.ts +0 -42
  129. package/apps/storefront/scripts/v84CleanCloneSourceGraph.ts +0 -145
  130. package/apps/storefront/scripts/validate-v84-clone-lifecycle.ts +0 -18
  131. package/apps/storefront/src/components/admin/AdminAIWorkflowsTab.astro +0 -531
  132. package/apps/storefront/src/components/admin/AdminBlogDetailRail.astro +0 -878
  133. package/apps/storefront/src/components/admin/AdminBlogTab.astro +0 -1435
  134. package/apps/storefront/src/components/admin/AdminCheckoutSettingsPanel.astro +0 -226
  135. package/apps/storefront/src/components/admin/AdminCustomersTab.astro +0 -593
  136. package/apps/storefront/src/components/admin/AdminFulfillmentTab.astro +0 -465
  137. package/apps/storefront/src/components/admin/AdminIntegrationsTab.astro +0 -105
  138. package/apps/storefront/src/components/admin/AdminProductsTab.astro +0 -901
  139. package/apps/storefront/src/components/admin/AdminPublishTab.astro +0 -2983
  140. package/apps/storefront/src/components/admin/AdminReportingTab.astro +0 -435
  141. package/apps/storefront/src/components/admin/AdminSettingsTab.astro +0 -782
  142. package/apps/storefront/src/components/admin/AdminSubscriptionsTab.astro +0 -611
  143. package/apps/storefront/src/components/admin/orders/OrdersWorkspace.astro +0 -1223
  144. package/apps/storefront/src/lib/apps/adminService.ts +0 -116
  145. package/apps/storefront/src/lib/apps/adminSession.ts +0 -214
  146. package/apps/storefront/src/lib/apps/apiAuth.ts +0 -91
  147. package/apps/storefront/src/lib/apps/apiRoute.ts +0 -35
  148. package/apps/storefront/src/lib/apps/catalogMapper.ts +0 -39
  149. package/apps/storefront/src/lib/apps/consentConfigStore.ts +0 -228
  150. package/apps/storefront/src/lib/apps/gtmMigrationInstall.ts +0 -447
  151. package/apps/storefront/src/lib/apps/gtmMigrationReport.ts +0 -367
  152. package/apps/storefront/src/lib/apps/gtmMigrationTab.ts +0 -315
  153. package/apps/storefront/src/lib/apps/healthAggregate.ts +0 -66
  154. package/apps/storefront/src/lib/apps/integrationLifecycle.ts +0 -614
  155. package/apps/storefront/src/lib/apps/integrationLifecycleController.ts +0 -125
  156. package/apps/storefront/src/lib/apps/integrationReadModel.ts +0 -563
  157. package/apps/storefront/src/lib/apps/integrationsTab.ts +0 -547
  158. package/apps/storefront/src/lib/apps/integrationsView.ts +0 -106
  159. package/apps/storefront/src/lib/apps/managedAnalyticsService.ts +0 -599
  160. package/apps/storefront/src/lib/apps/tenantIntegrationMaterialization.ts +0 -170
  161. package/apps/storefront/src/lib/apps/tokenIssuer.ts +0 -121
  162. package/apps/storefront/src/lib/apps/tokenVerifier.ts +0 -148
  163. package/apps/storefront/src/lib/apps/v84CleanCloneReplayContext.ts +0 -16
  164. package/apps/storefront/src/lib/apps/v84CloneLifecycleCacheEvidence.ts +0 -105
  165. package/apps/storefront/src/lib/apps/v84CloneLifecycleEvidence.ts +0 -177
  166. package/apps/storefront/src/lib/apps/v84CloneLifecycleMaterialization.ts +0 -251
  167. package/apps/storefront/src/lib/apps/v84CloneLifecycleSemantics.ts +0 -241
  168. package/apps/storefront/src/lib/apps/v84CloneMigrationEvidence.ts +0 -211
  169. package/apps/storefront/src/lib/apps/v84CloneNativeInstallEvidence.ts +0 -409
  170. package/apps/storefront/src/lib/apps/v84NonportableCodeCoaching.ts +0 -368
  171. package/apps/storefront/src/lib/apps/v84NonportableRouteContract.ts +0 -188
  172. package/apps/storefront/src/lib/apps/v84NonportableRouteDogfood.ts +0 -291
  173. package/apps/storefront/src/lib/apps/ws1ManagedAnalyticsClient.ts +0 -95
  174. package/apps/storefront/src/lib/content-edit/applyDiff.ts +0 -91
  175. package/apps/storefront/src/lib/content-edit/client.ts +0 -286
  176. package/apps/storefront/src/lib/content-edit/index.ts +0 -14
  177. package/apps/storefront/src/lib/content-edit/route.ts +0 -25
  178. package/apps/storefront/src/lib/content-edit/types.ts +0 -19
  179. package/apps/storefront/src/lib/dev/cockpitStore.ts +0 -57
  180. package/apps/storefront/src/lib/publish/adminPublishTab.ts +0 -4625
  181. package/apps/storefront/src/lib/publish/apex-readiness.ts +0 -360
  182. package/apps/storefront/src/lib/publish/buildStream.ts +0 -269
  183. package/apps/storefront/src/lib/publish/collapsePersistence.ts +0 -72
  184. package/apps/storefront/src/lib/publish/dispatchHealth.ts +0 -267
  185. package/apps/storefront/src/lib/publish/domainState.ts +0 -360
  186. package/apps/storefront/src/lib/publish/lifecycleState.ts +0 -369
  187. package/apps/storefront/src/lib/publish/liveReleaseSummary.ts +0 -29
  188. package/apps/storefront/src/lib/publish/mergeDoctorOnFailure.ts +0 -78
  189. package/apps/storefront/src/lib/publish/mergeHealthBanner.ts +0 -62
  190. package/apps/storefront/src/lib/publish/mergeRowFindings.ts +0 -124
  191. package/apps/storefront/src/lib/publish/mergeSupportEscalation.ts +0 -75
  192. package/apps/storefront/src/lib/publish/panelPolling.ts +0 -78
  193. package/apps/storefront/src/lib/publish/publish-guard.ts +0 -88
  194. package/apps/storefront/src/lib/publish/publishFormat.ts +0 -165
  195. package/apps/storefront/src/lib/publish/publishHero.ts +0 -177
  196. package/apps/storefront/src/lib/publish/reviewRelease/changeState.ts +0 -66
  197. package/apps/storefront/src/lib/publish/reviewRelease/copy.ts +0 -141
  198. package/apps/storefront/src/lib/publish/reviewRelease/index.ts +0 -41
  199. package/apps/storefront/src/lib/publish/reviewRelease/permissions.ts +0 -47
  200. package/apps/storefront/src/lib/publish/reviewRelease/releaseState.ts +0 -42
  201. package/apps/storefront/src/lib/publish/reviewRelease/types.ts +0 -59
  202. package/apps/storefront/src/lib/publish/reviewRelease/viewModel.ts +0 -440
  203. package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/actions.ts +0 -161
  204. package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/controller.ts +0 -325
  205. package/apps/storefront/src/lib/publish/reviewReleaseWorkspace/render.ts +0 -241
  206. package/apps/storefront/src/lib/publish/shipWorkspace.ts +0 -439
  207. package/apps/storefront/src/lib/publish/sseRoute.ts +0 -119
  208. package/apps/storefront/src/lib/publish/stageBundleUpload.ts +0 -215
  209. package/apps/storefront/src/lib/publish/streamLogConsole.ts +0 -142
  210. package/apps/storefront/src/lib/publish/versionNumber.ts +0 -52
  211. package/apps/storefront/src/pages/admin/ops-timeline.astro +0 -420
  212. package/apps/storefront/src/pages/admin/review-release.astro +0 -265
  213. package/apps/storefront/src/pages/admin/select.astro +0 -96
  214. package/apps/storefront/src/pages/admin.astro +0 -570
  215. package/apps/storefront/src/pages/api/apps/admin/credentials/rotate.ts +0 -86
  216. package/apps/storefront/src/pages/api/apps/admin/gtm-migration-install.ts +0 -174
  217. package/apps/storefront/src/pages/api/apps/admin/gtm-migration.ts +0 -96
  218. package/apps/storefront/src/pages/api/apps/admin/health.ts +0 -44
  219. package/apps/storefront/src/pages/api/apps/admin/install.ts +0 -125
  220. package/apps/storefront/src/pages/api/apps/admin/integration-lifecycle.ts +0 -118
  221. package/apps/storefront/src/pages/api/apps/admin/integrations.ts +0 -89
  222. package/apps/storefront/src/pages/api/apps/admin/list.ts +0 -26
  223. package/apps/storefront/src/pages/api/apps/admin/platform-adapters.ts +0 -85
  224. package/apps/storefront/src/pages/api/apps/admin/resume.ts +0 -79
  225. package/apps/storefront/src/pages/api/apps/admin/suspend.ts +0 -80
  226. package/apps/storefront/src/pages/api/apps/admin/uninstall.ts +0 -98
  227. package/apps/storefront/src/pages/api/apps/admin/update.ts +0 -126
  228. package/apps/storefront/src/pages/api/apps/admin/webhooks/deliveries/[deliveryId]/replay.ts +0 -70
  229. package/apps/storefront/src/pages/api/apps/admin/webhooks/deliveries.ts +0 -51
  230. package/apps/storefront/src/pages/api/apps/internal/order-forward.ts +0 -255
  231. package/apps/storefront/src/pages/api/apps/oauth/token.ts +0 -87
  232. package/apps/storefront/src/pages/api/apps/v1/attribution.ts +0 -162
  233. package/apps/storefront/src/pages/api/apps/v1/catalog/products/[handle].ts +0 -39
  234. package/apps/storefront/src/pages/api/apps/v1/catalog/products.ts +0 -49
  235. package/apps/storefront/src/pages/api/apps/v1/health.ts +0 -32
  236. package/apps/storefront/src/pages/api/apps/v1/inventory.ts +0 -59
  237. package/apps/storefront/src/pages/api/apps/v1/orders/[id].ts +0 -48
  238. package/apps/storefront/src/pages/api/apps/v1/orders.ts +0 -73
  239. package/apps/storefront/src/pages/api/apps/v1/reports.ts +0 -21
  240. package/apps/storefront/src/pages/api/apps/v1/webhooks/deliveries/[deliveryId]/replay.ts +0 -74
  241. package/apps/storefront/src/pages/api/apps/v1/webhooks/deliveries.ts +0 -47
  242. package/apps/storefront/src/pages/api/cache-purge.ts +0 -55
  243. package/apps/storefront/src/pages/api/compliance/tamper.ts +0 -88
  244. package/apps/storefront/src/pages/api/content-edit/ai-edit.ts +0 -164
  245. package/apps/storefront/src/pages/api/dashboard/enter-vendor.ts +0 -154
  246. package/apps/storefront/src/pages/api/dashboard/vendor-search.ts +0 -120
  247. package/apps/storefront/src/pages/api/integrations/v1/[operation].ts +0 -108
  248. package/apps/storefront/src/pages/api/publish/stage-bundle.ts +0 -70
  249. package/apps/storefront/src/pages/api/test/dev-session.ts +0 -133
  250. package/apps/storefront/src/pages/cockpit.astro +0 -1548
  251. package/apps/storefront/src/pages/dashboard/[appDomain]/apps/index.astro +0 -119
  252. package/apps/storefront/src/pages/dashboard/[appDomain]/index.astro +0 -105
  253. package/apps/storefront/src/pages/dashboard/[appDomain]/team.astro +0 -177
  254. package/apps/storefront/src/pages/dashboard/index.astro +0 -160
@@ -1,611 +0,0 @@
1
- ---
2
- /**
3
- * Subscriptions tab - read-only v1. Catalog purchase options are the source of
4
- * truth; lifecycle actions require a later subscription API and audit gates.
5
- */
6
- import { getSubscriptionsViewModel } from "@/lib/admin/services/mock";
7
- import { formatDate } from "@/lib/format";
8
- import type { AdminTenantEnvelope } from "@/lib/admin/envelope";
9
- import type {
10
- SubscriptionAttentionRow,
11
- SubscriptionProgramReadiness,
12
- SubscriptionRenewalState,
13
- SubscriptionSubscriberStatus,
14
- } from "@/lib/admin/viewmodels/subscriptions";
15
-
16
- interface Props {
17
- envelope: AdminTenantEnvelope;
18
- }
19
-
20
- const { envelope } = Astro.props;
21
- const cspNonce = Astro.locals.cspNonce;
22
- const vm = getSubscriptionsViewModel(envelope);
23
- const defaultProgram = vm.programs.find((row) => row.needsAttentionCount > 0) ?? vm.programs[0] ?? null;
24
-
25
- const READINESS_LABEL: Record<SubscriptionProgramReadiness, string> = {
26
- ready: "Ready",
27
- needs_setup: "Needs setup",
28
- blocked: "Blocked",
29
- };
30
-
31
- const READINESS_TONE: Record<SubscriptionProgramReadiness, string> = {
32
- ready: "green",
33
- needs_setup: "amber",
34
- blocked: "red",
35
- };
36
-
37
- const STATUS_LABEL: Record<SubscriptionSubscriberStatus, string> = {
38
- active: "Active",
39
- paused: "Paused",
40
- payment_attention: "Payment attention",
41
- verification_hold: "Verification hold",
42
- };
43
-
44
- const STATUS_TONE: Record<SubscriptionSubscriberStatus, string> = {
45
- active: "green",
46
- paused: "",
47
- payment_attention: "amber",
48
- verification_hold: "red",
49
- };
50
-
51
- const RENEWAL_TONE: Record<SubscriptionRenewalState, string> = {
52
- scheduled: "green",
53
- attention: "amber",
54
- held: "red",
55
- };
56
-
57
- const ATTENTION_KIND_LABEL: Record<SubscriptionAttentionRow["kind"], string> = {
58
- setup_gap: "Setup gap",
59
- verification_hold: "Verification hold",
60
- payment_attention: "Payment attention",
61
- product_blocker: "Product blocker",
62
- };
63
-
64
- function formatMoney(value: number): string {
65
- return `$${value.toFixed(2)}`;
66
- }
67
-
68
- ---
69
-
70
- <section
71
- id="subscriptions"
72
- class="band subscriptions-tab"
73
- aria-labelledby="admin-tab-subscriptions subscriptions-title"
74
- data-admin-panel
75
- data-agent-scope="subscriptions"
76
- role="tabpanel"
77
- data-subscriptions-target-tenant={vm.targetTenant}
78
- data-admin-selected-id={defaultProgram?.id ?? ""}
79
- >
80
- <div class="section-title">
81
- <div>
82
- <h2 id="subscriptions-title">Subscriptions</h2>
83
- <p>Recurring purchase options, subscriber readiness, renewal attention, and checkout payload evidence.</p>
84
- </div>
85
- <div class="actions">
86
- <button class="btn" type="button"><svg><use href="#i-export"></use></svg>Export</button>
87
- <button class="btn" type="button"><svg><use href="#i-refresh"></use></svg>Refresh</button>
88
- <button class="btn primary" type="button"><svg><use href="#i-check"></use></svg>Review setup</button>
89
- </div>
90
- </div>
91
-
92
- <div class="grid cols-4">
93
- <div class="metric"><span>Subscription products</span><strong>{vm.summary.subscriptionProducts}</strong><small>Catalog purchase options</small></div>
94
- <div class="metric"><span>Active subscribers</span><strong>{vm.summary.activeSubscribers}</strong><small>Across available programs</small></div>
95
- <div class="metric"><span>Upcoming renewal value</span><strong>{formatMoney(vm.summary.upcomingRenewalValue)}</strong><small>Scheduled renewals</small></div>
96
- <div class="metric"><span>Needs attention</span><strong>{vm.summary.needsAttention}</strong><small>Setup, payment, or verification</small></div>
97
- </div>
98
-
99
- {vm.attention.length > 0 && (
100
- <div class="panel subscriptions-attention-panel">
101
- <div class="panel-head subscriptions-panel-head">
102
- <h3><svg><use href="#i-alert"></use></svg>Attention Queue</h3>
103
- <span class="chip amber">{vm.attention.length} item{vm.attention.length === 1 ? "" : "s"}</span>
104
- </div>
105
- <div class="panel-body">
106
- <div class="subscriptions-attention-grid">
107
- {vm.attention.slice(0, 4).map((row) => {
108
- const program = vm.detailsById[row.programId];
109
- return (
110
- <div class:list={["subscriptions-attention-card", row.blocking ? "blocking" : ""]}>
111
- <div>
112
- <span class:list={["chip", row.tone]}>{ATTENTION_KIND_LABEL[row.kind]}</span>
113
- <strong>{row.label}</strong>
114
- <p>{row.detail}</p>
115
- </div>
116
- <button class="btn" type="button" data-subscriptions-select-row={row.programId}>
117
- {program ? program.productName : "Open"}
118
- </button>
119
- </div>
120
- );
121
- })}
122
- </div>
123
- </div>
124
- </div>
125
- )}
126
-
127
- <div class="subscriptions-workspace">
128
- <div class="panel subscriptions-list-panel">
129
- <div class="panel-head subscriptions-panel-head">
130
- <h3><svg><use href="#i-refresh"></use></svg>Programs</h3>
131
- <span class="chip teal">{vm.programs.length} recurring option{vm.programs.length === 1 ? "" : "s"}</span>
132
- </div>
133
- <div class="panel-body grid">
134
- <div class="subscriptions-toolbar" aria-label="Subscription controls">
135
- <label class="subscriptions-search">
136
- <span>Search</span>
137
- <input type="search" placeholder="Search products, options, frequency" aria-label="Search subscription programs" data-subscriptions-search />
138
- </label>
139
- <label>
140
- <span>Readiness</span>
141
- <select aria-label="Filter by readiness" data-subscriptions-readiness-select>
142
- <option value="">Any readiness</option>
143
- <option value="ready">Ready</option>
144
- <option value="needs_setup">Needs setup</option>
145
- <option value="blocked">Blocked</option>
146
- </select>
147
- </label>
148
- </div>
149
-
150
- <div class="table-wrap">
151
- <table class="subscriptions-table">
152
- <thead>
153
- <tr>
154
- <th>Program</th>
155
- <th>Frequency</th>
156
- <th>Savings</th>
157
- <th>Readiness</th>
158
- <th>Subscribers</th>
159
- <th>Renewal value</th>
160
- <th class="action">Action</th>
161
- </tr>
162
- </thead>
163
- <tbody data-subscriptions-tbody>
164
- {vm.programs.map((row) => (
165
- <tr
166
- class:list={[{ selected: row.id === defaultProgram?.id }]}
167
- data-subscriptions-row
168
- data-program-id={row.id}
169
- data-readiness={row.readiness}
170
- data-search-haystack={`${row.productName} ${row.optionLabel} ${row.frequency}`.toLowerCase()}
171
- >
172
- <td><strong>{row.productName}</strong><span class="subtle">{row.optionLabel}</span></td>
173
- <td><strong>{row.frequency}</strong></td>
174
- <td><strong>{row.savingsLabel ?? "None"}</strong>{row.priceAdjustmentLabel && <span class="subtle">{row.priceAdjustmentLabel}</span>}</td>
175
- <td>
176
- <span class:list={["chip", READINESS_TONE[row.readiness]]}>{READINESS_LABEL[row.readiness]}</span>
177
- {row.needsAttentionCount > 0 && <span class="subtle">{row.needsAttentionCount} attention</span>}
178
- </td>
179
- <td><strong>{row.subscriberCount}</strong></td>
180
- <td><strong>{formatMoney(row.upcomingRenewalValue)}</strong></td>
181
- <td class="action"><button type="button" class="btn" data-subscriptions-select-row={row.id}>Open</button></td>
182
- </tr>
183
- ))}
184
- </tbody>
185
- </table>
186
- <p class="subscriptions-empty-state" data-subscriptions-empty hidden>No subscription programs match the current filters.</p>
187
- </div>
188
- </div>
189
- </div>
190
-
191
- <aside class="panel subscriptions-detail-panel" aria-labelledby="subscriptions-detail-title" data-subscriptions-detail-root>
192
- {vm.programs.map((row) => {
193
- const detail = vm.detailsById[row.id]!;
194
- return (
195
- <div class="subscriptions-detail-record" data-subscriptions-detail-record={row.id} hidden={row.id !== defaultProgram?.id}>
196
- <div class="panel-head subscriptions-panel-head">
197
- <h3 id={row.id === defaultProgram?.id ? "subscriptions-detail-title" : undefined}><svg><use href="#i-file"></use></svg>{row.optionLabel}</h3>
198
- <span class:list={["chip", READINESS_TONE[row.readiness]]}>{READINESS_LABEL[row.readiness]}</span>
199
- </div>
200
- <div class="panel-body grid">
201
- <div class="subscriptions-detail-meta">
202
- <div><span class="eyebrow">Product</span><strong>{row.productName}</strong></div>
203
- <div><span class="eyebrow">Frequency</span><strong>{row.frequency}</strong></div>
204
- <div><span class="eyebrow">Subscribers</span><strong>{row.subscriberCount}</strong></div>
205
- </div>
206
-
207
- {detail.attention.length > 0 && (
208
- <div class="subscriptions-check-list">
209
- {detail.attention.map((attention) => (
210
- <div class:list={["subscriptions-check-row", attention.blocking ? "blocking" : ""]}>
211
- <div><b>{attention.label}</b><p>{attention.detail}</p></div>
212
- <span class:list={["chip", attention.tone]}>{ATTENTION_KIND_LABEL[attention.kind]}</span>
213
- </div>
214
- ))}
215
- </div>
216
- )}
217
-
218
- <details class="detail-section" open>
219
- <summary class="detail-section-head"><h4>Checkout payload preview</h4><span class="chip">{detail.checkoutFields.length}</span></summary>
220
- <div class="mini-table" role="table" aria-label="Checkout payload preview">
221
- {detail.checkoutFields.map((field) => (
222
- <div class="mini-row payload-row" role="row">
223
- <div role="cell"><span class="eyebrow">Field</span><strong>{field.name}</strong></div>
224
- <div role="cell"><span class="eyebrow">Value</span><strong>{field.value}</strong></div>
225
- </div>
226
- ))}
227
- </div>
228
- </details>
229
-
230
- <details class="detail-section" open={detail.subscribers.length > 0}>
231
- <summary class="detail-section-head"><h4>Linked subscribers</h4><span class="chip">{detail.subscribers.length}</span></summary>
232
- {detail.subscribers.length > 0 ? (
233
- <div class="mini-table" role="table" aria-label="Linked subscribers">
234
- {detail.subscribers.map((subscriber) => (
235
- <div class="mini-row subscriber-row" role="row">
236
- <div role="cell"><strong>{subscriber.customerName}</strong><span class="subtle">{subscriber.email}</span></div>
237
- <div role="cell"><span class:list={["chip", STATUS_TONE[subscriber.status]]}>{STATUS_LABEL[subscriber.status]}</span></div>
238
- <div role="cell"><span class="eyebrow">Next renewal</span><strong>{formatDate(subscriber.nextRenewalAt)}</strong></div>
239
- </div>
240
- ))}
241
- </div>
242
- ) : (
243
- <p class="subscriptions-note">No active subscriber records are linked to this program.</p>
244
- )}
245
- </details>
246
-
247
- <details class="detail-section" open={detail.upcomingRenewals.length > 0}>
248
- <summary class="detail-section-head"><h4>Upcoming renewals</h4><span class="chip">{detail.upcomingRenewals.length}</span></summary>
249
- <div class="subscriptions-renewal-list">
250
- {detail.upcomingRenewals.map((renewal) => (
251
- <div>
252
- <time>{formatDate(renewal.at)}</time>
253
- <div>
254
- <b>{renewal.customerName}</b>
255
- <p>{formatMoney(renewal.amount)} renewal</p>
256
- </div>
257
- <span class:list={["chip", RENEWAL_TONE[renewal.state]]}>{renewal.state}</span>
258
- </div>
259
- ))}
260
- </div>
261
- </details>
262
-
263
- <details class="detail-section">
264
- <summary class="detail-section-head"><h4>Evidence timeline</h4><span class="chip">{detail.evidenceTimeline.length}</span></summary>
265
- <div class="subscriptions-activity-list">
266
- {detail.evidenceTimeline.map((event) => (
267
- <div>
268
- <time>{formatDate(event.at)}</time>
269
- <div><b>{event.title}</b><p>{event.detail}</p></div>
270
- </div>
271
- ))}
272
- </div>
273
- </details>
274
- </div>
275
- </div>
276
- );
277
- })}
278
- </aside>
279
- </div>
280
- </section>
281
-
282
- <script is:inline nonce={cspNonce}>
283
- (() => {
284
- const root = document.querySelector("[data-subscriptions-target-tenant]");
285
- if (!root) return;
286
- const rows = Array.from(root.querySelectorAll("[data-subscriptions-row]"));
287
- const detailRecords = Array.from(root.querySelectorAll("[data-subscriptions-detail-record]"));
288
- const emptyState = root.querySelector("[data-subscriptions-empty]");
289
- const searchInput = root.querySelector("[data-subscriptions-search]");
290
- const readinessSelect = root.querySelector("[data-subscriptions-readiness-select]");
291
-
292
- const selectProgram = (programId) => {
293
- root.dataset.adminSelectedId = programId;
294
- rows.forEach((row) => row.classList.toggle("selected", row.dataset.programId === programId));
295
- detailRecords.forEach((record) => {
296
- record.hidden = record.dataset.subscriptionsDetailRecord !== programId;
297
- });
298
- };
299
-
300
- const applyFilters = () => {
301
- const query = String(searchInput?.value ?? "").trim().toLowerCase();
302
- const readiness = String(readinessSelect?.value ?? "");
303
- let visible = 0;
304
- rows.forEach((row) => {
305
- const matchesSearch = !query || String(row.dataset.searchHaystack ?? "").includes(query);
306
- const matchesReadiness = !readiness || row.dataset.readiness === readiness;
307
- const show = matchesSearch && matchesReadiness;
308
- row.hidden = !show;
309
- if (show) visible += 1;
310
- });
311
- if (emptyState) emptyState.hidden = visible !== 0;
312
- };
313
-
314
- root.querySelectorAll("[data-subscriptions-select-row]").forEach((button) => {
315
- button.addEventListener("click", () => {
316
- const programId = button.dataset.subscriptionsSelectRow;
317
- if (programId) selectProgram(programId);
318
- });
319
- });
320
-
321
- rows.forEach((row) => {
322
- row.addEventListener("click", (event) => {
323
- if (event.target instanceof Element && event.target.closest("[data-subscriptions-select-row]")) return;
324
- const programId = row.dataset.programId;
325
- if (programId) selectProgram(programId);
326
- });
327
- });
328
-
329
- searchInput?.addEventListener("input", applyFilters);
330
- readinessSelect?.addEventListener("change", applyFilters);
331
- applyFilters();
332
- })();
333
- </script>
334
-
335
- <style>
336
- .subscriptions-tab {
337
- --subscriptions-sideout-width: minmax(370px, 0.42fr);
338
- }
339
-
340
- .subscriptions-panel-head {
341
- align-items: center;
342
- }
343
-
344
- .subscriptions-attention-grid {
345
- display: grid;
346
- grid-template-columns: repeat(2, minmax(0, 1fr));
347
- gap: 10px;
348
- }
349
-
350
- .subscriptions-attention-card {
351
- display: flex;
352
- justify-content: space-between;
353
- gap: 12px;
354
- min-width: 0;
355
- padding: 12px;
356
- border: 1px solid var(--admin-line);
357
- border-radius: var(--admin-radius);
358
- background: var(--admin-surface-soft);
359
- }
360
-
361
- .subscriptions-attention-card.blocking {
362
- border-color: #f2c778;
363
- background: #fff8ea;
364
- }
365
-
366
- .subscriptions-attention-card strong,
367
- .subscriptions-attention-card p {
368
- display: block;
369
- margin: 6px 0 0;
370
- }
371
-
372
- .subscriptions-attention-card p,
373
- .subscriptions-note,
374
- .subscriptions-activity-list p,
375
- .subscriptions-renewal-list p,
376
- .subscriptions-check-row p {
377
- color: var(--admin-muted);
378
- font-size: 12px;
379
- }
380
-
381
- .subscriptions-workspace {
382
- display: grid;
383
- grid-template-columns: minmax(0, 1fr) var(--subscriptions-sideout-width);
384
- gap: 14px;
385
- align-items: start;
386
- }
387
-
388
- .subscriptions-detail-panel {
389
- position: sticky;
390
- top: 0;
391
- }
392
-
393
- .subscriptions-toolbar {
394
- display: grid;
395
- grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.28fr);
396
- gap: 10px;
397
- }
398
-
399
- .subscriptions-toolbar label {
400
- display: grid;
401
- gap: 5px;
402
- min-width: 0;
403
- }
404
-
405
- .subscriptions-toolbar span,
406
- .eyebrow {
407
- color: var(--admin-muted);
408
- font-size: 11px;
409
- font-weight: 760;
410
- text-transform: uppercase;
411
- }
412
-
413
- .subscriptions-toolbar input,
414
- .subscriptions-toolbar select {
415
- min-width: 0;
416
- width: 100%;
417
- min-height: 38px;
418
- padding: 0 10px;
419
- border: 1px solid var(--admin-line-strong);
420
- border-radius: var(--admin-radius-sm);
421
- background: var(--admin-surface);
422
- color: var(--admin-ink);
423
- }
424
-
425
- .subscriptions-table {
426
- min-width: 980px;
427
- }
428
-
429
- .subscriptions-table tbody tr {
430
- cursor: pointer;
431
- }
432
-
433
- .subscriptions-table tr.selected td {
434
- background: #eef9f6;
435
- }
436
-
437
- .subscriptions-empty-state {
438
- margin: 0;
439
- padding: 24px 14px;
440
- color: var(--admin-muted);
441
- font-size: 13px;
442
- text-align: center;
443
- }
444
-
445
- .subscriptions-detail-meta {
446
- display: grid;
447
- grid-template-columns: repeat(3, minmax(0, 1fr));
448
- gap: 10px;
449
- }
450
-
451
- .subscriptions-detail-meta > div {
452
- min-width: 0;
453
- padding-bottom: 10px;
454
- border-bottom: 1px solid var(--admin-line);
455
- }
456
-
457
- .subscriptions-detail-meta strong,
458
- .mini-row strong {
459
- display: block;
460
- margin-top: 3px;
461
- overflow-wrap: anywhere;
462
- }
463
-
464
- .subscriptions-check-list,
465
- .subscriptions-activity-list,
466
- .subscriptions-renewal-list {
467
- display: grid;
468
- gap: 10px;
469
- }
470
-
471
- .subscriptions-check-row {
472
- display: grid;
473
- grid-template-columns: minmax(0, 1fr) auto;
474
- gap: 12px;
475
- align-items: center;
476
- padding: 11px 12px;
477
- border: 1px solid var(--admin-line);
478
- border-radius: var(--admin-radius);
479
- background: var(--admin-surface-soft);
480
- }
481
-
482
- .subscriptions-check-row.blocking {
483
- border-color: #f2c778;
484
- background: #fff8ea;
485
- }
486
-
487
- .subscriptions-check-row b,
488
- .subscriptions-renewal-list b,
489
- .subscriptions-activity-list b {
490
- display: block;
491
- }
492
-
493
- .detail-section {
494
- display: grid;
495
- gap: 10px;
496
- padding-top: 2px;
497
- }
498
-
499
- .detail-section + .detail-section {
500
- padding-top: 12px;
501
- border-top: 1px solid var(--admin-line);
502
- }
503
-
504
- .detail-section-head {
505
- display: flex;
506
- align-items: center;
507
- justify-content: space-between;
508
- gap: 10px;
509
- cursor: pointer;
510
- list-style: none;
511
- }
512
-
513
- .detail-section-head::-webkit-details-marker {
514
- display: none;
515
- }
516
-
517
- .detail-section-head h4 {
518
- margin: 0;
519
- font-size: 13px;
520
- }
521
-
522
- .mini-table {
523
- display: grid;
524
- margin-top: 10px;
525
- border: 1px solid var(--admin-line);
526
- border-radius: var(--admin-radius);
527
- overflow: hidden;
528
- }
529
-
530
- .mini-row {
531
- display: grid;
532
- grid-template-columns: minmax(130px, 1.25fr) minmax(120px, 1fr) 110px;
533
- gap: 10px;
534
- align-items: center;
535
- min-height: 58px;
536
- padding: 9px 10px;
537
- border-bottom: 1px solid var(--admin-line);
538
- }
539
-
540
- .mini-row:last-child {
541
- border-bottom: 0;
542
- }
543
-
544
- .payload-row {
545
- grid-template-columns: minmax(130px, 0.8fr) minmax(0, 1fr);
546
- }
547
-
548
- .subscriptions-renewal-list > div {
549
- display: grid;
550
- grid-template-columns: 92px minmax(0, 1fr) auto;
551
- gap: 10px;
552
- align-items: center;
553
- }
554
-
555
- .subscriptions-activity-list > div {
556
- display: grid;
557
- grid-template-columns: 92px minmax(0, 1fr);
558
- gap: 10px;
559
- }
560
-
561
- .subscriptions-renewal-list time,
562
- .subscriptions-activity-list time {
563
- color: var(--admin-muted);
564
- font-size: 12px;
565
- }
566
-
567
- @media (max-width: 1180px) {
568
- .subscriptions-workspace {
569
- grid-template-columns: minmax(0, 1fr);
570
- }
571
-
572
- .subscriptions-detail-panel {
573
- position: static;
574
- }
575
- }
576
-
577
- @media (max-width: 920px) {
578
- .subscriptions-tab .section-title,
579
- .subscriptions-tab .panel-head {
580
- align-items: flex-start;
581
- flex-direction: column;
582
- }
583
-
584
- .subscriptions-tab .grid.cols-4,
585
- .subscriptions-attention-grid {
586
- grid-template-columns: repeat(2, minmax(0, 1fr));
587
- }
588
- }
589
-
590
- @media (max-width: 640px) {
591
- .subscriptions-tab .grid.cols-4,
592
- .subscriptions-attention-grid,
593
- .subscriptions-toolbar,
594
- .subscriptions-detail-meta,
595
- .mini-row,
596
- .payload-row,
597
- .subscriptions-renewal-list > div,
598
- .subscriptions-activity-list > div,
599
- .subscriptions-check-row {
600
- grid-template-columns: 1fr;
601
- }
602
-
603
- .subscriptions-tab .actions {
604
- width: 100%;
605
- }
606
-
607
- .subscriptions-tab .actions .btn {
608
- flex: 1 1 150px;
609
- }
610
- }
611
- </style>