efficient-storefront-blocks 0.121.2 → 0.122.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +42 -0
  2. package/dist/chunks/{EditorPreviewCheckout-CDSVQFZG.js → EditorPreviewCheckout-HGXPPOPY.js} +4 -4
  3. package/dist/chunks/{SiteEditorProvider-6ZJ5MKW3.js → SiteEditorProvider-R3ZNQPAI.js} +1 -1
  4. package/dist/chunks/chunk-7OV26TMN.js +1 -0
  5. package/dist/chunks/chunk-IJC4EEZC.js +1 -0
  6. package/dist/chunks/{chunk-7D4OUJUE.js → chunk-NYZMVYQ4.js} +1 -1
  7. package/dist/chunks/chunk-PNXEY4EH.js +96 -0
  8. package/dist/chunks/chunk-TAV4GVJC.js +342 -0
  9. package/dist/chunks/{fitment-data-SWQZTLG6.js → fitment-data-QP4XEFXC.js} +1 -1
  10. package/dist/editor/components/HeaderSettingsPanel.d.ts +1 -1
  11. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  12. package/dist/editor/lib/document/blocks/commerce/DetailRows/fields.js +1 -1
  13. package/dist/editor/lib/document/blocks/commerce/FitmentPicker/fields.js +1 -1
  14. package/dist/editor/lib/document/blocks/commerce/shared-fields.js +1 -1
  15. package/dist/editor/lib/document/blocks/service/SignUp/fields.js +1 -1
  16. package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
  17. package/dist/editor/lib/document/box-header.js +1 -1
  18. package/dist/editor.css +1 -1
  19. package/dist/index.js +74 -56
  20. package/dist/render/built-with.json +1 -1
  21. package/dist/render/components/GalleryShowcase.js +1 -1
  22. package/dist/render/components/Header.js +1 -1
  23. package/dist/render/components/HeaderToolBlocks.d.ts +2 -1
  24. package/dist/render/components/SignUpSection.d.ts +2 -1
  25. package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
  26. package/dist/render/components/fitment/FitmentPickerPart.d.ts +2 -1
  27. package/dist/render/components/pdp-dynamic/DynamicDetailRows.d.ts +2 -1
  28. package/dist/render/lib/api/index.js +1 -1
  29. package/dist/render/lib/content/english-variant.d.ts +3 -1
  30. package/dist/render/lib/content/english-variant.js +1 -1
  31. package/dist/render/lib/content/header-bar.d.ts +26 -1
  32. package/dist/render/lib/content/header-bar.js +1 -1
  33. package/dist/render/lib/content/tab-strip.d.ts +5 -2
  34. package/dist/render/lib/content/tab-strip.js +1 -1
  35. package/dist/render/lib/document/blocks/commerce/DetailRows/meta.d.ts +8 -0
  36. package/dist/render/lib/document/blocks/commerce/DetailRows/meta.js +1 -1
  37. package/dist/render/lib/document/blocks/commerce/DetailRows/render.js +1 -1
  38. package/dist/render/lib/document/blocks/commerce/FitmentPicker/meta.d.ts +8 -0
  39. package/dist/render/lib/document/blocks/commerce/FitmentPicker/meta.js +1 -1
  40. package/dist/render/lib/document/blocks/commerce/FitmentPicker/render.js +1 -1
  41. package/dist/render/lib/document/blocks/service/OpeningHours/render.js +1 -1
  42. package/dist/render/lib/document/blocks/service/SignUp/meta.d.ts +8 -0
  43. package/dist/render/lib/document/blocks/service/SignUp/meta.js +1 -1
  44. package/dist/render/lib/document/blocks/service/SignUp/render.js +1 -1
  45. package/dist/render/lib/wheels/plp-filters.js +1 -1
  46. package/dist/words.d.ts +3 -0
  47. package/dist/words.js +1 -1
  48. package/package.json +4 -4
  49. package/dist/chunks/chunk-ERY7GVI7.js +0 -96
  50. package/dist/chunks/chunk-HPCPOXEL.js +0 -1
  51. package/dist/chunks/chunk-JGBM6X5G.js +0 -1
  52. package/dist/chunks/chunk-PTRZMZVD.js +0 -342
  53. /package/dist/chunks/{chunk-PTRZMZVD.js.LEGAL.txt → chunk-TAV4GVJC.js.LEGAL.txt} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- "efficient-web-builder": "72.0.0"
2
+ "efficient-web-builder": "73.0.0"
3
3
  }
