@tokenoftrust/storefront-runner 1.4.1 → 1.4.2-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/apps/storefront/astro.config.mjs +17 -1
  2. package/apps/storefront/integrations/materialize-guard.mjs +56 -0
  3. package/apps/storefront/migrations-apps/0002_good_switch.sql +26 -0
  4. package/apps/storefront/migrations-apps/0003_mute_marauders.sql +12 -0
  5. package/apps/storefront/migrations-apps/meta/0002_snapshot.json +1160 -0
  6. package/apps/storefront/migrations-apps/meta/0003_snapshot.json +1235 -0
  7. package/apps/storefront/migrations-apps/meta/_journal.json +14 -0
  8. package/apps/storefront/public/js/dashboard-team.js +38 -2
  9. package/apps/storefront/src/components/Seo.astro +65 -1
  10. package/apps/storefront/src/components/admin/AdminBlogDetailRail.astro +878 -0
  11. package/apps/storefront/src/components/admin/AdminBlogTab.astro +1432 -0
  12. package/apps/storefront/src/components/admin/AdminCustomersTab.astro +3 -7
  13. package/apps/storefront/src/components/admin/AdminPublishTab.astro +1105 -2334
  14. package/apps/storefront/src/components/admin/AdminSubscriptionsTab.astro +1 -3
  15. package/apps/storefront/src/components/blog/BlogPaywall.astro +87 -0
  16. package/apps/storefront/src/components/blog/PostAccessBadge.astro +43 -0
  17. package/apps/storefront/src/components/blog/PostGrid.astro +57 -0
  18. package/apps/storefront/src/components/blog/ReactionBar.astro +214 -0
  19. package/apps/storefront/src/layouts/Layout.astro +48 -3
  20. package/apps/storefront/src/lib/activity/alerts.ts +17 -19
  21. package/apps/storefront/src/lib/activity/changeActorAttribution.ts +3 -3
  22. package/apps/storefront/src/lib/activity/deployVersion.ts +19 -26
  23. package/apps/storefront/src/lib/activity/ingest.ts +8 -8
  24. package/apps/storefront/src/lib/activity/ingestAuth.ts +1 -1
  25. package/apps/storefront/src/lib/activity/killSwitch.ts +6 -6
  26. package/apps/storefront/src/lib/activity/query.ts +9 -9
  27. package/apps/storefront/src/lib/activity/recordActivity.ts +11 -15
  28. package/apps/storefront/src/lib/activity/store.ts +4 -6
  29. package/apps/storefront/src/lib/activity/uiActor.ts +12 -12
  30. package/apps/storefront/src/lib/activity/workerCommit.ts +6 -6
  31. package/apps/storefront/src/lib/admin/adminShell.ts +290 -0
  32. package/apps/storefront/src/lib/admin/ai/approvalMode.ts +2 -3
  33. package/apps/storefront/src/lib/admin/ai/audit.ts +3 -5
  34. package/apps/storefront/src/lib/admin/checkoutStyleInput.ts +7 -7
  35. package/apps/storefront/src/lib/admin/checkoutStyleTarget.ts +3 -3
  36. package/apps/storefront/src/lib/admin/orderClient.ts +3 -5
  37. package/apps/storefront/src/lib/admin/services/orders.ts +17 -19
  38. package/apps/storefront/src/lib/admin/viewmodels/aiWorkflows.ts +4 -6
  39. package/apps/storefront/src/lib/admin/viewmodels/settings.ts +1 -1
  40. package/apps/storefront/src/lib/apps/adminService.ts +4 -4
  41. package/apps/storefront/src/lib/apps/adminSession.ts +53 -44
  42. package/apps/storefront/src/lib/apps/apiAuth.ts +2 -2
  43. package/apps/storefront/src/lib/apps/apiRoute.ts +2 -2
  44. package/apps/storefront/src/lib/apps/catalogMapper.ts +1 -1
  45. package/apps/storefront/src/lib/apps/credentials.ts +2 -2
  46. package/apps/storefront/src/lib/apps/gatewayKeys.ts +4 -4
  47. package/apps/storefront/src/lib/apps/healthAggregate.ts +5 -5
  48. package/apps/storefront/src/lib/apps/orders/attributionService.ts +2 -2
  49. package/apps/storefront/src/lib/apps/orders/customerHash.ts +1 -1
  50. package/apps/storefront/src/lib/apps/orders/foxyOrderClient.ts +12 -12
  51. package/apps/storefront/src/lib/apps/orders/idempotency.ts +7 -7
  52. package/apps/storefront/src/lib/apps/orders/orderForwardReceiver.ts +1 -1
  53. package/apps/storefront/src/lib/apps/orders/orderMapper.ts +2 -2
  54. package/apps/storefront/src/lib/apps/orders/ordersStore.ts +6 -6
  55. package/apps/storefront/src/lib/apps/registryService.ts +6 -6
  56. package/apps/storefront/src/lib/apps/scopes.ts +2 -2
  57. package/apps/storefront/src/lib/apps/tokenIssuer.ts +4 -4
  58. package/apps/storefront/src/lib/apps/tokenVerifier.ts +6 -6
  59. package/apps/storefront/src/lib/apps/widgets/eligibility.ts +2 -2
  60. package/apps/storefront/src/lib/apps/widgets/frameProps.ts +3 -3
  61. package/apps/storefront/src/lib/apps/widgets/launchToken.ts +4 -4
  62. package/apps/storefront/src/lib/apps/widgets/placements.ts +2 -2
  63. package/apps/storefront/src/lib/apps/widgets/renderSlot.ts +1 -1
  64. package/apps/storefront/src/lib/auth/adminEntry.ts +9 -9
  65. package/apps/storefront/src/lib/auth/identityToken.ts +6 -14
  66. package/apps/storefront/src/lib/auth/loginGate.ts +75 -13
  67. package/apps/storefront/src/lib/auth/mcpClientAssertion.ts +2 -4
  68. package/apps/storefront/src/lib/auth/operatorSession.ts +113 -0
  69. package/apps/storefront/src/lib/auth/session.ts +7 -8
  70. package/apps/storefront/src/lib/auth/totAccessClient.ts +8 -18
  71. package/apps/storefront/src/lib/basePath.ts +9 -2
  72. package/apps/storefront/src/lib/blog/access.ts +29 -0
  73. package/apps/storefront/src/lib/blog/collection.ts +313 -0
  74. package/apps/storefront/src/lib/blog/markdown.ts +174 -0
  75. package/apps/storefront/src/lib/blog/provider.ts +5 -0
  76. package/apps/storefront/src/lib/blog/reactions.ts +87 -0
  77. package/apps/storefront/src/lib/blog/rss.ts +92 -0
  78. package/apps/storefront/src/lib/blog/teaser.ts +83 -0
  79. package/apps/storefront/src/lib/blog/types.ts +34 -0
  80. package/apps/storefront/src/lib/blog/viewCounts.ts +243 -0
  81. package/apps/storefront/src/lib/d1/catalog.ts +2 -2
  82. package/apps/storefront/src/lib/d1/schema-apps.ts +96 -17
  83. package/apps/storefront/src/lib/dev/activityIngestToken.ts +2 -4
  84. package/apps/storefront/src/lib/dev/activityStore.ts +3 -5
  85. package/apps/storefront/src/lib/dev/apiBase.ts +1 -4
  86. package/apps/storefront/src/lib/dev/cockpitStore.ts +1 -9
  87. package/apps/storefront/src/lib/dev/devDraft.ts +1 -1
  88. package/apps/storefront/src/lib/dev/previewStatus.ts +9 -21
  89. package/apps/storefront/src/lib/dev/rendezvousBroker.ts +9 -24
  90. package/apps/storefront/src/lib/edgeCache.ts +17 -0
  91. package/apps/storefront/src/lib/http/fetchTransport.ts +63 -0
  92. package/apps/storefront/src/lib/i18n.ts +25 -0
  93. package/apps/storefront/src/lib/jsonld.ts +118 -0
  94. package/apps/storefront/src/lib/monitoring/manifest.ts +11 -11
  95. package/apps/storefront/src/lib/newsletter/confirmationEmail.ts +30 -0
  96. package/apps/storefront/src/lib/newsletter/consent.ts +23 -0
  97. package/apps/storefront/src/lib/newsletter/digest.ts +117 -0
  98. package/apps/storefront/src/lib/newsletter/resendClient.ts +79 -0
  99. package/apps/storefront/src/lib/newsletter/send.ts +265 -0
  100. package/apps/storefront/src/lib/newsletter/subscribers.ts +156 -0
  101. package/apps/storefront/src/lib/publish/adminPublishTab.ts +3519 -0
  102. package/apps/storefront/src/lib/publish/apex-readiness.ts +41 -18
  103. package/apps/storefront/src/lib/publish/dispatchHealth.ts +5 -7
  104. package/apps/storefront/src/lib/publish/domainState.ts +22 -13
  105. package/apps/storefront/src/lib/publish/panelPolling.ts +78 -0
  106. package/apps/storefront/src/lib/publish/shipWorkspace.ts +100 -49
  107. package/apps/storefront/src/lib/publish/stageBundleUpload.ts +215 -0
  108. package/apps/storefront/src/lib/rate/kvWindow.ts +53 -0
  109. package/apps/storefront/src/lib/search/index.ts +2 -2
  110. package/apps/storefront/src/lib/seo/alternates.ts +42 -0
  111. package/apps/storefront/src/lib/seo/meta.ts +65 -0
  112. package/apps/storefront/src/lib/social/golive.ts +212 -0
  113. package/apps/storefront/src/lib/social/notify.ts +32 -0
  114. package/apps/storefront/src/lib/social/tokenStore.ts +171 -0
  115. package/apps/storefront/src/lib/the-build/provider.ts +27 -0
  116. package/apps/storefront/src/lib/the-build/readingTime.ts +35 -0
  117. package/apps/storefront/src/lib/the-build/toc.ts +95 -0
  118. package/apps/storefront/src/lib/tot/ToTClient.ts +1 -1
  119. package/apps/storefront/src/lib/tot/d1Client.ts +2 -2
  120. package/apps/storefront/src/lib/tot/totClientInterface.ts +3 -4
  121. package/apps/storefront/src/lib/webhooks/deliveryStore.ts +16 -17
  122. package/apps/storefront/src/middleware/index.ts +113 -2
  123. package/apps/storefront/src/pages/admin.astro +10 -1312
  124. package/apps/storefront/src/pages/api/blog/[collection]/[slug]/react.ts +104 -0
  125. package/apps/storefront/src/pages/api/newsletter/[collection]/subscribe.ts +146 -0
  126. package/apps/storefront/src/pages/api/newsletter/confirm.ts +75 -0
  127. package/apps/storefront/src/pages/api/newsletter/unsubscribe.ts +90 -0
  128. package/apps/storefront/src/pages/api/publish/stage-bundle.ts +70 -0
  129. package/apps/storefront/src/pages/api/rum/vitals.ts +21 -2
  130. package/apps/storefront/src/pages/blog/[slug].astro +96 -16
  131. package/apps/storefront/src/pages/blog/author/[author].astro +140 -0
  132. package/apps/storefront/src/pages/blog/category/[category].astro +67 -0
  133. package/apps/storefront/src/pages/blog/index.astro +2 -0
  134. package/apps/storefront/src/pages/blog/tag/[tag].astro +65 -0
  135. package/apps/storefront/src/pages/cockpit.astro +37 -12
  136. package/apps/storefront/src/pages/dashboard/[appDomain]/team.astro +15 -11
  137. package/apps/storefront/src/pages/search.astro +1 -1
  138. package/apps/storefront/src/pages/sitemap.xml.ts +20 -0
  139. package/apps/storefront/src/pages/the-build/[slug].astro +129 -0
  140. package/apps/storefront/src/pages/the-build/index.astro +146 -0
  141. package/apps/storefront/src/pages/the-build/rss.xml.ts +33 -0
  142. package/apps/storefront/src/styles/admin.css +1080 -0
  143. package/apps/storefront/tsconfig.json +5 -0
  144. package/package.json +1 -1
  145. package/packages/public-runtime/package.json +1 -0
  146. package/packages/public-runtime/src/activity/catalog.ts +52 -0
  147. package/packages/public-runtime/src/catalog-d1.ts +1 -1
  148. package/packages/public-runtime/src/customization-preview.ts +25 -2
  149. package/packages/public-runtime/src/customization-runtime.ts +125 -3
  150. package/packages/public-runtime/src/customization-versioning.ts +10 -0
  151. package/packages/public-runtime/src/index.ts +1 -0
  152. package/packages/public-runtime/src/static-bundle.ts +357 -0
  153. package/packages/public-runtime/src/tenant.ts +36 -8
  154. package/scripts/build/copy-tenant-assets.mjs +14 -4
  155. package/scripts/dev/ai-edit.mjs +1 -1
  156. package/scripts/dev/checkout-watch.mjs +2 -2
  157. package/scripts/dev/file-browser.mjs +2 -4
  158. package/scripts/dev/file-writer.mjs +1 -1
  159. package/scripts/dev/git-status.mjs +2 -2
  160. package/scripts/dev/locate-handler.mjs +3 -3
  161. package/scripts/dev/port-check.mjs +3 -3
  162. package/scripts/dev/publish.mjs +5 -9
  163. package/scripts/dev/shot.mjs +1 -1
  164. package/scripts/dev/unified-diff.mjs +8 -3
  165. package/scripts/tot-dev.mjs +6 -9
  166. package/apps/storefront/src/lib/dev/vcBinding.ts +0 -80
