efficient-storefront-blocks 0.99.1 → 0.101.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 (151) hide show
  1. package/CHANGELOG.md +55 -1
  2. package/dist/chunks/{EditorPreviewCheckout-EBG3NMJI.js → EditorPreviewCheckout-JMBBJSI7.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-YAIB64UV.js → SiteEditorProvider-BKZW7KVN.js} +1 -1
  4. package/dist/chunks/chunk-AF5TRBQB.js +1 -0
  5. package/dist/chunks/chunk-GJZGQCDM.js +1 -0
  6. package/dist/chunks/chunk-KV3EHFHB.js +339 -0
  7. package/dist/chunks/chunk-XNUK2QNK.js +1 -0
  8. package/dist/chunks/chunk-YSKMBJ7V.js +74 -0
  9. package/dist/chunks/{fitment-data-PXY35OVC.js → fitment-data-HMD5DDDB.js} +1 -1
  10. package/dist/consent.js +1 -1
  11. package/dist/contract.js +1 -1
  12. package/dist/editor/lib/api/section-templates.js +1 -1
  13. package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
  14. package/dist/editor/lib/document/blocks/commerce/DetailRows/fields.js +1 -1
  15. package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
  16. package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
  17. package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
  18. package/dist/editor/lib/document/blocks/service/FooterLogo/fields.js +1 -1
  19. package/dist/editor/lib/document/blocks/service/Subscribe/fields.js +1 -1
  20. package/dist/editor/lib/document/box-header.js +1 -1
  21. package/dist/editor/lib/document/config.js +1 -1
  22. package/dist/editor/lib/efficient-block-sources.js +1 -1
  23. package/dist/editor/lib/storefront-editor-words.d.ts +4 -0
  24. package/dist/editor/lib/storefront-editor-words.js +1 -1
  25. package/dist/editor.css +1 -1
  26. package/dist/index.js +39 -32
  27. package/dist/links.js +1 -1
  28. package/dist/render/app/globals.css +122 -16
  29. package/dist/render/built-with.json +1 -1
  30. package/dist/render/components/ChatWidget.js +1 -1
  31. package/dist/render/components/Collections.js +1 -1
  32. package/dist/render/components/ConsentContext.d.ts +6 -0
  33. package/dist/render/components/ConsentContext.js +1 -1
  34. package/dist/render/components/ConsentPanel.d.ts +6 -0
  35. package/dist/render/components/ConsentPanel.js +1 -1
  36. package/dist/render/components/ConsentProvider.js +1 -1
  37. package/dist/render/components/CouponField.js +1 -1
  38. package/dist/render/components/DealerFinderSection.js +1 -1
  39. package/dist/render/components/DetailRows.d.ts +2 -3
  40. package/dist/render/components/DetailRows.js +1 -1
  41. package/dist/render/components/EmailCaptureForm.js +1 -1
  42. package/dist/render/components/Events.d.ts +2 -3
  43. package/dist/render/components/Events.js +1 -1
  44. package/dist/render/components/FooterEmailSignup.js +1 -1
  45. package/dist/render/components/FooterLogo.d.ts +1 -1
  46. package/dist/render/components/FooterLogo.js +1 -1
  47. package/dist/render/components/FooterMenu.d.ts +2 -1
  48. package/dist/render/components/FooterMenu.js +1 -1
  49. package/dist/render/components/GalleryGrid.d.ts +3 -3
  50. package/dist/render/components/GalleryGrid.js +3 -3
  51. package/dist/render/components/GridCardTemplate.js +1 -1
  52. package/dist/render/components/LegalLine.d.ts +10 -0
  53. package/dist/render/components/LegalLine.js +1 -1
  54. package/dist/render/components/ProductGridSection.d.ts +3 -2
  55. package/dist/render/components/ProductGridSection.js +1 -1
  56. package/dist/render/components/ProductHeroPanel.js +1 -1
  57. package/dist/render/components/SiteLegalContext.d.ts +19 -0
  58. package/dist/render/components/SiteLegalContext.js +1 -0
  59. package/dist/render/components/Subscribe.d.ts +9 -1
  60. package/dist/render/components/Subscribe.js +1 -1
  61. package/dist/render/components/booking/BookingFormState.js +1 -1
  62. package/dist/render/components/catalog/ShopperFilters.d.ts +3 -1
  63. package/dist/render/components/catalog/ShopperFilters.js +1 -1
  64. package/dist/render/components/fitment/FitmentFinder.js +1 -1
  65. package/dist/render/components/pdp-dynamic/DynamicDetailRows.d.ts +1 -2
  66. package/dist/render/components/pdp-dynamic/DynamicDetailRows.js +1 -1
  67. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +1 -2
  68. package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
  69. package/dist/render/components/useProductSelection.d.ts +2 -1
  70. package/dist/render/components/useProductSelection.js +1 -1
  71. package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +5 -3
  72. package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
  73. package/dist/render/components/wheels-plp/PlpFacetRows.d.ts +5 -2
  74. package/dist/render/components/wheels-plp/PlpFacetRows.js +1 -1
  75. package/dist/render/components/wheels-plp/PlpSidebar.d.ts +17 -6
  76. package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
  77. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.d.ts +3 -2
  78. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.js +1 -1
  79. package/dist/render/lib/api/index.js +1 -1
  80. package/dist/render/lib/api/list-rows.d.ts +3 -0
  81. package/dist/render/lib/api/list-rows.js +1 -0
  82. package/dist/render/lib/api/types.d.ts +6 -0
  83. package/dist/render/lib/cache-evict.d.ts +1 -0
  84. package/dist/render/lib/cache-evict.js +1 -1
  85. package/dist/render/lib/catalog/default-variant.d.ts +2 -0
  86. package/dist/render/lib/catalog/default-variant.js +1 -0
  87. package/dist/render/lib/chrome-cache.js +1 -1
  88. package/dist/render/lib/consent/rules.d.ts +7 -0
  89. package/dist/render/lib/consent/rules.js +1 -1
  90. package/dist/render/lib/content/collection-card-look.d.ts +0 -4
  91. package/dist/render/lib/content/collection-card-look.js +1 -1
  92. package/dist/render/lib/content/facet-row-seed.d.ts +1 -0
  93. package/dist/render/lib/content/facet-row-seed.js +1 -1
  94. package/dist/render/lib/content/product-card-seed.js +1 -1
  95. package/dist/render/lib/content/rail-row-seed.d.ts +16 -0
  96. package/dist/render/lib/content/rail-row-seed.js +1 -0
  97. package/dist/render/lib/content/site.d.ts +4 -0
  98. package/dist/render/lib/content/site.js +1 -1
  99. package/dist/render/lib/content/tab-strip.d.ts +3 -1
  100. package/dist/render/lib/content/tab-strip.js +1 -1
  101. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.d.ts +8 -0
  102. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.js +1 -1
  103. package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
  104. package/dist/render/lib/document/blocks/commerce/DetailRows/meta.js +1 -1
  105. package/dist/render/lib/document/blocks/commerce/DetailRows/render.js +1 -1
  106. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +8 -0
  107. package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -1
  108. package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -1
  109. package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
  110. package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
  111. package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
  112. package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
  113. package/dist/render/lib/document/blocks/service/DealerFinder/meta.js +1 -1
  114. package/dist/render/lib/document/blocks/service/Events/meta.js +1 -1
  115. package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
  116. package/dist/render/lib/document/blocks/service/Subscribe/render.js +1 -1
  117. package/dist/render/lib/document/card-templates.js +1 -1
  118. package/dist/render/lib/document/current-product.d.ts +2 -1
  119. package/dist/render/lib/document/current-product.js +1 -1
  120. package/dist/render/lib/document/document-nodes.d.ts +2 -0
  121. package/dist/render/lib/document/document-nodes.js +1 -1
  122. package/dist/render/lib/document/footer-page-blocks.js +1 -1
  123. package/dist/render/lib/document/lazy-draws.js +1 -1
  124. package/dist/render/lib/document/section-to-box-rows-listing.js +1 -1
  125. package/dist/render/lib/field-input.d.ts +2 -0
  126. package/dist/render/lib/field-input.js +1 -1
  127. package/dist/render/lib/links/link-rules.d.ts +5 -0
  128. package/dist/render/lib/links/link-rules.js +1 -1
  129. package/dist/render/lib/sections/band-padding.d.ts +39 -0
  130. package/dist/render/lib/sections/band-padding.js +1 -0
  131. package/dist/render/lib/sections/gallery-toolbar.d.ts +2 -2
  132. package/dist/render/lib/sections/gallery-toolbar.js +1 -1
  133. package/dist/render/lib/sections/product-pictures.js +1 -1
  134. package/dist/render/lib/wheels/catalog-filters-to-listing.js +1 -1
  135. package/dist/render/lib/wheels/plp-filters.d.ts +2 -1
  136. package/dist/render/lib/wheels/plp-filters.js +1 -1
  137. package/dist/render/lib/wheels/plp-hydrate.d.ts +0 -3
  138. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  139. package/dist/render/lib/wheels/selected-ranges.d.ts +1 -0
  140. package/dist/render/lib/wheels/selected-ranges.js +1 -1
  141. package/dist/words.d.ts +13 -0
  142. package/dist/words.js +4 -4
  143. package/package.json +4 -4
  144. package/dist/chunks/chunk-5VSNQZU6.js +0 -1
  145. package/dist/chunks/chunk-B2IYTOE3.js +0 -1
  146. package/dist/chunks/chunk-DOJJTEJV.js +0 -1
  147. package/dist/chunks/chunk-KRMWJLBM.js +0 -412
  148. package/dist/chunks/chunk-QP2F42DV.js +0 -1
  149. package/dist/render/lib/sections/own-padding.d.ts +0 -3
  150. package/dist/render/lib/sections/own-padding.js +0 -1
  151. /package/dist/chunks/{chunk-KRMWJLBM.js.LEGAL.txt → chunk-KV3EHFHB.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- "use client";import{jsx as n,Fragment as Y,jsxs as S}from"react/jsx-runtime";import{useCallback as H,useMemo as F,useState as U}from"react";import{CardTemplateRows as re}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as le}from"efficient-web-builder/format/lib/content/card-template";import{useCurrency as oe}from"../CurrencyContext.js";import{useEnglish as se}from"../EnglishVariant.js";import X from"./PriceRange.js";import ie from"./SortSelect.js";import{DEFAULT_CATALOG_FILTER_LABELS as I}from"../../lib/content/catalog-filter-labels.js";import{itemKind as D,plpKindNoun as ce}from"../../lib/catalog/plp-item.js";import{itemLugs as ae,lugFilterLabel as pe}from"../../lib/wheels/lug-count.js";import{CATALOG_TEXT_SIZE as O}from"../../lib/sections/catalog-text-size.js";import{buildPlpFacets as ue,itemMatchesPlp as me,plpInStockCount as de,plpPriceBounds as fe,plpSortKeysFor as ge,PLP_ONE_VALUE_MAX as he,PLP_SORT_LABELS as Se}from"../../lib/wheels/plp-filters.js";import{FILTER_IN_STOCK_KEY as be,FILTER_PRICE_KEY as A,filterGroupItems as xe}from"../../lib/sections/filter-option-rows.js";import we from"../wheels-plp/PlpSidebar.js";import{FILTER_BLOCK_TYPE as V}from"../../lib/document/document-nodes.js";import{FilterPill as ye,PillButton as Me}from"./FilterPill.js";import{useShopperFilter as ke}from"./ShopperScope.js";import{HideTaker as Te}from"efficient-web-builder/render/components/ViewHideRoot";const Z="lugs";function _e({owner:r,look:e,lookPhone:s,shown:l,showSort:a,openingSort:c,filtersBelow:t,fieldUsage:p,firstRows:L,editing:u}){const{currency:h}=oe(),w=se(),{ref:E,scope:f}=ke({filtersBelow:t,openingSort:c}),{state:m}=f,g=f.live?f.rows:L??f.rows,b=F(()=>[...new Set(g.map(D))],[g]),N=F(()=>{const o=ue(g,m,h,b,p??[],"pass").filter(i=>i.key!=="collections"||l.includes("category"));if(l.includes("lugs")){const i=Le(g,m,h);i&&o.push(i)}return o.map(i=>({...i,label:w(i.label)}))},[g,m,h,b,p,l,w]),y=l.includes("price")?fe(g,h):null,P=l.includes("inStock")&&g.length>0?de(g,m,h):null,J=ge(b.length?b:["alloy-wheel"]),k=f.update,x=H(o=>k({...o,page:1}),[k]),v=H((o,i)=>k(d=>{if(o===Z){const M=Number(i),te=(d.lugs??[]).includes(M);return{...d,page:1,lugs:te?(d.lugs??[]).filter(ne=>ne!==M):[...d.lugs??[],M]}}const C=d[o].map(String),z=C.includes(i)?C.filter(M=>M!==i):[...C,i];return{...d,page:1,[o]:o==="diameters"?z.map(Number):z}}),[k]),B=a&&!f.sortInChips,Q=F(()=>{const o=xe(N,m,P).map(i=>({...i,options:i.options.map(d=>({...d,press:i.key===be?()=>x({inStockOnly:!m.inStockOnly}):()=>v(i.key,d.value)}))}));return y?[...o,{key:A,label:I.price,options:[]}]:o},[N,m,P,y,x,v]),T={owner:r,items:Q,state:m,sorts:J,showSort:B,set:x,bounds:y},W=o=>x({priceMin:o}),ee=o=>x({priceMax:o}),G=n(we,{facets:N,filters:m,noun:ce(b.length?b:["alloy-wheel"]),inStockCount:P,onToggle:v,onInStockOnly:o=>x({inStockOnly:o}),onClearAll:f.clear,price:y?{label:I.price,control:n(X,{bounds:y,min:m.priceMin,max:m.priceMax,onMin:W,onMax:ee})}:void 0,foot:B?n(_,{...T}):void 0,owner:{id:r.id,facetTemplate:r.facetTemplate,type:V},editing:u}),K=e==="rail"?G:n(R,{...T,columns:e==="bar-columns"}),j=(s==="rail"?e==="rail":s==="bar"&&e!=="rail")?null:s==="button"?n(Ee,{...T}):s==="rail"?G:n(R,{...T,columns:!1});return S(Te,{as:"div",ref:E,"data-shopper-filters":"",className:"w-full",children:[j?S(Y,{children:[n("div",{className:"max-view-wide:hidden",children:K}),n("div",{className:"view-wide:hidden",children:j})]}):K,u&&f.grids===0&&n("p",{className:`mt-2 font-mono ${O.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:"Filters a Product Grid in this Box"})]})}function Le(r,e,s){const l=new Map,a=new Set;for(const t of r){const p=D(t)==="alloy-wheel"?ae(t):null;p!==null&&(a.add(p),me(t,e,s,"lugs","pass")&&l.set(p,(l.get(p)??0)+1))}if(a.size<=he)return null;const c=e.lugs??[];return{key:Z,label:I.lugs,options:[...a].sort((t,p)=>t-p).map(t=>({value:String(t),label:pe(t),count:l.get(t)??0,checked:c.includes(t),swatch:null}))}}function _({state:r,sorts:e,set:s}){return n(ie,{value:r.sort,keys:e,labels:Se,onChange:l=>s({sort:l})})}function $(r,e){return r.key===A?(e.priceMin!=null?1:0)+(e.priceMax!=null?1:0):r.options.filter(s=>s.state.selected).length}function q({owner:r,items:e,state:s,set:l,bounds:a,wrap:c}){const t=u=>l({priceMin:u}),p=u=>l({priceMax:u}),L=(u,h)=>{const w=e[h.index],E=w.key===A?S(Y,{children:[u,n(X,{bounds:a,min:s.priceMin,max:s.priceMax,onMin:t,onMax:p})]}):u;return c(E,w)};return n(re,{ownerId:r.id,ownerType:V,Template:r.template,rows:e.map(le),items:e,fallback:null,wrapCopy:L,children:u=>u})}function R({columns:r,...e}){const[s,l]=U(null),a=c=>()=>l(t=>t===c?null:c);return r?S("div",{className:"flex flex-col gap-4",children:[n("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-6 border-y border-line py-4",children:n(q,{...e,wrap:(c,t)=>n("div",{children:c},t.key)})}),e.showSort&&n("div",{className:"flex flex-wrap items-center justify-end gap-4",children:n(_,{...e})})]}):S("div",{className:"relative flex flex-wrap items-center gap-2 @container",children:[n(q,{...e,wrap:(c,t)=>n(ye,{labelSize:O.labelSmall,name:t.key,label:t.label,badge:$(t,e.state),open:s===t.key,onToggle:a(t.key),children:c},t.key)}),e.showSort&&n("div",{className:"ml-auto",children:n(_,{...e})})]})}function Ee(r){const[e,s]=U(!1),l=r.items.reduce((a,c)=>a+$(c,r.state),0);return S("div",{className:"flex flex-col gap-4",children:[S("div",{className:"flex items-center justify-between gap-4",children:[n(Me,{labelSize:O.labelSmall,label:"Filters",badge:l,open:e,onToggle:()=>s(a=>!a)}),r.showSort&&n(_,{...r})]}),e&&n(R,{...r,columns:!0,showSort:!1})]})}export{_e as default};
1
+ "use client";import{jsx as l,Fragment as z,jsxs as S}from"react/jsx-runtime";import{useCallback as Y,useMemo as F,useState as U}from"react";import{CardTemplateRows as ne}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as re}from"efficient-web-builder/format/lib/content/card-template";import{useCurrency as oe}from"../CurrencyContext.js";import{useEnglish as ie}from"../EnglishVariant.js";import X from"./PriceRange.js";import se from"./SortSelect.js";import{DEFAULT_CATALOG_FILTER_LABELS as I}from"../../lib/content/catalog-filter-labels.js";import{itemKind as D,plpKindNoun as ae}from"../../lib/catalog/plp-item.js";import{itemLugs as ce,lugFilterLabel as pe}from"../../lib/wheels/lug-count.js";import{CATALOG_TEXT_SIZE as O}from"../../lib/sections/catalog-text-size.js";import{buildPlpFacets as ue,itemMatchesPlp as me,plpInStockCount as de,plpPriceBounds as fe,plpSortKeysFor as ge,PLP_ONE_VALUE_MAX as he,PLP_SORT_LABELS as Se}from"../../lib/wheels/plp-filters.js";import{FILTER_IN_STOCK_KEY as be,FILTER_PRICE_KEY as A,filterGroupItems as xe}from"../../lib/sections/filter-option-rows.js";import ye from"../wheels-plp/PlpSidebar.js";import{FILTER_BLOCK_TYPE as V}from"../../lib/document/document-nodes.js";import{FilterPill as we,PillButton as Te}from"./FilterPill.js";import{useShopperFilter as Me}from"./ShopperScope.js";import{HideTaker as ke}from"efficient-web-builder/render/components/ViewHideRoot";const Z="lugs";function _e({owner:n,look:e,lookPhone:i,shown:r,showSort:c,openingSort:a,filtersBelow:t,fieldUsage:p,firstRows:L,editing:u}){const{currency:h}=oe(),y=ie(),{ref:E,scope:f}=Me({filtersBelow:t,openingSort:a}),{state:m}=f,g=f.live?f.rows:L??f.rows,b=F(()=>[...new Set(g.map(D))],[g]),N=F(()=>{const o=ue(g,m,h,b,p??[],"pass").filter(s=>s.key!=="collections"||r.includes("category"));if(r.includes("lugs")){const s=Le(g,m,h);s&&o.push(s)}return o.map(s=>({...s,label:y(s.label)}))},[g,m,h,b,p,r,y]),w=r.includes("price")?fe(g,h):null,P=r.includes("inStock")&&g.length>0?de(g,m,h):null,J=ge(b.length?b:["alloy-wheel"]),M=f.update,x=Y(o=>M({...o,page:1}),[M]),v=Y((o,s)=>M(d=>{if(o===Z){const T=Number(s),te=(d.lugs??[]).includes(T);return{...d,page:1,lugs:te?(d.lugs??[]).filter(le=>le!==T):[...d.lugs??[],T]}}const C=d[o].map(String),H=C.includes(s)?C.filter(T=>T!==s):[...C,s];return{...d,page:1,[o]:o==="diameters"?H.map(Number):H}}),[M]),B=c&&!f.sortInChips,Q=F(()=>{const o=xe(N,m,P).map(s=>({...s,options:s.options.map(d=>({...d,press:s.key===be?()=>x({inStockOnly:!m.inStockOnly}):()=>v(s.key,d.value)}))}));return w?[...o,{key:A,label:I.price,options:[]}]:o},[N,m,P,w,x,v]),k={owner:n,items:Q,state:m,sorts:J,showSort:B,set:x,bounds:w},W=o=>x({priceMin:o}),ee=o=>x({priceMax:o}),G=l(ye,{facets:N,filters:m,noun:ae(b.length?b:["alloy-wheel"]),inStockCount:P,onToggle:v,onInStockOnly:o=>x({inStockOnly:o}),onClearAll:f.clear,price:w?{label:I.price,control:l(X,{bounds:w,min:m.priceMin,max:m.priceMax,onMin:W,onMax:ee})}:void 0,foot:B?l(_,{...k}):void 0,owner:{id:n.id,facetTemplate:n.facetTemplate,railTemplate:n.railTemplate,railHeadTemplate:n.railHeadTemplate,type:V},editing:u}),K=e==="rail"?G:l(R,{...k,columns:e==="bar-columns"}),j=(i==="rail"?e==="rail":i==="bar"&&e!=="rail")?null:i==="button"?l(Ee,{...k}):i==="rail"?G:l(R,{...k,columns:!1});return S(ke,{as:"div",ref:E,"data-shopper-filters":"",className:"w-full",children:[j?S(z,{children:[l("div",{className:"max-view-wide:hidden",children:K}),l("div",{className:"view-wide:hidden",children:j})]}):K,u&&f.grids===0&&l("p",{className:`mt-2 font-mono ${O.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:"Filters a Product Grid in this Box"})]})}function Le(n,e,i){const r=new Map,c=new Set;for(const t of n){const p=D(t)==="alloy-wheel"?ce(t):null;p!==null&&(c.add(p),me(t,e,i,"lugs","pass")&&r.set(p,(r.get(p)??0)+1))}if(c.size<=he)return null;const a=e.lugs??[];return{key:Z,label:I.lugs,options:[...c].sort((t,p)=>t-p).map(t=>({value:String(t),label:pe(t),count:r.get(t)??0,checked:a.includes(t),swatch:null}))}}function _({state:n,sorts:e,set:i}){return l(se,{value:n.sort,keys:e,labels:Se,onChange:r=>i({sort:r})})}function $(n,e){return n.key===A?(e.priceMin!=null?1:0)+(e.priceMax!=null?1:0):n.options.filter(i=>i.state.selected).length}function q({owner:n,items:e,state:i,set:r,bounds:c,wrap:a}){const t=u=>r({priceMin:u}),p=u=>r({priceMax:u}),L=(u,h)=>{const y=e[h.index],E=y.key===A?S(z,{children:[u,l(X,{bounds:c,min:i.priceMin,max:i.priceMax,onMin:t,onMax:p})]}):u;return a(E,y)};return l(ne,{ownerId:n.id,ownerType:V,Template:n.template,rows:e.map(re),items:e,fallback:null,wrapCopy:L,children:u=>u})}function R({columns:n,...e}){const[i,r]=U(null),c=a=>()=>r(t=>t===a?null:a);return n?S("div",{className:"flex flex-col gap-4",children:[l("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-6 border-y border-line py-4",children:l(q,{...e,wrap:(a,t)=>l("div",{children:a},t.key)})}),e.showSort&&l("div",{className:"flex flex-wrap items-center justify-end gap-4",children:l(_,{...e})})]}):S("div",{className:"relative flex flex-wrap items-center gap-2 @container",children:[l(q,{...e,wrap:(a,t)=>l(we,{labelSize:O.labelSmall,name:t.key,label:t.label,badge:$(t,e.state),open:i===t.key,onToggle:c(t.key),children:a},t.key)}),e.showSort&&l("div",{className:"ml-auto",children:l(_,{...e})})]})}function Ee(n){const[e,i]=U(!1),r=n.items.reduce((c,a)=>c+$(a,n.state),0);return S("div",{className:"flex flex-col gap-4",children:[S("div",{className:"flex items-center justify-between gap-4",children:[l(Te,{labelSize:O.labelSmall,label:"Filters",badge:r,open:e,onToggle:()=>i(c=>!c)}),n.showSort&&l(_,{...n})]}),e&&l(R,{...n,columns:!0,showSort:!1})]})}export{_e as default};
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as i,Fragment as x}from"react/jsx-runtime";import P from"../SectionBand.js";import S from"next/link";import{useEffect as M,useMemo as F,useRef as E}from"react";import{appendVehicleParams as $}from"../../lib/wheels/plp-vehicle-params.js";import{shopHrefForVehicle as j,shouldLeaveForTheShop as L}from"../../lib/wheels/picker-goes-to-the-shop.js";import z from"efficient-web-builder/render/components/SectionHeader";import{withRMark as T}from"efficient-web-builder/render/components/RMark";import k from"./FitmentPickerGrid.js";import V from"./StockFitmentCard.js";import{useVehicleFit as _}from"./useVehicleFit.js";import{say as O}from"efficient-web-builder/format/lib/editor-words";const f={body:"text-[length:var(--size-body,18px)]",headingSmall:"text-[length:var(--size-headingSmall,30px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,14px)]"};function R(l,n,c){if(!c)return l;const[s,m=""]=l.split("?"),r=$(new URLSearchParams(m),n).toString();return r?`${s}?${r}`:s}function Y({num:l,title:n,description:c,ctaText:s,ctaHref:m,layout:h="full",omitHead:r=!1,initialMakes:b=[],editing:o=!1}){const{cascade:e}=_({initialMakes:b,editing:o,autoApply:!0}),a=h==="bar",u=E(!1),w=F(()=>{if(!a)return e;const d=y=>(...N)=>{u.current=!0,y(...N)};return{...e,setMake:d(e.setMake),setModel:d(e.setModel),setYear:d(e.setYear),setModification:d(e.setModification)}},[a,e]);M(()=>{a&&(typeof window>"u"||L({shopperPicked:u.current,fullyPicked:e.fullyPicked,editing:o,pathname:window.location.pathname})&&window.location.assign(j(e.vehicle)))},[a,e.fullyPicked,e.vehicle,o]);const v=!r&&!a&&!!(l||n||c),p=!a&&s&&m?{text:s,href:m}:null,g=p?R(p.href,e.vehicle,e.fullyPicked):null;return i(P,{className:a?r?"pt-0 pb-8 max-view-desktop:pb-5":"py-8 max-view-desktop:py-5":r?"pt-0 pb-20 max-view-desktop:pb-[60px]":"py-20 max-view-desktop:py-[60px]",children:[v&&t(z,{num:l,title:n,description:c,accent:!0}),a?i("div",{className:"flex flex-wrap items-center gap-5",children:[!r&&n?.trim()&&t("p",{className:`font-heading3 ${f.headingSmall} [font-weight:var(--sf-heading-weight-strong,600)] leading-none tracking-[-0.02em] whitespace-nowrap`,children:T(n)}),t("div",{className:"min-w-[320px] flex-1 basis-0",children:t(k,{cascade:w,compact:!0,editing:o})})]}):t(k,{cascade:e,editing:o}),!a&&t(V,{loading:e.loading.stock,error:e.cascadeError,data:e.fullyPicked?e.stock:null}),!a&&i("div",{className:"mt-10 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-8",children:[t("p",{className:`max-w-[680px] font-serif ${f.body} italic leading-[1.55] text-fg-dim`,children:e.fullyPicked?i(x,{children:["Your car ·"," ",i("strong",{className:"font-display [font-weight:var(--sf-heading-weight-strong,500)] not-italic text-fg",children:[e.vehicle.year," ",e.makeName," ",e.modelName," ",e.modName]}),e.stock&&t("span",{className:"ml-3 not-italic text-accent",children:"OEM fitment loaded."})]}):i(x,{children:["Tell us four things — ",t("em",{className:"not-italic text-accent",children:"make, model, year, trim"})," — and we'll show the OEM stock fitment for your car."]})}),p&&g&&i(S,{href:g,className:`group inline-flex items-center gap-4 border border-btn bg-btn px-8 py-5 font-mono ${f.labelLarge} uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg`,children:[p.text,t("span",{className:"transition-transform group-hover:translate-x-[4px]",children:"→"})]})]}),o&&e.makeOptions.length===0&&!e.loading.models&&t("p",{className:`mt-4 font-mono ${f.labelSmall} uppercase tracking-[0.24em] text-fg-dim`,children:O("Vehicle catalog unavailable in this preview — the picker fills from the live fitment API on the published site.")})]})}export{Y as default,R as fitmentCtaHref};
1
+ "use client";import{jsx as t,jsxs as i,Fragment as x}from"react/jsx-runtime";import P from"../SectionBand.js";import S from"next/link";import{useEffect as M,useMemo as F,useRef as $}from"react";import{appendVehicleParams as E}from"../../lib/wheels/plp-vehicle-params.js";import{linkParts as j}from"../../lib/links/link-rules.js";import{shopHrefForVehicle as L,shouldLeaveForTheShop as z}from"../../lib/wheels/picker-goes-to-the-shop.js";import T from"efficient-web-builder/render/components/SectionHeader";import{withRMark as V}from"efficient-web-builder/render/components/RMark";import k from"./FitmentPickerGrid.js";import _ from"./StockFitmentCard.js";import{useVehicleFit as O}from"./useVehicleFit.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const f={body:"text-[length:var(--size-body,18px)]",headingSmall:"text-[length:var(--size-headingSmall,30px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,14px)]"};function Y(l,n,s){if(!s)return l;const{path:c,query:m,hash:h}=j(l),r=E(new URLSearchParams(m),n).toString();return`${c}${r?`?${r}`:""}${h}`}function q({num:l,title:n,description:s,ctaText:c,ctaHref:m,layout:h="full",omitHead:r=!1,initialMakes:b=[],editing:o=!1}){const{cascade:e}=O({initialMakes:b,editing:o,autoApply:!0}),a=h==="bar",u=$(!1),w=F(()=>{if(!a)return e;const d=y=>(...N)=>{u.current=!0,y(...N)};return{...e,setMake:d(e.setMake),setModel:d(e.setModel),setYear:d(e.setYear),setModification:d(e.setModification)}},[a,e]);M(()=>{a&&(typeof window>"u"||z({shopperPicked:u.current,fullyPicked:e.fullyPicked,editing:o,pathname:window.location.pathname})&&window.location.assign(L(e.vehicle)))},[a,e.fullyPicked,e.vehicle,o]);const v=!r&&!a&&!!(l||n||s),p=!a&&c&&m?{text:c,href:m}:null,g=p?Y(p.href,e.vehicle,e.fullyPicked):null;return i(P,{className:a?r?"pt-0 pb-8 max-view-desktop:pb-5":"py-8 max-view-desktop:py-5":r?"pt-0 pb-20 max-view-desktop:pb-[60px]":"py-20 max-view-desktop:py-[60px]",children:[v&&t(T,{num:l,title:n,description:s,accent:!0}),a?i("div",{className:"flex flex-wrap items-center gap-5",children:[!r&&n?.trim()&&t("p",{className:`font-heading3 ${f.headingSmall} [font-weight:var(--sf-heading-weight-strong,600)] leading-none tracking-[-0.02em] whitespace-nowrap`,children:V(n)}),t("div",{className:"min-w-[320px] flex-1 basis-0",children:t(k,{cascade:w,compact:!0,editing:o})})]}):t(k,{cascade:e,editing:o}),!a&&t(_,{loading:e.loading.stock,error:e.cascadeError,data:e.fullyPicked?e.stock:null}),!a&&i("div",{className:"mt-10 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-8",children:[t("p",{className:`max-w-[680px] font-serif ${f.body} italic leading-[1.55] text-fg-dim`,children:e.fullyPicked?i(x,{children:["Your car ·"," ",i("strong",{className:"font-display [font-weight:var(--sf-heading-weight-strong,500)] not-italic text-fg",children:[e.vehicle.year," ",e.makeName," ",e.modelName," ",e.modName]}),e.stock&&t("span",{className:"ml-3 not-italic text-accent",children:"OEM fitment loaded."})]}):i(x,{children:["Tell us four things — ",t("em",{className:"not-italic text-accent",children:"make, model, year, trim"})," — and we'll show the OEM stock fitment for your car."]})}),p&&g&&i(S,{href:g,className:`group inline-flex items-center gap-4 border border-btn bg-btn px-8 py-5 font-mono ${f.labelLarge} uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg`,children:[p.text,t("span",{className:"transition-transform group-hover:translate-x-[4px]",children:"→"})]})]}),o&&e.makeOptions.length===0&&!e.loading.models&&t("p",{className:`mt-4 font-mono ${f.labelSmall} uppercase tracking-[0.24em] text-fg-dim`,children:R("Vehicle catalog unavailable in this preview — the picker fills from the live fitment API on the published site.")})]})}export{q as default,Y as fitmentCtaHref};
@@ -5,8 +5,7 @@ export declare const supportedKinds: readonly ProductKind[];
5
5
  interface Props {
6
6
  rowsFrom?: "story" | "details";
7
7
  startLeft?: boolean;
8
- padTop?: number;
9
- padBottom?: number;
8
+ pads?: Record<string, unknown>;
10
9
  editing?: boolean;
11
10
  template?: unknown;
12
11
  nodeId?: string;
@@ -1 +1 @@
1
- "use client";import{jsx as s}from"react/jsx-runtime";import D from"../SectionBand.js";import h from"../DetailRows.js";import x from"./KindGate.js";import b from"./RecordPhotoGallery.js";import{useCurrentProduct as k}from"../../lib/document/current-product.js";import{SAMPLE_RECORD as S,recordFacts as B,recordPictures as w,useCurrentRecord as P,useDrawsOtherRecord as T}from"../../lib/document/current-record.js";import{detailShotTag as v,pickDetailShots as N}from"../../lib/wheels/detail-shots.js";import{selectedStuds as C}from"../../lib/wheels/selected-studs.js";import{useSampleProduct as F}from"./useSampleProduct.js";import{say as L}from"efficient-web-builder/format/lib/editor-words";const j=["alloy-wheel"];function g(e,i){return e.finishes.find(t=>t.name===i)??e.finishes[0]}function E(e,i){return(g(e,i)?.features??[]).map(t=>({eyebrow:t.eyebrow,title:t.heading,copy:t.description,tag:t.mark,image:t.image||void 0}))}function G(e,i,t){const r=N(g(e,i),t);return r.rows.map(o=>({eyebrow:o.eyebrow?.trim()||void 0,title:o.title,copy:o.line||void 0,image:o.url,tag:v(o,r,t),imageShape:"square"}))}function I(e){return T(!!e.editing)?s(K,{...e}):s(x,{kinds:j,type:"DetailRows",editing:e.editing,children:s(O,{...e})})}function y(e){const i=B(e),t=w(e)[0];return!i.length&&!t&&!e.title.trim()?[]:[{title:e.title,specs:i,image:t?.url||void 0}]}function K({startLeft:e,padTop:i,padBottom:t,editing:r=!1,template:o,nodeId:c}){const a=P(),n=a?y(a):r?y(S):[];if(n.length===0)return null;const l=a?w(a,{firstField:!0}):[];return l.length&&(n[0]={...n[0],media:s(b,{pictures:l,name:a?.title??"",editing:r,fit:"column"})}),s(h,{rows:n,startLeft:e,padTop:i,padBottom:t,editing:r,template:o,nodeId:c})}function O({rowsFrom:e,startLeft:i,padTop:t,padBottom:r,editing:o=!1,template:c,nodeId:a}){const n=k(),l=F(o&&!n),u=n?.product??l,d=u?.kind==="alloy-wheel"?u.source:null,m=n?n.selection.shown.finish:void 0,R=n?C(n.selection):null,p=e==="details",f=d?p?G(d,m,R):E(d,m):[];return p&&f.length===0?o?s(D,{className:"border-b border-line py-14 max-view-desktop:py-10",children:s("p",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:L("No detail shots on this finish yet. Tick a close-up on the design's renderings and give it a title. This section is hidden on the live page until then.")})}):null:s(h,{rows:f,startLeft:i,padTop:t,padBottom:r,editing:o,template:c,nodeId:a})}export{I as default,y as recordDetailRows,j as supportedKinds};
1
+ "use client";import{jsx as s}from"react/jsx-runtime";import R from"../SectionBand.js";import p from"../DetailRows.js";import D from"./KindGate.js";import x from"./RecordPhotoGallery.js";import{useCurrentProduct as b}from"../../lib/document/current-product.js";import{SAMPLE_RECORD as k,recordFacts as S,recordPictures as h,useCurrentRecord as P,useDrawsOtherRecord as v}from"../../lib/document/current-record.js";import{detailShotTag as N,pickDetailShots as B}from"../../lib/wheels/detail-shots.js";import{selectedStuds as C}from"../../lib/wheels/selected-studs.js";import{useSampleProduct as F}from"./useSampleProduct.js";import{say as L}from"efficient-web-builder/format/lib/editor-words";const T=["alloy-wheel"];function w(e,i){return e.finishes.find(t=>t.name===i)??e.finishes[0]}function j(e,i){return(w(e,i)?.features??[]).map(t=>({eyebrow:t.eyebrow,title:t.heading,copy:t.description,tag:t.mark,image:t.image||void 0}))}function E(e,i,t){const r=B(w(e,i),t);return r.rows.map(o=>({eyebrow:o.eyebrow?.trim()||void 0,title:o.title,copy:o.line||void 0,image:o.url,tag:N(o,r,t),imageShape:"square"}))}function G(e){return v(!!e.editing)?s(I,{...e}):s(D,{kinds:T,type:"DetailRows",editing:e.editing,children:s(K,{...e})})}function g(e){const i=S(e),t=h(e)[0];return!i.length&&!t&&!e.title.trim()?[]:[{title:e.title,specs:i,image:t?.url||void 0}]}function I({startLeft:e,pads:i,editing:t=!1,template:r,nodeId:o}){const l=P(),n=l?g(l):t?g(k):[];if(n.length===0)return null;const a=l?h(l,{firstField:!0}):[];return a.length&&(n[0]={...n[0],media:s(x,{pictures:a,name:l?.title??"",editing:t,fit:"column"})}),s(p,{rows:n,startLeft:e,pads:i,editing:t,template:r,nodeId:o})}function K({rowsFrom:e,startLeft:i,pads:t,editing:r=!1,template:o,nodeId:l}){const n=b(),a=F(r&&!n),d=n?.product??a,c=d?.kind==="alloy-wheel"?d.source:null,u=n?n.selection.shown.finish:void 0,y=n?C(n.selection):null,m=e==="details",f=c?m?E(c,u,y):j(c,u):[];return m&&f.length===0?r?s(R,{className:"border-b border-line py-14 max-view-desktop:py-10",children:s("p",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:L("No detail shots on this finish yet. Tick a close-up on the design's renderings and give it a title. This section is hidden on the live page until then.")})}):null:s(p,{rows:f,startLeft:i,pads:t,editing:r,template:o,nodeId:l})}export{G as default,g as recordDetailRows,T as supportedKinds};
@@ -15,8 +15,7 @@ export interface DynamicGalleryGridProps {
15
15
  styleOwner?: string;
16
16
  editing?: boolean;
17
17
  omitHead?: boolean;
18
- padTop?: number;
19
- padBottom?: number;
18
+ pads?: Record<string, unknown>;
20
19
  }
