efficient-storefront-blocks 0.117.0 → 0.117.2

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 (31) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/dist/chunks/{EditorPreviewCheckout-JKTRIRSH.js → EditorPreviewCheckout-75F6QF5U.js} +4 -4
  3. package/dist/editor/lib/document/blocks/commerce/FitmentTable/fields.js +1 -1
  4. package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
  5. package/dist/editor/lib/document/config.d.ts +1 -0
  6. package/dist/editor/lib/document/config.js +1 -1
  7. package/dist/editor/lib/storefront-editor-words.d.ts +2 -0
  8. package/dist/editor/lib/storefront-editor-words.js +1 -1
  9. package/dist/index.js +30 -30
  10. package/dist/render/components/FitmentTable.d.ts +5 -1
  11. package/dist/render/components/FitmentTable.js +1 -1
  12. package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
  13. package/dist/render/components/checkout/checkout-state.d.ts +5 -1
  14. package/dist/render/components/checkout/checkout-state.js +1 -1
  15. package/dist/render/components/pdp-dynamic/DynamicFitmentTable.d.ts +4 -0
  16. package/dist/render/components/pdp-dynamic/DynamicFitmentTable.js +1 -1
  17. package/dist/render/lib/checkout/wallet-return.d.ts +1 -1
  18. package/dist/render/lib/checkout/wallet-return.js +1 -1
  19. package/dist/render/lib/content/fitment-row-seed.d.ts +15 -0
  20. package/dist/render/lib/content/fitment-row-seed.js +1 -0
  21. package/dist/render/lib/document/blocks/commerce/FitmentTable/meta.d.ts +10 -0
  22. package/dist/render/lib/document/blocks/commerce/FitmentTable/meta.js +1 -1
  23. package/dist/render/lib/document/blocks/commerce/FitmentTable/render.js +1 -1
  24. package/dist/render/lib/document/card-templates.js +1 -1
  25. package/dist/render/lib/document/render-config.d.ts +1 -0
  26. package/dist/render/lib/document/render-config.js +1 -1
  27. package/dist/render/lib/document/section-to-box-rows-fitment.d.ts +1 -0
  28. package/dist/render/lib/document/section-to-box-rows-fitment.js +1 -0
  29. package/dist/words.d.ts +2 -0
  30. package/dist/words.js +1 -1
  31. package/package.json +2 -1
@@ -1,3 +1,4 @@
1
+ import type { SlotComponent } from "efficient-easel/blocks";
1
2
  import type { FitmentRow } from "../lib/wheels/fitments.js";
2
3
  import { type FieldUsageAnswer } from "../lib/content/field-usage.js";
3
4
  export interface FitmentTableProps {
@@ -13,5 +14,8 @@ export interface FitmentTableProps {
13
14
  editing?: boolean;
14
15
  omitHead?: boolean;
15
16
  fieldUsage?: readonly FieldUsageAnswer[];
17
+ template?: SlotComponent;
18
+ headTemplate?: SlotComponent;
19
+ nodeId?: string;
16
20
  }
17
- export default function FitmentTable({ num, title, description, rows, showFilter, tooltipDefaultOn, footnote, footnoteLinkText, footnoteLinkHref, editing, omitHead, fieldUsage, }: FitmentTableProps): import("react").JSX.Element | null;
21
+ export default function FitmentTable({ num, title, description, rows, showFilter, tooltipDefaultOn, footnote, footnoteLinkText, footnoteLinkHref, editing, omitHead, fieldUsage, template, headTemplate, nodeId, }: FitmentTableProps): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as l,Fragment as q}from"react/jsx-runtime";import C from"./SectionBand.js";import{useEffect as J,useState as E}from"react";import _ from"efficient-web-builder/render/components/SectionHeader";import M from"./SectionFootnote.js";import{renderGold as u,renderHeadline as A}from"efficient-web-builder/render/components/goldPhrases";import Q from"./fitment/FitmentRowFit.js";import{useVehicleFit as Y}from"./fitment/useVehicleFit.js";import{fitmentRowAnswer as ee}from"../lib/wheels/fitment-row-fit.js";import{fitmentColumns as te,loadUnitFor as ne}from"../lib/wheels/fitment-columns.js";import{useActiveCountry as le}from"./CurrencyContext.js";import{NO_FIELD_ANSWERS as re}from"../lib/content/field-usage.js";import{say as T}from"efficient-web-builder/format/lib/editor-words";import{useEnglish as oe}from"./EnglishVariant.js";const o={body:"text-[length:var(--size-body,12px)]",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)]"},ae="whitespace-nowrap border-b border-line px-4 py-4",L=`relative cursor-pointer border-2 px-4 py-2 font-mono ${o.labelSmall} font-semibold uppercase tracking-[0.18em] text-fg transition-colors`,X="border-b border-line py-[120px] max-view-desktop:py-20",j="border-b border-line pt-0 pb-[120px] max-view-desktop:pt-0 max-view-desktop:pb-20",I={background:"color-mix(in oklab, var(--accent) 14%, transparent)"},R=(a,i,s)=>i.map(f=>f.cell(a,s)).join("|");function ie({num:a,title:i,description:s,rows:f,showFilter:B=!0,tooltipDefaultOn:b=!0,footnote:H,footnoteLinkText:O,footnoteLinkHref:W,editing:y=!1,omitHead:p=!1,fieldUsage:G=re}){const N=f??[],c=te(G),K=oe(),h=ne(le()),[x,k]=E(null),[r,S]=E(b);J(()=>S(b),[b]);const P=Y({editing:y}),$=c.length===0;if(N.length===0||$)return y?l(C,{className:p?j:X,children:[p?null:t(_,{num:a!=null?u(a):void 0,title:i!=null?A(i,!1):void 0,description:s!=null?u(s):void 0,accent:!0}),t("p",{className:`border-t border-line py-6 font-mono ${o.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:$?T("Every fitment column is hidden in Product Types — show one to draw this table."):T("No fitment data for this wheel — pick a wheel with fitment specs.")})]}):null;const F=new Set,g=N.filter(e=>{const n=R(e,c,h);return F.has(n)?!1:(F.add(n),!0)}),w=Array.from(new Set(g.map(e=>e.diameter))).sort((e,n)=>e-n),d=x!==null&&w.includes(x)?x:null,v=d===null?g:g.filter(e=>e.diameter===d),V=B&&w.length>1,D=e=>{if(e===0)return!1;const n=v[e-1],m=v[e];return n.diameter!==m.diameter||n.width!==m.width};return l(C,{className:p?j:X,children:[p?null:t(_,{num:a!=null?u(a):void 0,title:i!=null?A(i,!1):void 0,description:s!=null?u(s):void 0,accent:!0}),l("div",{className:"mb-6 flex flex-wrap items-center gap-x-2 gap-y-3",children:[V&&l(q,{children:[t("span",{className:`mr-2 font-mono ${o.labelSmall} uppercase tracking-[0.24em] text-fg-dim max-view-tablet:mr-0 max-view-tablet:mb-1 max-view-tablet:w-full`,children:"Filter by size:"}),l("button",{type:"button",onClick:()=>k(null),className:`${L} ${d===null?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:d===null?I:void 0,children:[d===null&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),"All"]}),w.map(e=>{const n=e===d;return l("button",{type:"button",onClick:()=>k(n?null:e),className:`${L} ${n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:n?I:void 0,children:[n&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e,'"']},e)})]}),l("button",{type:"button",onClick:()=>S(e=>!e),"aria-pressed":r,"aria-label":r?"Hide vehicle tooltip":"Show vehicle tooltip",className:`ml-auto inline-flex items-center gap-3 font-mono ${o.labelSmall} uppercase tracking-[0.24em] text-fg-dim transition-colors hover:text-fg max-view-tablet:hidden`,children:[t("span",{children:"Vehicle tooltip"}),t("span",{className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 transition-colors ${r?"border-accent":"border-fg-dim/50"}`,style:r?{background:"color-mix(in oklab, var(--accent) 30%, transparent)"}:void 0,"aria-hidden":!0,children:t("span",{className:`block h-3 w-3 rounded-full transition-transform ${r?"translate-x-[18px] bg-accent":"translate-x-[2px] bg-fg-dim"}`})}),t("span",{className:r?"text-accent":"text-fg-dim",children:r?"On":"Off"})]})]}),t("div",{className:"-mx-1 overflow-x-auto",children:l("table",{className:`w-full border-collapse font-mono ${o.labelXl} tracking-[0.06em] text-fg`,children:[t("thead",{children:t("tr",{children:c.map(({header:e},n)=>t("th",{className:`whitespace-nowrap border-b border-line bg-surface px-4 py-4 text-left ${o.body} font-normal uppercase tracking-[0.22em] text-fg-dim`,children:K(e)},n))})}),t("tbody",{children:v.map((e,n)=>t("tr",{className:`group transition-colors hover:[&>td]:bg-surface ${D(n)?"[&>td]:border-t [&>td]:border-line":""}`,children:c.map((m,U)=>{const z=U===c.length-1,Z=m.fieldKey==="diameter";return l("td",{className:`${z?"relative ":""}${ae}${Z?" text-accent":""}`,children:[m.cell(e,h),z&&r&&t("span",{role:"tooltip",className:`pointer-events-none absolute top-1/2 right-0 z-20 hidden w-[520px] -translate-y-1/2 whitespace-normal bg-[var(--tooltip-bg)] px-3 py-2 text-right font-mono ${o.labelXs} normal-case tracking-[0.12em] text-fg shadow-lg group-hover:block max-view-tablet:!hidden`,children:t(Q,{answer:ee(e,P)})})]},m.fieldKey)})},R(e,c,h)))})]})}),t(M,{text:H,linkText:O,linkHref:W})]})}export{ie as default};
1
+ "use client";import{jsx as t,jsxs as l,Fragment as re}from"react/jsx-runtime";import L from"./SectionBand.js";import{useEffect as oe,useState as R}from"react";import{CardTemplateRows as B}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ae}from"efficient-web-builder/format/lib/content/page-width";import{SPEC_TABLE_BAND as I}from"../lib/sections/spec-table-band.js";import{FITMENT_HEAD_TEMPLATE_SLOT as ie,fitmentCardRow as se,fitmentHeadRow as ce}from"../lib/content/fitment-row-seed.js";import O from"efficient-web-builder/render/components/SectionHeader";import de from"./SectionFootnote.js";import{renderGold as b,renderHeadline as X}from"efficient-web-builder/render/components/goldPhrases";import me from"./fitment/FitmentRowFit.js";import{useVehicleFit as pe}from"./fitment/useVehicleFit.js";import{fitmentRowAnswer as ue}from"../lib/wheels/fitment-row-fit.js";import{fitmentColumns as fe,loadUnitFor as be}from"../lib/wheels/fitment-columns.js";import{useActiveCountry as he}from"./CurrencyContext.js";import{NO_FIELD_ANSWERS as xe}from"../lib/content/field-usage.js";import{say as H}from"efficient-web-builder/format/lib/editor-words";import{useEnglish as ge}from"./EnglishVariant.js";const a={body:"text-[length:var(--size-body,12px)]",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)]"},we="whitespace-nowrap border-b border-line px-4 py-4",j=`relative cursor-pointer border-2 px-4 py-2 font-mono ${a.labelSmall} font-semibold uppercase tracking-[0.18em] text-fg transition-colors`,P=I.inline,D=I.ownBox,h={scroll:"-mx-1 overflow-x-auto",table:`min-w-[600px] ${ae}`,head:"border-b border-line bg-surface",row:"group relative border-b border-line transition-colors hover:bg-surface"},G={background:"color-mix(in oklab, var(--accent) 14%, transparent)"},y=(i,s,c)=>s.map(x=>x.cell(i,c)).join("|");function ve({num:i,title:s,description:c,rows:x,showFilter:W=!0,tooltipDefaultOn:g=!0,footnote:K,footnoteLinkText:M,footnoteLinkHref:U,editing:S=!1,omitHead:f=!1,fieldUsage:V=xe,template:Z,headTemplate:q,nodeId:T}){const k=x??[],r=fe(V),_=ge(),u=be(he()),[w,E]=R(null),[o,$]=R(g);oe(()=>$(g),[g]);const J=pe({editing:S}),C=r.length===0;if(k.length===0||C)return S?l(L,{className:f?D:P,children:[f?null:t(O,{num:i!=null?b(i):void 0,title:s!=null?X(s,!1):void 0,description:c!=null?b(c):void 0,accent:!0}),t("p",{className:`border-t border-line py-6 font-mono ${a.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:C?H("Every fitment column is hidden in Product Types — show one to draw this table."):H("No fitment data for this wheel — pick a wheel with fitment specs.")})]}):null;const A=new Set,v=k.filter(e=>{const n=y(e,r,u);return A.has(n)?!1:(A.add(n),!0)}),N=Array.from(new Set(v.map(e=>e.diameter))).sort((e,n)=>e-n),d=w!==null&&N.includes(w)?w:null,m=d===null?v:v.filter(e=>e.diameter===d),Q=W&&N.length>1,Y=e=>{if(e===0)return!1;const n=m[e-1],p=m[e];return n.diameter!==p.diameter||n.width!==p.width},F=e=>o?t("span",{role:"tooltip",className:`pointer-events-none absolute top-1/2 right-0 z-20 hidden w-[520px] -translate-y-1/2 whitespace-normal bg-[var(--tooltip-bg)] px-3 py-2 text-right font-mono ${a.labelXs} normal-case tracking-[0.12em] text-fg shadow-lg group-hover:block max-view-tablet:!hidden`,children:t(me,{answer:ue(e,J)})}):null,ee=(e,n)=>l("div",{className:h.row,children:[e,m[n.index]?F(m[n.index]):null]}),te=t("div",{className:"-mx-1 overflow-x-auto",children:l("table",{className:`w-full border-collapse font-mono ${a.labelXl} tracking-[0.06em] text-fg`,children:[t("thead",{children:t("tr",{children:r.map(({header:e},n)=>t("th",{className:`whitespace-nowrap border-b border-line bg-surface px-4 py-4 text-left ${a.body} font-normal uppercase tracking-[0.22em] text-fg-dim`,children:_(e)},n))})}),t("tbody",{children:m.map((e,n)=>t("tr",{className:`group transition-colors hover:[&>td]:bg-surface ${Y(n)?"[&>td]:border-t [&>td]:border-line":""}`,children:r.map((p,ne)=>{const z=ne===r.length-1,le=p.fieldKey==="diameter";return l("td",{className:`${z?"relative ":""}${we}${le?" text-accent":""}`,children:[p.cell(e,u),z?F(e):null]},p.fieldKey)})},y(e,r,u)))})]})});return l(L,{className:f?D:P,children:[f?null:t(O,{num:i!=null?b(i):void 0,title:s!=null?X(s,!1):void 0,description:c!=null?b(c):void 0,accent:!0}),l("div",{className:"mb-6 flex flex-wrap items-center gap-x-2 gap-y-3",children:[Q&&l(re,{children:[t("span",{className:`mr-2 font-mono ${a.labelSmall} uppercase tracking-[0.24em] text-fg-dim max-view-tablet:mr-0 max-view-tablet:mb-1 max-view-tablet:w-full`,children:"Filter by size:"}),l("button",{type:"button",onClick:()=>E(null),className:`${j} ${d===null?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:d===null?G:void 0,children:[d===null&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),"All"]}),N.map(e=>{const n=e===d;return l("button",{type:"button",onClick:()=>E(n?null:e),className:`${j} ${n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:n?G:void 0,children:[n&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e,'"']},e)})]}),l("button",{type:"button",onClick:()=>$(e=>!e),"aria-pressed":o,"aria-label":o?"Hide vehicle tooltip":"Show vehicle tooltip",className:`ml-auto inline-flex items-center gap-3 font-mono ${a.labelSmall} uppercase tracking-[0.24em] text-fg-dim transition-colors hover:text-fg max-view-tablet:hidden`,children:[t("span",{children:"Vehicle tooltip"}),t("span",{className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 transition-colors ${o?"border-accent":"border-fg-dim/50"}`,style:o?{background:"color-mix(in oklab, var(--accent) 30%, transparent)"}:void 0,"aria-hidden":!0,children:t("span",{className:`block h-3 w-3 rounded-full transition-transform ${o?"translate-x-[18px] bg-accent":"translate-x-[2px] bg-fg-dim"}`})}),t("span",{className:o?"text-accent":"text-fg-dim",children:o?"On":"Off"})]})]}),t(B,{ownerId:T??"",ownerType:"FitmentTable",Template:Z,rows:m.map(e=>se(e,r,u,y(e,r,u))),wrapCopy:ee,fallback:te,children:e=>t("div",{className:h.scroll,children:l("div",{className:h.table,children:[t(B,{ownerId:T??"",ownerType:"FitmentTable",slot:ie,Template:q,rows:[ce(r,_)],fallback:null,children:n=>t("div",{className:h.head,children:n})}),e]})})}),t(de,{text:K,linkText:M,linkHref:U})]})}export{ve as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as r,Fragment as x}from"react/jsx-runtime";import R from"next/link";import{useEffect as D,useMemo as Y,useRef as j,useState as C}from"react";import{holdTime as X}from"../../lib/checkout/hold-time.js";import{stripeAppearance as J}from"../../lib/checkout/stripe-appearance.js";import{userZone as ee}from"efficient-shell/format";import{Elements as te,PaymentElement as re,useElements as ne,useStripe as ae}from"@stripe/react-stripe-js";import{loadStripe as ie}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{resolveCopyright as oe}from"../../lib/content/site.js";import{ApiError as L,products as 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:i}=E();if(!t.grandTotal||!t.currency)return null;const m=c=>i(Number(c),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 i=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 ",i,". Your payment goes back to your card."]}):t.kind==="expired"?r(x,{children:["The hold on checkout ",i," ran out before your payment arrived. Your payment goes back to your card."]}):t.kind==="processing"?r(x,{children:["Your payment for checkout ",i," 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 ",i]}):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:i,placing:m,formLocked:y,email:p,me:c,addressSaveNote:g,lostChangeNote:d,idemKey:f,confirmation:o,setConfirmation:u,payment:h,paypalStep:k,squareStep:N,pendingConf:l,paid:b,setPaid:S,payNote:s,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 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: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:o.orderNumber})," has gone through."," "]}):r(x,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," is being reviewed by our team."," "]}),c?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:o,paid:b}),d&&e("p",{className:"text-sm text-fg-dim",children:d}),s&&e("p",{className:"text-sm text-fg-dim",children:s}),g&&e("p",{className:"text-sm text-fg-dim",children:g}),!c&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(R,{href:`/track?order=${encodeURIComponent(o.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:i,onPaid:m,onProcessing:y,onRenew:p,onBack:c}){const{formatMoney:g}=E(),d=e("span",{className:"text-fg",children:g(Number(t.amount),t.currency)}),f=Y(()=>ie(t.publishableKey),[t.publishableKey]),o=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."]}):i?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:o},children:e(Pe,{payment:t,checkout:n,onPaid:m,onProcessing:y,onRenew:p,onBack:c})},t.clientSecret)]})]})})}const we=5;function Pe({payment:t,checkout:n,onPaid:i,onProcessing:m,onRenew:y,onBack:p}){const{formatMoney:c}=E(),g=ae(),d=ne(),[f,o]=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(s){let a=s;for(let P=0;a==="processing"&&P<we;P+=1)await new Promise(v=>setTimeout(v,1e3)),a=await N()??a;if(a==="succeeded"){i();return}if(a==="processing"){m();return}h("Payment did not complete. Please try again."),o(!1)}async function b(){if(!g||!d||f)return;o(!0),h(null),k.current=!0;const s=await g.confirmPayment({elements:d,redirect:"if_required"}).catch(()=>null);if(!s){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}h(a===void 0?I:"Payment failed. Please try again."),o(!1);return}if(s.error){if(!n.orderNumber&&s.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),o(!1);return}await y(a==="canceled"),o(!1);return}h(s.error.message??"Payment failed. Please try again."),o(!1);return}await l(s.paymentIntent?.status)}async function S(){if(f)return;if(!k.current){p();return}o(!0),h(null);const s=await N();if(s==="succeeded"||s==="processing"){await l(s);return}if(o(!1),s===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 ",c(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 i=`${t}|${n}`;if(T?.key===i)return T.promise;const m=new Promise((y,p)=>{document.getElementById(B)?.remove();const c=document.createElement("script");c.id=B;const g=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});c.src=`https://www.paypal.com/sdk/js?${g}`,c.onload=()=>{const d=window.paypal;d?y(d):p(new Error("PayPal SDK loaded without its namespace"))},c.onerror=()=>p(new Error("PayPal SDK failed to load")),document.head.appendChild(c)});return T={key:i,promise:m},m}function Ce({confirmation:t,clientId:n,idemKey:i,onPaid:m,onSkip:y}){const{formatMoney:p}=E(),c=j(null),[g,d]=C(!1),[f,o]=C(null),u=j(m);return u.current=m,D(()=>{let h=!1,k=null;return ve(n,t.currency).then(N=>{if(!(h||!c.current))return k=N.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await q.createPaypalOrder({idempotencyKey:i})).paypalOrderId,onApprove:async l=>{try{if((await q.capturePaypalOrder({idempotencyKey:i,paypalOrderId:l.orderID})).status==="paid"){u.current();return}o("PayPal did not complete the payment. Please try again.")}catch(b){o(b instanceof L?b.message:"PayPal payment failed. Please try again.")}},onError:()=>{o("PayPal could not process the payment. Please try again.")}}),k.render(c.current).then(()=>{h||d(!0)})}).catch(()=>{h||o("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{h=!0,k?.close?.()}},[n,t.currency,i]),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:c}),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 i=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 c=window.Square;c?m(c):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:i},i}function je({confirmation:t,applicationId:n,locationId:i,environment:m,idemKey:y,onPaid:p,onSkip:c}){const{formatMoney:g}=E(),d=j(null),f=j(null),o=j(null),[u,h]=C(!1),[k,N]=C(!1),[l,b]=C(null);D(()=>{let s=!1,a=null;return Se(m).then(async P=>{if(s||!d.current)return;const v=P.payments(n,i);o.current=v,a=await v.card(),await a.attach(d.current),f.current=a,s||h(!0)}).catch(()=>{s||b("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{s=!0,a?.destroy?.()}},[n,i,m]);async function S(){const s=f.current;if(!(!s||k)){N(!0),b(null);try{const a=await s.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 o.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:c,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 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};
@@ -19,6 +19,10 @@ export declare const NO_PAYMENT_METHOD_NOTE = "This shop does not take payment o
19
19
  export declare function paymentNotStartedMessage(conf: Pick<OrderConfirmation, "orderNumber" | "checkoutNumber">, err: unknown): string;
