efficient-storefront-blocks 0.86.0 → 0.88.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 (272) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/chunks/{EditorPreviewCheckout-4LNXFNN7.js → EditorPreviewCheckout-ZGPS3Q3X.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-A2HMVDKS.js → SiteEditorProvider-HZ47WOEX.js} +1 -1
  4. package/dist/chunks/{chunk-TGBNREUJ.js → chunk-7C2YH2AQ.js} +1 -1
  5. package/dist/chunks/chunk-O7GCI2MP.js +1 -0
  6. package/dist/chunks/chunk-RHNDIM7Z.js +382 -0
  7. package/dist/chunks/chunk-VOK5N3IB.js +1 -0
  8. package/dist/chunks/{fitment-data-TSYW6AFA.js → fitment-data-SH4US3BV.js} +1 -1
  9. package/dist/contract.js +32 -2
  10. package/dist/editor/components/CategorySource.d.ts +8 -1
  11. package/dist/editor/components/CategorySource.js +1 -1
  12. package/dist/editor/components/CollectionPicker.js +1 -1
  13. package/dist/editor/components/EditProductLink.js +1 -1
  14. package/dist/editor/components/FinishPicker.js +1 -1
  15. package/dist/editor/components/FormPicker.js +1 -1
  16. package/dist/editor/components/GalleryShowcaseSource.js +1 -1
  17. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  18. package/dist/editor/components/ProductHeroSource.js +1 -1
  19. package/dist/editor/components/ProductPicker.js +1 -1
  20. package/dist/editor/components/ReviewsProductSource.js +1 -1
  21. package/dist/editor/components/SocialLinksDoor.js +1 -1
  22. package/dist/editor/components/SpecTableSource.js +1 -1
  23. package/dist/editor/lib/document/blocks/commerce/BundleOffer/fields.js +1 -1
  24. package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.d.ts +2 -0
  25. package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.js +1 -0
  26. package/dist/editor/lib/document/blocks/commerce/FilterChipsBlock/fields.d.ts +2 -0
  27. package/dist/editor/lib/document/blocks/commerce/FilterChipsBlock/fields.js +1 -0
  28. package/dist/editor/lib/document/blocks/commerce/GalleryItem/fields.js +1 -1
  29. package/dist/editor/lib/document/blocks/commerce/ProductBuy/fields.d.ts +2 -0
  30. package/dist/editor/lib/document/blocks/commerce/ProductBuy/fields.js +1 -0
  31. package/dist/editor/lib/document/blocks/commerce/ProductBuyButton/fields.d.ts +2 -0
  32. package/dist/editor/lib/document/blocks/commerce/ProductBuyButton/fields.js +1 -0
  33. package/dist/editor/lib/document/blocks/commerce/ProductEyebrow/fields.d.ts +2 -0
  34. package/dist/editor/lib/document/blocks/commerce/ProductEyebrow/fields.js +1 -0
  35. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  36. package/dist/editor/lib/document/blocks/commerce/ProductName/fields.d.ts +2 -0
  37. package/dist/editor/lib/document/blocks/commerce/ProductName/fields.js +1 -0
  38. package/dist/editor/lib/document/blocks/commerce/ProductPicture/fields.d.ts +2 -0
  39. package/dist/editor/lib/document/blocks/commerce/ProductPicture/fields.js +1 -0
  40. package/dist/editor/lib/document/blocks/commerce/ProductSpecs/fields.d.ts +2 -0
  41. package/dist/editor/lib/document/blocks/commerce/ProductSpecs/fields.js +1 -0
  42. package/dist/editor/lib/document/blocks/commerce/RelatedProducts/fields.js +1 -1
  43. package/dist/editor/lib/document/blocks/commerce/controls.d.ts +4 -0
  44. package/dist/editor/lib/document/blocks/commerce/controls.js +1 -1
  45. package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
  46. package/dist/editor/lib/document/blocks/commerce/index.js +1 -1
  47. package/dist/editor/lib/document/config.js +1 -1
  48. package/dist/editor/lib/document/section-text-regions.js +1 -1
  49. package/dist/editor/lib/editor-words-kept.d.ts +1 -0
  50. package/dist/editor/lib/editor-words-kept.js +1 -0
  51. package/dist/editor/lib/efficient-backend.d.ts +7 -1
  52. package/dist/editor/lib/efficient-backend.js +1 -1
  53. package/dist/editor/lib/storefront-document.js +1 -1
  54. package/dist/editor/lib/storefront-editor-words.d.ts +40 -12
  55. package/dist/editor/lib/storefront-editor-words.js +1 -1
  56. package/dist/editor.css +1 -1
  57. package/dist/fitment.js +1 -1
  58. package/dist/index.js +136 -83
  59. package/dist/links.js +1 -1
  60. package/dist/render/app/fonts/fallbacks.css +8 -0
  61. package/dist/render/app/fonts/jost/OFL.txt +93 -0
  62. package/dist/render/app/fonts/jost/cyrillic-italic.woff2 +0 -0
  63. package/dist/render/app/fonts/jost/cyrillic.woff2 +0 -0
  64. package/dist/render/app/fonts/jost/latin-ext-italic.woff2 +0 -0
  65. package/dist/render/app/fonts/jost/latin-ext.woff2 +0 -0
  66. package/dist/render/app/fonts/jost/latin-italic.woff2 +0 -0
  67. package/dist/render/app/fonts/jost/latin.woff2 +0 -0
  68. package/dist/render/app/globals.css +122 -11
  69. package/dist/render/built-with.json +1 -1
  70. package/dist/render/components/BundleCard.d.ts +2 -1
  71. package/dist/render/components/BundleCard.js +1 -1
  72. package/dist/render/components/Events.js +1 -1
  73. package/dist/render/components/FitmentTable.d.ts +1 -1
  74. package/dist/render/components/FitmentTable.js +1 -1
  75. package/dist/render/components/FooterMenu.d.ts +5 -1
  76. package/dist/render/components/FooterMenu.js +1 -1
  77. package/dist/render/components/GalleryGrid.js +1 -1
  78. package/dist/render/components/GalleryItem.d.ts +11 -1
  79. package/dist/render/components/GalleryItem.js +1 -1
  80. package/dist/render/components/GridCardTemplate.d.ts +40 -0
  81. package/dist/render/components/GridCardTemplate.js +1 -0
  82. package/dist/render/components/MenuLinkBlock.d.ts +5 -1
  83. package/dist/render/components/MenuLinkBlock.js +1 -1
  84. package/dist/render/components/ProductCardChrome.d.ts +1 -1
  85. package/dist/render/components/ProductCardChrome.js +1 -1
  86. package/dist/render/components/ProductGridSection.d.ts +9 -15
  87. package/dist/render/components/ProductGridSection.js +1 -1
  88. package/dist/render/components/ProductHeroPanel.js +1 -1
  89. package/dist/render/components/ProductRef.d.ts +8 -2
  90. package/dist/render/components/ProductRef.js +1 -1
  91. package/dist/render/components/SectionBand.d.ts +3 -2
  92. package/dist/render/components/SectionBand.js +1 -1
  93. package/dist/render/components/StorefrontProviders.d.ts +1 -1
  94. package/dist/render/components/StorefrontProviders.js +1 -1
  95. package/dist/render/components/TyreCard.js +1 -1
  96. package/dist/render/components/TyreFitVerdicts.d.ts +2 -1
  97. package/dist/render/components/TyreFitVerdicts.js +1 -1
  98. package/dist/render/components/TyrePlpCard.js +1 -1
  99. package/dist/render/components/card-pieces/CardBuyButton.d.ts +8 -1
  100. package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
  101. package/dist/render/components/card-pieces/CardEyebrow.d.ts +3 -1
  102. package/dist/render/components/card-pieces/CardEyebrow.js +1 -1
  103. package/dist/render/components/card-pieces/CardName.d.ts +4 -1
  104. package/dist/render/components/card-pieces/CardName.js +1 -1
  105. package/dist/render/components/card-pieces/CardPrice.d.ts +2 -6
  106. package/dist/render/components/card-pieces/CardPrice.js +1 -1
  107. package/dist/render/components/card-pieces/CardProductBadge.d.ts +2 -1
  108. package/dist/render/components/card-pieces/CardProductBadge.js +1 -1
  109. package/dist/render/components/card-pieces/CardProductPicture.d.ts +13 -0
  110. package/dist/render/components/card-pieces/CardProductPicture.js +1 -0
  111. package/dist/render/components/card-pieces/CardSpecs.js +1 -1
  112. package/dist/render/components/card-pieces/HostPart.js +1 -1
  113. package/dist/render/components/card-pieces/ProductCardState.d.ts +25 -6
  114. package/dist/render/components/card-pieces/ProductCardState.js +1 -1
  115. package/dist/render/components/card-pieces/card-text-region.d.ts +18 -0
  116. package/dist/render/components/card-pieces/card-text-region.js +1 -0
  117. package/dist/render/components/catalog/CatalogFilterContext.d.ts +4 -1
  118. package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
  119. package/dist/render/components/catalog/ClearAllButton.d.ts +4 -0
  120. package/dist/render/components/catalog/ClearAllButton.js +1 -0
  121. package/dist/render/components/catalog/FilterPill.d.ts +4 -2
  122. package/dist/render/components/catalog/FilterPill.js +1 -1
  123. package/dist/render/components/catalog/ShopperChips.d.ts +13 -0
  124. package/dist/render/components/catalog/ShopperChips.js +1 -0
  125. package/dist/render/components/catalog/ShopperFilters.d.ts +20 -0
  126. package/dist/render/components/catalog/ShopperFilters.js +1 -0
  127. package/dist/render/components/catalog/ShopperScope.d.ts +72 -0
  128. package/dist/render/components/catalog/ShopperScope.js +3 -0
  129. package/dist/render/components/catalog/SortSelect.js +1 -1
  130. package/dist/render/components/fitment/StockFitmentPart.d.ts +8 -1
  131. package/dist/render/components/fitment/StockFitmentPart.js +1 -1
  132. package/dist/render/components/fitment/fitment-answer-source.d.ts +12 -0
  133. package/dist/render/components/fitment/fitment-answer-source.js +1 -0
  134. package/dist/render/components/pdp-dynamic/DynamicFitmentTable.js +1 -1
  135. package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.d.ts +10 -12
  136. package/dist/render/components/pdp-dynamic/DynamicRelatedProducts.js +1 -1
  137. package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
  138. package/dist/render/components/pdp-dynamic/DynamicTyreSizes.js +1 -1
  139. package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
  140. package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
  141. package/dist/render/components/wheels-plp/PlpCard.d.ts +1 -1
  142. package/dist/render/components/wheels-plp/PlpCard.js +1 -1
  143. package/dist/render/components/wheels-plp/PlpPagination.d.ts +2 -1
  144. package/dist/render/components/wheels-plp/PlpPagination.js +1 -1
  145. package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
  146. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.d.ts +2 -0
  147. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.js +1 -1
  148. package/dist/render/lib/api/index.d.ts +6 -0
  149. package/dist/render/lib/api/index.js +1 -1
  150. package/dist/render/lib/catalog/related-cards.d.ts +4 -1
  151. package/dist/render/lib/catalog/relationships.d.ts +9 -2
  152. package/dist/render/lib/catalog/relationships.js +1 -1
  153. package/dist/render/lib/commerce.d.ts +2 -0
  154. package/dist/render/lib/commerce.js +1 -1
  155. package/dist/render/lib/content/article-body.js +1 -5
  156. package/dist/render/lib/content/field-usage.d.ts +1 -0
  157. package/dist/render/lib/content/field-usage.js +1 -1
  158. package/dist/render/lib/content/filter-card-seed.d.ts +10 -0
  159. package/dist/render/lib/content/filter-card-seed.js +1 -0
  160. package/dist/render/lib/content/product-card-seed.d.ts +34 -0
  161. package/dist/render/lib/content/product-card-seed.js +1 -0
  162. package/dist/render/lib/content/tab-strip.d.ts +17 -0
  163. package/dist/render/lib/content/tab-strip.js +1 -0
  164. package/dist/render/lib/document/blocks/commerce/BundleOffer/meta.js +1 -1
  165. package/dist/render/lib/document/blocks/commerce/BundleOffer/render.js +1 -1
  166. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +8 -0
  167. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -0
  168. package/dist/render/lib/document/blocks/commerce/FilterBlock/render.d.ts +2 -0
  169. package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -0
  170. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/meta.d.ts +8 -0
  171. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/meta.js +1 -0
  172. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.d.ts +2 -0
  173. package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.js +1 -0
  174. package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
  175. package/dist/render/lib/document/blocks/commerce/GalleryItem/render.js +1 -1
  176. package/dist/render/lib/document/blocks/commerce/ProductBuy/meta.d.ts +2 -0
  177. package/dist/render/lib/document/blocks/commerce/ProductBuy/meta.js +1 -0
  178. package/dist/render/lib/document/blocks/commerce/ProductBuy/render.d.ts +2 -0
  179. package/dist/render/lib/document/blocks/commerce/ProductBuy/render.js +1 -0
  180. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/meta.d.ts +2 -0
  181. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/meta.js +1 -0
  182. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/render.d.ts +2 -0
  183. package/dist/render/lib/document/blocks/commerce/ProductBuyButton/render.js +1 -0
  184. package/dist/render/lib/document/blocks/commerce/ProductEyebrow/meta.d.ts +2 -0
  185. package/dist/render/lib/document/blocks/commerce/ProductEyebrow/meta.js +1 -0
  186. package/dist/render/lib/document/blocks/commerce/ProductEyebrow/render.d.ts +2 -0
  187. package/dist/render/lib/document/blocks/commerce/ProductEyebrow/render.js +1 -0
  188. package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.d.ts +4 -0
  189. package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
  190. package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
  191. package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
  192. package/dist/render/lib/document/blocks/commerce/ProductName/meta.d.ts +2 -0
  193. package/dist/render/lib/document/blocks/commerce/ProductName/meta.js +1 -0
  194. package/dist/render/lib/document/blocks/commerce/ProductName/render.d.ts +2 -0
  195. package/dist/render/lib/document/blocks/commerce/ProductName/render.js +1 -0
  196. package/dist/render/lib/document/blocks/commerce/ProductPicture/meta.d.ts +2 -0
  197. package/dist/render/lib/document/blocks/commerce/ProductPicture/meta.js +1 -0
  198. package/dist/render/lib/document/blocks/commerce/ProductPicture/render.d.ts +2 -0
  199. package/dist/render/lib/document/blocks/commerce/ProductPicture/render.js +1 -0
  200. package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -1
  201. package/dist/render/lib/document/blocks/commerce/ProductSpecs/meta.d.ts +2 -0
  202. package/dist/render/lib/document/blocks/commerce/ProductSpecs/meta.js +1 -0
  203. package/dist/render/lib/document/blocks/commerce/ProductSpecs/render.d.ts +2 -0
  204. package/dist/render/lib/document/blocks/commerce/ProductSpecs/render.js +1 -0
  205. package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.d.ts +0 -4
  206. package/dist/render/lib/document/blocks/commerce/RelatedProducts/meta.js +1 -1
  207. package/dist/render/lib/document/blocks/commerce/RelatedProducts/render.js +1 -1
  208. package/dist/render/lib/document/blocks/commerce/StockFitment/meta.js +1 -1
  209. package/dist/render/lib/document/blocks/commerce/metas.d.ts +8 -0
  210. package/dist/render/lib/document/blocks/commerce/metas.js +1 -1
  211. package/dist/render/lib/document/blocks/commerce/renders.d.ts +8 -0
  212. package/dist/render/lib/document/blocks/commerce/renders.js +1 -1
  213. package/dist/render/lib/document/blocks/text-part-shapes.json +0 -16
  214. package/dist/render/lib/document/card-templates.d.ts +1 -0
  215. package/dist/render/lib/document/card-templates.js +1 -1
  216. package/dist/render/lib/document/document-nodes.d.ts +24 -0
  217. package/dist/render/lib/document/document-nodes.js +1 -0
  218. package/dist/render/lib/document/footer-page-blocks.js +1 -1
  219. package/dist/render/lib/document/lazy-draws.js +1 -1
  220. package/dist/render/lib/document/render-config.js +1 -1
  221. package/dist/render/lib/document/storefront-root.js +1 -1
  222. package/dist/render/lib/font-table.json +209 -1
  223. package/dist/render/lib/links/link-rules.js +1 -1
  224. package/dist/render/lib/menu-link.d.ts +2 -0
  225. package/dist/render/lib/menu-link.js +1 -1
  226. package/dist/render/lib/next-fonts.js +1 -1
  227. package/dist/render/lib/sections/bundle-to-grid.d.ts +8 -0
  228. package/dist/render/lib/sections/bundle-to-grid.js +1 -0
  229. package/dist/render/lib/sections/catalog-text-size.d.ts +2 -0
  230. package/dist/render/lib/sections/catalog-text-size.js +1 -1
  231. package/dist/render/lib/sections/filter-option-rows.d.ts +37 -0
  232. package/dist/render/lib/sections/filter-option-rows.js +1 -0
  233. package/dist/render/lib/sections/gallery-toolbar.d.ts +27 -0
  234. package/dist/render/lib/sections/gallery-toolbar.js +1 -0
  235. package/dist/render/lib/sections/grid-no-hole.d.ts +4 -0
  236. package/dist/render/lib/sections/grid-no-hole.js +1 -1
  237. package/dist/render/lib/sections/product-card-text-regions.d.ts +3 -0
  238. package/dist/render/lib/sections/product-card-text-regions.js +1 -0
  239. package/dist/render/lib/sections/product-grid-columns.d.ts +13 -1
  240. package/dist/render/lib/sections/product-grid-columns.js +1 -1
  241. package/dist/render/lib/sections/product-grid-pages.d.ts +42 -0
  242. package/dist/render/lib/sections/product-grid-pages.js +1 -0
  243. package/dist/render/lib/sections/related-to-grid.d.ts +8 -0
  244. package/dist/render/lib/sections/related-to-grid.js +1 -0
  245. package/dist/render/lib/sections/shopper-filters.d.ts +45 -0
  246. package/dist/render/lib/sections/shopper-filters.js +1 -0
  247. package/dist/render/lib/storefront-page-groups.d.ts +0 -4
  248. package/dist/render/lib/storefront-page-groups.js +1 -1
  249. package/dist/render/lib/tyres/tyre-vehicle-fitment.d.ts +1 -0
  250. package/dist/render/lib/tyres/tyre-vehicle-fitment.js +1 -1
  251. package/dist/render/lib/wheels/plp-filters.d.ts +6 -3
  252. package/dist/render/lib/wheels/plp-filters.js +1 -1
  253. package/dist/render/lib/wheels/plp-hydrate.d.ts +5 -3
  254. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  255. package/dist/render/lib/wheels/selected-ranges.d.ts +16 -0
  256. package/dist/render/lib/wheels/selected-ranges.js +1 -0
  257. package/dist/render/lib/wheels/set-mode.d.ts +10 -0
  258. package/dist/render/lib/wheels/set-mode.js +1 -1
  259. package/dist/render/lib/wheels/shopper-first-paint.d.ts +28 -0
  260. package/dist/render/lib/wheels/shopper-first-paint.js +1 -0
  261. package/dist/render/lib/wheels/shopper-scope.d.ts +11 -0
  262. package/dist/render/lib/wheels/shopper-scope.js +1 -0
  263. package/dist/words.d.ts +92 -15
  264. package/dist/words.js +6 -6
  265. package/package.json +4 -4
  266. package/dist/chunks/chunk-EUKK2IN6.js +0 -1
  267. package/dist/chunks/chunk-FJRKNPNN.js +0 -340
  268. package/dist/chunks/chunk-SLRULFYY.js +0 -1
  269. package/dist/render/components/pdp-dynamic/DynamicBundleOffer.d.ts +0 -13
  270. package/dist/render/components/pdp-dynamic/DynamicBundleOffer.js +0 -1
  271. /package/dist/chunks/{chunk-ALMIS7CK.js → chunk-NQLVRCTI.js} +0 -0
  272. /package/dist/chunks/{chunk-FJRKNPNN.js.LEGAL.txt → chunk-RHNDIM7Z.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- "use client";import{jsx as a,jsxs as i}from"react/jsx-runtime";import c from"../ThemedSelect.js";import{CATALOG_TEXT_SIZE as o}from"../../lib/sections/catalog-text-size.js";const m={toolbar:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] normal-case tracking-normal text-fg",line:`border-b border-line bg-transparent pb-2 font-mono ${o.labelLarge} uppercase tracking-[0.2em] text-fg`,box:`border border-line bg-transparent px-4 py-3 font-mono ${o.labelLarge} uppercase tracking-[0.2em] text-fg`};function b({value:n,keys:l,labels:s,onChange:p,look:r="toolbar"}){const t=a(c,{"aria-label":"Sort results",align:"end",value:n,onChange:e=>p(e.target.value),className:m[r],children:l.map(e=>a("option",{value:e,children:s[e]},e))});return r!=="toolbar"?t:i("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Sort by",t]})}export{b as default};
1
+ "use client";import{jsx as r,jsxs as c}from"react/jsx-runtime";import i from"../ThemedSelect.js";import{CATALOG_TEXT_SIZE as n}from"../../lib/sections/catalog-text-size.js";const m={toolbar:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] normal-case tracking-normal text-fg",line:`border-b border-line bg-transparent pb-2 font-mono ${n.labelLarge} uppercase tracking-[0.2em] text-fg`,box:`border border-line bg-transparent px-4 py-3 font-mono ${n.labelLarge} uppercase tracking-[0.2em] text-fg`};function b({value:o,keys:l,labels:s,onChange:p,look:t="toolbar"}){const a=r(i,{"aria-label":"Sort results",align:"end",value:o,onChange:e=>p(e.target.value),className:m[t],children:l.map(e=>r("option",{value:e,children:s[e]},e))});return t!=="toolbar"?a:c("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:[r("span",{className:"whitespace-nowrap",children:"Sort by"}),a]})}export{b as default};
@@ -1,4 +1,11 @@
1
+ import { type ReactNode } from "react";
2
+ import type { StoreProduct } from "../../lib/catalog/store-product.js";
3
+ export declare function useFitmentAnswerView({ product, editing, label, }: {
4
+ product: StoreProduct | null;
5
+ editing?: boolean;
6
+ label?: string;
7
+ }): ReactNode;
1
8
  export default function StockFitmentPart({ editing, label, }: {
2
9
  editing?: boolean;
3
10
  label?: string;
4
- }): import("react").JSX.Element | null;
11
+ }): ReactNode;
@@ -1 +1 @@
1
- "use client";import{jsx as r}from"react/jsx-runtime";import{useSyncExternalStore as i}from"react";import{say as n}from"efficient-web-builder/format/lib/editor-words";import s from"./StockFitmentCard.js";import{storefrontVehicleMemory as o}from"../../lib/wheels/vehicle-memory.js";const c=()=>null;function m({editing:e=!1,label:a="Stock fitment"}){const t=i(o.subscribeStock,o.readStock,c);return t?r(s,{loading:t.loading,error:t.error,data:t.stock}):e?r("div",{"data-host-part-sample":"",className:"opacity-60",children:n(a)}):null}export{m as default};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{useSyncExternalStore as c}from"react";import{say as m}from"efficient-web-builder/format/lib/editor-words";import h from"./StockFitmentCard.js";import{fitmentAnswerFor as w}from"./fitment-answer-source.js";import l from"../TyreFitVerdicts.js";import{useTyreFitAnswer as S}from"../useTyreFitAnswer.js";import{useSampleProduct as v}from"../pdp-dynamic/useSampleProduct.js";import{useCurrentProduct as A}from"../../lib/document/current-product.js";import{tyreFitQuery as F,unknownAnswer as k}from"../../lib/tyres/tyre-vehicle-fitment.js";import{storefrontVehicleMemory as i}from"../../lib/wheels/vehicle-memory.js";const N=()=>null,x=()=>null,b=k({make:"",model:"",year:0,modification:""});function C({product:o,editing:r=!1,label:s=""}){const n=w(o),a=c(i.subscribeStock,i.readStock,N),u=c(i.subscribe,i.read,x),t=n.source==="tyreVerdicts"?n:null,{answer:p,loading:d,retry:f}=S(t?.slug??"",t&&!r?F(u?.vehicle):null),y=r?e("div",{"data-host-part-sample":"",className:"opacity-60",children:m(s)}):null;return t?r?e("div",{"data-host-part-sample":"",className:"opacity-60",children:e(l,{variants:t.variants,answer:b,headline:m("A sample. On the live page each size shows its own verdict for the shopper's car.")})}):e(l,{variants:t.variants,answer:p,loading:d,onRetry:f}):a?e(h,{loading:a.loading,error:a.error,data:a.stock}):y}function O({editing:o=!1,label:r=""}){const s=A(),n=v(o&&!s);return C({product:s?.product??n,editing:o,label:r})}export{O as default,C as useFitmentAnswerView};
@@ -0,0 +1,12 @@
1
+ import type { ProductKind, TyreVariant } from "../../lib/api/index.js";
2
+ import type { StoreProduct } from "../../lib/catalog/store-product.js";
3
+ export type FitmentAnswerSource = "stockCard" | "tyreVerdicts";
4
+ export declare const FITMENT_ANSWER_BY_KIND: Readonly<Record<ProductKind, FitmentAnswerSource>>;
5
+ export type FitmentAnswer = {
6
+ source: "stockCard";
7
+ } | {
8
+ source: "tyreVerdicts";
9
+ slug: string;
10
+ variants: TyreVariant[];
11
+ };
12
+ export declare function fitmentAnswerFor(product: StoreProduct | null | undefined): FitmentAnswer;
@@ -0,0 +1 @@
1
+ const t={"alloy-wheel":"stockCard",tyre:"tyreVerdicts"},s={source:"stockCard"};function n(e){if(!e)return s;const r=t[e.kind];return r==="tyreVerdicts"&&e.kind==="tyre"&&e.source.variants.length>0?{source:r,slug:e.source.slug,variants:e.source.variants}:s}export{t as FITMENT_ANSWER_BY_KIND,n as fitmentAnswerFor};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import g from"../FitmentTable.js";import k from"./KindGate.js";import{TyreSizesContent as x}from"../TyreSizeGrid.js";import{useCurrentProduct as w}from"../../lib/document/current-product.js";import{useSampleProduct as F}from"./useSampleProduct.js";const U=["alloy-wheel","tyre"],b=[];function h(t){return n(k,{kinds:U,type:"FitmentTable",editing:t.editing,children:n(y,{...t})})}function y({num:t,title:s,description:l,showFilter:m,tooltipDefaultOn:a,footnote:d,footnoteLinkText:c,footnoteLinkHref:u,editing:r=!1,omitHead:f=!1,tyreHead:e}){const o=w(),p=F(r&&!o),i=o?.product??p;if(i?.kind==="tyre")return n(x,{variants:i.source.variants,fieldUsage:o?.fieldUsage??b,num:t,title:e?e.title:s,description:e?e.description:l,editing:r,omitHead:f,keepHiddenHead:e!=null});const T=i?.kind==="alloy-wheel"?i.source.fitments??[]:[];return n(g,{num:t,title:s,description:l,rows:T,showFilter:m,tooltipDefaultOn:a,footnote:d,footnoteLinkText:c,footnoteLinkHref:u,editing:r,omitHead:f,fieldUsage:o?.fieldUsage})}export{h as default,U as supportedKinds};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import k from"../FitmentTable.js";import x from"./KindGate.js";import{TyreSizesContent as F}from"../TyreSizeGrid.js";import{useCurrentProduct as T}from"../../lib/document/current-product.js";import{NO_FIELD_ANSWERS as w}from"../../lib/content/field-usage.js";import{useSampleProduct as b}from"./useSampleProduct.js";const h=["alloy-wheel","tyre"];function y(t){return n(x,{kinds:h,type:"FitmentTable",editing:t.editing,children:n(S,{...t})})}function S({num:t,title:s,description:l,showFilter:f,tooltipDefaultOn:a,footnote:d,footnoteLinkText:u,footnoteLinkHref:c,editing:r=!1,omitHead:m=!1,tyreHead:e}){const o=T(),p=b(r&&!o),i=o?.product??p;if(i?.kind==="tyre")return n(F,{variants:i.source.variants,fieldUsage:o?.fieldUsage??w,num:t,title:e?e.title:s,description:e?e.description:l,editing:r,omitHead:m,keepHiddenHead:e!=null});const g=i?.kind==="alloy-wheel"?i.source.fitments??[]:[];return n(k,{num:t,title:s,description:l,rows:g,showFilter:f,tooltipDefaultOn:a,footnote:d,footnoteLinkText:u,footnoteLinkHref:c,editing:r,omitHead:m,fieldUsage:o?.fieldUsage})}export{y as default,h as supportedKinds};
@@ -1,6 +1,6 @@
1
- import { type CardImageBackground } from "efficient-web-builder/format/lib/content/card-image-background";
2
- import type { CardHoverDrawn } from "efficient-web-builder/format/lib/animation/hover";
1
+ import { type CardHoverDrawn } from "efficient-web-builder/format/lib/animation/hover";
3
2
  import { type CardIndexFormat, type CardOutline } from "efficient-web-builder/format/lib/sections/product-card-style";