21
20
  export default function DynamicGalleryGrid(props: DynamicGalleryGridProps): import("react").JSX.Element;
22
21
  export declare function SourcedGalleryGrid(props: DynamicGalleryGridProps & {
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as S}from"react/jsx-runtime";import C from"efficient-web-builder/render/components/Btn";import j,{GALLERY_GRID_ATTR as D,GalleryLinksContext as F}from"../GalleryItem.js";import{SharedPartKinds as K}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as U}from"efficient-web-builder/render/components/goldPhrases";import Z from"efficient-web-builder/render/components/SectionHeader";import $ from"./KindGate.js";import z from"./RecordPhotoGallery.js";import{headIsEmpty as V,ownPadding as W}from"../../lib/sections/own-padding.js";import{PLP_KINDS as X}from"../../lib/catalog/plp-item.js";import{useCurrentProduct as Y}from"../../lib/document/current-product.js";import{SAMPLE_PICTURE_COUNT as L,SAMPLE_RECORD as q,recordPictures as J,useCurrentRecord as Q,useDrawsOtherRecord as ee}from"../../lib/document/current-record.js";import{mediaGroupVehicle as re}from"../../lib/content/source-values.js";import{IMAGE_ZONES as M}from"../../lib/sections/product-pictures.js";import{useSampleProduct as te}from"./useSampleProduct.js";import{say as _}from"efficient-web-builder/format/lib/editor-words";import{galleryLayoutRatio as ie,resolveGalleryLayout as oe}from"efficient-web-builder/format/lib/content/gallery-layout";import{HideTaker as T}from"efficient-web-builder/render/components/ViewHideRoot";const ae=X;function ne(e,o){if(!e)return[];if(o==="all")return M.flatMap(n=>e[n]??[]);const r=M.includes(o)?o:null;return r?e[r]??[]:[]}const k="relative z-[2] bg-bg py-[120px] max-view-wide:py-[70px]",I="relative z-[2] bg-bg pt-0 pb-[120px] max-view-wide:pt-0 max-view-wide:pb-[70px]",H="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]";function se(e){return ee(!!e.editing)?t(le,{...e}):t($,{kinds:ae,type:"GalleryB",editing:e.editing,children:t(me,{...e})})}function le(e){const{editing:o=!1}=e,r=Q(),n=r?J(r,{firstField:!0}).map(a=>({images:[a.url],eyebrow:a.alt&&a.alt!==r.title?a.alt:void 0,...a.video?{video:a.video}:{}})):o?Array.from({length:L},()=>({images:[""]})):[];return t(A,{...e,tiles:n,owner:{name:(r??q).title},photosOnly:!0,emptyHint:_("This record’s pictures appear here on its page. A record with no pictures draws nothing.")})}function Ee(e){const{rows:o,limit:r,layout:n,editing:a=!1,title:h}=e,d=oe(n),c=typeof r=="number"&&r>0?Math.floor(r):void 0,p=o.filter(s=>typeof s.cover=="string"&&s.cover).map(s=>({images:[s.cover],...s.video?{video:s.video}:{}})),g=a&&p.length===0?Array.from({length:c??L},()=>({images:[""]})):p;return t(A,{...e,tiles:c?g.slice(0,c):g,owner:{name:(h??"").replace(/==/g,"").trim()},photosOnly:!0,tilesAcross:d?.across===3?3:4,tileRatio:d?ie(d):null,emptyHint:_("The website’s pictures appear here, in the order they are put in. A website with no pictures draws nothing.")})}function me({omitHead:e=!1,num:o,title:r,linkText:n,linkHref:a,galleryHref:h="/gallery",submitHref:d="/contact",zone:c="all",photoDisplay:p="covers",previewHover:g,display:s,displayPhone:y,styleOwner:v,editing:f=!1,padTop:G,padBottom:x}){const w=Y(),N=te(f&&!w),u=w?.product??N,b=ne(u?.mediaGroups,c).map(i=>({images:(i.items??[]).filter(m=>m.kind==="image").map(m=>m.url),vehicle:re(i),finish:i.finish})).filter(i=>i.images.length>0),P=(p==="auto"?b.length>=4?"covers":"all":p)==="all"?b.flatMap(i=>i.images.map(m=>({images:[m],vehicle:i.vehicle,finish:i.finish}))):b;return t(A,{omitHead:e,num:o,title:r,linkText:n,linkHref:a,galleryHref:h,submitHref:d,previewHover:g,display:s,displayPhone:y,styleOwner:v,editing:f,padTop:G,padBottom:x,tiles:u?P.map(i=>({images:i.images,eyebrow:i.vehicle||void 0,meta:i.finish})):[],owner:{name:u?.name??"",href:u?.href,process:u?.eyebrow},emptyHint:_("This product’s photos appear here on a product page. Add media groups in the product’s Media tab.")})}function A({omitHead:e=!1,num:o,title:r,linkText:n,linkHref:a,galleryHref:h="/gallery",submitHref:d="/contact",previewHover:c,display:p,displayPhone:g,styleOwner:s,editing:y=!1,tiles:v,owner:f,emptyHint:G,photosOnly:x=!1,tilesAcross:w,tileRatio:N=null,padTop:u,padBottom:b}){const R=n?{text:n,href:a||"#"}:void 0,P=r?U(r,!1):void 0,i=e?null:t(Z,{num:o,title:P,link:R}),m=!y&&V(o,r,R?.text)?null:i,E=W(u,b);return v.length===0?y?t(T,{as:"section",className:e?I:k,style:E,children:S("div",{className:H,children:[m,t("p",{className:"mt-8 border-t border-line py-6 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:G})]})}):null:t(T,{as:"section",className:e?I:k,style:E,children:S("div",{className:H,children:[m,x?t(z,{pictures:v.map(l=>({url:l.images[0]??"",alt:l.eyebrow,video:l.video})),name:f.name,editing:y,...w?{fit:"tiles",across:w,ratio:N}:{}}):t(F.Provider,{value:{galleryHref:h,submitHref:d,previewHover:c,display:p,displayPhone:g,styleOwner:s,photosOnly:x},children:t(K,{children:t("div",{[D]:"",className:"grid grid-cols-4 gap-2 max-[1500px]:grid-cols-3 max-view-wide:grid-cols-1 max-view-wide:gap-1",children:v.map((l,O)=>t(j,{image:l.images[0],photos:l.images.slice(1).map(B=>({src:B})),href:f.href,process:f.process,eyebrow:l.eyebrow,name:f.name,meta:l.meta,editing:y},`${l.eyebrow}-${O}`))})})}),!x&&t("div",{className:"mt-12 flex flex-col items-center gap-3",children:t(C,{href:h,variant:"ghost",children:"See Gallery"})})]})})}export{Ee as SourcedGalleryGrid,se as default,ae as supportedKinds};
1
+ "use client";import{jsx as t,jsxs as O}from"react/jsx-runtime";import I from"efficient-web-builder/render/components/Btn";import C,{GALLERY_GRID_ATTR as H,GalleryLinksContext as F}from"../GalleryItem.js";import{SharedPartKinds as j}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as D}from"efficient-web-builder/render/components/goldPhrases";import K from"efficient-web-builder/render/components/SectionHeader";import $ from"./KindGate.js";import U from"./RecordPhotoGallery.js";import{FRAME_120 as W,FRAME_ROOM_OWN_BOX as X,FRAME_ROOM_Y as Y,framedBandPad as Z,headIsEmpty as z,withBandClasses as V}from"../../lib/sections/band-padding.js";import{PLP_KINDS as q}from"../../lib/catalog/plp-item.js";import{useCurrentProduct as J}from"../../lib/document/current-product.js";import{SAMPLE_PICTURE_COUNT as P,SAMPLE_RECORD as Q,recordPictures as ee,useCurrentRecord as re,useDrawsOtherRecord as te}from"../../lib/document/current-record.js";import{mediaGroupVehicle as ie}from"../../lib/content/source-values.js";import{IMAGE_ZONES as S}from"../../lib/sections/product-pictures.js";import{useSampleProduct as ae}from"./useSampleProduct.js";import{say as A}from"efficient-web-builder/format/lib/editor-words";import{galleryLayoutRatio as oe,resolveGalleryLayout as se}from"efficient-web-builder/format/lib/content/gallery-layout";import{HideTaker as L}from"efficient-web-builder/render/components/ViewHideRoot";const ne=q;function le(e,a){if(!e)return[];if(a==="all")return S.flatMap(s=>e[s]??[]);const r=S.includes(a)?a:null;return r?e[r]??[]:[]}const me=`relative z-[2] bg-bg ${Y}`,de=`relative z-[2] bg-bg ${X}`,T="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]";function ce(e){return te(!!e.editing)?t(fe,{...e}):t($,{kinds:ne,type:"GalleryB",editing:e.editing,children:t(pe,{...e})})}function fe(e){const{editing:a=!1}=e,r=re(),s=r?ee(r,{firstField:!0}).map(o=>({images:[o.url],eyebrow:o.alt&&o.alt!==r.title?o.alt:void 0,...o.video?{video:o.video}:{}})):a?Array.from({length:P},()=>({images:[""]})):[];return t(E,{...e,tiles:s,owner:{name:(r??Q).title},photosOnly:!0,emptyHint:A("This record’s pictures appear here on its page. A record with no pictures draws nothing.")})}function Le(e){const{rows:a,limit:r,layout:s,editing:o=!1,title:h}=e,d=se({layout:s}),c=typeof r=="number"&&r>0?Math.floor(r):void 0,f=a.filter(n=>typeof n.cover=="string"&&n.cover).map(n=>({images:[n.cover],...n.video?{video:n.video}:{}})),g=o&&f.length===0?Array.from({length:c??P},()=>({images:[""]})):f;return t(E,{...e,tiles:c?g.slice(0,c):g,owner:{name:(h??"").replace(/==/g,"").trim()},photosOnly:!0,tilesAcross:d?.across===3?3:4,tileRatio:d?oe(d):null,emptyHint:A("The website’s pictures appear here, in the order they are put in. A website with no pictures draws nothing.")})}function pe({omitHead:e=!1,num:a,title:r,linkText:s,linkHref:o,galleryHref:h="/gallery",submitHref:d="/contact",zone:c="all",photoDisplay:f="covers",previewHover:g,display:n,displayPhone:y,styleOwner:x,editing:p=!1,pads:_}){const v=J(),R=ae(p&&!v),u=v?.product??R,w=le(u?.mediaGroups,c).map(i=>({images:(i.items??[]).filter(m=>m.kind==="image").map(m=>m.url),vehicle:ie(i),finish:i.finish})).filter(i=>i.images.length>0),N=(f==="auto"?w.length>=4?"covers":"all":f)==="all"?w.flatMap(i=>i.images.map(m=>({images:[m],vehicle:i.vehicle,finish:i.finish}))):w;return t(E,{omitHead:e,num:a,title:r,linkText:s,linkHref:o,galleryHref:h,submitHref:d,previewHover:g,display:n,displayPhone:y,styleOwner:x,editing:p,pads:_,tiles:u?N.map(i=>({images:i.images,eyebrow:i.vehicle||void 0,meta:i.finish})):[],owner:{name:u?.name??"",href:u?.href,process:u?.eyebrow},emptyHint:A("This product’s photos appear here on a product page. Add media groups in the product’s Media tab.")})}function E({omitHead:e=!1,num:a,title:r,linkText:s,linkHref:o,galleryHref:h="/gallery",submitHref:d="/contact",previewHover:c,display:f,displayPhone:g,styleOwner:n,editing:y=!1,tiles:x,owner:p,emptyHint:_,photosOnly:v=!1,tilesAcross:R,tileRatio:u=null,pads:w}){const G=s?{text:s,href:o||"#"}:void 0,N=r?D(r,!1):void 0,i=e?null:t(K,{num:a,title:N,link:G}),m=!y&&z(a,r,G?.text)?null:i,b=Z(w,W,{noTop:e,nonNegative:!0}),M=V(e?de:me,b);return x.length===0?y?t(L,{as:"section",...b.attrs,className:M,style:b.style,children:O("div",{className:T,children:[m,t("p",{className:"mt-8 border-t border-line py-6 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.18em] text-fg-dim",children:_})]})}):null:t(L,{as:"section",...b.attrs,className:M,style:b.style,children:O("div",{className:T,children:[m,v?t(U,{pictures:x.map(l=>({url:l.images[0]??"",alt:l.eyebrow,video:l.video})),name:p.name,editing:y,...R?{fit:"tiles",across:R,ratio:u}:{}}):t(F.Provider,{value:{galleryHref:h,submitHref:d,previewHover:c,display:f,displayPhone:g,styleOwner:n,photosOnly:v},children:t(j,{children:t("div",{[H]:"",className:"grid grid-cols-4 gap-2 max-[1500px]:grid-cols-3 max-view-wide:grid-cols-1 max-view-wide:gap-1",children:x.map((l,k)=>t(C,{image:l.images[0],photos:l.images.slice(1).map(B=>({src:B})),href:p.href,process:p.process,eyebrow:l.eyebrow,name:p.name,meta:l.meta,editing:y},`${l.eyebrow}-${k}`))})})}),!v&&t("div",{className:"mt-12 flex flex-col items-center gap-3",children:t(I,{href:h,variant:"ghost",children:"See Gallery"})})]})})}export{Le as SourcedGalleryGrid,ce as default,ne as supportedKinds};
@@ -34,6 +34,7 @@ export interface ProductSelection {
34
34
  set: number;
35
35
  msrpLabel: string | null;
36
36
  }
37
- export declare function useProductSelection(product: StoreProduct, { editing, }?: {
37
+ export declare function useProductSelection(product: StoreProduct, { editing, defaultVariant, }?: {
38
38
  editing?: boolean;
39
+ defaultVariant?: number | null;
39
40
  }): ProductSelection;
@@ -1 +1 @@
1
- "use client";import{useEffect as _,useState as c}from"react";import{useCurrency as j}from"./CurrencyContext.js";import{useVehicleFit as D}from"./fitment/useVehicleFit.js";import{askableOptions as G,resolvePart as H,shownOptions as N,staleOptions as R,statedOptions as z}from"../lib/catalog/product-options.js";import{wheelForVehicle as B}from"../lib/catalog/from-wheel.js";import{DEFAULT_PURCHASE_STATE as y,purchaseOffer as J,vehicleGate as K}from"../lib/catalog/purchase.js";import{formatSelectionWasPrice as X,resolveSelectionPrice as Y}from"../lib/wheels/price-display.js";import{isPreOrderWheel as Z}from"../lib/wheels/pre-order.js";function ae(t,{editing:P=!1}={}){const[o,d]=c({}),[l,v]=c(y.qty),[h,A]=c(y.choice),[O,T]=c(0),[x,C]=c(!1),[a,E]=c(!1),p=D({editing:P,autoApply:!0}),s=B(t,a?null:p.fit),S=G(s,o),M=z(s,o),V=N(s,o),e=H(s,o),q=e!=null&&!e.inStock,f=R(s,o).join("|");_(()=>{if(!f)return;const r=new Set(f.split("|"));d(m=>{const i={...m};for(const W of r)delete i[W];return i})},[f]);const{currency:u}=j(),k=J(s,e,{choice:h,qty:l}),n=Y({prices:t.anchorPrices,msrpPrices:t.anchorMsrpPrices},e?{components:k.components}:null,u,l),F=n.unit??0,Q=n.setTotal??0,b=X(n,u),w=a||p.appliedName!=="",g=K(t)==="required"?w:!0,I=S.every(r=>r.chosen!==null)&&g&&e!=null&&e.inStock&&n.priced,L=Z({variants:t.parts,inStock:t.inStock,priced:n.priced});function U(r,m){d(i=>({...i,[r]:m}))}return{picked:o,shown:V,pick:U,qty:l,setQty:v,choice:h,setChoice:A,angleIdx:O,setAngleIdx:T,showValidation:x,setShowValidation:C,manualMode:a,setManualMode:E,vehicle:p,fitmentSet:w,rows:S,facts:M,part:e,outOfStock:q,offer:k,preOrder:L,canAddToCart:I,currency:u,price:n,unit:F,set:Q,msrpLabel:b}}export{ae as useProductSelection};
1
+ "use client";import{useEffect as j,useState as r}from"react";import{useCurrency as D}from"./CurrencyContext.js";import{useVehicleFit as G}from"./fitment/useVehicleFit.js";import{askableOptions as H,resolvePart as N,shownOptions as R,staleOptions as z,statedOptions as B}from"../lib/catalog/product-options.js";import{picksForVariant as J}from"../lib/catalog/default-variant.js";import{wheelForVehicle as K}from"../lib/catalog/from-wheel.js";import{DEFAULT_PURCHASE_STATE as y,purchaseOffer as X,vehicleGate as Y}from"../lib/catalog/purchase.js";import{formatSelectionWasPrice as Z,resolveSelectionPrice as $}from"../lib/wheels/price-display.js";import{isPreOrderWheel as ee}from"../lib/wheels/pre-order.js";function me(e,{editing:P=!1,defaultVariant:v=null}={}){const[o,d]=r(()=>J(e,v)),[l,A]=r(y.qty),[h,O]=r(y.choice),[T,V]=r(0),[x,C]=r(!1),[a,E]=r(!1),p=G({editing:P,autoApply:!0}),n=K(e,a?null:p.fit),S=H(n,o),F=B(n,o),M=R(n,o),t=N(n,o),q=t!=null&&!t.inStock,f=z(n,o).join("|");j(()=>{if(!f)return;const c=new Set(f.split("|"));d(u=>{const i={...u};for(const _ of c)delete i[_];return i})},[f]);const{currency:m}=D(),k=X(n,t,{choice:h,qty:l}),s=$({prices:e.anchorPrices,msrpPrices:e.anchorMsrpPrices},t?{components:k.components}:null,m,l),Q=s.unit??0,b=s.setTotal??0,g=Z(s,m),w=a||p.appliedName!=="",I=Y(e)==="required"?w:!0,L=S.every(c=>c.chosen!==null)&&I&&t!=null&&t.inStock&&s.priced,U=ee({variants:e.parts,inStock:e.inStock,priced:s.priced});function W(c,u){d(i=>({...i,[c]:u}))}return{picked:o,shown:M,pick:W,qty:l,setQty:A,choice:h,setChoice:O,angleIdx:T,setAngleIdx:V,showValidation:x,setShowValidation:C,manualMode:a,setManualMode:E,vehicle:p,fitmentSet:w,rows:S,facts:F,part:t,outOfStock:q,offer:k,preOrder:U,canAddToCart:L,currency:m,price:s,unit:Q,set:b,msrpLabel:g}}export{me as useProductSelection};
@@ -20,12 +20,14 @@ export interface AlloyWheelsListingProps {
20
20
  showInStock?: boolean;
21
21
  kinds?: string[];
22
22
  products?: ProductSummary[];
23
- requestQuery?: string;
23
+ addressQuery?: string;
24
24
  wheels?: WheelSummary[];
25
25
  editing?: boolean;
26
26
  ownerId?: string;
27
27
  template?: SlotComponent;
28
- facetTemplate?: SlotComponent;
28
+ facetTemplate: SlotComponent;
29
+ railTemplate: SlotComponent;
30
+ railHeadTemplate: SlotComponent;
29
31
  omitHead?: boolean;
30
32
  hover?: CardHoverDrawn;
31
33
  }
@@ -33,4 +35,4 @@ export declare const PLP_GATE_DEFAULTS: {
33
35
  readonly heading: "Let's find wheels that fit your car.";
34
36
  readonly 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.";
35
37
  };
36
- export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, requestQuery, editing, ownerId, template, facetTemplate, hover, titleLevel, omitHead, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
38
+ export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, addressQuery, editing, ownerId, template, facetTemplate, railTemplate, railHeadTemplate, hover, titleLevel, omitHead, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- "use client";import{jsx as o,jsxs as c,Fragment as qe}from"react/jsx-runtime";import{useScopeClass as Je}from"../../lib/use-scope-class.js";import{useCallback as d,useEffect as Qe,useMemo as i,useRef as Ue,useState as Xe}from"react";import{cardHoverOf as Ze}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as et}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as tt}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as ot,answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as rt}from"../CurrencyContext.js";import nt from"../NoCurrencyNote.js";import{usePreviewDevice as st}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as it,renderHeadline as lt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as ct}from"../useProductCatalog.js";import{scrollBehavior as at}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as pt,PLP_GRID_GAP_VAR as le,plpGridVars as dt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as mt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as ut,cardRowsGridStyle as ht}from"../WheelCardFrame.js";import{applyPlpFilters as ft,buildPlpFacets as gt,buildPlpTypeOptions as yt,buildTyreSizeBoxes as St,EMPTY_PLP_FILTERS as ce,hasActivePlpFilters as xt,paginatePlp as bt,pickTyreSize as wt,plpTyreSizeBoxesShown as kt,plpInStockCount as vt,plpOpeningSort as Pt,plpPriceBounds as Nt,plpShownKinds as Ct,plpSortKeysFor as Tt,PLP_SORT_LABELS as _t}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as At,itemTyreSizes as zt,plpBrandVaries as Lt,plpProcessVaries as Mt,plpItemsOfKinds as Ot,plpKindNoun as ae,resolvePlpKinds as Ft}from"../../lib/catalog/plp-item.js";import{plpGateWords as Rt,plpVehicleCopy as Vt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Gt,oemTyreSizes as It}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as jt}from"../../lib/wheels/plp-fitment-match.js";import Et from"./PlpActiveChips.js";import{GridCardProvider as Kt,GridMixedCards as Bt,gridIndexCss as Dt,LISTING_CARD_RULES as Wt}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as $t}from"../ProductCardEyebrow.js";import Ht from"./PlpPagination.js";import Yt from"./PlpSidebar.js";import{PlpResultRange as qt,PlpToolbar as Jt}from"./PlpToolbar.js";import Qt from"../catalog/SortSelect.js";import Ut from"./PlpVehicleBar.js";import Xt from"./PlpVehicleGate.js";import{useVehicleCatalog as Zt}from"./useVehicleCatalog.js";import{useVehicleFit as eo}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as to}from"./usePlpFiltersInUrl.js";import{say as I}from"efficient-web-builder/format/lib/editor-words";const Eo={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 oo({level:k,className:v,children:P}){const L=et(k);return o(L,{className:v,children:P})}const ro=Ze({},"AlloyWheelsListing");function no({heading:k="",intro:v="",askForCar:P=!0,gateHeading:L="",gateIntro:pe="",perPage:j=24,columns:de,defaultSort:me="recommended",hiddenFacets:ue=[],fieldUsage:f=ot,showPrice:E=!0,showInStock:he=!0,kinds:fe,products:ge,wheels:ye,requestQuery:Se,editing:m=!1,ownerId:K="",template:xe,facetTemplate:be,hover:we=ro,titleLevel:ke,omitHead:B=!1}){const{currency:a}=rt(),u=Ft(fe),D=st(),W=pt(de),ve=dt(W,m?D:null),Pe=mt(W,m?D:null),$=Je("plp"),Ne=Dt($),Ce=ct(),H=ge??ye??Ce??[],Y=i(()=>Ot(H,u),[H,u.join(",")]),r=eo({editing:m,enabled:P,autoApply:!0}),[Te,M]=Xe(!1),_e=Pt(me,u),g=r.applied?.vehicle??null,[e,x]=to({editing:m,openingSort:_e,appliedVehicle:g,vehicleRestored:r.restored,requestQuery:Se}),p=Ct(u,e.kind),n=d(t=>x(t),[x]),q=d((t,h)=>{const l=e[t],He=l.map(String).includes(h)?l.filter(Ye=>String(Ye)!==h):[...l,t==="diameters"?Number(h):h];n({...e,[t]:He,page:1})},[e,n]),J=d(t=>n({...e,priceMin:t,page:1}),[e,n]),Q=d(t=>n({...e,priceMax:t,page:1}),[e,n]),U=d(t=>n({...e,inStockOnly:t,page:1}),[e,n]),X=d(t=>n({...ce,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),Ae=d(t=>n({...e,sort:t,page:1}),[e,n]),ze=d(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:at()})},[e,n]),Z=d(()=>n({...ce,sort:e.sort}),[e.sort,n]),{clear:C}=r,ee=d(()=>{C(),M(!0),x(t=>({...t,page:1}))},[C]),Le=d(()=>{C(),M(!1),x(t=>({...t,page:1}))},[C]),T=g?[g.make,g.model,g.year,g.modification].join("|"):"",_=Ue(null);Qe(()=>{if(r.restored){if(_.current===null){_.current=T;return}_.current!==T&&(_.current=T,x(t=>t.page===1?t:{...t,page:1}))}},[r.restored,T,x]);const{items:A,failed:te,retry:Me}=Zt({catalog:Y,shownKinds:u,vehicle:g,editing:m}),s=i(()=>{if(!r.fit)return A;const t=A.filter(l=>z(l)==="alloy-wheel"),h=new Set(jt(t,r.fit).map(l=>l.slug));return A.filter(l=>z(l)!=="alloy-wheel"||h.has(At(l)))},[A,r.fit]),b=ue.join(","),Oe=i(()=>{const t=new Set(b?b.split(","):[]);return gt(s,e,a,p,f).filter(h=>!t.has(h.key))},[s,e,a,b,p.join(","),f]),y=i(()=>ft(s,e,a),[s,e,a]),Fe=p.length>1,oe=i(()=>ie(f,"alloy-wheel"),[f]),Re=i(()=>ie(f,"tyre"),[f]),O=i(()=>Lt(y),[y]),F=i(()=>Mt(y),[y]),R=Fe?ae(["alloy-wheel"]).one:null,Ve=i(()=>({kindLabel:R,brand:O,process:F}),[R,O,F]),Ge=$t({kind:!!R,brand:O,process:F},oe),Ie=i(()=>E?Nt(s,a):null,[s,a,E]),je=i(()=>vt(s,e,a),[s,e,a]),Ee=i(()=>yt(s,u,e,a),[s,u.join(","),e,a]),Ke=d((t,h)=>{const l=wt(s.flatMap(zt),e.tyreSizes[0]??"",t,h);n({...e,tyreSizes:l?[l]:[],page:1})},[s,e,n]),Be=i(()=>{const t=new Set(b?b.split(","):[]);return!kt(s,p)||t.has("tyreSizes")?null:St(s,e,a)},[s,e,a,b,p.join(","),f]),S=i(()=>bt(y,e.page,j),[y,e.page,j]),w=ae(p),V=Vt(p),re=Rt(L,pe,p,u),ne=p.length===1&&p[0]==="tyre",se=r.applied?.stock??null,N=i(()=>It(se),[se]),De=i(()=>s.filter(t=>p.includes(z(t))).length,[s,p.join(",")]),G=Y.length===0,We=!G&&s.length===0,$e=P&&!m&&!r.applied&&!Te;return u.length===0?null:c("section",{children:[P&&o(Ut,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:ne&&N.length>0?`Takes ${N.join(" · ")}`:null,resolving:r.resolving,unresolved:ne?!!r.applied&&!r.resolving&&N.length===0:r.unresolved,matchCount:De,copy:V,onAmend:Le,onClear:ee}),$e&&o(Xt,{cascade:r.cascade,heading:re.heading,intro:re.intro,ready:r.restored,copy:V,onSkip:()=>M(!0)}),c("div",{className:B?void 0:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[!B&&(k||v)&&c("header",{className:"mb-6",children:[k&&o(oo,{level:ke,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:lt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:it(v)})]}),c("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[o(Yt,{facets:Oe,filters:e,typeOptions:Ee,sizeBoxes:Be,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:w,priceBounds:Ie,inStockCount:he?je:null,onToggle:q,onPickType:X,onPickSize:Ke,onPriceMin:J,onPriceMax:Q,onInStockOnly:U,onClearAll:Z,owner:{id:K,facetTemplate:be},editing:m}),c("div",{className:"min-w-0 flex-1",children:[o(Jt,{className:"mb-4",start:c(qe,{children:[o(qt,{total:S.total,range:{from:S.from,to:S.to},noun:w}),o(Et,{filters:e,onToggle:q,onPriceMin:J,onPriceMax:Q,onInStockOnly:U,onPickType:X})]}),end:o(Qt,{value:e.sort,keys:Tt(u),labels:_t,onChange:Ae})}),te&&!G&&c("div",{role:"status",className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 border border-line px-4 py-3",children:[o("p",{className:"text-[14px] text-fg-dim",children:"We couldn't check your car just now — try again."}),o("button",{type:"button",onClick:Me,className:"cursor-pointer bg-btn px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Try again"})]}),G?o("div",{className:"border border-dashed border-line p-10",children:o("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?w.many==="wheels"?I("No wheels in this website's catalog yet — curate products to see them here."):w.many==="tyres"?I("No tyres in this website's catalog yet — curate products to see them here."):I("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):We?te?null:c("div",{className:"border border-line p-10",children:[c("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",r.appliedName]}),o("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:V.nothingFits}),c("button",{type:"button",onClick:ee,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 ",w.many]})]}):S.total===0?c("div",{className:"border border-line p-10",children:[c("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",w.many," match those filters"]}),o("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),xt(e)&&o("button",{type:"button",onClick:Z,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"})]}):c(Kt,{value:{ownerId:K,ownerType:"AlloyWheelsListing",Template:xe,hover:we,imageSizes:Pe,fieldUsage:oe,tyreFieldUsage:Re,reserveEyebrow:Ge,editing:m,eyebrow:Ve,fit:r.fit,colours:e.finishes,setGridGap:`var(${le})`,rules:Wt},children:[o("style",{children:Ne}),o("div",{className:`plp-card-grid ${$} ${ut} ${tt}`,style:{...ve,...ht(`var(${le})`)},children:o(Bt,{items:S.items,tyreOf:t=>z(t)==="tyre"?t:null,tyreFit:t=>N.length>0?Gt(t.sizes,N):null})})]}),o(Ht,{page:S.page,pageCount:S.pageCount,onPage:ze}),o(nt,{editing:m})]})]})]})]})}export{Eo as PLP_GATE_DEFAULTS,no as default};
1
+ "use client";import{jsx as o,jsxs as c,Fragment as Ue}from"react/jsx-runtime";import{useScopeClass as Xe}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as Ze,useMemo as i,useRef as et,useState as tt}from"react";import{cardHoverOf as ot}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as rt}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as nt}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as st,answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as it}from"../CurrencyContext.js";import lt from"../NoCurrencyNote.js";import{usePreviewDevice as ct}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as at,renderHeadline as pt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as mt}from"../useProductCatalog.js";import{scrollBehavior as dt}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ut,PLP_GRID_GAP_VAR as le,plpGridVars as ht}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as ft}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as gt,cardRowsGridStyle as yt}from"../WheelCardFrame.js";import{applyPlpFilters as St,buildPlpFacets as xt,buildPlpTypeOptions as bt,buildTyreSizeBoxes as wt,EMPTY_PLP_FILTERS as ce,hasActivePlpFilters as kt,paginatePlp as vt,pickTyreSize as Pt,plpTyreSizeBoxesShown as Nt,plpInStockCount as Ct,plpOpeningSort as Tt,plpPriceBounds as _t,plpShownKinds as At,plpSortKeysFor as Lt,PLP_SORT_LABELS as zt}from"../../lib/wheels/plp-filters.js";import{itemKind as L,itemSlug as Ot,itemTyreSizes as It,plpBrandVaries as Mt,plpProcessVaries as Ft,plpItemsOfKinds as Gt,plpKindNoun as ae,resolvePlpKinds as Rt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Vt,plpVehicleCopy as Et}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as jt,oemTyreSizes as Kt}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as Bt}from"../../lib/wheels/plp-fitment-match.js";import Dt from"./PlpActiveChips.js";import{GridCardProvider as Wt,GridMixedCards as $t,gridIndexCss as Ht,LISTING_CARD_RULES as Yt}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as qt}from"../ProductCardEyebrow.js";import Jt from"./PlpPagination.js";import Qt from"./PlpSidebar.js";import{PlpResultRange as Ut,PlpToolbar as Xt}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";import{ALLOY_WHEELS_LISTING_TYPE as pe}from"../../lib/document/document-nodes.js";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:k,className:v,children:P}){const z=rt(k);return o(z,{className:v,children:P})}const io=ot({},pe);function lo({heading:k="",intro:v="",askForCar:P=!0,gateHeading:z="",gateIntro:me="",perPage:E=24,columns:de,defaultSort:ue="recommended",hiddenFacets:he=[],fieldUsage:f=st,showPrice:j=!0,showInStock:fe=!0,kinds:ge,products:ye,wheels:Se,addressQuery:xe,editing:d=!1,ownerId:K="",template:be,facetTemplate:we,railTemplate:ke,railHeadTemplate:ve,hover:Pe=io,titleLevel:Ne,omitHead:B=!1}){const{currency:a}=it(),u=Rt(ge),D=ct(),W=ut(de),Ce=ht(W,d?D:null),Te=ft(W,d?D:null),$=Xe("plp"),_e=Ht($),Ae=mt(),H=ye??Se??Ae??[],Y=i(()=>Gt(H,u),[H,u.join(",")]),r=ro({editing:d,enabled:P,autoApply:!0}),[Le,O]=tt(!1),ze=Tt(ue,u),g=r.applied?.vehicle??null,[e,x]=no({editing:d,openingSort:ze,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:xe}),p=At(u,e.kind),n=m(t=>x(t),[x]),q=m((t,h)=>{const l=e[t],Je=l.map(String).includes(h)?l.filter(Qe=>String(Qe)!==h):[...l,t==="diameters"?Number(h):h];n({...e,[t]:Je,page:1})},[e,n]),J=m(t=>n({...e,priceMin:t,page:1}),[e,n]),Q=m(t=>n({...e,priceMax:t,page:1}),[e,n]),U=m(t=>n({...e,inStockOnly:t,page:1}),[e,n]),X=m(t=>n({...ce,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),Oe=m(t=>n({...e,sort:t,page:1}),[e,n]),Ie=m(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:dt()})},[e,n]),Z=m(()=>n({...ce,sort:e.sort}),[e.sort,n]),{clear:C}=r,ee=m(()=>{C(),O(!0),x(t=>({...t,page:1}))},[C]),Me=m(()=>{C(),O(!1),x(t=>({...t,page:1}))},[C]),T=g?[g.make,g.model,g.year,g.modification].join("|"):"",_=et(null);Ze(()=>{if(r.restored){if(_.current===null){_.current=T;return}_.current!==T&&(_.current=T,x(t=>t.page===1?t:{...t,page:1}))}},[r.restored,T,x]);const{items:A,failed:te,retry:Fe}=oo({catalog:Y,shownKinds:u,vehicle:g,editing:d}),s=i(()=>{if(!r.fit)return A;const t=A.filter(l=>L(l)==="alloy-wheel"),h=new Set(Bt(t,r.fit).map(l=>l.slug));return A.filter(l=>L(l)!=="alloy-wheel"||h.has(Ot(l)))},[A,r.fit]),b=he.join(","),Ge=i(()=>{const t=new Set(b?b.split(","):[]);return xt(s,e,a,p,f).filter(h=>!t.has(h.key))},[s,e,a,b,p.join(","),f]),y=i(()=>St(s,e,a),[s,e,a]),Re=p.length>1,oe=i(()=>ie(f,"alloy-wheel"),[f]),Ve=i(()=>ie(f,"tyre"),[f]),I=i(()=>Mt(y),[y]),M=i(()=>Ft(y),[y]),F=Re?ae(["alloy-wheel"]).one:null,Ee=i(()=>({kindLabel:F,brand:I,process:M}),[F,I,M]),je=qt({kind:!!F,brand:I,process:M},oe),Ke=i(()=>j?_t(s,a):null,[s,a,j]),Be=i(()=>Ct(s,e,a),[s,e,a]),De=i(()=>bt(s,u,e,a),[s,u.join(","),e,a]),We=m((t,h)=>{const l=Pt(s.flatMap(It),e.tyreSizes[0]??"",t,h);n({...e,tyreSizes:l?[l]:[],page:1})},[s,e,n]),$e=i(()=>{const t=new Set(b?b.split(","):[]);return!Nt(s,p)||t.has("tyreSizes")?null:wt(s,e,a)},[s,e,a,b,p.join(","),f]),S=i(()=>vt(y,e.page,E),[y,e.page,E]),w=ae(p),G=Et(p),re=Vt(z,me,p,u),ne=p.length===1&&p[0]==="tyre",se=r.applied?.stock??null,N=i(()=>Kt(se),[se]),He=i(()=>s.filter(t=>p.includes(L(t))).length,[s,p.join(",")]),R=Y.length===0,Ye=!R&&s.length===0,qe=P&&!d&&!r.applied&&!Le;return u.length===0?null:c("section",{children:[P&&o(eo,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:ne&&N.length>0?`Takes ${N.join(" · ")}`:null,resolving:r.resolving,unresolved:ne?!!r.applied&&!r.resolving&&N.length===0:r.unresolved,matchCount:He,copy:G,onAmend:Me,onClear:ee}),qe&&o(to,{cascade:r.cascade,heading:re.heading,intro:re.intro,ready:r.restored,copy:G,onSkip:()=>O(!0)}),c("div",{className:B?void 0:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[!B&&(k||v)&&c("header",{className:"mb-6",children:[k&&o(so,{level:Ne,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:pt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:at(v)})]}),c("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[o(Qt,{facets:Ge,filters:e,typeOptions:De,sizeBoxes:$e,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:w,priceBounds:Ke,inStockCount:fe?Be:null,onToggle:q,onPickType:X,onPickSize:We,onPriceMin:J,onPriceMax:Q,onInStockOnly:U,onClearAll:Z,owner:{id:K,facetTemplate:we,railTemplate:ke,railHeadTemplate:ve},editing:d}),c("div",{className:"min-w-0 flex-1",children:[o(Xt,{className:"mb-4",start:c(Ue,{children:[o(Ut,{total:S.total,range:{from:S.from,to:S.to},noun:w}),o(Dt,{filters:e,onToggle:q,onPriceMin:J,onPriceMax:Q,onInStockOnly:U,onPickType:X})]}),end:o(Zt,{value:e.sort,keys:Lt(u),labels:zt,onChange:Oe})}),te&&!R&&c("div",{role:"status",className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 border border-line px-4 py-3",children:[o("p",{className:"text-[14px] text-fg-dim",children:"We couldn't check your car just now — try again."}),o("button",{type:"button",onClick:Fe,className:"cursor-pointer bg-btn px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Try again"})]}),R?o("div",{className:"border border-dashed border-line p-10",children:o("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:d?w.many==="wheels"?V("No wheels in this website's catalog yet — curate products to see them here."):w.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."})}):Ye?te?null:c("div",{className:"border border-line p-10",children:[c("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",r.appliedName]}),o("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:G.nothingFits}),c("button",{type:"button",onClick:ee,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 ",w.many]})]}):S.total===0?c("div",{className:"border border-line p-10",children:[c("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",w.many," match those filters"]}),o("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),kt(e)&&o("button",{type:"button",onClick:Z,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"})]}):c(Wt,{value:{ownerId:K,ownerType:pe,Template:be,hover:Pe,imageSizes:Te,fieldUsage:oe,tyreFieldUsage:Ve,reserveEyebrow:je,editing:d,eyebrow:Ee,fit:r.fit,colours:e.finishes,setGridGap:`var(${le})`,rules:Yt},children:[o("style",{children:_e}),o("div",{className:`plp-card-grid ${$} ${gt} ${nt}`,style:{...Ce,...yt(`var(${le})`)},children:o($t,{items:S.items,tyreOf:t=>L(t)==="tyre"?t:null,tyreFit:t=>N.length>0?jt(t.sizes,N):null})})]}),o(Jt,{page:S.page,pageCount:S.pageCount,onPage:Ie}),o(lt,{editing:d})]})]})]})]})}export{Wo as PLP_GATE_DEFAULTS,lo as default};
@@ -3,14 +3,17 @@ import { type FacetRow } from "../../lib/content/facet-row-seed.js";
3
3
  import type { OptionCardRows } from "../../lib/sections/filter-option-rows.js";
