efficient-storefront-blocks 0.131.1 → 0.132.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/chunks/{CustomHtmlCodeWindow-JINOMDUB.js → CustomHtmlCodeWindow-2WCOBTZI.js} +1 -1
- package/dist/chunks/EditorPreviewCheckout-LWCGOB7R.js +4 -0
- package/dist/chunks/SiteEditorProvider-IOAQH4S4.js +1 -0
- package/dist/chunks/{chunk-3QCDDPXL.js → chunk-3P4XQK3S.js} +1 -1
- package/dist/chunks/{chunk-QYTBEMMG.js → chunk-3RAPOAJE.js} +2 -2
- package/dist/chunks/{chunk-43XANC6T.js → chunk-OBAUAKZL.js} +1 -1
- package/dist/chunks/{chunk-GVSVEV2H.js → chunk-PB4FLVPH.js} +8 -8
- package/dist/chunks/{chunk-SV3VVDBH.js → chunk-TNWF32DT.js} +1 -1
- package/dist/chunks/{chunk-7W33H2GG.js → chunk-UFQDBLLF.js} +1 -1
- package/dist/chunks/chunk-WCEMPYVI.js +1 -0
- package/dist/chunks/{chunk-R5FDAR72.js → chunk-XXVOKKJV.js} +1 -1
- package/dist/chunks/{fitment-data-FRSLYOCL.js → fitment-data-MW7I7F7T.js} +1 -1
- package/dist/chunks/{section-css-style-3IQWMPDP.js → section-css-style-7OKHUI7L.js} +1 -1
- package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +1 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +28 -28
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CartContext.d.ts +2 -0
- package/dist/render/components/CartContext.js +1 -1
- package/dist/render/components/GalleryCard.d.ts +2 -1
- package/dist/render/components/GalleryCard.js +1 -1
- package/dist/render/components/GalleryGrid.d.ts +2 -1
- package/dist/render/components/GalleryGrid.js +3 -3
- package/dist/render/components/GalleryItem.d.ts +1 -0
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/cart/drawer-parts.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +2 -0
- package/dist/render/lib/api/types.d.ts +1 -0
- package/dist/render/lib/cart/shipping-status.d.ts +5 -0
- package/dist/render/lib/cart/shipping-status.js +1 -1
- package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
- package/dist/render/lib/sections/gallery-mosaic.d.ts +3 -0
- package/dist/render/lib/sections/gallery-mosaic.js +1 -0
- package/dist/render/lib/sections/gallery-toolbar.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +2 -0
- package/dist/words.js +2 -2
- package/package.json +2 -2
- package/dist/chunks/EditorPreviewCheckout-B5B4BHEG.js +0 -4
- package/dist/chunks/SiteEditorProvider-CJRYE2LF.js +0 -1
- package/dist/chunks/chunk-PJVO662Y.js +0 -1
- /package/dist/chunks/{chunk-TICXZI44.js → chunk-2NWFNMO3.js} +0 -0
- /package/dist/chunks/{chunk-QYTBEMMG.js.LEGAL.txt → chunk-3RAPOAJE.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-FVHAKC6L.js → chunk-AHUOASUP.js} +0 -0
- /package/dist/chunks/{chunk-43XANC6T.js.LEGAL.txt → chunk-OBAUAKZL.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-T5PQ7BY4.js → chunk-YDV7IGPY.js} +0 -0
|
@@ -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
|
|
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};
|
|
@@ -24,6 +24,7 @@ interface Props {
|
|
|
24
24
|
displayPhone?: unknown;
|
|
25
25
|
styleOwner?: string;
|
|
26
26
|
editing?: boolean;
|
|
27
|
+
setCount?: number;
|
|
27
28
|
}
|
|
28
|
-
export default function GalleryCard({ build, hiddenMobile, alwaysShowOverlay, forceHover, index, total, ratio, captionPlace, display, displayPhone, styleOwner, editing }: Props): import("react").JSX.Element;
|
|
29
|
+
export default function GalleryCard({ build, hiddenMobile, alwaysShowOverlay, forceHover, index, total, ratio, captionPlace, display, displayPhone, styleOwner, editing, setCount }: Props): import("react").JSX.Element;
|
|
29
30
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import{useState as S}from"react";import T from"next/image";import u from"efficient-web-builder/render/components/Placeholder";import{withRMark as d}from"efficient-web-builder/render/components/RMark";import{galleryCaptionIsBelow as _,galleryCardRatioClass as w}from"efficient-web-builder/format/lib/content/gallery-card-layout";import{partDisplayClass as R}from"efficient-web-builder/format/lib/content/part-display";import{PART_STYLE_KIND_ATTR as A,PART_STYLE_OWNER_ATTR as C}from"efficient-web-builder/render/lib/document/text-parts";import E from"efficient-web-builder/render/components/PartStyledKind";import{gallerySetChip as L}from"../lib/sections/gallery-mosaic.js";const P=(e,o)=>`${String(e).padStart(2,"0")} / ${String(o).padStart(2,"0")}`;function D({build:e,hiddenMobile:o,alwaysShowOverlay:n,forceHover:l,index:c,total:m,ratio:p,captionPlace:b,display:N,displayPhone:z,styleOwner:h,editing:f=!1,setCount:v}){const a=g=>R(N,z,g),r=g=>f&&h?{[C]:h,[A]:`@${g}`}:{},i=(g,y)=>!f&&h?t(E,{kind:`@${g}`,shared:!0,children:y}):y,[k,j]=S(!1);if(v!=null)return t(I,{build:e,count:v,ratio:p,shown:a,keptAttrs:r,kept:i});const $=_(b),x=s("div",{className:["sf-card group relative overflow-hidden bg-surface-2",w(p),o?"max-view-wide:hidden":""].join(" "),children:[s("div",{className:["absolute inset-0 z-[1] flex items-center justify-center transition-[transform,filter,opacity] duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",l?"scale-[1.06] opacity-0 [filter:brightness(0.5)]":"group-hover:scale-[1.06] group-hover:opacity-0 group-hover:[filter:brightness(0.5)]"].join(" "),children:[t(u,{label:e.imageLabel,src:e.imageSrc}),!n&&t("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.35)"}})]}),t("div",{className:["absolute inset-0 z-[1] flex items-center justify-center transition-[transform,filter,opacity] duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",l?"opacity-100 scale-[1.06] [filter:brightness(0.5)]":"opacity-0 group-hover:scale-[1.06] group-hover:opacity-100 group-hover:[filter:brightness(0.5)]"].join(" "),style:{background:"var(--site-surface)"},children:e.detailSrc&&t(T,{src:e.detailSrc,alt:"",fill:!0,sizes:"(max-width: 800px) 100vw, (max-width: 1500px) 33vw, 25vw",loading:"lazy",className:"absolute inset-0 z-[3] object-cover",style:{display:k?"none":"block"},onError:()=>j(!0)})}),(e.process||c!=null&&m!=null)&&s("div",{className:"pointer-events-none absolute top-3 left-3 right-3 z-[3] flex items-baseline gap-2 max-view-wide:top-2.5 max-view-wide:left-2.5 max-view-wide:right-2.5",children:[e.process&&t("span",{...r("tag"),className:["min-w-0 truncate font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.24em] text-accent",a("tag"),"transition-opacity duration-300 ease-out",n||l?"opacity-100":"opacity-0 group-hover:opacity-100 max-view-wide:opacity-100"].join(" "),children:i("tag",d(e.process))}),c!=null&&m!=null&&t("span",{...r("number"),className:`ml-auto shrink-0 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.24em] ${a("number")}`.trim(),style:{color:"rgba(245,241,232,0.7)"},children:i("number",P(c,m))})]}),t("div",{className:["absolute inset-0 z-[2]","transition-[opacity,transform] duration-300 ease-out",n||l?"opacity-100 translate-y-0":"opacity-0 translate-y-2 group-hover:opacity-100 group-hover:translate-y-0 max-view-wide:opacity-100 max-view-wide:translate-y-0"].join(" "),style:{color:"var(--overlay-fg)",background:n?"linear-gradient(180deg, rgba(10,10,10,.55) 0%, transparent 35%, transparent 55%, rgba(10,10,10,.92) 100%)":"linear-gradient(180deg, transparent 40%, rgba(10,10,10,.85) 100%)"},children:s("div",{className:"absolute inset-x-0 bottom-0 top-9 flex flex-col justify-end gap-1 overflow-hidden p-6 max-view-wide:top-8 max-view-wide:p-3.5",children:[e.car&&t("div",{...r("eyebrow"),className:`truncate font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.2em] text-accent max-view-wide:text-[length:var(--size-label,11px)] max-view-wide:tracking-[0.15em] ${a("eyebrow")}`.trim(),children:i("eyebrow",e.car)}),e.wheel&&t("div",{...r("title"),className:`font-heading3 text-[length:var(--size-headingSmall,22px)] font-medium leading-[1.05] tracking-[-0.02em] max-view-wide:text-[length:var(--size-body,16px)] ${n?"uppercase ":""}${a("title")}`.trim(),children:i("title",e.wheel)}),e.finish&&t("div",{...r("meta"),className:`mt-1.5 flex gap-3.5 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.12em] ${a("meta")}`.trim(),style:{color:"rgba(245,241,232,0.7)"},children:t("span",{children:i("meta",d(e.finish))})})]})})]});return $?s("div",{className:o?"max-view-wide:hidden":"",children:[x,s("div",{className:"bg-surface px-3.5 pt-3 pb-3.5",children:[e.wheel&&t("div",{...r("title"),className:`font-display text-[length:var(--size-body,15px)] font-medium leading-[1.25] tracking-[-0.01em] text-fg ${a("title")}`.trim(),children:i("title",e.wheel)}),(e.finish||e.car)&&t("div",{...r(e.finish?"meta":"eyebrow"),className:`mt-0.5 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] text-fg-dim ${a(e.finish?"meta":"eyebrow")}`.trim(),children:i(e.finish?"meta":"eyebrow",d(e.finish||e.car))})]})]}):x}function I({build:e,count:o,ratio:n,shown:l,keptAttrs:c,kept:m}){const p=L(o);return s("div",{className:`sf-card relative overflow-hidden bg-surface-2 ${w(n)}`,style:{color:"var(--overlay-fg)"},children:[t("div",{className:"absolute inset-0 flex items-center justify-center",children:t(u,{label:e.imageLabel,src:e.imageSrc})}),t("div",{className:"absolute inset-0",style:{background:"linear-gradient(180deg, color-mix(in srgb, var(--overlay-scrim) 0%, transparent) 45%, color-mix(in srgb, var(--overlay-scrim) 70%, transparent))"}}),p&&t("span",{"data-gallery-set-chip":"",className:"absolute right-3 top-3 z-1 bg-overlay-scrim/45 px-2 py-1 text-[length:var(--size-label,11px)] tracking-[0.12em]",children:p}),s("div",{className:"absolute bottom-[18px] left-5 right-5 z-1 max-view-wide:bottom-2.5 max-view-wide:left-3",children:[e.wheel&&t("div",{...c("title"),className:`text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] opacity-85 ${l("title")}`.trim(),children:m("title",d(e.wheel))}),e.car&&t("div",{...c("eyebrow"),className:`mt-1 text-lg leading-normal max-view-wide:text-sm ${l("eyebrow")}`.trim(),children:m("eyebrow",e.car)})]})]})}export{D as default,P as galleryTileNumber};
|
|
@@ -24,5 +24,6 @@ export interface GalleryGridProps {
|
|
|
24
24
|
layoutPhone?: string;
|
|
25
25
|
gap?: number | string;
|
|
26
26
|
gapPhone?: unknown;
|
|
27
|
+
sets?: boolean;
|
|
27
28
|
}
|
|
28
|
-
export default function GalleryGrid({ items: Items, template, nodeId, sourced, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, layoutPhone, columns, columnsMobile, gap: gapProp, gapPhone, omitHead, pads, editing, }: GalleryGridProps): import("react").JSX.Element;
|
|
29
|
+
export default function GalleryGrid({ items: Items, template, nodeId, sourced, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, layoutPhone, columns, columnsMobile, gap: gapProp, gapPhone, sets, omitHead, pads, editing, }: GalleryGridProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
2
|
-
`),b=f(()=>
|
|
3
|
-
`):[]:c?.blockIds,[
|
|
1
|
+
"use client";import{jsx as r,jsxs as ce}from"react/jsx-runtime";import{useCallback as j,useMemo as f,useState as B}from"react";import{usePathname as me}from"next/navigation";import{containerGapProps as pe}from"efficient-web-builder/format/lib/content/container-gap";import fe from"efficient-web-builder/render/components/Btn";import ge,{GALLERY_GRID_ATTR as ue,GalleryLinksContext as ye,GalleryTilesContext as he}from"./GalleryItem.js";import{useShopperGallery as we}from"./catalog/ShopperScope.js";import{galleryShownIds as Le,galleryToolbarIdle as Se,WALL_PLACED_CELL as Ce,WALL_PLACED_CSS as xe,wallSpanAt as ve}from"../lib/sections/gallery-toolbar.js";import{GALLERY_MOSAIC_LAYOUT as Ge,galleryMosaicRowsCss as Ne}from"../lib/sections/gallery-mosaic.js";import{useSiteSells as _e}from"./SiteRecordContext.js";import{SharedPartKinds as Ae}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as Pe}from"efficient-web-builder/render/components/goldPhrases";import ke from"efficient-web-builder/render/components/SectionHeader";import{FRAME_120 as Oe,framedBandPad as be,headIsEmpty as Ie,withBandClasses as Te}from"../lib/sections/band-padding.js";import{galleryFrame as Ee,galleryTemplate as Re}from"../lib/sections/gallery-frame.js";import{SITE_COLUMN as Me,withSideOnce as je}from"efficient-web-builder/format/lib/content/page-width";import{resolveGridColumns as Be,resolveGridMobileColumns as $e}from"efficient-web-builder/format/lib/content/grid-span";import{galleryLayoutClass as $,galleryLayoutCss as De,resolveGalleryLayout as Ye}from"efficient-web-builder/format/lib/content/gallery-layout";import{HideTaker as ze}from"efficient-web-builder/render/components/ViewHideRoot";import{useSideSpaceOnce as Fe}from"efficient-web-builder/render/components/SideSpaceOnce";function Ue({items:c,template:D,nodeId:Y,sourced:a,num:x,title:w,linkText:v,linkHref:z,galleryHref:g="/gallery",submitHref:F="/contact",previewHover:U,display:W,displayPhone:K,styleOwner:V,layout:G,layoutPhone:q,columns:u,columnsMobile:H,gap:J,gapPhone:Q,sets:N=!1,omitHead:L=!1,pads:X,editing:_=!1}){const Z=Fe(),ee=me(),le=_e(),se=g!==ee&&(le||g!=="/gallery"),y={layout:G,layoutPhone:q},m=Ye(y),re=!m&&u!=null&&u!=="",i=pe("GalleryB",J,"both",Q),A=m?{className:`sf-card-grid sf-gallery-zone ${$(y)} grid${i.className}`,style:i.style}:re?{className:`sf-card-grid sf-grid-zone grid${i.className}`,style:{...i.style,"--sf-grid-cols":String(Be(u)),"--sf-grid-cols-phone":String($e(H,u))}}:{className:`sf-card-grid grid grid-cols-4${i.className} max-[1500px]:grid-cols-3 max-view-wide:grid-cols-1`,style:i.style},P=v?{text:v,href:z||"#"}:void 0,ne=w?Pe(w,!1):void 0,[k,te]=B({}),O=j((e,s)=>{te(l=>{const o=l[e.id];if(s){if(!o)return l;const{[e.id]:We,...de}=l;return de}return o&&o.tag===e.tag&&o.name===e.name?l:{...l,[e.id]:e}})},[]),h=a?.map(e=>e.tile.id).join(`
|
|
2
|
+
`),b=f(()=>h!==void 0?h?h.split(`
|
|
3
|
+
`):[]:c?.blockIds,[h,c?.blockIds]),d=f(()=>(b??[]).map(e=>k[e]).filter(e=>!!e),[b,k]),{ref:oe,toolbar:p}=we(d),I=p!==null&&!Se(p,d),n=f(()=>I&&p?Le(d,p):null,[I,p,d]),t=f(()=>n??d.map(e=>e.id),[n,d]),[T,ae]=B(null),E=j((e,s)=>{const l=t.indexOf(e);l<0||t.length<2||ae({id:t[(l+s+t.length)%t.length],at:s>0?"first":"last"})},[t]),ie=f(()=>{const e=new Map((n??[]).map((s,l)=>[s,l]));return{report:O,positionOf:s=>{const l=n?e.get(s):void 0;return l===void 0?null:{index:l+1,total:n.length}},walkCount:t.length,walk:E,opening:T}},[O,n,t.length,E,T]),S=n?e=>{const s=n.indexOf(e);if(s<0)return{style:{display:"none"}};if(!m)return{style:{order:s}};const l=ve(m,s,n.length);return{className:Ce,style:{order:s,"--sf-wall-c":l.col,"--sf-wall-r":l.row,"--sf-wall-cp":l.colPhone,"--sf-wall-rp":l.rowPhone}}}:void 0,R=m?De(y)+(G===Ge?Ne($(y)):""):"",C=be(X,Oe,{noTop:L,nonNegative:!0}),M=Re(D,!a);return r(ze,{as:"section",ref:oe,...C.attrs,className:Te(Ee(L,!!M),C),style:C.style,children:ce("div",{className:je(Me,Z),children:[L||!_&&Ie(x,w,P?.text)?null:r(ke,{num:x,title:ne,link:P}),R?r("style",{dangerouslySetInnerHTML:{__html:R+(n?xe:"")}}):null,(c||a)&&r(ye.Provider,{value:{galleryHref:g,submitHref:F,previewHover:U,display:W,displayPhone:K,styleOwner:V,wordsAtRest:!!a,ownerId:Y,Template:M,...N?{sets:N}:{}},children:r(he.Provider,{value:ie,children:r(Ae,{children:r("div",{[ue]:"",style:{display:"contents"},children:a?r("div",{...A,children:a.map(({tile:e,...s})=>{const l=r(ge,{...s,tile:e,editing:_},e.id),o=S?.(e.id);return o?r("div",{className:o.className,style:o.style,children:l},e.id):l})}):c?r(c,{...A,minEmptyHeight:320,...S?{cell:S}:{}}):null})})})}),se&&r("div",{className:"mt-12 flex flex-col items-center gap-3",children:r(fe,{href:g,variant:"ghost",children:"See Gallery"})})]})})}export{Ue as default};
|
|
@@ -12,6 +12,7 @@ export declare const GalleryLinksContext: import("react").Context<{
|
|
|
12
12
|
wordsAtRest?: boolean;
|
|
13
13
|
Template?: ReturnType<typeof galleryTemplate>;
|
|
14
14
|
ownerId?: string;
|
|
15
|
+
sets?: boolean;
|
|
15
16
|
}>;
|
|
16
17
|
export declare const GALLERY_TILE_PARTS: readonly [{
|
|
17
18
|
readonly id: "tag";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as n,Fragment as x}from"react/jsx-runtime";import{createContext as V,useCallback as ae,useContext as X,useEffect as q,useRef as se,useState as I}from"react";import P from"next/link";import{slugify as ie}from"efficient-shell/format";import{CardTemplateRows as ce}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as pe,SIDE_ONCE_HOLDS_CLASS as de}from"efficient-web-builder/format/lib/content/page-width";import me,{galleryTileNumber as fe}from"./GalleryCard.js";import he,{LightboxClose as xe,LIGHTBOX_CLOSE_TINT as ue}from"./Lightbox.js";import{useSiteSells as ge}from"./SiteRecordContext.js";import{renderGold as f,renderHeadline as Z}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as be}from"efficient-web-builder/format/lib/sized-image";import{useBrowserLayoutEffect as ve}from"efficient-shell/hooks";import{HideTaker as J}from"efficient-web-builder/render/components/ViewHideRoot";import{useSideSpaceOnce as we}from"efficient-web-builder/render/components/SideSpaceOnce";const ye="(max-width: 1100px) 100vw, min(59vw, 1050px)",ke=V({}),Ue=[{id:"tag",label:"Tag"},{id:"eyebrow",label:"Eyebrow"},{id:"title",label:"Title"},{id:"meta",label:"Meta"},{id:"number",label:"Card number"}],Ne=V(null),Se="data-gallery-grid",z="data-gallery-tile";function Le(t,o){const[a,i]=I(null);return q(()=>{const c=t.current,s=c?.closest(`[${Se}]`);if(!c||!s)return;const w=()=>{const k=Array.from(s.querySelectorAll(`[${z}]`)),N=k.indexOf(c),u=N>=0?{index:N+1,total:k.length}:null;i(g=>g?.index===u?.index&&g?.total===u?.total?g:u)};if(w(),!o)return;const y=new MutationObserver(w);return y.observe(s,{childList:!0,subtree:!0}),()=>y.disconnect()},[t,o]),a}const Ve={process:"Category",eyebrow:"Subtitle",name:"Item name",meta:"Detail"},_e=()=>({image:"",href:"#",process:"",eyebrow:"",name:"",meta:""}),Xe=Array.from({length:6},_e);function Ce(t){const o=(t.photos??[]).map(s=>s?.src).filter(s=>!!s),a=t.image||o[0]||"",i=[a,...o].filter(s=>!!s),c=ie(t.name)||"gallery-item";return{car:t.eyebrow??"",wheel:t.name??"",process:t.process??"",finish:t.meta??"",imageLabel:`${c}.jpg`,detailLabel:`${c}-detail.jpg`,imageSrc:a||void 0,detailSrc:o[0]||a||void 0,photos:i,href:t.href}}function Te({editing:t=!1,previewHover:o,ratio:a,captionPlace:i,tile:c,...s}){const w=we(),{galleryHref:y="/gallery",submitHref:k="/contact",previewHover:N,display:u,displayPhone:g,styleOwner:ee,photosOnly:te=!1,wordsAtRest:re=!1,Template:A,ownerId:oe}=X(ke),e=Ce(s),b=ge()&&!te,H=!b&&!Oe(e),p=e.photos??(e.imageSrc?[e.imageSrc]:[]),$=se(null),j=ae(l=>{$.current=l},[]),ne=Le($,t),h=X(Ne),S=h?.report,d=c?.id,G=c?.tag??"",R=c?.name??"";ve(()=>{if(!S||!d)return;const l={id:d,tag:G,name:R};return S(l),()=>S(l,!0)},[S,d,G,R]);const v=(d?h?.positionOf(d):null)??ne,B=t&&(!!o||!!N),[le,m]=I(!1),[L,C]=I(0),M=!!d&&!!h&&h.walkCount>1,D=l=>{const E=L+l;if(M&&(E<0||E>=p.length)){m(!1),h.walk(d,l);return}C((E+p.length)%p.length)},Y=()=>D(-1),W=()=>D(1),T=p.length>1||M,_=h?.opening;q(()=>{!_||_.id!==d||(C(_.at==="last"?Math.max(0,p.length-1):0),m(!0))},[_,d]);const O=p[L]??e.imageSrc??"",F=p.slice(1),U=A?r("div",{className:`block w-full min-w-0 ${pe}${w?` ${de}`:""}`,children:r(ce,{ownerId:oe??"GalleryB",ownerType:"GalleryB",Template:A,rows:[{key:d??e.imageSrc??"tile",image:e.imageSrc??"",tag:e.process,number:v?fe(v.index,v.total):"",eyebrow:e.car,name:e.wheel,meta:e.finish,href:e.href??""}],items:[{hoverMedia:F.length?{photos:[{finish:"",items:F.map(l=>({url:l,kind:"image"}))}]}:null}],previewHover:B,fallback:null,children:l=>l})}):r(me,{build:e,forceHover:B,alwaysShowOverlay:re,index:v?.index,total:v?.total,ratio:a,captionPlace:i,display:u,displayPhone:g,styleOwner:ee,editing:t});return n(x,{children:[t?r(J,{as:"div",ref:j,[z]:"",className:"block w-full text-left",children:U}):r(J,{as:"button",ref:j,[z]:"",type:"button","aria-label":b?`Open ${e.car||"build"} on ${e.wheel||"wheel"}`:Q(e),onClick:()=>{C(0),m(!0)},className:"block w-full cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:U}),r(he,{open:le,onClose:()=>m(!1),label:b?`${e.car} on ${e.wheel}`:Q(e),onPrev:T?Y:void 0,onNext:T?W:void 0,className:"flex items-center justify-center p-6 max-[700px]:p-3",children:n("div",{onClick:l=>l.stopPropagation(),className:`relative grid w-[min(1800px,100%)] max-h-[calc(100vh-48px)] ${H?"grid-cols-1":"grid-cols-[1.4fr_1fr]"} overflow-hidden border border-line bg-bg max-view-desktop:grid-cols-1 max-view-desktop:overflow-auto`,style:{boxShadow:"0 60px 120px -20px color-mix(in srgb, var(--sf-shadow-color, #141416) 70%, transparent)"},children:[r(xe,{label:"Close popup",className:"absolute right-[24px] top-[24px] z-[5] flex h-[56px] w-[56px] items-center justify-center border border-line font-mono text-[length:var(--size-label,21px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:ue},children:"✕"}),n("div",{className:"relative flex min-h-[690px] items-center justify-center overflow-hidden bg-surface-2 max-view-desktop:min-h-[450px]",children:[O&&r("img",{...be(O,{fallbackWidth:1280}),sizes:ye,alt:`${(b?e.car:e.wheel||e.car)||"Photo"} — ${L+1} of ${p.length}`,className:"block h-full max-h-[88vh] w-full object-cover"},O),T&&n(x,{children:[r("button",{type:"button","aria-label":"Previous photo",onClick:Y,className:"absolute left-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),r("button",{type:"button","aria-label":"Next photo",onClick:W,className:"absolute right-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"}),p.length>1&&n("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[L+1," / ",p.length]})]})]}),b?n("div",{className:"flex flex-col gap-[30px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[e.process&&r("span",{className:"font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.3em] text-accent",children:f(e.process)}),e.wheel&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:Z(e.wheel,!1)}),e.car&&n("div",{className:"font-heading3 text-[length:var(--size-headingSmall,27px)] leading-[1.4] text-fg",children:["on ",r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em]",children:f(e.car,!0)})]}),n("dl",{className:"mt-3 grid grid-cols-[auto_1fr] gap-x-7 gap-y-[18px] border-y border-line py-[30px] font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em]",children:[e.wheel&&n(x,{children:[r("dt",{className:"text-fg-dim",children:"Wheel"}),r("dd",{className:"text-fg",children:f(e.wheel)})]}),e.process&&n(x,{children:[r("dt",{className:"text-fg-dim",children:"Process"}),r("dd",{className:"text-fg",children:f(e.process)})]}),e.finish&&n(x,{children:[r("dt",{className:"text-fg-dim",children:"Finish"}),r("dd",{className:"text-fg",children:f(e.finish)})]}),e.car&&n(x,{children:[r("dt",{className:"text-fg-dim",children:"Vehicle"}),r("dd",{className:"text-fg",children:f(e.car)})]})]}),n("div",{className:"mt-auto flex flex-col gap-3.5 pt-6",children:[n(P,{href:e.href||"/wheels",onClick:()=>m(!1),className:"group flex items-center justify-between gap-6 border border-btn bg-btn px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",children:[r("span",{children:"View product"}),r("span",{className:"transition-transform group-hover:translate-x-[6px]",children:"→"})]}),n(P,{href:y,onClick:()=>m(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"See more builds"}),r("span",{children:"→"})]}),n(P,{href:k,onClick:()=>m(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"Submit your build"}),r("span",{children:"→"})]})]})]}):!H&&r(Ee,{build:e})]})})]})}function K(t){return[t.process,t.car,t.finish].filter((o,a,i)=>!!o&&o!==t.wheel&&i.indexOf(o)===a)}function Oe(t){return!!t.wheel||K(t).length>0}function Q(t){const o=t.wheel||t.car;return o?`Open photo of ${o}`:"Open photo"}function Ee({build:t}){const o=t.wheel,a=K(t);return n("div",{className:"flex flex-col gap-[24px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[o&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:Z(o,!1)}),a.map(i=>r("p",{className:"text-[length:var(--size-body,18px)] leading-[1.5] text-fg",children:f(i)},i))]})}export{Se as GALLERY_GRID_ATTR,Ve as GALLERY_ITEM_HINTS,Xe as GALLERY_ITEM_SEEDS,z as GALLERY_TILE_ATTR,Ue as GALLERY_TILE_PARTS,ke as GalleryLinksContext,Ne as GalleryTilesContext,Te as default};
|
|
1
|
+
"use client";import{jsx as r,jsxs as l,Fragment as y}from"react/jsx-runtime";import{createContext as K,useCallback as de,useContext as J,useEffect as Q,useRef as me,useState as z}from"react";import I from"next/link";import{SiteLink as pe}from"efficient-web-builder/render/lib/site-runtime";import{GALLERY_PHONE_BREAKPOINT as fe}from"efficient-web-builder/format/lib/content/gallery-layout";import{slugify as he}from"efficient-shell/format";import{CardTemplateRows as xe}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ge,SIDE_ONCE_HOLDS_CLASS as ue}from"efficient-web-builder/format/lib/content/page-width";import be,{galleryTileNumber as we}from"./GalleryCard.js";import ee,{LightboxClose as te,LIGHTBOX_CLOSE_TINT as ve}from"./Lightbox.js";import{useSiteSells as ye}from"./SiteRecordContext.js";import{renderGold as b,renderHeadline as re}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as A}from"efficient-web-builder/format/lib/sized-image";import{useBrowserLayoutEffect as Ne}from"efficient-shell/hooks";import{HideTaker as oe}from"efficient-web-builder/render/components/ViewHideRoot";import{useSideSpaceOnce as ke}from"efficient-web-builder/render/components/SideSpaceOnce";const Se="(max-width: 1100px) 100vw, min(59vw, 1050px)",_e=K({}),et=[{id:"tag",label:"Tag"},{id:"eyebrow",label:"Eyebrow"},{id:"title",label:"Title"},{id:"meta",label:"Meta"},{id:"number",label:"Card number"}],Ce=K(null),Le="data-gallery-grid",j="data-gallery-tile";function Te(t,o){const[a,c]=z(null);return Q(()=>{const i=t.current,n=i?.closest(`[${Le}]`);if(!i||!n)return;const w=()=>{const g=Array.from(n.querySelectorAll(`[${j}]`)),f=g.indexOf(i),m=f>=0?{index:f+1,total:g.length}:null;c(N=>N?.index===m?.index&&N?.total===m?.total?N:m)};if(w(),!o)return;const x=new MutationObserver(w);return x.observe(n,{childList:!0,subtree:!0}),()=>x.disconnect()},[t,o]),a}const tt={process:"Category",eyebrow:"Subtitle",name:"Item name",meta:"Detail"},$e=()=>({image:"",href:"#",process:"",eyebrow:"",name:"",meta:""}),rt=Array.from({length:6},$e);function Ee(t){const o=(t.photos??[]).map(n=>n?.src).filter(n=>!!n),a=t.image||o[0]||"",c=[a,...o].filter(n=>!!n),i=he(t.name)||"gallery-item";return{car:t.eyebrow??"",wheel:t.name??"",process:t.process??"",finish:t.meta??"",imageLabel:`${i}.jpg`,detailLabel:`${i}-detail.jpg`,imageSrc:a||void 0,detailSrc:o[0]||a||void 0,photos:c,href:t.href}}function Oe({editing:t=!1,previewHover:o,ratio:a,captionPlace:c,tile:i,...n}){const w=ke(),{galleryHref:x="/gallery",submitHref:g="/contact",previewHover:f,display:m,displayPhone:N,styleOwner:ae,photosOnly:ne=!1,wordsAtRest:ie=!1,Template:G,ownerId:se,sets:R=!1}=J(_e),e=Ee(n),k=ye()&&!ne,B=!k&&!Pe(e),d=e.photos??(e.imageSrc?[e.imageSrc]:[]),M=me(null),D=de(s=>{M.current=s},[]),ce=Te(M,t),v=J(Ce),C=v?.report,p=i?.id,W=i?.tag??"",Y=i?.name??"";Ne(()=>{if(!C||!p)return;const s={id:p,tag:W,name:Y};return C(s),()=>C(s,!0)},[C,p,W,Y]);const S=(p?v?.positionOf(p):null)??ce,F=t&&(!!o||!!f),[U,h]=z(!1),[_,L]=z(0),X=!!p&&!!v&&v.walkCount>1,V=s=>{const P=_+s;if(X&&(P<0||P>=d.length)){h(!1),v.walk(p,s);return}L((P+d.length)%d.length)},T=()=>V(-1),$=()=>V(1),u=d.length>1||X,E=v?.opening;Q(()=>{!E||E.id!==p||(L(E.at==="last"?Math.max(0,d.length-1):0),h(!0))},[E,p]);const O=d[_]??e.imageSrc??"",Z=d.slice(1),q=G?r("div",{className:`block w-full min-w-0 ${ge}${w?` ${ue}`:""}`,children:r(xe,{ownerId:se??"GalleryB",ownerType:"GalleryB",Template:G,rows:[{key:p??e.imageSrc??"tile",image:e.imageSrc??"",tag:e.process,number:S?we(S.index,S.total):"",eyebrow:e.car,name:e.wheel,meta:e.finish,href:e.href??""}],items:[{hoverMedia:Z.length?{photos:[{finish:"",items:Z.map(s=>({url:s,kind:"image"}))}]}:null}],previewHover:F,fallback:null,children:s=>s})}):r(be,{build:e,forceHover:F,alwaysShowOverlay:ie,index:S?.index,total:S?.total,ratio:a,captionPlace:c,display:m,displayPhone:N,styleOwner:ae,editing:t,...R?{setCount:d.length}:{}});return l(y,{children:[t?r(oe,{as:"div",ref:D,[j]:"",className:"block w-full text-left",children:q}):r(oe,{as:"button",ref:D,[j]:"",type:"button","aria-label":k?`Open ${e.car||"build"} on ${e.wheel||"wheel"}`:H(e),onClick:()=>{L(0),h(!0)},className:"block w-full cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:q}),R?r(ee,{open:U,onClose:()=>h(!1),label:e.car&&e.wheel?`${e.car} on ${e.wheel}`:H(e),onPrev:u?T:void 0,onNext:u?$:void 0,className:"bg-bg",children:r(je,{build:e,set:d,index:_,onPick:L,onPrev:u?T:void 0,onNext:u?$:void 0,onLeave:()=>h(!1)})}):r(ee,{open:U,onClose:()=>h(!1),label:k?`${e.car} on ${e.wheel}`:H(e),onPrev:u?T:void 0,onNext:u?$:void 0,className:"flex items-center justify-center p-6 max-[700px]:p-3",children:l("div",{onClick:s=>s.stopPropagation(),className:`relative grid w-[min(1800px,100%)] max-h-[calc(100vh-48px)] ${B?"grid-cols-1":"grid-cols-[1.4fr_1fr]"} overflow-hidden border border-line bg-bg max-view-desktop:grid-cols-1 max-view-desktop:overflow-auto`,style:{boxShadow:"0 60px 120px -20px color-mix(in srgb, var(--sf-shadow-color, #141416) 70%, transparent)"},children:[r(te,{label:"Close popup",className:"absolute right-[24px] top-[24px] z-[5] flex h-[56px] w-[56px] items-center justify-center border border-line font-mono text-[length:var(--size-label,21px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:ve},children:"✕"}),l("div",{className:"relative flex min-h-[690px] items-center justify-center overflow-hidden bg-surface-2 max-view-desktop:min-h-[450px]",children:[O&&r("img",{...A(O,{fallbackWidth:1280}),sizes:Se,alt:`${(k?e.car:e.wheel||e.car)||"Photo"} — ${_+1} of ${d.length}`,className:"block h-full max-h-[88vh] w-full object-cover"},O),u&&l(y,{children:[r("button",{type:"button","aria-label":"Previous photo",onClick:T,className:"absolute left-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),r("button",{type:"button","aria-label":"Next photo",onClick:$,className:"absolute right-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"}),d.length>1&&l("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[_+1," / ",d.length]})]})]}),k?l("div",{className:"flex flex-col gap-[30px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[e.process&&r("span",{className:"font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.3em] text-accent",children:b(e.process)}),e.wheel&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:re(e.wheel,!1)}),e.car&&l("div",{className:"font-heading3 text-[length:var(--size-headingSmall,27px)] leading-[1.4] text-fg",children:["on ",r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em]",children:b(e.car,!0)})]}),l("dl",{className:"mt-3 grid grid-cols-[auto_1fr] gap-x-7 gap-y-[18px] border-y border-line py-[30px] font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em]",children:[e.wheel&&l(y,{children:[r("dt",{className:"text-fg-dim",children:"Wheel"}),r("dd",{className:"text-fg",children:b(e.wheel)})]}),e.process&&l(y,{children:[r("dt",{className:"text-fg-dim",children:"Process"}),r("dd",{className:"text-fg",children:b(e.process)})]}),e.finish&&l(y,{children:[r("dt",{className:"text-fg-dim",children:"Finish"}),r("dd",{className:"text-fg",children:b(e.finish)})]}),e.car&&l(y,{children:[r("dt",{className:"text-fg-dim",children:"Vehicle"}),r("dd",{className:"text-fg",children:b(e.car)})]})]}),l("div",{className:"mt-auto flex flex-col gap-3.5 pt-6",children:[l(I,{href:e.href||"/wheels",onClick:()=>h(!1),className:"group flex items-center justify-between gap-6 border border-btn bg-btn px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",children:[r("span",{children:"View product"}),r("span",{className:"transition-transform group-hover:translate-x-[6px]",children:"→"})]}),l(I,{href:x,onClick:()=>h(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"See more builds"}),r("span",{children:"→"})]}),l(I,{href:g,onClick:()=>h(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"Submit your build"}),r("span",{children:"→"})]})]})]}):!B&&r(ze,{build:e})]})})]})}function le(t){return[t.process,t.car,t.finish].filter((o,a,c)=>!!o&&o!==t.wheel&&c.indexOf(o)===a)}function Pe(t){return!!t.wheel||le(t).length>0}function H(t){const o=t.wheel||t.car;return o?`Open photo of ${o}`:"Open photo"}function ze({build:t}){const o=t.wheel,a=le(t);return l("div",{className:"flex flex-col gap-[24px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[o&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:re(o,!1)}),a.map(c=>r("p",{className:"text-[length:var(--size-body,18px)] leading-[1.5] text-fg",children:b(c)},c))]})}const Ie=360,Ae="120px";function je({build:t,set:o,index:a,onPick:c,onPrev:i,onNext:n,onLeave:w}){const x=o[a]??t.imageSrc??"",g="absolute top-1/2 flex h-12 w-12 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg bg-bg text-lg text-fg max-view-wide:hidden";return l("div",{onClick:f=>f.stopPropagation(),className:"grid h-full w-full grid-cols-[1fr_360px] bg-bg text-fg max-view-wide:grid-cols-1 max-view-wide:grid-rows-[auto_1fr] max-view-wide:overflow-auto",children:[l("div",{className:"relative grid min-h-0 place-items-center bg-surface-2 py-12 max-view-wide:p-0",children:[x&&r("img",{...A(x,{fallbackWidth:1280}),sizes:`(max-width: ${fe}px) 100vw, calc(100vw - ${Ie}px)`,alt:`${t.car||t.wheel||"Photo"} — ${a+1} of ${o.length}`,className:"block max-h-[calc(100vh-96px)] max-w-[calc(100%-192px)] max-view-wide:max-h-[60vh] max-view-wide:max-w-full"},x),i&&r("button",{type:"button","aria-label":"Previous photo",onClick:i,className:`${g} left-6`,children:"‹"}),n&&r("button",{type:"button","aria-label":"Next photo",onClick:n,className:`${g} right-6`,children:"›"})]}),l("div",{"data-gallery-set-side":"",className:"flex min-h-0 flex-col overflow-auto p-8 max-view-wide:px-4 max-view-wide:py-5",children:[r(te,{label:"Close popup",className:"flex h-10 w-10 shrink-0 cursor-pointer items-center justify-center self-end border border-fg bg-bg text-lg text-fg max-view-wide:fixed max-view-wide:right-3 max-view-wide:top-3 max-view-wide:z-5",children:"✕"}),t.wheel&&r("div",{className:"mt-10 text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-fg-dim max-view-wide:mt-0",children:t.wheel}),t.car&&r("div",{className:"mt-2 mb-2 text-2xl leading-normal",children:t.car}),l("div",{className:"text-xs leading-normal text-fg-dim",children:[a+1," / ",o.length]}),o.length>1&&r("div",{className:"mt-8 grid grid-cols-3 gap-2 max-view-wide:grid-cols-5",children:o.map((f,m)=>r("button",{type:"button","data-gallery-set-thumb":"","aria-label":`Show photo ${m+1}`,"aria-current":m===a?"true":void 0,onClick:()=>c(m),className:`block cursor-pointer p-0 ${m===a?"opacity-100 outline outline-1 outline-offset-2 outline-fg":"opacity-50"}`,children:r("img",{...A(f,{fallbackWidth:320,maxWidth:640}),sizes:Ae,alt:"",loading:"lazy",className:"block aspect-[4/3] w-full object-cover"})},`${f}-${m}`))}),t.wheel&&t.href&&l(pe,{href:t.href,onClick:w,className:"mt-auto inline-block self-start border border-fg px-8 py-3 text-xs text-fg max-view-wide:mt-6",children:["See ",t.wheel]})]})]})}export{Le as GALLERY_GRID_ATTR,tt as GALLERY_ITEM_HINTS,rt as GALLERY_ITEM_SEEDS,j as GALLERY_TILE_ATTR,et as GALLERY_TILE_PARTS,_e as GalleryLinksContext,Ce as GalleryTilesContext,Oe as default};
|
|
@@ -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
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fragment as g,jsx as d}from"react/jsx-runtime";import{phoneKey as H}from"efficient-easel/draw";import k,{SourcedGalleryGrid as P}from"../../../../../components/pdp-dynamic/DynamicGalleryGrid.js";import{declaredBlockSource as h,sourcedRows as x}from"efficient-web-builder/format/lib/content/block-sources";import y from"../../../../../components/GalleryGrid.js";import{PRODUCT_PICTURES_SOURCE as w,productPictureTiles as T,productPicturesLayout as v}from"../../../../sections/product-pictures.js";import{hidableText as a}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as G}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as
|
|
1
|
+
import{Fragment as g,jsx as d}from"react/jsx-runtime";import{phoneKey as H}from"efficient-easel/draw";import k,{SourcedGalleryGrid as P}from"../../../../../components/pdp-dynamic/DynamicGalleryGrid.js";import{declaredBlockSource as h,sourcedRows as x}from"efficient-web-builder/format/lib/content/block-sources";import y from"../../../../../components/GalleryGrid.js";import{PRODUCT_PICTURES_SOURCE as w,productPictureTiles as T,productPicturesLayout as v}from"../../../../sections/product-pictures.js";import{hidableText as a}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as G}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as i}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{bandPadProps as u}from"../../../../sections/band-padding.js";import{GalleryBMeta as B,GALLERY_B_PH as l}from"./meta.js";const U={...B,render:e=>{const m=G(e.headPlacement)==="own-box",t=n=>m?void 0:n,o={num:t(i(e.num,l.num,e.editor)),title:t(i(e.title,l.title,e.editor)),omitHead:m,linkText:t(i(e.linkText,l.link,e.editor)),linkHref:t(a(e.linkHref)||"/contact"),galleryHref:a(e.galleryHref)||"/gallery",previewHover:e.previewHover,display:e.display,displayPhone:e.displayPhone,styleOwner:e.id,layout:e.layout,layoutPhone:e.layoutPhone,columns:e.columns,columnsMobile:e.columnsMobile,gap:e.gap,gapPhone:e[H("gap")],sets:e.sets===!0,pads:u(e),editing:e.editor?.isEditing,template:e.template,nodeId:typeof e.id=="string"?e.id:void 0},c=h(e);if(c===w){const n=!!e.editor?.isEditing,r=T(e,n,e.limit);return!n&&r.length===0?d(g,{}):d(y,{...o,layout:v(e),sourced:r})}if(c!==""){const n=!!e.editor?.isEditing,{rows:r,sample:f}=x(e,n);return d(P,{num:t(i(e.num,l.num,e.editor)),title:t(i(e.title,l.title,e.editor)),linkText:t(i(e.linkText,l.link,e.editor)),linkHref:t(a(e.linkHref)||"/contact"),omitHead:m,rows:f?[]:r,limit:e.limit,layout:e.layout,editing:n,pads:u(e)})}return e.dynamic?d(k,{num:t(i(e.num,l.num,e.editor)),title:t(i(e.title,l.title,e.editor)),linkText:t(i(e.linkText,l.link,e.editor)),linkHref:t(a(e.linkHref)||"/contact"),omitHead:m,galleryHref:a(e.galleryHref)||"/gallery",zone:e.mediaZone||"all",photoDisplay:e.photoDisplay||"covers",previewHover:e.previewHover,display:e.display,displayPhone:e.displayPhone,styleOwner:e.id,editing:e.editor?.isEditing,pads:u(e),template:o.template,nodeId:o.nodeId}):d(y,{...o,items:e.items})}};export{U as GalleryBRender};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{GALLERY_PHONE_BREAKPOINT as t}from"efficient-web-builder/format/lib/content/gallery-layout";const n="mosaic",s=260,e=150;function a(o){const r=`.${o}.sf-gallery-zone`;return`${r}{grid-auto-rows:${s}px}@media (max-width:${t}px){${r}{grid-auto-rows:${e}px}}`}function p(o){return o>1?`${o} photos`:""}export{n as GALLERY_MOSAIC_LAYOUT,a as galleryMosaicRowsCss,p as gallerySetChip};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{galleryCellAt as a}from"efficient-web-builder/format/lib/content/gallery-layout";const u=["newest","name"],f={newest:"Newest",name:"Name A–Z"},w={tag:null,sort:"newest"};function i(n){const r=[];for(const o of n){const t=o.tag.trim();t&&!r.includes(t)&&r.push(t)}return r}function s(n,r){return n!==null&&i(r).includes(n)?n:null}function L(n,r){return s(n.tag,r)===null&&n.sort==="newest"}function g(n,r){const o=s(r.tag,n),t=o===null?[...n]:n.filter(e=>e.tag.trim()===o);return r.sort==="name"&&t.sort((e,l)=>e.name.localeCompare(l.name)),t.map(e=>e.id)}function d(n,r,o){const[t,e]=a(n,!1,r,o),[l,c]=a(n,!0,r,o);return{col:t,row:e,colPhone:l,rowPhone:c}}const p="sf-wall-placed",x=`.${p}{grid-column:span var(--sf-wall-c) !important;grid-row:span var(--sf-wall-r) !important}@media (max-width:800px){.${p}{grid-column:span var(--sf-wall-cp) !important;grid-row:span var(--sf-wall-rp) !important}}`;export{w as EMPTY_GALLERY_TOOLBAR,u as GALLERY_SORT_KEYS,f as GALLERY_SORT_LABELS,p as WALL_PLACED_CELL,x as WALL_PLACED_CSS,s as clampGalleryTag,g as galleryShownIds,i as galleryTags,L as galleryToolbarIdle,d as wallSpanAt};
|