3
+ import type { SlotComponent } from "efficient-easel/blocks";
4
4
  export declare const supportedKinds: readonly ("alloy-wheel" | "tyre")[];
5
5
  interface Props {
6
6
  num?: string;
@@ -14,19 +14,17 @@ interface Props {
14
14
  footnoteLinkHref?: string;
15
15
  editing?: boolean;
16
16
  omitHead?: boolean;
17
+ hover?: CardHoverDrawn;
18
+ ownerId?: string;
19
+ template?: SlotComponent;
17
20
  cardImage?: number | null;
18
21
  outline?: CardOutline;
19
22
  indexBadge?: CardIndexFormat;
20
- showBadge?: boolean;
21
- showCardPrice?: boolean;
22
- showCardFinishes?: boolean;
23
- showCardSizes?: boolean;
24
- showCardBuy?: boolean;
25
- showCardPage?: boolean;
26
- coverIndex?: number;
27
- imageBackground?: CardImageBackground;
28
- hover?: CardHoverDrawn;
23
+ columnsPhone?: unknown;
24
+ columnsTablet?: unknown;
25
+ gap?: number | string;
26
+ gapPhone?: unknown;
29
27
  }
30
28
  export default function DynamicRelatedProducts(props: Props): import("react").JSX.Element;
31
- export declare function RelatedProductsBody({ num, title, description, columns, cardCount, relationship: key, footnote, footnoteLinkText, footnoteLinkHref, editing, omitHead, cardImage, outline, indexBadge, showBadge, showCardPrice, showCardFinishes, showCardSizes, showCardBuy, showCardPage, coverIndex, imageBackground, hover, }: Props): import("react").JSX.Element | null;
29
+ export declare function RelatedProductsBody({ num, title, description, columns, cardCount, relationship: key, footnote, footnoteLinkText, footnoteLinkHref, editing, omitHead, hover, ownerId, template, cardImage, outline, indexBadge, columnsPhone, columnsTablet, gap, gapPhone, }: Props): import("react").JSX.Element | null;
32
30
  export {};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as F}from"react/jsx-runtime";import A from"../SectionBand.js";import{useScopeClass as W}from"../../lib/use-scope-class.js";import{GRID_CARD_SHOW as I}from"../../lib/sections/card-show-defaults.js";import{useEffect as V,useState as X}from"react";import{resolveCardImageBackground as Z,THEME_CARD_IMAGE_BG as q}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as B}from"efficient-web-builder/format/lib/content/card-image-shape";import{DEFAULT_COVER_INDEX as J}from"../../lib/wheels/cover-rendering.js";import{DEFAULT_CARD_INDEX_FORMAT as Q,DEFAULT_CARD_OUTLINE as Y,cardIndexCss as ee}from"efficient-web-builder/format/lib/sections/product-card-style";import re from"../CompatibleTyres.js";import oe from"../ProductCard.js";import{CARD_ROWS_GRID_CLASS as te,cardRowsGridStyle as ie}from"../WheelCardFrame.js";import{ProductCardChromeProvider as se}from"../ProductCardChrome.js";import{gridClassImageSizes as ae}from"../../lib/sections/card-image-sizes.js";import{fillRowCss as ne}from"../../lib/sections/fill-row.js";import le from"efficient-web-builder/render/components/SectionHeader";import de from"../ViewMoreLink.js";import{useSiteMenuLinks as ce}from"../catalog/SiteMenuLinks.js";import{renderGold as G,renderHeadline as me}from"efficient-web-builder/render/components/goldPhrases";import pe from"./KindGate.js";import{loadProductCatalog as ue}from"../useProductCatalog.js";import{PLP_KINDS as fe}from"../../lib/catalog/plp-item.js";import{relatedCardCount as he,relatedViewMore as ge}from"../../lib/catalog/related-cards.js";import{DEFAULT_RELATIONSHIP as Ce,relationshipApplies as we,relationshipByKey as xe}from"../../lib/catalog/relationships.js";import{useCurrentProduct as ye}from"../../lib/document/current-product.js";import{PLACEHOLDER_RELATED as O}from"../../lib/wheels/placeholder-wheel.js";import{say as T}from"efficient-web-builder/format/lib/editor-words";const H={label:"text-[length:var(--size-label,13px)]"},ve=fe,$={2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-desktop:grid-cols-2 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-2 max-view-wide:grid-cols-1"};function be(r){return e(pe,{kinds:ve,type:"RelatedProducts",editing:r.editing,children:e(Se,{...r})})}function Se({num:r,title:t,description:c,columns:a=3,cardCount:b,relationship:S=Ce,footnote:_,footnoteLinkText:k,footnoteLinkHref:E,editing:o=!1,omitHead:C=!1,cardImage:i,outline:m,indexBadge:p,showBadge:w,showCardPrice:x,showCardFinishes:n,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,hover:y}){const d=ye(),U=ce(),R=he(b),[j,N]=X([]);V(()=>{if(d||!o)return;let P=!1;return ue().then(M=>{const K=M.length>0?M:O;P||N(K)}).catch(()=>{P||N(O)}),()=>{P=!0}},[d,o]);const s=xe(S);if(!s)return null;const D=ge(s,U),L=C?null:e(le,{num:r?G(r):void 0,title:me(t||s.heading,!1),description:c?G(c):void 0,accent:!0});if(!d)return o?e(z,{header:L,wheels:j.slice(0,R),columns:a,viewMore:D,cardImage:i,outline:m,indexBadge:p,showBadge:w,showCardPrice:x,showCardFinishes:n,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,hover:y}):null;if(!we(s,d.product.kind))return o?e(A,{className:"border-b border-line py-14 max-view-desktop:py-10",style:B(i),children:e("p",{className:`font-mono ${H.label} uppercase tracking-[0.18em] text-fg-dim`,children:T("“{relationship}” does not apply to this product. It is hidden on the live page.",{relationship:T(s.label)})})}):null;const v=s.resolve(d.product,d.relatedWheels);return v.kind==="tyre"?e(re,{omitHead:C,columns:a,cardImage:i,outline:m,indexBadge:p,num:r,title:t||s.heading,description:c,tyres:[...v.tyres].slice(0,R),footnote:_,footnoteLinkText:k,footnoteLinkHref:E,viewMore:D,editing:o}):v.wheels.length===0?o?F(A,{className:"border-b border-line py-[120px] max-view-desktop:py-20",style:B(i),children:[L,e("p",{className:`border-t border-line py-6 font-mono ${H.label} uppercase tracking-[0.18em] text-fg-dim`,children:T("Related products appear here on a product page.")})]}):null:e(z,{header:L,wheels:[...v.wheels].slice(0,R),columns:a,viewMore:D,cardImage:i,outline:m,indexBadge:p,showBadge:w,showCardPrice:x,showCardFinishes:n,showCardSizes:l,showCardBuy:u,showCardPage:f,coverIndex:h,imageBackground:g,hover:y})}function z({header:r,wheels:t,columns:c,viewMore:a,cardImage:b,outline:S,indexBadge:_,showBadge:k,showCardPrice:E,showCardFinishes:o,showCardSizes:C,showCardBuy:i,showCardPage:m,coverIndex:p,imageBackground:w,hover:x}){const n=W("rp");if(t.length===0)return null;const l=$[Math.min(4,Math.max(2,c))]??$[3],u=_??Q,f=ee(n,u),h=ne(n,l,{cards:t.length});return F(A,{className:"border-b border-line py-[120px] max-view-desktop:py-20",style:B(b),children:[f&&e("style",{children:f}),h&&e("style",{children:h}),r,e(se,{imageSizes:ae(l,t.length),imageBackgroundFill:Z(w,q),hover:x,coverIndex:p??J,outline:S??Y,indexBadge:u,showBadge:k??!0,showCardPrice:E??!0,showCardFinishes:o??!0,showCardSizes:C??I.showCardSizes,showCardBuy:i??I.showCardBuy,showCardPage:m??I.showCardPage,children:e("div",{className:`${n} grid gap-[2px] ${te} bg-[var(--catalog-grid-bg)] ${l}`,style:ie("2px"),children:t.map((g,y)=>e(oe,{wheel:g,variant:"catalog"},`${g.slug}-${y}`))})}),e("div",{className:"mt-10 flex",children:e(de,{href:a.href,label:a.label})})]})}export{Se as RelatedProductsBody,be as default,ve as supportedKinds};
1
+ "use client";import{jsx as e,jsxs as $}from"react/jsx-runtime";import G from"../SectionBand.js";import{useScopeClass as Z}from"../../lib/use-scope-class.js";import{useEffect as q,useState as J}from"react";import{cardHoverOf as Q}from"efficient-web-builder/format/lib/animation/hover";const Y=Q({},"ProductGrid");import ee from"../CompatibleTyres.js";import{cardRowsGrid as re,GridBundleCards as te,GridCardProvider as oe,GridCards as ne,gridIndexCss as se}from"../GridCardTemplate.js";import{productGridColumnsClass as le}from"../../lib/sections/product-grid-columns.js";import{containerGapProps as B}from"efficient-web-builder/format/lib/content/container-gap";import{cardImageShapeTokens as D}from"efficient-web-builder/format/lib/content/card-image-shape";import{NO_FIELD_ANSWERS as ie}from"../../lib/content/field-usage.js";import{gridClassImageSizes as de}from"../../lib/sections/card-image-sizes.js";import{fillRowCss as ae}from"../../lib/sections/fill-row.js";import ce from"efficient-web-builder/render/components/SectionHeader";import pe from"../ViewMoreLink.js";import{useSiteMenuLinks as me}from"../catalog/SiteMenuLinks.js";import{renderGold as O,renderHeadline as ue}from"efficient-web-builder/render/components/goldPhrases";import fe from"./KindGate.js";import{loadProductCatalog as he}from"../useProductCatalog.js";import{PLP_KINDS as be}from"../../lib/catalog/plp-item.js";import{relatedCardCount as we,relatedViewMore as ye}from"../../lib/catalog/related-cards.js";import{answersWithProducts as M,DEFAULT_RELATIONSHIP as ge,relationshipApplies as W,relationshipByKey as xe}from"../../lib/catalog/relationships.js";import{useCurrentProduct as Ee}from"../../lib/document/current-product.js";import{PLACEHOLDER_RELATED as j}from"../../lib/wheels/placeholder-wheel.js";import{say as P}from"efficient-web-builder/format/lib/editor-words";const K={label:"text-[length:var(--size-label,13px)]"},ke=be;function ve(o){return e(fe,{kinds:ke,type:"RelatedProducts",editing:o.editing,children:e(Pe,{...o})})}function Pe({num:o,title:r,description:i,columns:d=3,cardCount:C,relationship:N=ge,footnote:w,footnoteLinkText:y,footnoteLinkHref:S,editing:n=!1,omitHead:a=!1,hover:R,ownerId:c="",template:m,cardImage:l,outline:g,indexBadge:u,columnsPhone:x,columnsTablet:E,gap:k,gapPhone:_}){const L={columns:d,columnsPhone:x,columnsTablet:E,gap:k,gapPhone:_,hover:R,ownerId:c,template:m,editing:n},s=Ee(),F=me(),v=we(C),t=xe(N),T=t?M(t):!1,[U,H]=J([]);if(q(()=>{if(s||!n||!T)return;let p=!1;return he().then(b=>{const X=b.length>0?b:j;p||H(X)}).catch(()=>{p||H(j)}),()=>{p=!0}},[s,n,T]),!t)return null;const f=a?null:e(ce,{num:o?O(o):void 0,title:ue(r||t.heading,!1),description:i?O(i):void 0,accent:!0});if(!M(t)){if(s&&!W(t,s.product.kind))return n?e(z,{relationship:t,cardImage:l}):null;const p=s?t.resolve(s.product,s.relatedWheels):null,b=p?.kind==="bundle"?p.bundles.slice(0,v):[];return b.length===0?n?e(V,{header:f,omitHead:a,cardImage:l,words:P("Bundles containing this product appear here on a product page.")}):null:e(I,{header:f,cards:{bundles:b},...L})}const A=ye(t,F);if(!s)return n?e(I,{header:f,cards:{wheels:U.slice(0,v)},viewMore:A,...L}):null;if(!W(t,s.product.kind))return n?e(z,{relationship:t,cardImage:l}):null;const h=t.resolve(s.product,s.relatedWheels);return h.kind==="tyre"?e(ee,{omitHead:a,columns:d,cardImage:l,outline:g,indexBadge:u,num:o,title:r||t.heading,description:i,tyres:[...h.tyres].slice(0,v),footnote:w,footnoteLinkText:y,footnoteLinkHref:S,viewMore:A,editing:n}):h.kind!=="alloy-wheel"?null:h.wheels.length===0?n?e(V,{header:f,omitHead:a,cardImage:l,words:P("Related products appear here on a product page.")}):null:e(I,{header:f,cards:{wheels:[...h.wheels].slice(0,v)},viewMore:A,...L})}function z({relationship:o,cardImage:r}){return e(G,{className:"border-b border-line py-14 max-view-desktop:py-10",style:D(r),children:e("p",{className:`font-mono ${K.label} uppercase tracking-[0.18em] text-fg-dim`,children:P("“{relationship}” does not apply to this product. It is hidden on the live page.",{relationship:P(o.label)})})})}const Ce="border-b border-line py-[120px] max-view-desktop:py-20",Ne="border-b border-line pt-0 pb-[120px] max-view-desktop:pt-0 max-view-desktop:pb-20";function V({header:o,omitHead:r,cardImage:i,words:d}){return $(G,{className:r?Ne:Ce,style:D(i),children:[o,e("p",{className:`border-t border-line py-6 font-mono ${K.label} uppercase tracking-[0.18em] text-fg-dim`,children:d})]})}function I({header:o,cards:r,viewMore:i,columns:d,columnsPhone:C,columnsTablet:N,gap:w,gapPhone:y,hover:S,ownerId:n,template:a,editing:R}){const c=Z("rp"),m="wheels"in r?r.wheels.length:r.bundles.length;if(m===0)return null;const l=le(d,C,N),g="bundles"in r,u=g?B("ProductGrid",w,"both",y):re(B("ProductGrid",w,"both",y)),x=se(c),E=ae(c,l,{cards:m}),k=_=>e("div",{className:g?`${c} mt-10 grid${u.className} ${l}`:`${c} grid${u.className} bg-[var(--catalog-grid-bg)] ${l}`,style:u.style,children:_});return $(G,{className:"border-b border-line py-[120px] max-view-desktop:py-20",children:[x&&e("style",{children:x}),E&&e("style",{children:E}),o,e(oe,{value:{ownerId:n,Template:a,hover:S??Y,imageSizes:de(l,m),fieldUsage:ie,reserveEyebrow:!1,editing:R},children:"wheels"in r?e(ne,{wheels:r.wheels,children:k}):e(te,{bundles:r.bundles,children:k})}),i?e("div",{className:"mt-10 flex",children:e(pe,{href:i.href,label:i.label})}):null]})}export{Pe as RelatedProductsBody,ve as default,ke as supportedKinds};
@@ -1 +1 @@
1
- "use client";import{jsx as a}from"react/jsx-runtime";import b from"../SpecTable.js";import k from"./KindGate.js";import{DynamicEuTyreLabelBlock as v}from"./DynamicEuTyreLabel.js";import{buildSpecSheet as z,sourceFromWheel as E}from"../../lib/wheels/spec-sheet.js";import{buildTyreSpecSheet as I}from"../../lib/tyres/spec-sheet.js";import{partVariant as L}from"../../lib/catalog/from-wheel.js";import{useCurrentProduct as P}from"../../lib/document/current-product.js";import{applySpecAnswers as h}from"../../lib/content/field-usage.js";import{useSampleProduct as j}from"./useSampleProduct.js";const A=["alloy-wheel","tyre"],B=[];function D(t,r,i){const o=t.variants??[];return(r?o.find(n=>n.sku===r):void 0)??(i?o.find(n=>n.size===i):void 0)??o[0]??null}function G(t){return a(k,{kinds:A,type:"SpecTable",editing:t.editing,children:a(K,{...t})})}function K({num:t,title:r,description:i,showDiagram:o=!0,editing:n=!1,nodeId:d,omitHead:u=!1,template:p,showEuLabel:y=!1}){const e=P(),w=j(n&&!e),l=e?.product??w,c=l?.kind==="tyre"?l.source:null,m=e?.fieldUsage??B;if(c){const T=D(c,e?.selection.part?.id,e?.selection.shown.size),x=I({brand:c.brand,variant:T});return a(b,{capped:!1,builtInLabels:!0,num:t,title:r,description:i,rows:h(x.rows,m),diagram:null,editing:n,nodeId:d,omitHead:u,template:p,footer:y?a(v,{editing:n}):void 0})}const s=l?.kind==="alloy-wheel"?l.source:null,S=e?e.selection.shown.finish:s?.finishes[0]?.name,g=e&&s?L(s,e.selection.part)?.size??void 0:void 0,f=s?z(E(s),S,g):{rows:[],diagram:null};return a(b,{capped:!1,builtInLabels:!0,num:t,title:r,description:i,rows:h(f.rows,m),diagram:o?f.diagram:null,editing:n,nodeId:d,omitHead:u,template:p})}export{G as default,A as supportedKinds};
1
+ "use client";import{jsx as a}from"react/jsx-runtime";import b from"../SpecTable.js";import k from"./KindGate.js";import{DynamicEuTyreLabelBlock as I}from"./DynamicEuTyreLabel.js";import{buildSpecSheet as L,sourceFromWheel as v}from"../../lib/wheels/spec-sheet.js";import{buildTyreSpecSheet as z}from"../../lib/tyres/spec-sheet.js";import{partVariant as D}from"../../lib/catalog/from-wheel.js";import{useCurrentProduct as E}from"../../lib/document/current-product.js";import{NO_FIELD_ANSWERS as N,applySpecAnswers as h}from"../../lib/content/field-usage.js";import{useSampleProduct as _}from"./useSampleProduct.js";const j=["alloy-wheel","tyre"];function A(t,r,i){const o=t.variants??[];return(r?o.find(n=>n.sku===r):void 0)??(i?o.find(n=>n.size===i):void 0)??o[0]??null}function B(t){return a(k,{kinds:j,type:"SpecTable",editing:t.editing,children:a(F,{...t})})}function F({num:t,title:r,description:i,showDiagram:o=!0,editing:n=!1,nodeId:d,omitHead:u=!1,template:p,showEuLabel:y=!1}){const e=E(),w=_(n&&!e),l=e?.product??w,c=l?.kind==="tyre"?l.source:null,m=e?.fieldUsage??N;if(c){const T=A(c,e?.selection.part?.id,e?.selection.shown.size),x=z({brand:c.brand,variant:T});return a(b,{capped:!1,builtInLabels:!0,num:t,title:r,description:i,rows:h(x.rows,m),diagram:null,editing:n,nodeId:d,omitHead:u,template:p,footer:y?a(I,{editing:n}):void 0})}const s=l?.kind==="alloy-wheel"?l.source:null,S=e?e.selection.shown.finish:s?.finishes[0]?.name,g=e&&s?D(s,e.selection.part)?.size??void 0:void 0,f=s?L(v(s),S,g):{rows:[],diagram:null};return a(b,{capped:!1,builtInLabels:!0,num:t,title:r,description:i,rows:h(f.rows,m),diagram:o?f.diagram:null,editing:n,nodeId:d,omitHead:u,template:p})}export{B as default,j as supportedKinds};
@@ -1 +1 @@
1
- "use client";import{jsx as r}from"react/jsx-runtime";import u from"./KindGate.js";import{TyreSizesContent as m}from"../TyreSizeGrid.js";import{useCurrentProduct as p}from"../../lib/document/current-product.js";import{useSampleProduct as f}from"./useSampleProduct.js";const l=[],y=["tyre"];function S(t){return r(u,{kinds:y,type:"TyreSizes",editing:t.editing,children:r(x,{...t})})}function x({num:t,title:o,description:s,editing:i=!1,omitHead:c=!1}){const e=p(),d=f(i&&!e),n=e?.product??d,a=n?.kind==="tyre"?n.source.variants:[];return r(m,{variants:a,fieldUsage:e?.fieldUsage??l,num:t,title:o,description:s,editing:i,omitHead:c})}export{S as default,y as supportedKinds};
1
+ "use client";import{jsx as r}from"react/jsx-runtime";import m from"./KindGate.js";import{TyreSizesContent as u}from"../TyreSizeGrid.js";import{useCurrentProduct as p}from"../../lib/document/current-product.js";import{NO_FIELD_ANSWERS as f}from"../../lib/content/field-usage.js";import{useSampleProduct as l}from"./useSampleProduct.js";const y=["tyre"];function S(t){return r(m,{kinds:y,type:"TyreSizes",editing:t.editing,children:r(x,{...t})})}function x({num:t,title:n,description:s,editing:i=!1,omitHead:d=!1}){const e=p(),a=l(i&&!e),o=e?.product??a,c=o?.kind==="tyre"?o.source.variants:[];return r(u,{variants:c,fieldUsage:e?.fieldUsage??f,num:t,title:n,description:s,editing:i,omitHead:d})}export{S as default,y as supportedKinds};
@@ -1 +1 @@
1
- "use client";import{jsx as r,jsxs as p,Fragment as se}from"react/jsx-runtime";import{LISTING_CARD_SHOW as O}from"../../lib/sections/card-show-defaults.js";import{useScopeClass as Qe}from"../../lib/use-scope-class.js";import{useCallback as d,useEffect as Ze,useMemo as i,useRef as et,useState as tt}from"react";import{CARD_IMAGE_BG_OFF as ot,resolveCardImageBackground as rt}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as nt}from"efficient-web-builder/format/lib/content/card-image-shape";import{cardIndexCss as st,DEFAULT_CARD_INDEX_FORMAT as it,DEFAULT_CARD_OUTLINE as lt}from"efficient-web-builder/format/lib/sections/product-card-style";import{answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as at}from"../CurrencyContext.js";import ct from"../NoCurrencyNote.js";import{usePreviewDevice as pt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as dt,renderHeadline as mt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as ht}from"../useProductCatalog.js";import{scrollBehavior as ut}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ft,PLP_GRID_GAP_VAR as gt,plpGridVars as yt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as St}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as xt,cardRowsGridStyle as wt}from"../WheelCardFrame.js";import{applyPlpFilters as bt,buildPlpFacets as Ct,buildPlpTypeOptions as Pt,buildTyreSizeBoxes as kt,EMPTY_PLP_FILTERS as le,hasActivePlpFilters as vt,paginatePlp as Nt,pickTyreSize as Tt,plpTyreSizeBoxesShown as _t,plpInStockCount as At,plpOpeningSort as zt,plpPriceBounds as Ft,plpShownKinds as Bt,plpSortKeysFor as It,PLP_SORT_LABELS as Ot}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as R,itemTyreSizes as Rt,plpBrandVaries as Lt,plpProcessVaries as Vt,plpItemsOfKinds as Et,plpKindNoun as L,resolvePlpKinds as Dt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Gt,plpVehicleCopy as Kt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as jt,oemTyreSizes as Mt}from"../../lib/tyres/tyre-vehicle-fitment.js";import $t from"../TyreSummaryCard.js";import{wheelsFittingVehicle as Wt}from"../../lib/wheels/plp-fitment-match.js";import Ut from"./PlpActiveChips.js";import{DEFAULT_COVER_INDEX as Ht}from"../../lib/wheels/cover-rendering.js";import Xt from"./PlpCard.js";import Yt from"./PlpPagination.js";import qt from"./PlpSidebar.js";import{PlpResultRange as Jt,PlpToolbar as Qt}from"./PlpToolbar.js";import Zt from"../catalog/SortSelect.js";import eo from"./PlpVehicleBar.js";import to from"./PlpVehicleGate.js";import{useVehicleCatalog as oo}from"./useVehicleCatalog.js";import{useVehicleFit as ro}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as no}from"./usePlpFiltersInUrl.js";import{say as V}from"efficient-web-builder/format/lib/editor-words";const Wo={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function so({level:C,className:P,children:k}){return r(C===2?"h2":"h1",{className:P,children:k})}const io=[];function lo({heading:C="",intro:P="",askForCar:k=!0,gateHeading:E="",gateIntro:ae="",perPage:D=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:de=[],fieldUsage:f=io,showPrice:G=!0,showInStock:me=!0,kinds:he,products:ue,wheels:fe,requestQuery:ge,editing:m=!1,coverIndex:ye=Ht,cardImage:Se,hover:xe,imageBackground:we,showBadge:be=!0,showCardSizes:Ce,showCardBuy:Pe,showCardPage:ke,showCardPrice:ve,showCardFinishes:Ne,outline:Te=lt,indexBadge:K=it,titleLevel:_e}){const{currency:l}=at(),Ae=rt(we,ot),h=Dt(he),j=pt(),M=ft(ce),ze=yt(M,m?j:null),Fe=St(M,m?j:null),$=Qe("plp"),F=st($,K),Be=ht(),W=ue??fe??Be??[],U=i(()=>Et(W,h),[W,h.join(",")]),o=ro({editing:m,enabled:k,autoApply:!0}),[Ie,B]=tt(!1),Oe=zt(pe,h),g=o.applied?.vehicle??null,[e,x]=no({editing:m,openingSort:Oe,appliedVehicle:g,vehicleRestored:o.restored,requestQuery:ge}),c=Bt(h,e.kind),s=d(t=>x(t),[x]),H=d((t,u)=>{const a=e[t],qe=a.map(String).includes(u)?a.filter(Je=>String(Je)!==u):[...a,t==="diameters"?Number(u):u];s({...e,[t]:qe,page:1})},[e,s]),X=d(t=>s({...e,priceMax:t,page:1}),[e,s]),Y=d(t=>s({...e,inStockOnly:t,page:1}),[e,s]),q=d(t=>s({...le,kind:t,inStockOnly:e.inStockOnly,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMax,e.sort,s]),Re=d(t=>s({...e,sort:t,page:1}),[e,s]),Le=d(t=>{s({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:ut()})},[e,s]),J=d(()=>s({...le,sort:e.sort}),[e.sort,s]),{clear:N}=o,Q=d(()=>{N(),B(!0),x(t=>({...t,page:1}))},[N]),Ve=d(()=>{N(),B(!1),x(t=>({...t,page:1}))},[N]),T=g?[g.make,g.model,g.year,g.modification].join("|"):"",_=et(null);Ze(()=>{if(o.restored){if(_.current===null){_.current=T;return}_.current!==T&&(_.current=T,x(t=>t.page===1?t:{...t,page:1}))}},[o.restored,T,x]);const A=oo({catalog:U,shownKinds:h,vehicle:g,editing:m}),n=i(()=>{if(!o.fit)return A;const t=A.filter(a=>z(a)==="alloy-wheel"),u=new Set(Wt(t,o.fit).map(a=>a.slug));return A.filter(a=>z(a)!=="alloy-wheel"||u.has(R(a)))},[A,o.fit]),w=de.join(","),Ee=i(()=>{const t=new Set(w?w.split(","):[]);return Ct(n,e,l,c,f).filter(u=>!t.has(u.key))},[n,e,l,w,c.join(","),f]),y=i(()=>bt(n,e,l),[n,e,l]),Z=c.length>1,De=i(()=>ie(f,"alloy-wheel"),[f]),Ge=i(()=>ie(f,"tyre"),[f]),ee=i(()=>Lt(y),[y]),Ke=i(()=>Vt(y),[y]),je=i(()=>G?Ft(n,l):null,[n,l,G]),Me=i(()=>At(n,e,l),[n,e,l]),$e=i(()=>Pt(n,h,e,l),[n,h.join(","),e,l]),We=d((t,u)=>{const a=Tt(n.flatMap(Rt),e.tyreSizes[0]??"",t,u);s({...e,tyreSizes:a?[a]:[],page:1})},[n,e,s]),Ue=i(()=>{const t=new Set(w?w.split(","):[]);return!_t(n,c)||t.has("tyreSizes")?null:kt(n,e,l)},[n,e,l,w,c.join(","),f]),S=i(()=>Nt(y,e.page,D),[y,e.page,D]),b=L(c),I=Kt(c),te=Gt(E,ae,c,h),oe=c.length===1&&c[0]==="tyre",re=o.applied?.stock??null,v=i(()=>Mt(re),[re]),He=i(()=>n.filter(t=>c.includes(z(t))).length,[n,c.join(",")]),ne=U.length===0,Xe=!ne&&n.length===0,Ye=k&&!m&&!o.applied&&!Ie;return h.length===0?null:p("section",{style:nt(Se),children:[k&&r(eo,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:oe&&v.length>0?`Takes ${v.join(" · ")}`:null,resolving:o.resolving,unresolved:oe?!!o.applied&&!o.resolving&&v.length===0:o.unresolved,matchCount:He,copy:I,onAmend:Ve,onClear:Q}),Ye&&r(to,{cascade:o.cascade,heading:te.heading,intro:te.intro,ready:o.restored,copy:I,onSkip:()=>B(!0)}),p("div",{className:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[(C||P)&&p("header",{className:"mb-6",children:[C&&r(so,{level:_e,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:mt(C,!1)}),P&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:dt(P)})]}),p("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(qt,{facets:Ee,filters:e,typeOptions:$e,sizeBoxes:Ue,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:b,priceBounds:je,inStockCount:me?Me:null,onToggle:H,onPickType:q,onPickSize:We,onPriceMax:X,onInStockOnly:Y,onClearAll:J}),p("div",{className:"min-w-0 flex-1",children:[r(Qt,{className:"mb-4",start:p(se,{children:[r(Jt,{total:S.total,range:{from:S.from,to:S.to},noun:b}),r(Ut,{filters:e,onToggle:H,onPriceMax:X,onInStockOnly:Y,onPickType:q})]}),end:r(Zt,{value:e.sort,keys:It(h),labels:Ot,onChange:Re})}),ne?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?b.many==="wheels"?V("No wheels in this website's catalog yet — curate products to see them here."):b.many==="tyres"?V("No tyres in this website's catalog yet — curate products to see them here."):V("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Xe?p("div",{className:"border border-line p-10",children:[p("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:I.nothingFits}),p("button",{type:"button",onClick:Q,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",b.many]})]}):S.total===0?p("div",{className:"border border-line p-10",children:[p("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",b.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),vt(e)&&r("button",{type:"button",onClick:J,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):p(se,{children:[F&&r("style",{children:F}),r("div",{className:`${F?`${$} plp-card-grid`:"plp-card-grid"} ${xt}`,style:{...ze,...wt(`var(${gt})`)},children:S.items.map(t=>z(t)==="tyre"?r($t,{item:t,currency:l,fitSize:v.length>0?jt(t.sizes,v):null,kindLabel:Z?L(["tyre"]).one:null,showBrand:ee,editing:m,fieldUsage:Ge},`tyre:${R(t)}`):r(Xt,{wheel:t,colours:e.finishes,fit:o.fit,editing:m,kindLabel:Z?L(["alloy-wheel"]).one:null,showBrand:ee,coverIndex:ye,fieldUsage:De,showProcess:Ke,hover:xe,imageBackgroundFill:Ae,showBadge:be,outline:Te,indexBadge:K,showCardSizes:Ce??O.showCardSizes,showCardBuy:Pe??O.showCardBuy,showCardPage:ke??O.showCardPage,showCardPrice:ve??!0,showCardFinishes:Ne??!0,imageSizes:Fe},`wheel:${R(t)}`))})]}),r(Yt,{page:S.page,pageCount:S.pageCount,onPage:Le}),r(ct,{editing:m})]})]})]})]})}export{Wo as PLP_GATE_DEFAULTS,lo as default};
1
+ "use client";import{jsx as r,jsxs as p,Fragment as se}from"react/jsx-runtime";import{LISTING_CARD_SHOW as O}from"../../lib/sections/card-show-defaults.js";import{useScopeClass as Qe}from"../../lib/use-scope-class.js";import{useCallback as d,useEffect as Ze,useMemo as i,useRef as et,useState as tt}from"react";import{CARD_IMAGE_BG_OFF as ot,resolveCardImageBackground as rt}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as nt}from"efficient-web-builder/format/lib/content/card-image-shape";import{cardIndexCss as st,DEFAULT_CARD_INDEX_FORMAT as it,DEFAULT_CARD_OUTLINE as lt}from"efficient-web-builder/format/lib/sections/product-card-style";import{NO_FIELD_ANSWERS as at,answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as ct}from"../CurrencyContext.js";import pt from"../NoCurrencyNote.js";import{usePreviewDevice as dt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as mt,renderHeadline as ht}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as ut}from"../useProductCatalog.js";import{scrollBehavior as ft}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as gt,PLP_GRID_GAP_VAR as yt,plpGridVars as St}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as xt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as wt,cardRowsGridStyle as bt}from"../WheelCardFrame.js";import{applyPlpFilters as Ct,buildPlpFacets as Pt,buildPlpTypeOptions as kt,buildTyreSizeBoxes as vt,EMPTY_PLP_FILTERS as le,hasActivePlpFilters as Nt,paginatePlp as _t,pickTyreSize as Tt,plpTyreSizeBoxesShown as At,plpInStockCount as zt,plpOpeningSort as Ft,plpPriceBounds as It,plpShownKinds as Bt,plpSortKeysFor as Ot,PLP_SORT_LABELS as Lt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as L,itemTyreSizes as Rt,plpBrandVaries as Vt,plpProcessVaries as Et,plpItemsOfKinds as Dt,plpKindNoun as R,resolvePlpKinds as Gt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Kt,plpVehicleCopy as jt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Mt,oemTyreSizes as $t}from"../../lib/tyres/tyre-vehicle-fitment.js";import Wt from"../TyreSummaryCard.js";import{wheelsFittingVehicle as Ut}from"../../lib/wheels/plp-fitment-match.js";import Ht from"./PlpActiveChips.js";import{DEFAULT_COVER_INDEX as Xt}from"../../lib/wheels/cover-rendering.js";import Yt from"./PlpCard.js";import qt from"./PlpPagination.js";import Jt from"./PlpSidebar.js";import{PlpResultRange as Qt,PlpToolbar as Zt}from"./PlpToolbar.js";import eo from"../catalog/SortSelect.js";import to from"./PlpVehicleBar.js";import oo from"./PlpVehicleGate.js";import{useVehicleCatalog as ro}from"./useVehicleCatalog.js";import{useVehicleFit as no}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as so}from"./usePlpFiltersInUrl.js";import{say as V}from"efficient-web-builder/format/lib/editor-words";const Wo={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function io({level:C,className:P,children:k}){return r(C===2?"h2":"h1",{className:P,children:k})}function lo({heading:C="",intro:P="",askForCar:k=!0,gateHeading:E="",gateIntro:ae="",perPage:D=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:de=[],fieldUsage:f=at,showPrice:G=!0,showInStock:me=!0,kinds:he,products:ue,wheels:fe,requestQuery:ge,editing:m=!1,coverIndex:ye=Xt,cardImage:Se,hover:xe,imageBackground:we,showBadge:be=!0,showCardSizes:Ce,showCardBuy:Pe,showCardPage:ke,showCardPrice:ve,showCardFinishes:Ne,outline:_e=lt,indexBadge:K=it,titleLevel:Te}){const{currency:l}=ct(),Ae=rt(we,ot),h=Gt(he),j=dt(),M=gt(ce),ze=St(M,m?j:null),Fe=xt(M,m?j:null),$=Qe("plp"),F=st($,K),Ie=ut(),W=ue??fe??Ie??[],U=i(()=>Dt(W,h),[W,h.join(",")]),o=no({editing:m,enabled:k,autoApply:!0}),[Be,I]=tt(!1),Oe=Ft(pe,h),g=o.applied?.vehicle??null,[e,x]=so({editing:m,openingSort:Oe,appliedVehicle:g,vehicleRestored:o.restored,requestQuery:ge}),c=Bt(h,e.kind),s=d(t=>x(t),[x]),H=d((t,u)=>{const a=e[t],qe=a.map(String).includes(u)?a.filter(Je=>String(Je)!==u):[...a,t==="diameters"?Number(u):u];s({...e,[t]:qe,page:1})},[e,s]),X=d(t=>s({...e,priceMax:t,page:1}),[e,s]),Y=d(t=>s({...e,inStockOnly:t,page:1}),[e,s]),q=d(t=>s({...le,kind:t,inStockOnly:e.inStockOnly,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMax,e.sort,s]),Le=d(t=>s({...e,sort:t,page:1}),[e,s]),Re=d(t=>{s({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:ft()})},[e,s]),J=d(()=>s({...le,sort:e.sort}),[e.sort,s]),{clear:N}=o,Q=d(()=>{N(),I(!0),x(t=>({...t,page:1}))},[N]),Ve=d(()=>{N(),I(!1),x(t=>({...t,page:1}))},[N]),_=g?[g.make,g.model,g.year,g.modification].join("|"):"",T=et(null);Ze(()=>{if(o.restored){if(T.current===null){T.current=_;return}T.current!==_&&(T.current=_,x(t=>t.page===1?t:{...t,page:1}))}},[o.restored,_,x]);const A=ro({catalog:U,shownKinds:h,vehicle:g,editing:m}),n=i(()=>{if(!o.fit)return A;const t=A.filter(a=>z(a)==="alloy-wheel"),u=new Set(Ut(t,o.fit).map(a=>a.slug));return A.filter(a=>z(a)!=="alloy-wheel"||u.has(L(a)))},[A,o.fit]),w=de.join(","),Ee=i(()=>{const t=new Set(w?w.split(","):[]);return Pt(n,e,l,c,f).filter(u=>!t.has(u.key))},[n,e,l,w,c.join(","),f]),y=i(()=>Ct(n,e,l),[n,e,l]),Z=c.length>1,De=i(()=>ie(f,"alloy-wheel"),[f]),Ge=i(()=>ie(f,"tyre"),[f]),ee=i(()=>Vt(y),[y]),Ke=i(()=>Et(y),[y]),je=i(()=>G?It(n,l):null,[n,l,G]),Me=i(()=>zt(n,e,l),[n,e,l]),$e=i(()=>kt(n,h,e,l),[n,h.join(","),e,l]),We=d((t,u)=>{const a=Tt(n.flatMap(Rt),e.tyreSizes[0]??"",t,u);s({...e,tyreSizes:a?[a]:[],page:1})},[n,e,s]),Ue=i(()=>{const t=new Set(w?w.split(","):[]);return!At(n,c)||t.has("tyreSizes")?null:vt(n,e,l)},[n,e,l,w,c.join(","),f]),S=i(()=>_t(y,e.page,D),[y,e.page,D]),b=R(c),B=jt(c),te=Kt(E,ae,c,h),oe=c.length===1&&c[0]==="tyre",re=o.applied?.stock??null,v=i(()=>$t(re),[re]),He=i(()=>n.filter(t=>c.includes(z(t))).length,[n,c.join(",")]),ne=U.length===0,Xe=!ne&&n.length===0,Ye=k&&!m&&!o.applied&&!Be;return h.length===0?null:p("section",{style:nt(Se),children:[k&&r(to,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:oe&&v.length>0?`Takes ${v.join(" · ")}`:null,resolving:o.resolving,unresolved:oe?!!o.applied&&!o.resolving&&v.length===0:o.unresolved,matchCount:He,copy:B,onAmend:Ve,onClear:Q}),Ye&&r(oo,{cascade:o.cascade,heading:te.heading,intro:te.intro,ready:o.restored,copy:B,onSkip:()=>I(!0)}),p("div",{className:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[(C||P)&&p("header",{className:"mb-6",children:[C&&r(io,{level:Te,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:ht(C,!1)}),P&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:mt(P)})]}),p("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(Jt,{facets:Ee,filters:e,typeOptions:$e,sizeBoxes:Ue,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:b,priceBounds:je,inStockCount:me?Me:null,onToggle:H,onPickType:q,onPickSize:We,onPriceMax:X,onInStockOnly:Y,onClearAll:J}),p("div",{className:"min-w-0 flex-1",children:[r(Zt,{className:"mb-4",start:p(se,{children:[r(Qt,{total:S.total,range:{from:S.from,to:S.to},noun:b}),r(Ht,{filters:e,onToggle:H,onPriceMax:X,onInStockOnly:Y,onPickType:q})]}),end:r(eo,{value:e.sort,keys:Ot(h),labels:Lt,onChange:Le})}),ne?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?b.many==="wheels"?V("No wheels in this website's catalog yet — curate products to see them here."):b.many==="tyres"?V("No tyres in this website's catalog yet — curate products to see them here."):V("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Xe?p("div",{className:"border border-line p-10",children:[p("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:B.nothingFits}),p("button",{type:"button",onClick:Q,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",b.many]})]}):S.total===0?p("div",{className:"border border-line p-10",children:[p("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",b.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),Nt(e)&&r("button",{type:"button",onClick:J,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):p(se,{children:[F&&r("style",{children:F}),r("div",{className:`${F?`${$} plp-card-grid`:"plp-card-grid"} ${wt}`,style:{...ze,...bt(`var(${yt})`)},children:S.items.map(t=>z(t)==="tyre"?r(Wt,{item:t,currency:l,fitSize:v.length>0?Mt(t.sizes,v):null,kindLabel:Z?R(["tyre"]).one:null,showBrand:ee,editing:m,fieldUsage:Ge},`tyre:${L(t)}`):r(Yt,{wheel:t,colours:e.finishes,fit:o.fit,editing:m,kindLabel:Z?R(["alloy-wheel"]).one:null,showBrand:ee,coverIndex:ye,fieldUsage:De,showProcess:Ke,hover:xe,imageBackgroundFill:Ae,showBadge:be,outline:_e,indexBadge:K,showCardSizes:Ce??O.showCardSizes,showCardBuy:Pe??O.showCardBuy,showCardPage:ke??O.showCardPage,showCardPrice:ve??!0,showCardFinishes:Ne??!0,imageSizes:Fe},`wheel:${L(t)}`))})]}),r(qt,{page:S.page,pageCount:S.pageCount,onPage:Re}),r(pt,{editing:m})]})]})]})]})}export{Wo as PLP_GATE_DEFAULTS,lo as default};
@@ -1 +1 @@
1
- "use client";import{jsx as r,jsxs as u}from"react/jsx-runtime";import{useCurrency as c}from"../CurrencyContext.js";import{formatPrice as f}from"../../lib/commerce.js";import{plpActiveChips as m}from"../../lib/wheels/plp-filters.js";function p({filters:t,onToggle:l,onPriceMax:s,onInStockOnly:i,onPickType:o}){const{currency:a}=c(),n=m(t,a,f);return n.length===0?null:r("ul",{className:"flex list-none flex-wrap items-center gap-2",children:n.map(e=>r("li",{children:u("button",{type:"button",onClick:()=>e.key==="price"?s(null):e.key==="inStock"?i(!1):e.key==="kind"?o(null):l(e.key,e.value),className:`flex cursor-pointer items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em] text-bg hover:bg-fg ${e.key==="inStock"?"bg-green":"bg-accent"}`,children:[e.label,r("span",{"aria-hidden":"true",children:"✕"}),r("span",{className:"sr-only",children:"Remove filter"})]})},`${e.key}:${e.value}`))})}export{p as default};
1
+ "use client";import{jsx as r,jsxs as a}from"react/jsx-runtime";import{useCurrency as c}from"../CurrencyContext.js";import{formatPrice as f}from"../../lib/commerce.js";import{plpActiveChips as m}from"../../lib/wheels/plp-filters.js";function p({filters:t,onToggle:l,onPriceMax:s,onInStockOnly:i,onPickType:o}){const{currency:u}=c(),n=m(t,u,f);return n.length===0?null:r("ul",{className:"flex list-none flex-wrap items-center gap-2",children:n.map(e=>r("li",{children:a("button",{type:"button",onClick:()=>{if(e.key==="price")return s(null);if(e.key==="inStock")return i(!1);if(e.key==="kind")return o(null);if(!(e.key==="priceMin"||e.key==="lugs"))return l(e.key,e.value)},className:`flex cursor-pointer items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em] text-bg hover:bg-fg ${e.key==="inStock"?"bg-green":"bg-accent"}`,children:[e.label,r("span",{"aria-hidden":"true",children:"✕"}),r("span",{className:"sr-only",children:"Remove filter"})]})},`${e.key}:${e.value}`))})}export{p as default};
@@ -1,7 +1,7 @@
1
1
  import { type CardHoverDrawn } from "efficient-web-builder/format/lib/animation/hover";