4
4
  export type RailOwner = {
5
5
  id: string;
6
- facetTemplate?: SlotComponent;
6
+ facetTemplate: SlotComponent;
7
+ railTemplate: SlotComponent;
8
+ railHeadTemplate: SlotComponent;
7
9
  type?: string;
8
10
  };
11
+ export declare const RAIL_OWNER_TEMPLATES: readonly ["facetTemplate", "railTemplate", "railHeadTemplate"];
9
12
  export default function PlpFacetRows({ owner, rows, dead, label, className, editing, }: {
10
13
  owner: RailOwner;
11
14
  rows: OptionCardRows<FacetRow>;
12
15
  dead: readonly boolean[];
13
16
  label?: string;
14
- className: string;
17
+ className?: string;
15
18
  editing: boolean;
16
19
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as e}from"react/jsx-runtime";import{CardTemplateRows as m}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as c}from"efficient-web-builder/render/components/SiteGutterFrame";import{COPY_MARK as T}from"../../lib/content/copy-mark.js";import{FACET_TEMPLATE_SLOT as d,FACET_TICK as f,FACET_TICK_INK_CLASS as _,FACET_TICK_VAR as p}from"../../lib/content/facet-row-seed.js";import{ALLOY_WHEELS_LISTING_TYPE as C}from"../../lib/wheels/plp-hydrate.js";const A={[p]:`url("${f}")`},E="[--sf-card-lift:none] [--sf-card-shadow-hover:var(--sf-card-shadow,none)]";function I({owner:t,rows:a,dead:l,label:r,className:s,editing:i}){return e("ul",{className:`flex flex-col ${s} ${T} ${_} ${E}`,style:A,"aria-label":r,children:e(c,{children:e(m,{ownerId:t.id,ownerType:t.type??C,slot:d,Template:t.facetTemplate,rows:a.items,states:a.states,actions:i?void 0:a.actions,fallback:null,wrapCopy:(o,n)=>e("li",{className:l[n.index]?"-mx-3 opacity-40":"-mx-3",children:o}),children:o=>o})})})}export{I as default};
1
+ "use client";import{jsx as e}from"react/jsx-runtime";import{CARD_NO_LIFT_CLASS as p}from"efficient-web-builder/format/lib/content/box-background";import{CardTemplateRows as s}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as _}from"efficient-web-builder/render/components/SiteGutterFrame";import{COPY_MARK as c}from"../../lib/content/copy-mark.js";import{FACET_TEMPLATE_SLOT as n,FACET_TICK as f,FACET_TICK_INK_CLASS as C,FACET_TICK_VAR as d}from"../../lib/content/facet-row-seed.js";import{ALLOY_WHEELS_LISTING_TYPE as A}from"../../lib/document/document-nodes.js";const E={[d]:`url("${f}")`},N=["facetTemplate","railTemplate","railHeadTemplate"];function L({owner:t,rows:l,dead:o,label:r,className:i="",editing:m}){return e("ul",{className:`flex flex-col ${i} ${c} ${C} ${p}`,style:E,"aria-label":r,children:e(_,{children:e(s,{ownerId:t.id,ownerType:t.type??A,slot:n,Template:t.facetTemplate,rows:l.items,states:l.states,actions:m?void 0:l.actions,fallback:null,wrapCopy:(a,T)=>e("li",{className:o[T.index]?"-mx-3 opacity-40":"-mx-3",children:a}),children:a=>a})})})}export{N as RAIL_OWNER_TEMPLATES,L as default};
@@ -8,17 +8,12 @@ export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, fil
8
8
  key: K;