@@ -37,11 +37,13 @@ import OrdersWorkspace from "../components/admin/orders/OrdersWorkspace.astro";
37
37
  import AdminProductsTab from "../components/admin/AdminProductsTab.astro";
38
38
  import AdminSubscriptionsTab from "../components/admin/AdminSubscriptionsTab.astro";
39
39
  import AdminReportingTab from "../components/admin/AdminReportingTab.astro";
40
+ import AdminBlogTab from "../components/admin/AdminBlogTab.astro";
40
41
  import AdminPublishTab from "../components/admin/AdminPublishTab.astro";
41
42
  import AdminSettingsTab from "../components/admin/AdminSettingsTab.astro";
42
43
  import { readViewerSession } from "@/lib/auth/route";
43
44
  import { resolveAdminTenantMode } from "@/lib/adminTenantEnvelope";
44
45
  import { resolveAdminEntry } from "@/lib/auth/adminEntry";
46
+ import "@/styles/admin.css";
45
47
 
46
48
  const { tenant, basePath, cspNonce } = Astro.locals;
47
49
  const adminPath = `${basePath || ""}/admin`;
@@ -100,7 +102,7 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
100
102
  <title>{tenantLabel} Admin</title>
101
103
  <script is:inline nonce={cspNonce}>
102
104
  (() => {
103
- const adminTabs = ["orders", "products", "subscriptions", "customers", "fulfillment", "reporting", "ai-workflows", "publish", "settings"];
105
+ const adminTabs = ["orders", "products", "subscriptions", "customers", "fulfillment", "reporting", "ai-workflows", "blog", "publish", "settings"];
104
106
  const canViewInternalGuide = document.documentElement.dataset.internalAdminGuide === "true";
105
107
  const defaultTab = canViewInternalGuide ? "orders" : "settings";
106
108
  // A deep link may carry a query suffix in the hash (e.g. #publish?pr=42);
@@ -114,1078 +116,6 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
114
116
  document.documentElement.dataset.adminMode = mode;
115
117
  })();
