efficient-storefront-blocks 0.95.0 → 0.97.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 +39 -0
- package/dist/chunks/{EditorPreviewCheckout-3F3CP5MR.js → EditorPreviewCheckout-O7F36ZXB.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-HN7TFLUJ.js → SiteEditorProvider-VZUU5OPZ.js} +1 -1
- package/dist/chunks/chunk-AOZEO73W.js +401 -0
- package/dist/chunks/{chunk-CYLLSHDF.js → chunk-MXWQOFM6.js} +1 -1
- package/dist/chunks/chunk-NYEB6V2R.js +1 -0
- package/dist/chunks/chunk-SQ62RGWV.js +1 -0
- package/dist/chunks/chunk-UFEEFZ5M.js +1 -0
- package/dist/chunks/{fitment-data-Z62WUQGC.js → fitment-data-MCGKHSA4.js} +1 -1
- package/dist/contract.js +10 -2
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/document/config.d.ts +1 -0
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +5 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +57 -62
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +18 -5
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/ContactRouting.d.ts +6 -0
- package/dist/render/components/ContactRouting.js +1 -1
- package/dist/render/components/GridCardTemplate.js +1 -1
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/ProductHeroPanel.d.ts +3 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/WheelCardFrame.d.ts +3 -10
- package/dist/render/components/WheelCardFrame.js +1 -1
- package/dist/render/components/card-pieces/CardSurfaceFrame.d.ts +12 -0
- package/dist/render/components/card-pieces/CardSurfaceFrame.js +1 -0
- package/dist/render/components/card-pieces/card-row.js +1 -1
- package/dist/render/components/catalog/ShopperChips.d.ts +7 -4
- package/dist/render/components/catalog/ShopperChips.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.d.ts +1 -0
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +2 -2
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpFacetRows.d.ts +6 -4
- package/dist/render/components/wheels-plp/PlpFacetRows.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +19 -14
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/PlpTypePicker.d.ts +2 -5
- package/dist/render/lib/api/index.d.ts +3 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +28 -0
- package/dist/render/lib/content/booking-card-seed.d.ts +4 -0
- package/dist/render/lib/content/booking-card-seed.js +1 -1
- package/dist/render/lib/content/contact-card-seed.d.ts +4 -0
- package/dist/render/lib/content/contact-card-seed.js +1 -1
- package/dist/render/lib/content/facet-row-seed.d.ts +14 -0
- package/dist/render/lib/content/facet-row-seed.js +1 -1
- package/dist/render/lib/content/filter-card-seed.js +1 -1
- package/dist/render/lib/content/hero-option-seed.js +1 -1
- package/dist/render/lib/content/square-box.d.ts +4 -0
- package/dist/render/lib/content/square-box.js +1 -0
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +4 -0
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
- package/dist/render/lib/document/blocks/service/ContactRouting/render.js +1 -1
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/render-config.d.ts +1 -0
- package/dist/render/lib/document/render-config.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-detail.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-listing.d.ts +2 -0
- package/dist/render/lib/document/section-to-box-rows-listing.js +1 -0
- package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-spec.js +1 -1
- package/dist/words.d.ts +21 -0
- package/dist/words.js +5 -5
- package/package.json +5 -4
- package/dist/chunks/chunk-7SMQDDLZ.js +0 -1
- package/dist/chunks/chunk-GW5M2ATK.js +0 -1
- package/dist/chunks/chunk-SUKEQRMP.js +0 -389
- package/dist/chunks/chunk-WLMM7L6N.js +0 -1
- package/dist/render/components/ProductCardChrome.d.ts +0 -38
- package/dist/render/components/ProductCardChrome.js +0 -1
- /package/dist/chunks/{chunk-SUKEQRMP.js.LEGAL.txt → chunk-AOZEO73W.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as l,Fragment as
|
|
1
|
+
"use client";import{jsx as l,Fragment as z,jsxs as h}from"react/jsx-runtime";import{useCallback as Y,useMemo as F,useState as H}from"react";import{CardTemplateRows as te}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as le}from"efficient-web-builder/format/lib/content/card-template";import{useCurrency as ne}from"../CurrencyContext.js";import{useEnglish as re}from"../EnglishVariant.js";import U from"./PriceRange.js";import oe from"./SortSelect.js";import{DEFAULT_CATALOG_FILTER_LABELS as v}from"../../lib/content/catalog-filter-labels.js";import{itemKind as X,plpKindNoun as se}from"../../lib/catalog/plp-item.js";import{itemLugs as ie,lugFilterLabel as ce}from"../../lib/wheels/lug-count.js";import{CATALOG_TEXT_SIZE as I}from"../../lib/sections/catalog-text-size.js";import{buildPlpFacets as ae,itemMatchesPlp as pe,plpInStockCount as ue,plpPriceBounds as me,plpSortKeysFor as de,PLP_ONE_VALUE_MAX as fe,PLP_SORT_LABELS as ge}from"../../lib/wheels/plp-filters.js";import{FILTER_IN_STOCK_KEY as he,FILTER_PRICE_KEY as P,filterGroupItems as Se}from"../../lib/sections/filter-option-rows.js";import be from"../wheels-plp/PlpSidebar.js";import{FILTER_BLOCK_TYPE as D}from"../../lib/document/document-nodes.js";import{FilterPill as xe,PillButton as we}from"./FilterPill.js";import{useShopperFilter as ye}from"./ShopperScope.js";import{HideTaker as ke}from"efficient-web-builder/render/components/ViewHideRoot";const V="lugs";function Te({owner:n,look:t,lookPhone:s,shown:r,showSort:a,openingSort:c,filtersBelow:e,fieldUsage:p,firstRows:w,editing:y}){const{currency:m}=ne(),A=re(),{ref:q,scope:f}=ye({filtersBelow:e,openingSort:c}),{state:u}=f,g=f.live?f.rows:w??f.rows,S=F(()=>[...new Set(g.map(X))],[g]),L=F(()=>{const o=ae(g,u,m,S,p??[],"pass").filter(i=>i.key!=="collections"||r.includes("category"));if(r.includes("lugs")){const i=_e(g,u,m);i&&o.push(i)}return o.map(i=>({...i,label:A(i.label)}))},[g,u,m,S,p,r,A]),M=r.includes("price")?me(g,m):null,E=r.includes("inStock")&&g.length>0?ue(g,u,m):null,J=de(S.length?S:["alloy-wheel"]),k=f.update,b=Y(o=>k({...o,page:1}),[k]),N=Y((o,i)=>k(d=>{if(o===V){const x=Number(i),W=(d.lugs??[]).includes(x);return{...d,page:1,lugs:W?(d.lugs??[]).filter(ee=>ee!==x):[...d.lugs??[],x]}}const C=d[o].map(String),j=C.includes(i)?C.filter(x=>x!==i):[...C,i];return{...d,page:1,[o]:o==="diameters"?j.map(Number):j}}),[k]),R=a&&!f.sortInChips,Q=F(()=>{const o=Se(L,u,E).map(i=>({...i,options:i.options.map(d=>({...d,press:i.key===he?()=>b({inStockOnly:!u.inStockOnly}):()=>N(i.key,d.value)}))}));return M?[...o,{key:P,label:v.price,options:[]}]:o},[L,u,E,M,b,N]),T={owner:n,items:Q,state:u,sorts:J,showSort:R,set:b},B=l(be,{facets:L,filters:u,noun:se(S.length?S:["alloy-wheel"]),inStockCount:E,onToggle:N,onInStockOnly:o=>b({inStockOnly:o}),onClearAll:f.clear,price:M?{label:v.price,control:l(U,{min:u.priceMin,max:u.priceMax,onMin:o=>b({priceMin:o}),onMax:o=>b({priceMax:o})})}:void 0,foot:R?l(_,{...T}):void 0,owner:{id:n.id,facetTemplate:n.facetTemplate,type:D},editing:y}),G=t==="rail"?B:l(O,{...T,columns:t==="bar-columns"}),K=(s==="rail"?t==="rail":s==="bar"&&t!=="rail")?null:s==="button"?l(Le,{...T}):s==="rail"?B:l(O,{...T,columns:!1});return h(ke,{as:"div",ref:q,"data-shopper-filters":"",className:"w-full",children:[K?h(z,{children:[l("div",{className:"max-view-wide:hidden",children:G}),l("div",{className:"view-wide:hidden",children:K})]}):G,y&&f.grids===0&&l("p",{className:`mt-2 font-mono ${I.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:"Filters a Product Grid in this Box"})]})}function _e(n,t,s){const r=new Map,a=new Set;for(const e of n){const p=X(e)==="alloy-wheel"?ie(e):null;p!==null&&(a.add(p),pe(e,t,s,"lugs","pass")&&r.set(p,(r.get(p)??0)+1))}if(a.size<=fe)return null;const c=t.lugs??[];return{key:V,label:v.lugs,options:[...a].sort((e,p)=>e-p).map(e=>({value:String(e),label:ce(e),count:r.get(e)??0,checked:c.includes(e),swatch:null}))}}function _({state:n,sorts:t,set:s}){return l(oe,{value:n.sort,keys:t,labels:ge,onChange:r=>s({sort:r})})}function Z(n,t){return n.key===P?(t.priceMin!=null?1:0)+(t.priceMax!=null?1:0):n.options.filter(s=>s.state.selected).length}function $({owner:n,items:t,state:s,set:r,wrap:a}){const c=(e,p)=>{const w=t[p.index],y=w.key===P?h(z,{children:[e,l(U,{min:s.priceMin,max:s.priceMax,onMin:m=>r({priceMin:m}),onMax:m=>r({priceMax:m})})]}):e;return a(y,w)};return l(te,{ownerId:n.id,ownerType:D,Template:n.template,rows:t.map(le),items:t,fallback:null,wrapCopy:c,children:e=>e})}function O({columns:n,...t}){const[s,r]=H(null),a=c=>()=>r(e=>e===c?null:c);return n?h("div",{className:"flex flex-col gap-4",children:[l("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-6 border-y border-line py-4",children:l($,{...t,wrap:(c,e)=>l("div",{children:c},e.key)})}),t.showSort&&l("div",{className:"flex flex-wrap items-center justify-end gap-4",children:l(_,{...t})})]}):h("div",{className:"flex flex-wrap items-center gap-2",children:[l($,{...t,wrap:(c,e)=>l(xe,{labelSize:I.labelSmall,name:e.key,label:e.label,badge:Z(e,t.state),open:s===e.key,onToggle:a(e.key),children:c},e.key)}),t.showSort&&l("div",{className:"ml-auto",children:l(_,{...t})})]})}function Le(n){const[t,s]=H(!1),r=n.items.reduce((a,c)=>a+Z(c,n.state),0);return h("div",{className:"flex flex-col gap-4",children:[h("div",{className:"flex items-center justify-between gap-4",children:[l(we,{labelSize:I.labelSmall,label:"Filters",badge:r,open:t,onToggle:()=>s(a=>!a)}),n.showSort&&l(_,{...n})]}),t&&l(O,{...n,columns:!0,showSort:!1})]})}export{Te as default};
|
|
@@ -26,11 +26,11 @@ export interface AlloyWheelsListingProps {
|
|
|
26
26
|
ownerId?: string;
|
|
27
27
|
template?: SlotComponent;
|
|
28
28
|
facetTemplate?: SlotComponent;
|
|
29
|
-
|
|
29
|
+
omitHead?: boolean;
|
|
30
30
|
hover?: CardHoverDrawn;
|
|
31
31
|
}
|
|
32
32
|
export declare const PLP_GATE_DEFAULTS: {
|
|
33
33
|
readonly heading: "Let's find wheels that fit your car.";
|
|
34
34
|
readonly intro: "Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you.";
|
|
35
35
|
};
|
|
36
|
-
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, requestQuery, editing, ownerId, template, facetTemplate, hover, titleLevel, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
36
|
+
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, requestQuery, editing, ownerId, template, facetTemplate, hover, titleLevel, omitHead, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as p,Fragment as
|
|
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,11 +1,13 @@
|
|
|
1
1
|
import type { SlotComponent } from "efficient-easel/blocks";
|
|
2
2
|
import { type FacetRow } from "../../lib/content/facet-row-seed.js";
|
|
3
3
|
import type { OptionCardRows } from "../../lib/sections/filter-option-rows.js";
|
|
4
|
+
export type RailOwner = {
|
|
5
|
+
id: string;
|
|
6
|
+
facetTemplate?: SlotComponent;
|
|
7
|
+
type?: string;
|
|
8
|
+
};
|
|
4
9
|
export default function PlpFacetRows({ owner, rows, dead, label, className, editing, }: {
|
|
5
|
-
owner:
|
|
6
|
-
id: string;
|
|
7
|
-
facetTemplate?: SlotComponent;
|
|
8
|
-
};
|
|
10
|
+
owner: RailOwner;
|
|
9
11
|
rows: OptionCardRows<FacetRow>;
|
|
10
12
|
dead: readonly boolean[];
|
|
11
13
|
label?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e}from"react/jsx-runtime";import{CardTemplateRows as
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{CardTemplateRows as m}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as c}from"efficient-web-builder/render/components/SiteGutterFrame";import{COPY_MARK as T}from"../../lib/content/copy-mark.js";import{FACET_TEMPLATE_SLOT as d,FACET_TICK as f,FACET_TICK_INK_CLASS as _,FACET_TICK_VAR as p}from"../../lib/content/facet-row-seed.js";import{ALLOY_WHEELS_LISTING_TYPE as C}from"../../lib/wheels/plp-hydrate.js";const A={[p]:`url("${f}")`},E="[--sf-card-lift:none] [--sf-card-shadow-hover:var(--sf-card-shadow,none)]";function I({owner:t,rows:a,dead:l,label:r,className:s,editing:i}){return e("ul",{className:`flex flex-col ${s} ${T} ${_} ${E}`,style:A,"aria-label":r,children:e(c,{children:e(m,{ownerId:t.id,ownerType:t.type??C,slot:d,Template:t.facetTemplate,rows:a.items,states:a.states,actions:i?void 0:a.actions,fallback:null,wrapCopy:(o,n)=>e("li",{className:l[n.index]?"-mx-3 opacity-40":"-mx-3",children:o}),children:o=>o})})})}export{I as default};
|
|
@@ -1,31 +1,36 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
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
|
-
|
|
6
|
-
|
|
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, }: {
|
|
7
|
+
facets: (Omit<PlpFacetGroup, "key"> & {
|
|
8
|
+
key: K;
|
|
9
|
+
})[];
|
|
7
10
|
filters: PlpFilterState;
|
|
8
|
-
typeOptions
|
|
9
|
-
sizeBoxes
|
|
10
|
-
sizeMatches
|
|
11
|
+
typeOptions?: PlpTypeOption[];
|
|
12
|
+
sizeBoxes?: PlpTyreSizeBox[] | null;
|
|
13
|
+
sizeMatches?: number | null;
|
|
11
14
|
noun: {
|
|
12
15
|
one: string;
|
|
13
16
|
many: string;
|
|
14
17
|
};
|
|
15
|
-
priceBounds
|
|
18
|
+
priceBounds?: {
|
|
16
19
|
min: number;
|
|
17
20
|
max: number;
|
|
18
21
|
} | null;
|
|
19
22
|
inStockCount: number | null;
|
|
20
|
-
onToggle: (key:
|
|
21
|
-
onPickType
|
|
22
|
-
onPickSize
|
|
23
|
-
onPriceMax
|
|
23
|
+
onToggle: (key: K, value: string) => void;
|
|
24
|
+
onPickType?: (kind: ProductKind | null) => void;
|
|
25
|
+
onPickSize?: (part: TyreSizePart, value: number | null) => void;
|
|
26
|
+
onPriceMax?: (value: number | null) => void;
|
|
24
27
|
onInStockOnly: (value: boolean) => void;
|
|
25
28
|
onClearAll: () => void;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
price?: {
|
|
30
|
+
label: string;
|
|
31
|
+
control: ReactNode;
|
|
29
32
|
};
|
|
33
|
+
foot?: ReactNode;
|
|
34
|
+
owner: RailOwner;
|
|
30
35
|
editing?: boolean;
|
|
31
36
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import E from"../catalog/ClearAllButton.js";import{useState as F}from"react";import{say as A}from"efficient-web-builder/format/lib/editor-words";import{useCurrency as _}from"../CurrencyContext.js";import{useEnglish as L}from"../EnglishVariant.js";import{formatPrice as g}from"../../lib/commerce.js";import{facetRow as M}from"../../lib/content/facet-row-seed.js";import{optionCardRows as R}from"../../lib/sections/filter-option-rows.js";import{hasActivePlpFilters as O,isDeadPlpOption as N,PLP_FACET_LABELS as D}from"../../lib/wheels/plp-filters.js";import I from"./PlpFacetRows.js";import U from"./PlpInStockToggle.js";import q from"./PlpTypePicker.js";import G from"./PlpTyreSizeBoxes.js";function H({facets:o,filters:t,typeOptions:c=[],sizeBoxes:m=null,sizeMatches:w=null,noun:s,priceBounds:n=null,inStockCount:x,onToggle:P,onPickType:S,onPickSize:C,onPriceMax:$,onInStockOnly:j,onClearAll:z,price:d,foot:h,owner:b,editing:y=!1}){const{currency:u}=_(),p=L(),[f,v]=F({});return r("aside",{className:"-mx-3 w-[calc(100%+1.5rem)] flex-none px-3 lg:sticky lg:[--sf-plp-rail-gap:16px] lg:[--sf-plp-rail-top:calc(var(--sf-header-h,88px)+var(--sf-plp-rail-gap))] lg:top-[var(--sf-plp-rail-top)] lg:max-h-[calc(100svh-var(--sf-plp-rail-top)-var(--sf-plp-rail-gap))] lg:w-[292px] lg:overflow-y-auto lg:overscroll-contain lg:pr-[22px]",children:[r("div",{className:"flex items-center justify-between pb-2",children:[e("h2",{className:"font-display text-[18px] font-medium uppercase tracking-[-0.01em]",children:A("Filter")}),O(t)&&e(E,{onClick:z,size:"text-[11px]"})]}),c.length>0&&e("div",{className:"pb-1 pt-1",children:e(q,{options:c,noun:s.many,onPick:S??(()=>{}),owner:b,editing:y})}),x!==null&&e("div",{className:"border-t border-line py-2",children:e(U,{checked:t.inStockOnly,count:x,noun:s.many,onChange:j})}),m&&e(k,{label:p(D.tyreSizes),open:!f.tyreSizes,onToggle:()=>v(l=>({...l,tyreSizes:!l.tyreSizes})),children:!f.tyreSizes&&e("div",{className:"pb-3",children:e(G,{boxes:m,composed:t.tyreSizes[0]??"",matches:w,noun:s.many,onPick:C??(()=>{})})})}),o.map(l=>{if(l.options.length===0)return null;const i=!f[l.key],T=R(l.options,{item:a=>M(a,a.checked),selected:a=>a.checked,press:a=>()=>P(l.key,a.value),label:a=>`${p(l.label)}: ${a.label} (${a.count} ${s.many})`,disabled:N});return e(k,{label:p(l.label),open:i,onToggle:()=>v(a=>({...a,[l.key]:!a[l.key]})),children:i&&e(I,{owner:b,rows:T,dead:l.options.map(N),label:p(l.label),className:"pb-3",editing:y})},l.key)}),d?r("div",{className:"border-t border-line py-3",children:[e("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em]",children:d.label}),e("div",{className:"mt-2",children:d.control})]}):n&&r("div",{className:"border-t border-line py-3",children:[r("span",{className:"font-mono text-[11px] uppercase tracking-[0.2em]",children:["Price · per ",s.one]}),e("input",{type:"range",min:n.min,max:n.max,step:5,value:t.priceMax??n.max,onChange:l=>{const i=Number(l.target.value);$?.(i>=n.max?null:i)},className:"mt-2 w-full accent-[var(--accent)]","aria-label":`Maximum price per ${s.one}`}),r("div",{className:"mt-1.5 flex justify-between font-mono text-[11px] tabular-nums",children:[e("span",{className:"text-fg-dim",children:g(n.min,u)}),r("span",{children:["Up to ",g(t.priceMax??n.max,u)]})]})]}),h&&e("div",{className:"border-t border-line py-3",children:h})]})}function k({label:o,open:t,onToggle:c,children:m}){return r("div",{className:"border-t border-line",children:[r("button",{type:"button",onClick:c,"aria-expanded":t,"aria-label":`${t?"Collapse":"Expand"} ${o} 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:o}),e("span",{"aria-hidden":"true",className:`font-mono text-[10px] text-fg-dim transition-transform ${t?"rotate-180":""}`,children:"▾"})]}),m]})}export{H as default};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import type { SlotComponent } from "efficient-easel/blocks";
|
|
2
1
|
import { type PlpTypeOption } from "../../lib/wheels/plp-filters.js";
|
|
3
2
|
import type { ProductKind } from "../../lib/api/index.js";
|
|
3
|
+
import { type RailOwner } from "./PlpFacetRows.js";
|
|
4
4
|
export default function PlpTypePicker({ options, noun, onPick, owner, editing, }: {
|
|
5
5
|
options: PlpTypeOption[];
|
|
6
6
|
noun: string;
|
|
7
7
|
onPick: (kind: ProductKind | null) => void;
|
|
8
|
-
owner:
|
|
9
|
-
id: string;
|
|
10
|
-
facetTemplate?: SlotComponent;
|
|
11
|
-
};
|
|
8
|
+
owner: RailOwner;
|
|
12
9
|
editing?: boolean;
|
|
13
10
|
}): import("react").JSX.Element | null;
|
|
@@ -333,7 +333,9 @@ export declare const fitment: {
|
|
|
333
333
|
getStockFitment: (make: string, model: string, year: number, modification: string, region?: string) => Promise<StockFitment | null>;
|
|
334
334
|
};
|
|
335
335
|
export declare const products: {
|
|
336
|
-
listWheels: (process?: string | null, opts?: ListReadOpts
|
|
336
|
+
listWheels: (process?: string | null, opts?: ListReadOpts & {
|
|
337
|
+
maxRows?: number;
|
|
338
|
+
}) => Promise<WheelSummary[]>;
|
|
337
339
|
listWheelsBySlug: (slugs: readonly string[], opts?: ListReadOpts) => Promise<WheelSummary[]>;
|
|
338
340
|
listCatalog: (kinds: readonly ProductKind[], vehicle?: TyreFitVehicleQuery | null, opts?: {
|
|
339
341
|
maxRows?: number;
|
|
@@ -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 U}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:E(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"?U([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?E(t,`site=${encodeURIComponent(e)}`):t}return E(t,await Mt())}function E(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Bt="preview";async function qt(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(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=E(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);return U(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 U(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 C=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},$=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,zt=t=>`${$(t)}currencies/`,Kt="/api/storefront/media/ingest/";class Vt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function Xt(){const t=Ut();if(!t)throw new Vt;return`${Kt}?${new URLSearchParams({site:t})}`}const Zt="X-Puck-Media-Manifest",rt=pt.contentHash,_={"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=>C("header-settings",r,s),l=r=>C("theme-settings",r,s),p=r=>C("chat-settings",r,s),g=r=>C("social-settings",r,s);return{findPageBySlug:async(r,a,n)=>{const c=new URLSearchParams({slug:r});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:a}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new jt(r,S.length);return S[0]??null},getPageById:(r,a)=>e(`/api/storefront/pages/${r}/`,{token:a}),saveLayout:(r,a,n,c,y)=>e(`/api/storefront/pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(r,a,n)=>e(`/api/storefront/pages/${r}/duplicate/`,{method:"POST",body:JSON.stringify({title:a.title,slug:a.slug}),token:n}),geocode:(r,a,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:r,country:n}:{q:r})}`,{token:a}),listBlockSources:r=>e("/api/storefront/block-sources/",{token:r}),listRecordTypes:r=>e("/api/storefront/record-types/",{token:r}),createPagePreviewLink:(r,a)=>e(`/api/storefront/pages/${r}/preview-link/`,{method:"POST",token:a}),claimPageEditLock:(r,a,n,c=!1)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:a}),releasePageEditLock:(r,a)=>e(`/api/storefront/pages/${r}/edit-lock/`,{method:"DELETE",token:a}),createTemplate:(r,a,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:r,layout:a}),headers:_,token:n}),getTemplate:(r,a)=>e(`/api/storefront/page-templates/${r}/`,{token:a}),saveTemplateLayout:(r,a,n)=>e(`/api/storefront/page-templates/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:_,token:n}),listTemplatePages:async(r,a)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(r,a,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(r)}&slug=${encodeURIComponent(a)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(r,a,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:r,...a}),headers:_,token:n}),saveTemplatePageLayout:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"PATCH",body:JSON.stringify({layout:a}),headers:_,token:n}),deleteTemplatePage:(r,a,n)=>e(`/api/storefront/template-pages/${r}/`,{method:"DELETE",token:a,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},createPage:(r,a,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:r,slug:a,layout:n}),token:c}),deletePage:(r,a)=>e(`/api/storefront/pages/${r}/`,{method:"DELETE",token:a}),getHeaderSettings:(r,a)=>e(o(a),{token:r}),listMenus:async(r,a)=>{const n=new URLSearchParams({no_page:"true"});a&&n.set("site",a);const c=await e(`/api/storefront/menus/?${n}`,{token:r});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:r});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(r,a)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.visibleOnly&&n.set("is_visible","true"),a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.sort_order-R.sort_order||S.name.localeCompare(R.name))},listForms:async(r,a={})=>{const n=new URLSearchParams({no_page:"true"});a.siteId&&n.set("site",a.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:r});return[...Array.isArray(c)?c:c.results??[]].sort((S,R)=>S.title.localeCompare(R.title))},listWheelSummaries:async(r,a={})=>{const n=new URLSearchParams;a.siteId&&n.set("site",a.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:r});return 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,E 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 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};
|
|
@@ -1549,6 +1549,7 @@ export interface components {
|
|
|
1549
1549
|
};
|
|
1550
1550
|
cornerStyle: "square" | "small" | "large";
|
|
1551
1551
|
cornerRadiusPx?: number | null;
|
|
1552
|
+
cornerRadiusUnit?: "px" | "vw" | null;
|
|
1552
1553
|
cardShadow: "none" | "soft" | "lifted";
|
|
1553
1554
|
shadowColor: string;
|
|
1554
1555
|
cardGap: "tight" | "normal" | "roomy";
|
|
@@ -1571,8 +1572,15 @@ export interface components {
|
|
|
1571
1572
|
};
|
|
1572
1573
|
textStyles?: components["schemas"]["ThemeTextStyle"][] | null;
|
|
1573
1574
|
siteWidth: number;
|
|
1575
|
+
siteWidthUnit?: "px" | "%" | "vw" | null;
|
|
1574
1576
|
siteGutter: number;
|
|
1577
|
+
siteGutterUnit?: "px" | "%" | "vw" | null;
|
|
1578
|
+
siteGutterPhone?: number | null;
|
|
1579
|
+
siteGutterPhoneUnit?: "px" | "%" | "vw" | null;
|
|
1575
1580
|
blockGap?: number | null;
|
|
1581
|
+
blockGapUnit?: "px" | "%" | "vw" | null;
|
|
1582
|
+
blockGapPhone?: number | null;
|
|
1583
|
+
blockGapPhoneUnit?: "px" | "%" | "vw" | null;
|
|
1576
1584
|
heroBackgroundFollowsWidth: boolean;
|
|
1577
1585
|
sectionBackgroundWidth: "full" | "content" | null;
|
|
1578
1586
|
sectionContentWidth: "full" | "content" | null;
|
|
@@ -1598,14 +1606,32 @@ export interface components {
|
|
|
1598
1606
|
font?: string;
|
|
1599
1607
|
color?: string;
|
|
1600
1608
|
size?: number;
|
|
1609
|
+
sizeTablet?: number;
|
|
1601
1610
|
sizePhone?: number;
|
|
1611
|
+
sizeUnit?: "px" | "vw";
|
|
1612
|
+
sizeUnitTablet?: "px" | "vw";
|
|
1613
|
+
sizeUnitPhone?: "px" | "vw";
|
|
1602
1614
|
weight?: number;
|
|
1603
1615
|
italic?: boolean;
|
|
1604
1616
|
lineHeight?: number;
|
|
1617
|
+
lineHeightTablet?: number;
|
|
1618
|
+
lineHeightPhone?: number;
|
|
1605
1619
|
letterSpacing?: number;
|
|
1620
|
+
letterSpacingTablet?: number;
|
|
1621
|
+
letterSpacingPhone?: number;
|
|
1606
1622
|
paragraphSpacing?: number;
|
|
1623
|
+
paragraphSpacingTablet?: number;
|
|
1624
|
+
paragraphSpacingPhone?: number;
|
|
1625
|
+
paragraphSpacingUnit?: "px" | "%" | "vw";
|
|
1626
|
+
paragraphSpacingUnitTablet?: "px" | "%" | "vw";
|
|
1627
|
+
paragraphSpacingUnitPhone?: "px" | "%" | "vw";
|
|
1607
1628
|
letterCase?: "none" | "upper" | "capitalize" | "lower";
|
|
1608
1629
|
largestSize?: number;
|
|
1630
|
+
largestSizeTablet?: number;
|
|
1631
|
+
largestSizePhone?: number;
|
|
1632
|
+
largestSizeUnit?: "px" | "vw";
|
|
1633
|
+
largestSizeUnitTablet?: "px" | "vw";
|
|
1634
|
+
largestSizeUnitPhone?: "px" | "vw";
|
|
1609
1635
|
};
|
|
1610
1636
|
WordStyle: {
|
|
1611
1637
|
font?: string | null;
|
|
@@ -1635,6 +1661,7 @@ export interface components {
|
|
|
1635
1661
|
logoPosition: "left" | "center" | "right";
|
|
1636
1662
|
logoSize: "small" | "medium" | "large";
|
|
1637
1663
|
logoSizePx: number | null;
|
|
1664
|
+
logoSizeUnit?: "px" | "%" | "vw" | null;
|
|
1638
1665
|
reverseLogo: boolean;
|
|
1639
1666
|
menuHandle: string | null;
|
|
1640
1667
|
menuItems: {
|
|
@@ -1649,6 +1676,7 @@ export interface components {
|
|
|
1649
1676
|
menuSplit: number;
|
|
1650
1677
|
menuRow: "top" | "bottom" | "inline";
|
|
1651
1678
|
menuGapPx?: number | null;
|
|
1679
|
+
menuGapUnit?: "px" | "%" | "vw" | null;
|
|
1652
1680
|
searchEnabled: boolean;
|
|
1653
1681
|
searchPosition: "left" | "right";
|
|
1654
1682
|
searchRow: "top" | "bottom";
|
|
@@ -3,12 +3,16 @@ import { type SeededNode } from "efficient-web-builder/format/lib/document/seed-
|
|
|
3
3
|
type Props = Record<string, unknown>;
|
|
4
4
|
export declare const BOOKING_SERVICE_SLOT = "serviceTemplate";
|
|
5
5
|
export declare const BOOKING_TIME_SLOT = "timeTemplate";
|
|
6
|
+
export declare const BOOKING_SERVICE_FIELDS: readonly CardRowFieldSpec[];
|
|
7
|
+
export declare const BOOKING_TIME_FIELDS: readonly CardRowFieldSpec[];
|
|
6
8
|
export declare const BOOKING_TEMPLATE_SLOTS: readonly [{
|
|
7
9
|
readonly slot: "serviceTemplate";
|
|
8
10
|
readonly label: "Service template";
|
|
11
|
+
readonly fields: readonly CardRowFieldSpec[];
|
|
9
12
|
}, {
|
|
10
13
|
readonly slot: "timeTemplate";
|
|
11
14
|
readonly label: "Time template";
|
|
15
|
+
readonly fields: readonly CardRowFieldSpec[];
|
|
12
16
|
}];
|
|
13
17
|
export declare const BOOKING_OPTION_FIELDS: readonly CardRowFieldSpec[];
|
|
14
18
|
export declare const BOOKING_OPTION_ALLOW: readonly ["Text", "Flex"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BOX_HIDE_WHEN_ROW_EMPTY as
|
|
1
|
+
import{BOX_HIDE_WHEN_ROW_EMPTY as g}from"efficient-web-builder/format/lib/content/card-template";import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as s}from"efficient-web-builder/format/lib/document/container-blocks";import{rowFieldTextSeed as l}from"efficient-web-builder/format/lib/document/blocks/general/Cards/card-seed";import{BOX as T,DIM as u,INNER_BOX as d,TEXT as _,boxPadding as f,seedNodes as S}from"efficient-web-builder/format/lib/document/seed-parts";import{parseSectionHeadPlacement as b}from"efficient-web-builder/format/lib/sections/section-head-placement";import{BOOKING_KIND_PROP as P,bookingKindRole as k}from"../booking/text-kinds.js";const p="serviceTemplate",O="timeTemplate",B=[{key:"name",label:"Service"},{key:"meta",label:"Duration · price"},{key:"description",label:"Service description",multiline:!0}],E=[{key:"time",label:"Time"},{key:"businessTime",label:"Business time"}],F=[{slot:p,label:"Service template",fields:B},{slot:O,label:"Time template",fields:E}],C=[...B,...E],I=["Text",o],W={[p]:{type:"slot",allow:[...I]},[O]:{type:"slot",allow:[...I]}},y="BookingBox",L="AppointmentBooking",a=(e,t,n={})=>({fontRole:e,size:t,...n});function c(e,t,n,i=!1){const r=k(n[P[t]]);if(!r)return e;const{fontRole:D,size:N,...x}=e;return{...x,role:r,...i?{size:N}:{}}}const m={lineHeight:1.5};function h(e){return{type:o,props:{...T,direction:"column",name:"Service",justify:"center",gap:12,gapPhone:12,...f(16,16),sectionBorder:{width:1}},slots:{[s]:[{type:o,props:{...d,name:"Words",gap:4,gapPhone:4},slots:{[s]:[l("name",{..._,tag:"span"},c(a("heading",18,{weight:500,...m}),"name",e)),l("meta",{...u,tag:"span"},c(a("label",11,{case:"upper",letterSpacing:.14,...m}),"value",e))]}},{type:o,props:{...d,name:"Description",[g]:["description"]},slots:{[s]:[l("description",{...u,tag:"span"},c(a("heading",14,m),"note",e))]}}]}}}function K(e){return{type:o,props:{...T,direction:"column",name:"Time",align:"center",justify:"center",gap:2,gapPhone:2,...f(8,12),sectionBorder:{width:1},sectionHeightMode:"fixed",sectionHeightValue:44,sectionHeightUnit:"px"},slots:{[s]:[l("time",{..._,tag:"span"},c(a("label",12,{weight:600,case:"upper",letterSpacing:.12,align:"center",...m}),"value",e)),{type:o,props:{...d,name:"Business time",align:"center",[g]:["businessTime"]},slots:{[s]:[l("businessTime",{...u,tag:"span"},c(a("label",9,{case:"upper",letterSpacing:.08,align:"center",...m}),"value",e,!0))]}}]}}}function v(e,t={}){return S([h(t)],(n,i)=>i==="0"?`${e}~service`:`${e}~service.${i.slice(2)}`)}function G(e,t={}){return S([K(t)],(n,i)=>i==="0"?`${e}~time`:`${e}~time.${i.slice(2)}`)}function w(e,t){return e===y?t.region==="booking":e===L?t.layout!=="boxes"||b(t.headPlacement)==="own-box":!1}function Y(e,t){if(!w(e,t))return t;const n=t[p]===void 0,i=t[O]===void 0;if(!n&&!i)return t;const r=typeof t.id=="string"&&t.id.trim()?t.id:e;return{...t,...n?{[p]:v(r,t)}:{},...i?{[O]:G(r,t)}:{}}}export{L as APPOINTMENT_BOOKING_TYPE,y as BOOKING_BOX_TYPE,I as BOOKING_OPTION_ALLOW,C as BOOKING_OPTION_FIELDS,B as BOOKING_SERVICE_FIELDS,p as BOOKING_SERVICE_SLOT,F as BOOKING_TEMPLATE_SLOTS,W as BOOKING_TEMPLATE_SLOT_FIELDS,E as BOOKING_TIME_FIELDS,O as BOOKING_TIME_SLOT,v as bookingServiceSeed,G as bookingTimeSeed,w as drawsBookingStep,Y as withBookingTemplates};
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { type CardRowFieldSpec } from "efficient-web-builder/format/lib/content/card-template";
|
|
1
2
|
import { type BlockSeed } from "efficient-web-builder/format/lib/document/seed-parts";
|
|
2
3
|
type Props = Record<string, unknown>;
|
|
3
4
|
export declare const CONTACT_TOPIC_SLOT = "template";
|
|
4
5
|
export declare const CONTACT_REASON_SLOT = "reasonTemplate";
|
|
5
6
|
export declare const CONTACT_CHANNEL_SLOT = "channelTemplate";
|
|
7
|
+
export declare const CONTACT_TOPIC_FIELDS: readonly CardRowFieldSpec[];
|
|
8
|
+
export declare const CONTACT_REASON_FIELDS: readonly CardRowFieldSpec[];
|
|
9
|
+
export declare const CONTACT_CHANNEL_FIELDS: readonly CardRowFieldSpec[];
|
|
6
10
|
export declare const CONTACT_TEMPLATE_ALLOW: readonly ["Text", "ImageBlock", "Flex"];
|
|
7
11
|
export declare const contactTopicSeed: () => BlockSeed;
|
|
8
12
|
export declare const contactReasonSeed: () => BlockSeed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BOX_HIDE_WHEN_ROW_EMPTY as
|
|
1
|
+
import{BOX_HIDE_WHEN_ROW_EMPTY as C,CARD_ROW_LINK_PROP as E}from"efficient-web-builder/format/lib/content/card-template";import{BOX_TYPE as o,CONTAINER_BLOCKS_SLOT as l}from"efficient-web-builder/format/lib/document/container-blocks";import{rowFieldTextSeed as n}from"efficient-web-builder/format/lib/document/blocks/general/Cards/card-seed";import{BOX as S,DIM as r,INNER_BOX as b,TEXT as c,boxPadding as d,labelStyle as N,seedNodes as f,token as O}from"efficient-web-builder/format/lib/document/seed-parts";const h="template",_="reasonTemplate",L="channelTemplate",y={key:"title",label:"Title",plain:!0},$=[{key:"eyebrow",label:"Eyebrow",plain:!0},y,{key:"copy",label:"Body",multiline:!0},{key:"response",label:"Response time"}],M=[y],V=[{key:"label",label:"Label",plain:!0},{key:"value",label:"Value",plain:!0},{key:"sub",label:"Sub line",plain:!0},{key:"href",label:"Link",kind:"link"}],Y=["Text","ImageBlock",o],p=(e,t)=>({...N(e),letterSpacing:t,lineHeight:1.5}),m={...p(12,.24),color:"main"},P={textStyle:"heading-3",...O("headingSmall",26),weight:500,case:"upper",lineHeight:1.05,letterSpacing:-.02},x={textStyle:"heading-1",...O("body",14),weight:400,case:"none",lineHeight:1.5,letterSpacing:0,color:"muted"},u=p(12,.22),w=p(12,.2),A={...p(12,.3),color:"main"},R={textStyle:"heading-3",...O("headingSmall",24),weight:500,case:"none",lineHeight:1.2,letterSpacing:-.02},H={...p(12,.2),color:"muted"},s=(e,t,i={})=>({...b,name:e,gap:t,gapPhone:t,...i}),I=()=>({type:o,props:s("Topic",16,{justify:"between",...d(40,32),sectionHeightMode:"fixed",sectionHeightValue:240,sectionHeightUnit:"px"}),slots:{[l]:[{type:o,props:s("Head",16),slots:{[l]:[n("eyebrow",{...c,tag:"p",widthFit:"fill"},m),n("title",{...c,tag:"h3",widthFit:"fill"},P)]}},{type:o,props:s("Foot",24),slots:{[l]:[n("copy",{...r,tag:"p",widthFit:"fill"},x),{type:o,props:{...S,name:"Response",direction:"row",justify:"between",align:"center",gap:16,gapPhone:16,phoneRow:2,sharePhone:"content",wrapPhone:"nowrap",...d(0,0),sectionPaddingTop:16,sectionPaddingTopPhone:16,sectionBorder:{top:1},[C]:["response"]},slots:{[l]:[{type:"Text",props:{...r,tag:"p",text:"Response",_partStyles:{text:u}}},n("response",{...c,tag:"p"},u)]}}]}}]}}),B=()=>({type:o,props:{...s("Reason",0),...d(12,16),sectionBorder:{width:1}},slots:{[l]:[n("title",{...r,tag:"p"},w)]}}),k=()=>({type:o,props:{...s("Channel",12),...d(32,20,20,20),sectionPaddingLeft:22,sectionPaddingTopTablet:20,sectionPaddingRightTablet:20,sectionPaddingBottomTablet:20,sectionPaddingLeftTablet:20,sectionBorder:{bottom:1}},slots:{[l]:[n("label",{...c,tag:"p",widthFit:"fill"},A),{type:o,props:{...s("Value",0),[E]:"href"},slots:{[l]:[n("value",{...c,tag:"p",widthFit:"fill"},R)]}},n("sub",{...r,tag:"p",widthFit:"fill"},H)]}});function g(e,t,i){return f([e],(T,a)=>a==="0"?`${t}~${i}`:`${t}~${i}.${a.slice(2)}`)}const F=e=>typeof e.id=="string"&&e.id.trim()?e.id:"ContactRouting";function U(e){const t=e[h]===void 0,i=e[_]===void 0,T=e[L]===void 0;if(!t&&!i&&!T)return e;const a=F(e);return{...e,...t?{[h]:g(I(),a,"topic")}:{},...i?{[_]:g(B(),a,"reason")}:{},...T?{[L]:g(k(),a,"channel")}:{}}}export{V as CONTACT_CHANNEL_FIELDS,L as CONTACT_CHANNEL_SLOT,M as CONTACT_REASON_FIELDS,_ as CONTACT_REASON_SLOT,Y as CONTACT_TEMPLATE_ALLOW,$ as CONTACT_TOPIC_FIELDS,h as CONTACT_TOPIC_SLOT,k as contactChannelSeed,B as contactReasonSeed,I as contactTopicSeed,U as withContactTemplates};
|