efficient-storefront-blocks 0.123.2 → 0.124.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 +19 -0
- package/dist/chunks/CustomHtmlCodeWindow-6QU56I6L.js +26 -0
- package/dist/chunks/{EditorPreviewCheckout-GKVO7FIF.js → EditorPreviewCheckout-TRX42H6I.js} +4 -4
- package/dist/chunks/SiteEditorProvider-IBJ5A5V3.js +1 -0
- package/dist/chunks/chunk-27GSFHNV.js +1 -0
- package/dist/chunks/chunk-CDKQFBBA.js +1 -0
- package/dist/chunks/chunk-EKCLPISP.js +96 -0
- package/dist/chunks/{chunk-HG7XPHVS.js → chunk-ESQTNC7T.js} +21 -20
- package/dist/chunks/chunk-JJ5MCDPE.js +1 -0
- package/dist/chunks/chunk-MC6E4ZLD.js +339 -0
- package/dist/chunks/chunk-O5WPKRAC.js +2 -0
- package/dist/chunks/chunk-S5N6H2MP.js +1 -0
- package/dist/chunks/chunk-T7CS442T.js +4 -0
- package/dist/chunks/chunk-YCL4MPLF.js +1 -0
- package/dist/chunks/fitment-data-MXT6XIW5.js +1 -0
- package/dist/chunks/{section-css-style-TIXCQNGX.js → section-css-style-ZZ3ZOGPR.js} +1 -1
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +138 -27
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/BoxHeaderBar.js +1 -1
- package/dist/render/components/GalleryShowcase.js +1 -1
- package/dist/render/components/card-pieces/CardProductPicture.js +1 -1
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/content/english-variant.js +1 -1
- package/dist/render/lib/content/header-bar.js +1 -1
- package/dist/render/lib/content/tab-strip.js +1 -1
- package/dist/render/lib/content/title-look.js +1 -1
- package/dist/render/lib/document/blocks/commerce/DetailRows/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FitmentPicker/render.js +1 -1
- package/dist/render/lib/document/blocks/service/OpeningHours/render.js +1 -1
- package/dist/render/lib/document/blocks/service/SignUp/render.js +1 -1
- package/dist/render/lib/document/subscribe-content-type.js +1 -1
- package/dist/render/lib/sections/catalog-filter-layout.js +1 -1
- package/dist/render/lib/sections/fitment-cell-look.js +1 -1
- package/dist/render/lib/sections/hero-arrangement.js +1 -1
- package/dist/render/lib/sections/hero-gallery.js +1 -1
- package/dist/render/lib/sections/hero-price-placement.js +1 -1
- package/dist/render/lib/sections/product-grid-pages.js +1 -1
- package/dist/render/lib/sections/shopper-filters.js +1 -1
- package/dist/render/lib/wheels/plp-filters.js +1 -1
- package/dist/render/lib/wheels/set-mode.js +1 -1
- package/dist/routine-index.json +1 -0
- package/dist/value-index.json +1 -0
- package/dist/words.d.ts +28 -0
- package/dist/words.js +5 -5
- package/package.json +18 -4
- package/dist/chunks/SiteEditorProvider-INLF7RK2.js +0 -1
- package/dist/chunks/chunk-3UESM7IL.js +0 -1
- package/dist/chunks/chunk-A4GCH4L7.js +0 -1
- package/dist/chunks/chunk-ABH43N7O.js +0 -96
- package/dist/chunks/chunk-JRGIFGZA.js +0 -1
- package/dist/chunks/chunk-MFXGST7A.js +0 -342
- package/dist/chunks/chunk-PGKDGGEE.js +0 -1
- package/dist/chunks/fitment-data-6YOZL3W4.js +0 -1
- /package/dist/chunks/{chunk-HG7XPHVS.js.LEGAL.txt → chunk-ESQTNC7T.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-MFXGST7A.js.LEGAL.txt → chunk-MC6E4ZLD.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as x}from"react/jsx-runtime";import{parseOption as _}from"efficient-
|
|
1
|
+
"use client";import{jsx as x}from"react/jsx-runtime";import{parseOption as _}from"efficient-shell/format";import{useEffect as v,useState as E}from"react";import{useRootIsDark as y}from"efficient-shell/theme";import{usePathname as T}from"next/navigation";import{useHeaderBar as D}from"./useHeaderBar.js";import{headerSolidBackground as I,isProductPage as P,resolveHeaderHeightPx as R}from"../lib/content/header-bar.js";import{headerThemeWrap as S}from"../lib/content/header-theme.js";import{HEADER_SET_HEIGHT_VAR as A}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_OVERRIDE_ATTR as B,resolveHeaderInkMode as j}from"efficient-web-builder/render/lib/document/header-ink";import{centredCap as w,SITE_WIDTH_CAP as M}from"efficient-web-builder/format/lib/content/page-width";import{HideTaker as O}from"efficient-web-builder/render/components/ViewHideRoot";import{blockParts as C}from"../lib/block-parts.js";const N=C("SiteHeader"),W=["none","always","on_scroll_up"],K=r=>_(W,"always",r);function V({sticky:r,topTextColor:c,heightPx:m,theme:u,bandCapped:f=!1,children:p}){const t=K(r),a=R(m),{headerRef:o,scrolled:n,navHidden:h}=D({stickyMode:t,heightPx:a}),s=j(c),g=s==="auto"?null:{[B]:s},e=S(u),d=P(T()),[b,H]=E(null);v(()=>H(o.current?.ownerDocument??null),[o]);const k=!y({doc:b,whenUnset:!0}),l=n||d,i=I(k,d);return x(O,{as:"header",ref:o,"data-scrolled":n||void 0,"data-box-header":"",...g,className:["sf-site-header",...e?[e.className]:[],"flex flex-col justify-center",t==="none"?"absolute":"fixed","inset-x-0 top-0 z-50",l?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...e?e.style:null,minHeight:`var(${A}, ${a}px)`,...f?w(M):null,...h?{transform:"translateY(-100%)"}:null,...l?{background:i,color:"var(--fg)","--sf-header-ground":i}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},...N("header"),children:p})}export{V as default,K as resolveStickyMode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as r,Fragment as y}from"react/jsx-runtime";import $e from"next/link";import{useMemo as R,useState as N}from"react";import{slugify as F}from"efficient-shell/format";import{stripMarkup as T}from"efficient-web-builder/format/lib/markup";import{renderChrome as k,renderGold as i,renderHeadline as Ce}from"efficient-web-builder/render/components/goldPhrases";import O from"efficient-web-builder/render/components/Placeholder";import je,{LightboxClose as Se}from"./Lightbox.js";import ze from"./ThemedSelect.js";import{say as $}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as Le}from"efficient-web-builder/render/components/ViewHideRoot";import{parseOption as _e}from"efficient-web-builder/format/lib/parse-option";const l={bodyUpTo720:"max-view-tablet:text-[length:var(--size-body,15px)]",labelUpTo720:"max-view-tablet:text-[length:var(--size-label,11px)]",body:"text-[length:var(--size-body,17px)]",labelXs:"text-[length:var(--size-label,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"};function W(x){const g=[x.image,...(x.photos??[]).map(f=>f?.src)].filter(f=>!!f);return g.length?g:[""]}const G=6,Ae=()=>Array.from({length:G},(x,g)=>({image:"",process:$("Tag"),eyebrow:$("Category"),name:$("Item name"),meta:$("{n} photos",{n:`0${g+1}`})}));function Pe({mode:x="both",kicker:g,breadcrumbLabel:f,vehicleTabLabel:X="Gallery A",vehicleTitle:Y,vehicleBody1:ee,vehicleBody2:te,vehicleStats:ae,vehicleCards:B,wheelTabLabel:U="Gallery B",wheelTitle:re,wheelBody1:le,wheelBody2:ne,wheelStats:se,wheelCards:H,othersTitle:oe,othersBody1:ie,othersBody2:ce,othersStats:me,othersCards:pe,showBreadcrumb:de=!0,showStats:xe=!0,showIntro:ge=!0,showTabs:fe=!0,showFilters:E=!0,showCount:M=!0,showSort:I=!0,previewTab:C,previewHover:ue=!1,editing:h=!1}){const j=x==="both",v=j?["vehicles","wheels"]:x==="wheels"?["wheels"]:x==="others"?["others"]:["vehicles"],[be,he]=N(v[0]),w=(h&&j&&C&&v.includes(C)?C:null)??_e(v,v[0],be),ve=h&&ue,[S,Z]=N("all"),[z,we]=N("newest"),[L,b]=N(null),n=w==="vehicles"?{title:Y,body1:ee,body2:te,stats:ae??[],cards:B??[],unit:"items",word:X}:w==="others"?{title:oe,body1:ie,body2:ce,stats:me??[],cards:pe??[],unit:"items",word:"Others"}:{title:re,body1:le,body2:ne,stats:se??[],cards:H??[],unit:"items",word:U},D=R(()=>{const e=[];for(const a of n.cards)a.process&&!e.includes(a.process)&&e.push(a.process);return e},[n.cards]),_=S!=="all"&&D.includes(S)?S:"all",V=_==="all"?n.cards:n.cards.filter(e=>e.process===_),q=R(()=>{const e=[...V];return z==="name"&&e.sort((a,o)=>(a.name??"").localeCompare(o.name??"")),e},[V,z]),J=n.cards.length===0,A=h&&J,P=A?Ae():q,ye=A?G:n.cards.length,Ne=A?G:q.length,K=g?`${g} · ${T(n.word)}`:void 0;function ke(e){e!==w&&(he(e),Z("all"))}return r(Le,{as:"section",className:"relative z-[2] bg-bg",children:[de&&r("nav",{className:`mx-auto flex max-w-[var(--sf-site-width,1600px)] items-center gap-4 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono ${l.labelLarge} uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-4`,children:[t("span",{className:"hover:text-fg",children:"Home"}),t("span",{className:"opacity-40",children:"/"}),t("span",{className:"text-fg",children:f?k(f):"Gallery"})]}),r("div",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[auto_1fr_auto] items-end gap-[60px] border-b border-line px-[var(--sf-site-gutter,40px)] pt-[100px] pb-[60px] max-view-desktop:grid-cols-1 max-view-desktop:gap-5 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-[60px]",children:[t("span",{className:`pb-4 font-mono ${l.labelXl} uppercase tracking-[0.3em] text-accent`,children:K?i(K):null}),t("h2",{className:"font-display text-[length:min(var(--size-headingLarge,clamp(64px,9vw,140px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.9] tracking-[-0.04em]",children:n.title?Ce(n.title,!0):null}),t("div",{className:`pb-4 text-right font-mono ${l.labelLarge} uppercase leading-[1.8] tracking-[0.18em] text-fg-dim max-view-desktop:text-left`,children:xe&&n.stats.map((e,a)=>r("div",{children:[e.value?t("strong",{className:"font-normal text-fg",children:i(e.value)}):null," ",e.label?i(e.label):null]},a))})]}),ge&&(n.body1||n.body2)&&r("div",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-2 gap-[60px] px-[var(--sf-site-gutter,40px)] pt-8 max-view-desktop:grid-cols-1 max-view-desktop:gap-4 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[n.body1&&t("p",{className:`max-w-[540px] font-display ${l.body} leading-[1.6] text-fg-dim`,children:i(n.body1)}),n.body2&&t("p",{className:`max-w-[540px] font-display ${l.body} leading-[1.6] text-fg-dim`,children:i(n.body2)})]}),j&&fe&&t("div",{className:"mx-auto mt-10 flex max-w-[var(--sf-site-width,1600px)] items-stretch border-y border-line px-[var(--sf-site-gutter,40px)] max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-tablet:px-3",children:["vehicles","wheels"].map((e,a)=>{const o=w===e,c=e==="vehicles"?X:U,u=e==="vehicles"?(B??[]).length:(H??[]).length,m=(c||"").trim().split(/\s+/),p=m.slice(0,-1).join(" "),s=m.slice(-1)[0]??"";return r("button",{type:"button",onClick:()=>ke(e),className:["group relative grid flex-1 cursor-pointer grid-cols-[auto_1fr_auto] items-end gap-5 px-6 py-8 text-left transition-colors",a===0?"border-r border-line":"","max-view-tablet:grid-cols-[auto_1fr] max-view-tablet:items-center max-view-tablet:gap-2 max-view-tablet:px-3 max-view-tablet:py-3",o?"bg-surface":"hover:bg-fg/[0.04]"].join(" "),children:[t("span",{className:[`pb-2 font-mono ${l.labelLarge} tracking-[0.3em] max-view-tablet:pb-0 ${l.labelUpTo720} max-view-tablet:tracking-[0.24em]`,o?"text-accent":"text-fg-dim group-hover:text-accent"].join(" "),children:a===0?"A":"B"}),r("span",{className:`font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3.6vw,48px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.02em] ${l.bodyUpTo720}`,children:[p?r(y,{children:[k(p)," "]}):null,t("em",{className:"font-normal italic text-accent",children:k(s)})]}),r("span",{className:`pb-2 text-right font-mono ${l.labelSmall} uppercase leading-[1.7] tracking-[0.24em] text-fg-dim max-view-tablet:hidden`,children:[t("strong",{className:"font-normal text-fg",children:u})," ","items",t("br",{}),e==="vehicles"?"Community photos":"Featured photos"]}),o&&t("span",{className:"pointer-events-none absolute inset-x-0 -bottom-px h-0.5 bg-accent"})]},e)})}),(E||M||I)&&r("div",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[auto_1fr_auto] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-5 max-view-tablet:grid-cols-1 max-view-tablet:gap-4 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-3",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[t("div",{className:"flex flex-wrap gap-1",children:E&&["all",...D].map(e=>{const a=_===e,o=e==="all"?"All":e;return t("button",{type:"button",onClick:()=>Z(e),className:[`cursor-pointer border px-4 py-3 font-mono ${l.labelLarge} uppercase tracking-[0.2em] transition-colors`,a?"border-fg bg-fg text-bg":"border-transparent text-fg-dim hover:text-fg"].join(" "),children:k(o)},e)})}),M?r("div",{className:`text-center font-mono ${l.labelLarge} uppercase tracking-[0.2em] text-fg-dim`,children:[t("strong",{className:"font-normal text-accent",children:Ne})," / ",ye," ",n.unit]}):t("div",{}),I?r("div",{className:`flex items-center gap-3 font-mono ${l.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:[t("span",{children:"Sort"}),r(ze,{value:z,onChange:e=>we(e.target.value),className:`cursor-pointer border border-line bg-bg px-3 py-2 font-mono ${l.labelLarge} uppercase tracking-[0.18em] text-fg`,children:[t("option",{value:"newest",children:"Newest"}),t("option",{value:"featured",children:"Featured"}),t("option",{value:"name",children:"Name A–Z"})]})]}):t("div",{})]}),t("div",{className:"mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] pt-5 pb-20 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",children:P.length>0?t("div",{className:"grid grid-cols-6 gap-2 max-view-desktop:grid-cols-2 max-view-tablet:grid-cols-1",children:P.map((e,a)=>{const o=W(e)[0],u=`group relative block aspect-[4/3] w-full overflow-hidden bg-surface-2 text-left ${a<2?"col-span-3 max-view-desktop:col-span-1":"col-span-2 max-view-desktop:col-span-1"}`,m=`${e.name??"card"}-${a}`,p=r(y,{children:[t(O,{label:F(e.name)||`gallery-card-${a+1}`,src:o||void 0,alt:T(e.name??""),sizes:"(max-width: 720px) 100vw, (max-width: 1100px) 50vw, 33vw",className:`transition-transform duration-700 ${ve?"scale-[1.04]":"group-hover:scale-[1.04]"}`}),r("div",{className:"pointer-events-none absolute inset-0 z-10 flex flex-col justify-between p-6 max-view-tablet:p-3",style:{background:"linear-gradient(180deg, rgba(10,10,10,.55) 0%, transparent 35%, transparent 55%, rgba(10,10,10,.92) 100%)"},children:[r("div",{className:`flex items-start justify-between font-mono ${l.labelSmall} uppercase tracking-[0.24em]`,children:[e.process?t("span",{className:"text-accent",children:i(e.process)}):t("span",{}),r("span",{className:"text-overlay-fg/70",children:[String(a+1).padStart(2,"0")," / ",String(P.length).padStart(2,"0")]})]}),r("div",{className:"flex flex-col gap-2",children:[e.eyebrow&&t("div",{className:`font-mono ${l.labelSmall} uppercase tracking-[0.24em] text-accent`,children:i(e.eyebrow)}),e.name&&t("div",{className:"font-heading3 text-[length:var(--size-headingSmall,clamp(22px,2.4vw,32px))] font-medium uppercase leading-none tracking-[-0.02em] text-overlay-fg",children:i(e.name)}),e.meta&&t("div",{className:`flex flex-wrap gap-3 pt-1 font-mono ${l.labelXs} uppercase tracking-[0.2em] text-overlay-fg/70`,children:t("span",{children:i(e.meta)})})]})]})]});return h?t("div",{className:u,children:p},m):t("button",{type:"button",onClick:()=>b({card:e,index:0}),"aria-label":`Open ${e.name??"gallery item"}`,className:`${u} cursor-pointer focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2`,children:p},m)})}):t("div",{className:`py-20 text-center font-mono ${l.labelXl} uppercase tracking-[0.2em] text-fg-dim`,children:J?"No items in this gallery yet.":"No items match this filter."})}),L&&(()=>{const e=W(L.card),{card:a,index:o}=L,c=e.length,u=e[o]??e[0]??"",m=s=>b(d=>d&&{...d,index:(d.index+s+c)%c}),p=[a.process,a.meta].filter(Boolean).join(" · ");return r(je,{open:!0,onClose:()=>b(null),label:a.name??"Gallery item",onPrev:c>1?()=>m(-1):void 0,onNext:c>1?()=>m(1):void 0,className:"flex cursor-zoom-out flex-col items-center justify-center p-6 max-view-tablet:p-3",children:[r("div",{className:"relative flex w-full flex-1 items-center justify-center",children:[t("div",{className:"relative h-full max-h-[72vh] w-full max-w-[92vw]",children:t(O,{label:F(a.name)||"gallery-photo",src:u||void 0,alt:T(a.name??""),objectFit:"contain",sizes:"92vw"})}),c>1&&r(y,{children:[t("button",{type:"button","aria-label":"Previous photo",onClick:s=>{s.stopPropagation(),m(-1)},className:"absolute left-2 top-1/2 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),t("button",{type:"button","aria-label":"Next photo",onClick:s=>{s.stopPropagation(),m(1)},className:"absolute right-2 top-1/2 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"})]})]}),r("div",{className:`mt-5 flex flex-col items-center gap-3 text-center font-mono ${l.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,onClick:s=>s.stopPropagation(),children:[r("div",{className:"flex flex-col items-center gap-1",children:[a.name&&t("span",{className:"text-accent",children:i(a.name)}),a.eyebrow&&t("span",{children:i(a.eyebrow)}),r("span",{className:"text-fg-dim/70",children:[p?r(y,{children:[i(p)," · "]}):null,o+1," / ",c]})]}),a.href&&t($e,{href:a.href,onClick:()=>b(null),className:`cursor-pointer border border-btn bg-btn/[0.08] px-5 py-3 font-mono ${l.labelLarge} uppercase tracking-[0.28em] text-btn transition-colors hover:bg-btn hover:text-btn-ink`,children:"View Product →"})]}),c>1&&t("div",{onClick:s=>s.stopPropagation(),className:"mt-5 flex max-w-[92vw] gap-2 overflow-x-auto pb-1",children:e.map((s,d)=>t("button",{type:"button","aria-label":`Photo ${d+1}`,onClick:()=>b(Q=>Q&&{...Q,index:d}),className:["relative h-16 w-24 shrink-0 cursor-pointer overflow-hidden border transition-colors max-view-tablet:h-12 max-view-tablet:w-16",d===o?"border-accent":"border-line opacity-60 hover:border-fg-dim hover:opacity-100"].join(" "),children:t(O,{label:F(a.name)||"gallery-photo",src:s||void 0,alt:"",sizes:"120px"})},`${s}-${d}`))}),t(Se,{})]})})()]})}export{Pe as default};
|
|
1
|
+
"use client";import{jsx as t,jsxs as r,Fragment as y}from"react/jsx-runtime";import $e from"next/link";import{useMemo as R,useState as N}from"react";import{slugify as F,parseOption as Ce}from"efficient-shell/format";import{stripMarkup as T}from"efficient-web-builder/format/lib/markup";import{renderChrome as k,renderGold as i,renderHeadline as je}from"efficient-web-builder/render/components/goldPhrases";import O from"efficient-web-builder/render/components/Placeholder";import Se,{LightboxClose as ze}from"./Lightbox.js";import Le from"./ThemedSelect.js";import{say as $}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as _e}from"efficient-web-builder/render/components/ViewHideRoot";const l={bodyUpTo720:"max-view-tablet:text-[length:var(--size-body,15px)]",labelUpTo720:"max-view-tablet:text-[length:var(--size-label,11px)]",body:"text-[length:var(--size-body,17px)]",labelXs:"text-[length:var(--size-label,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"};function W(x){const g=[x.image,...(x.photos??[]).map(f=>f?.src)].filter(f=>!!f);return g.length?g:[""]}const G=6,Ae=()=>Array.from({length:G},(x,g)=>({image:"",process:$("Tag"),eyebrow:$("Category"),name:$("Item name"),meta:$("{n} photos",{n:`0${g+1}`})}));function Pe({mode:x="both",kicker:g,breadcrumbLabel:f,vehicleTabLabel:X="Gallery A",vehicleTitle:Y,vehicleBody1:ee,vehicleBody2:te,vehicleStats:ae,vehicleCards:B,wheelTabLabel:U="Gallery B",wheelTitle:re,wheelBody1:le,wheelBody2:ne,wheelStats:se,wheelCards:H,othersTitle:oe,othersBody1:ie,othersBody2:ce,othersStats:pe,othersCards:me,showBreadcrumb:de=!0,showStats:xe=!0,showIntro:ge=!0,showTabs:fe=!0,showFilters:E=!0,showCount:M=!0,showSort:I=!0,previewTab:C,previewHover:ue=!1,editing:h=!1}){const j=x==="both",v=j?["vehicles","wheels"]:x==="wheels"?["wheels"]:x==="others"?["others"]:["vehicles"],[be,he]=N(v[0]),w=(h&&j&&C&&v.includes(C)?C:null)??Ce(v,v[0],be),ve=h&&ue,[S,Z]=N("all"),[z,we]=N("newest"),[L,b]=N(null),n=w==="vehicles"?{title:Y,body1:ee,body2:te,stats:ae??[],cards:B??[],unit:"items",word:X}:w==="others"?{title:oe,body1:ie,body2:ce,stats:pe??[],cards:me??[],unit:"items",word:"Others"}:{title:re,body1:le,body2:ne,stats:se??[],cards:H??[],unit:"items",word:U},D=R(()=>{const e=[];for(const a of n.cards)a.process&&!e.includes(a.process)&&e.push(a.process);return e},[n.cards]),_=S!=="all"&&D.includes(S)?S:"all",V=_==="all"?n.cards:n.cards.filter(e=>e.process===_),q=R(()=>{const e=[...V];return z==="name"&&e.sort((a,o)=>(a.name??"").localeCompare(o.name??"")),e},[V,z]),J=n.cards.length===0,A=h&&J,P=A?Ae():q,ye=A?G:n.cards.length,Ne=A?G:q.length,K=g?`${g} · ${T(n.word)}`:void 0;function ke(e){e!==w&&(he(e),Z("all"))}return r(_e,{as:"section",className:"relative z-[2] bg-bg",children:[de&&r("nav",{className:`mx-auto flex max-w-[var(--sf-site-width,1600px)] items-center gap-4 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono ${l.labelLarge} uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-4`,children:[t("span",{className:"hover:text-fg",children:"Home"}),t("span",{className:"opacity-40",children:"/"}),t("span",{className:"text-fg",children:f?k(f):"Gallery"})]}),r("div",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[auto_1fr_auto] items-end gap-[60px] border-b border-line px-[var(--sf-site-gutter,40px)] pt-[100px] pb-[60px] max-view-desktop:grid-cols-1 max-view-desktop:gap-5 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-[60px]",children:[t("span",{className:`pb-4 font-mono ${l.labelXl} uppercase tracking-[0.3em] text-accent`,children:K?i(K):null}),t("h2",{className:"font-display text-[length:min(var(--size-headingLarge,clamp(64px,9vw,140px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.9] tracking-[-0.04em]",children:n.title?je(n.title,!0):null}),t("div",{className:`pb-4 text-right font-mono ${l.labelLarge} uppercase leading-[1.8] tracking-[0.18em] text-fg-dim max-view-desktop:text-left`,children:xe&&n.stats.map((e,a)=>r("div",{children:[e.value?t("strong",{className:"font-normal text-fg",children:i(e.value)}):null," ",e.label?i(e.label):null]},a))})]}),ge&&(n.body1||n.body2)&&r("div",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-2 gap-[60px] px-[var(--sf-site-gutter,40px)] pt-8 max-view-desktop:grid-cols-1 max-view-desktop:gap-4 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[n.body1&&t("p",{className:`max-w-[540px] font-display ${l.body} leading-[1.6] text-fg-dim`,children:i(n.body1)}),n.body2&&t("p",{className:`max-w-[540px] font-display ${l.body} leading-[1.6] text-fg-dim`,children:i(n.body2)})]}),j&&fe&&t("div",{className:"mx-auto mt-10 flex max-w-[var(--sf-site-width,1600px)] items-stretch border-y border-line px-[var(--sf-site-gutter,40px)] max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-tablet:px-3",children:["vehicles","wheels"].map((e,a)=>{const o=w===e,c=e==="vehicles"?X:U,u=e==="vehicles"?(B??[]).length:(H??[]).length,p=(c||"").trim().split(/\s+/),m=p.slice(0,-1).join(" "),s=p.slice(-1)[0]??"";return r("button",{type:"button",onClick:()=>ke(e),className:["group relative grid flex-1 cursor-pointer grid-cols-[auto_1fr_auto] items-end gap-5 px-6 py-8 text-left transition-colors",a===0?"border-r border-line":"","max-view-tablet:grid-cols-[auto_1fr] max-view-tablet:items-center max-view-tablet:gap-2 max-view-tablet:px-3 max-view-tablet:py-3",o?"bg-surface":"hover:bg-fg/[0.04]"].join(" "),children:[t("span",{className:[`pb-2 font-mono ${l.labelLarge} tracking-[0.3em] max-view-tablet:pb-0 ${l.labelUpTo720} max-view-tablet:tracking-[0.24em]`,o?"text-accent":"text-fg-dim group-hover:text-accent"].join(" "),children:a===0?"A":"B"}),r("span",{className:`font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3.6vw,48px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.02em] ${l.bodyUpTo720}`,children:[m?r(y,{children:[k(m)," "]}):null,t("em",{className:"font-normal italic text-accent",children:k(s)})]}),r("span",{className:`pb-2 text-right font-mono ${l.labelSmall} uppercase leading-[1.7] tracking-[0.24em] text-fg-dim max-view-tablet:hidden`,children:[t("strong",{className:"font-normal text-fg",children:u})," ","items",t("br",{}),e==="vehicles"?"Community photos":"Featured photos"]}),o&&t("span",{className:"pointer-events-none absolute inset-x-0 -bottom-px h-0.5 bg-accent"})]},e)})}),(E||M||I)&&r("div",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[auto_1fr_auto] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-5 max-view-tablet:grid-cols-1 max-view-tablet:gap-4 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-3",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[t("div",{className:"flex flex-wrap gap-1",children:E&&["all",...D].map(e=>{const a=_===e,o=e==="all"?"All":e;return t("button",{type:"button",onClick:()=>Z(e),className:[`cursor-pointer border px-4 py-3 font-mono ${l.labelLarge} uppercase tracking-[0.2em] transition-colors`,a?"border-fg bg-fg text-bg":"border-transparent text-fg-dim hover:text-fg"].join(" "),children:k(o)},e)})}),M?r("div",{className:`text-center font-mono ${l.labelLarge} uppercase tracking-[0.2em] text-fg-dim`,children:[t("strong",{className:"font-normal text-accent",children:Ne})," / ",ye," ",n.unit]}):t("div",{}),I?r("div",{className:`flex items-center gap-3 font-mono ${l.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:[t("span",{children:"Sort"}),r(Le,{value:z,onChange:e=>we(e.target.value),className:`cursor-pointer border border-line bg-bg px-3 py-2 font-mono ${l.labelLarge} uppercase tracking-[0.18em] text-fg`,children:[t("option",{value:"newest",children:"Newest"}),t("option",{value:"featured",children:"Featured"}),t("option",{value:"name",children:"Name A–Z"})]})]}):t("div",{})]}),t("div",{className:"mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] pt-5 pb-20 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",children:P.length>0?t("div",{className:"grid grid-cols-6 gap-2 max-view-desktop:grid-cols-2 max-view-tablet:grid-cols-1",children:P.map((e,a)=>{const o=W(e)[0],u=`group relative block aspect-[4/3] w-full overflow-hidden bg-surface-2 text-left ${a<2?"col-span-3 max-view-desktop:col-span-1":"col-span-2 max-view-desktop:col-span-1"}`,p=`${e.name??"card"}-${a}`,m=r(y,{children:[t(O,{label:F(e.name)||`gallery-card-${a+1}`,src:o||void 0,alt:T(e.name??""),sizes:"(max-width: 720px) 100vw, (max-width: 1100px) 50vw, 33vw",className:`transition-transform duration-700 ${ve?"scale-[1.04]":"group-hover:scale-[1.04]"}`}),r("div",{className:"pointer-events-none absolute inset-0 z-10 flex flex-col justify-between p-6 max-view-tablet:p-3",style:{background:"linear-gradient(180deg, rgba(10,10,10,.55) 0%, transparent 35%, transparent 55%, rgba(10,10,10,.92) 100%)"},children:[r("div",{className:`flex items-start justify-between font-mono ${l.labelSmall} uppercase tracking-[0.24em]`,children:[e.process?t("span",{className:"text-accent",children:i(e.process)}):t("span",{}),r("span",{className:"text-overlay-fg/70",children:[String(a+1).padStart(2,"0")," / ",String(P.length).padStart(2,"0")]})]}),r("div",{className:"flex flex-col gap-2",children:[e.eyebrow&&t("div",{className:`font-mono ${l.labelSmall} uppercase tracking-[0.24em] text-accent`,children:i(e.eyebrow)}),e.name&&t("div",{className:"font-heading3 text-[length:var(--size-headingSmall,clamp(22px,2.4vw,32px))] font-medium uppercase leading-none tracking-[-0.02em] text-overlay-fg",children:i(e.name)}),e.meta&&t("div",{className:`flex flex-wrap gap-3 pt-1 font-mono ${l.labelXs} uppercase tracking-[0.2em] text-overlay-fg/70`,children:t("span",{children:i(e.meta)})})]})]})]});return h?t("div",{className:u,children:m},p):t("button",{type:"button",onClick:()=>b({card:e,index:0}),"aria-label":`Open ${e.name??"gallery item"}`,className:`${u} cursor-pointer focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2`,children:m},p)})}):t("div",{className:`py-20 text-center font-mono ${l.labelXl} uppercase tracking-[0.2em] text-fg-dim`,children:J?"No items in this gallery yet.":"No items match this filter."})}),L&&(()=>{const e=W(L.card),{card:a,index:o}=L,c=e.length,u=e[o]??e[0]??"",p=s=>b(d=>d&&{...d,index:(d.index+s+c)%c}),m=[a.process,a.meta].filter(Boolean).join(" · ");return r(Se,{open:!0,onClose:()=>b(null),label:a.name??"Gallery item",onPrev:c>1?()=>p(-1):void 0,onNext:c>1?()=>p(1):void 0,className:"flex cursor-zoom-out flex-col items-center justify-center p-6 max-view-tablet:p-3",children:[r("div",{className:"relative flex w-full flex-1 items-center justify-center",children:[t("div",{className:"relative h-full max-h-[72vh] w-full max-w-[92vw]",children:t(O,{label:F(a.name)||"gallery-photo",src:u||void 0,alt:T(a.name??""),objectFit:"contain",sizes:"92vw"})}),c>1&&r(y,{children:[t("button",{type:"button","aria-label":"Previous photo",onClick:s=>{s.stopPropagation(),p(-1)},className:"absolute left-2 top-1/2 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),t("button",{type:"button","aria-label":"Next photo",onClick:s=>{s.stopPropagation(),p(1)},className:"absolute right-2 top-1/2 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"})]})]}),r("div",{className:`mt-5 flex flex-col items-center gap-3 text-center font-mono ${l.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,onClick:s=>s.stopPropagation(),children:[r("div",{className:"flex flex-col items-center gap-1",children:[a.name&&t("span",{className:"text-accent",children:i(a.name)}),a.eyebrow&&t("span",{children:i(a.eyebrow)}),r("span",{className:"text-fg-dim/70",children:[m?r(y,{children:[i(m)," · "]}):null,o+1," / ",c]})]}),a.href&&t($e,{href:a.href,onClick:()=>b(null),className:`cursor-pointer border border-btn bg-btn/[0.08] px-5 py-3 font-mono ${l.labelLarge} uppercase tracking-[0.28em] text-btn transition-colors hover:bg-btn hover:text-btn-ink`,children:"View Product →"})]}),c>1&&t("div",{onClick:s=>s.stopPropagation(),className:"mt-5 flex max-w-[92vw] gap-2 overflow-x-auto pb-1",children:e.map((s,d)=>t("button",{type:"button","aria-label":`Photo ${d+1}`,onClick:()=>b(Q=>Q&&{...Q,index:d}),className:["relative h-16 w-24 shrink-0 cursor-pointer overflow-hidden border transition-colors max-view-tablet:h-12 max-view-tablet:w-16",d===o?"border-accent":"border-line opacity-60 hover:border-fg-dim hover:opacity-100"].join(" "),children:t(O,{label:F(a.name)||"gallery-photo",src:s||void 0,alt:"",sizes:"120px"})},`${s}-${d}`))}),t(ze,{})]})})()]})}export{Pe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as m,Fragment as y}from"react/jsx-runtime";import{parseOption as ae}from"efficient-
|
|
1
|
+
"use client";import{jsx as e,jsxs as m,Fragment as y}from"react/jsx-runtime";import{parseOption as ae}from"efficient-shell/format";import $ from"next/image";import{useState as te}from"react";import{HideTaker as v}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as B,CARD_INDEX_CLASS as E,parseCardIndexFormat as X}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as ne,cardImageBackgroundPaints as K,resolveCardImageBackground as le}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as _}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as oe,boxSwatchFill as ie}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as se}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as ce}from"efficient-easel/screen/lib/document/shadow-values";import{sayCount as me}from"efficient-web-builder/format/lib/editor-words";import{parseSetPicture as de,setSecondSrc as fe}from"../../lib/wheels/set-mode.js";import{coverSrcForWheel as ue,parseCoverIndex as ge,resolvePaintedSrc as he}from"../../lib/wheels/cover-rendering.js";import pe from"../WheelPlaceholder.js";import be from"../BrandPlate.js";import Se from"../TyreImage.js";import{cardSpinOf as we}from"../card-spin.js";import{useCardHoverLayer as ke,useGridCard as I}from"../GridCardTemplate.js";import z from"./CardPicture.js";import j from"./CardProductBadge.js";import{useHeldCardPicture as Ce}from"./useHeldCardPicture.js";import{useProductCardState as Fe}from"./ProductCardState.js";import{blockParts as Pe}from"../../lib/block-parts.js";const i=Pe("ProductCard"),xe=["well","full"],ye="well",R=r=>ae(xe,ye,r);function ve({children:r}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:r})}function G({fill:r,badge:a,children:s}){const d=K(r);return m("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${d?"":" bg-surface"}`,style:d?{backgroundColor:r}:void 0,...i("image-frame"),children:[s,a]})}function T(r,a){const s=se();return ie({[oe]:r},s?.row)??le(a,ne)}function _e(r){const a=Fe();return a.kind==="bundle"?e(Ne,{state:a,...r}):a.kind==="tyre"?e(Ae,{state:a,...r}):a.kind!=="wheel"?null:e($e,{state:a,...r})}function Ne({state:r,imageBackground:a,cardImage:s,showBadge:d,frame:S,swatch:u}){const{bundle:n}=r,{imageSizes:g}=I(),f=R(S)==="full",h=n.components.length,p=n.image?f?e($,{alt:n.name,src:n.image,fill:!0,sizes:g,className:"object-cover",draggable:!1,...i("image")}):e($,{alt:n.name,src:n.image,width:1e3,height:1e3,sizes:g,className:"block h-full w-full object-cover",draggable:!1,...i("image")}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:me("{n} piece","{n} pieces",h,{})}),l=e(ve,{children:p}),t=T(u,a),b=d!==!1?e(j,{edge:f}):null;return e(v,{style:_(s),...i("image-block"),children:f?e(G,{fill:t,badge:b,children:l}):m(y,{children:[b,e(z,{image:l,imageBackgroundFill:t})]})})}function Ae({state:r,imageBackground:a,cardImage:s,indexBadge:d,frame:S,swatch:u}){const{tyre:n}=r,{imageSizes:g}=I(),f=T(u,a),h=X(d),p=h!=="off"?e("span",{"aria-hidden":!0,"data-format":h,className:`${E} ${B}`,...i("card-number")}):null,l=e(Se,{image:n.image,className:"h-full w-full",sizes:g,showBackground:!1}),t=e(be,{brand:n.brand,logo:n.brandLogo});return e(v,{style:_(s),...i("image-block"),children:R(S)==="full"?m(G,{fill:f,badge:p,children:[l,t]}):m(y,{children:[p,e(z,{image:l,imageBackgroundFill:f,plate:t})]})})}function $e({state:r,imageBackground:a,cardImage:s,coverIndex:d,indexBadge:S,showBadge:u,frame:n,setPicture:g,swatch:f,shadow:h,shadowColor:p}){const{wheel:l,sel:t,isSet:b}=r,{hover:Z,imageSizes:D,fit:q,rules:k,setGridGap:J}=I(),C=we(Z),Q=ue(l,ge(d),t.finish?.name,t.shownSrc,q?.holes),[L,V]=te(()=>new Set),O=o=>{t.pictureFailed(o),V(w=>w.has(o)?w:new Set(w).add(o))},H=he({overrideSrc:Q,hookSrc:t.shownSrc,failed:L}),W=l.rendersHaveAlpha===!0?ce(h,p):null,Y=W?{...C.style,filter:W}:C.style,N=(o,w)=>e($,{alt:w,src:o,width:1e3,height:1e3,sizes:D,className:`block h-full w-full object-contain ${C.className}`,style:Y,draggable:!1,onError:()=>O(o),...i("image")},o),ee=t.finish?`${l.name} — ${t.finish.name}`:l.name,F=b&&de(g)==="pair",re=F?fe(l.finishes?.find(o=>o.name===t.finish?.name),H):null,c=Ce({src:H,second:re,alt:ee,sizes:D,failed:L,onFailed:O,near:t.nearScreen,holdEmpty:t.awaitingProbe}),M=m(y,{children:[c.src?N(c.src,c.alt):e(pe,{imageLabel:l.name,spin:C}),c.trial]}),A=X(S),P=A!=="off",x=T(f,a),U=ke("picture",K(x)?x:void 0);if(R(n)==="full"){const o=m(y,{children:[P?e("span",{"aria-hidden":!0,"data-format":A,className:`${E} ${B}`,...i("card-number")}):null,e(j,{show:u!==!1,numbered:P,sale:k.sale,axleSets:k.axleSets,edge:!0})]});return e(v,{style:_(s),"data-set-picture":b&&!F?"one":void 0,...i("image-block"),children:m(G,{fill:x,badge:o,children:[m("div",{className:"flex h-full w-full items-center justify-center",children:[M,c.second?N(c.second,`${c.alt} — right`):null]}),U]})})}return m(v,{style:_(s),"data-set-picture":b&&!F?"one":void 0,...i("image-block"),children:[P?e("span",{"aria-hidden":!0,"data-format":A,className:`${E} ${B}`,...i("card-number")}):null,e(j,{show:u!==!1,numbered:P,sale:k.sale,axleSets:k.axleSets}),e(z,{image:M,imageSecond:c.second?N(c.second,`${c.alt} — right`):void 0,wide:F,imageBackgroundFill:x,setGridGap:J,plate:U})]})}export{ye as DEFAULT_PICTURE_FRAME,xe as PICTURE_FRAMES,_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r,Fragment as x}from"react/jsx-runtime";import R from"next/link";import{useEffect as D,useMemo as Y,useRef as j,useState as C}from"react";import{holdTime as X}from"../../lib/checkout/hold-time.js";import{stripeAppearance as J}from"../../lib/checkout/stripe-appearance.js";import{userZone as ee}from"efficient-shell/format";import{Elements as te,PaymentElement as re,useElements as ne,useStripe as ae}from"@stripe/react-stripe-js";import{loadStripe as ie}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{resolveCopyright as oe}from"../../lib/content/site.js";import{ApiError as L,products as I}from"../../lib/api/index.js";import ce,{WORDMARK_FIT_FLOOR_PX as se}from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as T,orderReference as le}from"../../lib/checkout/pay-first.js";import{CheckoutStateProvider as de,useCheckout as me}from"./checkout-state.js";import{CheckoutContact as pe,CheckoutOrderSummary as ue,CheckoutPayment as fe,CheckoutShippingAddress as xe,CheckoutShippingMethod as ge,FormLock as M,LeaveLink as z}from"./checkout-parts.js";import{parseOption as he}from"efficient-web-builder/format/lib/parse-option";function ye(t){return e(de,{...t,children:e(Ne,{})})}function be({order:t,paid:n}){const{formatMoney:o}=E();if(!t.grandTotal||!t.currency)return null;const m=s=>o(Number(s),t.currency),y=Number(t.freightCharge??0),p=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||y>0)&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:m(t.freightCharge??"0")})]}),p>0&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",m(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:m(t.grandTotal)})]})}function ke({result:t,lostChangeNote:n=null}){const o=e("span",{className:"font-mono text-fg",children:t.checkoutNumber});return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:t.kind==="refunded"||t.kind==="expired"?"Order not placed":t.kind==="processing"?"Payment processing":"Payment received"}),e("p",{className:"text-fg-dim",children:t.kind==="refunded"?r(x,{children:["An item sold out or an offer ended while you paid for checkout ",o,". Your payment goes back to your card."]}):t.kind==="expired"?r(x,{children:["The hold on checkout ",o," ran out before your payment arrived. Your payment goes back to your card."]}):t.kind==="processing"?r(x,{children:["Your payment for checkout ",o," is being processed. When it goes through, we will email your order confirmation."]}):r(x,{children:["Thank you — your payment",t.checkoutNumber?r(x,{children:[" for checkout ",o]}):null," has gone through. We will email you the order number shortly."]})}),n&&t.kind!=="refunded"&&t.kind!=="expired"&&e("p",{className:"text-sm text-fg-dim",children:n}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function Ne(){const{site:t,logo:n,items:o,placing:m,formLocked:y,email:p,me:s,addressSaveNote:g,lostChangeNote:d,idemKey:f,confirmation:c,setConfirmation:u,payment:h,paypalStep:k,squareStep:N,pendingConf:l,paid:b,setPaid:S,payNote:i,afterpayConfirming:a,gocardlessConfirming:P,zipConfirming:v,klarnaConfirming:K,cardConfirming:$,checkoutResult:A,confirmCardPayment:U,cardStillProcessing:W,renewCardPayment:H,holdRenewed:G,leaveCardPayment:Q,checkoutRootRef:V,setCheckoutHeaderEl:Z}=me();return c?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:b?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[b?r(x,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:c.orderNumber})," has gone through."," "]}):r(x,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:c.orderNumber})," is being reviewed by our team."," "]}),s?r(x,{children:["Track it under"," ",e(R,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(x,{children:"We’ve emailed you a link to set a password and track it."})]}),e(be,{order:c,paid:b}),d&&e("p",{className:"text-sm text-fg-dim",children:d}),i&&(i.warning?e("div",{className:"w-full max-w-sm text-left",children:e(_,{tone:"bad",role:"alert",children:i.text})}):e("p",{className:"text-sm text-fg-dim",children:i.text})),g&&e("p",{className:"text-sm text-fg-dim",children:g}),!s&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(R,{href:`/track?order=${encodeURIComponent(c.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):A?e(ke,{result:A,lostChangeNote:d}):$?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order — one moment."})]}):a?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):P?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):v?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):K?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):h&&l?e(we,{payment:h,checkout:l,holdRenewed:G,onPaid:U,onProcessing:W,onRenew:H,onBack:Q}):k&&l?e(Se,{confirmation:l,clientId:t.paypalClientId??"",idemKey:f,onPaid:()=>{S(!0),u(l)},onSkip:()=>u(l)}):N&&l?e(Re,{confirmation:l,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:f,onPaid:()=>{S(!0),u(l)},onSkip:()=>u(l)}):r("div",{ref:V,className:"bg-bg text-fg",children:[r("header",{ref:Z,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(z,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:e(z,{href:"/","aria-label":`${t.name} home`,className:"inline-flex max-w-full items-center justify-center max-[640px]:overflow-x-clip",children:[!0,!1].map(w=>e(ce,{hideClass:w?"min-[641px]:hidden":"max-[640px]:hidden",variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,sizeUnit:n?.sizeUnit??null,siteName:t.name,fitWordmarkToContainer:w,fitFloorPx:w?se:void 0},w?"phone":"wide"))})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(w=>r("span",{className:["relative flex items-center gap-2 transition-colors",w.state==="pending"?"text-fg-dim":"text-fg",w.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:w.state==="done"?"text-accent font-bold":"",children:w.n}),e("span",{children:w.label})]},w.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[r("div",{children:[r(M,{locked:y,children:[e(pe,{}),e(xe,{}),e(ge,{})]}),e(M,{locked:m,children:e(fe,{})})]}),e(ue,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:oe({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function we({payment:t,checkout:n,holdRenewed:o,onPaid:m,onProcessing:y,onRenew:p,onBack:s}){const{formatMoney:g}=E(),d=e("span",{className:"text-fg",children:g(Number(t.amount),t.currency)}),f=Y(()=>ie(t.publishableKey),[t.publishableKey]),c=Y(()=>J(),[]),u=X(n.expiresAt??"",ee()??"");return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:le(n)}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:n.orderNumber?r(x,{children:["Your order is placed. Pay ",d," by card to confirm it now."]}):o?r(x,{children:["Your hold ran out, so your items are held again",u?` until ${u}`:"",". Enter your card again, then pay ",d,"."]}):r(x,{children:["Your items are held",u?` until ${u}`:"",". Pay ",d," by card to place your order."]})}),e(te,{stripe:f,options:{clientSecret:t.clientSecret,appearance:c},children:e(ve,{payment:t,checkout:n,onPaid:m,onProcessing:y,onRenew:p,onBack:s})},t.clientSecret)]})]})})}const Pe=5;function ve({payment:t,checkout:n,onPaid:o,onProcessing:m,onRenew:y,onBack:p}){const{formatMoney:s}=E(),g=ae(),d=ne(),[f,c]=C(!1),[u,h]=C(null),k=j(!1);async function N(){try{return(await g.retrievePaymentIntent(t.clientSecret)).paymentIntent?.status}catch{return}}async function l(i){let a=i;for(let P=0;a==="processing"&&P<Pe;P+=1)await new Promise(v=>setTimeout(v,1e3)),a=await N()??a;if(a==="succeeded"){o();return}if(a==="processing"){m();return}h("Payment did not complete. Please try again."),c(!1)}async function b(){if(!g||!d||f)return;c(!0),h(null),k.current=!0;const i=await g.confirmPayment({elements:d,redirect:"if_required"}).catch(()=>null);if(!i){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}h(a===void 0?T:"Payment failed. Please try again."),c(!1);return}if(i.error){if(!n.orderNumber&&i.error.code==="payment_intent_unexpected_state"){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}if(a===void 0){h(T),c(!1);return}await y(a==="canceled"),c(!1);return}h(i.error.message??"Payment failed. Please try again."),c(!1);return}await l(i.paymentIntent?.status)}async function S(){if(f)return;if(!k.current){p();return}c(!0),h(null);const i=await N();if(i==="succeeded"||i==="processing"){await l(i);return}if(c(!1),i===void 0){h(T);return}p()}return r("div",{className:"flex flex-col gap-4",children:[e(re,{}),u&&e(_,{role:"alert",children:u}),e("button",{type:"button",onClick:b,disabled:!g||!d||f,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!g||!d||f?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:f?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",s(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),!n.orderNumber&&!f&&r("button",{type:"button",onClick:S,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{children:"Back to checkout"})]})]})}const B="paypal-sdk-js";let q=null;function Ce(t,n){const o=`${t}|${n}`;if(q?.key===o)return q.promise;const m=new Promise((y,p)=>{document.getElementById(B)?.remove();const s=document.createElement("script");s.id=B;const g=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});s.src=`https://www.paypal.com/sdk/js?${g}`,s.onload=()=>{const d=window.paypal;d?y(d):p(new Error("PayPal SDK loaded without its namespace"))},s.onerror=()=>p(new Error("PayPal SDK failed to load")),document.head.appendChild(s)});return q={key:o,promise:m},m}function Se({confirmation:t,clientId:n,idemKey:o,onPaid:m,onSkip:y}){const{formatMoney:p}=E(),s=j(null),[g,d]=C(!1),[f,c]=C(null),u=j(m);return u.current=m,D(()=>{let h=!1,k=null;return Ce(n,t.currency).then(N=>{if(!(h||!s.current))return k=N.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await I.createPaypalOrder({idempotencyKey:o})).paypalOrderId,onApprove:async l=>{try{if((await I.capturePaypalOrder({idempotencyKey:o,paypalOrderId:l.orderID})).status==="paid"){u.current();return}c("PayPal did not complete the payment. Please try again.")}catch(b){c(b instanceof L?b.message:"PayPal payment failed. Please try again.")}},onError:()=>{c("PayPal could not process the payment. Please try again.")}}),k.render(s.current).then(()=>{h||d(!0)})}).catch(()=>{h||c("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{h=!0,k?.close?.()}},[n,t.currency,o]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:p(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!g&&!f&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:s}),f&&e(_,{role:"alert",children:f}),e("button",{type:"button",onClick:y,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const F="square-web-sdk";let O=null;const je=["sandbox","production"];function Ee(t){const n=he(je,"production",t);if(O?.key===n)return O.promise;const o=new Promise((m,y)=>{document.getElementById(F)?.remove();const p=document.createElement("script");p.id=F,p.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",p.onload=()=>{const s=window.Square;s?m(s):y(new Error("Square SDK loaded without its namespace"))},p.onerror=()=>y(new Error("Square SDK failed to load")),document.head.appendChild(p)});return O={key:n,promise:o},o}function Re({confirmation:t,applicationId:n,locationId:o,environment:m,idemKey:y,onPaid:p,onSkip:s}){const{formatMoney:g}=E(),d=j(null),f=j(null),c=j(null),[u,h]=C(!1),[k,N]=C(!1),[l,b]=C(null);D(()=>{let i=!1,a=null;return Ee(m).then(async P=>{if(i||!d.current)return;const v=P.payments(n,o);c.current=v,a=await v.card(),await a.attach(d.current),f.current=a,i||h(!0)}).catch(()=>{i||b("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{i=!0,a?.destroy?.()}},[n,o,m]);async function S(){const i=f.current;if(!(!i||k)){N(!0),b(null);try{const a=await i.tokenize();if(a.status!=="OK"||!a.token){b(a.errors?.[0]?.message??"Please check the card details and try again."),N(!1);return}let P;try{P=(await c.current?.verifyBuyer?.(a.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await I.chargeSquare({idempotencyKey:y,sourceId:a.token,...P?{verificationToken:P}:{}})).status==="paid"){p();return}b("Square did not complete the payment. Please try again.")}catch(a){b(a instanceof L?a.message:"Square payment failed. Please try again.")}N(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:g(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!u&&!l&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:d}),l&&e(_,{role:"alert",children:l}),e("button",{type:"button",onClick:S,disabled:!u||k,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!u||k?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:k?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",g(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:s,disabled:k,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{ke as PayFirstResultView,ye as default};
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as x}from"react/jsx-runtime";import R from"next/link";import{useEffect as D,useMemo as Y,useRef as j,useState as C}from"react";import{holdTime as X}from"../../lib/checkout/hold-time.js";import{stripeAppearance as J}from"../../lib/checkout/stripe-appearance.js";import{userZone as ee,parseOption as te}from"efficient-shell/format";import{Elements as re,PaymentElement as ne,useElements as ae,useStripe as ie}from"@stripe/react-stripe-js";import{loadStripe as oe}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{resolveCopyright as ce}from"../../lib/content/site.js";import{ApiError as L,products as I}from"../../lib/api/index.js";import se,{WORDMARK_FIT_FLOOR_PX as le}from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as T,orderReference as de}from"../../lib/checkout/pay-first.js";import{CheckoutStateProvider as me,useCheckout as pe}from"./checkout-state.js";import{CheckoutContact as ue,CheckoutOrderSummary as fe,CheckoutPayment as xe,CheckoutShippingAddress as ge,CheckoutShippingMethod as he,FormLock as M,LeaveLink as z}from"./checkout-parts.js";function ye(t){return e(me,{...t,children:e(Ne,{})})}function be({order:t,paid:n}){const{formatMoney:o}=E();if(!t.grandTotal||!t.currency)return null;const m=s=>o(Number(s),t.currency),y=Number(t.freightCharge??0),p=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||y>0)&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:m(t.freightCharge??"0")})]}),p>0&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",m(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:m(t.grandTotal)})]})}function ke({result:t,lostChangeNote:n=null}){const o=e("span",{className:"font-mono text-fg",children:t.checkoutNumber});return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:t.kind==="refunded"||t.kind==="expired"?"Order not placed":t.kind==="processing"?"Payment processing":"Payment received"}),e("p",{className:"text-fg-dim",children:t.kind==="refunded"?r(x,{children:["An item sold out or an offer ended while you paid for checkout ",o,". Your payment goes back to your card."]}):t.kind==="expired"?r(x,{children:["The hold on checkout ",o," ran out before your payment arrived. Your payment goes back to your card."]}):t.kind==="processing"?r(x,{children:["Your payment for checkout ",o," is being processed. When it goes through, we will email your order confirmation."]}):r(x,{children:["Thank you — your payment",t.checkoutNumber?r(x,{children:[" for checkout ",o]}):null," has gone through. We will email you the order number shortly."]})}),n&&t.kind!=="refunded"&&t.kind!=="expired"&&e("p",{className:"text-sm text-fg-dim",children:n}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function Ne(){const{site:t,logo:n,items:o,placing:m,formLocked:y,email:p,me:s,addressSaveNote:g,lostChangeNote:d,idemKey:f,confirmation:c,setConfirmation:u,payment:h,paypalStep:k,squareStep:N,pendingConf:l,paid:b,setPaid:S,payNote:i,afterpayConfirming:a,gocardlessConfirming:P,zipConfirming:v,klarnaConfirming:K,cardConfirming:$,checkoutResult:A,confirmCardPayment:U,cardStillProcessing:W,renewCardPayment:H,holdRenewed:G,leaveCardPayment:Q,checkoutRootRef:V,setCheckoutHeaderEl:Z}=pe();return c?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:b?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[b?r(x,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:c.orderNumber})," has gone through."," "]}):r(x,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:c.orderNumber})," is being reviewed by our team."," "]}),s?r(x,{children:["Track it under"," ",e(R,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(x,{children:"We’ve emailed you a link to set a password and track it."})]}),e(be,{order:c,paid:b}),d&&e("p",{className:"text-sm text-fg-dim",children:d}),i&&(i.warning?e("div",{className:"w-full max-w-sm text-left",children:e(_,{tone:"bad",role:"alert",children:i.text})}):e("p",{className:"text-sm text-fg-dim",children:i.text})),g&&e("p",{className:"text-sm text-fg-dim",children:g}),!s&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(R,{href:`/track?order=${encodeURIComponent(c.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):A?e(ke,{result:A,lostChangeNote:d}):$?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order — one moment."})]}):a?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):P?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):v?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):K?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):h&&l?e(we,{payment:h,checkout:l,holdRenewed:G,onPaid:U,onProcessing:W,onRenew:H,onBack:Q}):k&&l?e(Se,{confirmation:l,clientId:t.paypalClientId??"",idemKey:f,onPaid:()=>{S(!0),u(l)},onSkip:()=>u(l)}):N&&l?e(Re,{confirmation:l,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:f,onPaid:()=>{S(!0),u(l)},onSkip:()=>u(l)}):r("div",{ref:V,className:"bg-bg text-fg",children:[r("header",{ref:Z,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(z,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:e(z,{href:"/","aria-label":`${t.name} home`,className:"inline-flex max-w-full items-center justify-center max-[640px]:overflow-x-clip",children:[!0,!1].map(w=>e(se,{hideClass:w?"min-[641px]:hidden":"max-[640px]:hidden",variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,sizeUnit:n?.sizeUnit??null,siteName:t.name,fitWordmarkToContainer:w,fitFloorPx:w?le:void 0},w?"phone":"wide"))})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(w=>r("span",{className:["relative flex items-center gap-2 transition-colors",w.state==="pending"?"text-fg-dim":"text-fg",w.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:w.state==="done"?"text-accent font-bold":"",children:w.n}),e("span",{children:w.label})]},w.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[r("div",{children:[r(M,{locked:y,children:[e(ue,{}),e(ge,{}),e(he,{})]}),e(M,{locked:m,children:e(xe,{})})]}),e(fe,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:ce({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function we({payment:t,checkout:n,holdRenewed:o,onPaid:m,onProcessing:y,onRenew:p,onBack:s}){const{formatMoney:g}=E(),d=e("span",{className:"text-fg",children:g(Number(t.amount),t.currency)}),f=Y(()=>oe(t.publishableKey),[t.publishableKey]),c=Y(()=>J(),[]),u=X(n.expiresAt??"",ee()??"");return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:de(n)}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:n.orderNumber?r(x,{children:["Your order is placed. Pay ",d," by card to confirm it now."]}):o?r(x,{children:["Your hold ran out, so your items are held again",u?` until ${u}`:"",". Enter your card again, then pay ",d,"."]}):r(x,{children:["Your items are held",u?` until ${u}`:"",". Pay ",d," by card to place your order."]})}),e(re,{stripe:f,options:{clientSecret:t.clientSecret,appearance:c},children:e(ve,{payment:t,checkout:n,onPaid:m,onProcessing:y,onRenew:p,onBack:s})},t.clientSecret)]})]})})}const Pe=5;function ve({payment:t,checkout:n,onPaid:o,onProcessing:m,onRenew:y,onBack:p}){const{formatMoney:s}=E(),g=ie(),d=ae(),[f,c]=C(!1),[u,h]=C(null),k=j(!1);async function N(){try{return(await g.retrievePaymentIntent(t.clientSecret)).paymentIntent?.status}catch{return}}async function l(i){let a=i;for(let P=0;a==="processing"&&P<Pe;P+=1)await new Promise(v=>setTimeout(v,1e3)),a=await N()??a;if(a==="succeeded"){o();return}if(a==="processing"){m();return}h("Payment did not complete. Please try again."),c(!1)}async function b(){if(!g||!d||f)return;c(!0),h(null),k.current=!0;const i=await g.confirmPayment({elements:d,redirect:"if_required"}).catch(()=>null);if(!i){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}h(a===void 0?T:"Payment failed. Please try again."),c(!1);return}if(i.error){if(!n.orderNumber&&i.error.code==="payment_intent_unexpected_state"){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}if(a===void 0){h(T),c(!1);return}await y(a==="canceled"),c(!1);return}h(i.error.message??"Payment failed. Please try again."),c(!1);return}await l(i.paymentIntent?.status)}async function S(){if(f)return;if(!k.current){p();return}c(!0),h(null);const i=await N();if(i==="succeeded"||i==="processing"){await l(i);return}if(c(!1),i===void 0){h(T);return}p()}return r("div",{className:"flex flex-col gap-4",children:[e(ne,{}),u&&e(_,{role:"alert",children:u}),e("button",{type:"button",onClick:b,disabled:!g||!d||f,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!g||!d||f?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:f?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",s(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),!n.orderNumber&&!f&&r("button",{type:"button",onClick:S,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{children:"Back to checkout"})]})]})}const B="paypal-sdk-js";let q=null;function Ce(t,n){const o=`${t}|${n}`;if(q?.key===o)return q.promise;const m=new Promise((y,p)=>{document.getElementById(B)?.remove();const s=document.createElement("script");s.id=B;const g=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});s.src=`https://www.paypal.com/sdk/js?${g}`,s.onload=()=>{const d=window.paypal;d?y(d):p(new Error("PayPal SDK loaded without its namespace"))},s.onerror=()=>p(new Error("PayPal SDK failed to load")),document.head.appendChild(s)});return q={key:o,promise:m},m}function Se({confirmation:t,clientId:n,idemKey:o,onPaid:m,onSkip:y}){const{formatMoney:p}=E(),s=j(null),[g,d]=C(!1),[f,c]=C(null),u=j(m);return u.current=m,D(()=>{let h=!1,k=null;return Ce(n,t.currency).then(N=>{if(!(h||!s.current))return k=N.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await I.createPaypalOrder({idempotencyKey:o})).paypalOrderId,onApprove:async l=>{try{if((await I.capturePaypalOrder({idempotencyKey:o,paypalOrderId:l.orderID})).status==="paid"){u.current();return}c("PayPal did not complete the payment. Please try again.")}catch(b){c(b instanceof L?b.message:"PayPal payment failed. Please try again.")}},onError:()=>{c("PayPal could not process the payment. Please try again.")}}),k.render(s.current).then(()=>{h||d(!0)})}).catch(()=>{h||c("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{h=!0,k?.close?.()}},[n,t.currency,o]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:p(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!g&&!f&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:s}),f&&e(_,{role:"alert",children:f}),e("button",{type:"button",onClick:y,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const F="square-web-sdk";let O=null;const je=["sandbox","production"];function Ee(t){const n=te(je,"production",t);if(O?.key===n)return O.promise;const o=new Promise((m,y)=>{document.getElementById(F)?.remove();const p=document.createElement("script");p.id=F,p.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",p.onload=()=>{const s=window.Square;s?m(s):y(new Error("Square SDK loaded without its namespace"))},p.onerror=()=>y(new Error("Square SDK failed to load")),document.head.appendChild(p)});return O={key:n,promise:o},o}function Re({confirmation:t,applicationId:n,locationId:o,environment:m,idemKey:y,onPaid:p,onSkip:s}){const{formatMoney:g}=E(),d=j(null),f=j(null),c=j(null),[u,h]=C(!1),[k,N]=C(!1),[l,b]=C(null);D(()=>{let i=!1,a=null;return Ee(m).then(async P=>{if(i||!d.current)return;const v=P.payments(n,o);c.current=v,a=await v.card(),await a.attach(d.current),f.current=a,i||h(!0)}).catch(()=>{i||b("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{i=!0,a?.destroy?.()}},[n,o,m]);async function S(){const i=f.current;if(!(!i||k)){N(!0),b(null);try{const a=await i.tokenize();if(a.status!=="OK"||!a.token){b(a.errors?.[0]?.message??"Please check the card details and try again."),N(!1);return}let P;try{P=(await c.current?.verifyBuyer?.(a.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await I.chargeSquare({idempotencyKey:y,sourceId:a.token,...P?{verificationToken:P}:{}})).status==="paid"){p();return}b("Square did not complete the payment. Please try again.")}catch(a){b(a instanceof L?a.message:"Square payment failed. Please try again.")}N(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:g(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!u&&!l&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:d}),l&&e(_,{role:"alert",children:l}),e("button",{type:"button",onClick:S,disabled:!u||k,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!u||k?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:k?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",g(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:s,disabled:k,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{ke as PayFirstResultView,ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PREVIEW_TOKEN_HEADER as dt,SITE_HOST_HEADER as ut,SITE_SLUG_HEADER as lt}from"../site-headers.js";import{PRODUCT_API_BASE as pt,PRODUCT_BACKEND_URL as H}from"./origins.js";import{listRows as m}from"./list-rows.js";import{parseOption as yt}from"efficient-web-builder/format/lib/parse-option";import{backendHopHeaders as ht,clientIpFromForwardedFor as ft,FORWARDED_FOR_HEADER as gt,hopCachingOf as mt}from"../forwarded-for.js";import wt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as O}from"../auth.js";import{efficientClientOpen as St}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as U}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as F}from"../wheels/renderable-finishes.js";const Pt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class w extends Error{status;data;constructor(e,n,s){super(n),this.status=e,this.data=s}}const v="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.",Ot=new Set([502,503,504]),k=0,bt="This editor runs on its host's own backend, which does not serve this request.",Tt=5e3,At=15e3,Rt=()=>typeof window>"u"?Tt:At;function M(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(Rt())}const B=t=>t instanceof Error&&t.name==="TimeoutError",q=(t,e)=>Ot.has(t)?v:e,Et=["admin","venue"];let G="admin";function $e(t){G=yt(Et,"admin",t)}function _t(){return G}const Ut=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let W=null;function Ce(t){W=t&&Ut.test(t)?t:null}function $t(){return W}function Ct(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=Y();return!e||/[?&]site=/.test(t)?t:$(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:n,baseUrl:s,headers:u,audience:l,...y}=e;if(typeof window<"u"&&!St())throw new w(k,bt,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const a=typeof FormData<"u"&&y.body instanceof FormData;let r;try{r=await fetch(`${s??Pt}${Ct(t)}`,{...y,headers:{...a?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...u},signal:y.signal??M({...y,audience:l})})}catch(h){throw h instanceof TypeError||B(h)?new w(k,v,null):h}let o;try{o=await r.text()}catch(h){throw B(h)?new w(k,v,null):h}let p=null;if(o)try{p=JSON.parse(o)}catch{throw new w(r.status,r.ok?"Expected JSON but received a non-JSON response":q(r.status,r.statusText),o)}if(!r.ok){const h=(p&&typeof p=="object"&&"detail"in p&&typeof p.detail=="string"?p.detail:null)??q(r.status,r.statusText);throw new w(r.status,h,p)}return p}let A=null;async function j(){return A||(A=Nt().finally(()=>{A=null}),A)}async function Nt(){const t=O.takeLegacyRefresh(),e=await kt.refresh(t??void 0);return O.setTokens(e.access),e.access}async function z(){return O.getAccess()??j()}async function g(t,e={}){let n;try{n=await z()}catch{throw O.clear(),new w(401,"Not signed in",null)}try{return await i(t,{...e,token:n})}catch(s){if(!(s instanceof w)||s.status!==401)throw s;try{const u=await j();return await i(t,{...e,token:u})}catch{throw O.clear(),s}}}const It=100,K=20;function vt(t){if(!t)return null;try{return new URL(t,"http://page.invalid").searchParams.get("page")}catch{return null}}async function V(t,e){const[n,s=""]=t.split("?"),u=[];let l="1";for(let y=0;y<K&&l;y++){const a=new URLSearchParams(s);a.set("page_size",String(It)),l!=="1"&&a.set("page",l);const r=await g(`${n}?${a.toString()}`);u.push(...m(r)),l=vt(r.next)}return l&&console.warn(`[${e}] stopped at ${K} pages (${u.length} rows); list may be truncated`),u}async function X(t,e={}){if(O.getAccess())try{return{data:await g(t,e),asShopper:!0}}catch(n){if(!(n instanceof w)||n.status!==401)throw n}return{data:await i(t,e),asShopper:!1}}async function Z(){const t=await g("/api/auth/me/");if(t.portal!=="shop")throw O.clear(),new w(403,"This session is not valid for this shop.",null);return t}const kt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{O.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await z();return await Z(),t},me:Z,updateMe:t=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>g("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>g("/api/shop-portal/profile/"),updateMyProfile:t=>g("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>g("/api/shop-portal/delivery-locations/"),createAddress:t=>g("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,n)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:n})}),brands:()=>g("/api/products/brands/"),myOrders:()=>V("/api/shop-portal/orders/","api.myOrders"),myOrder:t=>g(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>g(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>V(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`,"api.myReturns"),createReturn:t=>g("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>g(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const n=new FormData;return n.append("claim_item",t),n.append("file",e),n.append("media_type",e.type.startsWith("video/")?"video":"image"),g("/api/shop-portal/return-media/",{method:"POST",body:n})}};import{media as Lt,absolutizeApiUrl as L}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Jt,isSvgUrl as xt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Dt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Ht,webRuntimeSiteSlug as Y}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Ft}from"../sections/dealer-finder.js";import{SIGN_UP_PATH as Mt,SIGN_UP_VERIFY_PATH as Bt,SIGN_UP_WAITING_PATH as qt,WORKSPACE_FINDS_PATH as Gt,WORKSPACE_FIND_OPEN_PATH as Wt,signInUrlOf as jt,readLinkAnswer as Q,readSignUpAvailability as zt,readSignUpSent as Kt,signUpAvailabilityPath as Vt}from"../sections/sign-up.js";function S(t){if(typeof t=="string")return t.startsWith("/media/")?Lt(t):t;if(Array.isArray(t))return t.map(S);if(t&&typeof t=="object"){const e={};for(const[n,s]of Object.entries(t))e[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([u,l])=>[S(u),l])):S(s);return e}return t}import{PRODUCT_API_BASE as Ze}from"./origins.js";const tt=typeof window>"u"&&H!=="",Xt=tt?H:pt,Zt=Ht,b=()=>({baseUrl:Zt(),audience:null});function c(t,e){const n=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${n}`}const et=100,at=50;function J(t,e,n){const s=new URLSearchParams;for(const[u,l]of Object.entries(e))l!=null&&l!==""&&s.set(u,String(l));return s.set("pageSize",String(et)),n&&s.set("cursor",n),`/api/v1${t}?${s.toString()}`}function Yt(t,e){return J("/wheels",{process:t},e)}const rt=et;function Qt(t,e){return J("/wheels",{slug:t.join(",")},e)}function te(t,e,n){return J("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},n)}function ee(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function x(t,e,n=()=>!1,s=()=>!1){const u=[];let l=null;try{for(let y=0;y<at;y++){const a=await i(await e(l),await d());if(u.push(...m(a)),l=ee(a.next),!l)break;if(s(u))return u}l&&console.warn(`[${t}] stopped at ${at} pages (${u.length} rows); catalog may be truncated`)}catch(y){if(n(y))throw y;console.warn(`[${t}] product API unavailable, returning []`,y)}return u}const nt=t=>t instanceof w&&t.status===400;function st(t){return t.flatMap(e=>e.kind==="alloy-wheel"?U([e]):[e])}async function ot(){return(await ae()).host}async function ae(){try{const{headers:t}=await import("next/headers"),e=await t(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(e.get(ut)??e.get("x-forwarded-host")??e.get("host")),u=n(e.get("host"));return{host:s,matchesRequestHost:s!==null&&s===u}}catch{return{host:null,matchesRequestHost:!1}}}async function re(){try{const{headers:t}=await import("next/headers");return ft((await t()).get(gt))}catch{return null}}async function ne(){try{const{headers:t}=await import("next/headers");return(await t()).get(lt)||null}catch{return null}}async function se(){const t=await ne();if(t)return`site=${encodeURIComponent(t)}`;const e=await ot();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=Y();return e?$(t,`site=${encodeURIComponent(e)}`):t}return $(t,await se())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const oe="preview";async function ie(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(dt)}catch{return null}}async function ce(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function D(t,e){const n=await ie();if(n===null)return[await f(t),await d(e)];const s=$(await f(t),`${oe}=${encodeURIComponent(n)}`),{next:u,cache:l,...y}=e??{},a=await d({...y,cache:"no-store"}),r=await ce();return r&&(a.headers={...a.headers,"user-agent":r}),[s,a]}async function de(t){if(!tt)return;const[e,n]=await Promise.all([ot(),re()]),s=ht(e,n,t);return Object.keys(s).length>0?s:void 0}async function d(t){const e=await de(mt(t)),n={baseUrl:Xt,...t};return e&&(n.headers={...e,...t?.headers}),n}const R=typeof window>"u";function E(t,e){const n=new URLSearchParams;for(const[u,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(u,String(l));const s=n.toString();return`/api/v1/fitment${t}${s?`?${s}`:""}`}const xe={listMakes:async t=>{if(R){const{fitmentData:n}=await import("./fitment-data.js");return n.makes(t)}const e=await i(E("/makes",{region:t}),b());return m(e)},listModels:async(t,e)=>{if(R){const{fitmentData:s}=await import("./fitment-data.js");return s.models(t,e)}const n=await i(E("/models",{make:t,region:e}),b());return m(n)},listYears:async(t,e,n)=>{if(R){const{fitmentData:u}=await import("./fitment-data.js");return u.years(t,e,n)}const s=await i(E("/years",{make:t,model:e,region:n}),b());return m(s)},listModifications:async(t,e,n,s)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.modifications(t,e,n,s)}const u=await i(E("/modifications",{make:t,model:e,year:n,region:s}),b());return m(u)},getStockFitment:async(t,e,n,s,u)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.stockFitment(t,e,n,s,u)}return i(E("/stock-fitment",{make:t,model:e,year:n,modification:s,region:u}),b())}},De={listWheels:async(t,e={})=>{const n=await x("products.listWheels",async s=>await f(Yt(t,s)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:s=>U([...s]).length>=e.maxRows);return U(S(n))},listWheelsBySlug:async(t,e={})=>{const n=[...new Set(t.map(a=>a.trim()).filter(Boolean))];if(n.length===0)return[];const s=[];for(let a=0;a<n.length;a+=rt)s.push(n.slice(a,a+rt));const u=await Promise.all(s.map(a=>x("products.listWheelsBySlug",async r=>await f(Qt(a,r)),e.throwOnFailure?()=>!0:nt))),l=new Set(n),y=u.flat().filter(a=>l.has(a.slug));return U(S(y))},listCatalog:async(t,e,n={})=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await x("products.listCatalog",async u=>await f(te(t,e,u)),n.throwOnFailure?()=>!0:nt,n.maxRows===void 0?void 0:u=>st([...u]).length>=n.maxRows);return st(S(s))},getWheel:async t=>F(S(await i(await f(c(`/wheels/${t}`)),await d()))),getTyre:async t=>S(await i(await f(c(`/tyres/${t}`)),await d())),listBundles:async(t={})=>{try{return await i(await f(c("/bundles")),await d())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(c(`/bundles/${t}`)),await d()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:n=null}=t;if(typeof window>"u"){const{listGalleryBuilds:s}=await import("./gallery-builds-data.js");return S(s(e,n))}try{const s=new URLSearchParams;e&&s.set("process",e),n&&s.set("wheelSlug",n);const u=s.toString(),l=await i(`/api/v1/gallery-builds${u?`?${u}`:""}`,b());return S(m(l))}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>i(await f(c("/site")),await d()),getSiteBySlug:async t=>i(`${c("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await d():void 0),listPages:async()=>S(await i(await f(c("/pages")),await d())),listPopups:async()=>i(await f(c("/popups")),await d()),listProductTemplates:async()=>{try{return await i(await f(c("/product-templates")),await d())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${c("/dynamic-pages")}${e}`),await d())}catch(n){if(n instanceof w&&n.status===404)return[];throw n}},getRecord:async(t,e)=>{try{return await i(await f(c(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await d())}catch(n){if(n instanceof w&&n.status===404)return null;throw n}},listRecordKeys:async t=>{try{const e=await i(await f(c(`/records/${encodeURIComponent(t)}`)),await d({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(e){if(e instanceof w&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(c("/product-type-choices")),await d())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(c("/field-usage")),await d())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const n=e.record?`?record=${encodeURIComponent(e.record)}`:"",[s,u]=await D(c(`/pages/${t}`)+n,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return S(await i(s,u))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const n=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(c("/blog-posts")+n,await d())).map(u=>({...u,coverImage:L(u.coverImage)??""}))}catch(s){if(e)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(c(`/blog-posts/${t}`),await d());return{...e,coverImage:L(e.coverImage)??""}},createOrder:async t=>i(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>g(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(c("/orders/lookup"),await d({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(c("/payments/intent"),await d({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(c("/checkouts/release"),await d({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(c("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(c("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(c("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(c("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(c("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(c("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(c("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(c("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(c("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(c("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(c("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(c("/stock-alerts"),await d({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(c("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(c("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(c("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(c("/carts"),await d({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(c("/carts/restore"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(c("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const n=c("/reviews"),s=e.toString();try{return await i(await f(s?`${n}?${s}`:n),await d())}catch(u){return console.warn("[products.listReviews] product API unavailable, returning []",u),[]}},submitReview:async t=>i(c("/reviews"),await d({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(c(`/forms/${encodeURIComponent(t)}`),await d()),submitForm:async(t,e)=>i(c(`/forms/${encodeURIComponent(t)}/submissions`),await d({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(c("/shipping-methods"),await d())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(c(`/countries/${encodeURIComponent(t)}/subdivisions`),await d())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=c("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await X(e,n)).data:i(e,n)},validateCoupon:async t=>{const{data:e,asShopper:n}=await X(c("/coupons/validate"),await d({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:n}},getHeaderSettings:async()=>{const t=M({method:"GET"}),e=await i(...await D(c("/header-settings"),{signal:t})),n=L(e.logoUrl);let s=null,u=null;if(n&&xt(n)){const l=await Jt(n,t);l&&(s=l.reversed,u=l.inkIsDark)}return{...e,logoUrl:n,logoReversed:s,logoInkIsDark:u}},getThemeSettings:async()=>i(...await D(c("/theme-settings"))),getChatSettings:async()=>i(await f(c("/chat-settings")),await d())},He={listServices:async()=>{try{return await i(c("/bookings/services"),await d())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(c(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await d()),create:async t=>i(c("/bookings"),await d({method:"POST",body:JSON.stringify(t)})),get:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}`),await d()),cancel:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await d({method:"POST"})),reschedule:async(t,e)=>i(c(`/bookings/manage/${encodeURIComponent(t)}/reschedule`),await d({method:"POST",body:JSON.stringify({startAt:e})})),createPaymentIntent:async t=>i(c("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:t})}))};class ue extends Error{slug;count;constructor(e,n){super(`Slug "${e}" exists on ${n} websites; a site is required to pick one.`),this.slug=e,this.count=n,this.name="AmbiguousPageSlugError"}}const C=(t,e,n)=>{const s=new URLSearchParams({...e?{site:e}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${s?`?${s}`:""}`},N=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,le=t=>`${N(t)}currencies/`,pe="/api/storefront/media/ingest/";class ye 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 he(){const t=Dt();if(!t)throw new ye;return`${pe}?${new URLSearchParams({site:t})}`}const fe="X-Puck-Media-Manifest",it=wt.contentHash,I={"X-Media-Manifest":it,[fe]:it},Fe=ct({});function ct(t){return(e,n={})=>{const s=$t(),u=t.headers||s?{...s?{"Accept-Language":s}:{},...t.headers,...n.headers}:void 0;return i(e,{...n,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...u?{headers:u}:{},audience:t.audience??_t()})}}function ge(t={}){const e=ct(t),n=t.siteDrafts===!0,s=a=>C("header-settings",a,n),u=a=>C("theme-settings",a,n),l=a=>C("chat-settings",a,n),y=a=>C("social-settings",a,n);return{findPageBySlug:async(a,r,o)=>{const p=new URLSearchParams({slug:a});o&&p.set("site",o);const h=await e(`/api/storefront/pages/?${p.toString()}`,{token:r}),P=m(h);if(!o&&P.length>1)throw new ue(a,P.length);return P[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,o,p,h)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:p,...h?{client_id:h}:{}}),token:o}),duplicatePage:(a,r,o)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:o}),geocode:(a,r,o)=>e(`/api/storefront/geocode/?${new URLSearchParams(o?{q:a,country:o}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,o,p=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:p}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,o)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:I,token:o}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,o)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),listTemplatePages:async(a,r)=>{const o=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return m(o)},getPageLibrary:async a=>{const r=await e("/api/storefront/page-templates/?is_page_library=true&is_active=true",{token:a});return m(r)[0]??null},getTemplateLibrary:(a,r)=>e(`/api/storefront/pages/template-library/?site=${encodeURIComponent(a)}`,{token:r}),createPageFromTemplate:(a,r)=>e(`/api/storefront/pages/from-template/${n?"?draft=1":""}`,{method:"POST",body:JSON.stringify(a),token:r}),findTemplatePageBySlug:async(a,r,o)=>{const p=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:o});return m(p)[0]??null},createTemplatePage:(a,r,o)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:I,token:o}),saveTemplatePageLayout:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),deleteTemplatePage:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/pages/?${o.toString()}`,{token:a});return m(p)},createPage:(a,r,o,p)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:o}),token:p}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(s(r),{token:a}),listMenus:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/menus/?${o}`,{token:a});return m(p)},listBlogPosts:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/blog-posts/?${o.toString()}`,{token:a});return m(p)},listFieldUsage:async(a,r)=>{const o=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/categories/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.sort_order-_.sort_order||P.name.localeCompare(_.name))},listForms:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/forms/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.title.localeCompare(_.title))},listWheelSummaries:async(a,r={})=>{const o=new URLSearchParams;r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/wheel-curations/summaries/${p?`?${p}`:""}`,{token:a});return S(h)},listProducts:async(a,r={})=>{const o=new URLSearchParams;r.kinds?.length&&o.set("kind",r.kinds.join(",")),r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/products/${p?`?${p}`:""}`,{token:a});return S(h)},getWheelDetail:async(a,r,o={})=>{const p=new URLSearchParams({slug:r});return o.siteId&&p.set("site",o.siteId),F(S(await e(`/api/storefront/wheel-curations/detail/?${p.toString()}`,{token:a})))},updateHeaderSettings:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(N(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return m(r)},listSiteCurrencies:async(a,r)=>{const o=await e(le(a),{token:r});return Array.isArray(o)?o:[]},publishSite:(a,r)=>e(`${N(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${N(a)}live-state/`,{token:r}),getThemeSettings:(a,r)=>e(u(r),{token:a}),updateThemeSettings:(a,r,o)=>e(u(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getMyPreferences:async a=>(await e("/api/auth/me/",{token:a})).preferences??{},updateMyPreferences:(a,r)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:a}),token:r}),getChatSettings:(a,r)=>e(l(r),{token:a}),updateChatSettings:(a,r,o)=>e(l(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(y(r),{token:a}),updateSocialSettings:(a,r,o)=>e(y(o),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,o)=>{const p=new FormData;return p.append("logo",a),e(s(o),{method:"PATCH",body:p,token:r})},clearHeaderLogo:(a,r)=>e(s(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const o=new FormData;return o.append("file",a),e(he(),{method:"POST",body:o,token:r})},listMedia:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("kind",r);const p=await e(`/api/storefront/media-assets/?${o.toString()}`,{token:a});return m(p)}}}const Me=ge({siteDrafts:!0});function me(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function Be(t){return Ft(await i(me(t)))}const T={audience:null,baseUrl:""};async function qe(t,e){return zt(await i(Vt(t,e),T))}async function Ge(t){return Kt(await i(Mt,{...T,method:"POST",body:JSON.stringify(t)}))}async function We(t){try{const e=await i(Bt,{...T,method:"POST",body:JSON.stringify({token:t})});return Q(202,e)}catch(e){if(e instanceof w)return Q(e.status,e.data);throw e}}async function je(t,e){await i(qt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function ze(t,e){await i(Gt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function Ke(t){try{return jt(await i(Wt,{...T,method:"POST",body:JSON.stringify({token:t})}))}catch(e){if(e instanceof w&&we.has(e.status))return"";throw e}}const we=new Set([400,404,410]);export{Pt as API_URL,ue as AmbiguousPageSlugError,w as ApiError,At as BROWSER_READ_TIMEOUT_MS,bt as EFFICIENT_CLIENT_CLOSED_MESSAGE,ye as MediaUploadDestinationError,oe as PREVIEW_PARAM,Ze as PRODUCT_API_BASE,Tt as SERVER_READ_TIMEOUT_MS,v as SERVER_UNREACHABLE_MESSAGE,k as STATUS_NETWORK_ERROR,Fe as adminFetch,kt as api,i as apiFetch,$ as appendSiteQuery,ze as askForWorkspaces,Ge as askToSignUp,He as bookings,ge as createStorefrontAdmin,me as dealersPath,M as defaultRequestDeadline,he as editorMediaUploadPath,_t as editorPortalAudience,$t as editorRequestLanguage,Be as fetchDealers,qe as fetchSignUpAvailability,xe as fitment,je as joinSignUpWaitingList,We as openSignUpLink,Ke as openWorkspaceFind,De as products,Rt as readDeadlineMs,re as resolveClientIp,S as resolveMediaUrls,ie as resolvePreviewToken,ot as resolveSiteHost,ae as resolveSiteHostSource,ne as resolveSiteSlug,Ce as setEditorLanguage,$e as setEditorPortalAudience,Me as storefrontAdmin};
|
|
1
|
+
import{PREVIEW_TOKEN_HEADER as dt,SITE_HOST_HEADER as ut,SITE_SLUG_HEADER as lt}from"../site-headers.js";import{PRODUCT_API_BASE as pt,PRODUCT_BACKEND_URL as H}from"./origins.js";import{listRows as m}from"./list-rows.js";import{parseOption as yt}from"efficient-shell/format";import{backendHopHeaders as ht,clientIpFromForwardedFor as ft,FORWARDED_FOR_HEADER as gt,hopCachingOf as mt}from"../forwarded-for.js";import wt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as O}from"../auth.js";import{efficientClientOpen as St}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as U}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as F}from"../wheels/renderable-finishes.js";const Pt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class w extends Error{status;data;constructor(e,n,s){super(n),this.status=e,this.data=s}}const v="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.",Ot=new Set([502,503,504]),k=0,bt="This editor runs on its host's own backend, which does not serve this request.",Tt=5e3,At=15e3,Rt=()=>typeof window>"u"?Tt:At;function M(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(Rt())}const B=t=>t instanceof Error&&t.name==="TimeoutError",q=(t,e)=>Ot.has(t)?v:e,Et=["admin","venue"];let G="admin";function $e(t){G=yt(Et,"admin",t)}function _t(){return G}const Ut=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let W=null;function Ce(t){W=t&&Ut.test(t)?t:null}function $t(){return W}function Ct(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=Y();return!e||/[?&]site=/.test(t)?t:$(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:n,baseUrl:s,headers:u,audience:l,...y}=e;if(typeof window<"u"&&!St())throw new w(k,bt,null);if(typeof window>"u"&&s===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const a=typeof FormData<"u"&&y.body instanceof FormData;let r;try{r=await fetch(`${s??Pt}${Ct(t)}`,{...y,headers:{...a?{}:{"Content-Type":"application/json"},...n?{Authorization:`Bearer ${n}`}:{},...l===null?{}:{"X-Portal-Audience":l??"shop"},...u},signal:y.signal??M({...y,audience:l})})}catch(h){throw h instanceof TypeError||B(h)?new w(k,v,null):h}let o;try{o=await r.text()}catch(h){throw B(h)?new w(k,v,null):h}let p=null;if(o)try{p=JSON.parse(o)}catch{throw new w(r.status,r.ok?"Expected JSON but received a non-JSON response":q(r.status,r.statusText),o)}if(!r.ok){const h=(p&&typeof p=="object"&&"detail"in p&&typeof p.detail=="string"?p.detail:null)??q(r.status,r.statusText);throw new w(r.status,h,p)}return p}let A=null;async function j(){return A||(A=Nt().finally(()=>{A=null}),A)}async function Nt(){const t=O.takeLegacyRefresh(),e=await kt.refresh(t??void 0);return O.setTokens(e.access),e.access}async function z(){return O.getAccess()??j()}async function g(t,e={}){let n;try{n=await z()}catch{throw O.clear(),new w(401,"Not signed in",null)}try{return await i(t,{...e,token:n})}catch(s){if(!(s instanceof w)||s.status!==401)throw s;try{const u=await j();return await i(t,{...e,token:u})}catch{throw O.clear(),s}}}const It=100,K=20;function vt(t){if(!t)return null;try{return new URL(t,"http://page.invalid").searchParams.get("page")}catch{return null}}async function V(t,e){const[n,s=""]=t.split("?"),u=[];let l="1";for(let y=0;y<K&&l;y++){const a=new URLSearchParams(s);a.set("page_size",String(It)),l!=="1"&&a.set("page",l);const r=await g(`${n}?${a.toString()}`);u.push(...m(r)),l=vt(r.next)}return l&&console.warn(`[${e}] stopped at ${K} pages (${u.length} rows); list may be truncated`),u}async function X(t,e={}){if(O.getAccess())try{return{data:await g(t,e),asShopper:!0}}catch(n){if(!(n instanceof w)||n.status!==401)throw n}return{data:await i(t,e),asShopper:!1}}async function Z(){const t=await g("/api/auth/me/");if(t.portal!=="shop")throw O.clear(),new w(403,"This session is not valid for this shop.",null);return t}const kt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{O.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await z();return await Z(),t},me:Z,updateMe:t=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>g("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>g("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>g("/api/shop-portal/profile/"),updateMyProfile:t=>g("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>g("/api/shop-portal/delivery-locations/"),createAddress:t=>g("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>g(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,n)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:n})}),brands:()=>g("/api/products/brands/"),myOrders:()=>V("/api/shop-portal/orders/","api.myOrders"),myOrder:t=>g(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>g(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>V(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`,"api.myReturns"),createReturn:t=>g("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>g(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const n=new FormData;return n.append("claim_item",t),n.append("file",e),n.append("media_type",e.type.startsWith("video/")?"video":"image"),g("/api/shop-portal/return-media/",{method:"POST",body:n})}};import{media as Lt,absolutizeApiUrl as L}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Jt,isSvgUrl as xt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Dt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Ht,webRuntimeSiteSlug as Y}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Ft}from"../sections/dealer-finder.js";import{SIGN_UP_PATH as Mt,SIGN_UP_VERIFY_PATH as Bt,SIGN_UP_WAITING_PATH as qt,WORKSPACE_FINDS_PATH as Gt,WORKSPACE_FIND_OPEN_PATH as Wt,signInUrlOf as jt,readLinkAnswer as Q,readSignUpAvailability as zt,readSignUpSent as Kt,signUpAvailabilityPath as Vt}from"../sections/sign-up.js";function S(t){if(typeof t=="string")return t.startsWith("/media/")?Lt(t):t;if(Array.isArray(t))return t.map(S);if(t&&typeof t=="object"){const e={};for(const[n,s]of Object.entries(t))e[n]=n==="captions"&&s&&typeof s=="object"&&!Array.isArray(s)?Object.fromEntries(Object.entries(s).map(([u,l])=>[S(u),l])):S(s);return e}return t}import{PRODUCT_API_BASE as Ze}from"./origins.js";const tt=typeof window>"u"&&H!=="",Xt=tt?H:pt,Zt=Ht,b=()=>({baseUrl:Zt(),audience:null});function c(t,e){const n=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${n}`}const et=100,at=50;function J(t,e,n){const s=new URLSearchParams;for(const[u,l]of Object.entries(e))l!=null&&l!==""&&s.set(u,String(l));return s.set("pageSize",String(et)),n&&s.set("cursor",n),`/api/v1${t}?${s.toString()}`}function Yt(t,e){return J("/wheels",{process:t},e)}const rt=et;function Qt(t,e){return J("/wheels",{slug:t.join(",")},e)}function te(t,e,n){return J("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},n)}function ee(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function x(t,e,n=()=>!1,s=()=>!1){const u=[];let l=null;try{for(let y=0;y<at;y++){const a=await i(await e(l),await d());if(u.push(...m(a)),l=ee(a.next),!l)break;if(s(u))return u}l&&console.warn(`[${t}] stopped at ${at} pages (${u.length} rows); catalog may be truncated`)}catch(y){if(n(y))throw y;console.warn(`[${t}] product API unavailable, returning []`,y)}return u}const nt=t=>t instanceof w&&t.status===400;function st(t){return t.flatMap(e=>e.kind==="alloy-wheel"?U([e]):[e])}async function ot(){return(await ae()).host}async function ae(){try{const{headers:t}=await import("next/headers"),e=await t(),n=l=>l?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,s=n(e.get(ut)??e.get("x-forwarded-host")??e.get("host")),u=n(e.get("host"));return{host:s,matchesRequestHost:s!==null&&s===u}}catch{return{host:null,matchesRequestHost:!1}}}async function re(){try{const{headers:t}=await import("next/headers");return ft((await t()).get(gt))}catch{return null}}async function ne(){try{const{headers:t}=await import("next/headers");return(await t()).get(lt)||null}catch{return null}}async function se(){const t=await ne();if(t)return`site=${encodeURIComponent(t)}`;const e=await ot();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=Y();return e?$(t,`site=${encodeURIComponent(e)}`):t}return $(t,await se())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const oe="preview";async function ie(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(dt)}catch{return null}}async function ce(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function D(t,e){const n=await ie();if(n===null)return[await f(t),await d(e)];const s=$(await f(t),`${oe}=${encodeURIComponent(n)}`),{next:u,cache:l,...y}=e??{},a=await d({...y,cache:"no-store"}),r=await ce();return r&&(a.headers={...a.headers,"user-agent":r}),[s,a]}async function de(t){if(!tt)return;const[e,n]=await Promise.all([ot(),re()]),s=ht(e,n,t);return Object.keys(s).length>0?s:void 0}async function d(t){const e=await de(mt(t)),n={baseUrl:Xt,...t};return e&&(n.headers={...e,...t?.headers}),n}const R=typeof window>"u";function E(t,e){const n=new URLSearchParams;for(const[u,l]of Object.entries(e))l!==void 0&&l!==""&&n.set(u,String(l));const s=n.toString();return`/api/v1/fitment${t}${s?`?${s}`:""}`}const xe={listMakes:async t=>{if(R){const{fitmentData:n}=await import("./fitment-data.js");return n.makes(t)}const e=await i(E("/makes",{region:t}),b());return m(e)},listModels:async(t,e)=>{if(R){const{fitmentData:s}=await import("./fitment-data.js");return s.models(t,e)}const n=await i(E("/models",{make:t,region:e}),b());return m(n)},listYears:async(t,e,n)=>{if(R){const{fitmentData:u}=await import("./fitment-data.js");return u.years(t,e,n)}const s=await i(E("/years",{make:t,model:e,region:n}),b());return m(s)},listModifications:async(t,e,n,s)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.modifications(t,e,n,s)}const u=await i(E("/modifications",{make:t,model:e,year:n,region:s}),b());return m(u)},getStockFitment:async(t,e,n,s,u)=>{if(R){const{fitmentData:l}=await import("./fitment-data.js");return l.stockFitment(t,e,n,s,u)}return i(E("/stock-fitment",{make:t,model:e,year:n,modification:s,region:u}),b())}},De={listWheels:async(t,e={})=>{const n=await x("products.listWheels",async s=>await f(Yt(t,s)),e.throwOnFailure?()=>!0:void 0,e.maxRows===void 0?void 0:s=>U([...s]).length>=e.maxRows);return U(S(n))},listWheelsBySlug:async(t,e={})=>{const n=[...new Set(t.map(a=>a.trim()).filter(Boolean))];if(n.length===0)return[];const s=[];for(let a=0;a<n.length;a+=rt)s.push(n.slice(a,a+rt));const u=await Promise.all(s.map(a=>x("products.listWheelsBySlug",async r=>await f(Qt(a,r)),e.throwOnFailure?()=>!0:nt))),l=new Set(n),y=u.flat().filter(a=>l.has(a.slug));return U(S(y))},listCatalog:async(t,e,n={})=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await x("products.listCatalog",async u=>await f(te(t,e,u)),n.throwOnFailure?()=>!0:nt,n.maxRows===void 0?void 0:u=>st([...u]).length>=n.maxRows);return st(S(s))},getWheel:async t=>F(S(await i(await f(c(`/wheels/${t}`)),await d()))),getTyre:async t=>S(await i(await f(c(`/tyres/${t}`)),await d())),listBundles:async(t={})=>{try{return await i(await f(c("/bundles")),await d())}catch(e){if(t.throwOnFailure)throw e;return[]}},getBundle:async t=>i(await f(c(`/bundles/${t}`)),await d()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:n=null}=t;if(typeof window>"u"){const{listGalleryBuilds:s}=await import("./gallery-builds-data.js");return S(s(e,n))}try{const s=new URLSearchParams;e&&s.set("process",e),n&&s.set("wheelSlug",n);const u=s.toString(),l=await i(`/api/v1/gallery-builds${u?`?${u}`:""}`,b());return S(m(l))}catch(s){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",s),[]}},getSite:async()=>i(await f(c("/site")),await d()),getSiteBySlug:async t=>i(`${c("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await d():void 0),listPages:async()=>S(await i(await f(c("/pages")),await d())),listPopups:async()=>i(await f(c("/popups")),await d()),listProductTemplates:async()=>{try{return await i(await f(c("/product-templates")),await d())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${c("/dynamic-pages")}${e}`),await d())}catch(n){if(n instanceof w&&n.status===404)return[];throw n}},getRecord:async(t,e)=>{try{return await i(await f(c(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await d())}catch(n){if(n instanceof w&&n.status===404)return null;throw n}},listRecordKeys:async t=>{try{const e=await i(await f(c(`/records/${encodeURIComponent(t)}`)),await d({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(n=>typeof n=="string"&&n!==""):[]}catch(e){if(e instanceof w&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(c("/product-type-choices")),await d())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(c("/field-usage")),await d())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const n=e.record?`?record=${encodeURIComponent(e.record)}`:"",[s,u]=await D(c(`/pages/${t}`)+n,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return S(await i(s,u))},listBlogPosts:async(t={},{throwOnFailure:e=!1}={})=>{const n=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(c("/blog-posts")+n,await d())).map(u=>({...u,coverImage:L(u.coverImage)??""}))}catch(s){if(e)throw s;return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(c(`/blog-posts/${t}`),await d());return{...e,coverImage:L(e.coverImage)??""}},createOrder:async t=>i(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>g(c("/orders"),await d({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(c("/orders/lookup"),await d({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(c("/payments/intent"),await d({method:"POST",body:JSON.stringify(t)})),releaseCheckout:async t=>i(c("/checkouts/release"),await d({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(c("/payments/paypal/order"),await d({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(c("/payments/paypal/capture"),await d({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(c("/payments/afterpay/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(c("/payments/afterpay/capture"),await d({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(c("/payments/square/charge"),await d({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(c("/payments/gocardless/billing-request"),await d({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(c("/payments/gocardless/complete"),await d({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(c("/payments/zip/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(c("/payments/zip/capture"),await d({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(c("/payments/klarna/checkout"),await d({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(c("/payments/klarna/capture"),await d({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(c("/stock-alerts"),await d({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(c("/pre-order-intents"),await d({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(c("/newsletter-subscriptions"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(c("/newsletter-unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(c("/carts"),await d({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(c("/carts/restore"),await d({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(c("/carts/unsubscribe"),await d({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const n=c("/reviews"),s=e.toString();try{return await i(await f(s?`${n}?${s}`:n),await d())}catch(u){return console.warn("[products.listReviews] product API unavailable, returning []",u),[]}},submitReview:async t=>i(c("/reviews"),await d({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(c(`/forms/${encodeURIComponent(t)}`),await d()),submitForm:async(t,e)=>i(c(`/forms/${encodeURIComponent(t)}/submissions`),await d({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(c("/shipping-methods"),await d())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(c(`/countries/${encodeURIComponent(t)}/subdivisions`),await d())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=c("/cart/quote"),n=await d({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await X(e,n)).data:i(e,n)},validateCoupon:async t=>{const{data:e,asShopper:n}=await X(c("/coupons/validate"),await d({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:n}},getHeaderSettings:async()=>{const t=M({method:"GET"}),e=await i(...await D(c("/header-settings"),{signal:t})),n=L(e.logoUrl);let s=null,u=null;if(n&&xt(n)){const l=await Jt(n,t);l&&(s=l.reversed,u=l.inkIsDark)}return{...e,logoUrl:n,logoReversed:s,logoInkIsDark:u}},getThemeSettings:async()=>i(...await D(c("/theme-settings"))),getChatSettings:async()=>i(await f(c("/chat-settings")),await d())},He={listServices:async()=>{try{return await i(c("/bookings/services"),await d())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(c(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await d()),create:async t=>i(c("/bookings"),await d({method:"POST",body:JSON.stringify(t)})),get:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}`),await d()),cancel:async t=>i(c(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await d({method:"POST"})),reschedule:async(t,e)=>i(c(`/bookings/manage/${encodeURIComponent(t)}/reschedule`),await d({method:"POST",body:JSON.stringify({startAt:e})})),createPaymentIntent:async t=>i(c("/bookings/payments/intent"),await d({method:"POST",body:JSON.stringify({manageToken:t})}))};class ue extends Error{slug;count;constructor(e,n){super(`Slug "${e}" exists on ${n} websites; a site is required to pick one.`),this.slug=e,this.count=n,this.name="AmbiguousPageSlugError"}}const C=(t,e,n)=>{const s=new URLSearchParams({...e?{site:e}:{},...n?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${s?`?${s}`:""}`},N=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,le=t=>`${N(t)}currencies/`,pe="/api/storefront/media/ingest/";class ye 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 he(){const t=Dt();if(!t)throw new ye;return`${pe}?${new URLSearchParams({site:t})}`}const fe="X-Puck-Media-Manifest",it=wt.contentHash,I={"X-Media-Manifest":it,[fe]:it},Fe=ct({});function ct(t){return(e,n={})=>{const s=$t(),u=t.headers||s?{...s?{"Accept-Language":s}:{},...t.headers,...n.headers}:void 0;return i(e,{...n,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...u?{headers:u}:{},audience:t.audience??_t()})}}function ge(t={}){const e=ct(t),n=t.siteDrafts===!0,s=a=>C("header-settings",a,n),u=a=>C("theme-settings",a,n),l=a=>C("chat-settings",a,n),y=a=>C("social-settings",a,n);return{findPageBySlug:async(a,r,o)=>{const p=new URLSearchParams({slug:a});o&&p.set("site",o);const h=await e(`/api/storefront/pages/?${p.toString()}`,{token:r}),P=m(h);if(!o&&P.length>1)throw new ue(a,P.length);return P[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,o,p,h)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:p,...h?{client_id:h}:{}}),token:o}),duplicatePage:(a,r,o)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:o}),geocode:(a,r,o)=>e(`/api/storefront/geocode/?${new URLSearchParams(o?{q:a,country:o}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,o,p=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:o,takeover:p}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,o)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:I,token:o}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,o)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),listTemplatePages:async(a,r)=>{const o=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return m(o)},getPageLibrary:async a=>{const r=await e("/api/storefront/page-templates/?is_page_library=true&is_active=true",{token:a});return m(r)[0]??null},getTemplateLibrary:(a,r)=>e(`/api/storefront/pages/template-library/?site=${encodeURIComponent(a)}`,{token:r}),createPageFromTemplate:(a,r)=>e(`/api/storefront/pages/from-template/${n?"?draft=1":""}`,{method:"POST",body:JSON.stringify(a),token:r}),findTemplatePageBySlug:async(a,r,o)=>{const p=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:o});return m(p)[0]??null},createTemplatePage:(a,r,o)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:I,token:o}),saveTemplatePageLayout:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:I,token:o}),deleteTemplatePage:(a,r,o)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...o?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/pages/?${o.toString()}`,{token:a});return m(p)},createPage:(a,r,o,p)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:o}),token:p}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(s(r),{token:a}),listMenus:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("site",r);const p=await e(`/api/storefront/menus/?${o}`,{token:a});return m(p)},listBlogPosts:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/blog-posts/?${o.toString()}`,{token:a});return m(p)},listFieldUsage:async(a,r)=>{const o=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(o?.entries)?o.entries:[]},listCategories:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.visibleOnly&&o.set("is_visible","true"),r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/categories/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.sort_order-_.sort_order||P.name.localeCompare(_.name))},listForms:async(a,r={})=>{const o=new URLSearchParams({no_page:"true"});r.siteId&&o.set("site",r.siteId);const p=await e(`/api/storefront/forms/?${o.toString()}`,{token:a});return[...m(p)].sort((P,_)=>P.title.localeCompare(_.title))},listWheelSummaries:async(a,r={})=>{const o=new URLSearchParams;r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/wheel-curations/summaries/${p?`?${p}`:""}`,{token:a});return S(h)},listProducts:async(a,r={})=>{const o=new URLSearchParams;r.kinds?.length&&o.set("kind",r.kinds.join(",")),r.siteId&&o.set("site",r.siteId);const p=o.toString(),h=await e(`/api/storefront/products/${p?`?${p}`:""}`,{token:a});return S(h)},getWheelDetail:async(a,r,o={})=>{const p=new URLSearchParams({slug:r});return o.siteId&&p.set("site",o.siteId),F(S(await e(`/api/storefront/wheel-curations/detail/?${p.toString()}`,{token:a})))},updateHeaderSettings:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(N(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return m(r)},listSiteCurrencies:async(a,r)=>{const o=await e(le(a),{token:r});return Array.isArray(o)?o:[]},publishSite:(a,r)=>e(`${N(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${N(a)}live-state/`,{token:r}),getThemeSettings:(a,r)=>e(u(r),{token:a}),updateThemeSettings:(a,r,o)=>e(u(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getMyPreferences:async a=>(await e("/api/auth/me/",{token:a})).preferences??{},updateMyPreferences:(a,r)=>e("/api/auth/me/",{method:"PATCH",body:JSON.stringify({preferences:a}),token:r}),getChatSettings:(a,r)=>e(l(r),{token:a}),updateChatSettings:(a,r,o)=>e(l(o),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(y(r),{token:a}),updateSocialSettings:(a,r,o)=>e(y(o),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,o)=>{const p=new FormData;return p.append("logo",a),e(s(o),{method:"PATCH",body:p,token:r})},clearHeaderLogo:(a,r)=>e(s(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,o)=>e(s(o),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const o=new FormData;return o.append("file",a),e(he(),{method:"POST",body:o,token:r})},listMedia:async(a,r)=>{const o=new URLSearchParams({no_page:"true"});r&&o.set("kind",r);const p=await e(`/api/storefront/media-assets/?${o.toString()}`,{token:a});return m(p)}}}const Me=ge({siteDrafts:!0});function me(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function Be(t){return Ft(await i(me(t)))}const T={audience:null,baseUrl:""};async function qe(t,e){return zt(await i(Vt(t,e),T))}async function Ge(t){return Kt(await i(Mt,{...T,method:"POST",body:JSON.stringify(t)}))}async function We(t){try{const e=await i(Bt,{...T,method:"POST",body:JSON.stringify({token:t})});return Q(202,e)}catch(e){if(e instanceof w)return Q(e.status,e.data);throw e}}async function je(t,e){await i(qt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function ze(t,e){await i(Gt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function Ke(t){try{return jt(await i(Wt,{...T,method:"POST",body:JSON.stringify({token:t})}))}catch(e){if(e instanceof w&&we.has(e.status))return"";throw e}}const we=new Set([400,404,410]);export{Pt as API_URL,ue as AmbiguousPageSlugError,w as ApiError,At as BROWSER_READ_TIMEOUT_MS,bt as EFFICIENT_CLIENT_CLOSED_MESSAGE,ye as MediaUploadDestinationError,oe as PREVIEW_PARAM,Ze as PRODUCT_API_BASE,Tt as SERVER_READ_TIMEOUT_MS,v as SERVER_UNREACHABLE_MESSAGE,k as STATUS_NETWORK_ERROR,Fe as adminFetch,kt as api,i as apiFetch,$ as appendSiteQuery,ze as askForWorkspaces,Ge as askToSignUp,He as bookings,ge as createStorefrontAdmin,me as dealersPath,M as defaultRequestDeadline,he as editorMediaUploadPath,_t as editorPortalAudience,$t as editorRequestLanguage,Be as fetchDealers,qe as fetchSignUpAvailability,xe as fitment,je as joinSignUpWaitingList,We as openSignUpLink,Ke as openWorkspaceFind,De as products,Rt as readDeadlineMs,re as resolveClientIp,S as resolveMediaUrls,ie as resolvePreviewToken,ot as resolveSiteHost,ae as resolveSiteHostSource,ne as resolveSiteSlug,Ce as setEditorLanguage,$e as setEditorPortalAudience,Me as storefrontAdmin};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as i}from"efficient-
|
|
1
|
+
import{parseOption as i}from"efficient-shell/format";const o=["international","us"],t={tyre:"tire",tyres:"tires",colour:"color",colours:"colors",centre:"center",centres:"centers",catalogue:"catalog",catalogues:"catalogs",enquire:"inquire",enquiry:"inquiry",enquiries:"inquiries",aluminium:"aluminum",honour:"honor",honoured:"honored"},s=new RegExp(`\\b(${Object.keys(t).sort((e,r)=>r.length-e.length).join("|")})\\b`,"gi");function c(e){return i(o,"international",e)}function a(e,r){return e===e.toUpperCase()?r.toUpperCase():e[0]===e[0].toUpperCase()?r[0].toUpperCase()+r.slice(1):r}function l(e,r){return r!=="us"?e:e.replace(s,n=>a(n,t[n.toLowerCase()]))}export{t as US_SPELLING,l as inEnglish,c as normalizeEnglishVariant};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HEADER_HEIGHT_PX as o}from"efficient-web-builder/render/lib/document/header-clearance";import{parseOption as t}from"efficient-
|
|
1
|
+
import{HEADER_HEIGHT_PX as o}from"efficient-web-builder/render/lib/document/header-clearance";import{parseOption as t}from"efficient-shell/format";function i(e){return typeof e=="number"&&Number.isInteger(e)&&e>=o.min&&e<=o.max?e:o.default}const E="fixed inset-x-0 bottom-0 top-[var(--sf-header-h,88px)]",c=e=>!!e&&e.startsWith("/wheels/")&&e!=="/wheels",x=(e,r)=>!e&&r?"var(--section-bg)":"var(--bg)",l=[{label:"Uppercase",value:"uppercase"},{label:"Capitalised",value:"capitalised"}],n="uppercase",_=e=>t(l,n,e),s=[{label:"Icon",value:"icon"},{label:"Text",value:"text"}],u=e=>t(s,"icon",e),A=[{label:"Own row",value:"top"},{label:"Same row",value:"inline"}],b="top",H=e=>e==="inline"?"inline":e==="top"||e==="bottom"?"top":null;export{A as HEADER_MENU_ROWS,b as HEADER_MENU_ROW_FALLBACK,l as HEADER_NAV_TEXT_CASES,n as HEADER_NAV_TEXT_CASE_FALLBACK,s as HEADER_UTIL_STYLES,E as UNDER_HEADER_SHEET_CLASS,x as headerSolidBackground,c as isProductPage,i as resolveHeaderHeightPx,H as resolveMenuRow,_ as resolveNavTextCase,u as resolveUtilStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{normalizePath as s}from"efficient-web-builder/format/lib/popup/rules";import{menuLinkKind as u}from"../menu-link.js";import{linkParts as m}from"../links/link-rules.js";import{plpFilterQuery as b}from"../wheels/plp-filters.js";import{parseOption as d}from"efficient-
|
|
1
|
+
import{normalizePath as s}from"efficient-web-builder/format/lib/popup/rules";import{menuLinkKind as u}from"../menu-link.js";import{linkParts as m}from"../links/link-rules.js";import{plpFilterQuery as b}from"../wheels/plp-filters.js";import{parseOption as d}from"efficient-shell/format";const w="[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",g="text-[length:var(--size-label,13px)]",h={rowLink:"relative opacity-100",row:"pointer-events-none absolute inset-x-0 -bottom-2 h-[2px] bg-accent",tab:"absolute inset-x-0 -bottom-px h-[2px] bg-accent"},S={list:`m-0 flex list-none items-stretch gap-0 overflow-auto p-0 ${w}`,item:(e,t)=>[`relative isolate flex whitespace-nowrap border-r border-line px-[26px] py-[18px] font-mono ${g} uppercase tracking-[0.22em]`,e?"border-l border-line":"",t?"":"[&_*]:pointer-events-none [&_a]:pointer-events-auto"].join(" "),tab:e=>["block transition-colors after:absolute after:inset-0 after:-z-1",e?"text-fg":"text-fg-dim hover:text-fg"].join(" "),underline:h.tab},_={nav:"-mx-1 [scrollbar-width:none] max-view-wide:overflow-x-auto [&::-webkit-scrollbar]:hidden",list:"flex flex-wrap gap-2 px-1 pb-1 max-view-wide:min-w-max max-view-wide:flex-nowrap",tab:e=>`flex flex-col gap-0.5 rounded-[var(--sf-button-radius,999px)] border px-5 py-2.5 transition-colors ${e?"border-accent bg-accent text-accent-ink":"border-line text-fg hover:border-accent hover:text-accent"}`},v=["row","column"];function R(e){return d(v,"column",e)}function T(e,t){return e==="row"&&t===!0}function p(e){return[...new URLSearchParams(b(e))].map(([t,r])=>`${t}=${r}`)}function B(e,t,r){if(!t)return-1;const n=s(t),o=new Set(p(r));let i=-1,c=-1;return e.forEach((l,f)=>{if(u(l)!=="page"||s(l)!==n)return;const a=p(m(l).query);a.every(x=>o.has(x))&&a.length>c&&(i=f,c=a.length)}),i}function O(e,t){let r=e?.querySelector('[aria-current="page"]')??null;if(!e||!r)return;for(;r.parentElement&&r.parentElement!==e;)r=r.parentElement;const n=e.getBoundingClientRect(),o=r.getBoundingClientRect(),i=o.left<n.left?o.left-n.left:o.right>n.right?Math.min(o.right-n.right,o.left-n.left):0;i!==0&&e.scrollBy({left:i,behavior:t})}export{h as CURRENT_LINE,S as TAB_CELLS,_ as TAB_PILLS,B as currentLinkIndex,T as marksCurrentLink,R as menuLayoutOf,O as showCurrentTab};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as t}from"efficient-
|
|
1
|
+
import{parseOption as t}from"efficient-shell/format";const c="titleLook",e=["card","headline"],r="card",p=o=>t(e,r,o),s="accentLastWord",L="showBadge";export{r as DEFAULT_TITLE_LOOK,L as EYEBROW_BADGE_PROP,s as NAME_ACCENT_PROP,e as TITLE_LOOKS,c as TITLE_LOOK_PROP,p as parseTitleLook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import d from"../../../../../components/pdp-dynamic/DynamicDetailRows.js";import a from"../../../../../components/DetailRows.js";import{phRows as r}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{bandPadProps as i}from"../../../../sections/band-padding.js";import{parseOption as m}from"efficient-
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import d from"../../../../../components/pdp-dynamic/DynamicDetailRows.js";import a from"../../../../../components/DetailRows.js";import{phRows as r}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{bandPadProps as i}from"../../../../sections/band-padding.js";import{parseOption as m}from"efficient-shell/format";import{DETAIL_ROWS_FROM as o,DETAIL_ROWS_FROM_FALLBACK as n,DetailRowsMeta as f,DETAILROWS_SCAFFOLD_ROWS as R}from"./meta.js";const F={...f,render:t=>t.dynamic?e(d,{rowsFrom:m(o,n,t.rowsFrom),startLeft:t.startLeft,pads:i(t),editing:t.editor?.isEditing,template:t.template,nodeId:typeof t.id=="string"?t.id:void 0}):e(a,{rows:r(t.rows,R,t.editor),startLeft:t.startLeft,layout:t.layout,pads:i(t),editing:t.editor?.isEditing,template:t.template,nodeId:typeof t.id=="string"?t.id:void 0})};export{F as DetailRowsRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import i from"../../../../../components/fitment/FitmentPickerPart.js";import{phoneKey as r}from"efficient-easel/draw";import{parseOption as t}from"efficient-
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import i from"../../../../../components/fitment/FitmentPickerPart.js";import{phoneKey as r}from"efficient-easel/draw";import{parseOption as t}from"efficient-shell/format";import{FITMENT_CELL_LOOK_PROP as m}from"../../../../sections/fitment-cell-look.js";import{FITMENT_PICKER_LAYOUT_FALLBACK as n,FITMENT_PICKER_LAYOUTS as c,FitmentPickerMeta as l}from"./meta.js";const a={...l,render:e=>o(i,{layout:t(c,n,e.layout),pickerColumns:e.pickerColumns,pickerColumnsPhone:e[r("pickerColumns")],cellLook:e[m],editing:!!e.editor?.isEditing})};export{a as FitmentPickerRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import t from"../../../../../components/OpeningHours.js";import{OPENING_SAMPLE_MOMENT as i,OPENING_SAMPLE_WEEK as s,readOpeningRow as d}from"../../../../sections/opening-hours.js";import{sourcedRows as m}from"efficient-web-builder/format/lib/content/block-sources";import{readHidable as a}from"efficient-easel/screen/lib/document/hidable";import{parseOption as O}from"efficient-
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import t from"../../../../../components/OpeningHours.js";import{OPENING_SAMPLE_MOMENT as i,OPENING_SAMPLE_WEEK as s,readOpeningRow as d}from"../../../../sections/opening-hours.js";import{sourcedRows as m}from"efficient-web-builder/format/lib/content/block-sources";import{readHidable as a}from"efficient-easel/screen/lib/document/hidable";import{parseOption as O}from"efficient-shell/format";import{OPENING_HOURS_SHOW_FALLBACK as u,OPENING_HOURS_SHOWS as f,OpeningHoursMeta as p}from"./meta.js";const E=()=>[{week:s,zone:"Australia/Sydney",hours:""}],_=o=>{const{text:e,hidden:n}=a(o);return n||!e?void 0:e},P={...p,render:o=>{const{rows:e,sample:n}=m(o,!!o.editor?.isEditing,E());return r(t,{show:O(f,u,o.show),title:_(o.title),row:d(e),contained:o.contained!==!1,now:n?i:void 0})}};export{P as OpeningHoursRender,E as openingHoursSample};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import i from"../../../../../components/SignUpSection.js";import{parseOption as a}from"efficient-
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import i from"../../../../../components/SignUpSection.js";import{parseOption as a}from"efficient-shell/format";import{SIGN_UP_MODE_FALLBACK as o,SIGN_UP_MODES as m,SignUpMeta as d}from"./meta.js";const f=()=>({firstName:"Amelia",lastName:"Chen",email:"amelia@harbourlane.co",company:"Harbour Lane Studio",slug:"harbourlane",country:"AU",currency:"AUD"}),r=(e,n="")=>typeof e=="string"?e.trim():n,y={...d,render:e=>t(i,{mode:a(m,o,e.mode),product:r(e.product),productName:r(e.productName),freeLine:r(e.freeLine),zone:r(e.zone),askCountry:e.askCountry===!0,termsHref:r(e.termsHref),privacyHref:r(e.privacyHref),findHref:r(e.findHref),contained:e.contained!==!1,sample:e.editor?.isEditing?f():void 0})};export{y as SignUpRender,f as signUpSample};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as n}from"efficient-
|
|
1
|
+
import{parseOption as n}from"efficient-shell/format";import{shownForOption as r,withRowRules as i}from"efficient-web-builder/format/lib/document/show-when-attach";const t=["issues","posts"],S=[{label:"Issues",value:"issues"},{label:"Blog posts",value:"posts"}],o="issues";function _(s){return n(t,o,s)}const u={issues:["issues"],_gPosts:["posts"],posts:["posts"],limit:["posts"]};function c(s){return i(s,Object.entries(u).map(([e,p])=>[[e],r("contentType",t,o,p)]))}export{t as SUBSCRIBE_CONTENT_TYPES,o as SUBSCRIBE_CONTENT_TYPE_DEFAULT,u as SUBSCRIBE_CONTENT_TYPE_FIELDS,S as SUBSCRIBE_CONTENT_TYPE_OPTIONS,_ as subscribeContentTypeOf,c as withSubscribeContentRules};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as o}from"efficient-
|
|
1
|
+
import{parseOption as o}from"efficient-shell/format";const e="pills",r=[{label:"Pills",value:"pills"},{label:"Columns",value:"columns"}];function p(l){return o(r,e,l)}export{e as DEFAULT_FILTER_BAR_LAYOUT,r as FILTER_BAR_LAYOUT_OPTIONS,p as parseFilterBarLayout};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as o}from"efficient-
|
|
1
|
+
import{parseOption as o}from"efficient-shell/format";const l="cellLook",t=[{value:"joined",label:"Joined"},{value:"separate",label:"Separate"}],L="joined",p=e=>o(t,L,e);export{L as DEFAULT_FITMENT_CELL_LOOK,t as FITMENT_CELL_LOOK_OPTIONS,l as FITMENT_CELL_LOOK_PROP,p as parseFitmentCellLook};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as r}from"efficient-
|
|
1
|
+
import{parseOption as r}from"efficient-shell/format";const o=["split","imageRight","stacked"],n="split";function T(t){return r(o,n,t)}const p=["left","center"],i="left";function a(t){return r(p,i,t)}const s=35,_=70,c=50;function u(t){const e=typeof t=="number"?t:Number(t);return Number.isFinite(e)?Math.min(_,Math.max(s,Math.round(e))):c}export{n as DEFAULT_HERO_LAYOUT,c as DEFAULT_HERO_RATIO,i as DEFAULT_HERO_TEXT_ALIGN,o as HERO_LAYOUTS,_ as HERO_RATIO_MAX,s as HERO_RATIO_MIN,T as parseHeroLayout,u as parseHeroRatio,a as parseHeroTextAlign};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as r}from"efficient-
|
|
1
|
+
import{parseOption as r}from"efficient-shell/format";import{IMAGE_FIT_LABEL as e,parseImageFit as n}from"efficient-web-builder/format/lib/content/image-fit";const i=["main","thumbs","tiled"],p="thumbs";function s(t){return r(i,p,t)}const a=["contain","cover"],E="contain";function _(t){return n(t,E)}function I(){return a.map(t=>({label:e[t],value:t}))}function u(t,o){return o?"contain":t}export{p as DEFAULT_HERO_GALLERY_MODE,E as DEFAULT_HERO_IMAGE_FIT,i as HERO_GALLERY_MODES,a as HERO_IMAGE_FITS,I as heroImageFitOptions,s as parseHeroGalleryMode,_ as parseHeroImageFit,u as resolveHeroImageFit};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as e}from"efficient-
|
|
1
|
+
import{parseOption as e}from"efficient-shell/format";const t=["top","belowSpecs"],r="top";function E(o){return e(t,r,o)}export{r as DEFAULT_HERO_PRICE_PLACEMENT,E as parseHeroPricePlacement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{parseOption as o}from"efficient-
|
|
1
|
+
import{parseOption as o}from"efficient-shell/format";const i=[{value:"hide",label:"Hide the rest"},{value:"pages",label:"Pages"}],u="hide",f=12,m={min:4,max:48,step:4};function c(e){return o(i.map(t=>t.value),u,typeof e=="string"?e:void 0)}function a(e,t,r=1){const n=e===0?null:t.paged?{from:(r-1)*t.per+1,to:Math.min(e,r*t.per)}:t.cap?null:{from:1,to:e};return{total:e,range:n}}function P(e){return e.showAll||typeof e.limit!="number"?void 0:e.limit}const p=12;function s(e){const t=c(e.moreProducts)==="pages",r=t?void 0:P(e),n=typeof e.perPage=="number"&&e.perPage>0?Math.floor(e.perPage):f;return{paged:t,per:n,limit:r,cap:typeof r=="number"&&r>0}}export{u as DEFAULT_MORE_PRODUCTS,f as DEFAULT_PER_PAGE,p as GRID_TOP_UP_SPARE,i as MORE_PRODUCTS_OPTIONS,m as PER_PAGE_RANGE,P as gridLimitOf,s as gridPagingOf,a as gridShownOf,c as parseMoreProducts};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_CATALOG_FILTER_LABELS as a}from"../content/catalog-filter-labels.js";import{STOCK_WORDS as I}from"../content/stock-words.js";import{parseOption as l}from"efficient-
|
|
1
|
+
import{DEFAULT_CATALOG_FILTER_LABELS as a}from"../content/catalog-filter-labels.js";import{STOCK_WORDS as I}from"../content/stock-words.js";import{parseOption as l}from"efficient-shell/format";import{viewHideClass as b}from"efficient-web-builder/format/lib/content/view-hide-class";import{asPlpSortKey as S}from"../wheels/plp-filters.js";const p=[{value:"bar-pills",label:"Bar · pills"},{value:"bar-columns",label:"Bar · columns"},{value:"rail",label:"Side rail"},{value:"button",label:"Filters button"}],E="bar-pills",u=[{value:"bar",label:"Bar"},{value:"button",label:"Filters button"},{value:"rail",label:"Side rail"}],F="bar",d=[{value:"inStock",label:I.inStock},{value:"category",label:"Category"},{value:"lugs",label:a.lugs},{value:"price",label:a.price}],x=["inStock","category","lugs","price"],v="recommended";function y(t){return l(p.map(o=>o.value),E,typeof t=="string"?t:void 0)}function K(t){return l(u.map(o=>o.value),F,typeof t=="string"?t:void 0)}const i=["rail","button"],w="filterLook",g="rail",L=t=>i.includes(t.value),D=p.filter(L),G=u.filter(L);function c(t){return l(i,g,typeof t=="string"?t:void 0)}const k=c,m="lg:flex-none lg:self-stretch";function H(t,o){const r=c(t),O=k(o),_=e=>e.desk&&e.phone?"":e.desk||e.phone?b({desktop:!e.desk,tablet:!e.desk,mobile:!e.phone}):null,s=e=>_({desk:r===e,phone:O===e}),f=e=>e&&`${e} ${m}`,n={rail:null,button:null};for(const e of i)switch(e){case"rail":n.rail=f(s(e));break;case"button":n.button=s(e);break;default:{const T=e;throw new Error(`no drawing for listing look ${String(T)}`)}}return n}function U(t){if(!Array.isArray(t))return[...x];const o=new Set(d.map(r=>r.value));return t.filter(r=>typeof r=="string"&&o.has(r))}function C(t){return S(typeof t=="string"?t:void 0)}export{E as DEFAULT_FILTER_LOOK,F as DEFAULT_FILTER_LOOK_PHONE,g as DEFAULT_LISTING_FILTER_LOOK,v as DEFAULT_OPENING_SORT,x as DEFAULT_SHOWN_FILTERS,p as FILTER_LOOK_OPTIONS,u as FILTER_LOOK_PHONE_OPTIONS,i as LISTING_FILTER_LOOKS,D as LISTING_FILTER_LOOK_OPTIONS,G as LISTING_FILTER_LOOK_PHONE_OPTIONS,w as LISTING_FILTER_LOOK_PROP,d as SHOWN_FILTER_OPTIONS,L as isListingFilterLook,y as parseFilterLook,K as parseFilterLookPhone,c as parseListingFilterLook,k as parseListingFilterLookPhone,C as parseOpeningSort,U as parseShownFilters,H as plpFilterViews};
|