116
118
  </script>
117
- <style is:global nonce={cspNonce}>
118
- :root {
119
- color-scheme: light;
120
- --admin-bg: #f5f7f6;
121
- --admin-surface: #ffffff;
122
- --admin-surface-soft: #f9fbfa;
123
- --admin-surface-tint: #eef6f4;
124
- --admin-ink: #16211f;
125
- --admin-muted: #64716d;
126
- --admin-muted-2: #8c9894;
127
- --admin-line: #dce5e2;
128
- --admin-line-strong: #bdcbc7;
129
- --admin-teal: #007f79;
130
- --admin-teal-dark: #005d58;
131
- --admin-teal-soft: #dff4f1;
132
- --admin-green: #137a55;
133
- --admin-green-soft: #e3f5eb;
134
- --admin-blue: #2458c7;
135
- --admin-blue-soft: #e7efff;
136
- --admin-amber: #a45d00;
137
- --admin-amber-soft: #fff0d5;
138
- --admin-red: #b42318;
139
- --admin-red-soft: #fde7e4;
140
- --admin-violet: #6941c6;
141
- --admin-violet-soft: #efe9ff;
142
- --admin-shadow: 0 18px 50px rgba(23, 33, 31, 0.08);
143
- --admin-radius: 8px;
144
- --admin-radius-sm: 6px;
145
- --admin-scroll-offset: 104px;
146
- --admin-font:
147
- Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
148
- "Segoe UI", sans-serif;
149
- }
150
-
151
- * {
152
- box-sizing: border-box;
153
- }
154
-
155
- html {
156
- max-width: 100%;
157
- height: 100%;
158
- overflow: hidden;
159
- }
160
-
161
- body {
162
- margin: 0;
163
- height: 100%;
164
- min-height: 100vh;
165
- background: var(--admin-bg);
166
- color: var(--admin-ink);
167
- font: 14px/1.5 var(--admin-font);
168
- overflow: hidden;
169
- }
170
-
171
- button,
172
- input,
173
- select {
174
- font: inherit;
175
- }
176
-
177
- button {
178
- cursor: pointer;
179
- }
180
-
181
- svg {
182
- width: 18px;
183
- height: 18px;
184
- stroke: currentColor;
185
- stroke-width: 1.9;
186
- stroke-linecap: round;
187
- stroke-linejoin: round;
188
- fill: none;
189
- flex: 0 0 auto;
190
- }
191
-
192
- .shell {
193
- display: grid;
194
- grid-template-columns: 248px minmax(0, 1fr);
195
- height: 100vh;
196
- min-height: 0;
197
- overflow: hidden;
198
- }
199
-
200
- .sidebar {
201
- position: sticky;
202
- top: 0;
203
- height: 100vh;
204
- min-height: 0;
205
- display: flex;
206
- flex-direction: column;
207
- gap: 22px;
208
- padding: 20px 16px;
209
- overflow-y: auto;
210
- overscroll-behavior: contain;
211
- background: #101b18;
212
- color: #eef7f5;
213
- }
214
-
215
- .brand {
216
- display: flex;
217
- align-items: center;
218
- gap: 12px;
219
- min-height: 42px;
220
- }
221
-
222
- .brand-mark {
223
- width: 36px;
224
- height: 36px;
225
- display: grid;
226
- place-items: center;
227
- border-radius: var(--admin-radius);
228
- background: #00a991;
229
- color: #06231e;
230
- font-weight: 800;
231
- }
232
-
233
- .brand b,
234
- .store strong {
235
- display: block;
236
- font-size: 14px;
237
- line-height: 1.1;
238
- }
239
-
240
- .brand span,
241
- .store span {
242
- display: block;
243
- margin-top: 3px;
244
- color: rgba(238, 247, 245, 0.7);
245
- font-size: 12px;
246
- }
247
-
248
- .store {
249
- display: grid;
250
- gap: 4px;
251
- padding: 12px;
252
- border: 1px solid rgba(255, 255, 255, 0.12);
253
- border-radius: var(--admin-radius);
254
- background: rgba(255, 255, 255, 0.06);
255
- }
256
-
257
- /* Cross-surface hop to the developer cockpit — same card language as the
258
- sidebar's other blocks, kept visually quieter than the nav tabs. */
259
- .cockpit-link {
260
- display: flex;
261
- align-items: center;
262
- gap: 8px;
263
- padding: 10px 12px;
264
- border: 1px solid rgba(255, 255, 255, 0.12);
265
- border-radius: var(--admin-radius);
266
- background: rgba(255, 255, 255, 0.04);
267
- color: rgba(238, 247, 245, 0.85);
268
- font-size: 13px;
269
- text-decoration: none;
270
- }
271
- .cockpit-link:hover {
272
- background: rgba(255, 255, 255, 0.1);
273
- color: #fff;
274
- }
275
- .cockpit-link svg {
276
- width: 15px;
277
- height: 15px;
278
- stroke: currentColor;
279
- fill: none;
280
- }
281
-
282
- /* Signed-in-as chip (identity visibility — Trello 13075 postscript: an
283
- owner staring at a read-only Publish tab could not tell WHO the shell
284
- thought they were). Mirrors .store's card language; the standing line
285
- states the resolved principal FOR THIS STORE, not a global role. */
286
- .account {
287
- display: grid;
288
- grid-template-columns: auto 1fr;
289
- gap: 10px;
290
- align-items: center;
291
- padding: 12px;
292
- border: 1px solid rgba(255, 255, 255, 0.12);
293
- border-radius: var(--admin-radius);
294
- background: rgba(255, 255, 255, 0.06);
295
- /* Pinned to the sidebar's lower-left (the conventional account slot) —
296
- the sidebar is a flex column, so this soaks the remaining space. */
297
- margin-top: auto;
298
- }
299
- .account .account-avatar {
300
- display: grid;
301
- place-items: center;
302
- width: 32px;
303
- height: 32px;
304
- border-radius: 50%;
305
- border: 1px solid rgba(255, 255, 255, 0.2);
306
- background: rgba(255, 255, 255, 0.08);
307
- }
308
- .account .account-avatar svg {
309
- width: 16px;
310
- height: 16px;
311
- stroke: currentColor;
312
- fill: none;
313
- stroke-width: 1.8;
314
- }
315
- .account .account-meta {
316
- display: grid;
317
- gap: 2px;
318
- min-width: 0;
319
- }
320
- .account .account-email {
321
- font-weight: 640;
322
- font-size: 13px;
323
- overflow: hidden;
324
- text-overflow: ellipsis;
325
- white-space: nowrap;
326
- }
327
- .account .account-standing {
328
- color: rgba(238, 247, 245, 0.7);
329
- font-size: 11px;
330
- }
331
- .account .account-standing[data-standing="none"] {
332
- color: rgba(255, 196, 120, 0.9);
333
- }
334
- .account a {
335
- color: inherit;
336
- }
337
- .account .account-signout button {
338
- margin-top: 2px;
339
- padding: 0;
340
- border: 0;
341
- background: none;
342
- color: rgba(238, 247, 245, 0.6);
343
- font-size: 11px;
344
- text-decoration: underline;
345
- cursor: pointer;
346
- }
347
- .account .account-signout button:hover {
348
- color: rgba(238, 247, 245, 0.9);
349
- }
350
-
351
- .tenant-picker {
352
- display: grid;
353
- gap: 4px;
354
- padding: 10px 12px;
355
- border: 1px solid rgba(0, 169, 145, 0.4);
356
- border-radius: var(--admin-radius);
357
- background: rgba(0, 169, 145, 0.1);
358
- }
359
-
360
- .tenant-picker label {
361
- color: rgba(238, 247, 245, 0.7);
362
- font-size: 11px;
363
- font-weight: 760;
364
- text-transform: uppercase;
365
- }
366
-
367
- .tenant-picker select {
368
- min-height: 34px;
369
- border: 1px solid rgba(255, 255, 255, 0.2);
370
- border-radius: var(--admin-radius-sm);
371
- background: #101b18;
372
- color: #eef7f5;
373
- }
374
-
375
- .tenant-picker-denied {
376
- padding: 10px 12px;
377
- border: 1px solid var(--admin-amber);
378
- border-radius: var(--admin-radius);
379
- background: rgba(164, 93, 0, 0.16);
380
- color: #eef7f5;
381
- font-size: 12px;
382
- }
383
-
384
- .tenant-picker-denied code {
385
- font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
386
- }
387
-
388
- .nav {
389
- display: grid;
390
- gap: 4px;
391
- }
392
-
393
- .nav a {
394
- display: flex;
395
- align-items: center;
396
- gap: 10px;
397
- min-height: 40px;
398
- padding: 0 10px;
399
- border-radius: var(--admin-radius-sm);
400
- color: rgba(238, 247, 245, 0.74);
401
- text-decoration: none;
402
- }
403
-
404
- .nav a.active {
405
- background: rgba(0, 169, 145, 0.18);
406
- color: #ffffff;
407
- }
408
-
409
- .nav-group {
410
- display: grid;
411
- gap: 3px;
412
- }
413
-
414
- .nav-subnav {
415
- display: grid;
416
- gap: 2px;
417
- margin: 0 0 3px 28px;
418
- padding-left: 10px;
419
- border-left: 1px solid rgba(255, 255, 255, 0.14);
420
- }
421
-
422
- .nav-subnav a {
423
- min-height: 32px;
424
- padding: 0 8px;
425
- gap: 8px;
426
- font-size: 12px;
427
- }
428
-
429
- .nav-subnav svg {
430
- width: 16px;
431
- height: 16px;
432
- }
433
-
434
- .health {
435
- margin-top: auto;
436
- display: grid;
437
- gap: 9px;
438
- padding: 12px;
439
- border: 1px solid rgba(255, 255, 255, 0.12);
440
- border-radius: var(--admin-radius);
441
- background: rgba(255, 255, 255, 0.05);
442
- }
443
-
444
- .health-row {
445
- display: flex;
446
- align-items: center;
447
- justify-content: space-between;
448
- gap: 10px;
449
- font-size: 12px;
450
- color: rgba(238, 247, 245, 0.72);
451
- }
452
-
453
- .health-row strong {
454
- color: #ffffff;
455
- }
456
-
457
- .main {
458
- min-width: 0;
459
- min-height: 0;
460
- height: 100vh;
461
- overflow-x: hidden;
462
- overflow-y: auto;
463
- overscroll-behavior: contain;
464
- }
465
-
466
- .content,
467
- .band,
468
- .panel,
469
- .panel-body,
470
- .table-wrap {
471
- min-width: 0;
472
- max-width: 100%;
473
- }
474
-
475
- .topbar {
476
- position: sticky;
477
- top: 0;
478
- z-index: 30;
479
- display: flex;
480
- align-items: center;
481
- justify-content: space-between;
482
- gap: 18px;
483
- min-height: 68px;
484
- padding: 14px 24px;
485
- border-bottom: 1px solid var(--admin-line);
486
- background: rgba(245, 247, 246, 0.94);
487
- backdrop-filter: blur(16px);
488
- }
489
-
490
- .page-title h1 {
491
- margin: 0;
492
- font-size: 22px;
493
- font-weight: 760;
494
- }
495
-
496
- .page-title p {
497
- margin: 2px 0 0;
498
- color: var(--admin-muted);
499
- font-size: 13px;
500
- }
501
-
502
- .page-title,
503
- .page-title p,
504
- .note,
505
- code {
506
- min-width: 0;
507
- overflow-wrap: anywhere;
508
- }
509
-
510
- .actions {
511
- display: flex;
512
- flex-wrap: wrap;
513
- gap: 8px;
514
- }
515
-
516
- .btn,
517
- .icon-btn {
518
- min-height: 38px;
519
- display: inline-flex;
520
- align-items: center;
521
- justify-content: center;
522
- gap: 8px;
523
- border: 1px solid var(--admin-line-strong);
524
- border-radius: var(--admin-radius-sm);
525
- background: var(--admin-surface);
526
- color: var(--admin-ink);
527
- text-decoration: none;
528
- white-space: nowrap;
529
- }
530
-
531
- .btn {
532
- padding: 0 13px;
533
- font-weight: 680;
534
- max-width: 100%;
535
- }
536
-
537
- .icon-btn {
538
- width: 38px;
539
- padding: 0;
540
- }
541
-
542
- .btn.primary {
543
- border-color: var(--admin-teal-dark);
544
- background: var(--admin-teal);
545
- color: #ffffff;
546
- }
547
-
548
- .floating-ask {
549
- position: fixed;
550
- right: 24px;
551
- bottom: 24px;
552
- z-index: 80;
553
- min-height: 58px;
554
- max-width: min(280px, calc(100vw - 32px));
555
- display: inline-flex;
556
- align-items: center;
557
- gap: 10px;
558
- padding: 9px 15px 9px 10px;
559
- border: 1px solid rgba(0, 93, 88, 0.24);
560
- border-radius: 999px;
561
- background: var(--admin-teal);
562
- color: #ffffff;
563
- box-shadow: 0 16px 38px rgba(22, 33, 31, 0.22);
564
- }
565
-
566
- .floating-ask-icon {
567
- width: 40px;
568
- height: 40px;
569
- display: grid;
570
- place-items: center;
571
- border-radius: 50%;
572
- background: rgba(255, 255, 255, 0.16);
573
- }
574
-
575
- .floating-ask-label {
576
- display: grid;
577
- gap: 1px;
578
- min-width: 0;
579
- text-align: left;
580
- }
581
-
582
- .floating-ask-label strong {
583
- font-size: 14px;
584
- line-height: 1.1;
585
- }
586
-
587
- .floating-ask-label small {
588
- max-width: 160px;
589
- overflow: hidden;
590
- color: rgba(255, 255, 255, 0.78);
591
- font-size: 11px;
592
- font-weight: 680;
593
- line-height: 1.2;
594
- text-overflow: ellipsis;
595
- white-space: nowrap;
596
- }
597
-
598
- .content {
599
- display: grid;
600
- grid-template-columns: minmax(0, 1fr);
601
- gap: 18px;
602
- padding: 20px 24px 40px;
603
- }
604
-
605
- .band {
606
- display: grid;
607
- grid-template-columns: minmax(0, 1fr);
608
- gap: 14px;
609
- }
610
-
611
- [data-admin-panel],
612
- [data-admin-guide-section] {
613
- scroll-margin-top: var(--admin-scroll-offset);
614
- }
615
-
616
- html.admin-tabs-ready [data-admin-panel] {
617
- display: none;
618
- }
619
-
620
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="orders"] #orders,
621
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="products"] #products,
622
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="subscriptions"] #subscriptions,
623
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="customers"] #customers,
624
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="fulfillment"] #fulfillment,
625
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="reporting"] #reporting,
626
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="ai-workflows"] #ai-workflows,
627
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="publish"] #publish,
628
- html.admin-tabs-ready[data-admin-mode="work-area"][data-admin-tab="settings"] #settings {
629
- display: grid;
630
- }
631
-
632
- html.admin-tabs-ready[data-admin-mode="work-area"] [data-admin-guide-section],
633
- html.admin-tabs-ready[data-admin-mode="work-area"] [data-admin-tab-help] {
634
- display: none;
635
- }
636
-
637
- html[data-internal-admin-guide="false"] [data-admin-internal-only] {
638
- display: none !important;
639
- }
640
-
641
- .section-title {
642
- display: flex;
643
- align-items: center;
644
- justify-content: space-between;
645
- gap: 12px;
646
- }
647
-
648
- .section-title h2 {
649
- margin: 0;
650
- font-size: 16px;
651
- }
652
-
653
- .section-title p {
654
- margin: 4px 0 0;
655
- color: var(--admin-muted);
656
- font-size: 13px;
657
- }
658
-
659
- .grid {
660
- display: grid;
661
- grid-template-columns: minmax(0, 1fr);
662
- gap: 12px;
663
- }
664
-
665
- .grid.cols-2 {
666
- grid-template-columns: repeat(2, minmax(0, 1fr));
667
- }
668
-
669
- .grid.cols-3 {
670
- grid-template-columns: repeat(3, minmax(0, 1fr));
671
- }
672
-
673
- .grid.cols-4 {
674
- grid-template-columns: repeat(4, minmax(0, 1fr));
675
- }
676
-
677
- .panel {
678
- border: 1px solid var(--admin-line);
679
- border-radius: var(--admin-radius);
680
- background: var(--admin-surface);
681
- }
682
-
683
- .panel-head {
684
- display: flex;
685
- align-items: center;
686
- justify-content: space-between;
687
- gap: 12px;
688
- min-height: 50px;
689
- padding: 13px 14px;
690
- border-bottom: 1px solid var(--admin-line);
691
- }
692
-
693
- .panel-head h3 {
694
- margin: 0;
695
- display: flex;
696
- align-items: center;
697
- gap: 8px;
698
- font-size: 15px;
699
- }
700
-
701
- .panel-body {
702
- display: grid;
703
- grid-template-columns: minmax(0, 1fr);
704
- gap: 12px;
705
- padding: 14px;
706
- }
707
-
708
- .metric {
709
- min-height: 84px;
710
- padding: 14px;
711
- border: 1px solid var(--admin-line);
712
- border-radius: var(--admin-radius);
713
- background: var(--admin-surface);
714
- }
715
-
716
- .metric span,
717
- .field label {
718
- display: block;
719
- color: var(--admin-muted);
720
- font-size: 11px;
721
- font-weight: 760;
722
- text-transform: uppercase;
723
- }
724
-
725
- .metric strong {
726
- display: block;
727
- margin-top: 9px;
728
- font-size: 24px;
729
- }
730
-
731
- .metric small {
732
- display: block;
733
- margin-top: 3px;
734
- color: var(--admin-muted);
735
- font-size: 12px;
736
- }
737
-
738
- .chip {
739
- display: inline-flex;
740
- align-items: center;
741
- gap: 5px;
742
- min-height: 23px;
743
- padding: 0 8px;
744
- border-radius: 999px;
745
- background: var(--admin-surface-tint);
746
- color: #3f4d49;
747
- font-size: 12px;
748
- font-weight: 740;
749
- white-space: nowrap;
750
- }
751
-
752
- .chip.green {
753
- background: var(--admin-green-soft);
754
- color: var(--admin-green);
755
- }
756
-
757
- .chip.teal {
758
- background: var(--admin-teal-soft);
759
- /* Slightly darker than --admin-teal (#007f79): the shared token only
760
- reaches ~4.26:1 against --admin-teal-soft, just under WCAG AA's
761
- 4.5:1 for this chip's 12px text (hardening-qa a11y pass). Scoped to
762
- this rule only — --admin-teal itself stays unchanged since it is
763
- also used as a background (e.g. .btn.primary) where the pairing
764
- and contrast requirement are different. */
765
- color: #007973;
766
- }
767
-
768
- .chip.blue {
769
- background: var(--admin-blue-soft);
770
- color: var(--admin-blue);
771
- }
772
-
773
- .chip.amber {
774
- background: var(--admin-amber-soft);
775
- color: var(--admin-amber);
776
- }
777
-
778
- .chip.red {
779
- background: var(--admin-red-soft);
780
- color: var(--admin-red);
781
- }
782
-
783
- .chip.violet {
784
- background: var(--admin-violet-soft);
785
- color: var(--admin-violet);
786
- }
787
-
788
- .swatches {
789
- display: grid;
790
- grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
791
- gap: 10px;
792
- }
793
-
794
- .swatch {
795
- overflow: hidden;
796
- border: 1px solid var(--admin-line);
797
- border-radius: var(--admin-radius-sm);
798
- background: var(--admin-surface);
799
- }
800
-
801
- .swatch-color {
802
- min-height: 58px;
803
- }
804
-
805
- .swatch-meta {
806
- padding: 10px;
807
- }
808
-
809
- .swatch-meta b {
810
- display: block;
811
- font-size: 13px;
812
- }
813
-
814
- .swatch-meta code,
815
- .note code {
816
- color: var(--admin-muted);
817
- font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
818
- font-size: 12px;
819
- }
820
-
821
- .field {
822
- min-width: 0;
823
- padding: 11px;
824
- border: 1px solid var(--admin-line);
825
- border-radius: var(--admin-radius-sm);
826
- background: #fcfdfc;
827
- }
828
-
829
- .field strong {
830
- display: block;
831
- margin-top: 6px;
832
- font-size: 13px;
833
- }
834
-
835
- .field p {
836
- margin: 5px 0 0;
837
- color: var(--admin-muted);
838
- font-size: 12px;
839
- }
840
-
841
- .ship-gate {
842
- display: flex;
843
- align-items: center;
844
- justify-content: space-between;
845
- gap: 14px;
846
- padding: 14px;
847
- border: 1px solid #a6d8c0;
848
- border-radius: var(--admin-radius);
849
- background: #eefaf3;
850
- }
851
-
852
- .ship-gate.amber {
853
- border-color: #f1c883;
854
- background: #fff6e7;
855
- }
856
-
857
- .ship-gate-main,
858
- .risk-alert-main {
859
- display: flex;
860
- align-items: center;
861
- gap: 12px;
862
- min-width: 0;
863
- }
864
-
865
- .seal {
866
- width: 42px;
867
- height: 42px;
868
- display: grid;
869
- place-items: center;
870
- border-radius: 50%;
871
- background: var(--admin-green);
872
- color: #ffffff;
873
- }
874
-
875
- .ship-gate.amber .seal {
876
- background: var(--admin-amber);
877
- }
878
-
879
- .ship-gate b,
880
- .risk-alert b {
881
- display: block;
882
- font-size: 15px;
883
- }
884
-
885
- .ship-gate span,
886
- .risk-alert span {
887
- display: block;
888
- margin-top: 3px;
889
- color: var(--admin-muted);
890
- font-size: 12px;
891
- }
892
-
893
- .risk-alert {
894
- display: flex;
895
- align-items: center;
896
- justify-content: space-between;
897
- gap: 14px;
898
- padding: 12px 14px;
899
- border: 1px solid #f1c883;
900
- border-radius: var(--admin-radius);
901
- background: #fff6e7;
902
- }
903
-
904
- /* A JS-toggled `.risk-alert` (e.g. the degraded-forge strip) must stay hidden
905
- when `hidden` is set — the base display:flex above would otherwise win over
906
- the UA [hidden] rule and keep it visible. */
907
- .risk-alert[hidden] {
908
- display: none;
909
- }
910
-
911
- .risk-alert svg {
912
- color: var(--admin-amber);
913
- }
914
-
915
- .order-assist-grid {
916
- display: grid;
917
- grid-template-columns: repeat(3, minmax(0, 1fr));
918
- gap: 10px;
919
- }
920
-
921
- .order-assist-card {
922
- display: grid;
923
- gap: 7px;
924
- min-width: 0;
925
- padding: 12px;
926
- border: 1px solid var(--admin-line);
927
- border-radius: var(--admin-radius-sm);
928
- background: var(--admin-surface);
929
- }
930
-
931
- .order-assist-card strong {
932
- font-size: 14px;
933
- }
934
-
935
- .order-assist-card p {
936
- margin: 0;
937
- color: var(--admin-muted);
938
- font-size: 12px;
939
- }
940
-
941
- .tabs {
942
- display: flex;
943
- gap: 6px;
944
- max-width: 100%;
945
- overflow-x: auto;
946
- border-bottom: 1px solid var(--admin-line);
947
- }
948
-
949
- .mobile-tabbar {
950
- display: none;
951
- }
952
-
953
- .tab {
954
- flex: 0 0 auto;
955
- min-height: 38px;
956
- display: inline-flex;
957
- align-items: center;
958
- padding: 0 12px;
959
- border: 0;
960
- border-bottom: 2px solid transparent;
961
- background: transparent;
962
- color: var(--admin-muted);
963
- font-weight: 760;
964
- text-decoration: none;
965
- }
966
-
967
- .tab.active {
968
- border-color: var(--admin-teal);
969
- color: var(--admin-ink);
970
- }
971
-
972
- .table-wrap {
973
- overflow-x: auto;
974
- border: 1px solid var(--admin-line);
975
- border-radius: var(--admin-radius);
976
- background: var(--admin-surface);
977
- }
978
-
979
- table {
980
- width: 100%;
981
- min-width: 860px;
982
- border-collapse: collapse;
983
- font-size: 13px;
984
- }
985
-
986
- th {
987
- height: 38px;
988
- padding: 0 12px;
989
- border-bottom: 1px solid var(--admin-line);
990
- background: var(--admin-surface-soft);
991
- color: var(--admin-muted);
992
- font-size: 11px;
993
- font-weight: 760;
994
- text-align: left;
995
- text-transform: uppercase;
996
- white-space: nowrap;
997
- }
998
-
999
- td {
1000
- height: 46px;
1001
- padding: 7px 12px;
1002
- border-bottom: 1px solid var(--admin-line);
1003
- vertical-align: middle;
1004
- }
1005
-
1006
- tr:last-child td {
1007
- border-bottom: 0;
1008
- }
1009
-
1010
- .subtle {
1011
- display: block;
1012
- margin-top: 2px;
1013
- color: var(--admin-muted);
1014
- font-size: 12px;
1015
- }
1016
-
1017
- .money,
1018
- .action {
1019
- text-align: right;
1020
- }
1021
-
1022
- .check-row {
1023
- display: grid;
1024
- grid-template-columns: minmax(120px, 0.36fr) minmax(0, 1fr) auto;
1025
- gap: 10px;
1026
- align-items: center;
1027
- padding: 10px 0;
1028
- border-bottom: 1px solid var(--admin-line);
1029
- }
1030
-
1031
- .check-row:last-child {
1032
- border-bottom: 0;
1033
- }
1034
-
1035
- .check-row.blocking {
1036
- margin: 0 -8px;
1037
- padding: 10px 8px;
1038
- border: 1px solid #f1c883;
1039
- border-radius: var(--admin-radius-sm);
1040
- background: #fff8ec;
1041
- }
1042
-
1043
- .check-row b {
1044
- font-size: 13px;
1045
- }
1046
-
1047
- .check-row p {
1048
- margin: 2px 0 0;
1049
- color: var(--admin-muted);
1050
- font-size: 12px;
1051
- }
1052
-
1053
- .type-sample h3 {
1054
- margin: 0 0 8px;
1055
- font-size: 25px;
1056
- line-height: 1.12;
1057
- }
1058
-
1059
- .type-sample p {
1060
- margin: 0;
1061
- color: var(--admin-muted);
1062
- }
1063
-
1064
- .note {
1065
- margin: 0;
1066
- color: var(--admin-muted);
1067
- font-size: 13px;
1068
- }
1069
-
1070
- @media (max-width: 1120px) {
1071
- .shell {
1072
- grid-template-columns: 76px minmax(0, 1fr);
1073
- }
1074
-
1075
- .brand b,
1076
- .brand span,
1077
- .store,
1078
- .nav span,
1079
- .nav-subnav,
1080
- .health {
1081
- display: none;
1082
- }
1083
-
1084
- .sidebar {
1085
- align-items: center;
1086
- padding-inline: 12px;
1087
- }
1088
-
1089
- .nav a {
1090
- justify-content: center;
1091
- padding: 0;
1092
- }
1093
-
1094
- .grid.cols-4,
1095
- .grid.cols-3,
1096
- .order-assist-grid {
1097
- grid-template-columns: repeat(2, minmax(0, 1fr));
1098
- }
1099
- }
1100
-
1101
- @media (max-width: 760px) {
1102
- html,
1103
- body {
1104
- height: auto;
1105
- min-height: 100%;
1106
- overflow-x: hidden;
1107
- overflow-y: auto;
1108
- }
1109
-
1110
- .shell {
1111
- grid-template-columns: 1fr;
1112
- height: auto;
1113
- min-height: 100vh;
1114
- overflow: visible;
1115
- }
1116
-
1117
- .main {
1118
- height: auto;
1119
- min-height: 0;
1120
- overflow: visible;
1121
- }
1122
-
1123
- .sidebar {
1124
- position: static;
1125
- height: auto;
1126
- overflow: visible;
1127
- flex-direction: row;
1128
- align-items: center;
1129
- }
1130
-
1131
- .nav {
1132
- display: none;
1133
- }
1134
-
1135
- .mobile-tabbar {
1136
- position: sticky;
1137
- top: 0;
1138
- z-index: 29;
1139
- display: flex;
1140
- padding-inline: 16px;
1141
- background: rgba(245, 247, 246, 0.94);
1142
- backdrop-filter: blur(16px);
1143
- }
1144
-
1145
- .topbar,
1146
- .ship-gate,
1147
- .risk-alert,
1148
- .section-title,
1149
- .panel-head {
1150
- align-items: flex-start;
1151
- flex-direction: column;
1152
- }
1153
-
1154
- .content,
1155
- .topbar {
1156
- padding-inline: 16px;
1157
- }
1158
-
1159
- .floating-ask {
1160
- right: 16px;
1161
- bottom: 16px;
1162
- }
1163
-
1164
- [data-admin-panel],
1165
- [data-admin-guide-section] {
1166
- scroll-margin-top: 16px;
1167
- }
1168
-
1169
- .actions {
1170
- width: 100%;
1171
- }
1172
-
1173
- .actions .btn {
1174
- flex: 1 1 150px;
1175
- }
1176
-
1177
- .grid.cols-4,
1178
- .grid.cols-3,
1179
- .grid.cols-2,
1180
- .order-assist-grid {
1181
- grid-template-columns: 1fr;
1182
- }
1183
-
1184
- .check-row {
1185
- grid-template-columns: 1fr;
1186
- }
1187
- }
1188
- </style>
1189
119
  </head>
