@tokenoftrust/storefront-runner 2.4.86 → 2.4.87

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 (143) hide show
  1. package/apps/storefront/env.d.ts +1 -1
  2. package/apps/storefront/src/components/{ProductCard.astro → catalog/storefront/ProductCard.astro} +3 -3
  3. package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/PriceDisplay.astro +1 -1
  4. package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/ProductCarousel.astro +1 -1
  5. package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/ProductGrid.astro +1 -1
  6. package/apps/storefront/src/components/{islands → catalog/storefront/islands}/SearchTypeahead.tsx +1 -1
  7. package/apps/storefront/src/components/{islands → catalog/storefront/islands}/VariantSelector.tsx +1 -1
  8. package/apps/storefront/src/components/{plp → catalog/storefront/plp}/FacetSidebar.astro +1 -1
  9. package/apps/storefront/src/components/chrome/SiteHeader.astro +1 -1
  10. package/apps/storefront/src/components/compliance/{NicotineWarning.astro → storefront/compliance/NicotineWarning.astro} +1 -1
  11. package/apps/storefront/src/components/{islands → compliance/storefront/islands}/CheckoutComplianceGate.tsx +1 -1
  12. package/apps/storefront/src/components/{subscription → subscriptions/storefront/subscription}/HowItWorksSteps.astro +1 -1
  13. package/apps/storefront/src/components/{subscription → subscriptions/storefront/subscription}/ManageSubscriptionEntry.astro +1 -1
  14. package/apps/storefront/src/components/{subscription → subscriptions/storefront/subscription}/SavingsExplainer.astro +2 -2
  15. package/apps/storefront/src/layouts/Layout.astro +8 -8
  16. package/apps/storefront/src/lib/activity/alerts.ts +1 -1
  17. package/apps/storefront/src/lib/activity/candidateSubmitLease.ts +1 -1
  18. package/apps/storefront/src/lib/activity/fixtures/evidence.ts +2 -2
  19. package/apps/storefront/src/lib/activity/query.ts +2 -2
  20. package/apps/storefront/src/lib/activity/store.ts +1 -1
  21. package/apps/storefront/src/lib/admin/services/mock/index.ts +5 -5
  22. package/apps/storefront/src/lib/apps/consentConfigRead.ts +1 -1
  23. package/apps/storefront/src/lib/apps/orders/attributionService.ts +2 -2
  24. package/apps/storefront/src/lib/apps/orders/orderConversionD1.ts +2 -2
  25. package/apps/storefront/src/lib/apps/orders/verifiedProviderMeasurement.ts +2 -2
  26. package/apps/storefront/src/lib/{admin → catalog/admin}/catalogSettingsClient.ts +2 -2
  27. package/apps/storefront/src/lib/{admin → catalog/admin}/services/catalogProducts.ts +2 -2
  28. package/apps/storefront/src/lib/{d1 → catalog/d1}/catalog.ts +1 -1
  29. package/apps/storefront/src/lib/{admin/services/mock → catalog/fixtures}/products.ts +5 -5
  30. package/apps/storefront/src/lib/{search → catalog/search}/index.ts +1 -1
  31. package/apps/storefront/src/lib/{priceBuckets.ts → catalog/shared/priceBuckets.ts} +1 -1
  32. package/apps/storefront/src/lib/{tot → catalog/tot}/ToTClient.ts +3 -3
  33. package/apps/storefront/src/lib/{tot → catalog/tot}/query.ts +1 -1
  34. package/apps/storefront/src/lib/{tot → catalog/tot}/syncState.ts +1 -1
  35. package/apps/storefront/src/lib/{tot → catalog/tot}/tenantCatalog.ts +1 -1
  36. package/apps/storefront/src/lib/{admin/services/mock → checkout/fixtures}/checkoutSettings.ts +2 -2
  37. package/apps/storefront/src/lib/content/index.ts +1 -1
  38. package/apps/storefront/src/lib/env.ts +1 -1
  39. package/apps/storefront/src/lib/fulfillment/store.ts +1 -1
  40. package/apps/storefront/src/lib/integrations/apps/appVersionStore.ts +1 -1
  41. package/apps/storefront/src/lib/integrations/apps/credentials.ts +1 -1
  42. package/apps/storefront/src/lib/integrations/apps/orders/idempotency.ts +1 -1
  43. package/apps/storefront/src/lib/integrations/apps/registryAccess.ts +1 -1
  44. package/apps/storefront/src/lib/integrations/apps/registryService.ts +1 -1
  45. package/apps/storefront/src/lib/integrations/integration/managedInstallDeclarations.ts +1 -1
  46. package/apps/storefront/src/lib/integrations/webhooks/deliveryEngine.ts +1 -1
  47. package/apps/storefront/src/lib/integrations/webhooks/deliveryStore.ts +1 -1
  48. package/apps/storefront/src/lib/integrations/webhooks/emit.ts +1 -1
  49. package/apps/storefront/src/lib/integrations/webhooks/getDispatcher.ts +1 -1
  50. package/apps/storefront/src/lib/jsonld.ts +1 -1
  51. package/apps/storefront/src/lib/monitoring/manifest.ts +1 -1
  52. package/apps/storefront/src/lib/newsletter/send.ts +1 -1
  53. package/apps/storefront/src/lib/newsletter/subscribers.ts +1 -1
  54. package/apps/storefront/src/lib/{apps/orders → orders/data}/orderForwardReceiver.ts +1 -1
  55. package/apps/storefront/src/lib/{apps/orders → orders/data}/orderMapper.ts +1 -1
  56. package/apps/storefront/src/lib/{apps/orders → orders/data}/ordersStore.ts +1 -1
  57. package/apps/storefront/src/lib/{admin/services/mock → orders/fixtures}/orders.ts +5 -5
  58. package/apps/storefront/src/lib/rawChrome.ts +2 -2
  59. package/apps/storefront/src/lib/sections.ts +2 -2
  60. package/apps/storefront/src/lib/social/tokenStore.ts +2 -2
  61. package/apps/storefront/src/lib/{admin/services/mock → subscriptions/fixtures}/subscriptions.ts +8 -8
  62. package/apps/storefront/src/lib/tracking/d1Control.ts +1 -1
  63. package/apps/storefront/src/lib/tracking/interactionStore.ts +0 -0
  64. package/apps/storefront/src/lib/tracking/pruneRollup.ts +1 -1
  65. package/apps/storefront/src/lib/tracking/tenantD1Registry.ts +1 -1
  66. package/apps/storefront/src/lib/url.ts +1 -1
  67. package/apps/storefront/src/middleware/controlPlane.ts +1 -1
  68. package/apps/storefront/src/middleware/index.ts +2 -2
  69. package/apps/storefront/src/middleware/renderChain.ts +2 -2
  70. package/apps/storefront/src/pages/404.astro +1 -1
  71. package/apps/storefront/src/pages/api/activity.ts +1 -1
  72. package/apps/storefront/src/pages/api/admin/activity-alerts.ts +1 -1
  73. package/apps/storefront/src/pages/api/admin/interaction-insights.ts +1 -1
  74. package/apps/storefront/src/pages/api/admin/orders/[id].ts +2 -2
  75. package/apps/storefront/src/pages/api/admin/orders.ts +2 -2
  76. package/apps/storefront/src/pages/api/commerce/checkout-handoff.ts +2 -2
  77. package/apps/storefront/src/pages/api/commerce/final-cart-authorization.ts +2 -2
  78. package/apps/storefront/src/pages/api/compliance/preflight.ts +1 -1
  79. package/apps/storefront/src/pages/api/newsletter/[collection]/subscribe.ts +1 -1
  80. package/apps/storefront/src/pages/api/newsletter/confirm.ts +1 -1
  81. package/apps/storefront/src/pages/api/newsletter/unsubscribe.ts +1 -1
  82. package/apps/storefront/src/pages/api/tracking/interaction.ts +1 -1
  83. package/apps/storefront/src/pages/collections/[handle].astro +5 -5
  84. package/apps/storefront/src/pages/collections/index.astro +2 -2
  85. package/apps/storefront/src/pages/index.astro +4 -4
  86. package/apps/storefront/src/pages/llms.txt.ts +1 -1
  87. package/apps/storefront/src/pages/products/[handle].astro +11 -11
  88. package/apps/storefront/src/pages/search.astro +2 -2
  89. package/apps/storefront/src/pages/sitemap.xml.ts +1 -1
  90. package/apps/storefront/src/pages/style-guide/[tenant]/[theme].astro +34 -34
  91. package/docs/widget-library-guide.md +35 -35
  92. package/package.json +1 -1
  93. package/packages/public-runtime/src/chrome.ts +1 -1
  94. /package/apps/storefront/src/components/{CollectionCard.astro → catalog/storefront/CollectionCard.astro} +0 -0
  95. /package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/BrandGrid.astro +0 -0
  96. /package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/RatingStars.astro +0 -0
  97. /package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/ReviewList.astro +0 -0
  98. /package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/ReviewSummary.astro +0 -0
  99. /package/apps/storefront/src/components/{commerce → catalog/storefront/commerce}/TagFilterCloud.astro +0 -0
  100. /package/apps/storefront/src/components/{islands → catalog/storefront/islands}/ImageGallery.tsx +0 -0
  101. /package/apps/storefront/src/components/{islands → catalog/storefront/islands}/QuickView.tsx +0 -0
  102. /package/apps/storefront/src/components/{islands → catalog/storefront/islands}/RecentlyViewed.tsx +0 -0
  103. /package/apps/storefront/src/components/{plp → catalog/storefront/plp}/ActiveFilters.astro +0 -0
  104. /package/apps/storefront/src/components/{plp → catalog/storefront/plp}/Pagination.astro +0 -0
  105. /package/apps/storefront/src/components/{plp → catalog/storefront/plp}/SortSelect.astro +0 -0
  106. /package/apps/storefront/src/components/{commerce → checkout/storefront/commerce}/CartDrawerStyles.astro +0 -0
  107. /package/apps/storefront/src/components/{commerce → checkout/storefront/commerce}/CheckoutLoader.astro +0 -0
  108. /package/apps/storefront/src/components/compliance/{AdultSignatureNotice.astro → storefront/compliance/AdultSignatureNotice.astro} +0 -0
  109. /package/apps/storefront/src/components/compliance/{ComplianceNotice.astro → storefront/compliance/ComplianceNotice.astro} +0 -0
  110. /package/apps/storefront/src/components/compliance/{ExciseTaxNotice.astro → storefront/compliance/ExciseTaxNotice.astro} +0 -0
  111. /package/apps/storefront/src/components/compliance/{PactActNotice.astro → storefront/compliance/PactActNotice.astro} +0 -0
  112. /package/apps/storefront/src/components/compliance/{Prop65Warning.astro → storefront/compliance/Prop65Warning.astro} +0 -0
  113. /package/apps/storefront/src/components/compliance/{PurchaseLimitNotice.astro → storefront/compliance/PurchaseLimitNotice.astro} +0 -0
  114. /package/apps/storefront/src/components/compliance/{ShippingRestrictionNotice.astro → storefront/compliance/ShippingRestrictionNotice.astro} +0 -0
  115. /package/apps/storefront/src/components/compliance/{StateEligibilityNotice.astro → storefront/compliance/StateEligibilityNotice.astro} +0 -0
  116. /package/apps/storefront/src/components/{islands → compliance/storefront/islands}/AgeGate.tsx +0 -0
  117. /package/apps/storefront/src/components/{islands → compliance/storefront/islands}/IsolatedAgeGate.tsx +0 -0
  118. /package/apps/storefront/src/lib/{admin → catalog/admin}/catalogSettingsPreview.ts +0 -0
  119. /package/apps/storefront/src/lib/{admin → catalog/admin}/catalogSettingsState.ts +0 -0
  120. /package/apps/storefront/src/lib/{admin → catalog/admin}/productSetupPhoto.ts +0 -0
  121. /package/apps/storefront/src/lib/{admin → catalog/admin}/productsTabClient.ts +0 -0
  122. /package/apps/storefront/src/lib/{admin → catalog/admin}/viewmodels/catalogProducts.ts +0 -0
  123. /package/apps/storefront/src/lib/{admin → catalog/admin}/viewmodels/products.ts +0 -0
  124. /package/apps/storefront/src/lib/{fixtures → catalog/fixtures}/sampleProducts.ts +0 -0
  125. /package/apps/storefront/src/lib/{featuredProductsPresentation.ts → catalog/shared/featuredProductsPresentation.ts} +0 -0
  126. /package/apps/storefront/src/lib/{tot → catalog/tot}/d1Client.ts +0 -0
  127. /package/apps/storefront/src/lib/{tot → catalog/tot}/totClientInterface.ts +0 -0
  128. /package/apps/storefront/src/lib/{admin → checkout/admin}/checkoutStyleInput.ts +0 -0
  129. /package/apps/storefront/src/lib/{admin → checkout/admin}/checkoutStyleTarget.ts +0 -0
  130. /package/apps/storefront/src/{components/islands → lib/checkout/browser}/useCheckoutHandoffCorrelation.ts +0 -0
  131. /package/apps/storefront/src/lib/{commerce → checkout/commerce}/checkoutHandoffCorrelation.ts +0 -0
  132. /package/apps/storefront/src/lib/{commerce → checkout/commerce}/checkoutSettings.ts +0 -0
  133. /package/apps/storefront/src/lib/{commerce → checkout/commerce}/finalCartAuthorization.ts +0 -0
  134. /package/apps/storefront/src/lib/{checkoutCommerce.ts → checkout/shared/checkoutCommerce.ts} +0 -0
  135. /package/apps/storefront/src/{components/islands → lib/compliance/browser}/checkoutVerificationFlow.ts +0 -0
  136. /package/apps/storefront/src/lib/{visitorRegionCookie.ts → compliance/shared/visitorRegionCookie.ts} +0 -0
  137. /package/apps/storefront/src/lib/{verification → compliance/verification}/totVerificationClient.ts +0 -0
  138. /package/apps/storefront/src/lib/{admin → orders/admin}/orderClient.ts +0 -0
  139. /package/apps/storefront/src/lib/{admin → orders/admin}/services/orders.ts +0 -0
  140. /package/apps/storefront/src/lib/{admin → orders/admin}/viewmodels/orders.ts +0 -0
  141. /package/apps/storefront/src/lib/{apps/orders → orders/providers}/foxyOrderClient.ts +0 -0
  142. /package/apps/storefront/src/lib/{admin → subscriptions/admin}/viewmodels/subscriptions.ts +0 -0
  143. /package/apps/storefront/src/lib/{subscription → subscriptions/subscription}/model.ts +0 -0