9
9
  })[];
10
10
  filters: PlpFilterState;
11
- typeOptions?: PlpTypeOption[];
12
- sizeBoxes?: PlpTyreSizeBox[] | null;
13
- sizeMatches?: number | null;
14
11
  noun: {
15
12
  one: string;
16
13
  many: string;
17
14
  };
18
15
  inStockCount: number | null;
19
16
  onToggle: (key: K, value: string) => void;
20
- onPickType?: (kind: ProductKind | null) => void;
21
- onPickSize?: (part: TyreSizePart, value: number | null) => void;
22
17
  onInStockOnly: (value: boolean) => void;
23
18
  onClearAll: () => void;
24
19
  price?: {
@@ -28,7 +23,7 @@ export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, fil
28
23
  foot?: ReactNode;
29
24
  owner: RailOwner;
30
25
  editing?: boolean;
31
- } & RailPrice): import("react").JSX.Element;
26
+ } & RailPrice & RailTypes & RailSizes): import("react").JSX.Element;
32
27
  type RailPrice = {
33
28
  priceBounds: {
34
29
  min: number;
@@ -41,4 +36,20 @@ type RailPrice = {
41
36
  onPriceMin?: undefined;
42
37
  onPriceMax?: undefined;
43
38
  };
39
+ type RailTypes = {
40
+ typeOptions: PlpTypeOption[];
41
+ onPickType: (kind: ProductKind | null) => void;
42
+ } | {
43
+ typeOptions?: undefined;
44
+ onPickType?: undefined;
45
+ };
46
+ type RailSizes = {
47
+ sizeBoxes: PlpTyreSizeBox[] | null;
48
+ sizeMatches?: number | null;
49
+ onPickSize: (part: TyreSizePart, value: number | null) => void;
50
+ } | {
51
+ sizeBoxes?: undefined;
52
+ sizeMatches?: undefined;
53
+ onPickSize?: undefined;
54
+ };
44
55
  export {};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as t}from"react/jsx-runtime";import T from"../catalog/ClearAllButton.js";import{useState as A}from"react";import{say as F}from"efficient-web-builder/format/lib/editor-words";import R from"../catalog/PriceRange.js";import{useEnglish as _}from"../EnglishVariant.js";import{facetRow as M}from"../../lib/content/facet-row-seed.js";import{optionCardRows as B}from"../../lib/sections/filter-option-rows.js";import{hasActivePlpFilters as I,isDeadPlpOption as u,PLP_FACET_LABELS as L}from"../../lib/wheels/plp-filters.js";import D from"./PlpFacetRows.js";import O from"./PlpInStockToggle.js";import G from"./PlpTypePicker.js";import H from"./PlpTyreSizeBoxes.js";function q({facets:s,filters:r,typeOptions:i=[],sizeBoxes:o=null,sizeMatches:N=null,noun:n,priceBounds:d,inStockCount:f,onToggle:P,onPickType:w,onPickSize:S,onPriceMin:C,onPriceMax:z,onInStockOnly:E,onClearAll:$,price:p,foot:h,owner:x,editing:b=!1}){const c=_(),[m,y]=A({});return t("aside",{className:"-mx-3 w-[calc(100%+1.5rem)] flex-none px-3 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-[292px] lg:overflow-y-auto lg:overscroll-contain lg:pr-[22px]",children:[t("div",{className:"flex items-center justify-between pb-2",children:[e("h2",{className:"font-display text-[18px] font-medium uppercase tracking-[-0.01em]",children:F("Filter")}),I(r)&&e(T,{onClick:$,size:"text-[11px]"})]}),i.length>0&&e("div",{className:"pb-1 pt-1",children:e(G,{options:i,noun:n.many,onPick:w??(()=>{}),owner:x,editing:b})}),f!==null&&e("div",{className:"border-t border-line py-2",children:e(O,{checked:r.inStockOnly,count:f,noun:n.many,onChange:E})}),o&&e(k,{label:c(L.tyreSizes),open:!m.tyreSizes,onToggle:()=>y(l=>({...l,tyreSizes:!l.tyreSizes})),children:!m.tyreSizes&&e("div",{className:"pb-3",children:e(H,{boxes:o,composed:r.tyreSizes[0]??"",matches:N,noun:n.many,onPick:S??(()=>{})})})}),s.map(l=>{if(l.options.length===0)return null;const g=!m[l.key],j=B(l.options,{item:a=>M(a,a.checked),selected:a=>a.checked,press:a=>()=>P(l.key,a.value),label:a=>`${c(l.label)}: ${a.label} (${a.count} ${n.many})`,disabled:u});return e(k,{label:c(l.label),open:g,onToggle:()=>y(a=>({...a,[l.key]:!a[l.key]})),children:g&&e(D,{owner:x,rows:j,dead:l.options.map(u),label:c(l.label),className:"pb-3",editing:b})},l.key)}),p?t("div",{className:"border-t border-line py-3",children:[e("span",{className:v,children:p.label}),e("div",{className:"mt-3",children:p.control})]}):d&&t("div",{className:"border-t border-line py-3",children:[t("span",{className:v,children:["Price · per ",n.one]}),e("div",{className:"mt-3",children:e(R,{bounds:d,min:r.priceMin,max:r.priceMax,onMin:C,onMax:z})})]}),h&&e("div",{className:"border-t border-line py-3",children:h})]})}const v="block font-mono text-[11px] uppercase leading-4 tracking-[0.2em]";function k({label:s,open:r,onToggle:i,children:o}){return t("div",{className:"border-t border-line",children:[t("button",{type:"button",onClick:i,"aria-expanded":r,"aria-label":`${r?"Collapse":"Expand"} ${s} 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:s}),e("span",{"aria-hidden":"true",className:`font-mono text-[10px] text-fg-dim transition-transform ${r?"rotate-180":""}`,children:"▾"})]}),o]})}export{q as default};
1
+ "use client";import{jsx as r,jsxs as p}from"react/jsx-runtime";import I from"../catalog/ClearAllButton.js";import{Fragment as k}from"react";import{AccordionRowStyleContext as C,BoxTabPaneContext as O}from"efficient-web-builder/render/components/BoxTabPaneContext";import{CardTemplateRows as T}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as v}from"efficient-web-builder/render/components/SiteGutterFrame";import M from"../catalog/PriceRange.js";import{useEnglish as D}from"../EnglishVariant.js";import{facetRow as $}from"../../lib/content/facet-row-seed.js";import{RAIL_END_PART as H,RAIL_HEAD_TEMPLATE_SLOT as j,RAIL_OPTIONS_PART as F,RAIL_TEMPLATE_SLOT as B,railRow as W}from"../../lib/content/rail-row-seed.js";import{optionCardRows as z}from"../../lib/sections/filter-option-rows.js";import{hasActivePlpFilters as G,isDeadPlpOption as y,PLP_FACET_LABELS as Y}from"../../lib/wheels/plp-filters.js";import{ALLOY_WHEELS_LISTING_TYPE as V}from"../../lib/document/document-nodes.js";import q,{RAIL_OWNER_TEMPLATES as J}from"./PlpFacetRows.js";import K from"./PlpInStockToggle.js";import Q from"./PlpTypePicker.js";import U from"./PlpTyreSizeBoxes.js";function X({facets:w,filters:i,typeOptions:c,sizeBoxes:m,sizeMatches:E=null,noun:n,priceBounds:h,inStockCount:f,onToggle:A,onPickType:b,onPickSize:g,onPriceMin:L,onPriceMax:N,onInStockOnly:R,onClearAll:S,price:d,foot:x,owner:o,editing:P=!1}){const s=D(),u=o.type??V;if(process.env.NODE_ENV!=="production"){for(const e of J)if(!o[e])throw new Error(`PlpSidebar: the rail owner "${o.id}" has no ${e}. A page seeds it on read; a host that draws the rail alone hands it.`)}const t=[];m&&g&&t.push({word:s(Y.tyreSizes),body:r(U,{boxes:m,composed:i.tyreSizes[0]??"",matches:E,noun:n.many,onPick:g})});for(const e of w){if(e.options.length===0)continue;const a=z(e.options,{item:l=>$(l,l.checked),selected:l=>l.checked,press:l=>()=>A(e.key,l.value),label:l=>`${s(e.label)}: ${l.label} (${l.count} ${n.many})`,disabled:y});t.push({word:s(e.label),body:r(q,{owner:o,rows:a,dead:e.options.map(y),label:s(e.label),editing:P})})}return p("aside",{className:"-mx-3 w-[calc(100%+1.5rem)] flex-none px-3 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-[292px] lg:overflow-y-auto lg:overscroll-contain lg:pr-[22px]",children:[r(v,{children:r(T,{ownerId:o.id,ownerType:u,slot:j,Template:o.railHeadTemplate,rows:Z,fallback:null,hostParts:(e,a)=>a===H&&G(i)?r(I,{onClick:S,size:"text-[11px]"}):null,children:e=>e})}),c&&c.length>0&&b&&r("div",{className:"pb-1 pt-1",children:r(Q,{options:c,noun:n.many,onPick:b,owner:o,editing:P})}),f!==null&&r("div",{className:"border-t border-line py-2",children:r(K,{checked:i.inStockOnly,count:f,noun:n.many,onChange:R})}),r(v,{children:r(T,{ownerId:o.id,ownerType:u,slot:B,Template:o.railTemplate,rows:t.map(e=>W(e.word)),fallback:null,hostParts:(e,a)=>a===F?t[e.index]?.body:null,wrapCopy:(e,a)=>r(k,{children:e},t[a.index]?.word),children:e=>r(O.Provider,{value:"accordion",children:r(C.Provider,{value:"chevron",children:e})})})}),d?p("div",{className:"border-t border-line py-3",children:[r("span",{className:_,children:d.label}),r("div",{className:"mt-3",children:d.control})]}):h&&p("div",{className:"border-t border-line py-3",children:[p("span",{className:_,children:["Price · per ",n.one]}),r("div",{className:"mt-3",children:r(M,{bounds:h,min:i.priceMin,max:i.priceMax,onMin:L,onMax:N})})]}),x&&r("div",{className:"border-t border-line py-3",children:x})]})}const _="block font-mono text-[11px] uppercase leading-4 tracking-[0.2em]",Z=[{}];export{X as default};
@@ -2,12 +2,13 @@ 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
4
  export declare function watchLocation(onChange: () => void): () => void;
5
+ export declare function useAddressQuery(stamped: string, follow: boolean): string;
5
6
  export interface PlpUrlFiltersArgs {
6
7
  editing: boolean;
7
8
  openingSort: PlpSortKey;
8
9
  appliedVehicle: VehicleSelection | null;
9
10
  vehicleRestored: boolean;
10
- requestQuery?: string;
11
+ addressQuery?: string;
11
12
  }
12
13
  export declare function filtersFromQuery(search: string, openingSort: PlpSortKey): PlpFilterState;
13
- export declare function usePlpFiltersInUrl({ editing, openingSort, appliedVehicle, vehicleRestored, requestQuery, }: PlpUrlFiltersArgs): [PlpFilterState, Dispatch<SetStateAction<PlpFilterState>>];
14
+ export declare function usePlpFiltersInUrl({ editing, openingSort, appliedVehicle, vehicleRestored, addressQuery, }: 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 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};
1
+ "use client";import{useEffect as u,useState as p}from"react";import{EMPTY_PLP_FILTERS as F,plpFilterQuery as L,plpFiltersFromParams as P,plpFiltersToParams as a}from"../../lib/wheels/plp-filters.js";import{appendVehicleParams as S}from"../../lib/wheels/plp-vehicle-params.js";const d="plp:locationchange";let m=!1;function y(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(...o){n.apply(this,o),window.dispatchEvent(new Event(d))}}}return window.addEventListener("popstate",t),window.addEventListener(d,t),()=>{window.removeEventListener("popstate",t),window.removeEventListener(d,t)}}function A(t,e){const[n,r]=p(null);return u(()=>{if(!e||typeof window>"u")return;const o=()=>r(L(window.location.search));return o(),y(o)},[e]),e&&n!==null?n:t}function h(t,e){const n=P(t);return a(n).toString()===""?{...F,sort:e}:n}function I({editing:t,openingSort:e,appliedVehicle:n,vehicleRestored:r,addressQuery:o}){const[c,w]=p(()=>h(t?"":o??"",e)),[f,E]=p(!1);return u(()=>{if(t||typeof window>"u")return;const s=()=>{const i=h(window.location.search,e);w(l=>a(l).toString()===a(i).toString()?l:i)};return s(),E(!0),y(s)},[t,e]),u(()=>{if(t||!f||!r||typeof window>"u")return;const s=a(c);S(s,n);const i=s.toString();window.history.replaceState(null,"",`${window.location.pathname}${i?`?${i}`:""}`)},[t,f,r,c,n]),[c,w]}export{h as filtersFromQuery,A as useAddressQuery,I as usePlpFiltersInUrl,y as watchLocation};
@@ -1 +1 @@
1
- import{PREVIEW_TOKEN_HEADER as ot,SITE_HOST_HEADER as it,SITE_SLUG_HEADER as ct}from"../site-headers.js";import{PRODUCT_API_BASE as dt,PRODUCT_BACKEND_URL as D}from"./origins.js";import{backendHopHeaders as ut,clientIpFromForwardedFor as lt,FORWARDED_FOR_HEADER as pt,hopCachingOf as yt}from"../forwarded-for.js";import ht from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as ft}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as E}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as x}from"../wheels/renderable-finishes.js";const gt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class w extends Error{status;data;constructor(e,s,n){super(s),this.status=e,this.data=n}}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.",mt=new Set([502,503,504]),N=0,wt="This editor runs on its host's own backend, which does not serve this request.",St=5e3,Pt=15e3,Ot=()=>typeof window>"u"?St:Pt;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(Ot())}const F=t=>t instanceof Error&&t.name==="TimeoutError",M=(t,e)=>mt.has(t)?I:e,bt=["admin","venue"];let B="admin";function ye(t){B=bt.includes(t)?t:"admin"}function At(){return B}const Tt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let q=null;function he(t){q=t&&Tt.test(t)?t:null}function Rt(){return q}function Et(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=V();return!e||/[?&]site=/.test(t)?t:$(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:n,headers:l,audience:p,...h}=e;if(typeof window<"u"&&!ft())throw new w(N,wt,null);if(typeof window>"u"&&n===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"&&h.body instanceof FormData;let a;try{a=await fetch(`${n??gt}${Et(t)}`,{...h,headers:{...r?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:h.signal??H({...h,audience:p})})}catch(y){throw y instanceof TypeError||F(y)?new w(N,I,null):y}let o;try{o=await a.text()}catch(y){throw F(y)?new w(N,I,null):y}let c=null;if(o)try{c=JSON.parse(o)}catch{throw new w(a.status,a.ok?"Expected JSON but received a non-JSON response":M(a.status,a.statusText),o)}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 w(a.status,y,c)}return c}let b=null;async function G(){return b||(b=$t().finally(()=>{b=null}),b)}async function $t(){const t=P.takeLegacyRefresh(),e=await Ut.refresh(t??void 0);return P.setTokens(e.access),e.access}async function W(){return P.getAccess()??G()}async function g(t,e={}){let s;try{s=await W()}catch{throw P.clear(),new w(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(n){if(!(n instanceof w)||n.status!==401)throw n;try{const l=await G();return await i(t,{...e,token:l})}catch{throw P.clear(),n}}}const Ct=100,j=20;function _t(t){if(!t)return null;try{return new URL(t,"http://page.invalid").searchParams.get("page")}catch{return null}}async function z(t,e){const[s,n=""]=t.split("?"),l=[];let p="1";for(let h=0;h<j&&p;h++){const r=new URLSearchParams(n);r.set("page_size",String(Ct)),p!=="1"&&r.set("page",p);const a=await g(`${s}?${r.toString()}`);l.push(...a.results),p=_t(a.next)}return p&&console.warn(`[${e}] stopped at ${j} pages (${l.length} rows); list may be truncated`),l}async function K(t,e={}){if(P.getAccess())try{return{data:await g(t,e),asShopper:!0}}catch(s){if(!(s instanceof w)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function X(){const t=await g("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new w(403,"This session is not valid for this shop.",null);return t}const Ut={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 X(),t},me:X,updateMe:t=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>g("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>g("/api/shop-portal/profile/"),updateMyProfile:t=>g("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>g("/api/shop-portal/delivery-locations/"),createAddress:t=>g("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>g(`/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:()=>g("/api/products/brands/"),myOrders:()=>z("/api/shop-portal/orders/","api.myOrders"),myOrder:t=>g(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>g(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>z(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`,"api.myReturns"),createReturn:t=>g("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>g(`/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"),g("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as It,absolutizeApiUrl as v}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Nt,isSvgUrl as vt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as kt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Lt,webRuntimeSiteSlug as V}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Jt}from"../sections/dealer-finder.js";function m(t){if(typeof t=="string")return t.startsWith("/media/")?It(t):t;if(Array.isArray(t))return t.map(m);if(t&&typeof t=="object"){const e={};for(const[s,n]of Object.entries(t))e[s]=s==="captions"&&n&&typeof n=="object"&&!Array.isArray(n)?Object.fromEntries(Object.entries(n).map(([l,p])=>[m(l),p])):m(n);return e}return t}import{PRODUCT_API_BASE as Ce}from"./origins.js";const Z=typeof window>"u"&&D!=="",Dt=Z?D:dt,xt=Lt,O=()=>({baseUrl:xt(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const Y=100,Q=50;function k(t,e,s){const n=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&n.set(l,String(p));return n.set("pageSize",String(Y)),s&&n.set("cursor",s),`/api/v1${t}?${n.toString()}`}function Ht(t,e){return k("/wheels",{process:t},e)}const tt=Y;function Ft(t,e){return k("/wheels",{slug:t.join(",")},e)}function Mt(t,e,s){return k("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function Bt(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,n=()=>!1){const l=[];let p=null;try{for(let h=0;h<Q;h++){const r=await i(await e(p),await u());if(l.push(...r.results),p=Bt(r.next),!p)break;if(n(l))return l}p&&console.warn(`[${t}] stopped at ${Q} pages (${l.length} rows); catalog may be truncated`)}catch(h){if(s(h))throw h;console.warn(`[${t}] product API unavailable, returning []`,h)}return l}const et=t=>t instanceof w&&t.status===400;function rt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?E([e]):[e])}async function at(){return(await qt()).host}async function qt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,n=s(e.get(it)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:n,matchesRequestHost:n!==null&&n===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Gt(){try{const{headers:t}=await import("next/headers");return lt((await t()).get(pt))}catch{return null}}async function Wt(){try{const{headers:t}=await import("next/headers");return(await t()).get(ct)||null}catch{return null}}async function jt(){const t=await Wt();if(t)return`site=${encodeURIComponent(t)}`;const e=await at();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=V();return e?$(t,`site=${encodeURIComponent(e)}`):t}return $(t,await jt())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const zt="preview";async function Kt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(ot)}catch{return null}}async function Xt(){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 Kt();if(s===null)return[await f(t),await u(e)];const n=$(await f(t),`${zt}=${encodeURIComponent(s)}`),{next:l,cache:p,...h}=e??{},r=await u({...h,cache:"no-store"}),a=await Xt();return a&&(r.headers={...r.headers,"user-agent":a}),[n,r]}async function Vt(t){if(!Z)return;const[e,s]=await Promise.all([at(),Gt()]),n=ut(e,s,t);return Object.keys(n).length>0?n:void 0}async function u(t){const e=await Vt(yt(t)),s={baseUrl:Dt,...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 n=s.toString();return`/api/v1/fitment${t}${n?`?${n}`:""}`}const Pe={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:n}=await import("./fitment-data.js");return n.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,n)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,n)}return(await i(T("/modifications",{make:t,model:e,year:s,region:n}),O())).results},getStockFitment:async(t,e,s,n,l)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,n,l)}return i(T("/stock-fitment",{make:t,model:e,year:s,modification:n,region:l}),O())}},Oe={listWheels:async(t,e={})=>{const s=await L("products.listWheels",async n=>await f(Ht(t,n)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:n=>E([...n]).length>=e.maxRows);return E(m(s))},listWheelsBySlug:async(t,e={})=>{const s=[...new Set(t.map(r=>r.trim()).filter(Boolean))];if(s.length===0)return[];const n=[];for(let r=0;r<s.length;r+=tt)n.push(s.slice(r,r+tt));const l=await Promise.all(n.map(r=>L("products.listWheelsBySlug",async a=>await f(Ft(r,a)),e.throwOnFailure?()=>!0:et))),p=new Set(s),h=l.flat().filter(r=>p.has(r.slug));return E(m(h))},listCatalog:async(t,e,s={})=>{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 n=await L("products.listCatalog",async l=>await f(Mt(t,e,l)),s.throwOnFailure?()=>!0:et,s.maxRows===void 0?void 0:l=>rt([...l]).length>=s.maxRows);return rt(m(n))},getWheel:async t=>x(m(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>m(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:n}=await import("./gallery-builds-data.js");return m(n(e,s))}try{const n=new URLSearchParams;e&&n.set("process",e),s&&n.set("wheelSlug",s);const l=n.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,O());return m(p.results)}catch(n){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",n),[]}},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()=>m(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 w&&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 w&&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 w&&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)}`:"",[n,l]=await J(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return m(await i(n,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(n){if(e)throw n;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",n),[]}},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=>g(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"),n=e.toString();try{return await i(await f(n?`${s}?${n}`: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 K(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await K(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 n=null,l=null;if(s&&vt(s)){const p=await Nt(s,t);p&&(n=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:n,logoInkIsDark:l}},getThemeSettings:async()=>i(...await J(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},be={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 Zt 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 n=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${n?`?${n}`:""}`},_=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,Yt=t=>`${_(t)}currencies/`,Qt="/api/storefront/media/ingest/";class te 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 ee(){const t=kt();if(!t)throw new te;return`${Qt}?${new URLSearchParams({site:t})}`}const re="X-Puck-Media-Manifest",st=ht.contentHash,U={"X-Media-Manifest":st,[re]:st},Ae=nt({});function nt(t){return(e,s={})=>{const n=Rt(),l=t.headers||n?{...n?{"Accept-Language":n}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??At()})}}function ae(t={}){const e=nt(t),s=t.siteDrafts===!0,n=r=>C("header-settings",r,s),l=r=>C("theme-settings",r,s),p=r=>C("chat-settings",r,s),h=r=>C("social-settings",r,s);return{findPageBySlug:async(r,a,o)=>{const c=new URLSearchParams({slug:r});o&&c.set("site",o);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:a}),S=Array.isArray(y)?y:y.results??[];if(!o&&S.length>1)throw new Zt(r,S.length);return S[0]??null},getPageById:(r,a)=>e(`/api/storefront/pages/${r}/`,{token:a}),saveLayout:(r,a,o,c,y)=>e(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a,expected_updated_at:c,...y?{client_id:y}:{}}),token:o}),duplicatePage:(r,a,o)=>e(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:a.title,slug:a.slug}),token:o}),geocode:(r,a,o)=>e(`/api/storefront/geocode/?${new URLSearchParams(o?{q:r,country:o}:{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,o,c=!1)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:c}),token:a}),releasePageEditLock:(r,a)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:a}),createTemplate:(r,a,o)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:a}),headers:U,token:o}),getTemplate:(r,a)=>e(`/api/storefront/page-templates/${r}/`,{token:a}),saveTemplateLayout:(r,a,o)=>e(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:U,token:o}),listTemplatePages:async(r,a)=>{const o=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:a});return Array.isArray(o)?o:o.results??[]},findTemplatePageBySlug:async(r,a,o)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(a)}`,{token:o});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(r,a,o)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...a}),headers:U,token:o}),saveTemplatePageLayout:(r,a,o)=>e(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:U,token:o}),deleteTemplatePage:(r,a,o)=>e(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:a,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(r,a)=>{const o=new URLSearchParams({no_page:"true"});a&&o.set("site",a);const c=await e(`/api/storefront/pages/?${o.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},createPage:(r,a,o,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:a,layout:o}),token:c}),deletePage:(r,a)=>e(`/api/storefront/pages/${r}/`,{method:"DELETE",token:a}),getHeaderSettings:(r,a)=>e(n(a),{token:r}),listMenus:async(r,a)=>{const o=new URLSearchParams({no_page:"true"});a&&o.set("site",a);const c=await e(`/api/storefront/menus/?${o}`,{token:r});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(r,a={})=>{const o=new URLSearchParams({no_page:"true"});a.visibleOnly&&o.set("is_visible","true"),a.siteId&&o.set("site",a.siteId);const c=await e(`/api/storefront/blog-posts/?${o.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(r,a)=>{const o=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(a)}`,{token:r});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(r,a={})=>{const o=new URLSearchParams({no_page:"true"});a.visibleOnly&&o.set("is_visible","true"),a.siteId&&o.set("site",a.siteId);const c=await e(`/api/storefront/categories/?${o.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 o=new URLSearchParams({no_page:"true"});a.siteId&&o.set("site",a.siteId);const c=await e(`/api/storefront/forms/?${o.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.title.localeCompare(R.title))},listWheelSummaries:async(r,a={})=>{const o=new URLSearchParams;a.siteId&&o.set("site",a.siteId);const c=o.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:r});return m(y)},listProducts:async(r,a={})=>{const o=new URLSearchParams;a.kinds?.length&&o.set("kind",a.kinds.join(",")),a.siteId&&o.set("site",a.siteId);const c=o.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:r});return m(y)},getWheelDetail:async(r,a,o={})=>{const c=new URLSearchParams({slug:a});return o.siteId&&c.set("site",o.siteId),x(m(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:r})))},updateHeaderSettings:(r,a,o)=>e(n(o),{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 o=await e(Yt(r),{token:a});return Array.isArray(o)?o:[]},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,o)=>e(l(o),{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,o)=>e(p(o),{method:"PATCH",body:JSON.stringify(r),token:a}),getSocialSettings:(r,a)=>e(h(a),{token:r}),updateSocialSettings:(r,a,o)=>e(h(o),{method:"PATCH",body:JSON.stringify(r),token:a}),uploadHeaderLogo:(r,a,o)=>{const c=new FormData;return c.append("logo",r),e(n(o),{method:"PATCH",body:c,token:a})},clearHeaderLogo:(r,a)=>e(n(a),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,a,o)=>e(n(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:a}),uploadMedia:async(r,a)=>{const o=new FormData;return o.append("file",r),e(ee(),{method:"POST",body:o,token:a})},listMedia:async(r,a)=>{const o=new URLSearchParams({no_page:"true"});a&&o.set("kind",a);const c=await e(`/api/storefront/media-assets/?${o.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]}}}const Te=ae({siteDrafts:!0});function se(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function Re(t){return Jt(await i(se(t)))}export{gt as API_URL,Zt as AmbiguousPageSlugError,w as ApiError,Pt as BROWSER_READ_TIMEOUT_MS,wt as EFFICIENT_CLIENT_CLOSED_MESSAGE,te as MediaUploadDestinationError,zt as PREVIEW_PARAM,Ce as PRODUCT_API_BASE,St as SERVER_READ_TIMEOUT_MS,I as SERVER_UNREACHABLE_MESSAGE,N as STATUS_NETWORK_ERROR,Ae as adminFetch,Ut as api,i as apiFetch,$ as appendSiteQuery,be as bookings,ae as createStorefrontAdmin,se as dealersPath,H as defaultRequestDeadline,ee as editorMediaUploadPath,At as editorPortalAudience,Rt as editorRequestLanguage,Re as fetchDealers,Pe as fitment,Oe as products,Ot as readDeadlineMs,Gt as resolveClientIp,m as resolveMediaUrls,Kt as resolvePreviewToken,at as resolveSiteHost,qt as resolveSiteHostSource,Wt as resolveSiteSlug,he as setEditorLanguage,ye as setEditorPortalAudience,Te as storefrontAdmin};
1
+ import{PREVIEW_TOKEN_HEADER as it,SITE_HOST_HEADER as ct,SITE_SLUG_HEADER as dt}from"../site-headers.js";import{PRODUCT_API_BASE as ut,PRODUCT_BACKEND_URL as x}from"./origins.js";import{listRows as m}from"./list-rows.js";import{backendHopHeaders as lt,clientIpFromForwardedFor as pt,FORWARDED_FOR_HEADER as yt,hopCachingOf as ht}from"../forwarded-for.js";import ft from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as O}from"../auth.js";import{efficientClientOpen as gt}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as $}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as H}from"../wheels/renderable-finishes.js";const mt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class S extends Error{status;data;constructor(e,n,s){super(n),this.status=e,this.data=s}}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.",wt=new Set([502,503,504]),v=0,St="This editor runs on its host's own backend, which does not serve this request.",Pt=5e3,Ot=15e3,bt=()=>typeof window>"u"?Pt:Ot;function F(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(bt())}const M=t=>t instanceof Error&&t.name==="TimeoutError",B=(t,e)=>wt.has(t)?N:e,Tt=["admin","venue"];let q="admin";function fe(t){q=Tt.includes(t)?t:"admin"}function Rt(){return q}const At=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let G=null;function ge(t){G=t&&At.test(t)?t:null}function Et(){return G}function $t(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=Z();return!e||/[?&]site=/.test(t)?t:C(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:n,baseUrl:s,headers:u,audience:l,...y}=e;if(typeof window<"u"&&!gt())throw new S(v,St,null);if(typeof window>"u"&&s===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 a=typeof FormData<"u"&&y.body instanceof FormData;let r;try{r=await fetch(`${s??mt}${$t(t)}`,{...y,headers:{...a?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...u},signal:y.signal??F({...y,audience:l})})}catch(h){throw h instanceof TypeError||M(h)?new S(v,N,null):h}let o;try{o=await r.text()}catch(h){throw M(h)?new S(v,N,null):h}let p=null;if(o)try{p=JSON.parse(o)}catch{throw new S(r.status,r.ok?"Expected JSON but received a non-JSON response":B(r.status,r.statusText),o)}if(!r.ok){const h=(p&&typeof p=="object"&&"detail"in p&&typeof p.detail=="string"?p.detail:null)??B(r.status,r.statusText);throw new S(r.status,h,p)}return p}let T=null;async function W(){return T||(T=Ct().finally(()=>{T=null}),T)}async function Ct(){const t=O.takeLegacyRefresh(),e=await It.refresh(t??void 0);return O.setTokens(e.access),e.access}async function j(){return O.getAccess()??W()}async function g(t,e={}){let n;try{n=await j()}catch{throw O.clear(),new S(401,"Not signed in",null)}try{return await i(t,{...e,token:n})}catch(s){if(!(s instanceof S)||s.status!==401)throw s;try{const u=await W();return await i(t,{...e,token:u})}catch{throw O.clear(),s}}}const _t=100,z=20;function Ut(t){if(!t)return null;try{return new URL(t,"http://page.invalid").searchParams.get("page")}catch{return null}}async function K(t,e){const[n,s=""]=t.split("?"),u=[];let l="1";for(let y=0;y<z&&l;y++){const a=new URLSearchParams(s);a.set("page_size",String(_t)),l!=="1"&&a.set("page",l);const r=await g(`${n}?${a.toString()}`);u.push(...m(r)),l=Ut(r.next)}return l&&console.warn(`[${e}] stopped at ${z} pages (${u.length} rows); list may be truncated`),u}async function X(t,e={}){if(O.getAccess())try{return{data:await g(t,e),asShopper:!0}}catch(n){if(!(n instanceof S)||n.status!==401)throw n}return{data:await i(t,e),asShopper:!1}}async function V(){const t=await g("/api/auth/me/");if(t.portal!=="shop")throw O.clear(),new S(403,"This session is not valid for this shop.",null);return t}const It={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()=>{O.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await j();return await V(),t},me:V,updateMe:t=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>g("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>g("/api/shop-portal/profile/"),updateMyProfile:t=>g("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>g("/api/shop-portal/delivery-locations/"),createAddress:t=>g("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>g(`/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,n)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:n})}),brands:()=>g("/api/products/brands/"),myOrders:()=>K("/api/shop-portal/orders/","api.myOrders"),myOrder:t=>g(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>g(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>K(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`,"api.myReturns"),createReturn:t=>g("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>g(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const n=new FormData;return n.append("claim_item",t),n.append("file",e),n.append("media_type",e.type.startsWith("video/")?"video":"image"),g("/api/shop-portal/return-media/",{method:"POST",body:n})}};import{media as Nt,absolutizeApiUrl as k}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as vt,isSvgUrl as kt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Lt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Jt,webRuntimeSiteSlug as Z}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Dt}from"../sections/dealer-finder.js";function w(t){if(typeof t=="string")return t.startsWith("/media/")?Nt(t):t;if(Array.isArray(t))return t.map(w);if(t&&typeof t=="object"){const e={};for(const[n,s]of Object.entries(t))e[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([u,l])=>[w(u),l])):w(s);return e}return t}import{PRODUCT_API_BASE as Ue}from"./origins.js";const Y=typeof window>"u"&&x!=="",xt=Y?x:ut,Ht=Jt,b=()=>({baseUrl:Ht(),audience:null});function c(t,e){const n=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${n}`}const Q=100,tt=50;function L(t,e,n){const s=new URLSearchParams;for(const[u,l]of Object.entries(e))l!=null&&l!==""&&s.set(u,String(l));return s.set("pageSize",String(Q)),n&&s.set("cursor",n),`/api/v1${t}?${s.toString()}`}function Ft(t,e){return L("/wheels",{process:t},e)}const et=Q;function Mt(t,e){return L("/wheels",{slug:t.join(",")},e)}function Bt(t,e,n){return L("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},n)}function qt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function J(t,e,n=()=>!1,s=()=>!1){const u=[];let l=null;try{for(let y=0;y<tt;y++){const a=await i(await e(l),await d());if(u.push(...m(a)),l=qt(a.next),!l)break;if(s(u))return u}l&&console.warn(`[${t}] stopped at ${tt} pages (${u.length} rows); catalog may be truncated`)}catch(y){if(n(y))throw y;console.warn(`[${t}] product API unavailable, returning []`,y)}return u}const at=t=>t instanceof S&&t.status===400;function rt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?$([e]):[e])}async function nt(){return(await Gt()).host}async function Gt(){try{const{headers:t}=await import("next/headers"),e=await t(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(e.get(ct)??e.get("x-forwarded-host")??e.get("host")),u=n(e.get("host"));return{host:s,matchesRequestHost:s!==null&&s===u}}catch{return{host:null,matchesRequestHost:!1}}}async function Wt(){try{const{headers:t}=await import("next/headers");return pt((await t()).get(yt))}catch{return null}}async function jt(){try{const{headers:t}=await import("next/headers");return(await t()).get(dt)||null}catch{return null}}async function zt(){const t=await jt();if(t)return`site=${encodeURIComponent(t)}`;const e=await nt();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=Z();return e?C(t,`site=${encodeURIComponent(e)}`):t}return C(t,await zt())}function C(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Kt="preview";async function Xt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(it)}catch{return null}}async function Vt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function D(t,e){const n=await Xt();if(n===null)return[await f(t),await d(e)];const s=C(await f(t),`${Kt}=${encodeURIComponent(n)}`),{next:u,cache:l,...y}=e??{},a=await d({...y,cache:"no-store"}),r=await Vt();return r&&(a.headers={...a.headers,"user-agent":r}),[s,a]}async function Zt(t){if(!Y)return;const[e,n]=await Promise.all([nt(),Wt()]),s=lt(e,n,t);return Object.keys(s).length>0?s:void 0}async function d(t){const e=await Zt(ht(t)),n={baseUrl:xt,...t};return e&&(n.headers={...e,...t?.headers}),n}const R=typeof window>"u";function A(t,e){const n=new URLSearchParams;for(const[u,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(u,String(l));const s=n.toString();return`/api/v1/fitment${t}${s?`?${s}`:""}`}const be={listMakes:async t=>{if(R){const{fitmentData:n}=await import("./fitment-data.js");return n.makes(t)}const e=await i(A("/makes",{region:t}),b());return m(e)},listModels:async(t,e)=>{if(R){const{fitmentData:s}=await import("./fitment-data.js");return s.models(t,e)}const n=await i(A("/models",{make:t,region:e}),b());return m(n)},listYears:async(t,e,n)=>{if(R){const{fitmentData:u}=await import("./fitment-data.js");return u.years(t,e,n)}const s=await i(A("/years",{make:t,model:e,region:n}),b());return m(s)},listModifications:async(t,e,n,s)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.modifications(t,e,n,s)}const u=await i(A("/modifications",{make:t,model:e,year:n,region:s}),b());return m(u)},getStockFitment:async(t,e,n,s,u)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.stockFitment(t,e,n,s,u)}return i(A("/stock-fitment",{make:t,model:e,year:n,modification:s,region:u}),b())}},Te={listWheels:async(t,e={})=>{const n=await J("products.listWheels",async s=>await f(Ft(t,s)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:s=>$([...s]).length>=e.maxRows);return $(w(n))},listWheelsBySlug:async(t,e={})=>{const n=[...new Set(t.map(a=>a.trim()).filter(Boolean))];if(n.length===0)return[];const s=[];for(let a=0;a<n.length;a+=et)s.push(n.slice(a,a+et));const u=await Promise.all(s.map(a=>J("products.listWheelsBySlug",async r=>await f(Mt(a,r)),e.throwOnFailure?()=>!0:at))),l=new Set(n),y=u.flat().filter(a=>l.has(a.slug));return $(w(y))},listCatalog:async(t,e,n={})=>{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 u=>await f(Bt(t,e,u)),n.throwOnFailure?()=>!0:at,n.maxRows===void 0?void 0:u=>rt([...u]).length>=n.maxRows);return rt(w(s))},getWheel:async t=>H(w(await i(await f(c(`/wheels/${t}`)),await d()))),getTyre:async t=>w(await i(await f(c(`/tyres/${t}`)),await d())),listBundles:async(t={})=>{try{return await i(await f(c("/bundles")),await d())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(c(`/bundles/${t}`)),await d()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:n=null}=t;if(typeof window>"u"){const{listGalleryBuilds:s}=await import("./gallery-builds-data.js");return w(s(e,n))}try{const s=new URLSearchParams;e&&s.set("process",e),n&&s.set("wheelSlug",n);const u=s.toString(),l=await i(`/api/v1/gallery-builds${u?`?${u}`:""}`,b());return w(m(l))}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>i(await f(c("/site")),await d()),getSiteBySlug:async t=>i(`${c("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await d():void 0),listPages:async()=>w(await i(await f(c("/pages")),await d())),listPopups:async()=>i(await f(c("/popups")),await d()),listProductTemplates:async()=>{try{return await i(await f(c("/product-templates")),await d())}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(`${c("/dynamic-pages")}${e}`),await d())}catch(n){if(n instanceof S&&n.status===404)return[];throw n}},getRecord:async(t,e)=>{try{return await i(await f(c(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await d())}catch(n){if(n instanceof S&&n.status===404)return null;throw n}},listRecordKeys:async t=>{try{const e=await i(await f(c(`/records/${encodeURIComponent(t)}`)),await d({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(e){if(e instanceof S&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(c("/product-type-choices")),await d())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(c("/field-usage")),await d())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const n=e.record?`?record=${encodeURIComponent(e.record)}`:"",[s,u]=await D(c(`/pages/${t}`)+n,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return w(await i(s,u))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const n=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(c("/blog-posts")+n,await d())).map(u=>({...u,coverImage:k(u.coverImage)??""}))}catch(s){if(e)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(c(`/blog-posts/${t}`),await d());return{...e,coverImage:k(e.coverImage)??""}},createOrder:async t=>i(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>g(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(c("/orders/lookup"),await d({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(c("/payments/intent"),await d({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(c("/checkouts/release"),await d({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(c("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(c("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(c("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(c("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(c("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(c("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(c("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(c("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(c("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(c("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(c("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(c("/stock-alerts"),await d({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(c("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(c("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(c("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(c("/carts"),await d({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(c("/carts/restore"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(c("/carts/unsubscribe"),await d({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 n=c("/reviews"),s=e.toString();try{return await i(await f(s?`${n}?${s}`:n),await d())}catch(u){return console.warn("[products.listReviews] product API unavailable, returning []",u),[]}},submitReview:async t=>i(c("/reviews"),await d({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(c(`/forms/${encodeURIComponent(t)}`),await d()),submitForm:async(t,e)=>i(c(`/forms/${encodeURIComponent(t)}/submissions`),await d({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(c("/shipping-methods"),await d())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(c(`/countries/${encodeURIComponent(t)}/subdivisions`),await d())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=c("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await X(e,n)).data:i(e,n)},validateCoupon:async t=>{const{data:e,asShopper:n}=await X(c("/coupons/validate"),await d({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:n}},getHeaderSettings:async()=>{const t=F({method:"GET"}),e=await i(...await D(c("/header-settings"),{signal:t})),n=k(e.logoUrl);let s=null,u=null;if(n&&kt(n)){const l=await vt(n,t);l&&(s=l.reversed,u=l.inkIsDark)}return{...e,logoUrl:n,logoReversed:s,logoInkIsDark:u}},getThemeSettings:async()=>i(...await D(c("/theme-settings"))),getChatSettings:async()=>i(await f(c("/chat-settings")),await d())},Re={listServices:async()=>{try{return await i(c("/bookings/services"),await d())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(c(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await d()),create:async t=>i(c("/bookings"),await d({method:"POST",body:JSON.stringify(t)})),get:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}`),await d()),cancel:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await d({method:"POST"})),createPaymentIntent:async t=>i(c("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:t})}))};class Yt extends Error{slug;count;constructor(e,n){super(`Slug "${e}" exists on ${n} websites; a site is required to pick one.`),this.slug=e,this.count=n,this.name="AmbiguousPageSlugError"}}const _=(t,e,n)=>{const s=new URLSearchParams({...e?{site:e}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${s?`?${s}`:""}`},U=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,Qt=t=>`${U(t)}currencies/`,te="/api/storefront/media/ingest/";class ee 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 ae(){const t=Lt();if(!t)throw new ee;return`${te}?${new URLSearchParams({site:t})}`}const re="X-Puck-Media-Manifest",st=ft.contentHash,I={"X-Media-Manifest":st,[re]:st},Ae=ot({});function ot(t){return(e,n={})=>{const s=Et(),u=t.headers||s?{...s?{"Accept-Language":s}:{},...t.headers,...n.headers}:void 0;return i(e,{...n,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...u?{headers:u}:{},audience:t.audience??Rt()})}}function ne(t={}){const e=ot(t),n=t.siteDrafts===!0,s=a=>_("header-settings",a,n),u=a=>_("theme-settings",a,n),l=a=>_("chat-settings",a,n),y=a=>_("social-settings",a,n);return{findPageBySlug:async(a,r,o)=>{const p=new URLSearchParams({slug:a});o&&p.set("site",o);const h=await e(`/api/storefront/pages/?${p.toString()}`,{token:r}),P=m(h);if(!o&&P.length>1)throw new Yt(a,P.length);return P[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,o,p,h)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:p,...h?{client_id:h}:{}}),token:o}),duplicatePage:(a,r,o)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:o}),geocode:(a,r,o)=>e(`/api/storefront/geocode/?${new URLSearchParams(o?{q:a,country:o}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,o,p=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:p}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,o)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:I,token:o}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,o)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),listTemplatePages:async(a,r)=>{const o=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return m(o)},findTemplatePageBySlug:async(a,r,o)=>{const p=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:o});return m(p)[0]??null},createTemplatePage:(a,r,o)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:I,token:o}),saveTemplatePageLayout:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),deleteTemplatePage:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/pages/?${o.toString()}`,{token:a});return m(p)},createPage:(a,r,o,p)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:o}),token:p}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(s(r),{token:a}),listMenus:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/menus/?${o}`,{token:a});return m(p)},listBlogPosts:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/blog-posts/?${o.toString()}`,{token:a});return m(p)},listFieldUsage:async(a,r)=>{const o=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/categories/?${o.toString()}`,{token:a});return[...m(p)].sort((P,E)=>P.sort_order-E.sort_order||P.name.localeCompare(E.name))},listForms:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/forms/?${o.toString()}`,{token:a});return[...m(p)].sort((P,E)=>P.title.localeCompare(E.title))},listWheelSummaries:async(a,r={})=>{const o=new URLSearchParams;r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/wheel-curations/summaries/${p?`?${p}`:""}`,{token:a});return w(h)},listProducts:async(a,r={})=>{const o=new URLSearchParams;r.kinds?.length&&o.set("kind",r.kinds.join(",")),r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/products/${p?`?${p}`:""}`,{token:a});return w(h)},getWheelDetail:async(a,r,o={})=>{const p=new URLSearchParams({slug:r});return o.siteId&&p.set("site",o.siteId),H(w(await e(`/api/storefront/wheel-curations/detail/?${p.toString()}`,{token:a})))},updateHeaderSettings:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(U(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return m(r)},listSiteCurrencies:async(a,r)=>{const o=await e(Qt(a),{token:r});return Array.isArray(o)?o:[]},publishSite:(a,r)=>e(`${U(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${U(a)}live-state/`,{token:r}),getThemeSettings:(a,r)=>e(u(r),{token:a}),updateThemeSettings:(a,r,o)=>e(u(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getMyPreferences:async a=>(await e("/api/auth/me/",{token:a})).preferences??{},updateMyPreferences:(a,r)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:a}),token:r}),getChatSettings:(a,r)=>e(l(r),{token:a}),updateChatSettings:(a,r,o)=>e(l(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(y(r),{token:a}),updateSocialSettings:(a,r,o)=>e(y(o),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,o)=>{const p=new FormData;return p.append("logo",a),e(s(o),{method:"PATCH",body:p,token:r})},clearHeaderLogo:(a,r)=>e(s(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const o=new FormData;return o.append("file",a),e(ae(),{method:"POST",body:o,token:r})},listMedia:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("kind",r);const p=await e(`/api/storefront/media-assets/?${o.toString()}`,{token:a});return m(p)}}}const Ee=ne({siteDrafts:!0});function se(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function $e(t){return Dt(await i(se(t)))}export{mt as API_URL,Yt as AmbiguousPageSlugError,S as ApiError,Ot as BROWSER_READ_TIMEOUT_MS,St as EFFICIENT_CLIENT_CLOSED_MESSAGE,ee as MediaUploadDestinationError,Kt as PREVIEW_PARAM,Ue as PRODUCT_API_BASE,Pt as SERVER_READ_TIMEOUT_MS,N as SERVER_UNREACHABLE_MESSAGE,v as STATUS_NETWORK_ERROR,Ae as adminFetch,It as api,i as apiFetch,C as appendSiteQuery,Re as bookings,ne as createStorefrontAdmin,se as dealersPath,F as defaultRequestDeadline,ae as editorMediaUploadPath,Rt as editorPortalAudience,Et as editorRequestLanguage,$e as fetchDealers,be as fitment,Te as products,bt as readDeadlineMs,Wt as resolveClientIp,w as resolveMediaUrls,Xt as resolvePreviewToken,nt as resolveSiteHost,Gt as resolveSiteHostSource,jt as resolveSiteSlug,ge as setEditorLanguage,fe as setEditorPortalAudience,Ee as storefrontAdmin};
@@ -0,0 +1,3 @@
1
+ export declare function listRows<T>(data: T[] | {
2
+ results?: T[];
3
+ } | null | undefined): T[];
@@ -0,0 +1 @@
1
+ function s(r){return Array.isArray(r)?r:r?.results??[]}export{s as listRows};