efficient-storefront-blocks 0.98.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/chunks/{EditorPreviewCheckout-2FW4VEOK.js → EditorPreviewCheckout-J76THKIJ.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-LW5QSBKM.js → SiteEditorProvider-YAIB64UV.js} +1 -1
- package/dist/chunks/chunk-EIBYUCDE.js +1 -0
- package/dist/chunks/chunk-GOVYQQA4.js +1 -0
- package/dist/chunks/{chunk-4QN263UJ.js → chunk-KRMWJLBM.js} +2 -2
- package/dist/chunks/{fitment-data-BRGBDG7Y.js → fitment-data-OUHMES66.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SearchBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/BookingBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBox/fields.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/popup-look-fields.d.ts +1 -0
- package/dist/editor/lib/document/popup-look-fields.js +1 -1
- package/dist/editor/lib/document/text-kind-style-rows.d.ts +5 -0
- package/dist/editor/lib/document/text-kind-style-rows.js +1 -0
- package/dist/editor/lib/storefront-editor-words.d.ts +3 -2
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +31 -31
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +136 -12
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CatalogFilterBarSection.js +1 -1
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/CurrencyContext.d.ts +3 -0
- package/dist/render/components/CurrencyContext.js +1 -1
- package/dist/render/components/FooterMenu.d.ts +5 -3
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FormBlock.d.ts +4 -1
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/HeaderToolBlocks.d.ts +4 -2
- package/dist/render/components/HeaderToolBlocks.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +7 -2
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/PhoneSheet.d.ts +16 -0
- package/dist/render/components/PhoneSheet.js +1 -0
- package/dist/render/components/PreOrderPanel.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/SectionGroupBody.d.ts +2 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/Subscribe.d.ts +1 -0
- package/dist/render/components/Subscribe.js +1 -1
- package/dist/render/components/catalog/CatalogFilterBar.d.ts +5 -1
- package/dist/render/components/catalog/CatalogFilterBar.js +1 -1
- package/dist/render/components/catalog/CatalogFilterContext.d.ts +2 -0
- package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/PriceRange.d.ts +6 -1
- package/dist/render/components/catalog/PriceRange.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/fitment/PickerField.js +1 -1
- package/dist/render/components/formSubmission.d.ts +4 -2
- package/dist/render/components/formSubmission.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +0 -3
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicWheelDiagram.js +1 -1
- package/dist/render/components/submit/SubmitRegions.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.d.ts +2 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +15 -7
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.d.ts +6 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.js +1 -1
- package/dist/render/lib/api/index.d.ts +1 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/booking/text-kinds.js +1 -1
- package/dist/render/lib/content/article-page-seed.js +1 -1
- package/dist/render/lib/content/menu-row.d.ts +16 -0
- package/dist/render/lib/content/menu-row.js +1 -1
- package/dist/render/lib/content/text-kind-vars.d.ts +4 -0
- package/dist/render/lib/content/text-kind-vars.js +1 -0
- package/dist/render/lib/document/blocks/commerce/SearchBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/service/SiteHeader/render.js +1 -1
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -1
- package/dist/render/lib/popup/text-kind-style.js +1 -1
- package/dist/render/lib/submit/text-kinds.js +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.d.ts +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.js +1 -1
- package/dist/render/lib/wheels/plp-filters.d.ts +5 -0
- package/dist/render/lib/wheels/plp-filters.js +1 -1
- package/dist/render/lib/wheels/wheel-sheet.d.ts +3 -0
- package/dist/render/lib/wheels/wheel-sheet.js +1 -0
- package/dist/words.d.ts +3 -2
- package/dist/words.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/chunk-PWSMCGXO.js +0 -1
- package/dist/chunks/chunk-SEIKSSUW.js +0 -1
- /package/dist/chunks/{chunk-XEZ7BYVZ.js → chunk-B2IYTOE3.js} +0 -0
- /package/dist/chunks/{chunk-4QN263UJ.js.LEGAL.txt → chunk-KRMWJLBM.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-GOHV3G3C.js → chunk-QP2F42DV.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as p,Fragment as $e}from"react/jsx-runtime";import{useScopeClass as He}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as Ye,useMemo as i,useRef as qe,useState as Je}from"react";import{cardHoverOf as Qe}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as Ue}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as Xe}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as Ze,answersForKind as ne}from"../../lib/content/field-usage.js";import{useCurrency as et}from"../CurrencyContext.js";import tt from"../NoCurrencyNote.js";import{usePreviewDevice as ot}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as rt,renderHeadline as nt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as st}from"../useProductCatalog.js";import{scrollBehavior as it}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as lt,PLP_GRID_GAP_VAR as se,plpGridVars as at}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as ct}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as pt,cardRowsGridStyle as mt}from"../WheelCardFrame.js";import{applyPlpFilters as dt,buildPlpFacets as ut,buildPlpTypeOptions as ht,buildTyreSizeBoxes as ft,EMPTY_PLP_FILTERS as ie,hasActivePlpFilters as gt,paginatePlp as yt,pickTyreSize as St,plpTyreSizeBoxesShown as xt,plpInStockCount as wt,plpOpeningSort as bt,plpPriceBounds as vt,plpShownKinds as Pt,plpSortKeysFor as kt,PLP_SORT_LABELS as Nt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as Ct,itemTyreSizes as Tt,plpBrandVaries as _t,plpProcessVaries as At,plpItemsOfKinds as zt,plpKindNoun as le,resolvePlpKinds as Lt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Ot,plpVehicleCopy as Rt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Ft,oemTyreSizes as Gt}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as It}from"../../lib/wheels/plp-fitment-match.js";import Vt from"./PlpActiveChips.js";import{GridCardProvider as Et,GridMixedCards as Kt,gridIndexCss as jt,LISTING_CARD_RULES as Bt}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as Mt}from"../ProductCardEyebrow.js";import Dt from"./PlpPagination.js";import Wt from"./PlpSidebar.js";import{PlpResultRange as $t,PlpToolbar as Ht}from"./PlpToolbar.js";import Yt from"../catalog/SortSelect.js";import qt from"./PlpVehicleBar.js";import Jt from"./PlpVehicleGate.js";import{useVehicleCatalog as Qt}from"./useVehicleCatalog.js";import{useVehicleFit as Ut}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as Xt}from"./usePlpFiltersInUrl.js";import{say as V}from"efficient-web-builder/format/lib/editor-words";const Vo={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 Zt({level:v,className:P,children:k}){const L=Ue(v);return r(L,{className:P,children:k})}const eo=Qe({},"AlloyWheelsListing");function to({heading:v="",intro:P="",askForCar:k=!0,gateHeading:L="",gateIntro:ae="",perPage:E=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:me=[],fieldUsage:f=Ze,showPrice:K=!0,showInStock:de=!0,kinds:ue,products:he,wheels:fe,requestQuery:ge,editing:d=!1,ownerId:j="",template:ye,facetTemplate:Se,hover:xe=eo,titleLevel:we,omitHead:B=!1}){const{currency:a}=et(),u=Lt(ue),M=ot(),D=lt(ce),be=at(D,d?M:null),ve=ct(D,d?M:null),W=He("plp"),Pe=jt(W),ke=st(),$=he??fe??ke??[],H=i(()=>zt($,u),[$,u.join(",")]),o=Ut({editing:d,enabled:k,autoApply:!0}),[Ne,O]=Je(!1),Ce=bt(pe,u),g=o.applied?.vehicle??null,[e,x]=Xt({editing:d,openingSort:Ce,appliedVehicle:g,vehicleRestored:o.restored,requestQuery:ge}),c=Pt(u,e.kind),s=m(t=>x(t),[x]),Y=m((t,h)=>{const l=e[t],De=l.map(String).includes(h)?l.filter(We=>String(We)!==h):[...l,t==="diameters"?Number(h):h];s({...e,[t]:De,page:1})},[e,s]),q=m(t=>s({...e,priceMax:t,page:1}),[e,s]),J=m(t=>s({...e,inStockOnly:t,page:1}),[e,s]),Q=m(t=>s({...ie,kind:t,inStockOnly:e.inStockOnly,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMax,e.sort,s]),Te=m(t=>s({...e,sort:t,page:1}),[e,s]),_e=m(t=>{s({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:it()})},[e,s]),U=m(()=>s({...ie,sort:e.sort}),[e.sort,s]),{clear:C}=o,X=m(()=>{C(),O(!0),x(t=>({...t,page:1}))},[C]),Ae=m(()=>{C(),O(!1),x(t=>({...t,page:1}))},[C]),T=g?[g.make,g.model,g.year,g.modification].join("|"):"",_=qe(null);Ye(()=>{if(o.restored){if(_.current===null){_.current=T;return}_.current!==T&&(_.current=T,x(t=>t.page===1?t:{...t,page:1}))}},[o.restored,T,x]);const A=Qt({catalog:H,shownKinds:u,vehicle:g,editing:d}),n=i(()=>{if(!o.fit)return A;const t=A.filter(l=>z(l)==="alloy-wheel"),h=new Set(It(t,o.fit).map(l=>l.slug));return A.filter(l=>z(l)!=="alloy-wheel"||h.has(Ct(l)))},[A,o.fit]),w=me.join(","),ze=i(()=>{const t=new Set(w?w.split(","):[]);return ut(n,e,a,c,f).filter(h=>!t.has(h.key))},[n,e,a,w,c.join(","),f]),y=i(()=>dt(n,e,a),[n,e,a]),Le=c.length>1,Z=i(()=>ne(f,"alloy-wheel"),[f]),Oe=i(()=>ne(f,"tyre"),[f]),R=i(()=>_t(y),[y]),F=i(()=>At(y),[y]),G=Le?le(["alloy-wheel"]).one:null,Re=i(()=>({kindLabel:G,brand:R,process:F}),[G,R,F]),Fe=Mt({kind:!!G,brand:R,process:F},Z),Ge=i(()=>K?vt(n,a):null,[n,a,K]),Ie=i(()=>wt(n,e,a),[n,e,a]),Ve=i(()=>ht(n,u,e,a),[n,u.join(","),e,a]),Ee=m((t,h)=>{const l=St(n.flatMap(Tt),e.tyreSizes[0]??"",t,h);s({...e,tyreSizes:l?[l]:[],page:1})},[n,e,s]),Ke=i(()=>{const t=new Set(w?w.split(","):[]);return!xt(n,c)||t.has("tyreSizes")?null:ft(n,e,a)},[n,e,a,w,c.join(","),f]),S=i(()=>yt(y,e.page,E),[y,e.page,E]),b=le(c),I=Rt(c),ee=Ot(L,ae,c,u),te=c.length===1&&c[0]==="tyre",oe=o.applied?.stock??null,N=i(()=>Gt(oe),[oe]),je=i(()=>n.filter(t=>c.includes(z(t))).length,[n,c.join(",")]),re=H.length===0,Be=!re&&n.length===0,Me=k&&!d&&!o.applied&&!Ne;return u.length===0?null:p("section",{children:[k&&r(qt,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:te&&N.length>0?`Takes ${N.join(" · ")}`:null,resolving:o.resolving,unresolved:te?!!o.applied&&!o.resolving&&N.length===0:o.unresolved,matchCount:je,copy:I,onAmend:Ae,onClear:X}),Me&&r(Jt,{cascade:o.cascade,heading:ee.heading,intro:ee.intro,ready:o.restored,copy:I,onSkip:()=>O(!0)}),p("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&&(v||P)&&p("header",{className:"mb-6",children:[v&&r(Zt,{level:we,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:nt(v,!1)}),P&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:rt(P)})]}),p("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(Wt,{facets:ze,filters:e,typeOptions:Ve,sizeBoxes:Ke,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:b,priceBounds:Ge,inStockCount:de?Ie:null,onToggle:Y,onPickType:Q,onPickSize:Ee,onPriceMax:q,onInStockOnly:J,onClearAll:U,owner:{id:j,facetTemplate:Se},editing:d}),p("div",{className:"min-w-0 flex-1",children:[r(Ht,{className:"mb-4",start:p($e,{children:[r($t,{total:S.total,range:{from:S.from,to:S.to},noun:b}),r(Vt,{filters:e,onToggle:Y,onPriceMax:q,onInStockOnly:J,onPickType:Q})]}),end:r(Yt,{value:e.sort,keys:kt(u),labels:Nt,onChange:Te})}),re?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:d?b.many==="wheels"?V("No wheels in this website's catalog yet — curate products to see them here."):b.many==="tyres"?V("No tyres in this website's catalog yet — curate products to see them here."):V("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Be?p("div",{className:"border border-line p-10",children:[p("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:I.nothingFits}),p("button",{type:"button",onClick:X,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",b.many]})]}):S.total===0?p("div",{className:"border border-line p-10",children:[p("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",b.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),gt(e)&&r("button",{type:"button",onClick:U,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):p(Et,{value:{ownerId:j,ownerType:"AlloyWheelsListing",Template:ye,hover:xe,imageSizes:ve,fieldUsage:Z,tyreFieldUsage:Oe,reserveEyebrow:Fe,editing:d,eyebrow:Re,fit:o.fit,colours:e.finishes,setGridGap:`var(${se})`,rules:Bt},children:[r("style",{children:Pe}),r("div",{className:`plp-card-grid ${W} ${pt} ${Xe}`,style:{...be,...mt(`var(${se})`)},children:r(Kt,{items:S.items,tyreOf:t=>z(t)==="tyre"?t:null,tyreFit:t=>N.length>0?Ft(t.sizes,N):null})})]}),r(Dt,{page:S.page,pageCount:S.pageCount,onPage:_e}),r(tt,{editing:d})]})]})]})]})}export{Vo as PLP_GATE_DEFAULTS,to as default};
|
|
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,8 +1,9 @@
|
|
|
1
1
|
import type { ProductKind } from "../../lib/api/index.js";
|
|
2
2
|
import { type PlpFacetKey, type PlpFilterState } from "../../lib/wheels/plp-filters.js";
|
|
3
|
-
export default function PlpActiveChips({ filters, onToggle, onPriceMax, onInStockOnly, onPickType, }: {
|
|
3
|
+
export default function PlpActiveChips({ filters, onToggle, onPriceMin, onPriceMax, onInStockOnly, onPickType, }: {
|
|
4
4
|
filters: PlpFilterState;
|
|
5
5
|
onToggle: (key: PlpFacetKey, value: string) => void;
|
|
6
|
+
onPriceMin: (value: number | null) => void;
|
|
6
7
|
onPriceMax: (value: number | null) => void;
|
|
7
8
|
onInStockOnly: (value: boolean) => void;
|
|
8
9
|
onPickType: (kind: ProductKind | null) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as
|
|
1
|
+
"use client";import{jsx as r,jsxs as c}from"react/jsx-runtime";import{useCurrency as f}from"../CurrencyContext.js";import{formatPrice as m}from"../../lib/commerce.js";import{plpActiveChips as p}from"../../lib/wheels/plp-filters.js";function k({filters:t,onToggle:l,onPriceMin:s,onPriceMax:i,onInStockOnly:u,onPickType:o}){const{currency:a}=f(),n=p(t,a,m);return n.length===0?null:r("ul",{className:"flex list-none flex-wrap items-center gap-2",children:n.map(e=>r("li",{children:c("button",{type:"button",onClick:()=>{if(e.key==="priceMin")return s(null);if(e.key==="price")return i(null);if(e.key==="inStock")return u(!1);if(e.key==="kind")return o(null);if(e.key!=="lugs")return l(e.key,e.value)},className:`flex cursor-pointer items-center gap-2 px-2 py-1 font-mono text-[10px] uppercase tracking-[0.14em] text-bg hover:bg-fg ${e.key==="inStock"?"bg-green":"bg-accent"}`,children:[e.label,r("span",{"aria-hidden":"true",children:"✕"}),r("span",{className:"sr-only",children:"Remove filter"})]})},`${e.key}:${e.value}`))})}export{k as default};
|
|
@@ -3,7 +3,7 @@ import type { ProductKind } from "../../lib/api/index.js";
|
|
|
3
3
|
import type { TyreSizePart } from "../../lib/tyres/tyre-size.js";
|
|
4
4
|
import { type PlpFacetGroup, type PlpFacetKey, type PlpFilterState, type PlpTypeOption, type PlpTyreSizeBox } from "../../lib/wheels/plp-filters.js";
|
|
5
5
|
import { type RailOwner } from "./PlpFacetRows.js";
|
|
6
|
-
export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, filters, typeOptions, sizeBoxes, sizeMatches, noun, priceBounds, inStockCount, onToggle, onPickType, onPickSize, onPriceMax, onInStockOnly, onClearAll, price, foot, owner, editing, }: {
|
|
6
|
+
export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, filters, typeOptions, sizeBoxes, sizeMatches, noun, priceBounds, inStockCount, onToggle, onPickType, onPickSize, onPriceMin, onPriceMax, onInStockOnly, onClearAll, price, foot, owner, editing, }: {
|
|
7
7
|
facets: (Omit<PlpFacetGroup, "key"> & {
|
|
8
8
|
key: K;
|
|
9
9
|
})[];
|
|
@@ -15,15 +15,10 @@ export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, fil
|
|
|
15
15
|
one: string;
|
|
16
16
|
many: string;
|
|
17
17
|
};
|
|
18
|
-
priceBounds?: {
|
|
19
|
-
min: number;
|
|
20
|
-
max: number;
|
|
21
|
-
} | null;
|
|
22
18
|
inStockCount: number | null;
|
|
23
19
|
onToggle: (key: K, value: string) => void;
|
|
24
20
|
onPickType?: (kind: ProductKind | null) => void;
|
|
25
21
|
onPickSize?: (part: TyreSizePart, value: number | null) => void;
|
|
26
|
-
onPriceMax?: (value: number | null) => void;
|
|
27
22
|
onInStockOnly: (value: boolean) => void;
|
|
28
23
|
onClearAll: () => void;
|
|
29
24
|
price?: {
|
|
@@ -33,4 +28,17 @@ export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, fil
|
|
|
33
28
|
foot?: ReactNode;
|
|
34
29
|
owner: RailOwner;
|
|
35
30
|
editing?: boolean;
|
|
36
|
-
}): import("react").JSX.Element;
|
|
31
|
+
} & RailPrice): import("react").JSX.Element;
|
|
32
|
+
type RailPrice = {
|
|
33
|
+
priceBounds: {
|
|
34
|
+
min: number;
|
|
35
|
+
max: number;
|
|
36
|
+
} | null;
|
|
37
|
+
onPriceMin: (value: number | null) => void;
|
|
38
|
+
onPriceMax: (value: number | null) => void;
|
|
39
|
+
} | {
|
|
40
|
+
priceBounds?: undefined;
|
|
41
|
+
onPriceMin?: undefined;
|
|
42
|
+
onPriceMax?: undefined;
|
|
43
|
+
};
|
|
44
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
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};
|
|
@@ -7,4 +7,9 @@ export interface VehicleCatalogInput {
|
|
|
7
7
|
vehicle: VehicleSelection | null;
|
|
8
8
|
editing?: boolean;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export interface VehicleCatalog {
|
|
11
|
+
items: PlpItem[];
|
|
12
|
+
failed: boolean;
|
|
13
|
+
retry: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function useVehicleCatalog({ catalog, shownKinds, vehicle, editing, }: VehicleCatalogInput): VehicleCatalog;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useCallback as C,useEffect as N,useMemo as q,useState as o}from"react";import{products as v}from"../../lib/api/index.js";import{itemSlug as O}from"../../lib/catalog/plp-item.js";import{catalogSliceRequest as V,catalogVehicleQuery as F,mergeNarrowedSlice as J,serverNarrowedKinds as b}from"../../lib/catalog/plp-vehicle-slice.js";function H({catalog:n,shownKinds:d,vehicle:m,editing:g=!1}){const i=b(d),p=g?null:F(m),[u,h]=o(null),[y,c]=o(null),[S,k]=o(0),a=V(i,p,u!==null),e=a?JSON.stringify(a):"";N(()=>{if(!e)return;const t=JSON.parse(e);let l=!0;return v.listCatalog(t.kinds,t.vehicle,{throwOnFailure:!0}).then(r=>{l&&(h({key:e,slugs:r.map(O)}),c(null))}).catch(r=>{console.error("[useVehicleCatalog] catalog refetch failed",r),l&&c(e)}),()=>{l=!1}},[e,S]);const f=u?.slugs??null,s=i.join(","),K=q(()=>J(n,s?s.split(","):[],f),[n,s,f]),w=C(()=>k(t=>t+1),[]);return{items:K,failed:!!e&&y===e,retry:w}}export{H as useVehicleCatalog};
|
|
@@ -338,7 +338,7 @@ export declare const products: {
|
|
|
338
338
|
maxRows?: number;
|
|
339
339
|
}) => Promise<WheelSummary[]>;
|
|
340
340
|
listWheelsBySlug: (slugs: readonly string[], opts?: ListReadOpts) => Promise<WheelSummary[]>;
|
|
341
|
-
listCatalog: (kinds: readonly ProductKind[], vehicle?: TyreFitVehicleQuery | null, opts?: {
|
|
341
|
+
listCatalog: (kinds: readonly ProductKind[], vehicle?: TyreFitVehicleQuery | null, opts?: ListReadOpts & {
|
|
342
342
|
maxRows?: number;
|
|
343
343
|
}) => Promise<ProductSummary[]>;
|
|
344
344
|
getWheel: (slug: string) => Promise<Wheel>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PREVIEW_TOKEN_HEADER as st,SITE_HOST_HEADER as nt,SITE_SLUG_HEADER as ot}from"../site-headers.js";import{PRODUCT_API_BASE as it,PRODUCT_BACKEND_URL as D}from"./origins.js";import{backendHopHeaders as ct,clientIpFromForwardedFor as dt,FORWARDED_FOR_HEADER as ut,hopCachingOf as lt}from"../forwarded-for.js";import pt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as yt}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 ht=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const N="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",ft=new Set([502,503,504]),I=0,gt="This editor runs on its host's own backend, which does not serve this request.",wt=5e3,mt=15e3,St=()=>typeof window>"u"?wt:mt;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(St())}const F=t=>t instanceof Error&&t.name==="TimeoutError",M=(t,e)=>ft.has(t)?N:e,Pt=["admin","venue"];let B="admin";function ie(t){B=Pt.includes(t)?t:"admin"}function Ot(){return B}const bt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let q=null;function ce(t){q=t&&bt.test(t)?t:null}function At(){return q}function Tt(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=K();return!e||/[?&]site=/.test(t)?t:C(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...g}=e;if(typeof window<"u"&&!yt())throw new m(I,gt,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const r=typeof FormData<"u"&&g.body instanceof FormData;let a;try{a=await fetch(`${o??ht}${Tt(t)}`,{...g,headers:{...r?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:g.signal??H({...g,audience:p})})}catch(y){throw y instanceof TypeError||F(y)?new m(I,N,null):y}let n;try{n=await a.text()}catch(y){throw F(y)?new m(I,N,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(a.status,a.ok?"Expected JSON but received a non-JSON response":M(a.status,a.statusText),n)}if(!a.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??M(a.status,a.statusText);throw new m(a.status,y,c)}return c}let b=null;async function G(){return b||(b=Rt().finally(()=>{b=null}),b)}async function Rt(){const t=P.takeLegacyRefresh(),e=await Et.refresh(t??void 0);return P.setTokens(e.access),e.access}async function W(){return P.getAccess()??G()}async function h(t,e={}){let s;try{s=await W()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await G();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function j(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function z(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const Et={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await W();return await z(),t},me:z,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as Ct,absolutizeApiUrl as v}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as $t,isSvgUrl as _t}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Ut}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Nt,webRuntimeSiteSlug as K}from"efficient-web-builder/format/lib/web-runtime";function w(t){if(typeof t=="string")return t.startsWith("/media/")?Ct(t):t;if(Array.isArray(t))return t.map(w);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[w(l),p])):w(o);return e}return t}import{PRODUCT_API_BASE as Pe}from"./origins.js";const V=typeof window>"u"&&D!=="",It=V?D:it,vt=Nt,O=()=>({baseUrl:vt(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const X=100,Z=50;function k(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(X)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function kt(t,e){return k("/wheels",{process:t},e)}const Y=X;function Jt(t,e){return k("/wheels",{slug:t.join(",")},e)}function Lt(t,e,s){return k("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function Dt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function J(t,e,s=()=>!1,o=()=>!1){const l=[];let p=null;try{for(let g=0;g<Z;g++){const r=await i(await e(p),await u());if(l.push(...r.results),p=Dt(r.next),!p)break;if(o(l))return l}p&&console.warn(`[${t}] stopped at ${Z} pages (${l.length} rows); catalog may be truncated`)}catch(g){if(s(g))throw g;console.warn(`[${t}] product API unavailable, returning []`,g)}return l}const Q=t=>t instanceof m&&t.status===400;function tt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?E([e]):[e])}async function et(){return(await xt()).host}async function xt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(nt)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Ht(){try{const{headers:t}=await import("next/headers");return dt((await t()).get(ut))}catch{return null}}async function Ft(){try{const{headers:t}=await import("next/headers");return(await t()).get(ot)||null}catch{return null}}async function Mt(){const t=await Ft();if(t)return`site=${encodeURIComponent(t)}`;const e=await et();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=K();return e?C(t,`site=${encodeURIComponent(e)}`):t}return C(t,await Mt())}function C(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Bt="preview";async function qt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(st)}catch{return null}}async function Gt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function L(t,e){const s=await qt();if(s===null)return[await f(t),await u(e)];const o=C(await f(t),`${Bt}=${encodeURIComponent(s)}`),{next:l,cache:p,...g}=e??{},r=await u({...g,cache:"no-store"}),a=await Gt();return a&&(r.headers={...r.headers,"user-agent":a}),[o,r]}async function Wt(t){if(!V)return;const[e,s]=await Promise.all([et(),Ht()]),o=ct(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await Wt(lt(t)),s={baseUrl:It,...t};return e&&(s.headers={...e,...t?.headers}),s}const A=typeof window>"u";function T(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const ye={listMakes:async t=>{if(A){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(T("/makes",{region:t}),O())).results},listModels:async(t,e)=>{if(A){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(T("/models",{make:t,region:e}),O())).results},listYears:async(t,e,s)=>{if(A){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(T("/years",{make:t,model:e,region:s}),O())).results},listModifications:async(t,e,s,o)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(T("/modifications",{make:t,model:e,year:s,region:o}),O())).results},getStockFitment:async(t,e,s,o,l)=>{if(A){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(T("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),O())}},he={listWheels:async(t,e={})=>{const s=await J("products.listWheels",async o=>await f(kt(t,o)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:o=>E([...o]).length>=e.maxRows);return E(w(s))},listWheelsBySlug:async(t,e={})=>{const s=[...new Set(t.map(r=>r.trim()).filter(Boolean))];if(s.length===0)return[];const o=[];for(let r=0;r<s.length;r+=Y)o.push(s.slice(r,r+Y));const l=await Promise.all(o.map(r=>J("products.listWheelsBySlug",async a=>await f(Jt(r,a)),e.throwOnFailure?()=>!0:Q))),p=new Set(s),g=l.flat().filter(r=>p.has(r.slug));return E(w(g))},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 o=await J("products.listCatalog",async l=>await f(Lt(t,e,l)),Q,s.maxRows===void 0?void 0:l=>tt([...l]).length>=s.maxRows);return tt(w(o))},getWheel:async t=>x(w(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>w(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async(t={})=>{try{return await i(await f(d("/bundles")),await u())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return w(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,O());return w(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>w(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await L(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return w(await i(o,l))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const s=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+s,await u())).map(l=>({...l,coverImage:v(l.coverImage)??""}))}catch(o){if(e)throw o;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",o),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:v(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(d("/checkouts/release"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await j(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await j(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=H({method:"GET"}),e=await i(...await L(d("/header-settings"),{signal:t})),s=v(e.logoUrl);let o=null,l=null;if(s&&_t(s)){const p=await $t(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await L(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},fe={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class jt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const $=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},_=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,zt=t=>`${_(t)}currencies/`,Kt="/api/storefront/media/ingest/";class Vt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function Xt(){const t=Ut();if(!t)throw new Vt;return`${Kt}?${new URLSearchParams({site:t})}`}const Zt="X-Puck-Media-Manifest",rt=pt.contentHash,U={"X-Media-Manifest":rt,[Zt]:rt},ge=at({});function at(t){return(e,s={})=>{const o=At(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??Ot()})}}function Yt(t={}){const e=at(t),s=t.siteDrafts===!0,o=r=>$("header-settings",r,s),l=r=>$("theme-settings",r,s),p=r=>$("chat-settings",r,s),g=r=>$("social-settings",r,s);return{findPageBySlug:async(r,a,n)=>{const c=new URLSearchParams({slug:r});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:a}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new jt(r,S.length);return S[0]??null},getPageById:(r,a)=>e(`/api/storefront/pages/${r}/`,{token:a}),saveLayout:(r,a,n,c,y)=>e(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(r,a,n)=>e(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:a.title,slug:a.slug}),token:n}),geocode:(r,a,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:r,country:n}:{q:r})}`,{token:a}),listBlockSources:r=>e("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>e("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,a)=>e(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:a}),claimPageEditLock:(r,a,n,c=!1)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:a}),releasePageEditLock:(r,a)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:a}),createTemplate:(r,a,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:a}),headers:U,token:n}),getTemplate:(r,a)=>e(`/api/storefront/page-templates/${r}/`,{token:a}),saveTemplateLayout:(r,a,n)=>e(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:U,token:n}),listTemplatePages:async(r,a)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(r,a,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(a)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(r,a,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...a}),headers:U,token:n}),saveTemplatePageLayout:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:U,token:n}),deleteTemplatePage:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:a,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},createPage:(r,a,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:a,layout:n}),token:c}),deletePage:(r,a)=>e(`/api/storefront/pages/${r}/`,{method:"DELETE",token:a}),getHeaderSettings:(r,a)=>e(o(a),{token:r}),listMenus:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/menus/?${n}`,{token:r});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(r,a)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.sort_order-R.sort_order||S.name.localeCompare(R.name))},listForms:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.title.localeCompare(R.title))},listWheelSummaries:async(r,a={})=>{const n=new URLSearchParams;a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:r});return w(y)},listProducts:async(r,a={})=>{const n=new URLSearchParams;a.kinds?.length&&n.set("kind",a.kinds.join(",")),a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:r});return w(y)},getWheelDetail:async(r,a,n={})=>{const c=new URLSearchParams({slug:a});return n.siteId&&c.set("site",n.siteId),x(w(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:r})))},updateHeaderSettings:(r,a,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getSite:(r,a)=>e(_(r),{token:a}),listSites:async r=>{const a=await e("/api/storefront/sites/?no_page=true",{token:r});return Array.isArray(a)?a:a.results??[]},listSiteCurrencies:async(r,a)=>{const n=await e(zt(r),{token:a});return Array.isArray(n)?n:[]},publishSite:(r,a)=>e(`${_(r)}publish/`,{method:"POST",token:a}),getSiteLiveState:(r,a)=>e(`${_(r)}live-state/`,{token:a}),getThemeSettings:(r,a)=>e(l(a),{token:r}),updateThemeSettings:(r,a,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getMyPreferences:async r=>(await e("/api/auth/me/",{token:r})).preferences??{},updateMyPreferences:(r,a)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:r}),token:a}),getChatSettings:(r,a)=>e(p(a),{token:r}),updateChatSettings:(r,a,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(r),token:a}),getSocialSettings:(r,a)=>e(g(a),{token:r}),updateSocialSettings:(r,a,n)=>e(g(n),{method:"PATCH",body:JSON.stringify(r),token:a}),uploadHeaderLogo:(r,a,n)=>{const c=new FormData;return c.append("logo",r),e(o(n),{method:"PATCH",body:c,token:a})},clearHeaderLogo:(r,a)=>e(o(a),{method:"PATCH",body:JSON.stringify({logo:null}),token:r}),setHeaderLogoFromAsset:(r,a,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:r}),token:a}),uploadMedia:async(r,a)=>{const n=new FormData;return n.append("file",r),e(Xt(),{method:"POST",body:n,token:a})},listMedia:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("kind",a);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]}}}const we=Yt({siteDrafts:!0});export{ht as API_URL,jt as AmbiguousPageSlugError,m as ApiError,mt as BROWSER_READ_TIMEOUT_MS,gt as EFFICIENT_CLIENT_CLOSED_MESSAGE,Vt as MediaUploadDestinationError,Bt as PREVIEW_PARAM,Pe as PRODUCT_API_BASE,wt as SERVER_READ_TIMEOUT_MS,N as SERVER_UNREACHABLE_MESSAGE,I as STATUS_NETWORK_ERROR,ge as adminFetch,Et as api,i as apiFetch,C as appendSiteQuery,fe as bookings,Yt as createStorefrontAdmin,H as defaultRequestDeadline,Xt as editorMediaUploadPath,Ot as editorPortalAudience,At as editorRequestLanguage,ye as fitment,he as products,St as readDeadlineMs,Ht as resolveClientIp,w as resolveMediaUrls,qt as resolvePreviewToken,et as resolveSiteHost,xt as resolveSiteHostSource,Ft as resolveSiteSlug,ce as setEditorLanguage,ie as setEditorPortalAudience,we as storefrontAdmin};
|
|
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 m 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.",wt=new Set([502,503,504]),N=0,mt="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)=>wt.has(t)?I:e,bt=["admin","venue"];let B="admin";function le(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 pe(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 m(N,mt,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 m(N,I,null):y}let o;try{o=await a.text()}catch(y){throw F(y)?new m(N,I,null):y}let c=null;if(o)try{c=JSON.parse(o)}catch{throw new m(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 m(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 m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(n){if(!(n instanceof m)||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 m)||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 m(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";function w(t){if(typeof t=="string")return t.startsWith("/media/")?It(t):t;if(Array.isArray(t))return t.map(w);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])=>[w(l),p])):w(n);return e}return t}import{PRODUCT_API_BASE as Te}from"./origins.js";const Z=typeof window>"u"&&D!=="",Jt=Z?D:dt,Dt=Lt,O=()=>({baseUrl:Dt(),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 xt(t,e){return k("/wheels",{process:t},e)}const tt=Y;function Ht(t,e){return k("/wheels",{slug:t.join(",")},e)}function Ft(t,e,s){return k("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function Mt(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=Mt(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 m&&t.status===400;function rt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?E([e]):[e])}async function at(){return(await Bt()).host}async function Bt(){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 qt(){try{const{headers:t}=await import("next/headers");return lt((await t()).get(pt))}catch{return null}}async function Gt(){try{const{headers:t}=await import("next/headers");return(await t()).get(ct)||null}catch{return null}}async function Wt(){const t=await Gt();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 Wt())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const jt="preview";async function zt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(ot)}catch{return null}}async function Kt(){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 zt();if(s===null)return[await f(t),await u(e)];const n=$(await f(t),`${jt}=${encodeURIComponent(s)}`),{next:l,cache:p,...h}=e??{},r=await u({...h,cache:"no-store"}),a=await Kt();return a&&(r.headers={...r.headers,"user-agent":a}),[n,r]}async function Xt(t){if(!Z)return;const[e,s]=await Promise.all([at(),qt()]),n=ut(e,s,t);return Object.keys(n).length>0?n:void 0}async function u(t){const e=await Xt(yt(t)),s={baseUrl:Jt,...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 we={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())}},me={listWheels:async(t,e={})=>{const s=await L("products.listWheels",async n=>await f(xt(t,n)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:n=>E([...n]).length>=e.maxRows);return E(w(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(Ht(r,a)),e.throwOnFailure?()=>!0:et))),p=new Set(s),h=l.flat().filter(r=>p.has(r.slug));return E(w(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(Ft(t,e,l)),s.throwOnFailure?()=>!0:et,s.maxRows===void 0?void 0:l=>rt([...l]).length>=s.maxRows);return rt(w(n))},getWheel:async t=>x(w(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>w(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 w(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 w(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()=>w(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[n,l]=await J(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return w(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())},Se={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 Vt 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)}/`,Zt=t=>`${_(t)}currencies/`,Yt="/api/storefront/media/ingest/";class Qt 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 te(){const t=kt();if(!t)throw new Qt;return`${Yt}?${new URLSearchParams({site:t})}`}const ee="X-Puck-Media-Manifest",st=ht.contentHash,U={"X-Media-Manifest":st,[ee]:st},Pe=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 re(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 Vt(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 w(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 w(y)},getWheelDetail:async(r,a,o={})=>{const c=new URLSearchParams({slug:a});return o.siteId&&c.set("site",o.siteId),x(w(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(Zt(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(te(),{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 Oe=re({siteDrafts:!0});export{gt as API_URL,Vt as AmbiguousPageSlugError,m as ApiError,Pt as BROWSER_READ_TIMEOUT_MS,mt as EFFICIENT_CLIENT_CLOSED_MESSAGE,Qt as MediaUploadDestinationError,jt as PREVIEW_PARAM,Te as PRODUCT_API_BASE,St as SERVER_READ_TIMEOUT_MS,I as SERVER_UNREACHABLE_MESSAGE,N as STATUS_NETWORK_ERROR,Pe as adminFetch,Ut as api,i as apiFetch,$ as appendSiteQuery,Se as bookings,re as createStorefrontAdmin,H as defaultRequestDeadline,te as editorMediaUploadPath,At as editorPortalAudience,Rt as editorRequestLanguage,we as fitment,me as products,Ot as readDeadlineMs,qt as resolveClientIp,w as resolveMediaUrls,zt as resolvePreviewToken,at as resolveSiteHost,Bt as resolveSiteHostSource,Gt as resolveSiteSlug,pe as setEditorLanguage,le as setEditorPortalAudience,Oe as storefrontAdmin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FONT_ROLES as
|
|
1
|
+
import{FONT_ROLES as s}from"efficient-web-builder/format/lib/fonts";import{textKindVars as i}from"../content/text-kind-vars.js";const r=["step","name","value","note"],N={step:"Step",name:"Name",value:"Value",note:"Note"},p={step:"styleStep",name:"styleName",value:"styleValue",note:"styleNote"},a={step:{font:"--bk-step-font",size:"--bk-step-size"},name:{font:"--bk-name-font",size:"--bk-name-size"},value:{font:"--bk-value-font",size:"--bk-value-size"},note:{font:"--bk-note-font",size:"--bk-note-size"}};function f(e){return typeof e=="string"&&s.includes(e)?e:null}function c(e){const t={};for(const o of r){const n=f(e[p[o]]);n&&Object.assign(t,i(n,a[o]))}return t}export{p as BOOKING_KIND_PROP,a as BOOKING_KIND_VARS,r as BOOKING_TEXT_KINDS,N as BOOKING_TEXT_KIND_LABELS,f as bookingKindRole,c as bookingKindStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CARD_ROW_FIELD_PROP as s}from"efficient-web-builder/format/lib/content/card-template";import{RECORD_TITLE_FIELD as m}from"efficient-web-builder/format/lib/content/record-row";import{TEMPLATE_RECORD_TYPE_PROP as _}from"efficient-web-builder/format/lib/content/record-types";import{BOX_TYPE as n,CONTAINER_BLOCKS_SLOT as r}from"efficient-web-builder/format/lib/document/container-blocks";import{BOX as
|
|
1
|
+
import{CARD_ROW_FIELD_PROP as s}from"efficient-web-builder/format/lib/content/card-template";import{RECORD_TITLE_FIELD as m}from"efficient-web-builder/format/lib/content/record-row";import{TEMPLATE_RECORD_TYPE_PROP as _}from"efficient-web-builder/format/lib/content/record-types";import{BOX_TYPE as n,CONTAINER_BLOCKS_SLOT as r}from"efficient-web-builder/format/lib/document/container-blocks";import{BOX as E,DIM as c,TEXT as O,boxPadding as p,labelLook as g,seedNodes as d}from"efficient-web-builder/format/lib/document/seed-parts";import{BLOG_POST_RECORD_TYPE as P}from"./article-body.js";import{ARTICLE_BODY_BLOCK as l,ARTICLE_HEADING_LOOK as T,ARTICLE_MEASURE as y,ARTICLE_PARAGRAPH_LOOK as R,articleBodySeed as B}from"./article-body-seed.js";const a={...E,direction:"column",align:"center"},i=(o,e,t)=>({type:"Text",props:{...e,text:"",[s]:o,align:"center",maxWidth:y,_partStyles:{text:{...t,align:"center"}}}}),L=[{type:n,props:{...a,name:"Title",gap:16,...p(64,32,40,20),sectionPaddingBottom:16,sectionPaddingBottomPhone:16},slots:{[r]:[i("category",{...c,tag:"p"},{textStyle:"body-1",...g(13)}),i(m,{...O,tag:"h1"},T),i("excerpt",{...c,tag:"p"},R)]}},{type:n,props:{...a,align:"stretch",name:"Cover",...p(0,0,0,0)},slots:{[r]:[{type:"ImageBlock",props:{[s]:"cover",aspect:"16/9",contained:!0,widthMode:"page",...p(0,32,0,20)}}]}},{type:n,props:{...a,name:"Body",...p(0,32,0,20),sectionPaddingBottom:64,sectionPaddingBottomPhone:40},slots:{[r]:[{type:l,props:{}}]}},{type:n,props:{...a,align:"stretch",name:"Breadcrumb",...p(0,0,0,0)},slots:{[r]:[{type:"Breadcrumb",props:{items:[{label:"Home",href:"/"},{label:"Journal",href:"/journal"}],meta:"",[s]:m}}]}}];function x(){const o=d(L,(e,t)=>`article-${e}-${t.replace(/\./g,"-")}`).map(A);return{root:{props:{[_]:P}},content:o,zones:{}}}function A(o){const e=o.props[r];return Array.isArray(e)?{...o,props:{...o.props,[r]:e.map(t=>t.type===l?{...t,props:{...t.props,template:B(String(t.props.id))}}:t)}}:o}export{x as articlePageDocument};
|
|
@@ -4,3 +4,19 @@ export interface MenuLinkRange {
|
|
|
4
4
|
}
|
|
5
5
|
export declare function resolveMenuLinkRange(v: unknown): MenuLinkRange | null;
|
|
6
6
|
export declare const menuLinkInRange: (r: MenuLinkRange, n: number) => boolean;
|
|
7
|
+
export declare const MENU_STYLE_PLAIN = "plain";
|
|
8
|
+
export declare const MENU_STYLE_TABS = "tabs";
|
|
9
|
+
export declare const MENU_STYLE_BUTTON = "button";
|
|
10
|
+
export interface MenuShow {
|
|
11
|
+
list: string;
|
|
12
|
+
button: string;
|
|
13
|
+
drawsButton: boolean;
|
|
14
|
+
listHead: string;
|
|
15
|
+
listTail: string;
|
|
16
|
+
buttonHead: string;
|
|
17
|
+
buttonTail: string;
|
|
18
|
+
strip: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function menuShowClasses(style: unknown, stylePhone: unknown): MenuShow;
|
|
21
|
+
export declare const MENU_PANEL_WIDTH_DEFAULT = 420;
|
|
22
|
+
export declare const MENU_PANEL_TINT_OPACITY_DEFAULT = 60;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1?e:void 0;function s(e){if(!e||typeof e!="object")return null;const t=l(e.from)??1,n=l(e.to);return n!==void 0&&n<t||t===1&&n===void 0?null:n===void 0?{from:t}:{from:t,to:n}}const a=(e,t)=>t>=e.from&&(e.to===void 0||t<=e.to),b="plain",u="tabs",r="button",f=e=>e===void 0||e===""||e===null,i=(e,t,n,o="")=>({list:e,button:t,drawsButton:n,listHead:e,listTail:"",buttonHead:t,buttonTail:"",strip:o});function c(e,t){const n=f(t)||t===r;if(e===u){const d="hidden view-tablet:block";return f(t)||t===u?i("","",!1):t===r?i("hidden","flex view-tablet:hidden",!0,d):i("flex view-tablet:hidden","",!1,d)}const o=e===r;return!o&&!n?i("flex","",!1):o?n?i("hidden","flex",!0):i("flex view-tablet:hidden","hidden view-tablet:flex",!0):{...i("hidden view-tablet:flex","flex view-tablet:hidden",!0),listHead:"hidden",listTail:" view-tablet:flex",buttonHead:"flex",buttonTail:" view-tablet:hidden"}}const x=420,T=60;export{T as MENU_PANEL_TINT_OPACITY_DEFAULT,x as MENU_PANEL_WIDTH_DEFAULT,r as MENU_STYLE_BUTTON,b as MENU_STYLE_PLAIN,u as MENU_STYLE_TABS,a as menuLinkInRange,c as menuShowClasses,s as resolveMenuLinkRange};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fontRoleOf as f}from"efficient-web-builder/format/lib/fonts";import{partStyleDeclarations as r}from"efficient-web-builder/render/lib/document/part-styles";const l={fontKey:"",sizePx:16,weight:400,lineRatio:1.4,letterEm:0,align:"left",case:"none",paddingPx:0,widthPx:900};function s(i,n){const e=f(i);if(!e)return{};const t=r({role:e},l),o={};return t.fontFamily&&(o[n.font]=t.fontFamily),t.fontSize&&(o[n.size]=t.fontSize),o}export{s as textKindVars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import{SearchTool as i}from"../../../../../components/HeaderToolBlocks.js";import{SearchBlockMeta as s}from"./meta.js";const a={...s,render:({style:e,stylePhone:o,editor:r})=>t(i,{style:e,stylePhone:o,editing:r?.isEditing})};export{a as SearchBlockRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import h from"../../../../../components/BoxHeaderBar.js";import
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import h from"../../../../../components/BoxHeaderBar.js";import f from"../../../../../components/SectionGroupBody.js";import{headerBarFromProps as l}from"../../../published-header-bar.js";import{SiteHeaderMeta as g}from"./meta.js";const S={...g,render:({sections:a,navTextCase:n,toolTextStyle:d,menuRow:p,sticky:m,topTextColor:s,heightPx:x,sectionAccent:c,editor:t,...r})=>{const o=i(f,{place:"header",sections:a,widths:r,navTextCase:n,menuRow:p,toolTextStyle:d,editing:t?.isEditing});if(!t?.isEditing)return o;const e=l({sticky:m,topTextColor:s,heightPx:x,sectionAccent:c,...r});return i(h,{sticky:e.sticky,topTextColor:e.topTextColor,heightPx:e.heightPx,theme:e.theme,bandCapped:e.bandCapped,children:o})}};export{S as SiteHeaderRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as B}from"react/jsx-runtime";import{declaredBlockSource as F,sourcedRows as E}from"efficient-web-builder/format/lib/content/block-sources";import y from"../../components/FooterMenu.js";const M={MenuBlock:"FooterMenu",EmailFormBlock:"FooterEmailSignup",SocialLogosBlock:"FooterSocial",PaymentLogosBlock:"FooterPayment"},w="column";function O({id:o,template:e,menu:r,dataSource:n,dataRows:i,heading:l,accordionMobile:u,showDividers:c,direction:a,linkAlign:d,linkRange:m,menuStyle:s,currentPage:g,menuStylePhone:P,menuPanelWidth:f,menuPanelTintColor:k,menuPanelTintOpacity:p,editor:t}){return B(y,{owner:{id:String(o??""),type:"MenuBlock",template:e},menu:r,served:F({dataSource:n})?E({dataSource:n,dataRows:i},!!t?.isEditing).rows:void 0,heading:l||void 0,accordionMobile:u,showDividers:c,layout:a==="row"?"row":"column",linkAlign:d,linkRange:m,menuStyle:s,currentPage:g,menuStylePhone:P,menuPanelWidth:f,menuPanelTintColor:k,menuPanelTintOpacity:p,editing:t?.isEditing})}function R(o){for(const[r,n]of Object.entries(M))o[r]={...o[n]};const e=o.MenuBlock;e.defaultProps={...e.defaultProps,direction:w},e.render=O}export{M as PAGE_BLOCKS_FROM_FOOTER,w as PAGE_MENU_DIRECTION_DEFAULT,R as addPageBlocksFromFooter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{SECTION_BOX_SLOT as O,SECTION_BOX_TYPE as f,headParts as _,registerSectionToBox as v}from"efficient-web-builder/render/lib/sections/section-to-box";import{BUTTON as C,DIM as i,DROP_COMMON as a,DROP_SIDE_PADDING as s,FOLLOW_THE_BOX as H,INNER_BOX as c,SAME_KEYS as E,SECTION_BOX as h,SH_LINK as W,TEXT as
|
|
1
|
+
import{SECTION_BOX_SLOT as O,SECTION_BOX_TYPE as f,headParts as _,registerSectionToBox as v}from"efficient-web-builder/render/lib/sections/section-to-box";import{BUTTON as C,DIM as i,DROP_COMMON as a,DROP_SIDE_PADDING as s,FOLLOW_THE_BOX as H,INNER_BOX as c,SAME_KEYS as E,SECTION_BOX as h,SH_LINK as W,TEXT as o,bandPage as I,smallText as m,surfaceAccent as y,wrapperPad as b,wrapperPadKeys as R}from"efficient-web-builder/render/lib/document/blocks/general/section-to-box-row-parts";import{boxPadding as D,labelLook as F,labelStyle as K,token as n}from"efficient-web-builder/format/lib/document/seed-parts";import{CARD_ROW_FIELD_PROP as L}from"efficient-web-builder/format/lib/content/card-template";import{phoneKey as w}from"efficient-easel/draw";import{REVIEWS_BAND_OWN as M}from"./section-to-box-rows-reviews.js";import{rowFieldTextSeed as p}from"efficient-web-builder/format/lib/document/blocks/general/Cards/card-seed";const l=e=>[...E.filter(t=>t!=="sectionAccent"),["sectionAccent","sectionAccent",(t,r,d)=>y(t,d)],...R(e)],x=(e,t,r)=>(d,N)=>({...h,sectionAccent:y(d.sectionAccent??0,N),direction:"column",gap:t,gapPhone:r,sectionBorder:{top:1},...b(d,e)}),P=(e,t,r)=>({kind:"text",key:e,role:"heading",props:o,style:{textStyle:"heading-2",...n("headingMedium",44,32),weight:500,case:"upper",lineHeight:t,letterSpacing:r}}),k=(e,t,r={})=>({kind:"group",name:"Heading",props:{...c,gap:e,gapPhone:e,...r},parts:t}),u=(e={})=>({kind:"core",keep:"rest",props:H,...e}),g=M,[X]=_("ReviewForm"),G=()=>({name:"Review Form",boxProps:x(g,48,32),box:l(g),parts:[k(16,[{...X,props:o},P("title",1,-.02)]),u()],pressKeepsEmpty:["eyebrow","title"],drop:{...a,...s,headPlacement:"the head is the Text blocks above the form, which is always own-box here"}}),[V]=_("Reviews"),T=e=>({...K(12),letterSpacing:e}),j={type:f,props:{...c,name:"Card",gap:16,...D(40,40,32,32),sectionAccent:0},slots:{[O]:[{type:"RatingBlock",props:{[L]:"rating"}},p("title",o,{textStyle:"heading-1",...n("body",19),weight:500,case:"upper",lineHeight:1.2,letterSpacing:-.01}),p("quote",i,{textStyle:"body-1",...n("body",15),lineHeight:1.65}),{type:f,props:{...c,name:"Byline",direction:"row",justify:"between",align:"start",share:"content",phoneRow:2,[w("share")]:"content",gap:16,sectionPaddingTop:20,sectionPaddingTopPhone:20,sectionBorder:{top:1}},slots:{[O]:[p("name",o,T(.22)),p("dateLabel",{...i,align:"right"},{...T(.18),align:"right"}),p("role",{...i,align:"right"},{...T(.18),align:"right"})]}}]}},Y=()=>({name:"Reviews",boxProps:x(g,48,32),box:l(g),parts:[k(16,[{...V,props:o},P("title",1,-.02)]),u({slots:{template:[j]}})],pressKeepsEmpty:["eyebrow","title"],drop:{...a,...s,eyebrowLook:"the eyebrow Text wears the plain eyebrow's start look (Reviews' default); a stored `filled` look needs a filled Text look",headPlacement:"the head is the Text blocks above the reviews, which are always own-box here"}}),S={top:88,bottom:88,topTablet:88,bottomTablet:88,topPhone:64,bottomPhone:64},q=()=>({name:"Booking Form",boxProps:x(S,40,40),box:l(S),parts:[k(16,[m("eyebrow",{...n("label",12),weight:600,letterSpacing:.24,color:"accent"}),P("heading",.98,-.025),{kind:"text",key:"intro",props:{...i,maxWidth:660},style:{textStyle:"heading-1",...n("body",17),weight:400,case:"none",lineHeight:1.65,color:"muted"}}],{maxWidth:760}),u()],pressKeepsEmpty:["eyebrow","heading","intro"],drop:{...a,...s}}),B={top:88,bottom:88,topPhone:64,bottomPhone:64},U=()=>({name:"Ready-to-Order Banner",boxProps:e=>({...h,direction:"column",align:"center",gap:20,gapPhone:20,...b(e,B)}),box:[...E,...R(B)],parts:[{...m("eyebrow"),props:{...o,align:"center"}},{kind:"text",key:"title",role:"heading",props:{...o,align:"center",maxWidth:720},style:{textStyle:"heading-1",...n("headingMedium",44,30),weight:500,case:"none",lineHeight:1.05,letterSpacing:-.03,align:"center"}},{kind:"text",key:"body",props:{...o,align:"center",maxWidth:560},style:{textStyle:"body-1",...n("body",16),lineHeight:1.6,align:"center"}},{kind:"group",name:"Buttons",props:{...c,direction:"row",align:"center",justify:"center",share:"content",phoneRow:2,[w("share")]:"content",gap:24,gapPhone:24,sectionPaddingTop:8,sectionPaddingTopPhone:8},parts:[{kind:"button",key:"ctaText",href:"ctaHref",variant:"primary",props:e=>({...C,align:"center",href:typeof e.ctaHref=="string"&&e.ctaHref?e.ctaHref:"/checkout"})},{kind:"button",key:"secondaryText",href:"secondaryHref",variant:"ghost",props:{...W,align:"center",icon:"none"},style:{...F(13),color:"muted"}}]}],pressKeepsEmpty:["eyebrow","title","body"],drop:{...a,...s}}),A={top:60,bottom:0,topPhone:60,bottomPhone:0},z=()=>({name:"Contact Form",boxProps:(e,t)=>({...h,sectionAccent:y(e.sectionAccent??0,t),direction:"column",gap:0,gapPhone:0,...b(e,A)}),box:l(A),parts:[{kind:"group",name:"Header",props:{...c,direction:"row",align:"center",share:"content",phoneRow:2,[w("share")]:"content",gap:24,gapPhone:24,sectionPaddingBottom:24,sectionPaddingBottomPhone:24,sectionBorder:{bottom:1}},parts:[m("routingNumber"),{kind:"text",key:"routingTagline",props:i,style:{textStyle:"heading-1",...n("body",14),weight:400,case:"upper",letterSpacing:.04,color:"muted"}}]},{kind:"core",keep:"rest",derive:{reads:["sectionAccent"],props:(e,t)=>({sectionAccent:I(e.sectionAccent??0,t)})}}],drop:{...a,...s}});v({ContactRouting:z(),ReviewForm:G(),AppointmentBooking:q(),Reviews:Y(),CheckoutCTA:U()});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{textKindVars as i}from"../content/text-kind-vars.js";import{POPUP_KIND_VARS as e,POPUP_TEXT_KINDS as c}from"efficient-web-builder/format/lib/popup/text-kinds";function s(r){const o={};for(const t of c){const n=r[t];n&&Object.assign(o,i(n,e[t]))}return o}export{s as popupKindStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{FONT_ROLES as
|
|
1
|
+
import{FONT_ROLES as o}from"efficient-web-builder/format/lib/fonts";import{textKindVars as e}from"../content/text-kind-vars.js";const c=["field","tick","thanks"],d={field:"Form rows",tick:"Tick label",thanks:"Thank-you message"},f={field:"styleField",tick:"styleTick",thanks:"styleThanks"},r={field:{font:"--sb-field-font",size:"--sb-field-size"},tick:{font:"--sb-tick-font",size:"--sb-tick-size"},thanks:{font:"--sb-thanks-font",size:"--sb-thanks-size"}};function k(t){return typeof t=="string"&&o.includes(t)?t:null}function a(t){const s={};for(const n of c){const i=k(t[f[n]]);i&&Object.assign(s,e(i,r[n]))}return s}export{f as SUBMIT_KIND_PROP,r as SUBMIT_KIND_VARS,c as SUBMIT_TEXT_KINDS,d as SUBMIT_TEXT_KIND_LABELS,k as submitKindRole,a as submitKindStyle};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type PlpFilterState } from "./plp-filters.js";
|
|
2
2
|
import type { CatalogFilterState } from "./catalog-filters.js";
|
|
3
3
|
import type { VehicleSelection } from "./fitment-options.js";
|
|
4
|
-
export type UnmappableCatalogFacet = "lugs"
|
|
4
|
+
export type UnmappableCatalogFacet = "lugs";
|
|
5
5
|
export declare const RESULTS_LINK_BLOCKED_NOTE: string;
|
|
6
6
|
export declare function unmappableCatalogFacets(f: CatalogFilterState): UnmappableCatalogFacet[];
|
|
7
7
|
export declare function catalogFiltersToListingFilters(f: CatalogFilterState): PlpFilterState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EMPTY_PLP_FILTERS as h,plpFiltersToParams as d}from"./plp-filters.js";import{appendVehicleParams as g}from"./plp-vehicle-params.js";const x="The results link is off while the Lugs filter is on. The product listing page filters on bolt pattern and has no lug filter, so a shopper's lug choice could not be carried across — they would land on a wider set of products than they asked for. Turn Lugs off to use the results link.";function F(s){const t=[];return s.lugs!=null&&t.push("lugs"),
|
|
1
|
+
import{EMPTY_PLP_FILTERS as h,plpFiltersToParams as d}from"./plp-filters.js";import{appendVehicleParams as g}from"./plp-vehicle-params.js";const x="The results link is off while the Lugs filter is on. The product listing page filters on bolt pattern and has no lug filter, so a shopper's lug choice could not be carried across — they would land on a wider set of products than they asked for. Turn Lugs off to use the results link.";function F(s){const t=[];return s.lugs!=null&&t.push("lugs"),t}function f(s){return s==="default"?"recommended":s}function m(s){return{...h,collections:s.process?[s.process]:[],diameters:s.size!=null?[s.size]:[],finishes:s.finish?[s.finish]:[],priceMin:s.priceMin,priceMax:s.priceMax,sort:f(s.sort)}}function P(s,t,l){const e=s.indexOf("#"),a=e===-1?"":s.slice(e),o=e===-1?s:s.slice(0,e),i=o.indexOf("?"),c=i===-1?o:o.slice(0,i),n=new URLSearchParams(i===-1?"":o.slice(i+1));for(const[u,p]of d(m(t)))n.set(u,p);g(n,l);const r=n.toString();return`${c}${r?`?${r}`:""}${a}`}export{x as RESULTS_LINK_BLOCKED_NOTE,m as catalogFiltersToListingFilters,P as listingLinkFromCatalogFilters,F as unmappableCatalogFacets};
|
|
@@ -81,6 +81,11 @@ export interface PlpTypeOption {
|
|
|
81
81
|
checked: boolean;
|
|
82
82
|
}
|
|
83
83
|
export declare function buildPlpTypeOptions(items: readonly PlpItem[], ticked: readonly ProductKind[], f: PlpFilterState, currency: Currency): PlpTypeOption[];
|
|
84
|
+
export declare function plpPricedAmounts(items: readonly PlpItem[], currency: Currency): number[];
|
|
85
|
+
export declare function plpPriceBoundsOf(prices: readonly number[]): {
|
|
86
|
+
min: number;
|
|
87
|
+
max: number;
|
|
88
|
+
} | null;
|
|
84
89
|
export declare function plpPriceBounds(items: readonly PlpItem[], currency: Currency): {
|
|
85
90
|
min: number;
|
|
86
91
|
max: number;
|