@@ -18,7 +18,7 @@
18
18
  * per-subscriber diff. "New since last send" is computed once from the previous
19
19
  * ledger row's `sent_at`, not per-subscriber.
20
20
  */
21
- import type { Queryable } from "../d1/catalog.js";
21
+ import type { Queryable } from "../catalog/d1/catalog.js";
22
22
  import type { BlogPostSummary } from "../blog/types.js";
23
23
  import {
24
24
  sendBatch as realSendBatch,
@@ -9,7 +9,7 @@
9
9
  * caller is responsible for resolving `tenantId` from the request host/session
10
10
  * (NEVER a client body) — that is the multi-tenant isolation boundary.
11
11
  */
12
- import type { Queryable } from "../d1/catalog.js";
12
+ import type { Queryable } from "../catalog/d1/catalog.js";
13
13
 
14
14
  export type SubscriberStatus = "pending" | "confirmed" | "unsubscribed" | "bounced";
15
15
 
@@ -35,7 +35,7 @@
35
35
  import { OrdersStore, ScrappyOrderLedger, type OrderLineItem, type OrderStatus, type Order } from "./ordersStore.js";
36
36
  import { emitWebhookEvent } from "../../integrations/webhooks/emit.js";
37
37
  import type { WebhookTopic } from "../../integrations/webhooks/deliveryStore.js";
38
- import type { Queryable } from "../../d1/catalog.js";
38
+ import type { Queryable } from "../../catalog/d1/catalog.js";
39
39
  import {
40
40
  createLocalJWKSet,
41
41
  decodeJwt,
@@ -9,7 +9,7 @@
9
9
  * customer identity is always the per-(tenant, install) `customerHash`.
10
10
  */
11
11
  import { customerHash } from "../../integrations/apps/orders/customerHash.js";
12
- import type { FoxyOrder, FoxyOrderLineItem } from "./foxyOrderClient.js";
12
+ import type { FoxyOrder, FoxyOrderLineItem } from "../providers/foxyOrderClient.js";
13
13
  import {
14
14
  COMPLIANCE_STATES,
15
15
  FULFILLMENT_STATES,
@@ -10,7 +10,7 @@
10
10
  * `AppRegistryService` uses, so this runs unchanged against real D1 in the
11
11
  * Worker and an in-memory `node:sqlite` in tests.
12
12
  */
13
- import type { Queryable, QueryStatement } from "../../d1/catalog.js";
13
+ import type { Queryable, QueryStatement } from "../../catalog/d1/catalog.js";
14
14
  import {
15
15
  canonicalJson,
16
16
  idempotencyKey,
@@ -1,5 +1,5 @@
1
- import type { AdminTenantEnvelope } from "../../envelope";
2
- import { MOCK_ANCHOR_ISO, offsetIso, pick, randomBool, randomInt, seededRandom } from "../../seed";
1
+ import type { AdminTenantEnvelope } from "../../admin/envelope";
2
+ import { MOCK_ANCHOR_ISO, offsetIso, pick, randomBool, randomInt, seededRandom } from "../../admin/seed";
3
3
  import type {
4
4
  OrderDetail,
5
5
  OrderEvidenceEvent,
@@ -7,9 +7,9 @@ import type {
7
7
  OrderQueueSummary,
8
8
  OrderRow,
9
9
  OrdersViewModel,
10
- } from "../../viewmodels/orders";
11
- import { tenantProfile } from "./tenants";
12
- import { memoizeByEnvelope } from "../../memoizeByEnvelope";
10
+ } from "../admin/viewmodels/orders";
11
+ import { tenantProfile } from "../../admin/services/mock/tenants";
12
+ import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
13
13
 
14
14
  // Must stay index-aligned with customers.ts's NAMES: an order's customerId is
15
15
  // derived from the picked name's position here, and customers.ts assigns each
@@ -431,7 +431,7 @@ function renderHeader(header: ChromeHeader, variant: HeaderVariant, currentPath?
431
431
  /**
432
432
  * Age-gate config, embedded as JSON. The CHROME_BEHAVIOR_JS mechanism
433
433
  * reads this and builds the dialog itself inside a closed shadow root — the same
434
- * tamper-resistance pattern components/islands/IsolatedAgeGate.tsx uses for
434
+ * tamper-resistance pattern components/compliance/storefront/islands/IsolatedAgeGate.tsx uses for
435
435
  * component pages (see its header comment). `<` is escaped so an authored value
436
436
  * can't close the tag early.
437
437
  */
@@ -683,7 +683,7 @@ export const CHROME_BEHAVIOR_JS = `(function () {
683
683
  }
684
684
 
685
685
  // 21+ age gate — shadow-isolated. Only the host <div> lives in light
686
- // DOM (data-tot-compliance, the same marker components/islands/IsolatedAgeGate.tsx
686
+ // DOM (data-tot-compliance, the same marker components/compliance/storefront/islands/IsolatedAgeGate.tsx
687
687
  // uses); its contents sit behind a closed shadow root, so tenant CSS/JS can't
688
688
  // select, restyle, or hide the dialog. A MutationObserver re-asserts the host the
689
689
  // same way that component does. Config comes from the validated ChromeAgeGate
@@ -16,8 +16,8 @@ import {
16
16
  type CatalogProduct,
17
17
  type ProductSectionSource,
18
18
  } from "@tot/public-runtime";
19
- import type { ToTClient } from "@/lib/tot/ToTClient";
20
- import { isOnSale } from "@/lib/tot/query";
19
+ import type { ToTClient } from "@/lib/catalog/tot/ToTClient";
20
+ import { isOnSale } from "@/lib/catalog/tot/query";
21
21
 
22
22
  /**
23
23
  * Where a merchandising section gets its products. Exactly one shape per source.
@@ -18,7 +18,7 @@
18
18
  * root that wires the real bindings (mirrors `getDispatcher()`); it returns
19
19
  * `null` when either binding is absent so callers degrade rather than throw.
20
20
  */
21
- import type { Queryable } from "../d1/catalog.js";
21
+ import type { Queryable } from "../catalog/d1/catalog.js";
22
22
  import { readD1, readEnv } from "../env.js";
23
23
 
24
24
  /** The decrypted token material we persist as one JSON blob under AES-GCM. */
@@ -162,7 +162,7 @@ export async function rotateSocialToken(
162
162
  */
163
163
  export async function resolveSocialTokenStore(): Promise<SocialTokenStoreDeps | null> {
164
164
  const [{ fromD1 }, d1, rawKek] = await Promise.all([
165
- import("../d1/catalog.js"),
165
+ import("../catalog/d1/catalog.js"),
166
166
  readD1("STOREFRONT_APPS_DB"),
167
167
  readEnv("SOCIAL_TOKEN_KEK"),
168
168
  ]);
@@ -7,16 +7,16 @@ import {
7
7
  isSubscriptionFrequency,
8
8
  purchaseOptionPrice,
9
9
  } from "@tot/public-runtime";
10
- import type { AdminTenantEnvelope } from "../../envelope";
11
- import { memoizeByEnvelope } from "../../memoizeByEnvelope";
10
+ import type { AdminTenantEnvelope } from "../../admin/envelope";
11
+ import { memoizeByEnvelope } from "../../admin/memoizeByEnvelope";
12
12
  import {
13
13
  MOCK_ANCHOR_ISO,
14
14
  offsetIso,
15
15
  randomInt,
16
16
  seededRandom,
17
- } from "../../seed";
18
- import type { CustomerRow } from "../../../customers/admin/viewmodels/customers";
19
- import type { ProductDetail, ProductRow } from "../../viewmodels/products";
17
+ } from "../../admin/seed";
18
+ import type { CustomerRow } from "../../customers/admin/viewmodels/customers";
19
+ import type { ProductDetail, ProductRow } from "../../catalog/admin/viewmodels/products";
20
20
  import type {
21
21
  SubscriptionAttentionRow,
22
22
  SubscriptionCheckoutField,
@@ -27,9 +27,9 @@ import type {
27
27
  SubscriptionRenewalEvent,
28
28
  SubscriptionSubscriberRow,
29
29
  SubscriptionsViewModel,
30
- } from "../../viewmodels/subscriptions";
31
- import { getCustomersViewModel } from "../../../customers/fixtures/customers";
32
- import { getProductsViewModel } from "./products";
30
+ } from "../admin/viewmodels/subscriptions";
31
+ import { getCustomersViewModel } from "../../customers/fixtures/customers";
32
+ import { getProductsViewModel } from "../../catalog/fixtures/products";
33
33
 
34
34
  export interface SubscriptionProductSource {
35
35
  productId: string;
@@ -22,7 +22,7 @@
22
22
  * transport-agnostic and unit-testable against an in-memory sqlite.
23
23
  */
24
24
  import { readEnv } from "../env.js";
25
- import type { Queryable, QueryStatement } from "../d1/catalog.js";
25
+ import type { Queryable, QueryStatement } from "../catalog/d1/catalog.js";
26
26
 
27
27
  const CF_API_BASE = "https://api.cloudflare.com/client/v4";
28
28
 
@@ -44,7 +44,7 @@
44
44
  * transient D1 fault) is caught, logged, and recorded in that tenant's
45
45
  * outcome — it never aborts the rest of the batch.
46
46
  */
47
- import type { Queryable } from "../d1/catalog.js";
47
+ import type { Queryable } from "../catalog/d1/catalog.js";
48
48
  import type { AnalyticsEngineLike } from "../activity/store.js";
49
49
  import { fromD1Rest, type D1ControlConfig } from "./d1Control.js";
50
50
  import { aggregateInteractions, writeInteractionAnalytics } from "./interactionStore.js";
@@ -32,7 +32,7 @@
32
32
  */
33
33
  import { sha256Hex } from "@tot/public-runtime";
34
34
  import { readEnv } from "../env.js";
35
- import type { Queryable } from "../d1/catalog.js";
35
+ import type { Queryable } from "../catalog/d1/catalog.js";
36
36
  import {
37
37
  ensureDatabase,
38
38
  fromD1Rest,
@@ -8,7 +8,7 @@
8
8
  * &opt.Size=M&tag=sale&priceMin=50&priceMax=200&q=wool
9
9
  */
10
10
  import type { ListProductsQuery } from "@tot/public-runtime";
11
- import type { PriceBucket } from "./priceBuckets.js";
11
+ import type { PriceBucket } from "./catalog/shared/priceBuckets.js";
12
12
 
13
13
  export function parseQuery(url: URL): ListProductsQuery {
14
14
  const sp = url.searchParams;
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import type { APIContext, MiddlewareNext } from "astro";
10
10
  import { readEnv, readD1, readKv } from "@/lib/env";
11
- import { fromD1, type D1Like } from "@/lib/d1/catalog";
11
+ import { fromD1, type D1Like } from "@/lib/catalog/d1/catalog";
12
12
  import { readCurrentTenantConsentConfig } from "@/lib/apps/consentConfigRead";
13
13
  import { loadActiveManagedInstallDeclarations } from "@/lib/integrations/integration/managedInstallDeclarations";
14
14
  import { buildTenantConsentBroker, verifyPreviewToken } from "@tot/public-runtime";
@@ -29,7 +29,7 @@ import { compileRouteTierIndexV1, resolvePublicationRoutePlanV1, type RouteTierI
29
29
  import type { PublicationArtifactBucketV1, TenantConfig } from "@tot/public-runtime";
30
30
  import { DEV_DRAFT_COOKIE } from "@/lib/dev/devDraft";
31
31
  import { applySecurityHeaders } from "@/lib/securityHeaders";
32
- import { visitorRegionFor, withVisitorRegionCookie } from "@/lib/visitorRegionCookie";
32
+ import { visitorRegionFor, withVisitorRegionCookie } from "@/lib/compliance/shared/visitorRegionCookie";
33
33
  import { tryServeStaticBundle } from "./staticBundle.js";
34
34
  import { resolveCandidateContentPin } from "./candidatePin.js";
35
35
  import { parseGateMode } from "@/lib/auth/loginGate";
@@ -69,7 +69,7 @@ function routeTierIndexFor(tenant: TenantConfig): RouteTierIndexV1 {
69
69
  }
70
70
 
71
71
  /**
72
- * Every HTML document leaves with the visitor's region class (lib/visitorRegionCookie),
72
+ * Every HTML document leaves with the visitor's region class (lib/compliance/shared/visitorRegionCookie),
73
73
  * appended after the branch has read or written any edge cache.
74
74
  */
75
75
  export const onRequest = defineMiddleware(async (context, next) => {
@@ -11,7 +11,7 @@
11
11
  import type { APIContext, MiddlewareNext } from "astro";
12
12
  import { referenceTheme } from "@/themes/reference";
13
13
  import { mergeTheme, themeToCssVars } from "@/themes/schema";
14
- import { createToTClient } from "@/lib/tot/ToTClient";
14
+ import { createToTClient } from "@/lib/catalog/tot/ToTClient";
15
15
  import { readEnv, readR2 } from "@/lib/runtimeEnv";
16
16
  import { tryServeStaticBundle } from "./staticBundle.js";
17
17
  import { isPlatformPublicDiscoveryPath } from "./routeBranch.js";
@@ -85,7 +85,7 @@ import {
85
85
  } from "@tot/public-runtime";
86
86
  import { publicationContentRedirectLocationV1 } from "@tot/public-runtime/publication-content-redirects";
87
87
  import { loadTenantIntegrationDeclarations } from "@/lib/integrations/integration/tenantDeclarations";
88
- import { resolveTenantCommerce } from "@/lib/checkoutCommerce";
88
+ import { resolveTenantCommerce } from "@/lib/checkout/shared/checkoutCommerce";
89
89
  import {
90
90
  requestBrowserEnvironment,
91
91
  previewBrowserEnvironment,
@@ -12,7 +12,7 @@
12
12
  export const prerender = false;
13
13
 
14
14
  import Layout from "@/layouts/Layout.astro";
15
- import CollectionCard from "@/components/CollectionCard.astro";
15
+ import CollectionCard from "@/components/catalog/storefront/CollectionCard.astro";
16
16
  import { withBase } from "@/lib/basePath";
17
17
 
18
18
  const { tenant, tot, basePath, features } = Astro.locals;
@@ -29,7 +29,7 @@
29
29
  */
30
30
  import type { APIContext } from "astro";
31
31
  import { readD1, readEnv, readAnalytics, runAfterResponse, type CfExecutionContextLike } from "@/lib/env";
32
- import { fromD1 } from "@/lib/d1/catalog";
32
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
33
33
  import { verifyIngestAuth } from "@/lib/activity/ingestAuth";
34
34
  import { ingestEvents, type IngestRejection } from "@/lib/activity/ingest";
35
35
  import { fanOutActivity, type AnalyticsEngineLike, type ActivitySinks } from "@/lib/activity/store";
@@ -27,7 +27,7 @@
27
27
  import type { APIContext } from "astro";
28
28
  import { requireAdminApiEntry } from "@/lib/auth/adminApiGuard";
29
29
  import { readD1 } from "@/lib/env";
30
- import { fromD1 } from "@/lib/d1/catalog";
30
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
31
31
  import { checkActivityAlerts } from "@/lib/activity/alerts";
32
32
 
33
33
  export const prerender = false;
@@ -30,7 +30,7 @@
30
30
  import type { APIContext } from "astro";
31
31
  import { requireAdminApiEntry } from "@/lib/auth/adminApiGuard";
32
32
  import { readD1 } from "@/lib/env";
33
- import { fromD1 } from "@/lib/d1/catalog";
33
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
34
34
  import { resolveTenantStore, trackingNamePrefix } from "@/lib/tracking/tenantD1Registry";
35
35
  import { readD1Control } from "@/lib/tracking/d1Control";
36
36
  import { readTenantInteractionInsights } from "@/lib/tracking/tenantReadAccess";
@@ -15,8 +15,8 @@ import {
15
15
  orderApiBaseUrl,
16
16
  OrderApiError,
17
17
  projectCheckoutOrder,
18
- } from "@/lib/admin/orderClient";
19
- import { assessCheckoutOrder } from "@/lib/admin/services/orders";
18
+ } from "@/lib/orders/admin/orderClient";
19
+ import { assessCheckoutOrder } from "@/lib/orders/admin/services/orders";
20
20
  import { commerceStageForEnv } from "@/lib/fulfillment/fulfillmentService";
21
21
 
22
22
  export const prerender = false;
@@ -16,9 +16,9 @@ import {
16
16
  createCheckoutOrderClient,
17
17
  orderApiBaseUrl,
18
18
  OrderApiError,
19
- } from "@/lib/admin/orderClient";
19
+ } from "@/lib/orders/admin/orderClient";
20
20
  import { commerceStageForEnv } from "@/lib/fulfillment/fulfillmentService";
21
- import { assessCheckoutOrder, parseOrderFilters } from "@/lib/admin/services/orders";
21
+ import { assessCheckoutOrder, parseOrderFilters } from "@/lib/orders/admin/services/orders";
22
22
 
23
23
  export const prerender = false;
24
24
 
@@ -25,8 +25,8 @@ import {
25
25
  defaultConsentSnapshot,
26
26
  type CartDenialCode,
27
27
  } from "@tot/public-runtime";
28
- import { resolveCheckoutHandoffCorrelation } from "@/lib/commerce/checkoutHandoffCorrelation";
29
- import { resolveCartSigning, shopperCartDenialMessage } from "@/lib/checkoutCommerce";
28
+ import { resolveCheckoutHandoffCorrelation } from "@/lib/checkout/commerce/checkoutHandoffCorrelation";
29
+ import { resolveCartSigning, shopperCartDenialMessage } from "@/lib/checkout/shared/checkoutCommerce";
30
30
 
31
31
  export const prerender = false;
32
32
 
@@ -17,9 +17,9 @@ import {
17
17
  type PaymentState,
18
18
  type StockState,
19
19
  } from "@tot/public-runtime";
20
- import { fromD1, listAllActiveProducts } from "@/lib/d1/catalog.js";
20
+ import { fromD1, listAllActiveProducts } from "@/lib/catalog/d1/catalog.js";
21
21
  import { readD1, readEnv } from "@/lib/env";
22
- import { evaluateFinalCart, type SeamView } from "@/lib/commerce/finalCartAuthorization.js";
22
+ import { evaluateFinalCart, type SeamView } from "@/lib/checkout/commerce/finalCartAuthorization.js";
23
23
  import { d1CommerceRunner, mirrorOnHand, reserveAllocation } from "@/lib/inventory/allocations.js";
24
24
  import { POST as compliancePreflight } from "../compliance/preflight.js";
25
25
 
@@ -33,7 +33,7 @@ import {
33
33
  createTotVerificationClient,
34
34
  type TotVerificationClient,
35
35
  type TotVerificationStatus,
36
- } from "@/lib/verification/totVerificationClient";
36
+ } from "@/lib/compliance/verification/totVerificationClient";
37
37
 
38
38
  export const prerender = false;
39
39
 
@@ -16,7 +16,7 @@
16
16
  */
17
17
  import type { APIRoute } from "astro";
18
18
  import { readD1, readKv, readEnv } from "@/lib/env";
19
- import { fromD1 } from "@/lib/d1/catalog";
19
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
20
20
  import { checkRateLimit } from "@/lib/rate/kvWindow";
21
21
  import { NewsletterSubscribersStore } from "@/lib/newsletter/subscribers";
22
22
  import { randomToken, hashConsentIp } from "@/lib/newsletter/consent";
@@ -11,7 +11,7 @@
11
11
  */
12
12
  import type { APIRoute } from "astro";
13
13
  import { readD1 } from "@/lib/env";
14
- import { fromD1 } from "@/lib/d1/catalog";
14
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
15
15
  import { NewsletterSubscribersStore } from "@/lib/newsletter/subscribers";
16
16
 
17
17
  export const prerender = false;
@@ -20,7 +20,7 @@
20
20
  */
21
21
  import type { APIContext } from "astro";
22
22
  import { readD1 } from "@/lib/env";
23
- import { fromD1 } from "@/lib/d1/catalog";
23
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
24
24
  import { unsubscribeByToken } from "@/lib/newsletter/subscribers";
25
25
 
26
26
  export const prerender = false;
@@ -38,7 +38,7 @@
38
38
  */
39
39
  import type { APIContext } from "astro";
40
40
  import { readD1, readAnalytics, runAfterResponse, type CfExecutionContextLike } from "@/lib/env";
41
- import { fromD1 } from "@/lib/d1/catalog";
41
+ import { fromD1 } from "@/lib/catalog/d1/catalog";
42
42
  import { ingestInteractions, type StampedInteractionEvent } from "@/lib/tracking/collectorIngest";
43
43
  import { readD1Control } from "@/lib/tracking/d1Control";
44
44
  import { resolveTenantStore, trackingNamePrefix } from "@/lib/tracking/tenantD1Registry";
@@ -8,12 +8,12 @@
8
8
  import Layout from "@/layouts/Layout.astro";
9
9
  import Breadcrumbs from "@/components/Breadcrumbs.astro";
10
10
  import { homeCrumbLabel, siteTrail } from "@/lib/breadcrumbs";
11
- import ProductCard from "@/components/ProductCard.astro";
11
+ import ProductCard from "@/components/catalog/storefront/ProductCard.astro";
12
12
  import EmptyState from "@/components/EmptyState.astro";
13
- import FacetSidebar from "@/components/plp/FacetSidebar.astro";
14
- import ActiveFilters from "@/components/plp/ActiveFilters.astro";
15
- import SortSelect from "@/components/plp/SortSelect.astro";
16
- import Pagination from "@/components/plp/Pagination.astro";
13
+ import FacetSidebar from "@/components/catalog/storefront/plp/FacetSidebar.astro";
14
+ import ActiveFilters from "@/components/catalog/storefront/plp/ActiveFilters.astro";
15
+ import SortSelect from "@/components/catalog/storefront/plp/SortSelect.astro";
16
+ import Pagination from "@/components/catalog/storefront/plp/Pagination.astro";
17
17
  import Img from "@/components/assets/storefront/Img.astro";
18
18
  import { parseQuery, buildQueryString } from "@/lib/url";
19
19
  import { breadcrumbLd, itemListLd } from "@/lib/jsonld";
@@ -6,10 +6,10 @@
6
6
  import Layout from "@/layouts/Layout.astro";
7
7
  import Breadcrumbs from "@/components/Breadcrumbs.astro";
8
8
  import { homeCrumbLabel, siteTrail } from "@/lib/breadcrumbs";
9
- import CollectionCard from "@/components/CollectionCard.astro";
9
+ import CollectionCard from "@/components/catalog/storefront/CollectionCard.astro";
10
10
  import EmptyState from "@/components/EmptyState.astro";
11
11
  import { breadcrumbLd } from "@/lib/jsonld";
12
- import { activeMemberCount, nonEmptyCollections } from "@/lib/tot/query";
12
+ import { activeMemberCount, nonEmptyCollections } from "@/lib/catalog/tot/query";
13
13
 
14
14
  const { tenant, tot, canonicalBase } = Astro.locals;
15
15
  // Commerce-only route: marketing tenants have no catalog surface.
@@ -9,9 +9,9 @@
9
9
  import Layout from "@/layouts/Layout.astro";
10
10
  import Section from "@/components/Section.astro";
11
11
  import Hero from "@/components/home/Hero.astro";
12
- import ProductCarousel from "@/components/commerce/ProductCarousel.astro";
13
- import ProductGrid from "@/components/commerce/ProductGrid.astro";
14
- import CollectionCard from "@/components/CollectionCard.astro";
12
+ import ProductCarousel from "@/components/catalog/storefront/commerce/ProductCarousel.astro";
13
+ import ProductGrid from "@/components/catalog/storefront/commerce/ProductGrid.astro";
14
+ import CollectionCard from "@/components/catalog/storefront/CollectionCard.astro";
15
15
  import Img from "@/components/assets/storefront/Img.astro";
16
16
  import PromoTiles from "@/components/content/PromoTiles.astro";
17
17
  import TrustStrip from "@/components/content/TrustStrip.astro";
@@ -36,7 +36,7 @@ import {
36
36
  normalizeProductSectionSource,
37
37
  } from "@tot/public-runtime";
38
38
  import { resolveSectionSource } from "@/lib/sections";
39
- import { featuredProductsPresentationView } from "@/lib/featuredProductsPresentation";
39
+ import { featuredProductsPresentationView } from "@/lib/catalog/shared/featuredProductsPresentation";
40
40
  import {
41
41
  editorialMediaView,
42
42
  resolveCommerceStaticBlock,
@@ -10,7 +10,7 @@
10
10
  * SEO text; compliance facts come from tenant.compliance.
11
11
  */
12
12
  import type { APIContext } from "astro";
13
- import { nonEmptyCollections } from "@/lib/tot/query.js";
13
+ import { nonEmptyCollections } from "@/lib/catalog/tot/query.js";
14
14
  import { getBlogSettings, listBlogPosts } from "@/lib/blog/provider.js";
15
15
  import { compileRouteTierIndexV1 } from "@tot/public-runtime";
16
16
  import { readKv } from "@/lib/runtimeEnv.js";
@@ -9,17 +9,17 @@ import Layout from "@/layouts/Layout.astro";
9
9
  import Breadcrumbs from "@/components/Breadcrumbs.astro";
10
10
  import { homeCrumbLabel, siteTrail } from "@/lib/breadcrumbs";
11
11
  import Badge from "@/components/Badge.astro";
12
- import ProductCard from "@/components/ProductCard.astro";
12
+ import ProductCard from "@/components/catalog/storefront/ProductCard.astro";
13
13
  import Section from "@/components/Section.astro";
14
- import ImageGallery from "@/components/islands/ImageGallery.tsx";
15
- import VariantSelector, { publicSelectorVariants } from "@/components/islands/VariantSelector.tsx";
16
- import CheckoutComplianceGate from "@/components/islands/CheckoutComplianceGate.tsx";
17
- import RecentlyViewed from "@/components/islands/RecentlyViewed.tsx";
18
- import NicotineWarning from "@/components/compliance/NicotineWarning.astro";
19
- import Prop65Warning from "@/components/compliance/Prop65Warning.astro";
20
- import ReviewSummary from "@/components/commerce/ReviewSummary.astro";
21
- import ReviewList from "@/components/commerce/ReviewList.astro";
22
- import { isOnSale, isNew, isAvailable, fromPrice } from "@/lib/tot/query";
14
+ import ImageGallery from "@/components/catalog/storefront/islands/ImageGallery.tsx";
15
+ import VariantSelector, { publicSelectorVariants } from "@/components/catalog/storefront/islands/VariantSelector.tsx";
16
+ import CheckoutComplianceGate from "@/components/compliance/storefront/islands/CheckoutComplianceGate.tsx";
17
+ import RecentlyViewed from "@/components/catalog/storefront/islands/RecentlyViewed.tsx";
18
+ import NicotineWarning from "@/components/compliance/storefront/compliance/NicotineWarning.astro";
19
+ import Prop65Warning from "@/components/compliance/storefront/compliance/Prop65Warning.astro";
20
+ import ReviewSummary from "@/components/catalog/storefront/commerce/ReviewSummary.astro";
21
+ import ReviewList from "@/components/catalog/storefront/commerce/ReviewList.astro";
22
+ import { isOnSale, isNew, isAvailable, fromPrice } from "@/lib/catalog/tot/query";
23
23
  import {
24
24
  buildMemberSignedCartPayload,
25
25
  workerCartApiPath,
@@ -38,7 +38,7 @@ import type {
38
38
  MembershipStackingPolicy,
39
39
  PurchaseOptionPricingContext,
40
40
  } from "@tot/public-runtime";
41
- import { resolveCartSigning, shopperCheckoutUnavailableHtml } from "@/lib/checkoutCommerce";
41
+ import { resolveCartSigning, shopperCheckoutUnavailableHtml } from "@/lib/checkout/shared/checkoutCommerce";
42
42
  import { isRegulatedTenant } from "@/lib/compliance/enforcement";
43
43
  import { resolveMemberContext } from "@/lib/membership/eligibility";
44
44
  import { truncate } from "@/lib/format";
@@ -12,10 +12,10 @@
12
12
  import Layout from "@/layouts/Layout.astro";
13
13
  import Breadcrumbs from "@/components/Breadcrumbs.astro";
14
14
  import { homeCrumbLabel, siteTrail } from "@/lib/breadcrumbs";
15
- import ProductCard from "@/components/ProductCard.astro";
15
+ import ProductCard from "@/components/catalog/storefront/ProductCard.astro";
16
16
  import EmptyState from "@/components/EmptyState.astro";
17
17
  import Section from "@/components/Section.astro";
18
- import { toTypeaheadDoc } from "@/lib/search";
18
+ import { toTypeaheadDoc } from "@/lib/catalog/search/index";
19
19
  import { breadcrumbLd } from "@/lib/jsonld";
20
20
  import { withBase } from "@/lib/basePath";
21
21
 
@@ -9,7 +9,7 @@
9
9
  * loc is prefix-correct without special-casing here.
10
10
  */
11
11
  import type { APIContext } from "astro";
12
- import { nonEmptyCollections } from "@/lib/tot/query.js";
12
+ import { nonEmptyCollections } from "@/lib/catalog/tot/query.js";
13
13
  import { getBlogSettings, listBlogPosts } from "@/lib/blog/provider.js";
14
14
  import { authorSlug, categorySlug } from "@/lib/blog/collection.js";
15
15
  import { resolveBlogIndexCopy } from "@/lib/blog/pagination.js";