1190
120
  <body>
1191
121
  <svg aria-hidden="true" style="position:absolute;width:0;height:0;overflow:hidden">
@@ -1258,6 +188,7 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
1258
188
  <a href="#fulfillment" data-admin-tab-link><svg><use href="#i-truck"></use></svg><span>Fulfillment</span></a>
1259
189
  <a href="#reporting" data-admin-tab-link><svg><use href="#i-chart"></use></svg><span>Reporting</span></a>
1260
190
  <a href="#ai-workflows" data-admin-tab-link><svg><use href="#i-workflows"></use></svg><span>AI Workflows</span></a>
191
+ <a href="#blog" data-admin-tab-link><svg><use href="#i-file"></use></svg><span>Blog</span></a>
1261
192
  <a href="#publish" data-admin-tab-link><svg><use href="#i-export"></use></svg><span>Publish</span></a>
1262
193
  <a href="#settings" data-admin-tab-link><svg><use href="#i-gear"></use></svg><span>Settings</span></a>
1263
194
  </nav>
@@ -1323,6 +254,7 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
1323
254
  <a class="tab" href="#fulfillment" role="tab" aria-controls="fulfillment" aria-selected="false" data-admin-tab-link>Fulfillment</a>
1324
255
  <a class="tab" href="#reporting" role="tab" aria-controls="reporting" aria-selected="false" data-admin-tab-link>Reporting</a>