20
20
  export declare const SHIPPING_RETRY_NOTE = "Shipping cannot be calculated right now. Please try again.";
21
21
  export declare function placedOrderLockNote(orderNumber: string): string;
22
+ export interface PayNote {
23
+ text: string;
24
+ warning: boolean;
25
+ }
22
26
  export interface CheckoutProps {
23
27
  site: SiteIdentity;
24
28
  logo?: {
@@ -185,7 +189,7 @@ declare function useCheckoutState({ site, logo, preview }: CheckoutProps): {
185
189
  orderLocked: boolean;
186
190
  formLocked: boolean;
187
191
  restoredPrices: "waiting" | "changed" | "same" | null;
188
- payNote: string | null;
192
+ payNote: PayNote | null;
189
193
  afterpayConfirming: boolean;
190
194
  gocardlessConfirming: boolean;
191
195
  zipConfirming: boolean;
@@ -1,3 +1,3 @@
1
1
  "use client";import{jsx as R}from"react/jsx-runtime";import{createContext as fr,useContext as mr,useEffect as h,useMemo as an,useRef as y,useState as s}from"react";import{isOrderable as un,useCart as yr}from"../CartContext.js";import{useCurrency as hr}from"../CurrencyContext.js";import{getClickIds as gr}from"../../lib/click-ids.js";import{adConsentForOrder as kr}from"../../lib/consent/choice.js";import{trackBeginCheckout as Cr,trackPurchase as wr}from"../../lib/google-tag.js";import{trackMetaPurchase as Pr}from"../../lib/meta-pixel.js";import{ApiError as Fe,api as me,products as w}from"../../lib/api/index.js";import{uuid as qe}from"../../lib/uuid.js";import{orderLinesForSets as br}from"../../lib/commerce.js";import{canPersist as Nr,safeSessionStorage as st}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Sr,AFTERPAY_RETURN as Ar,GOCARDLESS_CONTEXT_KEY as vr,GOCARDLESS_RETURN as Or,KLARNA_CONTEXT_KEY as Er,KLARNA_RETURN as Rr,ZIP_CONTEXT_KEY as Kr,ZIP_RETURN as Mr,runWalletReturn as $e}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as Lr}from"../../lib/checkout/match-subdivision.js";import{clearCheckoutMemory as Tr,holdsPress as _r,parkCheckoutMemory as xr,parkForm as Ir,parkOrder as Fr,parkRequest as ln,readCheckoutMemory as qr,sameGoods as $r,sendableRequest as Br}from"../../lib/checkout/checkout-memory.js";import{checkoutGone as ct,checkoutWaiting as dn,BANK_WAITING as Ur,DROPPABLE_INTENT as Yr,NOT_CHECKED as at,LOST_CHANGE as it,PAY_FIRST_FLOW as ut,paysFirst as Hr,readIntentStatus as Gr,releaseHeldCheckout as pn,CHECKOUT_COMMITTED as Dr,goodsShapeOf as zr,refusedForGood as fn,settlePayFirst as Wr}from"../../lib/checkout/pay-first.js";import{couponCodeForOrder as mn,couponRefusedByOrder as Jr}from"../../lib/cart/coupon-preview.js";function yn(o){const g=o.indexOf(`
2
- `);return g===-1?[o,""]:[o.slice(0,g),o.slice(g+1)]}function hn(o,{canParkContext:g}={canParkContext:!0}){const f=o.paymentMethods,a=[];return f.includes("card")&&a.push({key:"card",title:"Card",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),f.includes("paypal")&&o.paypalClientId&&a.push({key:"paypal",title:"PayPal",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),f.includes("afterpay")&&a.push({key:"afterpay",title:"Afterpay",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),f.includes("square")&&o.squareApplicationId&&o.squareLocationId&&a.push({key:"square",title:"Card (Square)",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),f.includes("gocardless")&&g&&a.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),f.includes("zip")&&a.push({key:"zip",title:"Zip",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),f.includes("klarna")&&g&&a.push({key:"klarna",title:"Klarna",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),f.includes("bank")&&a.push({key:"bank",title:"Bank transfer",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),a}const Co="This shop does not take payment online yet. Please contact the shop to order.";class Be extends Error{}function gn(o,g){if(!o.orderNumber&&ct(g))return g.message;const f=g instanceof Fe?` (${g.message})`:"";return o.orderNumber?`Your order ${o.orderNumber} is saved, but the payment did not start${f}. Try the payment again — your order will not be placed twice.`:`Your items are held under ${o.checkoutNumber}, but the payment did not start${f}. Try the payment again — you will not be charged twice.`}const Xr=3e3,Zr=.005,kn=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]);function Cn(){const o=kr();return{...o==="denied"?{}:gr(),...o?{adConsent:o}:{}}}const v=o=>JSON.parse(o),jr={lastPress:null,keptCardKey:null,placedShape:null,placedRequest:null,unpaidOrder:null},Qr={lastPress:o=>o&&{key:o.key,request:ln(o.request),lines:o.lines,goods:v(o.shape)[0],plainPressed:!!o.plainMethod,plainLines:o.plainLines,plainGoods:v(o.plainShape)[0]},keptCardKey:o=>o,placedShape:o=>o===null?null:v(o)[0],placedRequest:o=>o&&ln(o.body),unpaidOrder:o=>o&&Fr(o)};function wn(o,g){const f={};for(const a of Object.keys(o))f[a]=o[a](g[a]);return f}const wo="Shipping cannot be calculated right now. Please try again.";function Po(o){return`Your order is saved, so its contact, address, delivery and discount can't change here. To change any of them, contact the shop and quote ${o}.`}function Vr({site:o,logo:g,preview:f=!1}){const{items:a,totals:P,coupon:K,refuseCoupon:bn,deliveryOptions:lt,shippingMethodId:Q,setShippingMethodId:dt,setQuoteDestination:ye,courier:Nn,requote:Ue,identify:pt,clearCapturedCart:he,replaceItems:Ye,removeCoupon:ft,applyCoupon:Sn}=yr(),An=lt.find(e=>e.id===Q)?.pickupLocation??null,{country:mt,countries:V,activeCountry:yt,formatMoney:vn}=hr(),[C,ge]=s(()=>hn(o)[0]?.key??null),[ht,On]=s(!0);h(()=>{On(Nr(st))},[]);const[M,He]=s(!1),[I,ke]=s(""),[L,Ce]=s(""),[H,we]=s(""),[Pe,Ge]=s(""),[ee,te]=s(""),[be,ne]=s(""),[F,re]=s(""),[T,oe]=s(""),[G,se]=s(""),[m,ce]=s(()=>mt||V[0]?.code||""),[O,Ne]=s(""),[ae,gt]=s([]),[De,ze]=s(null),[Se,D]=s(null),kt=an(()=>V.find(e=>e.code===m)??yt,[V,m,yt]),En=kt?.postalLabel||"Postal Code",Rn=ae[0]?.divisionType||"State / Province";h(()=>{if(!m){gt([]),ze(m);return}ze(null);let e=!1;return w.listCountrySubdivisions(m).then(t=>{e||(gt(t),ze(m),Ne(""))}),()=>{e=!0}},[m]);const Ct=ee.trim()!==""&&F.trim()!==""&&T.trim()!==""&&De===m&&(ae.length===0||O!=="")?T.trim():"";h(()=>{ye(m?{country:m,subdivision:O,postcode:Ct}:null)},[m,O,Ct,ye]),h(()=>()=>ye(null),[ye]);const Kn=Nn?.status==="unavailable",Mn=Ue,[ie,wt]=s(null),[Ln,Pt]=s([]),[We,Ae]=s("new"),[bt,Nt]=s(!1),[Je,Tn]=s("Home"),[_n,St]=s(null),[xn,Xe]=s(null),[q,ve]=s(()=>qe()),At=y(null),[Ze,z]=s(null),[In,N]=s(null),[vt,Oe]=s(null),[Ot,Fn]=s(!1),[Et,qn]=s(!1),[_,W]=s(null),[$n,Ee]=s(!1),[k,S]=s(null),Rt=!!k?.orderNumber,Bn=Rt||M,[Un,Yn]=s(null),[Hn,Gn]=s(!1),[Dn,zn]=s(!1),[Wn,Jn]=s(!1),[Xn,Zn]=s(!1),[Kt,jn]=s(!1),[Qn,je]=s(!1),[ue,Mt]=s(null),i=y({...jr});i.current.unpaidOrder=k;const Qe=y(!1),$=y(a),Lt=!!(Ze||ue&&ue.kind!=="processing"||Kt||Ot||Et||vt&&_?.orderNumber);h(()=>{Lt&&(Ye([]),ft())},[Lt,Ye,ft]);const Tt=y(!1);h(()=>{f||Tt.current||!a.some(un)||(Tt.current=!0,Cr({lines:a,currency:P.currency,value:P.subtotal-P.discount,coupon:K?.valid?K.code:void 0}))},[a,P,K,f]),h(()=>{pt(I,L.trim()||void 0)},[I,L,pt]);const _t=y(null),[Re,Vn]=s(null);h(()=>{const e=_t.current;if(!Re||!e)return;const t=()=>e.style.setProperty("--sf-checkout-header-h",`${Re.offsetHeight}px`);t();const r=new ResizeObserver(t);return r.observe(Re),()=>r.disconnect()},[Re]),h(()=>{const e=r=>({setConfirming:r,land:z,markPaid:()=>Ee(!0),note:Yn,fail:N,clearCart:he,lostChange:()=>Xe(it)}),t={search:window.location.search,storage:st,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};$e(Ar,{...t,capture:w.captureAfterpayPayment,page:e(Gn)}),$e(Mr,{...t,capture:w.captureZipPayment,page:e(Jn)}),$e(Or,{...t,capture:w.completeGocardlessPayment,page:e(zn)}),$e(Rr,{...t,capture:w.captureKlarnaPayment,page:e(Zn)})},[]);function xt(e){const[t,r]=yn(e.address);te(t),ne(r),re(e.city),oe(e.zip_code),e.country&&ce(e.country),e.phone&&se(e.phone),D({country:e.country||null,state:e.state??""})}h(()=>{if(Se){if((Se.country||m)!==m){D(null);return}De===m&&(Ne(Lr(m,Se.state,ae)),D(null))}},[Se,m,De,ae]),h(()=>{let e=!1;return(async()=>{try{const[t,r,c]=await Promise.all([me.me(),me.myProfile().catch(()=>null),me.myAddresses().catch(()=>[])]);if(e)return;wt(t);const n=c.filter(p=>p.is_active);Pt(n),ke(t.email);const u=(r?.contact_name??"").split(/\s+/);Ce(t.first_name||u[0]||""),we(t.last_name||u.slice(1).join(" "));const d=t.phone||r?.phone;d&&se(d);const l=n.find(p=>p.id===t.default_delivery_location)??n[0];if(l)Ae(l.id),xt(l);else if(r){const[p,j]=yn(r.address??"");te(p),ne(j),re(r.city??""),oe(r.zip_code??""),r.country&&ce(r.country),D({country:r.country||null,state:r.state??""})}Ie.current&&Ht(Ie.current,!1)}catch{}})(),()=>{e=!0}},[]);function er(){me.logout(),le.current=!0,Ie.current=null,xe.current=null,de(),wt(null),Pt([]),Ae("new"),Nt(!1),ke(""),Ce(""),we(""),Ge(""),te(""),ne(""),re(""),oe(""),se(""),ce(mt||V[0]?.code||""),Ne(""),D(null)}const J=an(()=>hn(o,{canParkContext:ht}),[o,ht]);h(()=>{J.some(e=>e.key===C)||ge(J[0]?.key??null)},[J,C]);const tr=J.length===0,Ke=be.trim()?`${ee}
2
+ `);return g===-1?[o,""]:[o.slice(0,g),o.slice(g+1)]}function hn(o,{canParkContext:g}={canParkContext:!0}){const f=o.paymentMethods,a=[];return f.includes("card")&&a.push({key:"card",title:"Card",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),f.includes("paypal")&&o.paypalClientId&&a.push({key:"paypal",title:"PayPal",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),f.includes("afterpay")&&a.push({key:"afterpay",title:"Afterpay",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),f.includes("square")&&o.squareApplicationId&&o.squareLocationId&&a.push({key:"square",title:"Card (Square)",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),f.includes("gocardless")&&g&&a.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),f.includes("zip")&&a.push({key:"zip",title:"Zip",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),f.includes("klarna")&&g&&a.push({key:"klarna",title:"Klarna",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),f.includes("bank")&&a.push({key:"bank",title:"Bank transfer",body:null,price:R("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),a}const Co="This shop does not take payment online yet. Please contact the shop to order.";class Be extends Error{}function gn(o,g){if(!o.orderNumber&&ct(g))return g.message;const f=g instanceof Fe?` (${g.message})`:"";return o.orderNumber?`Your order ${o.orderNumber} is saved, but the payment did not start${f}. Try the payment again — your order will not be placed twice.`:`Your items are held under ${o.checkoutNumber}, but the payment did not start${f}. Try the payment again — you will not be charged twice.`}const Xr=3e3,Zr=.005,kn=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]);function Cn(){const o=kr();return{...o==="denied"?{}:gr(),...o?{adConsent:o}:{}}}const v=o=>JSON.parse(o),jr={lastPress:null,keptCardKey:null,placedShape:null,placedRequest:null,unpaidOrder:null},Qr={lastPress:o=>o&&{key:o.key,request:ln(o.request),lines:o.lines,goods:v(o.shape)[0],plainPressed:!!o.plainMethod,plainLines:o.plainLines,plainGoods:v(o.plainShape)[0]},keptCardKey:o=>o,placedShape:o=>o===null?null:v(o)[0],placedRequest:o=>o&&ln(o.body),unpaidOrder:o=>o&&Fr(o)};function wn(o,g){const f={};for(const a of Object.keys(o))f[a]=o[a](g[a]);return f}const wo="Shipping cannot be calculated right now. Please try again.";function Po(o){return`Your order is saved, so its contact, address, delivery and discount can't change here. To change any of them, contact the shop and quote ${o}.`}function Vr({site:o,logo:g,preview:f=!1}){const{items:a,totals:P,coupon:K,refuseCoupon:bn,deliveryOptions:lt,shippingMethodId:Q,setShippingMethodId:dt,setQuoteDestination:ye,courier:Nn,requote:Ue,identify:pt,clearCapturedCart:he,replaceItems:Ye,removeCoupon:ft,applyCoupon:Sn}=yr(),An=lt.find(e=>e.id===Q)?.pickupLocation??null,{country:mt,countries:V,activeCountry:yt,formatMoney:vn}=hr(),[C,ge]=s(()=>hn(o)[0]?.key??null),[ht,On]=s(!0);h(()=>{On(Nr(st))},[]);const[M,He]=s(!1),[I,ke]=s(""),[L,Ce]=s(""),[H,we]=s(""),[Pe,Ge]=s(""),[ee,te]=s(""),[be,ne]=s(""),[F,re]=s(""),[T,oe]=s(""),[G,se]=s(""),[m,ce]=s(()=>mt||V[0]?.code||""),[O,Ne]=s(""),[ae,gt]=s([]),[De,ze]=s(null),[Se,D]=s(null),kt=an(()=>V.find(e=>e.code===m)??yt,[V,m,yt]),En=kt?.postalLabel||"Postal Code",Rn=ae[0]?.divisionType||"State / Province";h(()=>{if(!m){gt([]),ze(m);return}ze(null);let e=!1;return w.listCountrySubdivisions(m).then(t=>{e||(gt(t),ze(m),Ne(""))}),()=>{e=!0}},[m]);const Ct=ee.trim()!==""&&F.trim()!==""&&T.trim()!==""&&De===m&&(ae.length===0||O!=="")?T.trim():"";h(()=>{ye(m?{country:m,subdivision:O,postcode:Ct}:null)},[m,O,Ct,ye]),h(()=>()=>ye(null),[ye]);const Kn=Nn?.status==="unavailable",Mn=Ue,[ie,wt]=s(null),[Ln,Pt]=s([]),[We,Ae]=s("new"),[bt,Nt]=s(!1),[Je,Tn]=s("Home"),[_n,St]=s(null),[xn,Xe]=s(null),[q,ve]=s(()=>qe()),At=y(null),[Ze,z]=s(null),[In,N]=s(null),[vt,Oe]=s(null),[Ot,Fn]=s(!1),[Et,qn]=s(!1),[_,W]=s(null),[$n,Ee]=s(!1),[k,S]=s(null),Rt=!!k?.orderNumber,Bn=Rt||M,[Un,Yn]=s(null),[Hn,Gn]=s(!1),[Dn,zn]=s(!1),[Wn,Jn]=s(!1),[Xn,Zn]=s(!1),[Kt,jn]=s(!1),[Qn,je]=s(!1),[ue,Mt]=s(null),i=y({...jr});i.current.unpaidOrder=k;const Qe=y(!1),$=y(a),Lt=!!(Ze||ue&&ue.kind!=="processing"||Kt||Ot||Et||vt&&_?.orderNumber);h(()=>{Lt&&(Ye([]),ft())},[Lt,Ye,ft]);const Tt=y(!1);h(()=>{f||Tt.current||!a.some(un)||(Tt.current=!0,Cr({lines:a,currency:P.currency,value:P.subtotal-P.discount,coupon:K?.valid?K.code:void 0}))},[a,P,K,f]),h(()=>{pt(I,L.trim()||void 0)},[I,L,pt]);const _t=y(null),[Re,Vn]=s(null);h(()=>{const e=_t.current;if(!Re||!e)return;const t=()=>e.style.setProperty("--sf-checkout-header-h",`${Re.offsetHeight}px`);t();const r=new ResizeObserver(t);return r.observe(Re),()=>r.disconnect()},[Re]),h(()=>{const e=r=>({setConfirming:r,land:z,markPaid:()=>Ee(!0),note:(c,n)=>Yn({text:c,warning:n}),fail:N,clearCart:he,lostChange:()=>Xe(it)}),t={search:window.location.search,storage:st,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};$e(Ar,{...t,capture:w.captureAfterpayPayment,page:e(Gn)}),$e(Mr,{...t,capture:w.captureZipPayment,page:e(Jn)}),$e(Or,{...t,capture:w.completeGocardlessPayment,page:e(zn)}),$e(Rr,{...t,capture:w.captureKlarnaPayment,page:e(Zn)})},[]);function xt(e){const[t,r]=yn(e.address);te(t),ne(r),re(e.city),oe(e.zip_code),e.country&&ce(e.country),e.phone&&se(e.phone),D({country:e.country||null,state:e.state??""})}h(()=>{if(Se){if((Se.country||m)!==m){D(null);return}De===m&&(Ne(Lr(m,Se.state,ae)),D(null))}},[Se,m,De,ae]),h(()=>{let e=!1;return(async()=>{try{const[t,r,c]=await Promise.all([me.me(),me.myProfile().catch(()=>null),me.myAddresses().catch(()=>[])]);if(e)return;wt(t);const n=c.filter(p=>p.is_active);Pt(n),ke(t.email);const u=(r?.contact_name??"").split(/\s+/);Ce(t.first_name||u[0]||""),we(t.last_name||u.slice(1).join(" "));const d=t.phone||r?.phone;d&&se(d);const l=n.find(p=>p.id===t.default_delivery_location)??n[0];if(l)Ae(l.id),xt(l);else if(r){const[p,j]=yn(r.address??"");te(p),ne(j),re(r.city??""),oe(r.zip_code??""),r.country&&ce(r.country),D({country:r.country||null,state:r.state??""})}Ie.current&&Ht(Ie.current,!1)}catch{}})(),()=>{e=!0}},[]);function er(){me.logout(),le.current=!0,Ie.current=null,xe.current=null,de(),wt(null),Pt([]),Ae("new"),Nt(!1),ke(""),Ce(""),we(""),Ge(""),te(""),ne(""),re(""),oe(""),se(""),ce(mt||V[0]?.code||""),Ne(""),D(null)}const J=an(()=>hn(o,{canParkContext:ht}),[o,ht]);h(()=>{J.some(e=>e.key===C)||ge(J[0]?.key??null)},[J,C]);const tr=J.length===0,Ke=be.trim()?`${ee}
3
3
  ${be.trim()}`:ee,nr=zr({email:I,firstName:L,lastName:H,company:Pe.trim(),phone:G,address:Ke,city:F,subdivision:O,postcode:T,country:m,lines:a.map(e=>[e.id,e.qty]),shippingMethodId:Q,couponCode:mn(K),currency:P.currency,shopperId:ie?.id??null}),b=JSON.stringify([nr,C]),Ve=y(null),Me=y(!1),x=y(!1),X=y(null),Le=y(!1),A=y(b);A.current=b;const It=y(M);It.current=M;const Te=y(null);h(()=>{const e=()=>{const t=Te.current;t&&(Te.current=null,S(t),He(!1))};return window.addEventListener("pageshow",e),()=>window.removeEventListener("pageshow",e)},[]);function _e(e,t,r,c){const n={idempotencyKey:t,confirmation:r};Xt()&&(n.lostChange=!0),st.setItem(e,JSON.stringify(n)),window.location.assign(c),Te.current=r}async function Ft(e){He(!0);try{await e()}finally{Te.current||He(!1)}}const qt=y(!1),$t=!!(Ze||ue&&ue.kind!=="processing");h(()=>{$t&&(qt.current=!0,de())},[$t]);const xe=y(null),le=y(!1),et=y(null);function de(){et.current=null,Tr()}const Ie=y(null),[Z,rr]=s(!1);function tt(e){if(qt.current||f||le.current)return;const t={key:e,authed:Qe.current,parkedAt:et.current??=Date.now(),press:wn(Qr,i.current),lines:a.length>0?a:$.current,form:Ir({email:I,firstName:L,lastName:H,company:Pe,address1:ee,address2:be,city:F,postcode:T,phone:G,country:m,subdivision:O,selectedAddressId:We,shippingMethodId:Q,couponCode:K?.valid?K.code:null})};_r(t.press)?xr(t):de()}const Bt=y(C);Bt.current=C;function nt(e){return{...Br(e),...Cn(),...e.payFirst?{checkoutFlow:ut}:{}}}function or(e,t){let r=e.request.payFirst?"":null,c=e.plainPressed?null:"";const n=()=>Bt.current??"";return{key:e.key,send:()=>t(nt(e.request)),request:nt(e.request),lines:e.lines,shape:JSON.stringify([e.goods,null]),get method(){return r??n()},set method(u){r=u},get plainMethod(){return c??n()},set plainMethod(u){c=u},plainLines:e.plainLines,plainShape:JSON.stringify([e.plainGoods,null])}}const[sr,cr]=s(!1),Ut=sr?!P.quoted||P.serverSubtotal===null?"waiting":Math.abs(P.serverSubtotal-P.subtotal)<Zr?"same":"changed":null,rt=!k&&Ut==="waiting",ar=rt?{...P,repricing:!0}:P,Yt=rt&&P.quoteFailed;h(()=>{if(!Yt)return;const e=setInterval(Ue,Xr);return()=>clearInterval(e)},[Yt,Ue]);function Ht(e,t=!0){ke(e.email),Ce(e.firstName),we(e.lastName),Ge(e.company),te(e.address1),ne(e.address2),re(e.city),oe(e.postcode),se(e.phone),e.country&&ce(e.country),D({country:e.country||null,state:e.subdivision}),Ae(e.selectedAddressId),e.shippingMethodId&&dt(e.shippingMethodId),t&&(xe.current=e.couponCode)}h(()=>{let e=f?null:qr();const t=!!(e&&a.length>0);if(e&&t&&!$r(e.lines,a)&&(de(),e=null),e){const r=e.authed?w.createOrderAuthed:w.createOrder;ve(e.key),et.current=e.parkedAt,Qe.current=e.authed;const c={lastPress:n=>n&&or(n,r),keptCardKey:n=>n,placedShape:n=>n===null?null:JSON.stringify([n,null]),placedRequest:n=>{if(!n)return null;const u=nt(n);return{body:u,send:()=>r(u)}},unpaidOrder:n=>n};i.current=wn(c,e.press),e.press.unpaidOrder&&S(e.press.unpaidOrder),e.lines.length>0&&!t&&(Ye(e.lines),$.current=e.lines,cr(!0)),e.form&&(Ie.current=e.form,Ht(e.form))}rr(!0)},[]),h(()=>{!Z||a.length>0||i.current.unpaidOrder||M||(le.current=!0,de())},[Z,a.length]),h(()=>{const e=xe.current;!Z||!e||a.length===0||(xe.current=null,Sn(e,I||void 0))},[Z,a.length]),h(()=>{!Z||M||tt(q)},[Z,M,q,k]);const B=y(null);h(()=>{It.current||(b!==B.current&&(B.current=null),!(!x.current||!k||k.orderNumber)&&(b===i.current.placedShape||b===B.current||Ft(()=>Gt(k))))},[b,k]);async function Gt(e){if(Le.current)return null;Le.current=!0;try{const t=X.current?await Gr(X.current):"none";if(t==="succeeded"||t==="processing")return x.current=!1,S(null),E("card"),t==="succeeded"?await U(void 0,e):en(e),null;if(t===void 0||!Yr.has(t))return B.current=A.current,S(e),N(t==="requires_action"?Ur:at),null;const r=await pn(q);if(r==="committed")return x.current=!1,S(null),E("card"),await U(void 0,e),null;if(r!=="released")return B.current=A.current,S(e),N(at),null;x.current=!1,X.current=null,B.current=null,N(null),S(null);const c=qe();return ve(c),c}finally{Le.current=!1}}async function ir(){f||M||Le.current||await Ft(ur)}async function ur(){if(k){if((x.current?b!==i.current.placedShape:pe())&&!k.orderNumber){const c=await Gt(k);c&&A.current===b&&await Dt(c);return}N(null),Me.current=!1,await ot();const t=v(A.current)[1],r=k.orderNumber?t:"card";if(r&&kn.has(r)&&pe()&&v(A.current)[0]!==Ve.current){zt(k);return}E(r),r!==C&&ge(r),await tn(k,r,!k.orderNumber);return}await Dt(q)}async function Dt(e){if(a.length===0||P.repricing||rt||!C||!J.some(d=>d.key===C))return;const t=a.filter(un).flatMap(d=>br(d.components,d.qty));if(t.length===0){N("Pick a size on each wheel's product page before checking out.");return}N(null);let r,c=e,n=C,u=!1;try{const d=ie?w.createOrderAuthed:w.createOrder,l={customer:{email:I,name:`${L} ${H}`.trim(),phone:G.trim()||void 0,companyName:Pe.trim()||void 0,address:Ke,city:F,state:O||void 0,zipCode:T,country:m},items:t,currency:P.currency,idempotencyKey:e,shippingMethodId:Q??void 0,couponCode:mn(K),...Cn(),...Hr(C)?{checkoutFlow:ut}:{}};i.current.placedRequest={body:l,send:()=>d(l)},Qe.current=!!ie,le.current=!1,Xe(null),Ve.current=null,Me.current=!1,X.current=null,x.current=!1,B.current=null,i.current.placedShape=b,$.current=a;const p=i.current.lastPress,j=p?.key===l.idempotencyKey&&(p.shape!==b&&(!!l.checkoutFlow||!!p.method||!!p.plainMethod)||!!l.checkoutFlow&&!!p.plainMethod);j&&(i.current.keptCardKey=l.idempotencyKey);const on=jt(l,d),sn=j||!l.checkoutFlow&&i.current.keptCardKey===l.idempotencyKey,cn=!on&&!sn&&!l.checkoutFlow&&!!p&&!p.method;cn&&(p.plainMethod=C,p.plainLines=a,p.plainShape=b,tt(l.idempotencyKey));const Y=await(sn?Jt(l,d):d(l).then(fe=>({answer:fe,request:l})).catch(fe=>(on?Wt(fe,l.idempotencyKey):cn&&fn(fe)&&(p.plainMethod=""),lr(fe,l,d))));if(!Y)return;r=Y.answer,c=Y.request.idempotencyKey,n=Y.method??n,E(n),u=pe()||n!==v(A.current)[1],Y.method&&Y.method!==C&&ge(Y.method),r.orderNumber&&(Qt(r),he()),await ot()}catch(d){const l=Jr(d);l?(bn(l),N(`${l} Your order has not been placed. Place it again to continue without the code.`)):d instanceof Be?N(at):N(d instanceof Fe?d.message:"Could not place the order. Please try again.");return}if(n&&kn.has(n)&&(u||pe())){zt(r);return}await tn(r,n,!1,c)}function zt(e){Ve.current=v(A.current)[0],N(`${gn(e,null)} ${it}`),S(e)}function Wt(e,t){fn(e)&&!dn(e)&&i.current.lastPress?.key===t&&(i.current.lastPress=null)}async function lr(e,t,r){if(ct(e))return Zt(t,r);if(!dn(e))throw e;return i.current.keptCardKey=t.idempotencyKey,Jt(t,r,!0)}async function Jt(e,t,r=!1){const c=await pn(e.idempotencyKey);if(c==="released")return Zt(e,t);if(c!=="committed")throw new Be;const n=i.current.lastPress?.key===e.idempotencyKey?i.current.lastPress:null;if($.current=n?.lines??a,n?.method&&!r){i.current.keptCardKey=null,i.current.placedRequest={body:n.request,send:n.send};const j=await n.send().catch(()=>{throw new Be});return i.current.placedShape=n.shape,{answer:j,request:e,method:n.method}}const u={...e,checkoutFlow:ut},d=n&&!n.method?{body:n.request,send:n.send}:{body:u,send:()=>t(u)};i.current.placedRequest=d;const l=d.send,p=await l().catch(()=>null);if(!p&&n?.plainMethod)throw new Be;return p?.orderNumber&&p.status!==Dr?(i.current.keptCardKey=null,n?.plainMethod&&($.current=n.plainLines),n&&(i.current.placedShape=n.plainMethod?n.plainShape:n.shape),{answer:p,request:e,method:n?.plainMethod||void 0}):(n&&(i.current.placedShape=n.shape),E("card"),await Vt("",p?async()=>p:()=>Promise.reject(new Error("The order request did not answer."))),await ot(),null)}function pe(){const e=i.current.placedShape;return e!==null&&v(e)[0]!==v(A.current)[0]}function E(e){e!==v(A.current)[1]&&(Me.current=!0),Xe(Xt()?it:null)}function Xt(){return Me.current||pe()}async function Zt(e,t){const r={...e,idempotencyKey:qe()};i.current.keptCardKey=null,ve(r.idempotencyKey),i.current.placedRequest={body:r,send:()=>t(r)},jt(r,t);try{return{answer:await t(r),request:r}}catch(c){throw Wt(c,r.idempotencyKey),c}}function jt(e,t){return i.current.lastPress?.key===e.idempotencyKey?!1:(i.current.lastPress={key:e.idempotencyKey,send:()=>t(e),request:e,lines:a,shape:b,method:e.checkoutFlow?"":C??"",plainMethod:"",plainLines:a,plainShape:b},le.current=!1,tt(e.idempotencyKey),!0)}function Qt(e){wr({confirmation:e,lines:$.current,adsSendTo:o.googleAdsId&&o.googleAdsConversionLabel?`${o.googleAdsId}/${o.googleAdsConversionLabel}`:null}),Pr({confirmation:e,lines:$.current})}async function U(e,t=_){if(!t)return;const r=e?async()=>e:i.current.placedRequest?.send;if(t.orderNumber||!r){Ee(!0),z(t);return}await Vt(t.checkoutNumber,r)}async function Vt(e,t){he(),await Wr({checkoutNumber:e,resend:t,page:{setConfirming:jn,land:z,markPaid:()=>Ee(!0),track:Qt,unplaced:Mt}})}function en(e=_){if(e){if(e.orderNumber){z(e);return}he(),Mt({kind:"processing",checkoutNumber:e.checkoutNumber})}}async function ot(){const e=JSON.stringify([Je.trim(),L,H,G.trim(),Ke,F,O,T,m]);if(!(!ie||!bt||We!=="new"||At.current===e))try{await me.createAddress({label:Je.trim()||"Home",contact_name:`${L} ${H}`.trim(),phone:G.trim(),address:Ke,city:F,zip_code:T,state:O,country:m}),At.current=e,St("Address saved to your account.")}catch{St("We couldn't save the address to your account — you can add it under Account → Addresses.")}}async function tn(e,t=C,r=!1,c=q){S(null);try{if(t==="card"&&o.paymentMethods.includes("card")){const n=await w.createPaymentIntent({idempotencyKey:c});X.current=n;let u=e;if(r){const d=await i.current.placedRequest?.send().catch(()=>null);if(d?.orderNumber){E("card"),await U(d,e);return}u=nn(e,d)??{...e,expiresAt:null}}E("card"),W(u),je(!1),Oe(n)}else if(t==="paypal"&&o.paymentMethods.includes("paypal"))W(e),Fn(!0);else if(t==="afterpay"&&o.paymentMethods.includes("afterpay")){const n=window.location.origin,u=await w.createAfterpayCheckout({idempotencyKey:c,confirmUrl:`${n}/checkout?afterpay=confirm`,cancelUrl:`${n}/checkout?afterpay=cancel`});_e(Sr,c,e,u.redirectCheckoutUrl);return}else if(t==="square"&&o.paymentMethods.includes("square"))W(e),qn(!0);else if(t==="gocardless"&&o.paymentMethods.includes("gocardless")){const n=window.location.origin,u=await w.createGocardlessBillingRequest({idempotencyKey:c,confirmUrl:`${n}/checkout?gocardless=confirm`,cancelUrl:`${n}/checkout?gocardless=cancel`});_e(vr,c,e,u.authorisationUrl);return}else if(t==="zip"&&o.paymentMethods.includes("zip")){const n=window.location.origin,u=await w.createZipCheckout({idempotencyKey:c,redirectUrl:`${n}/checkout?zip=return`});_e(Kr,c,e,u.redirectUrl);return}else if(t==="klarna"&&o.paymentMethods.includes("klarna")){const n=window.location.origin,u=await w.createKlarnaCheckout({idempotencyKey:c,confirmUrl:`${n}/checkout?klarna=confirm`,cancelUrl:`${n}/checkout?klarna=cancel`});_e(Er,c,e,u.redirectUrl);return}else E(t),z(e)}catch(n){if((r||t==="card")&&n instanceof Fe&&n.status===409){E(t),await U(void 0,e);return}rn(e,n)}}function nn(e,t){return t&&!t.orderNumber&&t.status==="open"&&t.checkoutNumber===e.checkoutNumber?t:null}function rn(e,t){N(gn(e,t)),!e.orderNumber&&ct(t)?(x.current=!1,ve(qe())):S(e)}async function dr(e){if(!_)return;const t=_;try{const r=await w.createPaymentIntent({idempotencyKey:q}),c=await i.current.placedRequest?.send().catch(()=>null);if(c?.orderNumber){await U(c);return}const n=nn(t,c);W(n??{...t,expiresAt:null}),je(e&&n!==null),X.current=r,Oe(r)}catch(r){if(r instanceof Fe&&r.status===409){await U();return}Oe(null),W(null),rn(t,r)}}function pr(){_&&(x.current=!0,S(_),Oe(null),W(null),je(!1))}return{site:o,logo:g,items:a,totals:ar,coupon:K,deliveryOptions:lt,courierUnavailable:Kn,retryCourier:Mn,shippingMethodId:Q,setShippingMethodId:dt,pickupLocation:An,servedCountries:V,formatMoney:vn,payChoice:C,setPayChoice:ge,placing:M,email:I,setEmail:ke,firstName:L,setFirstName:Ce,lastName:H,setLastName:we,company:Pe,setCompany:Ge,address1:ee,setAddress1:te,address2:be,setAddress2:ne,city:F,setCity:re,postcode:T,setPostcode:oe,phone:G,setPhone:se,country:m,setCountry:ce,subdivision:O,setSubdivision:Ne,subdivisions:ae,destination:kt,postcodeLabel:En,subdivisionLabel:Rn,me:ie,savedAddresses:Ln,selectedAddressId:We,setSelectedAddressId:Ae,saveAddress:bt,setSaveAddress:Nt,saveLabel:Je,setSaveLabel:Tn,addressSaveNote:_n,lostChangeNote:xn,idemKey:q,confirmation:Ze,setConfirmation:z,orderError:In,payment:vt,paypalStep:Ot,squareStep:Et,pendingConf:_,paid:$n,setPaid:Ee,unpaidOrder:k,orderLocked:Rt,formLocked:Bn,restoredPrices:Ut,payNote:Un,afterpayConfirming:Hn,gocardlessConfirming:Dn,zipConfirming:Wn,klarnaConfirming:Xn,cardConfirming:Kt,checkoutResult:ue,confirmCardPayment:U,cardStillProcessing:en,renewCardPayment:dr,holdRenewed:Qn,leaveCardPayment:pr,checkoutRootRef:_t,setCheckoutHeaderEl:Vn,fillFromAddress:xt,checkoutSignOut:er,payOptions:J,noPaymentMethod:tr,placeOrder:ir}}const Pn=fr(null);function bo({children:o,...g}){const f=Vr(g);return R(Pn.Provider,{value:f,children:o})}function No(){const o=mr(Pn);if(!o)throw new Error("useCheckout must be used inside CheckoutStateProvider");return o}export{bo as CheckoutStateProvider,Co as NO_PAYMENT_METHOD_NOTE,wo as SHIPPING_RETRY_NOTE,hn as buildPayOptions,gn as paymentNotStartedMessage,Po as placedOrderLockNote,No as useCheckout};
@@ -1,4 +1,5 @@
1
1
  import type { ProductKind } from "../../lib/api/index.js";
2
+ import type { SlotComponent } from "efficient-easel/blocks";
2
3
  export declare const supportedKinds: readonly ProductKind[];
3
4
  export interface TyreHead {
4
5
  title?: string;
@@ -16,6 +17,9 @@ interface Props {
16
17
  footnoteLinkHref?: string;
17
18
  editing?: boolean;
18
19
  omitHead?: boolean;
20
+ template?: SlotComponent;
21
+ headTemplate?: SlotComponent;
22
+ nodeId?: string;
19
23
  }
20
24
  export default function DynamicFitmentTable(props: Props): import("react").JSX.Element;
21
25
  export {};
@@ -1 +1 @@
1
- "use client";import{jsx as n}from"react/jsx-runtime";import k from"../FitmentTable.js";import x from"./KindGate.js";import{TyreSizesContent as F}from"../TyreSizeGrid.js";import{useCurrentProduct as T}from"../../lib/document/current-product.js";import{NO_FIELD_ANSWERS as w}from"../../lib/content/field-usage.js";import{useSampleProduct as b}from"./useSampleProduct.js";const h=["alloy-wheel","tyre"];function y(t){return n(x,{kinds:h,type:"FitmentTable",editing:t.editing,children:n(S,{...t})})}function S({num:t,title:s,description:l,showFilter:f,tooltipDefaultOn:a,footnote:d,footnoteLinkText:u,footnoteLinkHref:c,editing:r=!1,omitHead:m=!1,tyreHead:e}){const o=T(),p=b(r&&!o),i=o?.product??p;if(i?.kind==="tyre")return n(F,{variants:i.source.variants,fieldUsage:o?.fieldUsage??w,num:t,title:e?e.title:s,description:e?e.description:l,editing:r,omitHead:m,keepHiddenHead:e!=null});const g=i?.kind==="alloy-wheel"?i.source.fitments??[]:[];return n(k,{num:t,title:s,description:l,rows:g,showFilter:f,tooltipDefaultOn:a,footnote:d,footnoteLinkText:u,footnoteLinkHref:c,editing:r,omitHead:m,fieldUsage:o?.fieldUsage})}export{y as default,h as supportedKinds};
1
+ "use client";import{jsx as n}from"react/jsx-runtime";import F from"../FitmentTable.js";import h from"./KindGate.js";import{TyreSizesContent as w}from"../TyreSizeGrid.js";import{useCurrentProduct as b}from"../../lib/document/current-product.js";import{NO_FIELD_ANSWERS as y}from"../../lib/content/field-usage.js";import{useSampleProduct as S}from"./useSampleProduct.js";const U=["alloy-wheel","tyre"];function D(t){return n(h,{kinds:U,type:"FitmentTable",editing:t.editing,children:n(L,{...t})})}function L({num:t,title:s,description:l,showFilter:a,tooltipDefaultOn:d,footnote:f,footnoteLinkText:p,footnoteLinkHref:u,editing:r=!1,omitHead:m=!1,tyreHead:e,template:c,headTemplate:T,nodeId:g}){const o=b(),k=S(r&&!o),i=o?.product??k;if(i?.kind==="tyre")return n(w,{variants:i.source.variants,fieldUsage:o?.fieldUsage??y,num:t,title:e?e.title:s,description:e?e.description:l,editing:r,omitHead:m,keepHiddenHead:e!=null});const x=i?.kind==="alloy-wheel"?i.source.fitments??[]:[];return n(F,{num:t,title:s,description:l,rows:x,showFilter:a,tooltipDefaultOn:d,footnote:f,footnoteLinkText:p,footnoteLinkHref:u,editing:r,omitHead:m,fieldUsage:o?.fieldUsage,template:c,headTemplate:T,nodeId:g})}export{D as default,U as supportedKinds};
@@ -50,7 +50,7 @@ export interface WalletReturnPage {
50
50
  setConfirming(on: boolean): void;
51
51
  land(order: LandingOrder): void;
52
52
  markPaid(): void;
53
- note(message: string): void;
53
+ note(message: string, warning: boolean): void;
54
54
  fail(message: string): void;
55
55
  clearCart(): void;
56
56
  lostChange(): void;
@@ -1 +1 @@
1
- const u="checkout-afterpay-context",s="checkout-gocardless-context",m="checkout-zip-context",d="checkout-klarna-context";function p(e){return e?.lostChange===!0}function g({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function f(e,t){const r=e.getItem(t);if(e.removeItem(t),!r)return null;try{return JSON.parse(r)}catch{return null}}function y(e){const t=e.words?.declined??`${e.name} declined the payment — our team will follow up on payment.`;return{settled:e.words?.settled??`The ${e.name} payment was not completed — our team will follow up on payment.`,declined:t,collecting:e.words?.collecting??t,unconfirmed:e.words?.unconfirmed??`We could not confirm the ${e.name} payment — our team will follow up on payment.`}}const k={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:u,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},h={name:"Zip",legParam:"zip",legValues:["return"],storageKey:m,evidenceFrom(e){const t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})},w={name:"GoCardless",legParam:"gocardless",legValues:["confirm","cancel"],storageKey:s,evidenceFrom:(e,t)=>t==="confirm"?t:null,requestFrom:(e,t)=>({idempotencyKey:t?.idempotencyKey??""}),keyedByParked:!0,words:{settled:"The direct debit was not set up — our team will follow up on payment.",declined:"The direct debit was declined — our team will follow up on payment.",collecting:"Your direct debit is set up — the payment is collecting and will clear in a few days.",unconfirmed:"We could not confirm the direct debit — our team will follow up on payment."}},E={name:"Klarna",legParam:"klarna",legValues:["confirm","cancel"],storageKey:d,evidenceFrom:(e,t)=>t==="confirm"?e.get("authorization_token"):null,requestFrom:(e,t)=>({idempotencyKey:t?.idempotencyKey??"",authorizationToken:e}),keyedByParked:!0,words:{collecting:"Your Klarna payment is being reviewed — we'll confirm the outcome shortly."}};async function T(e,t){const r=new URLSearchParams(t.search),a=r.get(e.legParam);if(!a||!e.legValues.includes(a))return;const i=f(t.storage,e.storageKey),l=e.evidenceFrom(r,a);t.scrubQuery();const n=g({evidence:l,parked:i});if(n.action==="ignore"||e.keyedByParked&&!n.parked)return;const o=y(e);if(t.page.clearCart(),p(n.parked)&&t.page.lostChange(),n.action==="settle"){t.page.note(o.settled),t.page.land(n.parked.confirmation);return}t.page.setConfirming(!0);try{const c=await t.capture(e.requestFrom(n.evidence,n.parked));c.status==="paid"?t.page.markPaid():t.page.note(c.status==="collecting"?o.collecting:o.declined),t.page.land(n.parked?.confirmation??c)}catch{n.parked?(t.page.note(o.unconfirmed),t.page.land(n.parked.confirmation)):t.page.fail(`We could not confirm your ${e.name} payment. Please contact us before trying again — your payment may already have been taken.`)}finally{t.page.setConfirming(!1)}}export{u as AFTERPAY_CONTEXT_KEY,k as AFTERPAY_RETURN,s as GOCARDLESS_CONTEXT_KEY,w as GOCARDLESS_RETURN,d as KLARNA_CONTEXT_KEY,E as KLARNA_RETURN,m as ZIP_CONTEXT_KEY,h as ZIP_RETURN,p as parkedLostChange,f as readParked,g as resolveWalletReturn,T as runWalletReturn};
1
+ const u="checkout-afterpay-context",s="checkout-gocardless-context",m="checkout-zip-context",d="checkout-klarna-context";function g(e){return e?.lostChange===!0}function p({evidence:e,parked:t}){return e?{action:"capture",evidence:e,parked:t}:t?{action:"settle",parked:t}:{action:"ignore"}}function f(e,t){const r=e.getItem(t);if(e.removeItem(t),!r)return null;try{return JSON.parse(r)}catch{return null}}function y(e){const t=e.words?.declined??`${e.name} declined the payment — our team will follow up on payment.`;return{settled:e.words?.settled??`The ${e.name} payment was not completed — our team will follow up on payment.`,declined:t,collecting:e.words?.collecting??t,unconfirmed:e.words?.unconfirmed??`We could not confirm the ${e.name} payment — our team will follow up on payment.`}}const k={name:"Afterpay",legParam:"afterpay",legValues:["confirm","cancel"],storageKey:u,evidenceFrom(e,t){return t==="cancel"||(e.get("status")??"").toUpperCase()==="CANCELLED"?null:e.get("orderToken")},requestFrom:e=>({token:e})},h={name:"Zip",legParam:"zip",legValues:["return"],storageKey:m,evidenceFrom(e){const t=(e.get("result")??"").toLowerCase();return t==="cancelled"||t==="declined"?null:e.get("checkoutId")},requestFrom:e=>({checkoutId:e})},w={name:"GoCardless",legParam:"gocardless",legValues:["confirm","cancel"],storageKey:s,evidenceFrom:(e,t)=>t==="confirm"?t:null,requestFrom:(e,t)=>({idempotencyKey:t?.idempotencyKey??""}),keyedByParked:!0,words:{settled:"The direct debit was not set up — our team will follow up on payment.",declined:"The direct debit was declined — our team will follow up on payment.",collecting:"Your direct debit is set up — the payment is collecting and will clear in a few days.",unconfirmed:"We could not confirm the direct debit — our team will follow up on payment."}},E={name:"Klarna",legParam:"klarna",legValues:["confirm","cancel"],storageKey:d,evidenceFrom:(e,t)=>t==="confirm"?e.get("authorization_token"):null,requestFrom:(e,t)=>({idempotencyKey:t?.idempotencyKey??"",authorizationToken:e}),keyedByParked:!0,words:{collecting:"Your Klarna payment is being reviewed — we'll confirm the outcome shortly."}};async function T(e,t){const r=new URLSearchParams(t.search),a=r.get(e.legParam);if(!a||!e.legValues.includes(a))return;const i=f(t.storage,e.storageKey),l=e.evidenceFrom(r,a);t.scrubQuery();const n=p({evidence:l,parked:i});if(n.action==="ignore"||e.keyedByParked&&!n.parked)return;const o=y(e);if(t.page.clearCart(),g(n.parked)&&t.page.lostChange(),n.action==="settle"){t.page.note(o.settled,!0),t.page.land(n.parked.confirmation);return}t.page.setConfirming(!0);try{const c=await t.capture(e.requestFrom(n.evidence,n.parked));c.status==="paid"?t.page.markPaid():c.status==="collecting"?t.page.note(o.collecting,!e.words?.collecting):t.page.note(o.declined,!0),t.page.land(n.parked?.confirmation??c)}catch{n.parked?(t.page.note(o.unconfirmed,!0),t.page.land(n.parked.confirmation)):t.page.fail(`We could not confirm your ${e.name} payment. Please contact us before trying again — your payment may already have been taken.`)}finally{t.page.setConfirming(!1)}}export{u as AFTERPAY_CONTEXT_KEY,k as AFTERPAY_RETURN,s as GOCARDLESS_CONTEXT_KEY,w as GOCARDLESS_RETURN,d as KLARNA_CONTEXT_KEY,E as KLARNA_RETURN,m as ZIP_CONTEXT_KEY,h as ZIP_RETURN,g as parkedLostChange,f as readParked,p as resolveWalletReturn,T as runWalletReturn};
@@ -0,0 +1,15 @@
1
+ import { type CardRowFieldSpec } from "efficient-web-builder/format/lib/content/card-template";
2
+ import { type BlockSeed } from "efficient-web-builder/format/lib/document/seed-parts";
3
+ import type { SourceRow } from "efficient-web-builder/format/lib/content/block-sources";
4
+ import { type FitmentColumn, type LoadUnit } from "../wheels/fitment-columns.js";
5
+ import type { FitmentRow } from "../wheels/fitments.js";
6
+ export declare const FITMENT_ROW_TEMPLATE_SLOT = "template";
7
+ export declare const FITMENT_ROW_TEMPLATE_LABEL = "Row template";
8
+ export declare const FITMENT_HEAD_TEMPLATE_SLOT = "headTemplate";
9
+ export declare const FITMENT_HEAD_TEMPLATE_LABEL = "Head template";
10
+ export declare const FITMENT_ROW_FIELDS: readonly CardRowFieldSpec[];
11
+ export declare const FITMENT_HEAD_FIELDS: readonly CardRowFieldSpec[];
12
+ export declare const fitmentRowSeed: () => BlockSeed;
13
+ export declare const fitmentHeadSeed: () => BlockSeed;
14
+ export declare function fitmentCardRow(row: FitmentRow, shown: readonly FitmentColumn[], unit: LoadUnit, key: string): SourceRow;
15
+ export declare function fitmentHeadRow(shown: readonly FitmentColumn[], english: (word: string) => string): SourceRow;
@@ -0,0 +1 @@
1
+ import{CARD_TEMPLATE_SLOT as L}from"efficient-web-builder/format/lib/content/card-template";import{rowFieldTextSeed as E}from"efficient-web-builder/format/lib/document/blocks/general/Cards/card-seed";import{DIM as h,INNER_BOX as O,LABEL_FACE as T,TEXT as c,boxPadding as y,token as d}from"efficient-web-builder/format/lib/document/seed-parts";import{BOX_TYPE as S,CONTAINER_BLOCKS_SLOT as w}from"efficient-web-builder/format/lib/document/container-blocks";import{phoneKey as r}from"efficient-easel/draw";import{FITMENT_COLUMNS as a}from"../wheels/fitment-columns.js";const K=L,u="Row template",C="headTemplate",D="Head template",B=a.map(e=>({key:e.fieldKey,label:e.header})),p=e=>`head_${e.fieldKey}`,P=a.map(e=>({key:p(e),label:`${e.header} heading`})),A="diameter",l={textStyle:T.textStyle,...d("label",14),letterSpacing:.06,lineHeight:1.5},N={...T,...d("body",12),letterSpacing:.22,weight:400,lineHeight:1.5},_=a.filter(e=>e.shownByDefault),x={...O,direction:"row",justify:"start",align:"start",share:"equal",phoneRow:2,[r("share")]:"content",[r("wrap")]:"nowrap",widthFit:"fill",gap:32,gapPhone:16,...y(16,16)},m={[r("widthFit")]:"fixed",[r("width")]:120},s=(e,o)=>({type:S,props:{...x,name:e},slots:{[w]:o}}),b=()=>s("Row",_.map(e=>E(e.fieldKey,{...c,name:e.header,tag:"p",...m},e.fieldKey===A?{...l,color:"main"}:l))),W=()=>s("Head",_.map(e=>E(p(e),{...h,name:e.header,tag:"p",...m},N)));function f(e,o,n){const i=new Set(e.map(t=>t.fieldKey));return Object.fromEntries(a.map(t=>[o(t),i.has(t.fieldKey)?n(t):""]))}function k(e,o,n,i){return{key:i,...f(o,t=>t.fieldKey,t=>String(t.cell(e,n)))}}function X(e,o){return{key:"head",...f(e,p,n=>o(n.header))}}export{P as FITMENT_HEAD_FIELDS,D as FITMENT_HEAD_TEMPLATE_LABEL,C as FITMENT_HEAD_TEMPLATE_SLOT,B as FITMENT_ROW_FIELDS,u as FITMENT_ROW_TEMPLATE_LABEL,K as FITMENT_ROW_TEMPLATE_SLOT,k as fitmentCardRow,X as fitmentHeadRow,W as fitmentHeadSeed,b as fitmentRowSeed};
@@ -6,4 +6,14 @@ export declare const FITMENTTABLE_PH: {
6
6
  footnote: string;
7
7
  footnoteLinkText: string;
8
8
  };
9
+ export declare const FitmentTableSlots: {
10
+ headTemplate: {
11
+ type: "slot";
12
+ allow: string[];
13
+ };
14
+ template: {
15
+ type: "slot";
16
+ allow: string[];
17
+ };
18
+ };
9
19
  export declare const FitmentTableMeta: Omit<BlockRender, "render">;
@@ -1 +1 @@
1
- import{PH as t}from"efficient-web-builder/format/lib/document/blocks/placeholders";const e={num:t.sectionNumber,title:"Specifications *table.*",description:t.body,footnote:"Add a short footnote here.",footnoteLinkText:"Contact us"},n={label:"Sizes",defaultProps:{dynamic:!1,num:"",title:"",description:"",wheel:"",showFilter:!0,tooltipDefaultOn:!0,footnote:"",footnoteLinkText:"",footnoteLinkHref:""}};export{e as FITMENTTABLE_PH,n as FitmentTableMeta};
1
+ import{cardTemplateSlot as t}from"efficient-web-builder/format/lib/content/card-template";import{PH as o}from"efficient-web-builder/format/lib/document/blocks/placeholders";import{FITMENT_HEAD_TEMPLATE_SLOT as e}from"../../../../content/fitment-row-seed.js";const a={num:o.sectionNumber,title:"Specifications *table.*",description:o.body,footnote:"Add a short footnote here.",footnoteLinkText:"Contact us"},i={[e]:t(),template:t()},f={label:"Sizes",fields:i,defaultProps:{dynamic:!1,num:"",title:"",description:"",wheel:"",showFilter:!0,tooltipDefaultOn:!0,footnote:"",footnoteLinkText:"",footnoteLinkHref:""}};export{a as FITMENTTABLE_PH,f as FitmentTableMeta,i as FitmentTableSlots};
@@ -1 +1 @@
1
- import{jsx as l}from"react/jsx-runtime";import r from"../../../../../components/pdp-dynamic/FitmentTableBlock.js";import{TYRE_SIZES_HEAD as d}from"../../../../../components/TyreSizeGrid.js";import{hidableText as a}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as c}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as e,phHideDefault as m}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{FitmentTableMeta as T,FITMENTTABLE_PH as i}from"./meta.js";const F={...T,render:t=>{const o=c(t.headPlacement)==="own-box",n=f=>o?void 0:f;return l(r,{dynamic:t.dynamic,wheel:t.wheel,num:n(e(t.num,i.num,t.editor)),title:n(e(t.title,i.title,t.editor)),description:n(e(t.description,i.description,t.editor)),tyreHead:o?void 0:{title:m(t.title,d.title,t.editor),description:m(t.description,d.description,t.editor)},omitHead:o,showFilter:t.showFilter,tooltipDefaultOn:t.tooltipDefaultOn,footnote:e(t.footnote,i.footnote,t.editor),footnoteLinkText:e(t.footnoteLinkText,i.footnoteLinkText,t.editor),footnoteLinkHref:a(t.footnoteLinkHref),editing:t.editor?.isEditing})}};export{F as FitmentTableRender};
1
+ import{jsx as a}from"react/jsx-runtime";import f from"../../../../../components/pdp-dynamic/FitmentTableBlock.js";import{TYRE_SIZES_HEAD as d}from"../../../../../components/TyreSizeGrid.js";import{hidableText as r}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as c}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as t,phHideDefault as m}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{FitmentTableMeta as T,FITMENTTABLE_PH as i}from"./meta.js";const F={...T,render:e=>{const n=c(e.headPlacement)==="own-box",o=l=>n?void 0:l;return a(f,{dynamic:e.dynamic,wheel:e.wheel,num:o(t(e.num,i.num,e.editor)),title:o(t(e.title,i.title,e.editor)),description:o(t(e.description,i.description,e.editor)),tyreHead:n?void 0:{title:m(e.title,d.title,e.editor),description:m(e.description,d.description,e.editor)},omitHead:n,showFilter:e.showFilter,tooltipDefaultOn:e.tooltipDefaultOn,footnote:t(e.footnote,i.footnote,e.editor),footnoteLinkText:t(e.footnoteLinkText,i.footnoteLinkText,e.editor),footnoteLinkHref:r(e.footnoteLinkHref),editing:e.editor?.isEditing,template:e.template,headTemplate:e.headTemplate,nodeId:typeof e.id=="string"?e.id:void 0})}};export{F as FitmentTableRender};
@@ -1 +1 @@
1
- import{CARD_LIST_TYPE as R,CARD_ROW_FIELD_PROP as y,CARD_ROW_LINK_PROP as L,CARD_TEMPLATE_SLOT as d,registerCardTemplates as de}from"efficient-web-builder/format/lib/content/card-template";import{DIM as p,INNER_BOX as o,LABEL_FACE as C,TEXT as n,boxPadding as r,fillSlot as F,labelLook as _,labelStyle as K,seedNodes as k,token as E}from"efficient-web-builder/format/lib/document/seed-parts";import{BOX_SHOW_KEY as M,BOX_SHOW_ON_CARD_HOVER as x,HOVER_KEY as Ee,PICTURE_HOVER_KEYS as Y}from"efficient-web-builder/format/lib/animation/hover";import{BOX_TYPE as a,CONTAINER_BLOCKS_SLOT as i}from"efficient-web-builder/format/lib/document/container-blocks";import{BOX_ROW_IMAGE_PROP as f}from"efficient-web-builder/format/lib/content/box-card-rule";import{POST_CARD_HEIGHT as pe}from"efficient-web-builder/format/lib/post-card-layout";import{EVENTS_FEATURED_DARKEN as _e,EVENTS_FEATURED_DARKEN_STYLE as G,EVENTS_FEATURED_PLACEMENT as ce}from"../content/events-featured-look.js";import{COLLECTION_DARKEN as Te,COLLECTION_HOVER_DARKEN as Oe,COLLECTION_HOVER_ZOOM as U}from"../content/collection-card-look.js";import{COLLECTION_CARD_REGIONS as b,COLLECTION_CARD_TEXT_SIZE as me}from"efficient-web-builder/format/lib/sections/collection-card-text-regions";import{SH_LINK as V}from"efficient-web-builder/render/lib/document/blocks/general/section-to-box-row-parts";import{rowFieldTextSeed as t}from"efficient-web-builder/format/lib/document/blocks/general/Cards/card-seed";import{withRelatedTabletColumns as S}from"../sections/product-grid-columns.js";import{bundleColumns as Le}from"../sections/bundle-to-grid.js";import{HERO_PRICE_BLOCK as be,withHeroPriceTemplate as he}from"../content/hero-price-seed.js";import{HERO_BUY_SLOT as ge,HERO_BUY_SLOT_LABEL as Pe,withHeroBuyTemplate as Re}from"../content/hero-buy-seed.js";import{HERO_OPTION_FIELDS as W,HERO_OPTION_SLOT as ye,HERO_OPTION_SLOT_LABEL as Ce,withHeroOptionTemplate as ke}from"../content/hero-option-seed.js";import{FILTER_OPTIONS_FIELD as fe,withFilterChipsTemplate as Se,withFilterTemplate as Ae}from"../content/filter-card-seed.js";import{FACET_ROW_FIELDS as h,FACET_TEMPLATE_LABEL as v,FACET_TEMPLATE_SLOT as $,withFacetTemplate as X}from"../content/facet-row-seed.js";import{RAIL_HEAD_TEMPLATE_LABEL as ue,RAIL_HEAD_TEMPLATE_SLOT as Ie,RAIL_ROW_FIELDS as A,RAIL_TEMPLATE_LABEL as Ne,RAIL_TEMPLATE_SLOT as we,withRailTemplates as Z}from"../content/rail-row-seed.js";import{MENU_LINK_BLOCK as De,withMenuTemplate as Be}from"../content/menu-card-seed.js";import{CONTACT_CHANNEL_FIELDS as j,CONTACT_CHANNEL_SLOT as He,CONTACT_REASON_FIELDS as Fe,CONTACT_REASON_SLOT as Ke,CONTACT_TOPIC_FIELDS as z,CONTACT_TOPIC_SLOT as Me,withContactTemplates as xe}from"../content/contact-card-seed.js";import{ARTICLE_BODY_BLOCK as Ye,withArticleBodyTemplate as Ge}from"efficient-web-builder/format/lib/document/article-body-seed";import{APPOINTMENT_BOOKING_TYPE as Ue,BOOKING_BOX_TYPE as Ve,BOOKING_OPTION_FIELDS as We,BOOKING_TEMPLATE_SLOTS as ve,withBookingTemplates as $e}from"../content/booking-card-seed.js";import{PRODUCT_BUY_BLOCK as Xe,PRODUCT_CARD_FIELDS as u,PRODUCT_COLOUR_BLOCK as Ze,PRODUCT_EYEBROW_BLOCK as je,PRODUCT_NAME_BLOCK as ze,PRODUCT_PICTURE_BLOCK as qe,PRODUCT_PRICE_BLOCK as Qe,PRODUCT_SIZE_BLOCK as Je,PRODUCT_SPECS_BLOCK as et,productCardSeed as tt,withKitCardTemplate as I,withListingCardTemplate as lt,withProductCardTemplate as N}from"../content/product-card-seed.js";import{ALLOY_WHEELS_LISTING_TYPE as ot,FILTER_BLOCK_TYPE as at,FILTER_CHIPS_TYPE as it,MENU_BLOCK_TYPE as nt,PRODUCT_GRID_TYPE as rt,PRODUCT_HERO_TYPE as st}from"./document-nodes.js";import{withSeededSlot as w}from"../content/seed-ids.js";const q="tags",c=_(12),Q={textStyle:"heading-3",...E("headingSmall",20),weight:500,lineHeight:1.2,letterSpacing:-.02},J={textStyle:"body-1",...E("body",14),lineHeight:1.55},dt={...Q,...E("headingSmall",30)},Et={sectionPaddingTop:24,sectionPaddingRight:28,sectionPaddingBottom:32,sectionPaddingLeft:28,sectionPaddingTopPhone:24,sectionPaddingRightPhone:28,sectionPaddingBottomPhone:32,sectionPaddingLeftPhone:28},pt=pe.fallback,_t=480,ct=70,Tt=()=>({type:a,props:{...o,name:"Featured",[f]:"cover",darken:_e,darkenStyle:G,darkenPhone:ct,darkenStylePhone:G,placement:ce,direction:"column",gap:8,gapPhone:8,...r(32,32,20,20),sectionHeightMode:"fixed",sectionHeightValue:pt,sectionHeightUnit:"px",sectionHeightModePhone:"fixed",sectionHeightValuePhone:_t,sectionHeightUnitPhone:"px",[L]:"href"},slots:{[i]:[t("meta",{...n,tag:"p"},c,!0),t("title",{...n,tag:"h3",widthFit:"fill"},dt),t("excerpt",{...p,tag:"p",widthFit:"fill",maxWidth:384},J),t("dateLabel",{...p,tag:"p"},{...c,color:"muted"})]}}),Ot=()=>({type:a,props:{...o,name:"Post",gap:0,gapPhone:0,...r(0,0,0,0),...F("surface"),shadow:!0},slots:{[i]:[{type:"ImageBlock",props:{[y]:"cover",aspect:"16/10",contained:!1}},{type:a,props:{...o,name:"Words",gap:12,gapPhone:12,...Et},slots:{[i]:[{type:a,props:{...o,name:"Meta",direction:"row",wrap:!0,share:"content",sharePhone:"content",phoneRow:2,gap:12,gapPhone:12,...r(0,0,0,0)},slots:{[i]:[t("meta",{...n,tag:"p"},c,!0),t("dateLabel",{...p,tag:"p"},{...c,color:"muted"},!0)]}},t("title",{...n,tag:"h3",widthFit:"fill"},Q),t("excerpt",{...p,tag:"p",widthFit:"fill"},J),{type:R,props:{[y]:q},slots:{template:[{type:a,props:{...o,name:"Chip",...r(4,8,4,8),sectionBorder:{width:1}},slots:{[i]:[t("label",{...p,tag:"p"},c)]}}]}},{type:"ButtonBlock",props:{variant:"ghost",label:"Read more",href:"",[L]:"href",...V,icon:"arrow-right",iconPosition:"after",_partStyles:{label:K(12)}}}]}}]}}),mt=()=>[Tt(),Ot()];function Lt(e){const l=["featured","post"];return w(e,d,"Events",m=>k(mt(),(s,se)=>{const[D,...B]=se.split("."),H=l[Number(D)]??`card${D}`;return B.length?`${m}~${H}.${B.join(".")}`:`${m}~${H}`}))}const bt={fields:[{key:"cover",label:"Cover",kind:"image",alt:"title"},{key:"meta",label:"Eyebrow"},{key:"dateLabel",label:"Date"},{key:"title",label:"Title"},{key:"excerpt",label:"Excerpt",multiline:!0},{key:"href",label:"Link",kind:"link"},{key:q,label:"Tags",kind:"list",fields:[{key:"label",label:"Tag"}]}],blocks:[{type:R,label:"Card list"}],seedOnInsert:Lt},T=e=>Number(/(\d+)px/.exec(e)?.[1]),O={tag:T(b.tag.builtIn),name:T(b.name.builtIn),namePhone:T(me.namePhone),body:T(b.body.builtIn),link:T(b.link.builtIn)},ht={..._(O.tag),letterSpacing:.25},gt={textStyle:"heading-2",...E("headingMedium",O.name,O.namePhone),weight:500,lineHeight:1,letterSpacing:-.03},Pt={textStyle:"body-1",...E("body",O.body),lineHeight:1.5,paragraphSpacing:12},ee=()=>[t("tag",{...n,tag:"p"},ht,!0),t("name",{...n,tag:"h3",widthFit:"fill"},gt),t("desc",{...n,tag:"p",widthFit:"fill",maxWidth:420},Pt),{type:"ButtonBlock",props:{variant:"ghost",label:"Explore",href:"",[L]:"href",...V,icon:"arrow-right",iconPosition:"after",_partStyles:{label:K(O.link)}}}],te={_hidden:!0,_hiddenTablet:!0,_hiddenPhone:!1},Rt=()=>({type:a,props:{...o,name:"Collection",gap:0,gapPhone:0,...r(0,0,0,0),[L]:"href"},slots:{[i]:[{type:a,props:{...o,name:"Picture",[f]:"image",boxShape:"portrait",darken:Te,placement:"bottom-left",direction:"column",gap:12,gapPhone:12,...r(32,32),hoverZoom:U,hoverDarken:Oe,_hiddenPhone:!0},slots:{[i]:ee()}},{type:"ImageBlock",props:{[y]:"image",aspect:"4/5",contained:!1,hoverZoom:U,...te}},{type:a,props:{...o,name:"Words",gap:12,gapPhone:12,...r(24,24),...F("surface"),...te},slots:{[i]:ee()}}]}});function yt(e){return w(e,d,"Collections",l=>k([Rt()],(m,s)=>`${l}~card${s?`.${s}`:""}`))}const Ct={fields:[{key:"tag",label:"Eyebrow"},{key:"name",label:"Title"},{key:"desc",label:"Description",multiline:!0},{key:"image",label:"Image",kind:"image",alt:"name"},{key:"href",label:"Link",kind:"link"}],seedOnInsert:yt},kt=35,ft=50,St=106,At=85,ut="nextImage",It="#f5f1e8",le="#c4c1ba",oe={...C,..._(11),letterSpacing:.24,color:"main"},Nt={...oe,color:le},wt={...C,..._(12,11),color:"main"},Dt={textStyle:"heading-3",...E("headingSmall",22,16),weight:500,lineHeight:1.05,letterSpacing:-.02,color:It},Bt={...C,..._(12),letterSpacing:.12,color:le},g=r(0,0,0,0),Ht=()=>({type:a,props:{...o,name:"Tile",placement:"top-left",share:"content",gap:0,gapPhone:0,...g,[f]:"image",boxShape:"square",darken:kt,[Ee]:ut,[Y.zoom]:St,[Y.darken]:ft},slots:{[i]:[{type:a,props:{...o,name:"Top row",direction:"row",justify:"between",align:"start",share:"content",phoneRow:2,sharePhone:"content",wrapPhone:"nowrap",widthFit:"fill",gap:8,gapPhone:8,...g,sectionPaddingTop:12,sectionPaddingLeft:12,sectionPaddingRight:12,sectionPaddingTopPhone:10,sectionPaddingLeftPhone:10,sectionPaddingRightPhone:10},slots:{[i]:[{type:a,props:{...o,name:"Tag",direction:"row",share:"content",minWidth:0,...g,[M]:x},slots:{[i]:[t("tag",{...n,tag:"p",textFit:"ellipsis"},oe)]}},t("number",{...n,tag:"p",textFit:"line"},Nt)]}},{type:a,props:{...o,name:"Words",justify:"end",align:"start",placement:"bottom-left",share:"content",widthFit:"fill",sectionHeightMode:"fill",gap:8,gapPhone:8,...r(24,24,12,14),sectionPaddingTopPhone:4,darken:At,darkenStyle:"bottom",[M]:x},slots:{[i]:[{type:a,props:{...o,name:"Heading",widthFit:"fill",gap:4,gapPhone:4,...g},slots:{[i]:[t("eyebrow",{...n,tag:"p",_hiddenPhone:!0},wt),t("name",{...n,tag:"h3"},Dt)]}},t("meta",{...n,tag:"p"},Bt)]}}]}});function Ft(e){return w(e,d,"GalleryB",l=>k([Ht()],(m,s)=>`${l}~tile${s?`.${s}`:""}`))}const Kt={fields:[{key:"image",label:"Image",kind:"image",alt:"name"},{key:"tag",label:"Tag"},{key:"number",label:"Card number"},{key:"eyebrow",label:"Eyebrow"},{key:"name",label:"Title"},{key:"meta",label:"Meta"},{key:"href",label:"Product link",kind:"link"}],seedOnInsert:Ft},Mt=["showCardPrice","showCardFinishes","showCardSizes","showCardBuy","showCardPage"],xt=e=>Object.fromEntries(Object.entries(e).filter(([l])=>!Mt.includes(l))),ae={fields:[{key:"label",label:"Label"},{key:"href",label:"Link",kind:"link"}],blocks:[{type:De,label:"Menu link"}],seed:Be},ie=e=>e.dynamic===!0&&e.relationship==="bundles",cl=(e={})=>tt(e),P={fields:u,blocks:[{type:qe,label:"Picture"},{type:je,label:"Eyebrow"},{type:ze,label:"Name"},{type:et,label:"Specs"},{type:Qe,label:"Price"},{type:Ze,label:"Colour"},{type:Je,label:"Size"},{type:Xe,label:"Buy"}],seed:e=>{if(e.dynamic!==!0)return N(e);const l=S(e);return ie(e)?I(l):N(l)}},ne=[{key:"label",label:"Filter name"},{key:fe,label:"Options",kind:"list",fields:[{key:"label",label:"Option"},{key:"count",label:"Count"}]}],re=[{slot:we,label:Ne,fields:A},{slot:Ie,label:ue,fields:[]}],Yt=[{block:"Reviews",fields:[{key:"quote",label:"Quote"},{key:"title",label:"Title"},{key:"name",label:"Name"},{key:"role",label:"Role · location"},{key:"rating",label:"Rating"},{key:"dateLabel",label:"Date"}],blocks:[{type:"RatingBlock",label:"Rating"}]},{block:"SpecTable",fields:[{key:"label",label:"Label"},{key:"value",label:"Value"}]},{block:"DetailRows",fields:[{key:"eyebrow",label:"Eyebrow"},{key:"title",label:"Title"},{key:"copy",label:"Body",multiline:!0},{key:"image",label:"Image",kind:"image",alt:"title"},{key:"tag",label:"Image tag"}]},{block:"FooterMenu",...ae},{block:nt,...ae},{block:rt,...P},{block:ot,...P,slots:[{slot:d,fields:u},{slot:$,label:v,fields:h},...re],fields:[...u,...h,...A],seed:e=>Z(X(lt(e)))},{block:"RelatedProducts",...P,seed:e=>{const l=S({...xt(e),dynamic:!0});return ie(l)?I(l):N(l,{legacyWellHonoured:!0})}},{block:"BundleOffer",...P,seed:e=>I(S({...e,columns:Le(e),dynamic:!0}))},{block:st,slots:[{slot:d,fields:[]},{slot:ye,label:Ce,fields:W},{slot:ge,label:Pe,fields:[]}],fields:W,blocks:[{type:be,label:"Price"}],seed:e=>Re(ke(he(e)))},{block:at,slots:[{slot:d,fields:ne},{slot:$,label:v,fields:h},...re],fields:[...ne,...h,...A],blocks:[{type:R,label:"Card list"}],seed:e=>Z(X(Ae(e)))},{block:it,fields:[{key:"label",label:"Pick"},{key:"mark",label:"Remove mark"}],seed:Se},{block:"ContactRouting",slots:[{slot:Me,label:"Topic card",fields:z},{slot:Ke,label:"Reason chip",fields:Fe},{slot:He,label:"Channel row",fields:j}],fields:[...z,...j],seed:xe},{block:Ye,fields:[{key:"heading",label:"Subhead"},{key:"paragraph",label:"Paragraph",multiline:!0}],seed:Ge},...[Ve,Ue].map(e=>({block:e,slots:ve,fields:We,seed:l=>$e(e,l)})),{block:"Events",...bt},{block:"Collections",...Ct},{block:"GalleryB",...Kt}];de(Yt);export{Yt as STOREFRONT_CARD_TEMPLATES,Rt as collectionCardSeed,ie as drawsKits,mt as eventsCardSeeds,Ht as galleryTileSeed,cl as productGridCardSeed,yt as withCollectionsTemplate,Lt as withEventsTemplate,Ft as withGalleryTemplate};
1
+ import{CARD_LIST_TYPE as R,CARD_ROW_FIELD_PROP as y,CARD_ROW_LINK_PROP as m,CARD_TEMPLATE_SLOT as E,registerCardTemplates as de}from"efficient-web-builder/format/lib/content/card-template";import{DIM as d,INNER_BOX as o,LABEL_FACE as C,TEXT as n,boxPadding as r,fillSlot as H,labelLook as T,labelStyle as K,seedNodes as f,token as _}from"efficient-web-builder/format/lib/document/seed-parts";import{BOX_SHOW_KEY as M,BOX_SHOW_ON_CARD_HOVER as x,HOVER_KEY as Te,PICTURE_HOVER_KEYS as Y}from"efficient-web-builder/format/lib/animation/hover";import{BOX_TYPE as a,CONTAINER_BLOCKS_SLOT as i}from"efficient-web-builder/format/lib/document/container-blocks";import{BOX_ROW_IMAGE_PROP as k}from"efficient-web-builder/format/lib/content/box-card-rule";import{POST_CARD_HEIGHT as pe}from"efficient-web-builder/format/lib/post-card-layout";import{EVENTS_FEATURED_DARKEN as ce,EVENTS_FEATURED_DARKEN_STYLE as G,EVENTS_FEATURED_PLACEMENT as Oe}from"../content/events-featured-look.js";import{COLLECTION_DARKEN as Le,COLLECTION_HOVER_DARKEN as me,COLLECTION_HOVER_ZOOM as U}from"../content/collection-card-look.js";import{COLLECTION_CARD_REGIONS as b,COLLECTION_CARD_TEXT_SIZE as be}from"efficient-web-builder/format/lib/sections/collection-card-text-regions";import{SH_LINK as V}from"efficient-web-builder/render/lib/document/blocks/general/section-to-box-row-parts";import{rowFieldTextSeed as t}from"efficient-web-builder/format/lib/document/blocks/general/Cards/card-seed";import{withRelatedTabletColumns as S}from"../sections/product-grid-columns.js";import{bundleColumns as he}from"../sections/bundle-to-grid.js";import{HERO_PRICE_BLOCK as ge,withHeroPriceTemplate as Pe}from"../content/hero-price-seed.js";import{HERO_BUY_SLOT as Re,HERO_BUY_SLOT_LABEL as ye,withHeroBuyTemplate as Ce}from"../content/hero-buy-seed.js";import{HERO_OPTION_FIELDS as W,HERO_OPTION_SLOT as fe,HERO_OPTION_SLOT_LABEL as ke,withHeroOptionTemplate as Se}from"../content/hero-option-seed.js";import{FILTER_OPTIONS_FIELD as Ae,withFilterChipsTemplate as Ie,withFilterTemplate as ue}from"../content/filter-card-seed.js";import{FACET_ROW_FIELDS as h,FACET_TEMPLATE_LABEL as v,FACET_TEMPLATE_SLOT as $,withFacetTemplate as X}from"../content/facet-row-seed.js";import{RAIL_HEAD_TEMPLATE_LABEL as Ne,RAIL_HEAD_TEMPLATE_SLOT as De,RAIL_ROW_FIELDS as A,RAIL_TEMPLATE_LABEL as we,RAIL_TEMPLATE_SLOT as Be,withRailTemplates as Z}from"../content/rail-row-seed.js";import{MENU_LINK_BLOCK as Fe,withMenuTemplate as He}from"../content/menu-card-seed.js";import{CONTACT_CHANNEL_FIELDS as j,CONTACT_CHANNEL_SLOT as Ke,CONTACT_REASON_FIELDS as Me,CONTACT_REASON_SLOT as xe,CONTACT_TOPIC_FIELDS as z,CONTACT_TOPIC_SLOT as Ye,withContactTemplates as Ge}from"../content/contact-card-seed.js";import{ARTICLE_BODY_BLOCK as Ue,withArticleBodyTemplate as Ve}from"efficient-web-builder/format/lib/document/article-body-seed";import{APPOINTMENT_BOOKING_TYPE as We,BOOKING_BOX_TYPE as ve,BOOKING_OPTION_FIELDS as $e,BOOKING_TEMPLATE_SLOTS as Xe,withBookingTemplates as Ze}from"../content/booking-card-seed.js";import{PRODUCT_BUY_BLOCK as je,PRODUCT_CARD_FIELDS as I,PRODUCT_COLOUR_BLOCK as ze,PRODUCT_EYEBROW_BLOCK as qe,PRODUCT_NAME_BLOCK as Qe,PRODUCT_PICTURE_BLOCK as Je,PRODUCT_PRICE_BLOCK as et,PRODUCT_SIZE_BLOCK as tt,PRODUCT_SPECS_BLOCK as lt,productCardSeed as ot,withKitCardTemplate as u,withListingCardTemplate as at,withProductCardTemplate as N}from"../content/product-card-seed.js";import{ALLOY_WHEELS_LISTING_TYPE as it,FILTER_BLOCK_TYPE as nt,FILTER_CHIPS_TYPE as rt,MENU_BLOCK_TYPE as st,PRODUCT_GRID_TYPE as Et,PRODUCT_HERO_TYPE as _t}from"./document-nodes.js";import{withSeededSlot as D}from"../content/seed-ids.js";import{FITMENT_HEAD_FIELDS as q,FITMENT_HEAD_TEMPLATE_LABEL as dt,FITMENT_HEAD_TEMPLATE_SLOT as Tt,FITMENT_ROW_FIELDS as Q,FITMENT_ROW_TEMPLATE_LABEL as pt,FITMENT_ROW_TEMPLATE_SLOT as ct}from"../content/fitment-row-seed.js";const J="tags",p=T(12),ee={textStyle:"heading-3",..._("headingSmall",20),weight:500,lineHeight:1.2,letterSpacing:-.02},te={textStyle:"body-1",..._("body",14),lineHeight:1.55},Ot={...ee,..._("headingSmall",30)},Lt={sectionPaddingTop:24,sectionPaddingRight:28,sectionPaddingBottom:32,sectionPaddingLeft:28,sectionPaddingTopPhone:24,sectionPaddingRightPhone:28,sectionPaddingBottomPhone:32,sectionPaddingLeftPhone:28},mt=pe.fallback,bt=480,ht=70,gt=()=>({type:a,props:{...o,name:"Featured",[k]:"cover",darken:ce,darkenStyle:G,darkenPhone:ht,darkenStylePhone:G,placement:Oe,direction:"column",gap:8,gapPhone:8,...r(32,32,20,20),sectionHeightMode:"fixed",sectionHeightValue:mt,sectionHeightUnit:"px",sectionHeightModePhone:"fixed",sectionHeightValuePhone:bt,sectionHeightUnitPhone:"px",[m]:"href"},slots:{[i]:[t("meta",{...n,tag:"p"},p,!0),t("title",{...n,tag:"h3",widthFit:"fill"},Ot),t("excerpt",{...d,tag:"p",widthFit:"fill",maxWidth:384},te),t("dateLabel",{...d,tag:"p"},{...p,color:"muted"})]}}),Pt=()=>({type:a,props:{...o,name:"Post",gap:0,gapPhone:0,...r(0,0,0,0),...H("surface"),shadow:!0},slots:{[i]:[{type:"ImageBlock",props:{[y]:"cover",aspect:"16/10",contained:!1}},{type:a,props:{...o,name:"Words",gap:12,gapPhone:12,...Lt},slots:{[i]:[{type:a,props:{...o,name:"Meta",direction:"row",wrap:!0,share:"content",sharePhone:"content",phoneRow:2,gap:12,gapPhone:12,...r(0,0,0,0)},slots:{[i]:[t("meta",{...n,tag:"p"},p,!0),t("dateLabel",{...d,tag:"p"},{...p,color:"muted"},!0)]}},t("title",{...n,tag:"h3",widthFit:"fill"},ee),t("excerpt",{...d,tag:"p",widthFit:"fill"},te),{type:R,props:{[y]:J},slots:{template:[{type:a,props:{...o,name:"Chip",...r(4,8,4,8),sectionBorder:{width:1}},slots:{[i]:[t("label",{...d,tag:"p"},p)]}}]}},{type:"ButtonBlock",props:{variant:"ghost",label:"Read more",href:"",[m]:"href",...V,icon:"arrow-right",iconPosition:"after",_partStyles:{label:K(12)}}}]}}]}}),Rt=()=>[gt(),Pt()];function yt(e){const l=["featured","post"];return D(e,E,"Events",L=>f(Rt(),(s,_e)=>{const[w,...B]=_e.split("."),F=l[Number(w)]??`card${w}`;return B.length?`${L}~${F}.${B.join(".")}`:`${L}~${F}`}))}const Ct={fields:[{key:"cover",label:"Cover",kind:"image",alt:"title"},{key:"meta",label:"Eyebrow"},{key:"dateLabel",label:"Date"},{key:"title",label:"Title"},{key:"excerpt",label:"Excerpt",multiline:!0},{key:"href",label:"Link",kind:"link"},{key:J,label:"Tags",kind:"list",fields:[{key:"label",label:"Tag"}]}],blocks:[{type:R,label:"Card list"}],seedOnInsert:yt},c=e=>Number(/(\d+)px/.exec(e)?.[1]),O={tag:c(b.tag.builtIn),name:c(b.name.builtIn),namePhone:c(be.namePhone),body:c(b.body.builtIn),link:c(b.link.builtIn)},ft={...T(O.tag),letterSpacing:.25},kt={textStyle:"heading-2",..._("headingMedium",O.name,O.namePhone),weight:500,lineHeight:1,letterSpacing:-.03},St={textStyle:"body-1",..._("body",O.body),lineHeight:1.5,paragraphSpacing:12},le=()=>[t("tag",{...n,tag:"p"},ft,!0),t("name",{...n,tag:"h3",widthFit:"fill"},kt),t("desc",{...n,tag:"p",widthFit:"fill",maxWidth:420},St),{type:"ButtonBlock",props:{variant:"ghost",label:"Explore",href:"",[m]:"href",...V,icon:"arrow-right",iconPosition:"after",_partStyles:{label:K(O.link)}}}],oe={_hidden:!0,_hiddenTablet:!0,_hiddenPhone:!1},At=()=>({type:a,props:{...o,name:"Collection",gap:0,gapPhone:0,...r(0,0,0,0),[m]:"href"},slots:{[i]:[{type:a,props:{...o,name:"Picture",[k]:"image",boxShape:"portrait",darken:Le,placement:"bottom-left",direction:"column",gap:12,gapPhone:12,...r(32,32),hoverZoom:U,hoverDarken:me,_hiddenPhone:!0},slots:{[i]:le()}},{type:"ImageBlock",props:{[y]:"image",aspect:"4/5",contained:!1,hoverZoom:U,...oe}},{type:a,props:{...o,name:"Words",gap:12,gapPhone:12,...r(24,24),...H("surface"),...oe},slots:{[i]:le()}}]}});function It(e){return D(e,E,"Collections",l=>f([At()],(L,s)=>`${l}~card${s?`.${s}`:""}`))}const ut={fields:[{key:"tag",label:"Eyebrow"},{key:"name",label:"Title"},{key:"desc",label:"Description",multiline:!0},{key:"image",label:"Image",kind:"image",alt:"name"},{key:"href",label:"Link",kind:"link"}],seedOnInsert:It},Nt=35,Dt=50,wt=106,Bt=85,Ft="nextImage",Ht="#f5f1e8",ae="#c4c1ba",ie={...C,...T(11),letterSpacing:.24,color:"main"},Kt={...ie,color:ae},Mt={...C,...T(12,11),color:"main"},xt={textStyle:"heading-3",..._("headingSmall",22,16),weight:500,lineHeight:1.05,letterSpacing:-.02,color:Ht},Yt={...C,...T(12),letterSpacing:.12,color:ae},g=r(0,0,0,0),Gt=()=>({type:a,props:{...o,name:"Tile",placement:"top-left",share:"content",gap:0,gapPhone:0,...g,[k]:"image",boxShape:"square",darken:Nt,[Te]:Ft,[Y.zoom]:wt,[Y.darken]:Dt},slots:{[i]:[{type:a,props:{...o,name:"Top row",direction:"row",justify:"between",align:"start",share:"content",phoneRow:2,sharePhone:"content",wrapPhone:"nowrap",widthFit:"fill",gap:8,gapPhone:8,...g,sectionPaddingTop:12,sectionPaddingLeft:12,sectionPaddingRight:12,sectionPaddingTopPhone:10,sectionPaddingLeftPhone:10,sectionPaddingRightPhone:10},slots:{[i]:[{type:a,props:{...o,name:"Tag",direction:"row",share:"content",minWidth:0,...g,[M]:x},slots:{[i]:[t("tag",{...n,tag:"p",textFit:"ellipsis"},ie)]}},t("number",{...n,tag:"p",textFit:"line"},Kt)]}},{type:a,props:{...o,name:"Words",justify:"end",align:"start",placement:"bottom-left",share:"content",widthFit:"fill",sectionHeightMode:"fill",gap:8,gapPhone:8,...r(24,24,12,14),sectionPaddingTopPhone:4,darken:Bt,darkenStyle:"bottom",[M]:x},slots:{[i]:[{type:a,props:{...o,name:"Heading",widthFit:"fill",gap:4,gapPhone:4,...g},slots:{[i]:[t("eyebrow",{...n,tag:"p",_hiddenPhone:!0},Mt),t("name",{...n,tag:"h3"},xt)]}},t("meta",{...n,tag:"p"},Yt)]}}]}});function Ut(e){return D(e,E,"GalleryB",l=>f([Gt()],(L,s)=>`${l}~tile${s?`.${s}`:""}`))}const Vt={fields:[{key:"image",label:"Image",kind:"image",alt:"name"},{key:"tag",label:"Tag"},{key:"number",label:"Card number"},{key:"eyebrow",label:"Eyebrow"},{key:"name",label:"Title"},{key:"meta",label:"Meta"},{key:"href",label:"Product link",kind:"link"}],seedOnInsert:Ut},Wt=["showCardPrice","showCardFinishes","showCardSizes","showCardBuy","showCardPage"],vt=e=>Object.fromEntries(Object.entries(e).filter(([l])=>!Wt.includes(l))),ne={fields:[{key:"label",label:"Label"},{key:"href",label:"Link",kind:"link"}],blocks:[{type:Fe,label:"Menu link"}],seed:He},re=e=>e.dynamic===!0&&e.relationship==="bundles",gl=(e={})=>ot(e),P={fields:I,blocks:[{type:Je,label:"Picture"},{type:qe,label:"Eyebrow"},{type:Qe,label:"Name"},{type:lt,label:"Specs"},{type:et,label:"Price"},{type:ze,label:"Colour"},{type:tt,label:"Size"},{type:je,label:"Buy"}],seed:e=>{if(e.dynamic!==!0)return N(e);const l=S(e);return re(e)?u(l):N(l)}},se=[{key:"label",label:"Filter name"},{key:Ae,label:"Options",kind:"list",fields:[{key:"label",label:"Option"},{key:"count",label:"Count"}]}],Ee=[{slot:Be,label:we,fields:A},{slot:De,label:Ne,fields:[]}],$t=[{block:"Reviews",fields:[{key:"quote",label:"Quote"},{key:"title",label:"Title"},{key:"name",label:"Name"},{key:"role",label:"Role · location"},{key:"rating",label:"Rating"},{key:"dateLabel",label:"Date"}],blocks:[{type:"RatingBlock",label:"Rating"}]},{block:"SpecTable",fields:[{key:"label",label:"Label"},{key:"value",label:"Value"}]},{block:"DetailRows",fields:[{key:"eyebrow",label:"Eyebrow"},{key:"title",label:"Title"},{key:"copy",label:"Body",multiline:!0},{key:"image",label:"Image",kind:"image",alt:"title"},{key:"tag",label:"Image tag"}]},{block:"FooterMenu",...ne},{block:st,...ne},{block:Et,...P},{block:it,...P,slots:[{slot:E,fields:I},{slot:$,label:v,fields:h},...Ee],fields:[...I,...h,...A],seed:e=>Z(X(at(e)))},{block:"RelatedProducts",...P,seed:e=>{const l=S({...vt(e),dynamic:!0});return re(l)?u(l):N(l,{legacyWellHonoured:!0})}},{block:"BundleOffer",...P,seed:e=>u(S({...e,columns:he(e),dynamic:!0}))},{block:_t,slots:[{slot:E,fields:[]},{slot:fe,label:ke,fields:W},{slot:Re,label:ye,fields:[]}],fields:W,blocks:[{type:ge,label:"Price"}],seed:e=>Ce(Se(Pe(e)))},{block:nt,slots:[{slot:E,fields:se},{slot:$,label:v,fields:h},...Ee],fields:[...se,...h,...A],blocks:[{type:R,label:"Card list"}],seed:e=>Z(X(ue(e)))},{block:rt,fields:[{key:"label",label:"Pick"},{key:"mark",label:"Remove mark"}],seed:Ie},{block:"ContactRouting",slots:[{slot:Ye,label:"Topic card",fields:z},{slot:xe,label:"Reason chip",fields:Me},{slot:Ke,label:"Channel row",fields:j}],fields:[...z,...j],seed:Ge},{block:Ue,fields:[{key:"heading",label:"Subhead"},{key:"paragraph",label:"Paragraph",multiline:!0}],seed:Ve},...[ve,We].map(e=>({block:e,slots:Xe,fields:$e,seed:l=>Ze(e,l)})),{block:"Events",...Ct},{block:"Collections",...ut},{block:"GalleryB",...Vt},{block:"FitmentTable",fields:[...q,...Q],slots:[{slot:Tt,label:dt,fields:q},{slot:ct,label:pt,fields:Q}]}];de($t);export{$t as STOREFRONT_CARD_TEMPLATES,At as collectionCardSeed,re as drawsKits,Rt as eventsCardSeeds,Gt as galleryTileSeed,gl as productGridCardSeed,It as withCollectionsTemplate,yt as withEventsTemplate,Ut as withGalleryTemplate};
@@ -7,6 +7,7 @@ import "./section-to-box-rows-productgrid.js";
7
7
  import "./section-to-box-rows-events.js";
8
8
  import "./section-to-box-rows-collections.js";
9
9
  import "./section-to-box-rows-gallery.js";
10
+ import "./section-to-box-rows-fitment.js";
10
11
  import "./section-to-box-rows-detail.js";
11
12
  import "./section-to-box-rows-service.js";
12
13
  import "./section-to-box-rows-listing.js";
@@ -1 +1 @@
1
- import{Fragment as h,jsx as E}from"react/jsx-runtime";import{generalRenderMetas as g}from"efficient-web-builder/format/lib/document/blocks/general/metas";import{finishRenderRegistry as S}from"efficient-web-builder/render/lib/document/render-registry";import{buildBlockCategories as R}from"efficient-web-builder/format/lib/document/section-catalog";import{SITE_HEADER_TYPE as a}from"efficient-web-builder/format/lib/document/section-groups";import"./slot-seeds.js";import"./card-templates.js";import"./section-to-box-rows-reviews.js";import"./section-to-box-rows-spec.js";import"./section-to-box-rows-productgrid.js";import"./section-to-box-rows-events.js";import"./section-to-box-rows-collections.js";import"./section-to-box-rows-gallery.js";import"./section-to-box-rows-detail.js";import"./section-to-box-rows-service.js";import"./section-to-box-rows-listing.js";import{COMMERCE_METAS as _}from"./blocks/commerce/metas.js";import{SERVICE_METAS as O}from"./blocks/service/metas.js";import P from"./blocks/text-part-shapes.json";import{addPageBlocksFromFooter as b}from"./footer-page-blocks.js";import{LAZY_DRAWS as f}from"./lazy-draws.js";import{drawPublishedStorefrontRoot as k}from"./storefront-root.js";import{withShopperAddressMark as T}from"../../components/catalog/ShopperScope.js";import{SHOPPER_BLOCK_TYPES as j}from"../wheels/shopper-first-paint.js";const l=P,w=(t,e)=>{const r=Object.hasOwn(l,t)?l[t]:void 0;return{...e,...r?{textParts:r}:null}};let p=null;function d(){if(p)return p;const t={},e=g();for(const o of Object.keys(e))t[o]={...e[o],render:f[o]};const r={..._,...O};for(const o of Object.keys(r)){const m=j.has(o)?T(f[o]):f[o];t[o]=w(o,{...r[o],render:m})}b(t);const n={root:{render:k},categories:R(),components:t};return S(n),p=n,n}function x(t=d()){const e=t.components,r=Object.keys(e),n=new Set([a]),o=[a];for(;o.length;){const m=o.shift();for(const c of Object.values(e[m]?.fields??{})){if(c?.type!=="slot")continue;const u=c.allow??r.filter(s=>!c.disallow?.includes(s));for(const s of u)n.has(s)||!(s in e)||(n.add(s),o.push(s))}}return[...n]}let i=null;function $(){if(i)return i;const t=d(),e=t.components;return i={...t,root:{render:({children:r})=>E(h,{children:r})},components:Object.fromEntries(x(t).map(r=>[r,e[r]]))},i}export{w as drawnBlock,$ as headerRenderConfig,d as renderConfig};
1
+ import{Fragment as h,jsx as E}from"react/jsx-runtime";import{generalRenderMetas as g}from"efficient-web-builder/format/lib/document/blocks/general/metas";import{finishRenderRegistry as S}from"efficient-web-builder/render/lib/document/render-registry";import{buildBlockCategories as R}from"efficient-web-builder/format/lib/document/section-catalog";import{SITE_HEADER_TYPE as a}from"efficient-web-builder/format/lib/document/section-groups";import"./slot-seeds.js";import"./card-templates.js";import"./section-to-box-rows-reviews.js";import"./section-to-box-rows-spec.js";import"./section-to-box-rows-productgrid.js";import"./section-to-box-rows-events.js";import"./section-to-box-rows-collections.js";import"./section-to-box-rows-gallery.js";import"./section-to-box-rows-fitment.js";import"./section-to-box-rows-detail.js";import"./section-to-box-rows-service.js";import"./section-to-box-rows-listing.js";import{COMMERCE_METAS as _}from"./blocks/commerce/metas.js";import{SERVICE_METAS as O}from"./blocks/service/metas.js";import P from"./blocks/text-part-shapes.json";import{addPageBlocksFromFooter as b}from"./footer-page-blocks.js";import{LAZY_DRAWS as p}from"./lazy-draws.js";import{drawPublishedStorefrontRoot as k}from"./storefront-root.js";import{withShopperAddressMark as T}from"../../components/catalog/ShopperScope.js";import{SHOPPER_BLOCK_TYPES as j}from"../wheels/shopper-first-paint.js";const l=P,w=(t,e)=>{const r=Object.hasOwn(l,t)?l[t]:void 0;return{...e,...r?{textParts:r}:null}};let f=null;function d(){if(f)return f;const t={},e=g();for(const o of Object.keys(e))t[o]={...e[o],render:p[o]};const r={..._,...O};for(const o of Object.keys(r)){const m=j.has(o)?T(p[o]):p[o];t[o]=w(o,{...r[o],render:m})}b(t);const n={root:{render:k},categories:R(),components:t};return S(n),f=n,n}function x(t=d()){const e=t.components,r=Object.keys(e),n=new Set([a]),o=[a];for(;o.length;){const m=o.shift();for(const c of Object.values(e[m]?.fields??{})){if(c?.type!=="slot")continue;const u=c.allow??r.filter(s=>!c.disallow?.includes(s));for(const s of u)n.has(s)||!(s in e)||(n.add(s),o.push(s))}}return[...n]}let i=null;function oo(){if(i)return i;const t=d(),e=t.components;return i={...t,root:{render:({children:r})=>E(h,{children:r})},components:Object.fromEntries(x(t).map(r=>[r,e[r]]))},i}export{w as drawnBlock,oo as headerRenderConfig,d as renderConfig};
@@ -0,0 +1 @@
1
+ import{registerSectionToBox as t}from"efficient-web-builder/render/lib/sections/section-to-box";import{headOnlyRow as e}from"efficient-web-builder/render/lib/document/blocks/general/section-to-box-rows-head";import{lineSides as m}from"efficient-web-builder/render/lib/document/blocks/general/section-to-box-row-parts";import{FITMENT_HEAD_TEMPLATE_SLOT as r,FITMENT_ROW_TEMPLATE_SLOT as i,fitmentHeadSeed as n,fitmentRowSeed as T}from"../content/fitment-row-seed.js";import{bandRoomBelow as E}from"../sections/section-band.js";import{SPEC_TABLE_BAND as b}from"../sections/spec-table-band.js";const o=E(b.ownBox);t({FitmentTable:e("FitmentTable",{slots:{[i]:[T()],[r]:[n()]},roomBelow:{bottom:o.bottom,bottomPhone:o.bottomPhone},boxProps:o.line?{sectionBorder:m({bottom:1})}:{},pressHeading:!0})});
package/dist/words.d.ts CHANGED
@@ -1833,6 +1833,7 @@ export type StorefrontBlocksPhrase =
1833
1833
  | "Group covers"
1834
1834
  | "Group {n}"
1835
1835
  | "Groups"
1836
+ | "Head template"
1836
1837
  | "Header button"
1837
1838
  | "Header link"
1838
1839
  | "Header settings"
@@ -2095,6 +2096,7 @@ export type StorefrontBlocksPhrase =
2095
2096
  | "Rim Profile"
2096
2097
  | "Routing groups"
2097
2098
  | "Row shape"
2099
+ | "Row template"
2098
2100
  | "Row {n}"
2099
2101
  | "Rows from"
2100
2102
  | "S"