@tokenoftrust/storefront-runner 1.3.4-rc.4 → 1.4.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.
- package/apps/storefront/astro.config.mjs +15 -0
- package/apps/storefront/dev-plugins/dev-publish.mjs +55 -0
- package/apps/storefront/dev-plugins/tenant-hot-reload.mjs +86 -7
- package/apps/storefront/drizzle.config.apps.ts +13 -0
- package/apps/storefront/env.d.ts +10 -0
- package/apps/storefront/migrations/README.md +13 -7
- package/apps/storefront/migrations-apps/0000_fast_millenium_guard.sql +129 -0
- package/apps/storefront/migrations-apps/meta/0000_snapshot.json +843 -0
- package/apps/storefront/migrations-apps/meta/_journal.json +13 -0
- package/apps/storefront/package.json +13 -1
- package/apps/storefront/perf/README.md +64 -0
- package/apps/storefront/perf/assert-budgets.ts +159 -0
- package/apps/storefront/playwright.config.ts +23 -0
- package/apps/storefront/public/js/dashboard-apps.js +173 -0
- package/apps/storefront/public/shared/commerce-marketing.css +221 -0
- package/apps/storefront/src/components/CollectionCard.astro +1 -0
- package/apps/storefront/src/components/ProductCard.astro +1 -0
- package/apps/storefront/src/components/admin/AdminPublishTab.astro +1959 -0
- package/apps/storefront/src/components/apps/AppWidgetFrame.astro +30 -0
- package/apps/storefront/src/components/chrome/NavDropdown.astro +6 -3
- package/apps/storefront/src/components/chrome/SiteFooter.astro +10 -0
- package/apps/storefront/src/components/chrome/SiteHeader.astro +10 -0
- package/apps/storefront/src/components/commerce/RatingStars.astro +3 -2
- package/apps/storefront/src/components/content/Callout.astro +75 -0
- package/apps/storefront/src/components/content/NeedsReviewCallout.astro +66 -0
- package/apps/storefront/src/components/content/ProseSections.astro +121 -0
- package/apps/storefront/src/components/content/ProseToc.astro +34 -0
- package/apps/storefront/src/components/content/RichText.astro +44 -0
- package/apps/storefront/src/components/content/TrustStrip.astro +46 -0
- package/apps/storefront/src/components/home/Hero.astro +14 -0
- package/apps/storefront/src/components/islands/CheckoutComplianceGate.tsx +295 -0
- package/apps/storefront/src/components/islands/ImageGallery.tsx +42 -21
- package/apps/storefront/src/components/islands/VariantSelector.tsx +62 -12
- package/apps/storefront/src/components/plp/FacetSidebar.astro +2 -2
- package/apps/storefront/src/components/subscription/ManageSubscriptionEntry.astro +1 -0
- package/apps/storefront/src/config/compliance/rulesets.ts +79 -0
- package/apps/storefront/src/config/storeName.ts +34 -0
- package/apps/storefront/src/layouts/Layout.astro +97 -23
- package/apps/storefront/src/lib/analytics/budgets.json +69 -0
- package/apps/storefront/src/lib/analytics/lighthouseReport.ts +109 -0
- package/apps/storefront/src/lib/analytics/perfBudgets.ts +452 -0
- package/apps/storefront/src/lib/analytics/rumAlert.ts +179 -0
- package/apps/storefront/src/lib/analytics/webVitals.ts +269 -0
- package/apps/storefront/src/lib/apps/adminService.ts +106 -0
- package/apps/storefront/src/lib/apps/adminSession.ts +205 -0
- package/apps/storefront/src/lib/apps/apiAuth.ts +91 -0
- package/apps/storefront/src/lib/apps/apiRoute.ts +35 -0
- package/apps/storefront/src/lib/apps/catalogMapper.ts +39 -0
- package/apps/storefront/src/lib/apps/credentials.ts +153 -0
- package/apps/storefront/src/lib/apps/gatewayKeys.ts +156 -0
- package/apps/storefront/src/lib/apps/healthAggregate.ts +66 -0
- package/apps/storefront/src/lib/apps/orders/attributionService.ts +206 -0
- package/apps/storefront/src/lib/apps/orders/customerHash.ts +28 -0
- package/apps/storefront/src/lib/apps/orders/foxyOrderClient.ts +203 -0
- package/apps/storefront/src/lib/apps/orders/idempotency.ts +100 -0
- package/apps/storefront/src/lib/apps/orders/orderForwardReceiver.ts +117 -0
- package/apps/storefront/src/lib/apps/orders/orderMapper.ts +91 -0
- package/apps/storefront/src/lib/apps/orders/ordersStore.ts +181 -0
- package/apps/storefront/src/lib/apps/registryService.ts +579 -0
- package/apps/storefront/src/lib/apps/scopes.ts +79 -0
- package/apps/storefront/src/lib/apps/tokenIssuer.ts +121 -0
- package/apps/storefront/src/lib/apps/tokenVerifier.ts +148 -0
- package/apps/storefront/src/lib/apps/widgets/eligibility.ts +18 -0
- package/apps/storefront/src/lib/apps/widgets/frameProps.ts +52 -0
- package/apps/storefront/src/lib/apps/widgets/launchToken.ts +84 -0
- package/apps/storefront/src/lib/apps/widgets/placements.ts +57 -0
- package/apps/storefront/src/lib/apps/widgets/renderSlot.ts +111 -0
- package/apps/storefront/src/lib/auth/adminEntry.ts +119 -0
- package/apps/storefront/src/lib/auth/identityToken.ts +21 -2
- package/apps/storefront/src/lib/auth/loginGate.ts +102 -18
- package/apps/storefront/src/lib/auth/mcpClientAssertion.ts +215 -0
- package/apps/storefront/src/lib/auth/route.ts +16 -1
- package/apps/storefront/src/lib/auth/session.ts +8 -0
- package/apps/storefront/src/lib/auth/stepUpChallenge.ts +107 -0
- package/apps/storefront/src/lib/auth/totAccessClient.ts +208 -0
- package/apps/storefront/src/lib/blog/provider.ts +39 -0
- package/apps/storefront/src/lib/blog/types.ts +26 -0
- package/apps/storefront/src/lib/checkoutCommerce.ts +39 -1
- package/apps/storefront/src/lib/chrome/model.ts +11 -0
- package/apps/storefront/src/lib/compliance/enforcement.ts +95 -0
- package/apps/storefront/src/lib/content/callout.ts +78 -0
- package/apps/storefront/src/lib/content/index.ts +27 -0
- package/apps/storefront/src/lib/content/needsReview.ts +58 -0
- package/apps/storefront/src/lib/content/prose.ts +186 -0
- package/apps/storefront/src/lib/content/richtext.ts +76 -0
- package/apps/storefront/src/lib/content/trustStrip.ts +74 -0
- package/apps/storefront/src/lib/content-edit/client.ts +70 -14
- package/apps/storefront/src/lib/d1/catalog.ts +12 -0
- package/apps/storefront/src/lib/d1/schema-apps.ts +213 -0
- package/apps/storefront/src/lib/dev/apiBase.ts +8 -2
- package/apps/storefront/src/lib/dev/cliSignInCode.ts +65 -115
- package/apps/storefront/src/lib/dev/cockpitStore.ts +65 -0
- package/apps/storefront/src/lib/dev/previewStatus.ts +112 -0
- package/apps/storefront/src/lib/dev/rendezvousBroker.ts +241 -0
- package/apps/storefront/src/lib/dev/subjectReissue.ts +67 -0
- package/apps/storefront/src/lib/email/magicLinkInviteEmail.ts +10 -10
- package/apps/storefront/src/lib/env.ts +12 -0
- package/apps/storefront/src/lib/jsonld.ts +12 -17
- package/apps/storefront/src/lib/membership/eligibility.ts +37 -0
- package/apps/storefront/src/lib/monitoring/manifest.ts +302 -0
- package/apps/storefront/src/lib/privacy/emailHint.ts +13 -5
- package/apps/storefront/src/lib/publish/apex-readiness.ts +337 -0
- package/apps/storefront/src/lib/publish/dispatchHealth.ts +269 -0
- package/apps/storefront/src/lib/publish/domainState.ts +351 -0
- package/apps/storefront/src/lib/publish/shipWorkspace.ts +362 -0
- package/apps/storefront/src/lib/rawChrome.ts +34 -3
- package/apps/storefront/src/lib/storyblok/content-model.ts +34 -2
- package/apps/storefront/src/lib/storyblok/provider.ts +11 -4
- package/apps/storefront/src/lib/subscription/model.ts +114 -0
- package/apps/storefront/src/lib/tot/ToTClient.ts +3 -3
- package/apps/storefront/src/lib/tot/query.ts +32 -0
- package/apps/storefront/src/lib/webhooks/cloudflareQueueDispatcher.ts +82 -0
- package/apps/storefront/src/lib/webhooks/deliveryEngine.ts +245 -0
- package/apps/storefront/src/lib/webhooks/deliveryMapper.ts +34 -0
- package/apps/storefront/src/lib/webhooks/deliveryStore.ts +668 -0
- package/apps/storefront/src/lib/webhooks/dispatcher.ts +168 -0
- package/apps/storefront/src/lib/webhooks/emit.ts +167 -0
- package/apps/storefront/src/lib/webhooks/endpointGuard.ts +135 -0
- package/apps/storefront/src/lib/webhooks/events.ts +98 -0
- package/apps/storefront/src/lib/webhooks/getDispatcher.ts +49 -0
- package/apps/storefront/src/lib/webhooks/signing.ts +29 -0
- package/apps/storefront/src/lib/webhooks/webhookSigningKey.ts +146 -0
- package/apps/storefront/src/middleware/index.ts +28 -13
- package/apps/storefront/src/pages/404.astro +21 -9
- package/apps/storefront/src/pages/[...slug].astro +36 -2
- package/apps/storefront/src/pages/admin.astro +29 -3
- package/apps/storefront/src/pages/api/apps/admin/credentials/rotate.ts +60 -0
- package/apps/storefront/src/pages/api/apps/admin/health.ts +44 -0
- package/apps/storefront/src/pages/api/apps/admin/install.ts +100 -0
- package/apps/storefront/src/pages/api/apps/admin/list.ts +26 -0
- package/apps/storefront/src/pages/api/apps/admin/resume.ts +56 -0
- package/apps/storefront/src/pages/api/apps/admin/suspend.ts +57 -0
- package/apps/storefront/src/pages/api/apps/admin/uninstall.ts +74 -0
- package/apps/storefront/src/pages/api/apps/admin/update.ts +103 -0
- package/apps/storefront/src/pages/api/apps/admin/webhooks/deliveries/[deliveryId]/replay.ts +59 -0
- package/apps/storefront/src/pages/api/apps/admin/webhooks/deliveries.ts +51 -0
- package/apps/storefront/src/pages/api/apps/internal/order-forward.ts +172 -0
- package/apps/storefront/src/pages/api/apps/oauth/token.ts +87 -0
- package/apps/storefront/src/pages/api/apps/v1/attribution.ts +142 -0
- package/apps/storefront/src/pages/api/apps/v1/catalog/products/[handle].ts +39 -0
- package/apps/storefront/src/pages/api/apps/v1/catalog/products.ts +49 -0
- package/apps/storefront/src/pages/api/apps/v1/health.ts +32 -0
- package/apps/storefront/src/pages/api/apps/v1/inventory.ts +59 -0
- package/apps/storefront/src/pages/api/apps/v1/orders/[id].ts +48 -0
- package/apps/storefront/src/pages/api/apps/v1/orders.ts +73 -0
- package/apps/storefront/src/pages/api/apps/v1/reports.ts +21 -0
- package/apps/storefront/src/pages/api/apps/v1/webhooks/deliveries/[deliveryId]/replay.ts +62 -0
- package/apps/storefront/src/pages/api/apps/v1/webhooks/deliveries.ts +47 -0
- package/apps/storefront/src/pages/api/auth/magic-exchange.ts +48 -1
- package/apps/storefront/src/pages/api/auth/step-up-send.ts +57 -0
- package/apps/storefront/src/pages/api/auth/step-up-verify.ts +129 -0
- package/apps/storefront/src/pages/api/auth/verify.ts +23 -0
- package/apps/storefront/src/pages/api/compliance/preflight.ts +206 -0
- package/apps/storefront/src/pages/api/rum/vitals.ts +54 -0
- package/apps/storefront/src/pages/api/test/dev-session.ts +133 -0
- package/apps/storefront/src/pages/auth/login.astro +197 -41
- package/apps/storefront/src/pages/auth/magic.astro +75 -43
- package/apps/storefront/src/pages/blog/[slug].astro +107 -0
- package/apps/storefront/src/pages/blog/index.astro +98 -0
- package/apps/storefront/src/pages/capabilities.astro +8 -0
- package/apps/storefront/src/pages/cockpit.astro +433 -69
- package/apps/storefront/src/pages/collections/[handle].astro +8 -0
- package/apps/storefront/src/pages/collections/index.astro +10 -2
- package/apps/storefront/src/pages/dashboard/[appDomain]/apps/index.astro +119 -0
- package/apps/storefront/src/pages/dashboard/[appDomain]/index.astro +5 -0
- package/apps/storefront/src/pages/index.astro +57 -0
- package/apps/storefront/src/pages/llms.txt.ts +31 -10
- package/apps/storefront/src/pages/products/[handle].astro +100 -9
- package/apps/storefront/src/pages/sitemap.xml.ts +21 -4
- package/apps/storefront/src/pages/style-guide/[tenant]/[theme].astro +198 -0
- package/apps/storefront/src/pages/style-guide/[tenant]/chrome/[theme].astro +7 -0
- package/apps/storefront/src/pages/style-guide/[tenant]/guide/[theme].astro +7 -0
- package/apps/storefront/src/pages/style-guide/[tenant]/index.astro +7 -0
- package/apps/storefront/src/pages/style-guide/index.astro +10 -0
- package/apps/storefront/src/styles/fonts.css +54 -0
- package/apps/storefront/src/styles/global.css +22 -2
- package/apps/storefront/src/themes/schema.ts +3 -25
- package/apps/storefront/tsconfig.json +1 -1
- package/apps/storefront/vitest.config.ts +4 -1
- package/package.json +1 -1
- package/packages/public-runtime/src/candidate-index.ts +311 -0
- package/packages/public-runtime/src/checkout.ts +94 -2
- package/packages/public-runtime/src/compliance/evaluate.ts +265 -0
- package/packages/public-runtime/src/compliance/evidence-signals.ts +81 -0
- package/packages/public-runtime/src/compliance/index.ts +22 -0
- package/packages/public-runtime/src/compliance/pact-report.ts +94 -0
- package/packages/public-runtime/src/compliance/profile.ts +198 -0
- package/packages/public-runtime/src/compliance/ruleset.ts +117 -0
- package/packages/public-runtime/src/compliance/verification.ts +81 -0
- package/packages/public-runtime/src/csp.ts +27 -3
- package/packages/public-runtime/src/customization-reconcile.ts +35 -0
- package/packages/public-runtime/src/customization-runtime.ts +8 -0
- package/packages/public-runtime/src/customization-versioning.ts +17 -0
- package/packages/public-runtime/src/extension-contract.ts +2 -1
- package/packages/public-runtime/src/hash.ts +25 -0
- package/packages/public-runtime/src/index.ts +6 -0
- package/packages/public-runtime/src/membership.ts +353 -0
- package/packages/public-runtime/src/product.ts +24 -2
- package/packages/public-runtime/src/review-trust-proof.ts +194 -0
- package/packages/public-runtime/src/tenant-assets.ts +40 -5
- package/packages/public-runtime/src/tenant.ts +236 -0
- package/packages/public-runtime/src/widget-postmessage.ts +205 -0
- package/scripts/dev/publish.mjs +158 -0
- package/scripts/dev/transient-files.mjs +2 -1
- package/tenants/home/public/fonts/inter-latin-400-normal.woff2 +0 -0
- package/tenants/home/public/fonts/inter-latin-500-normal.woff2 +0 -0
- package/tenants/home/public/fonts/inter-latin-600-normal.woff2 +0 -0
- package/tenants/home/public/fonts/inter-latin-ext-400-normal.woff2 +0 -0
- package/tenants/home/public/fonts/inter-latin-ext-500-normal.woff2 +0 -0
- package/tenants/home/public/fonts/inter-latin-ext-600-normal.woff2 +0 -0
- package/tenants/home/public/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/tenants/home/public/fonts/jetbrains-mono-latin-500-normal.woff2 +0 -0
- package/tenants/home/public/fonts/jetbrains-mono-latin-ext-400-normal.woff2 +0 -0
- package/tenants/home/public/fonts/jetbrains-mono-latin-ext-500-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-500-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-600-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-700-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-800-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-ext-500-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-ext-600-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-ext-700-normal.woff2 +0 -0
- package/tenants/home/public/fonts/plus-jakarta-sans-latin-ext-800-normal.woff2 +0 -0
- package/tenants/home/public/pages/storefront.css +23 -0
- package/apps/storefront/src/lib/dev/hostedCockpit.ts +0 -169
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/* Self-hosted web fonts (audit finding 6) — replaces the render-blocking
|
|
2
|
+
third-party Google Fonts stylesheet formerly linked in content/home.html.
|
|
3
|
+
woff2 vendored under /tenants/home/fonts/ (from @fontsource, latin +
|
|
4
|
+
latin-ext subsets); font-display: swap preserved. Same-origin => CSP 'self'. */
|
|
5
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:500;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-ext-500-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
6
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:500;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
7
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:600;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-ext-600-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
8
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:600;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
9
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:700;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-ext-700-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
10
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:700;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
11
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:800;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-ext-800-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
12
|
+
@font-face{font-family:'Plus Jakarta Sans';font-style:normal;font-display:swap;font-weight:800;src:url(/tenants/home/fonts/plus-jakarta-sans-latin-800-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
13
|
+
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url(/tenants/home/fonts/inter-latin-ext-400-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
14
|
+
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:400;src:url(/tenants/home/fonts/inter-latin-400-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
15
|
+
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:500;src:url(/tenants/home/fonts/inter-latin-ext-500-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
16
|
+
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:500;src:url(/tenants/home/fonts/inter-latin-500-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
17
|
+
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url(/tenants/home/fonts/inter-latin-ext-600-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
18
|
+
@font-face{font-family:'Inter';font-style:normal;font-display:swap;font-weight:600;src:url(/tenants/home/fonts/inter-latin-600-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
19
|
+
@font-face{font-family:'JetBrains Mono';font-style:normal;font-display:swap;font-weight:400;src:url(/tenants/home/fonts/jetbrains-mono-latin-ext-400-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
20
|
+
@font-face{font-family:'JetBrains Mono';font-style:normal;font-display:swap;font-weight:400;src:url(/tenants/home/fonts/jetbrains-mono-latin-400-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
21
|
+
@font-face{font-family:'JetBrains Mono';font-style:normal;font-display:swap;font-weight:500;src:url(/tenants/home/fonts/jetbrains-mono-latin-ext-500-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;}
|
|
22
|
+
@font-face{font-family:'JetBrains Mono';font-style:normal;font-display:swap;font-weight:500;src:url(/tenants/home/fonts/jetbrains-mono-latin-500-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}
|
|
23
|
+
|
|
1
24
|
/* Storefront by Token of Trust — early-access landing page.
|
|
2
25
|
* Ported from the approved prototype; served at /tenants/home/pages/storefront.css
|
|
3
26
|
* (mirrored from tenants/home/public/ by scripts/build/copy-tenant-assets.mjs).
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared auth + tenant + provider resolution for the hosted /dev cockpit's
|
|
3
|
-
* /api/dev/* routes (cp-tree, cp-file, cp-write, and cp-diff/cp-locate landing
|
|
4
|
-
* on top). Mirrors /api/content-edit/ai-edit's gate exactly: a signed-in
|
|
5
|
-
* developer session with a real capability, resolving only the session's OWN
|
|
6
|
-
* tenant — never a caller-supplied one. See decision
|
|
7
|
-
* architecture-environment-aware-cockpit (workstream tot-lime-cloud-dev-cockpit).
|
|
8
|
-
*
|
|
9
|
-
* Also carries the path resolution + draft-overlay helpers shared by
|
|
10
|
-
* cp-file/cp-write/cp-diff, so the three routes agree on exactly one
|
|
11
|
-
* definition of "the writable surface" and "the developer's current value for
|
|
12
|
-
* a path" (draft-if-present else published) rather than three copies drifting.
|
|
13
|
-
*/
|
|
14
|
-
import type { APIContext } from "astro";
|
|
15
|
-
import { readViewerSession } from "@/lib/auth/route";
|
|
16
|
-
import { json } from "@/lib/grants/route.js";
|
|
17
|
-
import { readEnv, readKv } from "@/lib/env";
|
|
18
|
-
import { resolvePreviewTenant } from "@/config/previewTenantLookup";
|
|
19
|
-
import { createContentProvider, type ContentProvider } from "@/lib/storyblok/provider";
|
|
20
|
-
import { readPublishedArtifact, themeArtifactPath } from "@tot/public-runtime";
|
|
21
|
-
import type { TenantConfig } from "@tot/public-runtime";
|
|
22
|
-
import {
|
|
23
|
-
DEV_DRAFT_COOKIE,
|
|
24
|
-
DEV_DRAFT_TTL_SECONDS,
|
|
25
|
-
devDraftKey,
|
|
26
|
-
signDevDraftToken,
|
|
27
|
-
verifyDevDraftToken,
|
|
28
|
-
} from "@/lib/dev/devDraft";
|
|
29
|
-
|
|
30
|
-
export interface CockpitContext {
|
|
31
|
-
tenant: TenantConfig;
|
|
32
|
-
provider: ContentProvider;
|
|
33
|
-
kvGet: (key: string) => Promise<string | null>;
|
|
34
|
-
kvPut: ((key: string, value: string, opts: { expirationTtl: number }) => Promise<void>) | null;
|
|
35
|
-
draftSecret: string | null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** Resolved context, or a Response the caller should return as-is (401/403). */
|
|
39
|
-
export async function resolveCockpitContext(
|
|
40
|
-
context: APIContext,
|
|
41
|
-
): Promise<CockpitContext | Response> {
|
|
42
|
-
const session = await readViewerSession({ cookies: context.cookies });
|
|
43
|
-
if (!session) return json({ ok: false, message: "sign in required" }, 401);
|
|
44
|
-
if (!session.capability || session.capability === "none") {
|
|
45
|
-
return json({ ok: false, message: "no developer capability on this account" }, 403);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// The tenant is the session's OWN store (first membership, else the session's
|
|
49
|
-
// primary resource) — the same resolution /dev renders with and ai-edit.ts
|
|
50
|
-
// authenticates edits against. No caller-supplied tenant is ever honored.
|
|
51
|
-
const wanted = (session.tenants?.[0]?.resource ?? session.resource ?? "").toLowerCase();
|
|
52
|
-
const tenant = wanted ? await resolvePreviewTenant(wanted) : null;
|
|
53
|
-
if (!tenant) return json({ ok: false, message: "no store linked to this account" }, 403);
|
|
54
|
-
|
|
55
|
-
const kv = await readKv("TENANT_CACHE");
|
|
56
|
-
const kvGet = kv ? (key: string) => kv.get(key) : async () => null;
|
|
57
|
-
const kvPut = kv
|
|
58
|
-
? (key: string, value: string, opts: { expirationTtl: number }) => kv.put(key, value, opts)
|
|
59
|
-
: null;
|
|
60
|
-
const draftSecret = (await readEnv("CUSTOMIZATION_PREVIEW_SECRET")) ?? null;
|
|
61
|
-
const provider = createContentProvider(tenant, kv ? { get: kvGet, env: "live" } : undefined);
|
|
62
|
-
|
|
63
|
-
return { tenant, provider, kvGet, kvPut, draftSecret };
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export function isCockpitContext(v: CockpitContext | Response): v is CockpitContext {
|
|
67
|
-
return !(v instanceof Response);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
// ---------------------------------------------------------------------------
|
|
71
|
-
// The writable surface: content/home.html, content/pages-html/<slug>.html,
|
|
72
|
-
// theme.json — exactly scripts/dev/safe-path.mjs's WRITE_ALLOWLIST, mirrored
|
|
73
|
-
// here since the hosted Worker has no filesystem to check it against.
|
|
74
|
-
// ---------------------------------------------------------------------------
|
|
75
|
-
|
|
76
|
-
const PAGE_HTML_RE = /^content\/pages-html\/([^\0]+)\.html$/;
|
|
77
|
-
|
|
78
|
-
export function pageSlugForPath(path: string): string | null {
|
|
79
|
-
return PAGE_HTML_RE.exec(path)?.[1] ?? null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export function isWritablePath(path: string): boolean {
|
|
83
|
-
return path === "content/home.html" || path === "theme.json" || PAGE_HTML_RE.test(path);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function languageForPath(path: string): string | null {
|
|
87
|
-
if (path === "theme.json") return "json";
|
|
88
|
-
if (path === "content/home.html" || PAGE_HTML_RE.test(path)) return "html";
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/** The PUBLISHED value for one of the three writable-surface paths, or null if unknown/absent. */
|
|
93
|
-
export async function readPublishedPath(ctx: CockpitContext, path: string): Promise<string | null> {
|
|
94
|
-
if (path === "content/home.html") return ctx.provider.getHomeHtml();
|
|
95
|
-
if (path === "theme.json") {
|
|
96
|
-
return readPublishedArtifact(ctx.kvGet, ctx.tenant.tenant_id, "live", themeArtifactPath(ctx.tenant.tenant_id));
|
|
97
|
-
}
|
|
98
|
-
const slug = pageSlugForPath(path);
|
|
99
|
-
if (slug) return ctx.provider.getPageHtml(slug);
|
|
100
|
-
return null;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Deterministic small hash, standing in for the local file-writer's mtimeMs as
|
|
105
|
-
* an opaque "version" the client round-trips as `baseVersion` (C6 stale-write
|
|
106
|
-
* guard) — there's no filesystem here to stat. null in, null out (mirrors the
|
|
107
|
-
* local contract's `current: null` for "doesn't exist yet").
|
|
108
|
-
*/
|
|
109
|
-
export function contentVersion(content: string | null): number | null {
|
|
110
|
-
if (content === null) return null;
|
|
111
|
-
let h = 0x811c9dc5;
|
|
112
|
-
for (let i = 0; i < content.length; i++) {
|
|
113
|
-
h ^= content.charCodeAt(i);
|
|
114
|
-
h = Math.imul(h, 0x01000193);
|
|
115
|
-
}
|
|
116
|
-
return h >>> 0;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface DraftState {
|
|
120
|
-
/** The developer's existing draft id if their cookie verifies for this tenant, else a fresh one. */
|
|
121
|
-
draftId: string;
|
|
122
|
-
/** Draft-overlay value for `path` if one exists, else null. */
|
|
123
|
-
draftContent: string | null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/** Resolve (or mint) this request's draft id + this path's current draft-overlay value, if any. */
|
|
127
|
-
export async function resolveDraftState(
|
|
128
|
-
context: APIContext,
|
|
129
|
-
ctx: CockpitContext,
|
|
130
|
-
path: string,
|
|
131
|
-
): Promise<DraftState> {
|
|
132
|
-
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
133
|
-
const priorCookie = context.cookies.get(DEV_DRAFT_COOKIE)?.value ?? null;
|
|
134
|
-
const priorClaims =
|
|
135
|
-
priorCookie && ctx.draftSecret ? await verifyDevDraftToken(ctx.draftSecret, priorCookie, nowSeconds) : null;
|
|
136
|
-
const draftId =
|
|
137
|
-
priorClaims?.tenantId === ctx.tenant.tenant_id ? priorClaims.draftId : crypto.randomUUID();
|
|
138
|
-
const draftContent = await ctx.kvGet(devDraftKey(ctx.tenant.tenant_id, draftId, path));
|
|
139
|
-
return { draftId, draftContent };
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
/** The value the developer currently sees for `path`: their draft if present, else published. */
|
|
143
|
-
export async function readEffectivePath(
|
|
144
|
-
context: APIContext,
|
|
145
|
-
ctx: CockpitContext,
|
|
146
|
-
path: string,
|
|
147
|
-
): Promise<{ content: string | null; draftId: string }> {
|
|
148
|
-
const { draftId, draftContent } = await resolveDraftState(context, ctx, path);
|
|
149
|
-
if (draftContent !== null) return { content: draftContent, draftId };
|
|
150
|
-
return { content: await readPublishedPath(ctx, path), draftId };
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
/** (Re)issue the signed draft cookie so the middleware overlay + this route's own reads see it. */
|
|
154
|
-
export async function setDraftCookie(
|
|
155
|
-
context: APIContext,
|
|
156
|
-
ctx: CockpitContext,
|
|
157
|
-
draftId: string,
|
|
158
|
-
): Promise<void> {
|
|
159
|
-
if (!ctx.draftSecret) return;
|
|
160
|
-
const nowSeconds = Math.floor(Date.now() / 1000);
|
|
161
|
-
const token = await signDevDraftToken(ctx.draftSecret, ctx.tenant.tenant_id, draftId, DEV_DRAFT_TTL_SECONDS, nowSeconds);
|
|
162
|
-
context.cookies.set(DEV_DRAFT_COOKIE, token, {
|
|
163
|
-
httpOnly: true,
|
|
164
|
-
secure: true,
|
|
165
|
-
sameSite: "lax",
|
|
166
|
-
path: "/",
|
|
167
|
-
maxAge: DEV_DRAFT_TTL_SECONDS,
|
|
168
|
-
});
|
|
169
|
-
}
|