1325
256
  <a class="tab" href="#ai-workflows" role="tab" aria-controls="ai-workflows" aria-selected="false" data-admin-tab-link>AI Workflows</a>
257
+ <a class="tab" href="#blog" role="tab" aria-controls="blog" aria-selected="false" data-admin-tab-link>Blog</a>
1326
258
  <a class="tab" href="#publish" role="tab" aria-controls="publish" aria-selected="false" data-admin-tab-link>Publish</a>
1327
259
  <a class="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false" data-admin-tab-link>Settings</a>
1328
260
  </div>
@@ -1371,6 +303,7 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
1371
303
  <a id="admin-tab-fulfillment" class="tab" href="#fulfillment" role="tab" aria-controls="fulfillment" aria-selected="false" data-admin-tab-link>Fulfillment</a>
1372
304
  <a id="admin-tab-reporting" class="tab" href="#reporting" role="tab" aria-controls="reporting" aria-selected="false" data-admin-tab-link>Reporting</a>
1373
305
  <a id="admin-tab-ai-workflows" class="tab" href="#ai-workflows" role="tab" aria-controls="ai-workflows" aria-selected="false" data-admin-tab-link>AI Workflows</a>
306
+ <a id="admin-tab-blog" class="tab" href="#blog" role="tab" aria-controls="blog" aria-selected="false" data-admin-tab-link>Blog</a>
1374
307
  <a id="admin-tab-publish" class="tab" href="#publish" role="tab" aria-controls="publish" aria-selected="false" data-admin-tab-link>Publish</a>