2
2
  import type { WheelSummary } from "../../lib/api/index.js";
3
3
  import { type CardIndexFormat, type CardOutline } from "efficient-web-builder/format/lib/sections/product-card-style";
4
- import type { FieldUsageAnswer } from "../../lib/content/field-usage.js";
4
+ import { type FieldUsageAnswer } from "../../lib/content/field-usage.js";
5
5
  import { type VehicleFitment } from "../../lib/wheels/plp-fitment-match.js";
6
6
  export interface PlpCardProps {
7
7
  wheel: WheelSummary;
@@ -1 +1 @@
1
- "use client";import{jsx as r,Fragment as T,jsxs as G}from"react/jsx-runtime";import{CARD_IMAGE_SIZES as M}from"../../lib/sections/card-image-sizes.js";import{LISTING_CARD_SHOW as B}from"../../lib/sections/card-show-defaults.js";import U from"next/image";import{useHeldCardPicture as X}from"../card-pieces/useHeldCardPicture.js";import{useState as H}from"react";import V from"../BrandPlate.js";import Z,{CardBuyDialog as q}from"../card-pieces/CardBuyButton.js";import J from"../card-pieces/CardFinishSwatches.js";import K from"../card-pieces/CardPrice.js";import Q from"../card-pieces/CardProductBadge.js";import{useWheelCardState as Y,WheelCardStateProvider as ee}from"../card-pieces/ProductCardState.js";import{wheelCardEyebrow as re,wheelCardEyebrowShows as oe}from"../ProductCardEyebrow.js";import{withRMark as k}from"efficient-web-builder/render/components/RMark";import ae from"../WheelPlaceholder.js";import{cardSpinOf as se}from"../card-spin.js";import{cardHoverOf as te}from"efficient-web-builder/format/lib/animation/hover";import{CardSpecFacts as ne}from"../card-pieces/CardSpecs.js";import ie from"../WheelCardFrame.js";import{CARD_IMAGE_BG_OFF as le}from"efficient-web-builder/format/lib/content/card-image-background";import{itemBrand as de}from"../../lib/catalog/plp-item.js";import{CARD_INDEX_BADGE_CLASS as me,CARD_INDEX_CLASS as ce,DEFAULT_CARD_INDEX_FORMAT as he,DEFAULT_CARD_OUTLINE as pe}from"efficient-web-builder/format/lib/sections/product-card-style";import{setSecondSrc as ue}from"../../lib/wheels/set-mode.js";import{PLP_GRID_GAP_VAR as fe}from"../../lib/wheels/plp-grid.js";import{FITMENT_FIELD_SEPARATOR as we}from"../../lib/wheels/plp-fitment-match.js";import{coverSrcForWheel as Se,DEFAULT_COVER_INDEX as Ce,resolvePaintedSrc as ge}from"../../lib/wheels/cover-rendering.js";const _e=[],Ee=te({},"AlloyWheelsListing");function Ae({wheel:i,colours:p,fit:l=null,editing:d=!1,brandPlate:m=!1,kindLabel:u=null,showBrand:t=!0,showProcess:f=!1,coverIndex:w=Ce,fieldUsage:S=_e,hover:C=Ee,imageBackgroundFill:g=le,showBadge:_=!0,outline:E=pe,indexBadge:A=he,showCardSizes:F=B.showCardSizes,showCardBuy:b=B.showCardBuy,showCardPage:c=B.showCardPage,showCardPrice:o=!0,showCardFinishes:e=!0,imageSizes:h=M}){return r(ee,{wheel:i,colours:p,editing:d,children:r(Fe,{fit:l,brandPlate:m,kindLabel:u,showBrand:t,showProcess:f,coverIndex:w,fieldUsage:S,hover:C,imageBackgroundFill:g,showBadge:_,outline:E,indexBadge:A,showCardSizes:F,showCardBuy:b,showCardPage:c,showCardPrice:o,showCardFinishes:e,imageSizes:h})})}function Fe({fit:i,brandPlate:p,kindLabel:l,showBrand:d,showProcess:m,coverIndex:u,fieldUsage:t,hover:f,imageBackgroundFill:w,showBadge:S,outline:C,indexBadge:g,showCardSizes:_,showCardBuy:E,showCardPage:A,showCardPrice:F,showCardFinishes:b,imageSizes:c}){const{wheel:o,sel:e,isSet:h}=Y(),x=Se(o,u,e.finish?.name,e.shownSrc,i?.holes),[D,O]=H(()=>new Set),y=a=>{e.pictureFailed(a),O(n=>n.has(a)?n:new Set(n).add(a))},R=ge({overrideSrc:x,hookSrc:e.shownSrc,failed:D}),P=de(o),I=se(f),L=(a,n)=>r(U,{alt:n,src:a,width:800,height:800,sizes:c,className:["block h-full w-full object-contain",I.className].filter(Boolean).join(" "),style:I.style,draggable:!1,onError:()=>y(a)},a),W=e.finish?`${o.name} — ${e.finish.name}`:o.name,v=h?ue(o.finishes?.find(a=>a.name===e.finish?.name),R):null,s=X({src:R,second:v,alt:W,sizes:c,failed:D,onFailed:y,near:e.nearScreen,holdEmpty:e.awaitingProbe}),$=G(T,{children:[s.src?L(s.src,s.alt):r(ae,{imageLabel:o.name,spin:I}),s.trial]}),j=s.second?L(s.second,`${s.alt} — right`):void 0,N=g!=="off"?r("span",{"aria-hidden":!0,className:`${ce} ${me}`}):null,z=re({kindLabel:l,brand:d&&P?k(P):null,process:m&&o.process?k(o.process):null},t);return G(T,{children:[r(ie,{href:`/wheels/${o.slug}`,wide:h,setGridGap:`var(${fe})`,identityLink:!0,containerProps:{onPointerEnter:e.arm,onTouchStart:e.arm,onFocusCapture:e.arm},probes:e.probes,outline:C,imageBackgroundFill:w,indexBadge:N,badges:r(Q,{show:S,numbered:N!=null,sale:!0}),image:$,imageSecond:j,plate:p?r(V,{brand:P,logo:o.brandLogo}):null,eyebrow:z,wholeCardLink:!0,reserveEyebrow:oe({kind:!!l,brand:d,process:m},t),spec:r(ne,{sizes:_,fieldUsage:t,car:i,separator:we}),price:r(K,{show:F,setTotal:!0,wasFollowsSize:!0}),swatches:r(J,{show:b,showSingle:!0}),buy:r(Z,{buy:E,page:A})}),r(q,{})]})}export{Ae as default};
1
+ "use client";import{jsx as r,Fragment as T,jsxs as G}from"react/jsx-runtime";import{CARD_IMAGE_SIZES as M}from"../../lib/sections/card-image-sizes.js";import{LISTING_CARD_SHOW as D}from"../../lib/sections/card-show-defaults.js";import U from"next/image";import{useHeldCardPicture as X}from"../card-pieces/useHeldCardPicture.js";import{useState as H}from"react";import V from"../BrandPlate.js";import Z,{CardBuyDialog as q}from"../card-pieces/CardBuyButton.js";import J from"../card-pieces/CardFinishSwatches.js";import K from"../card-pieces/CardPrice.js";import Q from"../card-pieces/CardProductBadge.js";import{useWheelCardState as Y,WheelCardStateProvider as ee}from"../card-pieces/ProductCardState.js";import{wheelCardEyebrow as re,wheelCardEyebrowShows as oe}from"../ProductCardEyebrow.js";import{withRMark as k}from"efficient-web-builder/render/components/RMark";import ae from"../WheelPlaceholder.js";import{cardSpinOf as te}from"../card-spin.js";import{cardHoverOf as se}from"efficient-web-builder/format/lib/animation/hover";import{CardSpecFacts as ie}from"../card-pieces/CardSpecs.js";import ne from"../WheelCardFrame.js";import{CARD_IMAGE_BG_OFF as le}from"efficient-web-builder/format/lib/content/card-image-background";import{itemBrand as de}from"../../lib/catalog/plp-item.js";import{CARD_INDEX_BADGE_CLASS as me,CARD_INDEX_CLASS as ce,DEFAULT_CARD_INDEX_FORMAT as he,DEFAULT_CARD_OUTLINE as pe}from"efficient-web-builder/format/lib/sections/product-card-style";import{NO_FIELD_ANSWERS as fe}from"../../lib/content/field-usage.js";import{setSecondSrc as ue}from"../../lib/wheels/set-mode.js";import{PLP_GRID_GAP_VAR as we}from"../../lib/wheels/plp-grid.js";import{FITMENT_FIELD_SEPARATOR as Se}from"../../lib/wheels/plp-fitment-match.js";import{coverSrcForWheel as Ce,DEFAULT_COVER_INDEX as ge,resolvePaintedSrc as _e}from"../../lib/wheels/cover-rendering.js";const Ee=se({},"AlloyWheelsListing");function Fe({wheel:n,colours:p,fit:l=null,editing:d=!1,brandPlate:m=!1,kindLabel:f=null,showBrand:s=!0,showProcess:u=!1,coverIndex:w=ge,fieldUsage:S=fe,hover:C=Ee,imageBackgroundFill:g=le,showBadge:_=!0,outline:E=pe,indexBadge:F=he,showCardSizes:A=D.showCardSizes,showCardBuy:b=D.showCardBuy,showCardPage:c=D.showCardPage,showCardPrice:o=!0,showCardFinishes:e=!0,imageSizes:h=M}){return r(ee,{wheel:n,colours:p,editing:d,children:r(Ae,{fit:l,brandPlate:m,kindLabel:f,showBrand:s,showProcess:u,coverIndex:w,fieldUsage:S,hover:C,imageBackgroundFill:g,showBadge:_,outline:E,indexBadge:F,showCardSizes:A,showCardBuy:b,showCardPage:c,showCardPrice:o,showCardFinishes:e,imageSizes:h})})}function Ae({fit:n,brandPlate:p,kindLabel:l,showBrand:d,showProcess:m,coverIndex:f,fieldUsage:s,hover:u,imageBackgroundFill:w,showBadge:S,outline:C,indexBadge:g,showCardSizes:_,showCardBuy:E,showCardPage:F,showCardPrice:A,showCardFinishes:b,imageSizes:c}){const{wheel:o,sel:e,isSet:h}=Y(),x=Ce(o,f,e.finish?.name,e.shownSrc,n?.holes),[B,O]=H(()=>new Set),y=a=>{e.pictureFailed(a),O(i=>i.has(a)?i:new Set(i).add(a))},L=_e({overrideSrc:x,hookSrc:e.shownSrc,failed:B}),I=de(o),P=te(u),R=(a,i)=>r(U,{alt:i,src:a,width:800,height:800,sizes:c,className:["block h-full w-full object-contain",P.className].filter(Boolean).join(" "),style:P.style,draggable:!1,onError:()=>y(a)},a),W=e.finish?`${o.name} — ${e.finish.name}`:o.name,v=h?ue(o.finishes?.find(a=>a.name===e.finish?.name),L):null,t=X({src:L,second:v,alt:W,sizes:c,failed:B,onFailed:y,near:e.nearScreen,holdEmpty:e.awaitingProbe}),$=G(T,{children:[t.src?R(t.src,t.alt):r(ae,{imageLabel:o.name,spin:P}),t.trial]}),j=t.second?R(t.second,`${t.alt} — right`):void 0,N=g!=="off"?r("span",{"aria-hidden":!0,className:`${ce} ${me}`}):null,z=re({kindLabel:l,brand:d&&I?k(I):null,process:m&&o.process?k(o.process):null},s);return G(T,{children:[r(ne,{href:`/wheels/${o.slug}`,wide:h,setGridGap:`var(${we})`,identityLink:!0,containerProps:{onPointerEnter:e.arm,onTouchStart:e.arm,onFocusCapture:e.arm},probes:e.probes,outline:C,imageBackgroundFill:w,indexBadge:N,badges:r(Q,{show:S,numbered:N!=null,sale:!0}),image:$,imageSecond:j,plate:p?r(V,{brand:I,logo:o.brandLogo}):null,eyebrow:z,wholeCardLink:!0,reserveEyebrow:oe({kind:!!l,brand:d,process:m},s),spec:r(ie,{sizes:_,fieldUsage:s,car:n,separator:Se}),price:r(K,{show:A,setTotal:!0,wasFollowsSize:!0}),swatches:r(J,{show:b,showSingle:!0}),buy:r(Z,{buy:E,page:F})}),r(q,{})]})}export{Fe as default};
@@ -1,4 +1,5 @@
1
- export default function PlpPagination({ page, pageCount, onPage, }: {
1
+ export default function PlpPagination({ textSize, page, pageCount, onPage, }: {
2
+ textSize?: string;
2
3
  page: number;
3
4
  pageCount: number;
4
5
  onPage: (page: number) => void;
@@ -1 +1 @@
1
- "use client";import{jsx as o,jsxs as l}from"react/jsx-runtime";import{plpPageSequence as c}from"../../lib/wheels/plp-filters.js";function d({page:t,pageCount:r,onPage:n}){if(r<=1)return null;const s=c(r,t),i="flex h-9 w-9 cursor-pointer items-center justify-center border border-line font-mono text-[13px] transition-colors hover:border-accent hover:text-accent disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-line disabled:hover:text-fg";return l("div",{className:"mt-8 flex flex-wrap items-center justify-between gap-4 border-t border-line pt-4",children:[l("div",{className:"flex items-center gap-2",children:[o("button",{type:"button",onClick:()=>n(t-1),disabled:t<=1,"aria-label":"Previous page",className:i,children:"‹"}),s.map((e,a)=>e===null?o("span",{className:"px-1 font-mono text-[13px] text-fg-dim",children:"…"},`gap-${a}`):o("button",{type:"button",onClick:()=>n(e),"aria-current":e===t?"page":void 0,className:["h-9 min-w-9 cursor-pointer border px-2 font-mono text-[13px] tabular-nums transition-colors",e===t?"border-accent bg-accent text-bg":"border-line hover:border-accent hover:text-accent"].join(" "),children:e},e)),o("button",{type:"button",onClick:()=>n(t+1),disabled:t>=r,"aria-label":"Next page",className:i,children:"›"})]}),l("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Jump to",o("select",{value:t,onChange:e=>n(Number(e.target.value)),className:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] text-fg",children:Array.from({length:r},(e,a)=>a+1).map(e=>l("option",{value:e,children:["Page ",e," of ",r]},e))})]})]})}export{d as default};
1
+ "use client";import{jsx as o,jsxs as l}from"react/jsx-runtime";import{CATALOG_TEXT_SIZE as d}from"../../lib/sections/catalog-text-size.js";import{plpPageSequence as m}from"../../lib/wheels/plp-filters.js";function b({textSize:a=d.pager,page:r,pageCount:t,onPage:n}){if(t<=1)return null;const c=m(t,r),s=`flex h-9 w-9 cursor-pointer items-center justify-center border border-line font-mono ${a} transition-colors hover:border-accent hover:text-accent disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:border-line disabled:hover:text-fg`;return l("div",{className:"mt-8 flex flex-wrap items-center justify-between gap-4 border-t border-line pt-4",children:[l("div",{className:"flex items-center gap-2",children:[o("button",{type:"button",onClick:()=>n(r-1),disabled:r<=1,"aria-label":"Previous page",className:s,children:"‹"}),c.map((e,i)=>e===null?o("span",{className:`px-1 font-mono ${a} text-fg-dim`,children:"…"},`gap-${i}`):o("button",{type:"button",onClick:()=>n(e),"aria-current":e===r?"page":void 0,className:[`h-9 min-w-9 cursor-pointer border px-2 font-mono ${a} tabular-nums transition-colors`,e===r?"border-accent bg-accent text-bg":"border-line hover:border-accent hover:text-accent"].join(" "),children:e},e)),o("button",{type:"button",onClick:()=>n(r+1),disabled:r>=t,"aria-label":"Next page",className:s,children:"›"})]}),l("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Jump to",o("select",{value:r,onChange:e=>n(Number(e.target.value)),className:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] text-fg",children:Array.from({length:t},(e,i)=>i+1).map(e=>l("option",{value:e,children:["Page ",e," of ",t]},e))})]})]})}export{b as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useState as C}from"react";import{useCurrency as _}from"../CurrencyContext.js";import{useEnglish as $}from"../EnglishVariant.js";import{formatPrice as b}from"../../lib/commerce.js";import{hasActivePlpFilters as j,PLP_FACET_LABELS as z}from"../../lib/wheels/plp-filters.js";import T from"./PlpInStockToggle.js";import E from"./PlpTypePicker.js";import F from"./PlpTyreSizeBoxes.js";function A({facets:i,filters:t,typeOptions:m,sizeBoxes:o,sizeMatches:g,noun:s,priceBounds:r,inStockCount:x,onToggle:v,onPickType:k,onPickSize:N,onPriceMax:w,onInStockOnly:P,onClearAll:S}){const{currency:f}=_(),p=$(),[d,h]=C({});return n("aside",{className:"w-full flex-none lg:sticky lg:[--sf-plp-rail-gap:16px] lg:[--sf-plp-rail-top:calc(var(--sf-header-h,88px)+var(--sf-plp-rail-gap))] lg:top-[var(--sf-plp-rail-top)] lg:max-h-[calc(100svh-var(--sf-plp-rail-top)-var(--sf-plp-rail-gap))] lg:w-[268px] lg:overflow-y-auto lg:overscroll-contain lg:pr-2.5",children:[n("div",{className:"flex items-center justify-between pb-2",children:[e("h2",{className:"font-display text-[18px] font-medium uppercase tracking-[-0.01em]",children:"Filter"}),j(t)&&e("button",{type:"button",onClick:S,className:"cursor-pointer font-mono text-[11px] uppercase tracking-[0.16em] text-accent hover:text-fg",children:"Clear all"})]}),m.length>0&&e("div",{className:"pb-1 pt-1",children:e(E,{options:m,noun:s.many,onPick:k})}),x!==null&&e("div",{className:"border-t border-line py-2",children:e(T,{checked:t.inStockOnly,count:x,noun:s.many,onChange:P})}),o&&e(y,{label:p(z.tyreSizes),open:!d.tyreSizes,onToggle:()=>h(a=>({...a,tyreSizes:!a.tyreSizes})),children:!d.tyreSizes&&e("div",{className:"pb-3",children:e(F,{boxes:o,composed:t.tyreSizes[0]??"",matches:g,noun:s.many,onPick:N})})}),i.map(a=>{if(a.options.length===0)return null;const c=!d[a.key];return e(y,{label:p(a.label),open:c,onToggle:()=>h(l=>({...l,[a.key]:!l[a.key]})),children:c&&e("ul",{className:"flex flex-col pb-3",children:a.options.map(l=>{const u=l.count===0&&!l.checked;return e("li",{children:n("label",{className:`flex items-center gap-2.5 py-1 text-[13px] ${u?"opacity-40":"cursor-pointer"}`,children:[e("input",{type:"checkbox",checked:l.checked,disabled:u,onChange:()=>v(a.key,l.value),"aria-label":`${p(a.label)}: ${l.label} (${l.count} ${s.many})`,className:"h-[16px] w-[16px] flex-none accent-[var(--accent)]"}),l.swatch&&e("span",{className:"inline-block h-[13px] w-[13px] flex-none rounded-full shadow-[inset_0_0_0_1px_var(--site-line)]",style:{background:l.swatch}}),e("span",{className:"flex-1 capitalize",children:l.label}),e("span",{className:"font-mono text-[11px] tabular-nums text-fg-dim",children:l.count})]})},l.value)})})},a.key)}),r&&n("div",{className:"border-t border-line py-3",children:[n("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em]",children:["Price · per ",s.one]}),e("input",{type:"range",min:r.min,max:r.max,step:5,value:t.priceMax??r.max,onChange:a=>{const c=Number(a.target.value);w(c>=r.max?null:c)},className:"mt-2 w-full accent-[var(--accent)]","aria-label":`Maximum price per ${s.one}`}),n("div",{className:"mt-1.5 flex justify-between font-mono text-[11px] tabular-nums",children:[e("span",{className:"text-fg-dim",children:b(r.min,f)}),n("span",{children:["Up to ",b(t.priceMax??r.max,f)]})]})]})]})}function y({label:i,open:t,onToggle:m,children:o}){return n("div",{className:"border-t border-line",children:[n("button",{type:"button",onClick:m,"aria-expanded":t,"aria-label":`${t?"Collapse":"Expand"} ${i} filters`,className:"flex w-full cursor-pointer items-center justify-between py-3 text-left",children:[e("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em]",children:i}),e("span",{"aria-hidden":"true",className:`font-mono text-[10px] text-fg-dim transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),o]})}export{A as default};
1
+ "use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import C from"../catalog/ClearAllButton.js";import{useState as _}from"react";import{useCurrency as $}from"../CurrencyContext.js";import{useEnglish as z}from"../EnglishVariant.js";import{formatPrice as y}from"../../lib/commerce.js";import{hasActivePlpFilters as j,PLP_FACET_LABELS as T}from"../../lib/wheels/plp-filters.js";import E from"./PlpInStockToggle.js";import A from"./PlpTypePicker.js";import F from"./PlpTyreSizeBoxes.js";function L({facets:i,filters:t,typeOptions:m,sizeBoxes:p,sizeMatches:g,noun:s,priceBounds:n,inStockCount:x,onToggle:v,onPickType:k,onPickSize:N,onPriceMax:w,onInStockOnly:P,onClearAll:S}){const{currency:f}=$(),o=z(),[d,h]=_({});return r("aside",{className:"w-full flex-none lg:sticky lg:[--sf-plp-rail-gap:16px] lg:[--sf-plp-rail-top:calc(var(--sf-header-h,88px)+var(--sf-plp-rail-gap))] lg:top-[var(--sf-plp-rail-top)] lg:max-h-[calc(100svh-var(--sf-plp-rail-top)-var(--sf-plp-rail-gap))] lg:w-[268px] lg:overflow-y-auto lg:overscroll-contain lg:pr-2.5",children:[r("div",{className:"flex items-center justify-between pb-2",children:[e("h2",{className:"font-display text-[18px] font-medium uppercase tracking-[-0.01em]",children:"Filter"}),j(t)&&e(C,{onClick:S,size:"text-[11px]"})]}),m.length>0&&e("div",{className:"pb-1 pt-1",children:e(A,{options:m,noun:s.many,onPick:k})}),x!==null&&e("div",{className:"border-t border-line py-2",children:e(E,{checked:t.inStockOnly,count:x,noun:s.many,onChange:P})}),p&&e(b,{label:o(T.tyreSizes),open:!d.tyreSizes,onToggle:()=>h(a=>({...a,tyreSizes:!a.tyreSizes})),children:!d.tyreSizes&&e("div",{className:"pb-3",children:e(F,{boxes:p,composed:t.tyreSizes[0]??"",matches:g,noun:s.many,onPick:N})})}),i.map(a=>{if(a.options.length===0)return null;const c=!d[a.key];return e(b,{label:o(a.label),open:c,onToggle:()=>h(l=>({...l,[a.key]:!l[a.key]})),children:c&&e("ul",{className:"flex flex-col pb-3",children:a.options.map(l=>{const u=l.count===0&&!l.checked;return e("li",{children:r("label",{className:`flex items-center gap-2.5 py-1 text-[13px] ${u?"opacity-40":"cursor-pointer"}`,children:[e("input",{type:"checkbox",checked:l.checked,disabled:u,onChange:()=>v(a.key,l.value),"aria-label":`${o(a.label)}: ${l.label} (${l.count} ${s.many})`,className:"h-[16px] w-[16px] flex-none accent-[var(--accent)]"}),l.swatch&&e("span",{className:"inline-block h-[13px] w-[13px] flex-none rounded-full shadow-[inset_0_0_0_1px_var(--site-line)]",style:{background:l.swatch}}),e("span",{className:"flex-1 capitalize",children:l.label}),e("span",{className:"font-mono text-[11px] tabular-nums text-fg-dim",children:l.count})]})},l.value)})})},a.key)}),n&&r("div",{className:"border-t border-line py-3",children:[r("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em]",children:["Price · per ",s.one]}),e("input",{type:"range",min:n.min,max:n.max,step:5,value:t.priceMax??n.max,onChange:a=>{const c=Number(a.target.value);w(c>=n.max?null:c)},className:"mt-2 w-full accent-[var(--accent)]","aria-label":`Maximum price per ${s.one}`}),r("div",{className:"mt-1.5 flex justify-between font-mono text-[11px] tabular-nums",children:[e("span",{className:"text-fg-dim",children:y(n.min,f)}),r("span",{children:["Up to ",y(t.priceMax??n.max,f)]})]})]})]})}function b({label:i,open:t,onToggle:m,children:p}){return r("div",{className:"border-t border-line",children:[r("button",{type:"button",onClick:m,"aria-expanded":t,"aria-label":`${t?"Collapse":"Expand"} ${i} filters`,className:"flex w-full cursor-pointer items-center justify-between py-3 text-left",children:[e("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em]",children:i}),e("span",{"aria-hidden":"true",className:`font-mono text-[10px] text-fg-dim transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),p]})}export{L as default};
@@ -1,6 +1,7 @@
1
1
  import { type Dispatch, type SetStateAction } from "react";
2
2
  import type { VehicleSelection } from "../../lib/wheels/fitment-options.js";
3
3
  import { type PlpFilterState, type PlpSortKey } from "../../lib/wheels/plp-filters.js";
4
+ export declare function watchLocation(onChange: () => void): () => void;
4
5
  export interface PlpUrlFiltersArgs {
5
6
  editing: boolean;
6
7
  openingSort: PlpSortKey;
@@ -8,4 +9,5 @@ export interface PlpUrlFiltersArgs {
8
9
  vehicleRestored: boolean;
9
10
  requestQuery?: string;
10
11
  }
12
+ export declare function filtersFromQuery(search: string, openingSort: PlpSortKey): PlpFilterState;
11
13
  export declare function usePlpFiltersInUrl({ editing, openingSort, appliedVehicle, vehicleRestored, requestQuery, }: PlpUrlFiltersArgs): [PlpFilterState, Dispatch<SetStateAction<PlpFilterState>>];
@@ -1 +1 @@
1
- "use client";import{useEffect as d,useState as l}from"react";import{EMPTY_PLP_FILTERS as E,plpFiltersFromParams as L,plpFiltersToParams as i}from"../../lib/wheels/plp-filters.js";import{appendVehicleParams as P}from"../../lib/wheels/plp-vehicle-params.js";const w="plp:locationchange";let m=!1;function S(t){if(typeof window>"u")return()=>{};if(!m){m=!0;for(const e of["pushState","replaceState"]){const n=window.history[e];window.history[e]=function(...a){n.apply(this,a),window.dispatchEvent(new Event(w))}}}return window.addEventListener("popstate",t),window.addEventListener(w,t),()=>{window.removeEventListener("popstate",t),window.removeEventListener(w,t)}}function y(t,e){const n=L(new URLSearchParams(t));return i(n).toString()===""?{...E,sort:e}:n}function I({editing:t,openingSort:e,appliedVehicle:n,vehicleRestored:s,requestQuery:a}){const[c,p]=l(()=>y(t?"":a??"",e)),[f,h]=l(!1);return d(()=>{if(t||typeof window>"u")return;const r=()=>{const o=y(window.location.search,e);p(u=>i(u).toString()===i(o).toString()?u:o)};return r(),h(!0),S(r)},[t,e]),d(()=>{if(t||!f||!s||typeof window>"u")return;const r=i(c);P(r,n);const o=r.toString();window.history.replaceState(null,"",`${window.location.pathname}${o?`?${o}`:""}`)},[t,f,s,c,n]),[c,p]}export{I as usePlpFiltersInUrl};
1
+ "use client";import{useEffect as d,useState as l}from"react";import{EMPTY_PLP_FILTERS as E,plpFiltersFromParams as L,plpFiltersToParams as i}from"../../lib/wheels/plp-filters.js";import{appendVehicleParams as P}from"../../lib/wheels/plp-vehicle-params.js";const p="plp:locationchange";let m=!1;function S(t){if(typeof window>"u")return()=>{};if(!m){m=!0;for(const e of["pushState","replaceState"]){const n=window.history[e];window.history[e]=function(...a){n.apply(this,a),window.dispatchEvent(new Event(p))}}}return window.addEventListener("popstate",t),window.addEventListener(p,t),()=>{window.removeEventListener("popstate",t),window.removeEventListener(p,t)}}function y(t,e){const n=L(new URLSearchParams(t));return i(n).toString()===""?{...E,sort:e}:n}function T({editing:t,openingSort:e,appliedVehicle:n,vehicleRestored:s,requestQuery:a}){const[c,w]=l(()=>y(t?"":a??"",e)),[f,h]=l(!1);return d(()=>{if(t||typeof window>"u")return;const r=()=>{const o=y(window.location.search,e);w(u=>i(u).toString()===i(o).toString()?u:o)};return r(),h(!0),S(r)},[t,e]),d(()=>{if(t||!f||!s||typeof window>"u")return;const r=i(c);P(r,n);const o=r.toString();window.history.replaceState(null,"",`${window.location.pathname}${o?`?${o}`:""}`)},[t,f,s,c,n]),[c,w]}export{y as filtersFromQuery,T as usePlpFiltersInUrl,S as watchLocation};
@@ -2,6 +2,7 @@ import type { AdminFieldUsageRow } from "../links/link-rules.js";
2
2
  import type { TyreFitVehicleQuery } from "../tyres/tyre-vehicle-fitment.js";
3
3
  import type { SocialPlatform } from "efficient-web-builder/format/lib/content/social-links";
4
4
  import type { SiteThemeRow, SiteThemeRowPatch } from "efficient-web-builder/format/lib/site-theme-row";
5
+ import type { VideoFrames } from "efficient-web-builder/format/lib/web-backend";
5
6
  export declare const API_URL: string;
6
7
  export declare class ApiError extends Error {
7
8
  status: number;
@@ -430,6 +431,7 @@ export interface AdminStorefrontPage {
430
431
  group?: string | null;
431
432
  kind?: "normal" | "dynamic" | "lightbox" | "footer";
432
433
  live_state?: "live" | "changed" | "never";
434
+ video_frames?: VideoFrames;
433
435
  }
434
436
  export interface AdminGeocodeAnswer {
435
437
  status: "found" | "not_found" | "try_again";
@@ -741,6 +743,8 @@ export declare function createStorefrontAdmin(client?: AdminClient): {
741
743
  getSiteLiveState: (siteId: string, token: string) => Promise<AdminSiteLiveState>;
742
744
  getThemeSettings: (token: string, siteId?: string) => Promise<AdminThemeSettings>;
743
745
  updateThemeSettings: (patch: AdminThemeSettingsPatch, token: string, siteId?: string) => Promise<AdminThemeSettings>;
746
+ getMyPreferences: (token: string) => Promise<Record<string, unknown>>;
747
+ updateMyPreferences: (patch: Record<string, unknown>, token: string) => Promise<unknown>;
744
748
  getChatSettings: (token: string, siteId?: string) => Promise<AdminChatSettings>;
745
749
  updateChatSettings: (patch: AdminChatSettingsPatch, token: string, siteId?: string) => Promise<AdminChatSettings>;
746
750
  getSocialSettings: (token: string, siteId: string) => Promise<AdminSocialSettings>;
@@ -819,6 +823,8 @@ export declare const storefrontAdmin: {
819
823
  getSiteLiveState: (siteId: string, token: string) => Promise<AdminSiteLiveState>;
820
824
  getThemeSettings: (token: string, siteId?: string) => Promise<AdminThemeSettings>;
821
825
  updateThemeSettings: (patch: AdminThemeSettingsPatch, token: string, siteId?: string) => Promise<AdminThemeSettings>;
826
+ getMyPreferences: (token: string) => Promise<Record<string, unknown>>;
827
+ updateMyPreferences: (patch: Record<string, unknown>, token: string) => Promise<unknown>;
822
828
  getChatSettings: (token: string, siteId?: string) => Promise<AdminChatSettings>;
823
829
  updateChatSettings: (patch: AdminChatSettingsPatch, token: string, siteId?: string) => Promise<AdminChatSettings>;
824
830
  getSocialSettings: (token: string, siteId: string) => Promise<AdminSocialSettings>;
@@ -1 +1 @@
1
- import{PREVIEW_TOKEN_HEADER as at,SITE_HOST_HEADER as st,SITE_SLUG_HEADER as nt}from"../site-headers.js";import{PRODUCT_API_BASE as ot,PRODUCT_BACKEND_URL as D}from"./origins.js";import{backendHopHeaders as it,clientIpFromForwardedFor as ct,FORWARDED_FOR_HEADER as dt,hopCachingOf as ut}from"../forwarded-for.js";import lt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as pt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as U}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as x}from"../wheels/renderable-finishes.js";const yt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const I="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",ht=new Set([502,503,504]),N=0,ft="This editor runs on its host's own backend, which does not serve this request.",gt=5e3,wt=15e3,mt=()=>typeof window>"u"?gt:wt;function H(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(mt())}const F=t=>t instanceof Error&&t.name==="TimeoutError",M=(t,e)=>ht.has(t)?I:e,St=["admin","venue"];let B="admin";function ie(t){B=St.includes(t)?t:"admin"}function Pt(){return B}const Ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let q=null;function ce(t){q=t&&Ot.test(t)?t:null}function bt(){return q}function At(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=K();return!e||/[?&]site=/.test(t)?t:E(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...w}=e;if(typeof window<"u"&&!pt())throw new m(N,ft,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const r=typeof FormData<"u"&&w.body instanceof FormData;let a;try{a=await fetch(`${o??yt}${At(t)}`,{...w,headers:{...r?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:w.signal??H({...w,audience:p})})}catch(y){throw y instanceof TypeError||F(y)?new m(N,I,null):y}let n;try{n=await a.text()}catch(y){throw F(y)?new m(N,I,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(a.status,a.ok?"Expected JSON but received a non-JSON response":M(a.status,a.statusText),n)}if(!a.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??M(a.status,a.statusText);throw new m(a.status,y,c)}return c}let b=null;async function G(){return b||(b=Tt().finally(()=>{b=null}),b)}async function Tt(){const t=P.takeLegacyRefresh(),e=await Rt.refresh(t??void 0);return P.setTokens(e.access),e.access}async function W(){return P.getAccess()??G()}async function h(t,e={}){let s;try{s=await W()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await G();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function j(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function z(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const Rt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await W();return await z(),t},me:z,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as Et,absolutizeApiUrl as v}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Ct,isSvgUrl as $t}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as _t}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Ut,webRuntimeSiteSlug as K}from"efficient-web-builder/format/lib/web-runtime";function g(t){if(typeof t=="string")return t.startsWith("/media/")?Et(t):t;if(Array.isArray(t))return t.map(g);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[g(l),p])):g(o);return e}return t}import{PRODUCT_API_BASE as Pe}from"./origins.js";const V=typeof window>"u"&&D!=="",It=V?D:ot,Nt=Ut,O=()=>({baseUrl:Nt(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const X=100,Z=50;function k(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(X)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function vt(t,e){return k("/wheels",{process:t},e)}const Y=X;function kt(t,e){return k("/wheels",{slug:t.join(",")},e)}function Lt(t,e,s){return k("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function Jt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function L(t,e,s=()=>!1){const o=[];let l=null;try{for(let p=0;p<Z;p++){const w=await i(await e(l),await u());if(o.push(...w.results),l=Jt(w.next),!l)break}l&&console.warn(`[${t}] stopped at ${Z} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(s(p))throw p;console.warn(`[${t}] product API unavailable, returning []`,p)}return o}const Q=t=>t instanceof m&&t.status===400;function Dt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?U([e]):[e])}async function tt(){return(await xt()).host}async function xt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(st)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Ht(){try{const{headers:t}=await import("next/headers");return ct((await t()).get(dt))}catch{return null}}async function Ft(){try{const{headers:t}=await import("next/headers");return(await t()).get(nt)||null}catch{return null}}async function Mt(){const t=await Ft();if(t)return`site=${encodeURIComponent(t)}`;const e=await tt();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=K();return e?E(t,`site=${encodeURIComponent(e)}`):t}return E(t,await Mt())}function E(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Bt="preview";async function qt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(at)}catch{return null}}async function Gt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function J(t,e){const s=await qt();if(s===null)return[await f(t),await u(e)];const o=E(await f(t),`${Bt}=${encodeURIComponent(s)}`),{next:l,cache:p,...w}=e??{},r=await u({...w,cache:"no-store"}),a=await Gt();return a&&(r.headers={...r.headers,"user-agent":a}),[o,r]}async function Wt(t){if(!V)return;const[e,s]=await Promise.all([tt(),Ht()]),o=it(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await Wt(ut(t)),s={baseUrl:It,...t};return e&&(s.headers={...e,...t?.headers}),s}const A=typeof window>"u";function T(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const ye={listMakes:async t=>{if(A){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(T("/makes",{region:t}),O())).results},listModels:async(t,e)=>{if(A){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(T("/models",{make:t,region:e}),O())).results},listYears:async(t,e,s)=>{if(A){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(T("/years",{make:t,model:e,region:s}),O())).results},listModifications:async(t,e,s,o)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(T("/modifications",{make:t,model:e,year:s,region:o}),O())).results},getStockFitment:async(t,e,s,o,l)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(T("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),O())}},he={listWheels:async(t,e={})=>{const s=await L("products.listWheels",async o=>await f(vt(t,o)),e.throwOnFailure?()=>!0:void 0);return U(g(s))},listWheelsBySlug:async(t,e={})=>{const s=[...new Set(t.map(r=>r.trim()).filter(Boolean))];if(s.length===0)return[];const o=[];for(let r=0;r<s.length;r+=Y)o.push(s.slice(r,r+Y));const l=await Promise.all(o.map(r=>L("products.listWheelsBySlug",async a=>await f(kt(r,a)),e.throwOnFailure?()=>!0:Q))),p=new Set(s),w=l.flat().filter(r=>p.has(r.slug));return U(g(w))},listCatalog:async(t,e)=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await L("products.listCatalog",async o=>await f(Lt(t,e,o)),Q);return Dt(g(s))},getWheel:async t=>x(g(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>g(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async(t={})=>{try{return await i(await f(d("/bundles")),await u())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return g(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,O());return g(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>g(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await J(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return g(await i(o,l))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const s=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+s,await u())).map(l=>({...l,coverImage:v(l.coverImage)??""}))}catch(o){if(e)throw o;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",o),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:v(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(d("/checkouts/release"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await j(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await j(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=H({method:"GET"}),e=await i(...await J(d("/header-settings"),{signal:t})),s=v(e.logoUrl);let o=null,l=null;if(s&&$t(s)){const p=await Ct(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await J(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},fe={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class jt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const C=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},$=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,zt=t=>`${$(t)}currencies/`,Kt="/api/storefront/media/ingest/";class Vt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function Xt(){const t=_t();if(!t)throw new Vt;return`${Kt}?${new URLSearchParams({site:t})}`}const Zt="X-Puck-Media-Manifest",et=lt.contentHash,_={"X-Media-Manifest":et,[Zt]:et},ge=rt({});function rt(t){return(e,s={})=>{const o=bt(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??Pt()})}}function Yt(t={}){const e=rt(t),s=t.siteDrafts===!0,o=r=>C("header-settings",r,s),l=r=>C("theme-settings",r,s),p=r=>C("chat-settings",r,s),w=r=>C("social-settings",r,s);return{findPageBySlug:async(r,a,n)=>{const c=new URLSearchParams({slug:r});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:a}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new jt(r,S.length);return S[0]??null},getPageById:(r,a)=>e(`/api/storefront/pages/${r}/`,{token:a}),saveLayout:(r,a,n,c,y)=>e(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(r,a,n)=>e(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:a.title,slug:a.slug}),token:n}),geocode:(r,a,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:r,country:n}:{q:r})}`,{token:a}),listBlockSources:r=>e("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>e("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,a)=>e(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:a}),claimPageEditLock:(r,a,n,c=!1)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:a}),releasePageEditLock:(r,a)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:a}),createTemplate:(r,a,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:a}),headers:_,token:n}),getTemplate:(r,a)=>e(`/api/storefront/page-templates/${r}/`,{token:a}),saveTemplateLayout:(r,a,n)=>e(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:_,token:n}),listTemplatePages:async(r,a)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(r,a,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(a)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(r,a,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...a}),headers:_,token:n}),saveTemplatePageLayout:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:_,token:n}),deleteTemplatePage:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:a,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},createPage:(r,a,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:a,layout:n}),token:c}),deletePage:(r,a)=>e(`/api/storefront/pages/${r}/`,{method:"DELETE",token:a}),getHeaderSettings:(r,a)=>e(o(a),{token:r}),listMenus:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/menus/?${n}`,{token:r});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(r,a)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.sort_order-R.sort_order||S.name.localeCompare(R.name))},listForms:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.title.localeCompare(R.title))},listWheelSummaries:async(r,a={})=>{const n=new URLSearchParams;a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:r});return g(y)},listProducts:async(r,a={})=>{const n=new URLSearchParams;a.kinds?.length&&n.set("kind",a.kinds.join(",")),a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:r});return g(y)},getWheelDetail:async(r,a,n={})=>{const c=new URLSearchParams({slug:a});return n.siteId&&c.set("site",n.siteId),x(g(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:r})))},updateHeaderSettings:(r,a,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getSite:(r,a)=>e($(r),{token:a}),listSites:async r=>{const a=await e("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(a)?a:a.results??[]},listSiteCurrencies:async(r,a)=>{const n=await e(zt(r),{token:a});return Array.isArray(n)?n:[]},publishSite:(r,a)=>e(`${$(r)}publish/`,{method:"POST",token:a}),getSiteLiveState:(r,a)=>e(`${$(r)}live-state/`,{token:a}),getThemeSettings:(r,a)=>e(l(a),{token:r}),updateThemeSettings:(r,a,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getChatSettings:(r,a)=>e(p(a),{token:r}),updateChatSettings:(r,a,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getSocialSettings:(r,a)=>e(w(a),{token:r}),updateSocialSettings:(r,a,n)=>e(w(n),{method:"PATCH",body:JSON.stringify(r),token:a}),uploadHeaderLogo:(r,a,n)=>{const c=new FormData;return c.append("logo",r),e(o(n),{method:"PATCH",body:c,token:a})},clearHeaderLogo:(r,a)=>e(o(a),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,a,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:a}),uploadMedia:async(r,a)=>{const n=new FormData;return n.append("file",r),e(Xt(),{method:"POST",body:n,token:a})},listMedia:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("kind",a);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]}}}const we=Yt({siteDrafts:!0});export{yt as API_URL,jt as AmbiguousPageSlugError,m as ApiError,wt as BROWSER_READ_TIMEOUT_MS,ft as EFFICIENT_CLIENT_CLOSED_MESSAGE,Vt as MediaUploadDestinationError,Bt as PREVIEW_PARAM,Pe as PRODUCT_API_BASE,gt as SERVER_READ_TIMEOUT_MS,I as SERVER_UNREACHABLE_MESSAGE,N as STATUS_NETWORK_ERROR,ge as adminFetch,Rt as api,i as apiFetch,E as appendSiteQuery,fe as bookings,Yt as createStorefrontAdmin,H as defaultRequestDeadline,Xt as editorMediaUploadPath,Pt as editorPortalAudience,bt as editorRequestLanguage,ye as fitment,he as products,mt as readDeadlineMs,Ht as resolveClientIp,g as resolveMediaUrls,qt as resolvePreviewToken,tt as resolveSiteHost,xt as resolveSiteHostSource,Ft as resolveSiteSlug,ce as setEditorLanguage,ie as setEditorPortalAudience,we as storefrontAdmin};
1
+ import{PREVIEW_TOKEN_HEADER as at,SITE_HOST_HEADER as st,SITE_SLUG_HEADER as nt}from"../site-headers.js";import{PRODUCT_API_BASE as ot,PRODUCT_BACKEND_URL as D}from"./origins.js";import{backendHopHeaders as it,clientIpFromForwardedFor as ct,FORWARDED_FOR_HEADER as dt,hopCachingOf as ut}from"../forwarded-for.js";import lt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as pt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as U}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as x}from"../wheels/renderable-finishes.js";const yt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const N="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",ht=new Set([502,503,504]),I=0,ft="This editor runs on its host's own backend, which does not serve this request.",gt=5e3,wt=15e3,mt=()=>typeof window>"u"?gt:wt;function H(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(mt())}const F=t=>t instanceof Error&&t.name==="TimeoutError",M=(t,e)=>ht.has(t)?N:e,St=["admin","venue"];let B="admin";function ie(t){B=St.includes(t)?t:"admin"}function Pt(){return B}const Ot=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let q=null;function ce(t){q=t&&Ot.test(t)?t:null}function bt(){return q}function At(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=K();return!e||/[?&]site=/.test(t)?t:E(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...w}=e;if(typeof window<"u"&&!pt())throw new m(I,ft,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const r=typeof FormData<"u"&&w.body instanceof FormData;let a;try{a=await fetch(`${o??yt}${At(t)}`,{...w,headers:{...r?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:w.signal??H({...w,audience:p})})}catch(y){throw y instanceof TypeError||F(y)?new m(I,N,null):y}let n;try{n=await a.text()}catch(y){throw F(y)?new m(I,N,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(a.status,a.ok?"Expected JSON but received a non-JSON response":M(a.status,a.statusText),n)}if(!a.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??M(a.status,a.statusText);throw new m(a.status,y,c)}return c}let b=null;async function G(){return b||(b=Tt().finally(()=>{b=null}),b)}async function Tt(){const t=P.takeLegacyRefresh(),e=await Rt.refresh(t??void 0);return P.setTokens(e.access),e.access}async function W(){return P.getAccess()??G()}async function h(t,e={}){let s;try{s=await W()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await G();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function j(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function z(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const Rt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await W();return await z(),t},me:z,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as Et,absolutizeApiUrl as v}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Ct,isSvgUrl as $t}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as _t}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Ut,webRuntimeSiteSlug as K}from"efficient-web-builder/format/lib/web-runtime";function g(t){if(typeof t=="string")return t.startsWith("/media/")?Et(t):t;if(Array.isArray(t))return t.map(g);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[g(l),p])):g(o);return e}return t}import{PRODUCT_API_BASE as Pe}from"./origins.js";const V=typeof window>"u"&&D!=="",Nt=V?D:ot,It=Ut,O=()=>({baseUrl:It(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const X=100,Z=50;function k(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(X)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function vt(t,e){return k("/wheels",{process:t},e)}const Y=X;function kt(t,e){return k("/wheels",{slug:t.join(",")},e)}function Jt(t,e,s){return k("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function Lt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function J(t,e,s=()=>!1){const o=[];let l=null;try{for(let p=0;p<Z;p++){const w=await i(await e(l),await u());if(o.push(...w.results),l=Lt(w.next),!l)break}l&&console.warn(`[${t}] stopped at ${Z} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(s(p))throw p;console.warn(`[${t}] product API unavailable, returning []`,p)}return o}const Q=t=>t instanceof m&&t.status===400;function Dt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?U([e]):[e])}async function tt(){return(await xt()).host}async function xt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(st)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Ht(){try{const{headers:t}=await import("next/headers");return ct((await t()).get(dt))}catch{return null}}async function Ft(){try{const{headers:t}=await import("next/headers");return(await t()).get(nt)||null}catch{return null}}async function Mt(){const t=await Ft();if(t)return`site=${encodeURIComponent(t)}`;const e=await tt();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=K();return e?E(t,`site=${encodeURIComponent(e)}`):t}return E(t,await Mt())}function E(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Bt="preview";async function qt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(at)}catch{return null}}async function Gt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function L(t,e){const s=await qt();if(s===null)return[await f(t),await u(e)];const o=E(await f(t),`${Bt}=${encodeURIComponent(s)}`),{next:l,cache:p,...w}=e??{},r=await u({...w,cache:"no-store"}),a=await Gt();return a&&(r.headers={...r.headers,"user-agent":a}),[o,r]}async function Wt(t){if(!V)return;const[e,s]=await Promise.all([tt(),Ht()]),o=it(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await Wt(ut(t)),s={baseUrl:Nt,...t};return e&&(s.headers={...e,...t?.headers}),s}const A=typeof window>"u";function T(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const ye={listMakes:async t=>{if(A){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(T("/makes",{region:t}),O())).results},listModels:async(t,e)=>{if(A){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(T("/models",{make:t,region:e}),O())).results},listYears:async(t,e,s)=>{if(A){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(T("/years",{make:t,model:e,region:s}),O())).results},listModifications:async(t,e,s,o)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(T("/modifications",{make:t,model:e,year:s,region:o}),O())).results},getStockFitment:async(t,e,s,o,l)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(T("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),O())}},he={listWheels:async(t,e={})=>{const s=await J("products.listWheels",async o=>await f(vt(t,o)),e.throwOnFailure?()=>!0:void 0);return U(g(s))},listWheelsBySlug:async(t,e={})=>{const s=[...new Set(t.map(r=>r.trim()).filter(Boolean))];if(s.length===0)return[];const o=[];for(let r=0;r<s.length;r+=Y)o.push(s.slice(r,r+Y));const l=await Promise.all(o.map(r=>J("products.listWheelsBySlug",async a=>await f(kt(r,a)),e.throwOnFailure?()=>!0:Q))),p=new Set(s),w=l.flat().filter(r=>p.has(r.slug));return U(g(w))},listCatalog:async(t,e)=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await J("products.listCatalog",async o=>await f(Jt(t,e,o)),Q);return Dt(g(s))},getWheel:async t=>x(g(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>g(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async(t={})=>{try{return await i(await f(d("/bundles")),await u())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return g(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,O());return g(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>g(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await L(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return g(await i(o,l))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const s=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+s,await u())).map(l=>({...l,coverImage:v(l.coverImage)??""}))}catch(o){if(e)throw o;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",o),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:v(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(d("/checkouts/release"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await j(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await j(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=H({method:"GET"}),e=await i(...await L(d("/header-settings"),{signal:t})),s=v(e.logoUrl);let o=null,l=null;if(s&&$t(s)){const p=await Ct(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await L(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},fe={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class jt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const C=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},$=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,zt=t=>`${$(t)}currencies/`,Kt="/api/storefront/media/ingest/";class Vt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function Xt(){const t=_t();if(!t)throw new Vt;return`${Kt}?${new URLSearchParams({site:t})}`}const Zt="X-Puck-Media-Manifest",et=lt.contentHash,_={"X-Media-Manifest":et,[Zt]:et},ge=rt({});function rt(t){return(e,s={})=>{const o=bt(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??Pt()})}}function Yt(t={}){const e=rt(t),s=t.siteDrafts===!0,o=r=>C("header-settings",r,s),l=r=>C("theme-settings",r,s),p=r=>C("chat-settings",r,s),w=r=>C("social-settings",r,s);return{findPageBySlug:async(r,a,n)=>{const c=new URLSearchParams({slug:r});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:a}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new jt(r,S.length);return S[0]??null},getPageById:(r,a)=>e(`/api/storefront/pages/${r}/`,{token:a}),saveLayout:(r,a,n,c,y)=>e(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(r,a,n)=>e(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:a.title,slug:a.slug}),token:n}),geocode:(r,a,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:r,country:n}:{q:r})}`,{token:a}),listBlockSources:r=>e("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>e("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,a)=>e(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:a}),claimPageEditLock:(r,a,n,c=!1)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:a}),releasePageEditLock:(r,a)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:a}),createTemplate:(r,a,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:a}),headers:_,token:n}),getTemplate:(r,a)=>e(`/api/storefront/page-templates/${r}/`,{token:a}),saveTemplateLayout:(r,a,n)=>e(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:_,token:n}),listTemplatePages:async(r,a)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(r,a,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(a)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(r,a,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...a}),headers:_,token:n}),saveTemplatePageLayout:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:_,token:n}),deleteTemplatePage:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:a,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},createPage:(r,a,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:a,layout:n}),token:c}),deletePage:(r,a)=>e(`/api/storefront/pages/${r}/`,{method:"DELETE",token:a}),getHeaderSettings:(r,a)=>e(o(a),{token:r}),listMenus:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/menus/?${n}`,{token:r});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(r,a)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.sort_order-R.sort_order||S.name.localeCompare(R.name))},listForms:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.title.localeCompare(R.title))},listWheelSummaries:async(r,a={})=>{const n=new URLSearchParams;a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:r});return g(y)},listProducts:async(r,a={})=>{const n=new URLSearchParams;a.kinds?.length&&n.set("kind",a.kinds.join(",")),a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:r});return g(y)},getWheelDetail:async(r,a,n={})=>{const c=new URLSearchParams({slug:a});return n.siteId&&c.set("site",n.siteId),x(g(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:r})))},updateHeaderSettings:(r,a,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getSite:(r,a)=>e($(r),{token:a}),listSites:async r=>{const a=await e("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(a)?a:a.results??[]},listSiteCurrencies:async(r,a)=>{const n=await e(zt(r),{token:a});return Array.isArray(n)?n:[]},publishSite:(r,a)=>e(`${$(r)}publish/`,{method:"POST",token:a}),getSiteLiveState:(r,a)=>e(`${$(r)}live-state/`,{token:a}),getThemeSettings:(r,a)=>e(l(a),{token:r}),updateThemeSettings:(r,a,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getMyPreferences:async r=>(await e("/api/auth/me/",{token:r})).preferences??{},updateMyPreferences:(r,a)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:r}),token:a}),getChatSettings:(r,a)=>e(p(a),{token:r}),updateChatSettings:(r,a,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getSocialSettings:(r,a)=>e(w(a),{token:r}),updateSocialSettings:(r,a,n)=>e(w(n),{method:"PATCH",body:JSON.stringify(r),token:a}),uploadHeaderLogo:(r,a,n)=>{const c=new FormData;return c.append("logo",r),e(o(n),{method:"PATCH",body:c,token:a})},clearHeaderLogo:(r,a)=>e(o(a),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,a,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:a}),uploadMedia:async(r,a)=>{const n=new FormData;return n.append("file",r),e(Xt(),{method:"POST",body:n,token:a})},listMedia:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("kind",a);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]}}}const we=Yt({siteDrafts:!0});export{yt as API_URL,jt as AmbiguousPageSlugError,m as ApiError,wt as BROWSER_READ_TIMEOUT_MS,ft as EFFICIENT_CLIENT_CLOSED_MESSAGE,Vt as MediaUploadDestinationError,Bt as PREVIEW_PARAM,Pe as PRODUCT_API_BASE,gt as SERVER_READ_TIMEOUT_MS,N as SERVER_UNREACHABLE_MESSAGE,I as STATUS_NETWORK_ERROR,ge as adminFetch,Rt as api,i as apiFetch,E as appendSiteQuery,fe as bookings,Yt as createStorefrontAdmin,H as defaultRequestDeadline,Xt as editorMediaUploadPath,Pt as editorPortalAudience,bt as editorRequestLanguage,ye as fitment,he as products,mt as readDeadlineMs,Ht as resolveClientIp,g as resolveMediaUrls,qt as resolvePreviewToken,tt as resolveSiteHost,xt as resolveSiteHostSource,Ft as resolveSiteSlug,ce as setEditorLanguage,ie as setEditorPortalAudience,we as storefrontAdmin};
@@ -1,5 +1,6 @@
1
1
  import { type SiteMenuLink } from "./listing-links.js";
2
2
  import type { Relationship } from "./relationships.js";
3
+ import type { ProductKind } from "../api/index.js";
3
4
  export declare const RELATED_CARDS_MIN = 2;
4
5
  export declare const RELATED_CARDS_DEFAULT = 6;
5
6
  export declare const RELATED_CARDS_MAX = 12;
@@ -9,4 +10,6 @@ export interface RelatedViewMore {
9
10
  href: string;
10
11
  label: string;
11
12
  }
12
- export declare function relatedViewMore(relationship: Relationship, menuLinks?: readonly SiteMenuLink[]): RelatedViewMore;
13
+ export declare function relatedViewMore(relationship: Relationship & {
14
+ to: ProductKind;
15
+ }, menuLinks?: readonly SiteMenuLink[]): RelatedViewMore;