efficient-storefront-blocks 0.132.0 → 0.132.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.
@@ -4458,7 +4458,8 @@ em.text-accent {
4458
4458
  position: static;
4459
4459
  margin: 0;
4460
4460
  }
4461
- .sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-part="image-frame"] > [data-part="image"] {
4461
+ .sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-part="image-frame"] > [data-part="image"],
4462
+ .sf-card-ground-studio [data-part="box"]:has(> * > [data-part="image-block"]) [data-part="image-frame"] > * > [data-picture-zoom] {
4462
4463
  position: absolute;
4463
4464
  left: 11.5cqw;
4464
4465
  top: 28.6cqw;
@@ -4630,6 +4631,7 @@ em.text-accent {
4630
4631
  background-image: none;
4631
4632
  }
4632
4633
  .sf-card-ground-studio.sf-card-words-over [data-part="box"]:has(> * > [data-part="box"] > * > [data-part="image-block"]:only-child) > * > [data-part="box"]:has(> * > [data-part="image-block"]:only-child) [data-part="image-frame"] > [data-part="image"],
4634
+ .sf-card-ground-studio.sf-card-words-over [data-part="box"]:has(> * > [data-part="box"] > * > [data-part="image-block"]:only-child) > * > [data-part="box"]:has(> * > [data-part="image-block"]:only-child) [data-part="image-frame"] > * > [data-picture-zoom],
4633
4635
  .sf-card-ground-studio.sf-card-words-over [data-part="box"]:has(> * > [data-part="box"] > * > [data-part="image-block"]:only-child) > * > [data-part="box"]:has(> * > [data-part="image-block"]:only-child) [data-hover-media][data-hover-fit="contain"] > img {
4634
4636
  left: calc(50% - var(--sf-studio-over-wheel) / 2);
4635
4637
  top: calc(100% - var(--sf-studio-over-wheel));
@@ -83,6 +83,8 @@ interface CartCtx {
83
83
  appliedBundles: AppliedBundle[];
84
84
  shipping: number;
85
85
  freeShipping: boolean;
86
+ deliveryDiscountPercent: number;
87
+ deliverySaving: number;
86
88
  shippingStatus: ShippingStatus;
87
89
  freeUnitsByPartNumber: Record<string, number>;
88
90
  tax: CartQuoteTax | null;
@@ -1 +1 @@
1
- "use client";import{jsx as oe}from"react/jsx-runtime";import{createContext as re,useCallback as a,useContext as se,useEffect as p,useMemo as xt,useRef as g,useState as i}from"react";import{usePathname as ue}from"next/navigation";import{products as C}from"../lib/api/index.js";import{couponDeferredToCheckout as ce}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as Dt}from"../lib/cart/snapshot-lines.js";import{restoreCartLines as ie}from"../lib/cart/restore-lines.js";import{safeLocalStorage as F}from"efficient-web-builder/format/lib/safe-storage";import{MAX_QTY_PER_LINE as Pt,orderLinesForSets as ae,setPrice as le}from"../lib/commerce.js";import{UNPRICED_LABEL as de}from"../lib/wheels/price-display.js";import{isValidEmail as fe}from"../lib/email-shape.js";import{trackAddToCart as me}from"../lib/google-tag.js";import{shippingStatus as pe}from"../lib/cart/shipping-status.js";import{useCurrency as he}from"./CurrencyContext.js";const ye=400,ge=400,Ce=1500,J="storefront-cart";function j(d){return(d.components?.length??0)>0}function kt(d,r){return{code:d,valid:r.valid,deferred:ce(r,r.askedAsShopper),message:r.message||void 0,effects:r.effects??void 0}}function Ut(d,r){return le(d.components,r)}function H(d,r){const u=Ut(d,r);return u===null?null:u*d.qty}function Lt(d){return d!=="tyre"}const Qt=re(null);function De({children:d,preview:r=!1}){const{currency:u,country:Y,formatMoney:wt}=he(),[z,k]=i(r),[s,q]=i([]),[G,Wt]=i([]),[K,Vt]=i([]),[X,Ft]=i(!1),Z=g(new Set),[$,Jt]=i([]),[jt,Ht]=i(!1),[f,v]=i(null),[tt,et]=i(null),[nt,ot]=i(null),[Yt,zt]=i(0),rt=a(()=>zt(t=>t+1),[]),[st,ut]=i(void 0),[N,Gt]=i(null),[l,E]=i(null),[ct,A]=i(!1),[h,it]=i(null),B=g(void 0),I=a(()=>k(!0),[]),R=a(()=>k(!1),[]),at=a(()=>k(t=>!t),[]);p(()=>{r||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&I()},[I,r]);const _=ue(),lt=g(_);p(()=>{lt.current!==_&&(lt.current=_,r||R())},[_,r,R]);const dt=a(t=>{Gt(n=>n?.country===t?.country&&n?.subdivision===t?.subdivision&&n?.postcode===t?.postcode?n:t)},[]),ft=a((t,n)=>{Ht(!0),!(!n||!Lt(t))&&Jt(e=>e.includes(n)?e:[...e,n])},[]),mt=jt||s.length>0,U=g(!0);p(()=>(U.current=!0,()=>{U.current=!1}),[]),p(()=>{if(r)return;const t=[...$,...s.filter(e=>Lt(e.kind)).map(e=>e.slug)],n=[...new Set(t)].filter(e=>e&&!Z.current.has(e));if(n.length!==0){for(const e of n)Z.current.add(e);C.listWheelsBySlug(n).then(e=>{if(!U.current||e.length===0)return;const o=new Set(e.map(c=>c.slug));Wt(c=>[...c.filter(b=>!o.has(b.slug)),...e])})}},[r,$,s]),p(()=>{if(r||!mt||X)return;let t=!0;return C.listBundles().then(n=>{t&&(Vt(n),Ft(!0))}),()=>{t=!1}},[r,mt,X]);const S=f?.deliveryOptions??[],pt=f?.courier??null;p(()=>{f&&it(t=>t&&S.some(n=>n.id===t)?t:S[0]?.id??null)},[f]);const M=a(()=>s.filter(j).flatMap(t=>ae(t.components,t.qty)),[s]),ht=a(async(t,n)=>{const e=t.trim().toUpperCase();if(!e)return;const o=M();if(o.length===0){E({code:e,valid:!1,message:"Add a wheel to the cart first."});return}A(!0),B.current=n;try{const c=await C.validateCoupon({code:e,items:o,currency:u,shippingMethodId:h??void 0,customerEmail:n});E(kt(e,c))}catch{E({code:e,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{A(!1)}},[M,u,h]),yt=a(()=>{E(null),B.current=void 0},[]),gt=a(t=>{if(!l)return;const{code:n}=l;E(e=>e&&e.code===n?{code:n,valid:!1,refused:!0,message:t}:e)},[l]);p(()=>{if(!l||l.refused)return;const t=l.code,n=o=>o!==null&&o.code===t&&!o.refused,e=setTimeout(async()=>{const o=M();if(o.length===0){E(c=>n(c)?{code:t,valid:!1,message:"Add a wheel to the cart first."}:c);return}A(!0);try{const c=await C.validateCoupon({code:t,items:o,currency:u,shippingMethodId:h??void 0,customerEmail:B.current});E(b=>n(b)?kt(t,c):b)}catch{}finally{A(!1)}},ye);return()=>clearTimeout(e)},[s,u,h]);const L=l&&!l.refused?l.code:void 0;p(()=>{if(r)return;let t=!0;const n=s,e=setTimeout(async()=>{const o=M();if(o.length===0){v(null),et(null),ut(void 0);return}try{const c=await C.quoteCart({items:o,currency:u,shippingMethodId:h??void 0,couponCode:L,customerEmail:B.current||void 0,country:N?.country||Y||void 0,subdivision:N?.country&&N.subdivision||void 0,postcode:N?.country&&N.postcode||void 0});if(!t)return;v(c),et(n),ot(null)}catch{if(!t)return;ot(n)}ut(L)},ge);return()=>{t=!1,clearTimeout(e)}},[s,u,h,L,Y,N,Yt]);const x=a(t=>{q(n=>{const e=n.findIndex(o=>o.id===t.id);return e===-1?[...n,t]:n.map((o,c)=>c===e?{...o,qty:Math.min(Pt,o.qty+t.qty)}:o)}),me(t,u)},[u]),Ct=a(t=>{q(n=>n.filter(e=>e.id!==t))},[]),Et=a((t,n)=>{const e=Math.max(1,Math.min(Pt,n));q(o=>o.map(c=>c.id===t?{...c,qty:e}:c))},[]),D=a(t=>{q(t)},[]),[St,Q]=i(!1),[bt,Kt]=i([]),Nt=g(s);Nt.current=s,p(()=>{if(r)return;let t=[];try{const e=JSON.parse(F.getItem(J)??"[]");Array.isArray(e)&&(t=e)}catch{}if(t.length===0){Q(!0);return}let n=!0;return ie(t,C).then(({lines:e,dropped:o})=>{n&&(Nt.current.length===0&&(D(e),Kt(o)),Q(!0))},e=>{n&&(process.env.NODE_ENV!=="production"&&console.warn("stored cart could not be rebuilt",e),Q(!0))}),()=>{n=!1}},[r,D]),p(()=>{if(r||!St)return;const t=s.filter(j);if(t.length===0){F.removeItem(J);return}F.setItem(J,JSON.stringify(Dt(t,()=>"")))},[s,r,St]);const[O,Xt]=i(null),It=g(null);It.current=O;const y=g(null),w=g(""),Tt=a((t,n)=>{const e=t.trim().toLowerCase();fe(e)&&Xt(o=>o&&o.email===e&&o.firstName===(n??"")?o:{email:e,firstName:n??""})},[]);p(()=>{if(r||!O)return;const t=Dt(s.filter(j),o=>H(o,u)===null?de:wt(H(o,u),u)),n={email:O.email,firstName:O.firstName,currency:u,items:t},e=JSON.stringify(n);if(e!==w.current)return y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{y.current=null,w.current=e,C.captureCart(n).catch(o=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",o)})},Ce),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[s,O,u,r]);const Ot=a(()=>{y.current&&(clearTimeout(y.current),y.current=null);const t=It.current;t&&(w.current="",C.captureCart({email:t.email,firstName:t.firstName,currency:u,items:[]}).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",n)}))},[u]),qt=xt(()=>{const t=s.reduce((m,T)=>{const P=H(T,u);return P===null?m:m+P},0),n=s.some(m=>Ut(m,u)===null),e=s.reduce((m,T)=>m+T.qty,0),o=l?.valid?l.effects:void 0,c=o?Math.min(t,Number(o.discountAmount)):0,b=f?.bundleDiscount??0,$t=f?.appliedBundles??[],W=!!o?.freeShipping,_t=S.find(m=>m.id===h),Mt=W?0:f?.shipping??_t?.amount??0,vt=pe({quoted:f!==null,optionCount:S.length,chosenAmount:_t?.amount,couponWaivesFreight:W}),V={};for(const m of o?.freeUnits??[])V[m.partNumber]=(V[m.partNumber]??0)+m.quantity;const te=f?.tax??null,ee=f?f.grandTotal:t-c-b+Mt;return{sets:e,units:s.reduce((m,T)=>m+(T.components??[]).reduce((P,ne)=>P+ne.wheels*T.qty,0),0),subtotal:t,hasUnpricedLine:n,discount:c,bundleDiscount:b,appliedBundles:$t,shipping:Mt,freeShipping:W,shippingStatus:vt,freeUnitsByPartNumber:V,tax:te,grand:ee,repricing:!!l?.refused&&f!==null&&st===l?.code,quoted:f!==null&&tt===s,serverSubtotal:f?.subtotal??null,quoteFailed:nt===s,currency:u}},[s,u,l,S,h,f,st,tt,nt]),At=g(!0),Bt=a(t=>{At.current=t},[]),Rt=a(t=>{x(t),At.current&&I()},[x,I]),Zt=xt(()=>({isOpen:z,preview:r,open:I,close:R,toggle:at,items:s,catalog:G,bundles:K,warmCatalog:ft,add:x,addAndOpen:Rt,setAutoOpen:Bt,remove:Ct,setQty:Et,replaceItems:D,restoreDropped:bt,identify:Tt,clearCapturedCart:Ot,coupon:l,applyCoupon:ht,removeCoupon:yt,refuseCoupon:gt,couponBusy:ct,deliveryOptions:S,setQuoteDestination:dt,courier:pt,requote:rt,shippingMethodId:h,setShippingMethodId:it,totals:qt}),[z,r,I,R,at,s,G,K,ft,x,Rt,Bt,Ct,Et,D,bt,Tt,Ot,l,ht,yt,gt,ct,S,dt,pt,rt,h,qt]);return oe(Qt.Provider,{value:Zt,children:d})}function Pe(){const d=se(Qt);if(!d)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return d}export{J as CART_STORAGE_KEY,De as CartProvider,j as isOrderable,H as lineTotal,Pe as useCart};
1
+ "use client";import{jsx as ce}from"react/jsx-runtime";import{createContext as ie,useCallback as a,useContext as ae,useEffect as p,useMemo as kt,useRef as g,useState as i}from"react";import{usePathname as le}from"next/navigation";import{products as C}from"../lib/api/index.js";import{couponDeferredToCheckout as de}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as Ut}from"../lib/cart/snapshot-lines.js";import{restoreCartLines as fe}from"../lib/cart/restore-lines.js";import{safeLocalStorage as z}from"efficient-web-builder/format/lib/safe-storage";import{MAX_QTY_PER_LINE as Lt,orderLinesForSets as me,setPrice as pe}from"../lib/commerce.js";import{UNPRICED_LABEL as he}from"../lib/wheels/price-display.js";import{isValidEmail as ye}from"../lib/email-shape.js";import{trackAddToCart as ge}from"../lib/google-tag.js";import{deliveryAfterCoupon as Ce,shippingStatus as Se}from"../lib/cart/shipping-status.js";import{useCurrency as Ee}from"./CurrencyContext.js";const be=400,Ne=400,Ie=1500,G="storefront-cart";function K(d){return(d.components?.length??0)>0}function Qt(d,r){return{code:d,valid:r.valid,deferred:de(r,r.askedAsShopper),message:r.message||void 0,effects:r.effects??void 0}}function wt(d,r){return pe(d.components,r)}function X(d,r){const u=wt(d,r);return u===null?null:u*d.qty}function Wt(d){return d!=="tyre"}const Vt=ie(null);function Qe({children:d,preview:r=!1}){const{currency:u,country:Z,formatMoney:Ft}=Ee(),[$,w]=i(r),[s,B]=i([]),[tt,vt]=i([]),[et,Jt]=i([]),[nt,jt]=i(!1),ot=g(new Set),[rt,Ht]=i([]),[Yt,zt]=i(!1),[f,st]=i(null),[ut,ct]=i(null),[it,at]=i(null),[Gt,Kt]=i(0),lt=a(()=>Kt(t=>t+1),[]),[W,dt]=i(void 0),[N,Xt]=i(null),[l,S]=i(null),[ft,D]=i(!1),[h,mt]=i(null),M=g(void 0),I=a(()=>w(!0),[]),R=a(()=>w(!1),[]),pt=a(()=>w(t=>!t),[]);p(()=>{r||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&I()},[I,r]);const _=le(),ht=g(_);p(()=>{ht.current!==_&&(ht.current=_,r||R())},[_,r,R]);const yt=a(t=>{Xt(n=>n?.country===t?.country&&n?.subdivision===t?.subdivision&&n?.postcode===t?.postcode?n:t)},[]),gt=a((t,n)=>{zt(!0),!(!n||!Wt(t))&&Ht(e=>e.includes(n)?e:[...e,n])},[]),Ct=Yt||s.length>0,V=g(!0);p(()=>(V.current=!0,()=>{V.current=!1}),[]),p(()=>{if(r)return;const t=[...rt,...s.filter(e=>Wt(e.kind)).map(e=>e.slug)],n=[...new Set(t)].filter(e=>e&&!ot.current.has(e));if(n.length!==0){for(const e of n)ot.current.add(e);C.listWheelsBySlug(n).then(e=>{if(!V.current||e.length===0)return;const o=new Set(e.map(c=>c.slug));vt(c=>[...c.filter(b=>!o.has(b.slug)),...e])})}},[r,rt,s]),p(()=>{if(r||!Ct||nt)return;let t=!0;return C.listBundles().then(n=>{t&&(Jt(n),jt(!0))}),()=>{t=!1}},[r,Ct,nt]);const E=f?.deliveryOptions??[],St=f?.courier??null;p(()=>{f&&mt(t=>t&&E.some(n=>n.id===t)?t:E[0]?.id??null)},[f]);const x=a(()=>s.filter(K).flatMap(t=>me(t.components,t.qty)),[s]),Et=a(async(t,n)=>{const e=t.trim().toUpperCase();if(!e)return;const o=x();if(o.length===0){S({code:e,valid:!1,message:"Add a wheel to the cart first."});return}D(!0),M.current=n;try{const c=await C.validateCoupon({code:e,items:o,currency:u,shippingMethodId:h??void 0,customerEmail:n});S(Qt(e,c))}catch{S({code:e,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{D(!1)}},[x,u,h]),bt=a(()=>{S(null),M.current=void 0},[]),Nt=a(t=>{if(!l)return;const{code:n}=l;S(e=>e&&e.code===n?{code:n,valid:!1,refused:!0,message:t}:e)},[l]);p(()=>{if(!l||l.refused)return;const t=l.code,n=o=>o!==null&&o.code===t&&!o.refused,e=setTimeout(async()=>{const o=x();if(o.length===0){S(c=>n(c)?{code:t,valid:!1,message:"Add a wheel to the cart first."}:c);return}D(!0);try{const c=await C.validateCoupon({code:t,items:o,currency:u,shippingMethodId:h??void 0,customerEmail:M.current});S(b=>n(b)?Qt(t,c):b)}catch{}finally{D(!1)}},be);return()=>clearTimeout(e)},[s,u,h]);const q=l&&!l.refused?l.code:void 0;p(()=>{if(r)return;let t=!0;const n=s,e=setTimeout(async()=>{const o=x();if(o.length===0){st(null),ct(null),dt(void 0);return}try{const c=await C.quoteCart({items:o,currency:u,shippingMethodId:h??void 0,couponCode:q,customerEmail:M.current||void 0,country:N?.country||Z||void 0,subdivision:N?.country&&N.subdivision||void 0,postcode:N?.country&&N.postcode||void 0});if(!t)return;st(c),ct(n),at(null)}catch{if(!t)return;at(n)}dt(q)},Ne);return()=>{t=!1,clearTimeout(e)}},[s,u,h,q,Z,N,Gt]);const P=a(t=>{B(n=>{const e=n.findIndex(o=>o.id===t.id);return e===-1?[...n,t]:n.map((o,c)=>c===e?{...o,qty:Math.min(Lt,o.qty+t.qty)}:o)}),ge(t,u)},[u]),It=a(t=>{B(n=>n.filter(e=>e.id!==t))},[]),Tt=a((t,n)=>{const e=Math.max(1,Math.min(Lt,n));B(o=>o.map(c=>c.id===t?{...c,qty:e}:c))},[]),k=a(t=>{B(t)},[]),[Ot,F]=i(!1),[qt,Zt]=i([]),At=g(s);At.current=s,p(()=>{if(r)return;let t=[];try{const e=JSON.parse(z.getItem(G)??"[]");Array.isArray(e)&&(t=e)}catch{}if(t.length===0){F(!0);return}let n=!0;return fe(t,C).then(({lines:e,dropped:o})=>{n&&(At.current.length===0&&(k(e),Zt(o)),F(!0))},e=>{n&&(process.env.NODE_ENV!=="production"&&console.warn("stored cart could not be rebuilt",e),F(!0))}),()=>{n=!1}},[r,k]),p(()=>{if(r||!Ot)return;const t=s.filter(K);if(t.length===0){z.removeItem(G);return}z.setItem(G,JSON.stringify(Ut(t,()=>"")))},[s,r,Ot]);const[A,$t]=i(null),Bt=g(null);Bt.current=A;const y=g(null),v=g(""),Dt=a((t,n)=>{const e=t.trim().toLowerCase();ye(e)&&$t(o=>o&&o.email===e&&o.firstName===(n??"")?o:{email:e,firstName:n??""})},[]);p(()=>{if(r||!A)return;const t=Ut(s.filter(K),o=>X(o,u)===null?he:Ft(X(o,u),u)),n={email:A.email,firstName:A.firstName,currency:u,items:t},e=JSON.stringify(n);if(e!==v.current)return y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{y.current=null,v.current=e,C.captureCart(n).catch(o=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",o)})},Ie),()=>{y.current&&(clearTimeout(y.current),y.current=null)}},[s,A,u,r]);const Mt=a(()=>{y.current&&(clearTimeout(y.current),y.current=null);const t=Bt.current;t&&(v.current="",C.captureCart({email:t.email,firstName:t.firstName,currency:u,items:[]}).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",n)}))},[u]),Rt=kt(()=>{const t=s.reduce((m,O)=>{const Q=X(O,u);return Q===null?m:m+Q},0),n=s.some(m=>wt(m,u)===null),e=s.reduce((m,O)=>m+O.qty,0),o=l?.valid?l.effects:void 0,c=o?Math.min(t,Number(o.discountAmount)):0,b=f?.bundleDiscount??0,ee=f?.appliedBundles??[],U=!!o?.freeShipping,T=E.find(m=>m.id===h),J=Number(o?.deliveryDiscountPercent??0),L=!U&&J>0&&J<100?J:0,j=L>0&&T?Ce(T.amount,L):void 0,H=U?0:j!==void 0&&W!==q?j:f?.shipping??j??T?.amount??0,ne=L>0&&T?Math.max(0,T.amount-H):0,oe=Se({quoted:f!==null,optionCount:E.length,chosenAmount:T?.amount,couponWaivesFreight:U}),Y={};for(const m of o?.freeUnits??[])Y[m.partNumber]=(Y[m.partNumber]??0)+m.quantity;const re=f?.tax??null,se=f?f.grandTotal:t-c-b+H;return{sets:e,units:s.reduce((m,O)=>m+(O.components??[]).reduce((Q,ue)=>Q+ue.wheels*O.qty,0),0),subtotal:t,hasUnpricedLine:n,discount:c,bundleDiscount:b,appliedBundles:ee,shipping:H,freeShipping:U,deliveryDiscountPercent:L,deliverySaving:ne,shippingStatus:oe,freeUnitsByPartNumber:Y,tax:re,grand:se,repricing:!!l?.refused&&f!==null&&W===l?.code,quoted:f!==null&&ut===s,serverSubtotal:f?.subtotal??null,quoteFailed:it===s,currency:u}},[s,u,l,q,E,h,f,W,ut,it]),_t=g(!0),xt=a(t=>{_t.current=t},[]),Pt=a(t=>{P(t),_t.current&&I()},[P,I]),te=kt(()=>({isOpen:$,preview:r,open:I,close:R,toggle:pt,items:s,catalog:tt,bundles:et,warmCatalog:gt,add:P,addAndOpen:Pt,setAutoOpen:xt,remove:It,setQty:Tt,replaceItems:k,restoreDropped:qt,identify:Dt,clearCapturedCart:Mt,coupon:l,applyCoupon:Et,removeCoupon:bt,refuseCoupon:Nt,couponBusy:ft,deliveryOptions:E,setQuoteDestination:yt,courier:St,requote:lt,shippingMethodId:h,setShippingMethodId:mt,totals:Rt}),[$,r,I,R,pt,s,tt,et,gt,P,Pt,xt,It,Tt,k,qt,Dt,Mt,l,Et,bt,Nt,ft,E,yt,St,lt,h,Rt]);return ce(Vt.Provider,{value:te,children:d})}function we(){const d=ae(Vt);if(!d)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return d}export{G as CART_STORAGE_KEY,Qe as CartProvider,K as isOrderable,X as lineTotal,we as useCart};
@@ -25,4 +25,5 @@ export declare const PICTURE_FRAMES: readonly ["well", "full"];
25
25
  export type PictureFrame = (typeof PICTURE_FRAMES)[number];
26
26
  export declare const DEFAULT_PICTURE_FRAME: PictureFrame;
27
27
  export declare const WHEEL_ZOOM_CLASS = "transition-transform duration-(--page-motion-hover-duration) ease-(--page-ease-media) motion-safe:group-hover:scale-(--sf-photo-zoom)";
28
+ export declare const PICTURE_ZOOM_WELL_ATTR = "data-picture-zoom";
28
29
  export default function CardProductPicture(settings: CardProductPictureSettings): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as i,Fragment as C}from"react/jsx-runtime";import{parseOption as Z}from"efficient-shell/format";import I from"next/image";import{useState as te}from"react";import{HideTaker as A}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as R,CARD_INDEX_CLASS as $,parseCardIndexFormat as G}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as oe,cardImageBackgroundPaints as X,resolveCardImageBackground as ne}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as E}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as se,boxSwatchFill as ie}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as ce}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as me}from"efficient-easel/screen/lib/document/shadow-values";import{PICTURE_HOVER_KEYS as de,pictureHoverZoomOf as ue}from"efficient-web-builder/format/lib/animation/hover";import{PICTURE_ZOOM_VAR as fe}from"efficient-web-builder/format/lib/content/image-treatment";import{sayCount as he}from"efficient-web-builder/format/lib/editor-words";import{coverSrcForWheel as ge,parseCoverIndex as pe,resolvePaintedSrc as be}from"../../lib/wheels/cover-rendering.js";import we from"../WheelPlaceholder.js";import Se from"../BrandPlate.js";import ve from"../TyreImage.js";import{cardSpinOf as Ce}from"../card-spin.js";import{useCardHoverLayer as ye,useGridCard as B}from"../GridCardTemplate.js";import j from"./CardPicture.js";import T from"./CardProductBadge.js";import{useHeldCardPicture as xe}from"./useHeldCardPicture.js";import{useProductCardState as _e}from"./ProductCardState.js";import{blockParts as ke}from"../../lib/block-parts.js";const o=ke("ProductCard"),Fe=[{label:"Auto",value:"auto"},{label:"Always",value:"always"}],Pe=a=>Z(Fe.map(r=>r.value),"auto",a),Ne=["well","full"],Ae="well",H=a=>Z(Ne,Ae,a);function Ee({children:a}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:a})}const K="transition-transform duration-(--page-motion-hover-duration) ease-(--page-ease-media) motion-safe:group-hover:scale-(--sf-photo-zoom)";function V({zoom:a,image:r,layer:l,imageClass:n}){return i("div",{className:"contents",style:{[fe]:a},children:[e("div",{className:`${n} ${K}`,children:r}),l?e("div",{className:`pointer-events-none absolute inset-0 z-20 ${K}`,children:l}):null]})}function D({fill:a,badge:r,children:l}){const n=X(a);return i("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${n?"":" bg-surface"}`,style:n?{backgroundColor:a}:void 0,...o("image-frame"),children:[l,r]})}function L(a,r){const l=ce();return ie({[se]:a},l?.row)??ne(r,oe)}function ze(a){const r=_e();return r.kind==="bundle"?e(Oe,{state:r,...a}):r.kind==="tyre"?e(Ie,{state:r,...a}):r.kind!=="wheel"?null:e(Re,{state:r,...a})}function Oe({state:a,imageBackground:r,cardImage:l,showBadge:n,frame:w,swatch:h}){const{bundle:t}=a,{imageSizes:g}=B(),c=H(w)==="full",p=t.components.length,b=t.image?c?e(I,{alt:t.name,src:t.image,fill:!0,sizes:g,className:"object-cover",draggable:!1,...o("image")}):e(I,{alt:t.name,src:t.image,width:1e3,height:1e3,sizes:g,className:"block h-full w-full object-cover",draggable:!1,...o("image")}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:he("{n} piece","{n} pieces",p,{})}),u=e(Ee,{children:b}),f=L(h,r),m=n!==!1?e(T,{edge:c}):null;return e(A,{style:E(l),...o("image-block"),children:c?e(D,{fill:f,badge:m,children:u}):i(C,{children:[m,e(j,{image:u,imageBackgroundFill:f})]})})}function Ie({state:a,imageBackground:r,cardImage:l,indexBadge:n,frame:w,swatch:h}){const{tyre:t}=a,{imageSizes:g}=B(),c=L(h,r),p=G(n),b=p!=="off"?e("span",{"aria-hidden":!0,"data-format":p,className:`${$} ${R}`,...o("card-number")}):null,u=e(ve,{image:t.image,className:"h-full w-full",sizes:g,showBackground:!1}),f=e(Se,{brand:t.brand,logo:t.brandLogo});return e(A,{style:E(l),...o("image-block"),children:H(w)==="full"?i(D,{fill:c,badge:b,children:[u,f]}):i(C,{children:[b,e(j,{image:u,imageBackgroundFill:c,plate:f})]})})}function Re({state:a,imageBackground:r,cardImage:l,coverIndex:n,indexBadge:w,showBadge:h,setFlags:t,frame:g,swatch:c,shadow:p,shadowColor:b,shadowOn:u,hoverZoom:f}){const{wheel:m,sel:d}=a,{hover:Y,imageSizes:W,fit:q,rules:y}=B(),x=Ce(Y),J=ge(m,pe(n),d.finish?.name,d.shownSrc,q?.holes),[M,Q]=te(()=>new Set),U=s=>{d.pictureFailed(s),Q(v=>v.has(s)?v:new Set(v).add(s))},ee=be({overrideSrc:J,hookSrc:d.shownSrc,failed:M}),z=m.rendersHaveAlpha===!0||Pe(u)==="always"?me(p,b):null,ae=z?{...x.style,filter:z}:x.style,re=(s,v)=>e(I,{alt:v,src:s,width:1e3,height:1e3,sizes:W,className:`block h-full w-full object-contain ${x.className}`,style:ae,draggable:!1,onError:()=>U(s),...o("image")},s),le=d.finish?`${m.name} — ${d.finish.name}`:m.name,_=xe({src:ee,alt:le,sizes:W,failed:M,onFailed:U,near:d.nearScreen,holdEmpty:d.awaitingProbe}),k=i(C,{children:[_.src?re(_.src,_.alt):e(we,{imageLabel:m.name,spin:x}),_.trial]}),O=G(w),F=O!=="off",P=L(c,r),N=ye("picture",X(P)?P:void 0),S=ue({[de.zoom]:f});if(H(g)==="full"){const s=i(C,{children:[F?e("span",{"aria-hidden":!0,"data-format":O,className:`${$} ${R}`,...o("card-number")}):null,e(T,{show:h!==!1,numbered:F,sale:y.sale,axleSets:y.axleSets,setFlags:t!==!1,edge:!0})]});return e(A,{style:E(l),...o("image-block"),children:e(D,{fill:P,badge:s,children:S?e(V,{zoom:S,image:e("div",{className:"flex h-full w-full items-center justify-center",children:k}),layer:N,imageClass:"h-full w-full"}):i(C,{children:[e("div",{className:"flex h-full w-full items-center justify-center",children:k}),N]})})})}return i(A,{style:E(l),...o("image-block"),children:[F?e("span",{"aria-hidden":!0,"data-format":O,className:`${$} ${R}`,...o("card-number")}):null,e(T,{show:h!==!1,numbered:F,sale:y.sale,axleSets:y.axleSets,setFlags:t!==!1}),e(j,{image:S?e(V,{zoom:S,image:k,layer:N,imageClass:"h-full w-full"}):k,imageBackgroundFill:P,plate:S?null:N,shadowed:!!z})]})}export{Ae as DEFAULT_PICTURE_FRAME,Ne as PICTURE_FRAMES,Fe as SHADOW_ON,K as WHEEL_ZOOM_CLASS,ze as default,Pe as shadowOnOf};
1
+ "use client";import{jsx as e,jsxs as i,Fragment as v}from"react/jsx-runtime";import{parseOption as Z}from"efficient-shell/format";import R from"next/image";import{useState as le}from"react";import{HideTaker as E}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as I,CARD_INDEX_CLASS as T,parseCardIndexFormat as G}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as oe,cardImageBackgroundPaints as X,resolveCardImageBackground as ne}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as N}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as se,boxSwatchFill as ie}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as ce}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as me}from"efficient-easel/screen/lib/document/shadow-values";import{PICTURE_HOVER_KEYS as de,pictureHoverZoomOf as ue}from"efficient-web-builder/format/lib/animation/hover";import{PICTURE_ZOOM_VAR as fe}from"efficient-web-builder/format/lib/content/image-treatment";import{sayCount as he}from"efficient-web-builder/format/lib/editor-words";import{coverSrcForWheel as ge,parseCoverIndex as pe,resolvePaintedSrc as be}from"../../lib/wheels/cover-rendering.js";import we from"../WheelPlaceholder.js";import Se from"../BrandPlate.js";import Ce from"../TyreImage.js";import{cardSpinOf as ve}from"../card-spin.js";import{useCardHoverLayer as _e,useGridCard as $}from"../GridCardTemplate.js";import B from"./CardPicture.js";import j from"./CardProductBadge.js";import{useHeldCardPicture as ye}from"./useHeldCardPicture.js";import{useProductCardState as xe}from"./ProductCardState.js";import{blockParts as Pe}from"../../lib/block-parts.js";const o=Pe("ProductCard"),ke=[{label:"Auto",value:"auto"},{label:"Always",value:"always"}],Fe=a=>Z(ke.map(r=>r.value),"auto",a),Ae=["well","full"],Ee="well",L=a=>Z(Ae,Ee,a);function Ne({children:a}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:a})}const K="transition-transform duration-(--page-motion-hover-duration) ease-(--page-ease-media) motion-safe:group-hover:scale-(--sf-photo-zoom)",Oe="data-picture-zoom";function V({zoom:a,image:r,layer:t,imageClass:n}){return i("div",{className:"contents",style:{[fe]:a},children:[e("div",{className:`${n} ${K}`,[Oe]:"",children:r}),t?e("div",{className:`pointer-events-none absolute inset-0 z-20 ${K}`,children:t}):null]})}function H({fill:a,badge:r,children:t}){const n=X(a);return i("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${n?"":" bg-surface"}`,style:n?{backgroundColor:a}:void 0,...o("image-frame"),children:[t,r]})}function W(a,r){const t=ce();return ie({[se]:a},t?.row)??ne(r,oe)}function ze(a){const r=xe();return r.kind==="bundle"?e(Re,{state:r,...a}):r.kind==="tyre"?e(Ie,{state:r,...a}):r.kind!=="wheel"?null:e(Te,{state:r,...a})}function Re({state:a,imageBackground:r,cardImage:t,showBadge:n,frame:w,swatch:h}){const{bundle:l}=a,{imageSizes:g}=$(),c=L(w)==="full",p=l.components.length,b=l.image?c?e(R,{alt:l.name,src:l.image,fill:!0,sizes:g,className:"object-cover",draggable:!1,...o("image")}):e(R,{alt:l.name,src:l.image,width:1e3,height:1e3,sizes:g,className:"block h-full w-full object-cover",draggable:!1,...o("image")}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:he("{n} piece","{n} pieces",p,{})}),u=e(Ne,{children:b}),f=W(h,r),m=n!==!1?e(j,{edge:c}):null;return e(E,{style:N(t),...o("image-block"),children:c?e(H,{fill:f,badge:m,children:u}):i(v,{children:[m,e(B,{image:u,imageBackgroundFill:f})]})})}function Ie({state:a,imageBackground:r,cardImage:t,indexBadge:n,frame:w,swatch:h}){const{tyre:l}=a,{imageSizes:g}=$(),c=W(h,r),p=G(n),b=p!=="off"?e("span",{"aria-hidden":!0,"data-format":p,className:`${T} ${I}`,...o("card-number")}):null,u=e(Ce,{image:l.image,className:"h-full w-full",sizes:g,showBackground:!1}),f=e(Se,{brand:l.brand,logo:l.brandLogo});return e(E,{style:N(t),...o("image-block"),children:L(w)==="full"?i(H,{fill:c,badge:b,children:[u,f]}):i(v,{children:[b,e(B,{image:u,imageBackgroundFill:c,plate:f})]})})}function Te({state:a,imageBackground:r,cardImage:t,coverIndex:n,indexBadge:w,showBadge:h,setFlags:l,frame:g,swatch:c,shadow:p,shadowColor:b,shadowOn:u,hoverZoom:f}){const{wheel:m,sel:d}=a,{hover:Y,imageSizes:D,fit:q,rules:_}=$(),y=ve(Y),J=ge(m,pe(n),d.finish?.name,d.shownSrc,q?.holes),[M,Q]=le(()=>new Set),U=s=>{d.pictureFailed(s),Q(C=>C.has(s)?C:new Set(C).add(s))},ee=be({overrideSrc:J,hookSrc:d.shownSrc,failed:M}),O=m.rendersHaveAlpha===!0||Fe(u)==="always"?me(p,b):null,ae=O?{...y.style,filter:O}:y.style,re=(s,C)=>e(R,{alt:C,src:s,width:1e3,height:1e3,sizes:D,className:`block h-full w-full object-contain ${y.className}`,style:ae,draggable:!1,onError:()=>U(s),...o("image")},s),te=d.finish?`${m.name} — ${d.finish.name}`:m.name,x=ye({src:ee,alt:te,sizes:D,failed:M,onFailed:U,near:d.nearScreen,holdEmpty:d.awaitingProbe}),P=i(v,{children:[x.src?re(x.src,x.alt):e(we,{imageLabel:m.name,spin:y}),x.trial]}),z=G(w),k=z!=="off",F=W(c,r),A=_e("picture",X(F)?F:void 0),S=ue({[de.zoom]:f});if(L(g)==="full"){const s=i(v,{children:[k?e("span",{"aria-hidden":!0,"data-format":z,className:`${T} ${I}`,...o("card-number")}):null,e(j,{show:h!==!1,numbered:k,sale:_.sale,axleSets:_.axleSets,setFlags:l!==!1,edge:!0})]});return e(E,{style:N(t),...o("image-block"),children:e(H,{fill:F,badge:s,children:S?e(V,{zoom:S,image:e("div",{className:"flex h-full w-full items-center justify-center",children:P}),layer:A,imageClass:"h-full w-full"}):i(v,{children:[e("div",{className:"flex h-full w-full items-center justify-center",children:P}),A]})})})}return i(E,{style:N(t),...o("image-block"),children:[k?e("span",{"aria-hidden":!0,"data-format":z,className:`${T} ${I}`,...o("card-number")}):null,e(j,{show:h!==!1,numbered:k,sale:_.sale,axleSets:_.axleSets,setFlags:l!==!1}),e(B,{image:S?e(V,{zoom:S,image:P,layer:A,imageClass:"h-full w-full"}):P,imageBackgroundFill:F,plate:S?null:A,shadowed:!!O})]})}export{Ee as DEFAULT_PICTURE_FRAME,Ae as PICTURE_FRAMES,Oe as PICTURE_ZOOM_WELL_ATTR,ke as SHADOW_ON,K as WHEEL_ZOOM_CLASS,ze as default,Fe as shadowOnOf};
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as a,Fragment as c}from"react/jsx-runtime";import u from"next/link";import{FIGURE_UPDATING as N,FREE_PRICE as b,UNPRICED_LABEL as k}from"../../lib/wheels/price-display.js";import w from"../CartLineThumbnail.js";import C from"../CouponField.js";import j from"../QuantityStepper.js";import T from"efficient-web-builder/render/components/RMark";import{lineTotal as y,useCart as d}from"../CartContext.js";import{COUPON_DEFERRED_TOTAL as B}from"../../lib/cart/coupon-preview.js";import{shippingWords as F,TAX_PENDING as S}from"../../lib/cart/shipping-status.js";import{useCurrency as g}from"../CurrencyContext.js";import{cartSubtitle as $}from"efficient-web-builder/format/lib/content/cart-drawer";function H({content:e,closeRef:r}){const{close:n,items:s}=d(),l=r;return a("header",{className:"flex flex-shrink-0 flex-col gap-4 border-b border-line px-8 pb-6 pt-8 max-[640px]:px-6 max-[640px]:pt-6 max-[640px]:pb-5",children:[a("div",{className:"flex items-center justify-between",children:[a("span",{className:"flex items-center gap-3 font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[e.kickerBadge?t("span",{className:"border px-2 py-1 text-[10px]",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 50%, transparent)"},children:e.kickerBadge}):null,(e.kickerBadge?"· ":"")+e.kickerText]}),t("button",{ref:l,type:"button",onClick:n,"aria-label":"Close cart",className:"flex h-8 w-8 items-center justify-center border border-line text-[14px] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"✕"})]}),a("h1",{className:"font-display text-[38px] font-medium uppercase leading-[0.95] tracking-[-0.03em] max-[640px]:text-[30px]",children:[e.titleLead+" ",t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.02em] normal-case",children:e.titleAccent})]}),t("p",{className:"font-serif text-[13px] italic leading-[1.5] text-fg-dim",children:$(e,s.length)})]})}function X({content:e}){const{totals:r}=d(),{activeCountry:n}=g(),s=n?.name??e.shipsToFallback,l=1+(e.leadTimeValue?1:0)+(s?1:0);return t(c,{children:a("div",{className:`grid flex-shrink-0 ${_[l-1]} gap-px border-b border-line bg-line`,children:[t(h,{label:"Items",value:a(c,{children:[t("em",{className:"font-serif font-normal italic text-accent",children:r.sets})," set",r.sets===1?"":"s"," · ",r.units," item",r.units===1?"":"s"]})}),e.leadTimeValue?t(h,{label:"Lead time",value:e.leadTimeValue}):null,s?t(h,{label:"Ships to",value:s}):null]})})}function Y({content:e,tyres:r}){const{items:n,remove:s,setQty:l}=d();return t(c,{children:n.length===0?t(I,{content:e}):n.map(o=>t(R,{line:o,tyre:r.get(o.slug),onRemove:()=>s(o.id),onQtyChange:m=>l(o.id,m)},o.id))})}function J(){const{items:e,totals:r,bundles:n}=d(),{formatMoney:s}=g(),l=new Set(e.flatMap(i=>(i.components??[]).map(x=>x.partNumber))),o=new Set(r.appliedBundles.map(i=>i.slug)),m=n.filter(i=>!o.has(i.slug)).filter(i=>i.components.some(x=>l.has(x.partNumber))).slice(0,2);return t(c,{children:m.length>0&&a("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",style:{background:"color-mix(in oklab, var(--site-surface) 60%, transparent)"},children:[a("div",{className:"mb-4 flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[t("span",{children:"You may also need"}),t("span",{className:"font-display text-[11px] normal-case tracking-[0.08em] text-fg-dim",children:"Buy together, save"})]}),t("div",{className:"grid grid-cols-2 gap-2 max-[640px]:grid-cols-1",children:m.map(i=>t(E,{href:`/bundles/${i.slug}`,title:i.name,sub:L(i,r.currency,s)},i.slug))})]})})}function Z(){return t(c,{children:t("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",children:t(C,{})})})}function ee({content:e}){return t(c,{children:e.promises.length>0&&t("div",{className:"flex flex-wrap justify-center gap-5 border-b border-line px-8 pt-6 pb-8 font-mono text-[9px] uppercase tracking-[0.24em] text-fg-dim max-[640px]:px-6",children:e.promises.map(r=>t(U,{children:r},r))})})}function te(){const{totals:e,coupon:r}=d(),{formatMoney:n}=g();return t(c,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-2 border-t border-line px-8 pt-5 max-[640px]:px-6",children:[t(p,{label:`Subtotal · ${e.sets} set${e.sets===1?"":"s"}`,value:n(e.subtotal,e.currency)}),e.appliedBundles.map(s=>t(p,{label:`Bundle · ${s.name}${s.multiples>1?` ×${s.multiples}`:""}`,value:a("span",{style:{color:"var(--green)"},children:["− ",n(s.discount,e.currency)]})},s.slug)),e.discount>0&&r?.valid&&t(p,{label:`Coupon · ${r.code}`,value:a("span",{style:{color:"var(--green)"},children:["− ",n(e.discount,e.currency)]})}),r?.deferred&&t(p,{label:`Coupon · ${r.code}`,value:B}),r?.valid&&r.effects?.gift&&t(p,{label:`Free gift · ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` ×${r.effects.gift.quantity}`:""}`,value:t("span",{style:{color:"var(--green)"},children:b})}),t(p,{label:"Shipping",value:e.shippingStatus==="free"?t("span",{style:{color:"var(--green)"},children:b}):F(e.shippingStatus)??n(e.shipping,e.currency)}),e.tax&&(e.tax.charged?t(p,{label:e.tax.inclusive?`${e.tax.name} included · ${e.tax.rate}%`:e.tax.name,value:n(e.tax.amount,e.currency)}):e.tax.name?t(p,{label:e.tax.name,value:S}):null),a("div",{className:"mt-2 flex items-center justify-between border-t border-line pt-4 text-fg",children:[a("span",{className:"font-display text-[22px] font-medium tracking-[-0.02em] normal-case",children:["Total ",t("em",{className:"font-serif font-normal italic text-accent",children:"due"})]}),t("span",{className:"text-right font-display text-[30px] font-medium tracking-[-0.025em] text-fg",children:e.repricing?N:n(e.grand,e.currency)})]})]})})}function re(){const{items:e,close:r}=d();return t(c,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-3 px-8 pb-6 pt-4 max-[640px]:px-6",children:[a(u,{href:"/checkout",onClick:r,"aria-disabled":e.length===0,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[12px] uppercase tracking-[0.3em] transition-colors",e.length===0?"pointer-events-none 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:["Begin checkout",t("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}),t("div",{className:"flex items-center justify-between px-1 py-2 font-mono text-[10px] uppercase tracking-[0.24em] text-fg-dim",children:t(u,{href:"/wheels",onClick:r,className:"text-fg transition-colors hover:text-accent",children:"← Keep browsing"})})]})})}const _=["grid-cols-1","grid-cols-2","grid-cols-3"];function h({label:e,value:r}){return a("div",{className:"flex flex-col gap-1 bg-bg px-4 py-4",children:[t("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-fg-dim",children:e}),t("span",{className:"font-display text-[14px] font-medium tracking-[-0.005em] text-fg",children:r})]})}function R({line:e,tyre:r,onRemove:n,onQtyChange:s}){const{catalog:l,totals:o}=d(),m=(e.components??[]).reduce((f,v)=>f+(o.freeUnitsByPartNumber[v.partNumber]??0),0),{currency:i,formatMoney:x}=g();return a(c,{children:[a("article",{className:"grid grid-cols-[96px_1fr] gap-5 border-b border-line px-8 py-6 transition-colors hover:bg-[color-mix(in_oklab,var(--site-surface)_60%,transparent)] max-[640px]:grid-cols-[78px_1fr] max-[640px]:px-6 max-[640px]:py-5",children:[t(w,{line:e,catalog:l,tyre:r}),a("div",{className:"flex min-w-0 flex-col gap-2",children:[a("div",{className:"flex items-start justify-between gap-3",children:[a("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-accent",children:["N° ",e.positionNo," · ",e.process==="FusionForge®"?a(c,{children:["FusionForge",t(T,{})]}):e.process]}),t("span",{className:"whitespace-nowrap font-display text-[16px] font-medium tracking-[-0.015em] text-fg",children:y(e,i)===null?k:x(y(e,i),i)})]}),a("h3",{className:"mt-0.5 font-display text-[22px] font-medium uppercase leading-none tracking-[-0.02em]",children:[e.name.lead,t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em] normal-case",children:e.name.accent})]}),e.config.length>0&&a("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.config.map(f=>t("span",{className:["border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em]",f.gold?"border-[color-mix(in_oklab,var(--accent)_45%,var(--site-line))] text-accent":"border-line text-fg-dim"].join(" "),children:f.label},f.label)),m>0&&a("span",{className:"border border-accent bg-accent px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em] text-bg",children:[m,"× free"]})]}),a("div",{className:"mt-3 flex items-center justify-between gap-3",children:[t(j,{value:e.qty,onChange:s,size:"small"}),a("div",{className:"flex gap-4 font-mono text-[10px] uppercase tracking-[0.22em]",children:[t(u,{href:e.href??`/wheels/${e.slug}`,className:"text-fg-dim transition-colors hover:text-accent",children:e.href?"View product":"Edit finish"}),t("button",{type:"button",onClick:n,className:"text-fg-dim transition-colors hover:text-alert",children:"Remove"})]})]})]})]}),e.verifiedFor&&a("div",{className:"mx-8 -mt-px flex items-start gap-3 border-t-0 px-4 py-4 font-display text-[13px] leading-[1.45] text-fg max-[640px]:mx-6",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 35%, var(--site-line))",borderTop:"0"},children:[t("span",{className:"flex-shrink-0 pt-px font-mono text-[10px] uppercase tracking-[0.24em] text-accent",children:"Fits"}),a("span",{children:["Verified for your ",t("strong",{className:"font-medium text-accent",children:e.verifiedFor}),". Final torque values shipped with the wheels."]})]})]})}function E({title:e,sub:r,href:n}){return a(u,{href:n,className:"flex items-center justify-between border border-line bg-bg px-4 py-3 text-left transition-colors hover:border-accent",children:[a("span",{className:"flex min-w-0 flex-col gap-1",children:[t("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-display text-[13px] font-medium tracking-[-0.005em] text-fg",children:e}),t("span",{className:"font-mono text-[9px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),t("span",{className:"ml-2 flex h-6 w-6 flex-shrink-0 items-center justify-center font-mono text-[13px] text-accent",style:{borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))",borderWidth:1,borderStyle:"solid"},children:"+"})]})}function L(e,r,n){const s=e.savings[r];if(s===void 0)return"Buy together";const l=n(s,r);return e.savingIsFrom?`Save from ${l}`:`Save ${l}`}function U({children:e}){return t("span",{className:"inline-flex items-center gap-2 before:text-[6px] before:text-accent before:content-['●']",children:e})}function p({label:e,value:r}){return a("div",{className:"flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:[t("span",{children:e}),t("strong",{className:"font-display text-[14px] font-normal tracking-[-0.005em] normal-case text-fg",children:r})]})}function I({content:e}){return a("div",{className:"flex flex-col items-center justify-center gap-3 px-8 py-20 text-center",children:[t("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:e.emptyKicker}),t("p",{className:"font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:e.emptyBody}),a(u,{href:"/wheels",className:"mt-3 inline-flex items-center gap-3 border border-line px-5 py-3 font-mono text-[11px] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:["Browse the catalog ",t("span",{className:"text-accent",children:"→"})]})]})}export{re as CartActions,Z as CartCouponRow,H as CartDrawerHeader,R as CartLineRow,Y as CartLines,X as CartStatusRail,te as CartTotals,ee as CartTrustMarkers,J as CartUpsell};
1
+ "use client";import{jsx as t,jsxs as a,Fragment as o}from"react/jsx-runtime";import u from"next/link";import{FIGURE_UPDATING as N,FREE_PRICE as b,UNPRICED_LABEL as k}from"../../lib/wheels/price-display.js";import w from"../CartLineThumbnail.js";import C from"../CouponField.js";import S from"../QuantityStepper.js";import j from"efficient-web-builder/render/components/RMark";import{lineTotal as v,useCart as d}from"../CartContext.js";import{COUPON_DEFERRED_TOTAL as T}from"../../lib/cart/coupon-preview.js";import{couponSaving as B,shippingWords as F,TAX_PENDING as $}from"../../lib/cart/shipping-status.js";import{useCurrency as g}from"../CurrencyContext.js";import{cartSubtitle as _}from"efficient-web-builder/format/lib/content/cart-drawer";function X({content:e,closeRef:r}){const{close:s,items:n}=d(),l=r;return a("header",{className:"flex flex-shrink-0 flex-col gap-4 border-b border-line px-8 pb-6 pt-8 max-[640px]:px-6 max-[640px]:pt-6 max-[640px]:pb-5",children:[a("div",{className:"flex items-center justify-between",children:[a("span",{className:"flex items-center gap-3 font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[e.kickerBadge?t("span",{className:"border px-2 py-1 text-[10px]",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 50%, transparent)"},children:e.kickerBadge}):null,(e.kickerBadge?"· ":"")+e.kickerText]}),t("button",{ref:l,type:"button",onClick:s,"aria-label":"Close cart",className:"flex h-8 w-8 items-center justify-center border border-line text-[14px] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"✕"})]}),a("h1",{className:"font-display text-[38px] font-medium uppercase leading-[0.95] tracking-[-0.03em] max-[640px]:text-[30px]",children:[e.titleLead+" ",t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.02em] normal-case",children:e.titleAccent})]}),t("p",{className:"font-serif text-[13px] italic leading-[1.5] text-fg-dim",children:_(e,n.length)})]})}function Y({content:e}){const{totals:r}=d(),{activeCountry:s}=g(),n=s?.name??e.shipsToFallback,l=1+(e.leadTimeValue?1:0)+(n?1:0);return t(o,{children:a("div",{className:`grid flex-shrink-0 ${R[l-1]} gap-px border-b border-line bg-line`,children:[t(h,{label:"Items",value:a(o,{children:[t("em",{className:"font-serif font-normal italic text-accent",children:r.sets})," set",r.sets===1?"":"s"," · ",r.units," item",r.units===1?"":"s"]})}),e.leadTimeValue?t(h,{label:"Lead time",value:e.leadTimeValue}):null,n?t(h,{label:"Ships to",value:n}):null]})})}function J({content:e,tyres:r}){const{items:s,remove:n,setQty:l}=d();return t(o,{children:s.length===0?t(A,{content:e}):s.map(c=>t(E,{line:c,tyre:r.get(c.slug),onRemove:()=>n(c.id),onQtyChange:m=>l(c.id,m)},c.id))})}function Z(){const{items:e,totals:r,bundles:s}=d(),{formatMoney:n}=g(),l=new Set(e.flatMap(i=>(i.components??[]).map(x=>x.partNumber))),c=new Set(r.appliedBundles.map(i=>i.slug)),m=s.filter(i=>!c.has(i.slug)).filter(i=>i.components.some(x=>l.has(x.partNumber))).slice(0,2);return t(o,{children:m.length>0&&a("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",style:{background:"color-mix(in oklab, var(--site-surface) 60%, transparent)"},children:[a("div",{className:"mb-4 flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[t("span",{children:"You may also need"}),t("span",{className:"font-display text-[11px] normal-case tracking-[0.08em] text-fg-dim",children:"Buy together, save"})]}),t("div",{className:"grid grid-cols-2 gap-2 max-[640px]:grid-cols-1",children:m.map(i=>t(L,{href:`/bundles/${i.slug}`,title:i.name,sub:U(i,r.currency,n)},i.slug))})]})})}function ee(){return t(o,{children:t("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",children:t(C,{})})})}function te({content:e}){return t(o,{children:e.promises.length>0&&t("div",{className:"flex flex-wrap justify-center gap-5 border-b border-line px-8 pt-6 pb-8 font-mono text-[9px] uppercase tracking-[0.24em] text-fg-dim max-[640px]:px-6",children:e.promises.map(r=>t(I,{children:r},r))})})}function re(){const{totals:e,coupon:r}=d(),{formatMoney:s}=g();return t(o,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-2 border-t border-line px-8 pt-5 max-[640px]:px-6",children:[t(p,{label:`Subtotal · ${e.sets} set${e.sets===1?"":"s"}`,value:s(e.subtotal,e.currency)}),e.appliedBundles.map(n=>t(p,{label:`Bundle · ${n.name}${n.multiples>1?` ×${n.multiples}`:""}`,value:a("span",{style:{color:"var(--green)"},children:["− ",s(n.discount,e.currency)]})},n.slug)),(e.discount>0||e.deliverySaving>0)&&r?.valid&&t(p,{label:`Coupon · ${r.code}`,value:t("span",{style:{color:"var(--green)"},children:B(e,n=>s(n,e.currency))})}),r?.deferred&&t(p,{label:`Coupon · ${r.code}`,value:T}),r?.valid&&r.effects?.gift&&t(p,{label:`Free gift · ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` ×${r.effects.gift.quantity}`:""}`,value:t("span",{style:{color:"var(--green)"},children:b})}),t(p,{label:"Shipping",value:e.shippingStatus==="free"?t("span",{style:{color:"var(--green)"},children:b}):F(e.shippingStatus)??s(e.shipping,e.currency)}),e.tax&&(e.tax.charged?t(p,{label:e.tax.inclusive?`${e.tax.name} included · ${e.tax.rate}%`:e.tax.name,value:s(e.tax.amount,e.currency)}):e.tax.name?t(p,{label:e.tax.name,value:$}):null),a("div",{className:"mt-2 flex items-center justify-between border-t border-line pt-4 text-fg",children:[a("span",{className:"font-display text-[22px] font-medium tracking-[-0.02em] normal-case",children:["Total ",t("em",{className:"font-serif font-normal italic text-accent",children:"due"})]}),t("span",{className:"text-right font-display text-[30px] font-medium tracking-[-0.025em] text-fg",children:e.repricing?N:s(e.grand,e.currency)})]})]})})}function ae(){const{items:e,close:r}=d();return t(o,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-3 px-8 pb-6 pt-4 max-[640px]:px-6",children:[a(u,{href:"/checkout",onClick:r,"aria-disabled":e.length===0,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[12px] uppercase tracking-[0.3em] transition-colors",e.length===0?"pointer-events-none 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:["Begin checkout",t("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}),t("div",{className:"flex items-center justify-between px-1 py-2 font-mono text-[10px] uppercase tracking-[0.24em] text-fg-dim",children:t(u,{href:"/wheels",onClick:r,className:"text-fg transition-colors hover:text-accent",children:"← Keep browsing"})})]})})}const R=["grid-cols-1","grid-cols-2","grid-cols-3"];function h({label:e,value:r}){return a("div",{className:"flex flex-col gap-1 bg-bg px-4 py-4",children:[t("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-fg-dim",children:e}),t("span",{className:"font-display text-[14px] font-medium tracking-[-0.005em] text-fg",children:r})]})}function E({line:e,tyre:r,onRemove:s,onQtyChange:n}){const{catalog:l,totals:c}=d(),m=(e.components??[]).reduce((f,y)=>f+(c.freeUnitsByPartNumber[y.partNumber]??0),0),{currency:i,formatMoney:x}=g();return a(o,{children:[a("article",{className:"grid grid-cols-[96px_1fr] gap-5 border-b border-line px-8 py-6 transition-colors hover:bg-[color-mix(in_oklab,var(--site-surface)_60%,transparent)] max-[640px]:grid-cols-[78px_1fr] max-[640px]:px-6 max-[640px]:py-5",children:[t(w,{line:e,catalog:l,tyre:r}),a("div",{className:"flex min-w-0 flex-col gap-2",children:[a("div",{className:"flex items-start justify-between gap-3",children:[a("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-accent",children:["N° ",e.positionNo," · ",e.process==="FusionForge®"?a(o,{children:["FusionForge",t(j,{})]}):e.process]}),t("span",{className:"whitespace-nowrap font-display text-[16px] font-medium tracking-[-0.015em] text-fg",children:v(e,i)===null?k:x(v(e,i),i)})]}),a("h3",{className:"mt-0.5 font-display text-[22px] font-medium uppercase leading-none tracking-[-0.02em]",children:[e.name.lead,t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em] normal-case",children:e.name.accent})]}),e.config.length>0&&a("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.config.map(f=>t("span",{className:["border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em]",f.gold?"border-[color-mix(in_oklab,var(--accent)_45%,var(--site-line))] text-accent":"border-line text-fg-dim"].join(" "),children:f.label},f.label)),m>0&&a("span",{className:"border border-accent bg-accent px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em] text-bg",children:[m,"× free"]})]}),a("div",{className:"mt-3 flex items-center justify-between gap-3",children:[t(S,{value:e.qty,onChange:n,size:"small"}),a("div",{className:"flex gap-4 font-mono text-[10px] uppercase tracking-[0.22em]",children:[t(u,{href:e.href??`/wheels/${e.slug}`,className:"text-fg-dim transition-colors hover:text-accent",children:e.href?"View product":"Edit finish"}),t("button",{type:"button",onClick:s,className:"text-fg-dim transition-colors hover:text-alert",children:"Remove"})]})]})]})]}),e.verifiedFor&&a("div",{className:"mx-8 -mt-px flex items-start gap-3 border-t-0 px-4 py-4 font-display text-[13px] leading-[1.45] text-fg max-[640px]:mx-6",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 35%, var(--site-line))",borderTop:"0"},children:[t("span",{className:"flex-shrink-0 pt-px font-mono text-[10px] uppercase tracking-[0.24em] text-accent",children:"Fits"}),a("span",{children:["Verified for your ",t("strong",{className:"font-medium text-accent",children:e.verifiedFor}),". Final torque values shipped with the wheels."]})]})]})}function L({title:e,sub:r,href:s}){return a(u,{href:s,className:"flex items-center justify-between border border-line bg-bg px-4 py-3 text-left transition-colors hover:border-accent",children:[a("span",{className:"flex min-w-0 flex-col gap-1",children:[t("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-display text-[13px] font-medium tracking-[-0.005em] text-fg",children:e}),t("span",{className:"font-mono text-[9px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),t("span",{className:"ml-2 flex h-6 w-6 flex-shrink-0 items-center justify-center font-mono text-[13px] text-accent",style:{borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))",borderWidth:1,borderStyle:"solid"},children:"+"})]})}function U(e,r,s){const n=e.savings[r];if(n===void 0)return"Buy together";const l=s(n,r);return e.savingIsFrom?`Save from ${l}`:`Save ${l}`}function I({children:e}){return t("span",{className:"inline-flex items-center gap-2 before:text-[6px] before:text-accent before:content-['●']",children:e})}function p({label:e,value:r}){return a("div",{className:"flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:[t("span",{children:e}),t("strong",{className:"font-display text-[14px] font-normal tracking-[-0.005em] normal-case text-fg",children:r})]})}function A({content:e}){return a("div",{className:"flex flex-col items-center justify-center gap-3 px-8 py-20 text-center",children:[t("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:e.emptyKicker}),t("p",{className:"font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:e.emptyBody}),a(u,{href:"/wheels",className:"mt-3 inline-flex items-center gap-3 border border-line px-5 py-3 font-mono text-[11px] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:["Browse the catalog ",t("span",{className:"text-accent",children:"→"})]})]})}export{ae as CartActions,ee as CartCouponRow,X as CartDrawerHeader,E as CartLineRow,J as CartLines,Y as CartStatusRail,re as CartTotals,te as CartTrustMarkers,Z as CartUpsell};
@@ -1 +1 @@
1
- "use client";import{jsx as e,Fragment as N,jsxs as a}from"react/jsx-runtime";import{useId as O}from"react";import X from"next/image";import Z from"next/link";import{lineTotal as J,useCart as ee}from"../CartContext.js";import{useCurrency as te}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{FREE_PRICE as A}from"../../lib/wheels/price-display.js";import ne from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as ae}from"../../lib/cart/coupon-preview.js";import{orderReference as re}from"../../lib/checkout/pay-first.js";import{PRICES_REQUOTED as ie,PRICES_UNCHECKED as le}from"../../lib/checkout/checkout-memory.js";import{shippingWords as oe,TAX_PENDING as ce}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as se}from"../../lib/wheels/finish-defaults.js";import U from"../ThemedSelect.js";import f from"../WebFormField.js";import de from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as pe,placedOrderLockNote as me,SHIPPING_RETRY_NOTE as ue,useCheckout as w}from"./checkout-state.js";import{FIELD_INPUT_CLASS as g}from"../../lib/field-input.js";import{FIGURE_UPDATING as T}from"../../lib/wheels/price-display.js";function He(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:s,setLastName:d,company:x,setCompany:k,me:y,signInHref:m,checkoutSignOut:b,orderLocked:o,unpaidOrder:c}=w(),u=O();return a(L,{num:"N° 01",title:"Contact",children:[o&&c&&e(fe,{orderNumber:c.orderNumber}),e(f,{label:"Email",htmlFor:u,hint:y?a(N,{children:["Signed in ·"," ",e("button",{type:"button",onClick:b,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):m?a(N,{children:["Have an account?"," ",e(B,{href:m,className:"underline transition-colors hover:text-accent",children:"Sign in"})]}):void 0,children:e("input",{id:u,type:"email",value:t,onChange:p=>i(p.target.value),placeholder:"you@example.com",readOnly:y!==null,className:g})}),a(q,{children:[e(f,{label:"First name",children:e("input",{type:"text",value:n,onChange:p=>l(p.target.value),className:g})}),e(f,{label:"Last name",children:e("input",{type:"text",value:s,onChange:p=>d(p.target.value),className:g})})]}),e(f,{label:"Company (optional)",children:e("input",{type:"text",value:x,onChange:p=>k(p.target.value),autoComplete:"organization",className:g})})]})}function Me(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:s,setAddress2:d,city:x,setCity:k,postcode:y,setPostcode:m,phone:b,setPhone:o,country:c,setCountry:u,subdivision:p,setSubdivision:h,subdivisions:E,destination:F,postcodeLabel:S,subdivisionLabel:v,me:R,savedAddresses:D,selectedAddressId:P,setSelectedAddressId:$,saveAddress:H,setSaveAddress:G,saveLabel:W,setSaveLabel:K,fillFromAddress:Q,orderLocked:V}=w(),M=O(),j=O();return a(L,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.readyIn&&e("span",{className:"opacity-80",children:t.readyIn}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(N,{children:[R!==null&&D.length>0&&a("div",{className:"grid gap-3",children:[D.map(r=>e(I,{active:P===r.id,onClick:()=>{$(r.id),Q(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(I,{active:P==="new",onClick:()=>$("new"),title:"New address",body:null,price:null})]}),e(f,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:g})}),e(f,{label:"Address line 2",children:e("input",{type:"text",value:s,onChange:r=>d(r.target.value),placeholder:"Apartment, unit, garage bay…",className:g})}),a(q,{cols:"three",children:[e(f,{label:"City",children:e("input",{type:"text",value:x,onChange:r=>k(r.target.value),className:g})}),e(f,{label:S,children:e("input",{type:"text",value:y,onChange:r=>m(r.target.value),className:g})}),e(f,{label:"Country",separate:!0,htmlFor:M,children:e(U,{id:M,value:c,onChange:r=>u(r.target.value),className:g+" pr-10",style:Y,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(f,{label:v,separate:!0,htmlFor:j,children:E.length>0?a(U,{id:j,value:p,onChange:r=>h(r.target.value),className:g+" pr-10",style:Y,children:[e("option",{value:"",children:"Select…"}),E.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:j,type:"text",value:p,onChange:r=>h(r.target.value),className:g})})]}),e(f,{label:"Phone",children:e("input",{type:"tel",value:b,onChange:r=>o(r.target.value),className:g})}),!t&&R!==null&&P==="new"&&!V&&a(N,{children:[e(xe,{checked:H,onChange:G,label:"Save this address to my account"}),H&&e(f,{label:"Address label",children:e("input",{type:"text",value:W,onChange:r=>K(r.target.value),placeholder:"Home",className:g})})]})]})}function Ue(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:s,pickupLocation:d,formatMoney:x,city:k,destination:y,courierUnavailable:m,retryCourier:b}=w();return e(L,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(o=>{const c=o.pickupLocation,u=c?[c.address,c.city,c.state,c.zipCode].filter(Boolean).join(", "):null;return e(I,{active:l===o.id,onClick:()=>s(o.id),title:c?`${o.name} — ${c.name}`:o.name,body:c?[u,c.openingHours,c.readyIn,c.instructions,o.description].filter(Boolean).join(" · "):o.description||null,price:t.freeShipping||o.amount===0?A:x(o.amount,t.currency),tag:o.tag||void 0},o.id)}),m?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ue," ",e("button",{type:"button",onClick:b,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Ye(){const{payChoice:t,setPayChoice:i,payment:n,payOptions:l,noPaymentMethod:s}=w();return a(L,{num:"N° 04",title:"Payment",children:[s&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:pe}),e("div",{className:"grid gap-3",children:l.map(d=>e(I,{active:t===d.key,onClick:()=>i(d.key),title:d.title,body:d.body,price:d.price,tag:d.tag},d.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function qe(){const{site:t,items:i,totals:n,coupon:l,formatMoney:s,payChoice:d,placing:x,email:k,orderError:y,payment:m,noPaymentMethod:b,unpaidOrder:o,formLocked:c,restoredPrices:u,quoteFailed:p,retryQuote:h,placeOrder:E}=w(),F=u==="waiting",S=u==="changed";return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(B,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(B,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(v=>e(be,{slug:v.slug,name:v.name,qty:v.qty,config:v.config,configSummary:ye(v.config),price:S||F?null:J(v,n.currency)??0,currency:n.currency},v.id))}),e(ge,{locked:c,className:"border-t border-line px-6 pt-5",children:e(ne,{customerEmail:k,disabled:c})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(C,{label:"Subtotal",value:F?T:s(S?n.serverSubtotal??0:n.subtotal,n.currency)}),n.discount>0&&l?.valid&&e(C,{label:`Coupon · ${l.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",s(n.discount,n.currency)]})}),l?.deferred&&e(C,{label:`Coupon · ${l.code}`,value:ae}),l?.valid&&l.effects?.gift&&e(C,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:A})}),e(C,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:A}):oe(n.shippingStatus)??s(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(C,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:s(n.tax.amount,n.currency)}):n.tax.name?e(C,{label:n.tax.name,value:ce}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?T:s(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[S&&e(_,{tone:"quiet",children:ie}),p&&a(_,{role:"alert",children:[le," ",e("button",{type:"button",onClick:h,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}),y&&e(_,{role:"alert",children:y}),n.hasUnpricedLine&&a(_,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:E,disabled:x||!o&&(b||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all max-[640px]:whitespace-nowrap max-[640px]:tracking-[0.04em]",x||!o&&(i.length===0||b||n.hasUnpricedLine||n.repricing)?"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:x?a(N,{children:["Building order… ",e("span",{children:"·"})]}):b?a(N,{children:["No online payment ",e("span",{children:"·"})]}):o?a(N,{children:[a("span",{children:["Try payment again",a(z,{children:[" · ",re(o)]})]}),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):p?a(N,{children:["Total not confirmed ",e("span",{children:"·"})]}):n.repricing?a(N,{children:[T," ",e("span",{children:"·"})]}):a(N,{children:[a("span",{children:[d==="bank"?"Place order":"Continue to payment",a(z,{children:[" · ",s(n.grand,n.currency)]})]}),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const he=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function ge({locked:t,className:i="",children:n}){return e("fieldset",{disabled:t,className:"m-0 min-w-0 border-0 p-0 "+i+he,children:n})}function B({href:t,className:i="",children:n,...l}){const{placing:s}=w();return s?e("span",{"aria-disabled":"true","aria-label":l["aria-label"],className:i+" pointer-events-none",children:n}):e(Z,{href:t,"aria-label":l["aria-label"],className:i,children:n})}function fe({orderNumber:t}){return e(_,{tone:"quiet",role:"status",children:a("span",{className:"flex items-start gap-2",children:[a("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[e("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),e("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),e("span",{children:me(t)})]})})}const Y={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function L({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center 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}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function q({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function I({active:t,onClick:i,title:n,body:l,price:s,tag:d}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,d&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:d})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:s})]})}function xe({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function be({slug:t,name:i,qty:n,config:l,configSummary:s,price:d,currency:x}){const{catalog:k}=ee(),{formatMoney:y}=te(),m=k.find(h=>h.slug===t),b=m?.spokes??5,o=m?.mesh??!1,c=l.find(h=>h.gold)?.label,u=m?.finishes.find(h=>h.name===c&&h.src)??m?.finishes.find(h=>h.src),p=m?.finishes[0]?.color??se;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative aspect-square",children:[e("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:u?.src?e(X,{src:u.src,alt:`${i.lead}${i.accent} — ${u.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:p},children:e(de,{spokes:b,mesh:o,className:"block w-full"})})}),e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:s})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:d===null?null:y(d,x)})]})}function z({children:t}){return e("span",{className:"max-[640px]:sr-only",children:t})}function C({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function ye(t){return t.map(i=>i.label).join(" · ")}export{He as CheckoutContact,qe as CheckoutOrderSummary,Ye as CheckoutPayment,Me as CheckoutShippingAddress,Ue as CheckoutShippingMethod,ge as FormLock,B as LeaveLink};
1
+ "use client";import{jsx as e,Fragment as N,jsxs as a}from"react/jsx-runtime";import{useId as O}from"react";import X from"next/image";import Z from"next/link";import{lineTotal as J,useCart as ee}from"../CartContext.js";import{useCurrency as te}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{FREE_PRICE as A}from"../../lib/wheels/price-display.js";import ne from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as ae}from"../../lib/cart/coupon-preview.js";import{orderReference as re}from"../../lib/checkout/pay-first.js";import{PRICES_REQUOTED as ie,PRICES_UNCHECKED as le}from"../../lib/checkout/checkout-memory.js";import{couponSaving as oe,deliveryAfterCoupon as ce,shippingWords as se,TAX_PENDING as de}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as pe}from"../../lib/wheels/finish-defaults.js";import U from"../ThemedSelect.js";import x from"../WebFormField.js";import me from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as ue,placedOrderLockNote as he,SHIPPING_RETRY_NOTE as ge,useCheckout as w}from"./checkout-state.js";import{FIELD_INPUT_CLASS as f}from"../../lib/field-input.js";import{FIGURE_UPDATING as T}from"../../lib/wheels/price-display.js";function Ue(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:s,setLastName:d,company:m,setCompany:k,me:v,signInHref:u,checkoutSignOut:b,orderLocked:o,unpaidOrder:c}=w(),h=O();return a(L,{num:"N° 01",title:"Contact",children:[o&&c&&e(be,{orderNumber:c.orderNumber}),e(x,{label:"Email",htmlFor:h,hint:v?a(N,{children:["Signed in ·"," ",e("button",{type:"button",onClick:b,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):u?a(N,{children:["Have an account?"," ",e(B,{href:u,className:"underline transition-colors hover:text-accent",children:"Sign in"})]}):void 0,children:e("input",{id:h,type:"email",value:t,onChange:p=>i(p.target.value),placeholder:"you@example.com",readOnly:v!==null,className:f})}),a(q,{children:[e(x,{label:"First name",children:e("input",{type:"text",value:n,onChange:p=>l(p.target.value),className:f})}),e(x,{label:"Last name",children:e("input",{type:"text",value:s,onChange:p=>d(p.target.value),className:f})})]}),e(x,{label:"Company (optional)",children:e("input",{type:"text",value:m,onChange:p=>k(p.target.value),autoComplete:"organization",className:f})})]})}function Ye(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:s,setAddress2:d,city:m,setCity:k,postcode:v,setPostcode:u,phone:b,setPhone:o,country:c,setCountry:h,subdivision:p,setSubdivision:g,subdivisions:E,destination:P,postcodeLabel:S,subdivisionLabel:y,me:R,savedAddresses:D,selectedAddressId:F,setSelectedAddressId:$,saveAddress:H,setSaveAddress:G,saveLabel:W,setSaveLabel:K,fillFromAddress:Q,orderLocked:V}=w(),M=O(),j=O();return a(L,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.readyIn&&e("span",{className:"opacity-80",children:t.readyIn}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(N,{children:[R!==null&&D.length>0&&a("div",{className:"grid gap-3",children:[D.map(r=>e(I,{active:F===r.id,onClick:()=>{$(r.id),Q(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(I,{active:F==="new",onClick:()=>$("new"),title:"New address",body:null,price:null})]}),e(x,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:f})}),e(x,{label:"Address line 2",children:e("input",{type:"text",value:s,onChange:r=>d(r.target.value),placeholder:"Apartment, unit, garage bay…",className:f})}),a(q,{cols:"three",children:[e(x,{label:"City",children:e("input",{type:"text",value:m,onChange:r=>k(r.target.value),className:f})}),e(x,{label:S,children:e("input",{type:"text",value:v,onChange:r=>u(r.target.value),className:f})}),e(x,{label:"Country",separate:!0,htmlFor:M,children:e(U,{id:M,value:c,onChange:r=>h(r.target.value),className:f+" pr-10",style:Y,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(x,{label:y,separate:!0,htmlFor:j,children:E.length>0?a(U,{id:j,value:p,onChange:r=>g(r.target.value),className:f+" pr-10",style:Y,children:[e("option",{value:"",children:"Select…"}),E.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:j,type:"text",value:p,onChange:r=>g(r.target.value),className:f})})]}),e(x,{label:"Phone",children:e("input",{type:"tel",value:b,onChange:r=>o(r.target.value),className:f})}),!t&&R!==null&&F==="new"&&!V&&a(N,{children:[e(ye,{checked:H,onChange:G,label:"Save this address to my account"}),H&&e(x,{label:"Address label",children:e("input",{type:"text",value:W,onChange:r=>K(r.target.value),placeholder:"Home",className:f})})]})]})}function qe(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:s,pickupLocation:d,formatMoney:m,city:k,destination:v,courierUnavailable:u,retryCourier:b}=w();return e(L,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(o=>{const c=o.pickupLocation,h=c?[c.address,c.city,c.state,c.zipCode].filter(Boolean).join(", "):null;return e(I,{active:l===o.id,onClick:()=>s(o.id),title:c?`${o.name} — ${c.name}`:o.name,body:c?[h,c.openingHours,c.readyIn,c.instructions,o.description].filter(Boolean).join(" · "):o.description||null,price:t.freeShipping||o.amount===0?A:t.deliveryDiscountPercent>0?a(N,{children:[e("s",{className:"text-fg-dim",children:m(o.amount,t.currency)})," ",m(ce(o.amount,t.deliveryDiscountPercent),t.currency)]}):m(o.amount,t.currency),tag:o.tag||void 0},o.id)}),u?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ge," ",e("button",{type:"button",onClick:b,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function ze(){const{payChoice:t,setPayChoice:i,payment:n,payOptions:l,noPaymentMethod:s}=w();return a(L,{num:"N° 04",title:"Payment",children:[s&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:ue}),e("div",{className:"grid gap-3",children:l.map(d=>e(I,{active:t===d.key,onClick:()=>i(d.key),title:d.title,body:d.body,price:d.price,tag:d.tag},d.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Ge(){const{site:t,items:i,totals:n,coupon:l,formatMoney:s,payChoice:d,placing:m,email:k,orderError:v,payment:u,noPaymentMethod:b,unpaidOrder:o,formLocked:c,restoredPrices:h,quoteFailed:p,retryQuote:g,placeOrder:E}=w(),P=h==="waiting",S=h==="changed";return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(B,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(B,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(y=>e(Ne,{slug:y.slug,name:y.name,qty:y.qty,config:y.config,configSummary:ve(y.config),price:S||P?null:J(y,n.currency)??0,currency:n.currency},y.id))}),e(xe,{locked:c,className:"border-t border-line px-6 pt-5",children:e(ne,{customerEmail:k,disabled:c})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(C,{label:"Subtotal",value:P?T:s(S?n.serverSubtotal??0:n.subtotal,n.currency)}),(n.discount>0||n.deliverySaving>0)&&l?.valid&&e(C,{label:`Coupon · ${l.code}`,value:e("span",{className:"font-semibold text-green",children:oe(n,y=>s(y,n.currency))})}),l?.deferred&&e(C,{label:`Coupon · ${l.code}`,value:ae}),l?.valid&&l.effects?.gift&&e(C,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:A})}),e(C,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:A}):se(n.shippingStatus)??s(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(C,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:s(n.tax.amount,n.currency)}):n.tax.name?e(C,{label:n.tax.name,value:de}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?T:s(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[S&&e(_,{tone:"quiet",children:ie}),p&&a(_,{role:"alert",children:[le," ",e("button",{type:"button",onClick:g,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}),v&&e(_,{role:"alert",children:v}),n.hasUnpricedLine&&a(_,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:E,disabled:m||!o&&(b||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all max-[640px]:whitespace-nowrap max-[640px]:tracking-[0.04em]",m||!o&&(i.length===0||b||n.hasUnpricedLine||n.repricing)?"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:m?a(N,{children:["Building order… ",e("span",{children:"·"})]}):b?a(N,{children:["No online payment ",e("span",{children:"·"})]}):o?a(N,{children:[a("span",{children:["Try payment again",a(z,{children:[" · ",re(o)]})]}),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):p?a(N,{children:["Total not confirmed ",e("span",{children:"·"})]}):n.repricing?a(N,{children:[T," ",e("span",{children:"·"})]}):a(N,{children:[a("span",{children:[d==="bank"?"Place order":"Continue to payment",a(z,{children:[" · ",s(n.grand,n.currency)]})]}),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const fe=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function xe({locked:t,className:i="",children:n}){return e("fieldset",{disabled:t,className:"m-0 min-w-0 border-0 p-0 "+i+fe,children:n})}function B({href:t,className:i="",children:n,...l}){const{placing:s}=w();return s?e("span",{"aria-disabled":"true","aria-label":l["aria-label"],className:i+" pointer-events-none",children:n}):e(Z,{href:t,"aria-label":l["aria-label"],className:i,children:n})}function be({orderNumber:t}){return e(_,{tone:"quiet",role:"status",children:a("span",{className:"flex items-start gap-2",children:[a("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[e("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),e("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),e("span",{children:he(t)})]})})}const Y={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function L({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center 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}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function q({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function I({active:t,onClick:i,title:n,body:l,price:s,tag:d}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,d&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:d})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:s})]})}function ye({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function Ne({slug:t,name:i,qty:n,config:l,configSummary:s,price:d,currency:m}){const{catalog:k}=ee(),{formatMoney:v}=te(),u=k.find(g=>g.slug===t),b=u?.spokes??5,o=u?.mesh??!1,c=l.find(g=>g.gold)?.label,h=u?.finishes.find(g=>g.name===c&&g.src)??u?.finishes.find(g=>g.src),p=u?.finishes[0]?.color??pe;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative aspect-square",children:[e("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:h?.src?e(X,{src:h.src,alt:`${i.lead}${i.accent} — ${h.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:p},children:e(me,{spokes:b,mesh:o,className:"block w-full"})})}),e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:s})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:d===null?null:v(d,m)})]})}function z({children:t}){return e("span",{className:"max-[640px]:sr-only",children:t})}function C({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function ve(t){return t.map(i=>i.label).join(" · ")}export{Ue as CheckoutContact,Ge as CheckoutOrderSummary,ze as CheckoutPayment,Ye as CheckoutShippingAddress,qe as CheckoutShippingMethod,xe as FormLock,B as LeaveLink};
@@ -60,6 +60,8 @@ declare function useCheckoutState({ site, logo, signInHref, preview }: CheckoutP
60
60
  appliedBundles: import("../../lib/api/index.js").AppliedBundle[];
61
61
  shipping: number;
62
62
  freeShipping: boolean;
63
+ deliveryDiscountPercent: number;
64
+ deliverySaving: number;
63
65
  shippingStatus: import("../../lib/cart/shipping-status.js").ShippingStatus;
64
66
  freeUnitsByPartNumber: Record<string, number>;
65
67
  tax: {
@@ -2119,6 +2119,7 @@ export interface components {
2119
2119
  CouponEffects: {
2120
2120
  discountAmount: string;
2121
2121
  freeShipping: boolean;
2122
+ deliveryDiscountPercent: string;
2122
2123
  freightWaived: string;
2123
2124
  freeUnits: components["schemas"]["CouponFreeUnit"][];
2124
2125
  gift?: components["schemas"]["CouponGift"] | null;
@@ -9,4 +9,9 @@ export declare function shippingStatus({ quoted, optionCount, chosenAmount, coup
9
9
  chosenAmount: number | undefined;
10
10
  couponWaivesFreight: boolean;
11
11
  }): ShippingStatus;
12
+ export declare function deliveryAfterCoupon(amount: number, percent: number): number;
13
+ export declare function couponSaving({ discount, deliverySaving }: {
14
+ discount: number;
15
+ deliverySaving: number;
16
+ }, money: (amount: number) => string): string;
12
17
  export declare function shippingWords(status: ShippingStatus): string | null;
@@ -1 +1 @@
1
- import{FREE_PRICE as c}from"../wheels/price-display.js";const i="Arranged after review",t="Calculated at checkout",o=t,p=t;function s({quoted:r,optionCount:n,chosenAmount:e,couponWaivesFreight:a}){return r&&n===0?"arranged":a?"free":e===void 0?"pending":e===0?"free":"charged"}function d(r){switch(r){case"arranged":return i;case"pending":return o;case"free":return c;case"charged":return null}}export{t as CALCULATED_AT_CHECKOUT,i as SHIPPING_ARRANGED,o as SHIPPING_PENDING,p as TAX_PENDING,s as shippingStatus,d as shippingWords};
1
+ import{FREE_PRICE as u}from"../wheels/price-display.js";const i="Arranged after review",t="Calculated at checkout",a=t,f=t;function p({quoted:r,optionCount:e,chosenAmount:n,couponWaivesFreight:o}){return r&&e===0?"arranged":o?"free":n===void 0?"pending":n===0?"free":"charged"}function d(r,e){return r*(100-e)/100}function l({discount:r,deliverySaving:e},n){return[r>0?`− ${n(r)}`:null,e>0?`${n(e)} off delivery`:null].filter(Boolean).join(" · ")}function s(r){switch(r){case"arranged":return i;case"pending":return a;case"free":return u;case"charged":return null}}export{t as CALCULATED_AT_CHECKOUT,i as SHIPPING_ARRANGED,a as SHIPPING_PENDING,f as TAX_PENDING,l as couponSaving,d as deliveryAfterCoupon,p as shippingStatus,s as shippingWords};