1375
308
  <a id="admin-tab-settings" class="tab" href="#settings" role="tab" aria-controls="settings" aria-selected="false" data-admin-tab-link>Settings</a>
1376
309
  </div>
@@ -1497,6 +430,7 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
1497
430
  <AdminFulfillmentTab envelope={tenantEnvelope} />
1498
431
  <AdminReportingTab envelope={tenantEnvelope} />
1499
432
  <AdminAIWorkflowsTab envelope={tenantEnvelope} />
433
+ <AdminBlogTab envelope={tenantEnvelope} />
1500
434
  <AdminPublishTab envelope={tenantEnvelope} />
1501
435
  <AdminSettingsTab envelope={tenantEnvelope} />
1502
436
 
@@ -1612,245 +546,9 @@ const { envelope: tenantEnvelope, isStaff, pickerTenants, deniedTarget } = admin
1612
546
  </span>
1613
547
  </button>
1614
548
 
1615
- <script is:inline nonce={cspNonce}>
1616
- (() => {
1617
- const tabIds = ["orders", "products", "subscriptions", "customers", "fulfillment", "reporting", "ai-workflows", "publish", "settings"];
1618
- const tabSet = new Set(tabIds);
1619
- const tabHashPattern = new RegExp(`^#(${tabIds.join("|")})$`);
1620
- const canViewInternalGuide = document.documentElement.dataset.internalAdminGuide === "true";
1621
- const defaultTab = canViewInternalGuide ? "orders" : "settings";
1622
- const askContexts = {
1623
- orders: "Orders",
1624
- products: "Products",
1625
- subscriptions: "Subscriptions",
1626
- customers: "Customers",
1627
- fulfillment: "Fulfillment",
1628
- reporting: "Reporting",
1629
- "ai-workflows": "AI Workflows",
1630
- publish: "Publish",
1631
- settings: "Settings",
1632
- };
1633
-
1634
- const panelIdFromHash = () => {
1635
- const rawHash = window.location.hash.slice(1);
1636
- // The tab id is the part before any "?" query suffix (#publish?pr=42);
1637
- // the raw hash is still used for internal-guide anchor resolution.
1638
- const hash = rawHash.split("?")[0];
1639
- if (!rawHash) return defaultTab;
1640
- if (tabSet.has(hash)) return hash;
1641
- if (!canViewInternalGuide) return defaultTab;
1642
-
1643
- const target = rawHash ? document.getElementById(rawHash) : null;
1644
- const panel = target?.closest?.("[data-admin-panel]");
1645
- if (panel?.id && tabSet.has(panel.id)) return panel.id;
1646
-
1647
- return null;
1648
- };
1649
-
1650
- const setActiveTab = (id) => {
1651
- if (!tabSet.has(id)) return;
1652
-
1653
- document.documentElement.dataset.adminMode = "work-area";
1654
- document.documentElement.dataset.adminTab = id;
1655
- setAskContext(id);
1656
-
1657
- document.querySelectorAll("[data-admin-panel]").forEach((panel) => {
1658
- const active = panel.id === id;
1659
- panel.hidden = !active;
1660
- panel.setAttribute("aria-hidden", active ? "false" : "true");
1661
- });
1662
-
1663
- document.querySelectorAll("[data-admin-tab-link]").forEach((link) => {
1664
- const active = link.hash === `#${id}`;
1665
- link.classList.toggle("active", active);
1666
-
1667
- if (link.getAttribute("role") === "tab") {
1668
- link.setAttribute("aria-selected", active ? "true" : "false");
1669
- link.tabIndex = active ? 0 : -1;
1670
- }
1671
- });
1672
- };
1673
-
1674
- const setGuideMode = () => {
1675
- if (!canViewInternalGuide) {
1676
- setActiveTab(defaultTab);
1677
- return;
1678
- }
1679
-
1680
- document.documentElement.dataset.adminMode = "guide";
1681
- setAskContext(defaultTab);
1682
-
1683
- document.querySelectorAll("[data-admin-panel]").forEach((panel) => {
1684
- panel.hidden = true;
1685
- panel.setAttribute("aria-hidden", "true");
1686
- });
1687
-
1688
- document.querySelectorAll("[data-admin-tab-link]").forEach((link) => {
1689
- link.classList.remove("active");
1690
-
1691
- if (link.getAttribute("role") === "tab") {
1692
- link.setAttribute("aria-selected", "false");
1693
- link.tabIndex = 0;
1694
- }
1695
- });
1696
- };
1697
-
1698
- // Ask context envelope (baseline §Horizontal AI Concepts / Ask,
1699
- // ai-evidence-substrate item a — mirrors lib/admin/ai/askEnvelope.ts's
1700
- // buildAskEnvelope; duplicated here in plain JS because is:inline
1701
- // scripts cannot import modules). No chat backend yet: this is
1702
- // dev-inspectable only (window.__toTAdminAsk + a CustomEvent), never
1703
- // sent over the network.
1704
- const buildAskEnvelopePlain = (id) => {
1705
- const root = document.documentElement.dataset;
1706
- const isStaff = root.adminIsStaff === "true";
1707
- const panel = document.getElementById(id);
1708
- const selectedRecordId = panel?.querySelector("[data-admin-selected-id]")?.dataset.adminSelectedId || null;
1709
-
1710
- return {
1711
- tenant: {
1712
- adminAppTenant: root.adminAppTenant ?? "",
1713
- targetTenant: root.adminTargetTenant ?? "",
1714
- operator: root.adminOperator || null,
1715
- },
1716
- activeTab: id,
1717
- selectedRecordId,
1718
- role: isStaff ? "internal_staff" : "merchant_operator",
1719
- permissions: isStaff ? ["internal_admin", "cross_tenant_read"] : ["merchant_admin"],
1720
- filters: {},
1721
- evidenceContext: [],
1722
- };
1723
- };
1724
-
1725
- const setAskContext = (id) => {
1726
- const label = askContexts[id] ?? "Storefront";
1727
- const askButton = document.querySelector("[data-admin-ask]");
1728
- const askContext = document.querySelector("[data-admin-ask-context]");
1729
-
1730
- if (askContext) askContext.textContent = label;
1731
- if (askButton) {
1732
- askButton.setAttribute("aria-label", `Ask about ${label}`);
1733
- askButton.setAttribute("title", `Ask about ${label}`);
1734
- askButton.dataset.askScope = id;
1735
- }
1736
-
1737
- window.__toTAdminAsk = buildAskEnvelopePlain(id);
1738
- };
1739
-
1740
- const scrollWorkspaceToTop = () => {
1741
- const scroller = document.querySelector(".main");
1742
- const reset = () => {
1743
- if (scroller) {
1744
- scroller.scrollTo({ top: 0, left: 0 });
1745
- return;
1746
- }
1747
-
1748
- window.scrollTo({ top: 0, left: 0 });
1749
- };
1750
-
1751
- reset();
1752
- requestAnimationFrame(reset);
1753
- setTimeout(reset, 0);
1754
- };
1755
-
1756
- const scrollToHashTarget = (panelId) => {
1757
- const hash = window.location.hash.slice(1);
1758
- const target = hash ? document.getElementById(hash) : null;
1759
-
1760
- if (!target || tabSet.has(hash) || target.id === panelId) {
1761
- scrollWorkspaceToTop();
1762
- return;
1763
- }
1764
-
1765
- target?.scrollIntoView({ block: "start" });
1766
- };
1767
-
1768
- const activateFromHash = ({ scroll = false } = {}) => {
1769
- const panelId = panelIdFromHash();
1770
-
1771
- if (panelId) {
1772
- setActiveTab(panelId);
1773
- // Strip any query suffix before deciding whether the hash names a
1774
- // real tab — a valid deep link like #publish?pr=42 must not be
1775
- // normalized away to #settings for merchant viewers.
1776
- const hashTab = window.location.hash.slice(1).split("?")[0];
1777
- if (!canViewInternalGuide && !tabSet.has(hashTab)) {
1778
- history.replaceState(null, "", "#settings");
1779
- }
1780
- if (scroll) requestAnimationFrame(() => scrollToHashTarget(panelId));
1781
- return;
1782
- }
1783
-
1784
- setGuideMode();
1785
- if (scroll) {
1786
- const hash = window.location.hash.slice(1);
1787
- requestAnimationFrame(() => document.getElementById(hash)?.scrollIntoView({ block: "start" }));
1788
- }
1789
- };
1790
-
1791
- document.querySelector("[data-admin-tenant-picker-select]")?.addEventListener("change", (event) => {
1792
- const params = new URLSearchParams(window.location.search);
1793
- params.set("asTenant", event.target.value);
1794
- window.location.assign(`${window.location.pathname}?${params}${window.location.hash}`);
1795
- });
1796
-
1797
- // Emit the Ask envelope on open. No chat backend yet — dev-inspectable
1798
- // only via window.__toTAdminAsk (already kept current by setAskContext)
1799
- // and this "tot:admin-ask" CustomEvent.
1800
- document.querySelector("[data-admin-ask]")?.addEventListener("click", () => {
1801
- const activeTab = document.documentElement.dataset.adminTab ?? defaultTab;
1802
- const envelope = buildAskEnvelopePlain(activeTab);
1803
- window.__toTAdminAsk = envelope;
1804
- document.dispatchEvent(new CustomEvent("tot:admin-ask", { detail: envelope }));
1805
- if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1") {
1806
- console.debug("[admin:ask]", envelope);
1807
- }
1808
- });
1809
-
1810
- document.addEventListener("click", (event) => {
1811
- const target = event.target instanceof Element ? event.target : event.target?.parentElement;
1812
- const link = target?.closest("a[href^='#']");
1813
- if (!link || !tabHashPattern.test(link.hash)) return;
1814
-
1815
- event.preventDefault();
1816
- const id = link.hash.slice(1);
1817
- setActiveTab(id);
1818
- history.pushState(null, "", link.hash);
1819
- scrollWorkspaceToTop();
1820
- });
1821
-
1822
- document.addEventListener("keydown", (event) => {
1823
- const target = event.target instanceof Element ? event.target : null;
1824
- const currentTab = target?.closest("[role='tab'][data-admin-tab-link]");
1825
- if (!currentTab) return;
1826
-
1827
- // Filter to visible tabs only: the mobile tab bar and the internal
1828
- // Admin Tab Map can both be present in the DOM at once (one hidden
1829
- // via CSS depending on viewport/viewer), and this selector matches
1830
- // role="tab" elements in either — without this filter, arrow/home/
1831
- // end navigation could walk into a display:none tablist whose
1832
- // .focus() is a silent no-op.
1833
- const tabs = Array.from(document.querySelectorAll("[role='tab'][data-admin-tab-link]")).filter(
1834
- (el) => el.offsetParent !== null,
1835
- );
1836
- const currentIndex = tabs.indexOf(currentTab);
1837
- let nextIndex = currentIndex;
1838
-
1839
- if (event.key === "ArrowRight") nextIndex = (currentIndex + 1) % tabs.length;
1840
- if (event.key === "ArrowLeft") nextIndex = (currentIndex - 1 + tabs.length) % tabs.length;
1841
- if (event.key === "Home") nextIndex = 0;
1842
- if (event.key === "End") nextIndex = tabs.length - 1;
1843
-
1844
- if (nextIndex === currentIndex) return;
1845
-
1846
- event.preventDefault();
1847
- tabs[nextIndex].focus();
1848
- tabs[nextIndex].click();
1849
- });
1850
-
1851
- window.addEventListener("hashchange", () => activateFromHash({ scroll: true }));
1852
- activateFromHash({ scroll: Boolean(window.location.hash) });
1853
- })();
549
+ <script>
550
+ import { initAdminShell } from "@/lib/admin/adminShell";
551
+ initAdminShell();
1854
552
  </script>
1855
553
  </body>
1856
554
  </html>