@@ -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 W,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 G 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";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 Y(x){const g=[x.image,...(x.photos??[]).map(f=>f?.src)].filter(f=>!!f);return g.length?g:[""]}const O=6,_e=()=>Array.from({length:O},(x,g)=>({image:"",process:$("Tag"),eyebrow:$("Category"),name:$("Item name"),meta:$("{n} photos",{n:`0${g+1}`})}));function Ae({mode:x="both",kicker:g,breadcrumbLabel:f,vehicleTabLabel:X="Gallery A",vehicleTitle:ee,vehicleBody1:te,vehicleBody2:ae,vehicleStats:re,vehicleCards:B,wheelTabLabel:U="Gallery B",wheelTitle:le,wheelBody1:ne,wheelBody2:se,wheelStats:oe,wheelCards:H,othersTitle:ie,othersBody1:ce,othersBody2:me,othersStats:pe,othersCards:de,showBreadcrumb:xe=!0,showStats:ge=!0,showIntro:fe=!0,showTabs:ue=!0,showFilters:E=!0,showCount:M=!0,showSort:I=!0,previewTab:C,previewHover:be=!1,editing:h=!1}){const j=x==="both",v=j?["vehicles","wheels"]:x==="wheels"?["wheels"]:x==="others"?["others"]:["vehicles"],[Z,he]=N(v[0]),w=(h&&j&&C&&v.includes(C)?C:null)??(v.includes(Z)?Z:v[0]),ve=h&&be,[S,D]=N("all"),[z,we]=N("newest"),[L,b]=N(null),n=w==="vehicles"?{title:ee,body1:te,body2:ae,stats:re??[],cards:B??[],unit:"items",word:X}:w==="others"?{title:ie,body1:ce,body2:me,stats:pe??[],cards:de??[],unit:"items",word:"Others"}:{title:le,body1:ne,body2:se,stats:oe??[],cards:H??[],unit:"items",word:U},V=W(()=>{const e=[];for(const a of n.cards)a.process&&!e.includes(a.process)&&e.push(a.process);return e},[n.cards]),_=S!=="all"&&V.includes(S)?S:"all",q=_==="all"?n.cards:n.cards.filter(e=>e.process===_),J=W(()=>{const e=[...q];return z==="name"&&e.sort((a,o)=>(a.name??"").localeCompare(o.name??"")),e},[q,z]),K=n.cards.length===0,A=h&&K,P=A?_e():J,ye=A?O:n.cards.length,Ne=A?O:J.length,Q=g?`${g} · ${T(n.word)}`:void 0;function ke(e){e!==w&&(he(e),D("all"))}return r(Le,{as:"section",className:"relative z-[2] bg-bg",children:[xe&&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:Q?i(Q):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:ge&&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))})]}),fe&&(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&&ue&&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",...V].map(e=>{const a=_===e,o=e==="all"?"All":e;return t("button",{type:"button",onClick:()=>D(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=Y(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(G,{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:K?"No items in this gallery yet.":"No items match this filter."})}),L&&(()=>{const e=Y(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(G,{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(R=>R&&{...R,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(G,{label:F(a.name)||"gallery-photo",src:s||void 0,alt:"",sizes:"120px"})},`${s}-${d}`))}),t(Se,{})]})})()]})}export{Ae 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}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 +1 @@
1
- "use client";import{jsx as r,Fragment as T,jsxs as a}from"react/jsx-runtime";import re from"next/link";import{usePathname as Qe}from"next/navigation";import{useCallback as Ze,useEffect as B,useRef as et,useState as p}from"react";import{rootIsDark as tt,watchRootTheme as nt}from"efficient-shell/format";import{useCart as ot}from"./CartContext.js";import{useSearch as rt}from"./SearchContext.js";import at,{useCountrySelectShows as lt}from"./CountrySelect.js";import{resolveCountryShowAs as st}from"../lib/content/country-show-as.js";import ae from"./HeaderNavItem.js";import it from"efficient-web-builder/render/components/Logo";import{siteLengthCss as ct}from"efficient-web-builder/format/lib/content/css-length";import dt from"./MenuPlaceholderLabel.js";import{withRMark as le}from"efficient-web-builder/render/components/RMark";import{AccountButton as mt,CartButton as ut,SearchButton as ht}from"./HeaderTools.js";import ft from"./HeaderCallButton.js";import{useHeaderBar as pt}from"./useHeaderBar.js";import{useModalDismiss as gt}from"./useModalDismiss.js";import bt from"./ThemeToggle.js";import{products as xt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as yt}from"../lib/header-settings-fetch.js";import{menuDropdownAside as vt}from"../lib/menu-link.js";import{HEADER_MENU_PLACEHOLDER_COUNT as wt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as St}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as kt,resolveChromeWidth as Nt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as Pt}from"../lib/content/header-theme.js";import{headerSolidBackground as Et,isProductPage as It}from"../lib/content/header-bar.js";import{surfaceIsLight as Tt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as $t,HEADER_MENU_GAP_PX as Lt,HEADER_SET_HEIGHT_CSS as Ct}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_ATTR as _t,HEADER_INK_OVERRIDE_ATTR as Rt,resolveHeaderInkMode as At}from"efficient-web-builder/render/lib/document/header-ink";const se={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},Ht=Array.from({length:wt},()=>({href:"#",label:r(dt,{})}));function Dt({previewSettings:g,initialSettings:$,editorPreview:L,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:C,commerceEnabled:b=!0}={}){const G=Qe(),[ue,he]=p(!1);B(()=>{const e=y.current?.ownerDocument??document,n=()=>he(e.querySelector(`[${_t}="light"]`)!=null);n();const f=requestAnimationFrame(n);return()=>cancelAnimationFrame(f)},[G]);const F=It(G),[c,w]=p(!1),{open:fe,totals:pe}=ot(),{open:ge}=rt(),[_,be]=p(!1),[xe,ye]=p(null),[ve,we]=p(null),[t,Se]=p($??null),o=g??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[],dropdown_aside:e.dropdownAside??null})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),ke=de?null:o?.logoUrl??null,Ne=o?.reverseLogo??!1,Pe=o?.logoReversed??null,Ee=o?.logoInkIsDark??null,i=o?.logoPosition??"center",Ie=o?.logoSize??"medium",Te=o?.logoSizePx??null,$e=o?.logoSizeUnit??null,W=Math.min(Math.max(o?.menuSplit??3,1),4),Le=(o?.menuPosition??"left")==="center",Ce=(o?.menuPosition??"left")==="beside",K=(o?.menuRow??"top")==="inline",R=o?.menuGapPx??null,_e=R!=null?{gap:ct(R,o?.menuGapUnit,"gap",Lt)??`${R}px`}:void 0,S=K?se.inline:se.stacked,Re=o?.searchEnabled??!1,V=o?.searchPosition??"right",Ae=o?.countrySelectorEnabled??!0,He=st(o?.countrySelectorShowAs),A=o?.accountEnabled??!0,De=o?.cartEnabled??!0,H=(o?.utilStyle??"icon")==="text",l=`mono-eyebrow${(o?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,q=o?.countryUrls??{},Ue=Nt(o?.width),je=kt(Ue)??void 0,ze=o?.heightPx??$t.default,X=o?.sticky??"always",k=At(o?.topTextColor),m=Pt(o?.theme),N=Object.keys(q),Y=lt(N.length?N:void 0),x=Ae?r(at,{countries:N.length?N:void 0,urls:g?void 0:q,showAs:He}):null,{headerRef:y,scrolled:J,navHidden:Oe}=pt({stickyMode:X,heightPx:ze}),Me=m?JSON.stringify(m.style):null;B(()=>{const e=y.current?.ownerDocument??document,n=e.defaultView??window,f=oe=>oe?Tt(n.getComputedStyle(oe).getPropertyValue("--bg")):null,M=()=>{be(!tt({doc:e,whenUnset:!0})),ye(f(e.body)),we(f(y.current))};M();const Je=nt(M,{doc:e}),ne=new MutationObserver(M);return e.body&&ne.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Je(),ne.disconnect()}},[y,Me]);const v=ie??St?r(bt,{}):null;B(()=>{if(!yt({editorPreview:!!L,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return xt.getHeaderSettings().then(n=>!e&&Se(n)).catch(n=>{console.warn("[header] settings fetch failed; using built-in defaults",n)}),()=>{e=!0}},[L,g,$]);const P=J||F,Q=Et(_,F),Z=k==="auto"?ue:k==="light",Be=P||!Z,Ge=P?ve??_:(xe??_)&&!Z,Fe=k==="auto"?null:{[Rt]:k},We=Ze(()=>w(!1),[]),D=et(null);gt({active:c,onDismiss:We,focusRef:D,trapRef:D});const d=(e,n,f="start")=>r(ae,{item:e,dropdownAlign:f},n),Ke=!me&&(o?.menuItems?.length??0)>0,E=!!L||!!g,s=Ke?o.menuItems.map(e=>({href:e.url||"",label:le(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(n=>({href:n.url||"",label:le(n.label),plainLabel:n.label,description:n.description,image:n.image,badge:n.badge})),dropdownAside:vt(e.dropdown_aside)})):E?Ht.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ve=s.length>0||b&&A||!!x&&Y||!!v,qe=i==="center"?s.slice(0,W):i==="right"?s:[],Xe=i==="center"?s.slice(W):i==="left"?s:[],I=Re&&b?r(ht,{onClick:E?void 0:ge,asText:H}):null,U=b&&A?r(mt,{asText:H}):null,j=e=>b&&De?r(ut,{onClick:fe,count:pe.sets,asText:H,className:e}):null,Ye=o?.callPhone??"",ee=o?.callHref??"",z=e=>o?.callButton&&(ee||E)?r(ft,{href:E?"":ee,label:e?"Call":Ye||"Call"}):null,u=a(T,{children:[V==="left"?I:null,x,v,U,j(),V==="right"?I:null,z(!1)]}),O=(e,n=!1)=>r(re,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(it,{variant:"header",scrolled:Be,src:ke,reverse:Ne,onLightSurface:Ge,reversedSrc:Pe,inkIsDark:Ee,size:Ie,sizePx:Te,sizeUnit:$e,wordmark:ce,siteName:C,fitToContainer:n})}),h=O("inline-flex shrink-0 items-center justify-center"),te="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return a(T,{children:[r("header",{ref:y,"data-scrolled":J||void 0,...Fe,className:["sf-site-header",...m?[m.className]:[],X==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",P?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:Ct,...Oe?{transform:"translateY(-100%)"}:null,...P?{background:Q,color:"var(--fg)","--sf-header-ground":Q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:a("div",{className:"w-full",style:je,children:[Le?a("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${l} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${l} flex items-center justify-center gap-8`,children:s.map((e,n)=>d(e,`${e.href}-${n}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):i==="center"?a("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${l} flex items-center gap-8`,children:qe.map((e,n)=>d(e,`${e.href}-${n}`))}),h,a("nav",{className:`${l} flex items-center justify-end gap-8`,children:[Xe.map((e,n)=>d(e,`${e.href}-${n}`,"end")),u]})]}):Ce?a("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[a("div",{className:"flex items-center gap-8",style:_e,children:[h,r("nav",{className:`${l} flex items-center gap-8`,children:s.map((e,n)=>d(e,`${e.href}-${n}`))})]}),r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?a(T,{children:[a("nav",{className:`${l} flex items-center gap-8`,children:[s.map((e,n)=>d(e,`${e.href}-${n}`)),u]}),h]}):a(T,{children:[h,a("nav",{className:`${l} flex items-center gap-8`,children:[s.map((e,n)=>d(e,`${e.href}-${n}`)),u]})]})}),!K&&a("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[a("div",{className:"flex items-center justify-between",children:[O(te,!0),a("div",{className:`${l} flex shrink-0 items-center gap-5`,children:[I,x,v,U,j(),z(!1)]})]}),r("nav",{className:`${l} flex items-center gap-6 border-t border-line/60 pt-3`,children:s.map((e,n)=>d(e,`${e.href}-${n}`))})]}),a("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[O(te,!0),a("div",{className:"flex shrink-0 items-center gap-4",children:[I,U,j(l),z(!0),Ve&&a("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&a("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[s.map((e,n)=>r(ae,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${n}`)),a("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&A&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(re,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&Y&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),v&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{Dt as default};
1
+ "use client";import{jsx as r,Fragment as T,jsxs as a}from"react/jsx-runtime";import re from"next/link";import{usePathname as Qe}from"next/navigation";import{useCallback as Ze,useEffect as B,useRef as et,useState as p}from"react";import{rootIsDark as tt,watchRootTheme as nt}from"efficient-shell/format";import{useCart as ot}from"./CartContext.js";import{useSearch as rt}from"./SearchContext.js";import at,{useCountrySelectShows as lt}from"./CountrySelect.js";import{resolveCountryShowAs as st}from"../lib/content/country-show-as.js";import ae from"./HeaderNavItem.js";import it from"efficient-web-builder/render/components/Logo";import{siteLengthCss as ct}from"efficient-web-builder/format/lib/content/css-length";import dt from"./MenuPlaceholderLabel.js";import{withRMark as le}from"efficient-web-builder/render/components/RMark";import{AccountButton as mt,CartButton as ut,SearchButton as ht}from"./HeaderTools.js";import ft from"./HeaderCallButton.js";import{useHeaderBar as pt}from"./useHeaderBar.js";import{useModalDismiss as gt}from"./useModalDismiss.js";import bt from"./ThemeToggle.js";import{products as xt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as vt}from"../lib/header-settings-fetch.js";import{menuDropdownAside as yt}from"../lib/menu-link.js";import{HEADER_MENU_PLACEHOLDER_COUNT as wt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as St}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as Nt,resolveChromeWidth as kt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as Pt}from"../lib/content/header-theme.js";import{headerSolidBackground as Et,isProductPage as It,resolveMenuRow as Tt,resolveNavTextCase as $t,resolveUtilStyle as Ct}from"../lib/content/header-bar.js";import{surfaceIsLight as Lt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as _t,HEADER_MENU_GAP_PX as Rt,HEADER_SET_HEIGHT_CSS as At}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_ATTR as Ht,HEADER_INK_OVERRIDE_ATTR as Dt,resolveHeaderInkMode as Ut}from"efficient-web-builder/render/lib/document/header-ink";const se={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},jt=Array.from({length:wt},()=>({href:"#",label:r(dt,{})}));function zt({previewSettings:g,initialSettings:$,editorPreview:C,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:L,commerceEnabled:b=!0}={}){const G=Qe(),[ue,he]=p(!1);B(()=>{const e=v.current?.ownerDocument??document,n=()=>he(e.querySelector(`[${Ht}="light"]`)!=null);n();const f=requestAnimationFrame(n);return()=>cancelAnimationFrame(f)},[G]);const F=It(G),[c,w]=p(!1),{open:fe,totals:pe}=ot(),{open:ge}=rt(),[_,be]=p(!1),[xe,ve]=p(null),[ye,we]=p(null),[t,Se]=p($??null),o=g??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[],dropdown_aside:e.dropdownAside??null})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),Ne=de?null:o?.logoUrl??null,ke=o?.reverseLogo??!1,Pe=o?.logoReversed??null,Ee=o?.logoInkIsDark??null,i=o?.logoPosition??"center",Ie=o?.logoSize??"medium",Te=o?.logoSizePx??null,$e=o?.logoSizeUnit??null,W=Math.min(Math.max(o?.menuSplit??3,1),4),Ce=(o?.menuPosition??"left")==="center",Le=(o?.menuPosition??"left")==="beside",K=Tt(o?.menuRow)==="inline",R=o?.menuGapPx??null,_e=R!=null?{gap:ct(R,o?.menuGapUnit,"gap",Rt)??`${R}px`}:void 0,S=K?se.inline:se.stacked,Re=o?.searchEnabled??!1,V=o?.searchPosition??"right",Ae=o?.countrySelectorEnabled??!0,He=st(o?.countrySelectorShowAs),A=o?.accountEnabled??!0,De=o?.cartEnabled??!0,H=Ct(o?.utilStyle)==="text",l=`mono-eyebrow${$t(o?.navTextCase)==="capitalised"?" mono-eyebrow-plain":""}`,q=o?.countryUrls??{},Ue=kt(o?.width),je=Nt(Ue)??void 0,ze=o?.heightPx??_t.default,X=o?.sticky??"always",N=Ut(o?.topTextColor),m=Pt(o?.theme),k=Object.keys(q),Y=lt(k.length?k:void 0),x=Ae?r(at,{countries:k.length?k:void 0,urls:g?void 0:q,showAs:He}):null,{headerRef:v,scrolled:J,navHidden:Me}=pt({stickyMode:X,heightPx:ze}),Oe=m?JSON.stringify(m.style):null;B(()=>{const e=v.current?.ownerDocument??document,n=e.defaultView??window,f=oe=>oe?Lt(n.getComputedStyle(oe).getPropertyValue("--bg")):null,O=()=>{be(!tt({doc:e,whenUnset:!0})),ve(f(e.body)),we(f(v.current))};O();const Je=nt(O,{doc:e}),ne=new MutationObserver(O);return e.body&&ne.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Je(),ne.disconnect()}},[v,Oe]);const y=ie??St?r(bt,{}):null;B(()=>{if(!vt({editorPreview:!!C,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return xt.getHeaderSettings().then(n=>!e&&Se(n)).catch(n=>{console.warn("[header] settings fetch failed; using built-in defaults",n)}),()=>{e=!0}},[C,g,$]);const P=J||F,Q=Et(_,F),Z=N==="auto"?ue:N==="light",Be=P||!Z,Ge=P?ye??_:(xe??_)&&!Z,Fe=N==="auto"?null:{[Dt]:N},We=Ze(()=>w(!1),[]),D=et(null);gt({active:c,onDismiss:We,focusRef:D,trapRef:D});const d=(e,n,f="start")=>r(ae,{item:e,dropdownAlign:f},n),Ke=!me&&(o?.menuItems?.length??0)>0,E=!!C||!!g,s=Ke?o.menuItems.map(e=>({href:e.url||"",label:le(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(n=>({href:n.url||"",label:le(n.label),plainLabel:n.label,description:n.description,image:n.image,badge:n.badge})),dropdownAside:yt(e.dropdown_aside)})):E?jt.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ve=s.length>0||b&&A||!!x&&Y||!!y,qe=i==="center"?s.slice(0,W):i==="right"?s:[],Xe=i==="center"?s.slice(W):i==="left"?s:[],I=Re&&b?r(ht,{onClick:E?void 0:ge,asText:H}):null,U=b&&A?r(mt,{asText:H}):null,j=e=>b&&De?r(ut,{onClick:fe,count:pe.sets,asText:H,className:e}):null,Ye=o?.callPhone??"",ee=o?.callHref??"",z=e=>o?.callButton&&(ee||E)?r(ft,{href:E?"":ee,label:e?"Call":Ye||"Call"}):null,u=a(T,{children:[V==="left"?I:null,x,y,U,j(),V==="right"?I:null,z(!1)]}),M=(e,n=!1)=>r(re,{href:"/","aria-label":L?`${L} home`:"Home",className:e,children:r(it,{variant:"header",scrolled:Be,src:Ne,reverse:ke,onLightSurface:Ge,reversedSrc:Pe,inkIsDark:Ee,size:Ie,sizePx:Te,sizeUnit:$e,wordmark:ce,siteName:L,fitToContainer:n})}),h=M("inline-flex shrink-0 items-center justify-center"),te="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return a(T,{children:[r("header",{ref:v,"data-scrolled":J||void 0,...Fe,className:["sf-site-header",...m?[m.className]:[],X==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",P?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:At,...Me?{transform:"translateY(-100%)"}:null,...P?{background:Q,color:"var(--fg)","--sf-header-ground":Q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:a("div",{className:"w-full",style:je,children:[Ce?a("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${l} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${l} flex items-center justify-center gap-8`,children:s.map((e,n)=>d(e,`${e.href}-${n}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):i==="center"?a("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${l} flex items-center gap-8`,children:qe.map((e,n)=>d(e,`${e.href}-${n}`))}),h,a("nav",{className:`${l} flex items-center justify-end gap-8`,children:[Xe.map((e,n)=>d(e,`${e.href}-${n}`,"end")),u]})]}):Le?a("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[a("div",{className:"flex items-center gap-8",style:_e,children:[h,r("nav",{className:`${l} flex items-center gap-8`,children:s.map((e,n)=>d(e,`${e.href}-${n}`))})]}),r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?a(T,{children:[a("nav",{className:`${l} flex items-center gap-8`,children:[s.map((e,n)=>d(e,`${e.href}-${n}`)),u]}),h]}):a(T,{children:[h,a("nav",{className:`${l} flex items-center gap-8`,children:[s.map((e,n)=>d(e,`${e.href}-${n}`)),u]})]})}),!K&&a("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[a("div",{className:"flex items-center justify-between",children:[M(te,!0),a("div",{className:`${l} flex shrink-0 items-center gap-5`,children:[I,x,y,U,j(),z(!1)]})]}),r("nav",{className:`${l} flex items-center gap-6 border-t border-line/60 pt-3`,children:s.map((e,n)=>d(e,`${e.href}-${n}`))})]}),a("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[M(te,!0),a("div",{className:"flex shrink-0 items-center gap-4",children:[I,U,j(l),z(!0),Ve&&a("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&a("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[s.map((e,n)=>r(ae,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${n}`)),a("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&A&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(re,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&Y&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),y&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),y]})]})]})]})}export{zt as default};
@@ -1,5 +1,6 @@
1
1
  import type { CountryShowAs } from "../lib/content/country-show-as.js";
2
- export type ToolStyle = "icon" | "text";
2
+ import type { HeaderUtilStyle } from "../lib/content/header-bar.js";
3
+ export type ToolStyle = HeaderUtilStyle;
3
4
  export type SearchStyle = ToolStyle | "icon_text";
4
5
  export declare function SearchTool({ style, stylePhone, editing }: {
5
6
  style?: SearchStyle;
@@ -1,7 +1,8 @@
1
1
  import { type FormEvent } from "react";
2
2
  import { type SignUpDraft, type SignUpField, type SignUpSent, type SignUpTrouble, type SlugCheck } from "../lib/sections/sign-up.js";
3
+ import type { SIGN_UP_MODES } from "../lib/document/blocks/service/SignUp/meta.js";
3
4
  export interface SignUpProps {
4
- mode?: "create" | "find";
5
+ mode?: (typeof SIGN_UP_MODES)[number]["value"];
5
6
  product: string;
6
7
  productName: string;
7
8
  freeLine: string;
@@ -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 q}from"../../lib/api/index.js";import ce,{WORDMARK_FIT_FLOOR_PX as se}from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as I,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";function he(t){return e(de,{...t,children:e(ke,{})})}function ye({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 be({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 ke(){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:O,cardConfirming:$,checkoutResult:A,confirmCardPayment:U,cardStillProcessing:W,renewCardPayment:H,holdRenewed:G,leaveCardPayment:Z,checkoutRootRef:Q,setCheckoutHeaderEl:V}=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(ye,{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(be,{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."})]}):O?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(Ne,{payment:h,checkout:l,holdRenewed:G,onPaid:U,onProcessing:W,onRenew:H,onBack:Z}):k&&l?e(Ce,{confirmation:l,clientId:t.paypalClientId??"",idemKey:f,onPaid:()=>{S(!0),u(l)},onSkip:()=>u(l)}):N&&l?e(je,{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:Q,className:"bg-bg text-fg",children:[r("header",{ref:V,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 Ne({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(Pe,{payment:t,checkout:n,onPaid:m,onProcessing:y,onRenew:p,onBack:s})},t.clientSecret)]})]})})}const we=5;function Pe({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<we;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?I:"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(I),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(I);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 T=null;function ve(t,n){const o=`${t}|${n}`;if(T?.key===o)return T.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 T={key:o,promise:m},m}function Ce({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 ve(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 q.createPaypalOrder({idempotencyKey:o})).paypalOrderId,onApprove:async l=>{try{if((await q.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 K=null;function Se(t){const n=t==="sandbox"?"sandbox":"production";if(K?.key===n)return K.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 K={key:n,promise:o},o}function je({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 Se(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 q.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{be as PayFirstResultView,he 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}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,4 +1,5 @@
1
- export type FitmentPickerLayout = "tall" | "short";
1
+ import type { FITMENT_PICKER_LAYOUTS } from "../../lib/document/blocks/commerce/FitmentPicker/meta.js";
2
+ export type FitmentPickerLayout = (typeof FITMENT_PICKER_LAYOUTS)[number]["value"];
2
3
  export interface FitmentPickerPartProps {
3
4
  layout?: FitmentPickerLayout;
4
5
  pickerColumns?: unknown;
@@ -1,9 +1,10 @@
1
1
  import { type DetailRow } from "../DetailRows.js";
2
2
  import { type CurrentRecord } from "../../lib/document/current-record.js";
3
3
  import type { ProductKind } from "../../lib/api/index.js";
4
+ import type { DETAIL_ROWS_FROM } from "../../lib/document/blocks/commerce/DetailRows/meta.js";
4
5
  export declare const supportedKinds: readonly ProductKind[];
5
6
  interface Props {
6
- rowsFrom?: "story" | "details";
7
+ rowsFrom?: (typeof DETAIL_ROWS_FROM)[number]["value"];
7
8
  startLeft?: boolean;
8
9
  pads?: Record<string, unknown>;
9
10
  editing?: boolean;
@@ -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{backendHopHeaders as yt,clientIpFromForwardedFor as ht,FORWARDED_FOR_HEADER as ft,hopCachingOf as gt}from"../forwarded-for.js";import mt from"efficient-web-builder/format/lib/document/media-manifest.json";import{auth as O}from"../auth.js";import{efficientClientOpen as wt}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 St=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.",Pt=new Set([502,503,504]),k=0,Ot="This editor runs on its host's own backend, which does not serve this request.",bt=5e3,Tt=15e3,At=()=>typeof window>"u"?bt:Tt;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(At())}const B=t=>t instanceof Error&&t.name==="TimeoutError",q=(t,e)=>Pt.has(t)?v:e,Rt=["admin","venue"];let G="admin";function _e(t){G=Rt.includes(t)?t:"admin"}function Et(){return G}const _t=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let W=null;function Ue(t){W=t&&_t.test(t)?t:null}function Ut(){return W}function $t(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"&&!wt())throw new w(k,Ot,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??St}${$t(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=Ct().finally(()=>{A=null}),A)}async function Ct(){const t=O.takeLegacyRefresh(),e=await vt.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 Nt=100,K=20;function It(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(Nt)),l!=="1"&&a.set("page",l);const r=await g(`${n}?${a.toString()}`);u.push(...m(r)),l=It(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 vt={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 kt,absolutizeApiUrl as L}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Lt,isSvgUrl as Jt}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as xt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Dt,webRuntimeSiteSlug as Y}from"efficient-web-builder/format/lib/web-runtime";import{readDealerList as Ht}from"../sections/dealer-finder.js";import{SIGN_UP_PATH as Ft,SIGN_UP_VERIFY_PATH as Mt,SIGN_UP_WAITING_PATH as Bt,WORKSPACE_FINDS_PATH as qt,WORKSPACE_FIND_OPEN_PATH as Gt,signInUrlOf as Wt,readLinkAnswer as Q,readSignUpAvailability as jt,readSignUpSent as zt,signUpAvailabilityPath as Kt}from"../sections/sign-up.js";function S(t){if(typeof t=="string")return t.startsWith("/media/")?kt(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 Ve}from"./origins.js";const tt=typeof window>"u"&&H!=="",Vt=tt?H:pt,Xt=Dt,b=()=>({baseUrl:Xt(),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 Zt(t,e){return J("/wheels",{process:t},e)}const rt=et;function Yt(t,e){return J("/wheels",{slug:t.join(",")},e)}function Qt(t,e,n){return J("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},n)}function te(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=te(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 ee()).host}async function ee(){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 ae(){try{const{headers:t}=await import("next/headers");return ht((await t()).get(ft))}catch{return null}}async function re(){try{const{headers:t}=await import("next/headers");return(await t()).get(lt)||null}catch{return null}}async function ne(){const t=await re();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 ne())}function $(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const se="preview";async function oe(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(dt)}catch{return null}}async function ie(){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 oe();if(n===null)return[await f(t),await d(e)];const s=$(await f(t),`${se}=${encodeURIComponent(n)}`),{next:u,cache:l,...y}=e??{},a=await d({...y,cache:"no-store"}),r=await ie();return r&&(a.headers={...a.headers,"user-agent":r}),[s,a]}async function ce(t){if(!tt)return;const[e,n]=await Promise.all([ot(),ae()]),s=yt(e,n,t);return Object.keys(s).length>0?s:void 0}async function d(t){const e=await ce(gt(t)),n={baseUrl:Vt,...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 Le={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())}},Je={listWheels:async(t,e={})=>{const n=await x("products.listWheels",async s=>await f(Zt(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(Yt(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(Qt(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&&Jt(n)){const l=await Lt(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())},xe={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 de 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)}/`,ue=t=>`${N(t)}currencies/`,le="/api/storefront/media/ingest/";class pe 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 ye(){const t=xt();if(!t)throw new pe;return`${le}?${new URLSearchParams({site:t})}`}const he="X-Puck-Media-Manifest",it=mt.contentHash,I={"X-Media-Manifest":it,[he]:it},De=ct({});function ct(t){return(e,n={})=>{const s=Ut(),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??Et()})}}function fe(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 de(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(ue(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(ye(),{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 He=fe({siteDrafts:!0});function ge(t){const e=t.trim();return e?`/api/v1/dealers?${new URLSearchParams({near:e}).toString()}`:"/api/v1/dealers"}async function Fe(t){return Ht(await i(ge(t)))}const T={audience:null,baseUrl:""};async function Me(t,e){return jt(await i(Kt(t,e),T))}async function Be(t){return zt(await i(Ft,{...T,method:"POST",body:JSON.stringify(t)}))}async function qe(t){try{const e=await i(Mt,{...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 Ge(t,e){await i(Bt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function We(t,e){await i(qt,{...T,method:"POST",body:JSON.stringify({email:e.trim(),...t?{product:t}:{}})})}async function je(t){try{return Wt(await i(Gt,{...T,method:"POST",body:JSON.stringify({token:t})}))}catch(e){if(e instanceof w&&me.has(e.status))return"";throw e}}const me=new Set([400,404,410]);export{St as API_URL,de as AmbiguousPageSlugError,w as ApiError,Tt as BROWSER_READ_TIMEOUT_MS,Ot as EFFICIENT_CLIENT_CLOSED_MESSAGE,pe as MediaUploadDestinationError,se as PREVIEW_PARAM,Ve as PRODUCT_API_BASE,bt as SERVER_READ_TIMEOUT_MS,v as SERVER_UNREACHABLE_MESSAGE,k as STATUS_NETWORK_ERROR,De as adminFetch,vt as api,i as apiFetch,$ as appendSiteQuery,We as askForWorkspaces,Be as askToSignUp,xe as bookings,fe as createStorefrontAdmin,ge as dealersPath,M as defaultRequestDeadline,ye as editorMediaUploadPath,Et as editorPortalAudience,Ut as editorRequestLanguage,Fe as fetchDealers,Me as fetchSignUpAvailability,Le as fitment,Ge as joinSignUpWaitingList,qe as openSignUpLink,je as openWorkspaceFind,Je as products,At as readDeadlineMs,ae as resolveClientIp,S as resolveMediaUrls,oe as resolvePreviewToken,ot as resolveSiteHost,ee as resolveSiteHostSource,re as resolveSiteSlug,Ue as setEditorLanguage,_e as setEditorPortalAudience,He 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-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,4 +1,6 @@
1
- export type EnglishVariant = "international" | "us";
1
+ declare const ENGLISH_VARIANTS: readonly ["international", "us"];
2
+ export type EnglishVariant = (typeof ENGLISH_VARIANTS)[number];
2
3
  export declare const US_SPELLING: Readonly<Record<string, string>>;
3
4
  export declare function normalizeEnglishVariant(value: unknown): EnglishVariant;
4
5
  export declare function inEnglish(text: string, variant: EnglishVariant): string;
6
+ export {};
@@ -1 +1 @@
1
- const 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"},i=new RegExp(`\\b(${Object.keys(t).sort((e,r)=>r.length-e.length).join("|")})\\b`,"gi");function s(e){return e==="us"?"us":"international"}function o(e,r){return e===e.toUpperCase()?r.toUpperCase():e[0]===e[0].toUpperCase()?r[0].toUpperCase()+r.slice(1):r}function u(e,r){return r!=="us"?e:e.replace(i,n=>o(n,t[n.toLowerCase()]))}export{t as US_SPELLING,u as inEnglish,s as normalizeEnglishVariant};
1
+ import{parseOption as i}from"efficient-web-builder/format/lib/parse-option";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};
@@ -2,7 +2,32 @@ export declare function resolveHeaderHeightPx(v: unknown): number;
2
2
  export declare const UNDER_HEADER_SHEET_CLASS = "fixed inset-x-0 bottom-0 top-[var(--sf-header-h,88px)]";
3
3
  export declare const isProductPage: (pathname: string | null | undefined) => boolean;
4
4
  export declare const headerSolidBackground: (isLight: boolean, productPage: boolean) => string;
5
- export type HeaderNavTextCase = "uppercase" | "capitalised";
5
+ export declare const HEADER_NAV_TEXT_CASES: readonly [{
6
+ readonly label: "Uppercase";
7
+ readonly value: "uppercase";
8
+ }, {
9
+ readonly label: "Capitalised";
10
+ readonly value: "capitalised";
11
+ }];
12
+ export type HeaderNavTextCase = (typeof HEADER_NAV_TEXT_CASES)[number]["value"];
13
+ export declare const HEADER_NAV_TEXT_CASE_FALLBACK = "uppercase";
6
14
  export declare const resolveNavTextCase: (v: unknown) => HeaderNavTextCase;
15
+ export declare const HEADER_UTIL_STYLES: readonly [{
16
+ readonly label: "Icon";
17
+ readonly value: "icon";
18
+ }, {
19
+ readonly label: "Text";
20
+ readonly value: "text";
21
+ }];
22
+ export type HeaderUtilStyle = (typeof HEADER_UTIL_STYLES)[number]["value"];
23
+ export declare const resolveUtilStyle: (v: unknown) => HeaderUtilStyle;
7
24
  export type HeaderMenuRow = "top" | "inline";
25
+ export declare const HEADER_MENU_ROWS: readonly [{
26
+ readonly label: "Own row";
27
+ readonly value: "top";
28
+ }, {
29
+ readonly label: "Same row";
30
+ readonly value: "inline";
31
+ }];
32
+ export declare const HEADER_MENU_ROW_FALLBACK = "top";
8
33
  export declare const resolveMenuRow: (v: unknown) => HeaderMenuRow | null;
@@ -1 +1 @@
1
- import{HEADER_HEIGHT_PX as t}from"efficient-web-builder/render/lib/document/header-clearance";function s(e){return typeof e=="number"&&Number.isInteger(e)&&e>=t.min&&e<=t.max?e:t.default}const i="fixed inset-x-0 bottom-0 top-[var(--sf-header-h,88px)]",n=e=>!!e&&e.startsWith("/wheels/")&&e!=="/wheels",a=(e,o)=>!e&&o?"var(--section-bg)":"var(--bg)",p=e=>e==="capitalised"?"capitalised":"uppercase",l=e=>e==="inline"?"inline":e==="top"||e==="bottom"?"top":null;export{i as UNDER_HEADER_SHEET_CLASS,a as headerSolidBackground,n as isProductPage,s as resolveHeaderHeightPx,l as resolveMenuRow,p as resolveNavTextCase};
1
+ import{HEADER_HEIGHT_PX as o}from"efficient-web-builder/render/lib/document/header-clearance";import{parseOption as t}from"efficient-web-builder/format/lib/parse-option";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};
@@ -14,7 +14,10 @@ export declare const TAB_PILLS: {
14
14
  readonly list: "flex flex-wrap gap-2 px-1 pb-1 max-view-wide:min-w-max max-view-wide:flex-nowrap";
15
15
  readonly tab: (current: boolean) => string;
16
16
  };
17
- export declare function menuLayoutOf(direction: unknown): "row" | "column";
18
- export declare function marksCurrentLink(layout: "row" | "column" | undefined, currentPage: unknown): boolean;
17
+ declare const MENU_LAYOUTS: readonly ["row", "column"];
18
+ type MenuLayout = (typeof MENU_LAYOUTS)[number];
19
+ export declare function menuLayoutOf(direction: unknown): MenuLayout;
20
+ export declare function marksCurrentLink(layout: MenuLayout | undefined, currentPage: unknown): boolean;
19
21
  export declare function currentLinkIndex(hrefs: readonly string[], pagePath: string | null | undefined, pageQuery: string): number;
20
22
  export declare function showCurrentTab(strip: HTMLElement | null, behavior: ScrollBehavior): void;
23
+ export {};
@@ -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 b}from"../links/link-rules.js";import{plpFilterQuery as m}from"../wheels/plp-filters.js";const d="[scrollbar-width:none] [&::-webkit-scrollbar]:hidden",w="text-[length:var(--size-label,13px)]",g={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"},y={list:`m-0 flex list-none items-stretch gap-0 overflow-auto p-0 ${d}`,item:(e,t)=>[`relative isolate flex whitespace-nowrap border-r border-line px-[26px] py-[18px] font-mono ${w} 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:g.tab},E={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"}`};function C(e){return e==="row"?"row":"column"}function R(e,t){return e==="row"&&t===!0}function f(e){return[...new URLSearchParams(m(e))].map(([t,r])=>`${t}=${r}`)}function S(e,t,r){if(!t)return-1;const n=s(t),o=new Set(f(r));let i=-1,c=-1;return e.forEach((l,p)=>{if(u(l)!=="page"||s(l)!==n)return;const a=f(b(l).query);a.every(x=>o.has(x))&&a.length>c&&(i=p,c=a.length)}),i}function _(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{g as CURRENT_LINE,y as TAB_CELLS,E as TAB_PILLS,S as currentLinkIndex,R as marksCurrentLink,C as menuLayoutOf,_ as showCurrentTab};
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-web-builder/format/lib/parse-option";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};