efficient-storefront-blocks 0.82.0 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/chunks/EditorPreviewCheckout-3NVDTH56.js +4 -0
- package/dist/chunks/{SiteEditorProvider-5YHSOW4Y.js → SiteEditorProvider-77K7CGYZ.js} +1 -1
- package/dist/chunks/chunk-5EQD5D3L.js +340 -0
- package/dist/chunks/{chunk-NSBGNY7R.js → chunk-DQFD2BJD.js} +1 -1
- package/dist/chunks/{chunk-47L7KHRW.js → chunk-VJLQXB7I.js} +1 -1
- package/dist/chunks/chunk-VYOK2XBF.js +1 -0
- package/dist/chunks/{fitment-data-SZWTO4WT.js → fitment-data-PWXEDMOA.js} +1 -1
- package/dist/contract.js +22 -2
- package/dist/editor/lib/document/blocks/commerce/ProductHero/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMenu/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/MenuLinkBlock/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/MenuLinkBlock/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/index.js +1 -1
- package/dist/editor/lib/document/box-header.d.ts +1 -0
- package/dist/editor/lib/document/box-header.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/section-text-regions.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +5 -1
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +44 -73
- package/dist/render/app/globals.css +15 -6
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/FinishSwatches.js +2 -1
- package/dist/render/components/FooterMenu.d.ts +9 -9
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/LinkedProductHero.d.ts +2 -2
- package/dist/render/components/MenuLinkBlock.d.ts +7 -0
- package/dist/render/components/MenuLinkBlock.js +1 -0
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/ProductHeroPanel.d.ts +5 -5
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.d.ts +9 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/ClippedPictures.d.ts +10 -0
- package/dist/render/components/card-pieces/ClippedPictures.js +1 -0
- package/dist/render/components/card-pieces/HostPart.d.ts +2 -1
- package/dist/render/components/card-pieces/HostPart.js +1 -1
- package/dist/render/components/card-pieces/ProductCardState.d.ts +12 -0
- package/dist/render/components/card-pieces/ProductCardState.js +1 -1
- package/dist/render/components/card-pieces/useHeldCardPicture.d.ts +16 -0
- package/dist/render/components/card-pieces/useHeldCardPicture.js +1 -0
- package/dist/render/components/checkout/CheckoutPageClient.d.ts +2 -1
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +1 -0
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/pdp-dynamic/DynamicProductHero.d.ts +2 -2
- package/dist/render/components/product-hero/stage-photo.d.ts +6 -0
- package/dist/render/components/product-hero/stage-photo.js +3 -3
- package/dist/render/components/useFinishSelection.d.ts +3 -0
- package/dist/render/components/useFinishSelection.js +3 -1
- package/dist/render/components/useProductCatalog.d.ts +2 -0
- package/dist/render/components/wheels-plp/PlpCard.js +1 -1
- package/dist/render/lib/api/types.d.ts +15 -2
- package/dist/render/lib/catalog/relationships.js +1 -1
- package/dist/render/lib/checkout/pay-first.d.ts +19 -0
- package/dist/render/lib/checkout/pay-first.js +1 -1
- package/dist/render/lib/content/hero-price-seed.d.ts +4 -0
- package/dist/render/lib/content/hero-price-seed.js +1 -0
- package/dist/render/lib/content/menu-card-seed.d.ts +6 -0
- package/dist/render/lib/content/menu-card-seed.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.d.ts +4 -0
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterMenu/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/service/FooterMenu/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterMenu/render.js +1 -1
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/render.js +1 -0
- package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/metas.js +1 -1
- package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/renders.js +1 -1
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/menu-link.d.ts +8 -0
- package/dist/render/lib/sections/product-price-text-regions.d.ts +4 -0
- package/dist/render/lib/sections/product-price-text-regions.js +1 -0
- package/dist/render/lib/wheels/signed-url.d.ts +3 -0
- package/dist/render/lib/wheels/signed-url.js +1 -0
- package/dist/words.d.ts +26 -10
- package/dist/words.js +4 -4
- package/package.json +3 -3
- package/dist/chunks/EditorPreviewCheckout-XM22X3CX.js +0 -4
- package/dist/chunks/chunk-T2R5CZ2F.js +0 -1
- package/dist/chunks/chunk-VIPMT34C.js +0 -320
- package/dist/render/lib/sections/product-hero-text-regions.d.ts +0 -3
- package/dist/render/lib/sections/product-hero-text-regions.js +0 -1
- /package/dist/chunks/{chunk-VIPMT34C.js.LEGAL.txt → chunk-5EQD5D3L.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-VVWX2P2N.js → chunk-F3MB7QCR.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as r,Fragment as x}from"react/jsx-runtime";import S from"next/link";import{useEffect as D,useMemo as Y,useRef as j,useState as v}from"react";import{stripeAppearance as Q}from"../../lib/checkout/stripe-appearance.js";import{Elements as V,PaymentElement as Z,useElements as J,useStripe as X}from"@stripe/react-stripe-js";import{loadStripe as ee}from"@stripe/stripe-js";import{useCurrency as R}from"../CurrencyContext.js";import{Notice as I}from"../Notice.js";import{resolveCopyright as te}from"../../lib/content/site.js";import{ApiError as O,products as T}from"../../lib/api/index.js";import re from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as _,orderReference as ne}from"../../lib/checkout/pay-first.js";import{CheckoutStateProvider as ae,useCheckout as ie}from"./checkout-state.js";import{CheckoutContact as oe,CheckoutOrderSummary as se,CheckoutPayment as ce,CheckoutShippingAddress as le,CheckoutShippingMethod as de}from"./checkout-parts.js";function me(t){return e(ae,{...t,children:e(fe,{})})}function pe({order:t,paid:n}){const{formatMoney:p}=R();if(!t.grandTotal||!t.currency)return null;const u=i=>p(Number(i),t.currency),h=Number(t.freightCharge??0),c=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||h>0)&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:u(t.freightCharge??"0")})]}),c>0&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",u(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:u(t.grandTotal)})]})}function ue({result:t}){const n=e("span",{className:"font-mono text-fg",children:t.checkoutNumber});return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:t.kind==="refunded"||t.kind==="expired"?"Order not placed":t.kind==="processing"?"Payment processing":"Payment received"}),e("p",{className:"text-fg-dim",children:t.kind==="refunded"?r(x,{children:["An item sold out or an offer ended while you paid for checkout ",n,". Your payment is refunded to your card."]}):t.kind==="expired"?r(x,{children:["The hold on checkout ",n," ran out before your payment arrived. Your payment is refunded to your card."]}):t.kind==="processing"?r(x,{children:["Your payment for checkout ",n," is being processed. When it goes through, we will email your order confirmation."]}):r(x,{children:["Thank you — your payment for checkout ",n," has gone through. We will email you the order number shortly."]})}),e(S,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function fe(){const{site:t,logo:n,items:p,placing:u,email:h,me:c,addressSaveNote:i,idemKey:f,confirmation:o,setConfirmation:m,payment:d,paypalStep:k,squareStep:g,pendingConf:s,paid:y,setPaid:b,payNote:N,afterpayConfirming:E,gocardlessConfirming:l,zipConfirming:a,klarnaConfirming:w,cardConfirming:P,checkoutResult:q,confirmCardPayment:L,cardStillProcessing:z,renewCardPayment:F,holdRenewed:H,leaveCardPayment:G,checkoutRootRef:U,setCheckoutHeaderEl:W}=ie();return o?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:y?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[y?r(x,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," has gone through."," "]}):r(x,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," is being reviewed by our team."," "]}),c?r(x,{children:["Track it under"," ",e(S,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(x,{children:"We’ve emailed you a link to set a password and track it."})]}),e(pe,{order:o,paid:y}),N&&e("p",{className:"text-sm text-fg-dim",children:N}),i&&e("p",{className:"text-sm text-fg-dim",children:i}),!c&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(S,{href:`/track?order=${encodeURIComponent(o.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(S,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):q?e(ue,{result:q}):P?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order — one moment."})]}):E?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):l?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):a?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):w?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):d&&s?e(xe,{payment:d,checkout:s,holdRenewed:H,onPaid:L,onProcessing:z,onRenew:F,onBack:G}):k&&s?e(be,{confirmation:s,clientId:t.paypalClientId??"",idemKey:f,onPaid:()=>{b(!0),m(s)},onSkip:()=>m(s)}):g&&s?e(ke,{confirmation:s,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:f,onPaid:()=>{b(!0),m(s)},onSkip:()=>m(s)}):r("div",{ref:U,className:"bg-bg text-fg",children:[r("header",{ref:W,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(S,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e(S,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:e(re,{variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,siteName:t.name})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(C=>r("span",{className:["relative flex items-center gap-2 transition-colors",C.state==="pending"?"text-fg-dim":"text-fg",C.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:C.state==="done"?"text-accent font-bold":"",children:C.n}),e("span",{children:C.label})]},C.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[r("div",{children:[e(oe,{}),e(le,{}),e(de,{}),e(ce,{})]}),e(se,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:te({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function xe({payment:t,checkout:n,holdRenewed:p,onPaid:u,onProcessing:h,onRenew:c,onBack:i}){const{formatMoney:f}=R(),o=e("span",{className:"text-fg",children:f(Number(t.amount),t.currency)}),m=Y(()=>ee(t.publishableKey),[t.publishableKey]),d=Y(()=>Q(),[]);return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:ne(n)}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:n.orderNumber?r(x,{children:["Your order is placed. Pay ",o," by card to confirm it now."]}):p?r(x,{children:["Your hold ran out, so your items are held again",n.expiresAt?` until ${B(n.expiresAt)}`:"",". Enter your card again, then pay ",o,"."]}):r(x,{children:["Your items are held",n.expiresAt?` until ${B(n.expiresAt)}`:"",". Pay ",o," by card to place your order."]})}),e(V,{stripe:m,options:{clientSecret:t.clientSecret,appearance:d},children:e(he,{payment:t,checkout:n,onPaid:u,onProcessing:h,onRenew:c,onBack:i})},t.clientSecret)]})]})})}function B(t){return new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}const ge=5;function he({payment:t,checkout:n,onPaid:p,onProcessing:u,onRenew:h,onBack:c}){const{formatMoney:i}=R(),f=X(),o=J(),[m,d]=v(!1),[k,g]=v(null),s=j(!1);async function y(){try{return(await f.retrievePaymentIntent(t.clientSecret)).paymentIntent?.status}catch{return}}async function b(l){let a=l;for(let w=0;a==="processing"&&w<ge;w+=1)await new Promise(P=>setTimeout(P,1e3)),a=await y()??a;if(a==="succeeded"){p();return}if(a==="processing"){u();return}g("Payment did not complete. Please try again."),d(!1)}async function N(){if(!f||!o||m)return;d(!0),g(null),s.current=!0;const l=await f.confirmPayment({elements:o,redirect:"if_required"}).catch(()=>null);if(!l){const a=await y();if(a==="succeeded"||a==="processing"){await b(a);return}g(a===void 0?_:"Payment failed. Please try again."),d(!1);return}if(l.error){if(!n.orderNumber&&l.error.code==="payment_intent_unexpected_state"){const a=await y();if(a==="succeeded"||a==="processing"){await b(a);return}if(a===void 0){g(_),d(!1);return}await h(a==="canceled"),d(!1);return}g(l.error.message??"Payment failed. Please try again."),d(!1);return}await b(l.paymentIntent?.status)}async function E(){if(m)return;if(!s.current){c();return}d(!0),g(null);const l=await y();if(l==="succeeded"||l==="processing"){await b(l);return}if(d(!1),l===void 0){g(_);return}c()}return r("div",{className:"flex flex-col gap-4",children:[e(Z,{}),k&&e(I,{role:"alert",children:k}),e("button",{type:"button",onClick:N,disabled:!f||!o||m,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!f||!o||m?"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?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",i(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),!n.orderNumber&&!m&&r("button",{type:"button",onClick:E,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{children:"Back to checkout"})]})]})}const M="paypal-sdk-js";let A=null;function ye(t,n){const p=`${t}|${n}`;if(A?.key===p)return A.promise;const u=new Promise((h,c)=>{document.getElementById(M)?.remove();const i=document.createElement("script");i.id=M;const f=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});i.src=`https://www.paypal.com/sdk/js?${f}`,i.onload=()=>{const o=window.paypal;o?h(o):c(new Error("PayPal SDK loaded without its namespace"))},i.onerror=()=>c(new Error("PayPal SDK failed to load")),document.head.appendChild(i)});return A={key:p,promise:u},u}function be({confirmation:t,clientId:n,idemKey:p,onPaid:u,onSkip:h}){const{formatMoney:c}=R(),i=j(null),[f,o]=v(!1),[m,d]=v(null),k=j(u);return k.current=u,D(()=>{let g=!1,s=null;return ye(n,t.currency).then(y=>{if(!(g||!i.current))return s=y.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await T.createPaypalOrder({idempotencyKey:p})).paypalOrderId,onApprove:async b=>{try{if((await T.capturePaypalOrder({idempotencyKey:p,paypalOrderId:b.orderID})).status==="paid"){k.current();return}d("PayPal did not complete the payment. Please try again.")}catch(N){d(N instanceof O?N.message:"PayPal payment failed. Please try again.")}},onError:()=>{d("PayPal could not process the payment. Please try again.")}}),s.render(i.current).then(()=>{g||o(!0)})}).catch(()=>{g||d("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{g=!0,s?.close?.()}},[n,t.currency,p]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:c(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!f&&!m&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:i}),m&&e(I,{role:"alert",children:m}),e("button",{type:"button",onClick:h,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const $="square-web-sdk";let K=null;function Ne(t){const n=t==="sandbox"?"sandbox":"production";if(K?.key===n)return K.promise;const p=new Promise((u,h)=>{document.getElementById($)?.remove();const c=document.createElement("script");c.id=$,c.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",c.onload=()=>{const i=window.Square;i?u(i):h(new Error("Square SDK loaded without its namespace"))},c.onerror=()=>h(new Error("Square SDK failed to load")),document.head.appendChild(c)});return K={key:n,promise:p},p}function ke({confirmation:t,applicationId:n,locationId:p,environment:u,idemKey:h,onPaid:c,onSkip:i}){const{formatMoney:f}=R(),o=j(null),m=j(null),d=j(null),[k,g]=v(!1),[s,y]=v(!1),[b,N]=v(null);D(()=>{let l=!1,a=null;return Ne(u).then(async w=>{if(l||!o.current)return;const P=w.payments(n,p);d.current=P,a=await P.card(),await a.attach(o.current),m.current=a,l||g(!0)}).catch(()=>{l||N("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{l=!0,a?.destroy?.()}},[n,p,u]);async function E(){const l=m.current;if(!(!l||s)){y(!0),N(null);try{const a=await l.tokenize();if(a.status!=="OK"||!a.token){N(a.errors?.[0]?.message??"Please check the card details and try again."),y(!1);return}let w;try{w=(await d.current?.verifyBuyer?.(a.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await T.chargeSquare({idempotencyKey:h,sourceId:a.token,...w?{verificationToken:w}:{}})).status==="paid"){c();return}N("Square did not complete the payment. Please try again.")}catch(a){N(a instanceof O?a.message:"Square payment failed. Please try again.")}y(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:f(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!k&&!b&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:o}),b&&e(I,{role:"alert",children:b}),e("button",{type:"button",onClick:E,disabled:!k||s,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!k||s?"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:s?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",f(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:i,disabled:s,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{ue as PayFirstResultView,me as default};
|
|
1
|
+
"use client";import{jsx as e,jsxs as r,Fragment as x}from"react/jsx-runtime";import j from"next/link";import{useEffect as Y,useMemo as O,useRef as E,useState as v}from"react";import{stripeAppearance as V}from"../../lib/checkout/stripe-appearance.js";import{Elements as Z,PaymentElement as J,useElements as X,useStripe as ee}from"@stripe/react-stripe-js";import{loadStripe as te}from"@stripe/stripe-js";import{useCurrency as R}from"../CurrencyContext.js";import{Notice as q}from"../Notice.js";import{resolveCopyright as re}from"../../lib/content/site.js";import{ApiError as B,products as I}from"../../lib/api/index.js";import ne from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as T,orderReference as ae}from"../../lib/checkout/pay-first.js";import{CheckoutStateProvider as ie,useCheckout as oe}from"./checkout-state.js";import{CheckoutContact as ce,CheckoutOrderSummary as se,CheckoutPayment as le,CheckoutShippingAddress as de,CheckoutShippingMethod as me}from"./checkout-parts.js";function pe(t){return e(ie,{...t,children:e(xe,{})})}function ue({order:t,paid:n}){const{formatMoney:i}=R();if(!t.grandTotal||!t.currency)return null;const u=o=>i(Number(o),t.currency),h=Number(t.freightCharge??0),s=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||h>0)&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:u(t.freightCharge??"0")})]}),s>0&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",u(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:u(t.grandTotal)})]})}function fe({result:t,lostChangeNote:n=null}){const i=e("span",{className:"font-mono text-fg",children:t.checkoutNumber});return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:t.kind==="refunded"||t.kind==="expired"?"Order not placed":t.kind==="processing"?"Payment processing":"Payment received"}),e("p",{className:"text-fg-dim",children:t.kind==="refunded"?r(x,{children:["An item sold out or an offer ended while you paid for checkout ",i,". Your payment goes back to your card."]}):t.kind==="expired"?r(x,{children:["The hold on checkout ",i," ran out before your payment arrived. Your payment goes back to your card."]}):t.kind==="processing"?r(x,{children:["Your payment for checkout ",i," is being processed. When it goes through, we will email your order confirmation."]}):r(x,{children:["Thank you — your payment",t.checkoutNumber?r(x,{children:[" for checkout ",i]}):null," has gone through. We will email you the order number shortly."]})}),n&&t.kind!=="refunded"&&t.kind!=="expired"&&e("p",{className:"text-sm text-fg-dim",children:n}),e(j,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function xe(){const{site:t,logo:n,items:i,placing:u,email:h,me:s,addressSaveNote:o,lostChangeNote:f,idemKey:p,confirmation:d,setConfirmation:c,payment:k,paypalStep:g,squareStep:b,pendingConf:m,paid:y,setPaid:N,payNote:C,afterpayConfirming:l,gocardlessConfirming:a,zipConfirming:w,klarnaConfirming:P,cardConfirming:K,checkoutResult:D,confirmCardPayment:z,cardStillProcessing:F,renewCardPayment:H,holdRenewed:G,leaveCardPayment:U,checkoutRootRef:W,setCheckoutHeaderEl:Q}=oe();return d?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:y?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[y?r(x,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:d.orderNumber})," has gone through."," "]}):r(x,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:d.orderNumber})," is being reviewed by our team."," "]}),s?r(x,{children:["Track it under"," ",e(j,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(x,{children:"We’ve emailed you a link to set a password and track it."})]}),e(ue,{order:d,paid:y}),f&&e("p",{className:"text-sm text-fg-dim",children:f}),C&&e("p",{className:"text-sm text-fg-dim",children:C}),o&&e("p",{className:"text-sm text-fg-dim",children:o}),!s&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(j,{href:`/track?order=${encodeURIComponent(d.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(j,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):D?e(fe,{result:D,lostChangeNote:f}):K?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order — one moment."})]}):l?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):a?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Setting up your direct debit…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Confirming with GoCardless — one moment."})]}):w?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Zip — one moment."})]}):P?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):k&&m?e(ge,{payment:k,checkout:m,holdRenewed:G,onPaid:z,onProcessing:F,onRenew:H,onBack:U}):g&&m?e(Ne,{confirmation:m,clientId:t.paypalClientId??"",idemKey:p,onPaid:()=>{N(!0),c(m)},onSkip:()=>c(m)}):b&&m?e(we,{confirmation:m,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:p,onPaid:()=>{N(!0),c(m)},onSkip:()=>c(m)}):r("div",{ref:W,className:"bg-bg text-fg",children:[r("header",{ref:Q,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(j,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[13px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e(j,{href:"/","aria-label":`${t.name} home`,className:"inline-flex items-center justify-center",children:e(ne,{variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,siteName:t.name})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(S=>r("span",{className:["relative flex items-center gap-2 transition-colors",S.state==="pending"?"text-fg-dim":"text-fg",S.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:S.state==="done"?"text-accent font-bold":"",children:S.n}),e("span",{children:S.label})]},S.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[r("div",{children:[e(ce,{}),e(de,{}),e(me,{}),e(le,{})]}),e(se,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:re({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function ge({payment:t,checkout:n,holdRenewed:i,onPaid:u,onProcessing:h,onRenew:s,onBack:o}){const{formatMoney:f}=R(),p=e("span",{className:"text-fg",children:f(Number(t.amount),t.currency)}),d=O(()=>te(t.publishableKey),[t.publishableKey]),c=O(()=>V(),[]);return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:ae(n)}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:n.orderNumber?r(x,{children:["Your order is placed. Pay ",p," by card to confirm it now."]}):i?r(x,{children:["Your hold ran out, so your items are held again",n.expiresAt?` until ${M(n.expiresAt)}`:"",". Enter your card again, then pay ",p,"."]}):r(x,{children:["Your items are held",n.expiresAt?` until ${M(n.expiresAt)}`:"",". Pay ",p," by card to place your order."]})}),e(Z,{stripe:d,options:{clientSecret:t.clientSecret,appearance:c},children:e(ye,{payment:t,checkout:n,onPaid:u,onProcessing:h,onRenew:s,onBack:o})},t.clientSecret)]})]})})}function M(t){return new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}const he=5;function ye({payment:t,checkout:n,onPaid:i,onProcessing:u,onRenew:h,onBack:s}){const{formatMoney:o}=R(),f=ee(),p=X(),[d,c]=v(!1),[k,g]=v(null),b=E(!1);async function m(){try{return(await f.retrievePaymentIntent(t.clientSecret)).paymentIntent?.status}catch{return}}async function y(l){let a=l;for(let w=0;a==="processing"&&w<he;w+=1)await new Promise(P=>setTimeout(P,1e3)),a=await m()??a;if(a==="succeeded"){i();return}if(a==="processing"){u();return}g("Payment did not complete. Please try again."),c(!1)}async function N(){if(!f||!p||d)return;c(!0),g(null),b.current=!0;const l=await f.confirmPayment({elements:p,redirect:"if_required"}).catch(()=>null);if(!l){const a=await m();if(a==="succeeded"||a==="processing"){await y(a);return}g(a===void 0?T:"Payment failed. Please try again."),c(!1);return}if(l.error){if(!n.orderNumber&&l.error.code==="payment_intent_unexpected_state"){const a=await m();if(a==="succeeded"||a==="processing"){await y(a);return}if(a===void 0){g(T),c(!1);return}await h(a==="canceled"),c(!1);return}g(l.error.message??"Payment failed. Please try again."),c(!1);return}await y(l.paymentIntent?.status)}async function C(){if(d)return;if(!b.current){s();return}c(!0),g(null);const l=await m();if(l==="succeeded"||l==="processing"){await y(l);return}if(c(!1),l===void 0){g(T);return}s()}return r("div",{className:"flex flex-col gap-4",children:[e(J,{}),k&&e(q,{role:"alert",children:k}),e("button",{type:"button",onClick:N,disabled:!f||!p||d,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!f||!p||d?"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:d?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",o(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),!n.orderNumber&&!d&&r("button",{type:"button",onClick:C,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{children:"Back to checkout"})]})]})}const $="paypal-sdk-js";let _=null;function be(t,n){const i=`${t}|${n}`;if(_?.key===i)return _.promise;const u=new Promise((h,s)=>{document.getElementById($)?.remove();const o=document.createElement("script");o.id=$;const f=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});o.src=`https://www.paypal.com/sdk/js?${f}`,o.onload=()=>{const p=window.paypal;p?h(p):s(new Error("PayPal SDK loaded without its namespace"))},o.onerror=()=>s(new Error("PayPal SDK failed to load")),document.head.appendChild(o)});return _={key:i,promise:u},u}function Ne({confirmation:t,clientId:n,idemKey:i,onPaid:u,onSkip:h}){const{formatMoney:s}=R(),o=E(null),[f,p]=v(!1),[d,c]=v(null),k=E(u);return k.current=u,Y(()=>{let g=!1,b=null;return be(n,t.currency).then(m=>{if(!(g||!o.current))return b=m.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await I.createPaypalOrder({idempotencyKey:i})).paypalOrderId,onApprove:async y=>{try{if((await I.capturePaypalOrder({idempotencyKey:i,paypalOrderId:y.orderID})).status==="paid"){k.current();return}c("PayPal did not complete the payment. Please try again.")}catch(N){c(N instanceof B?N.message:"PayPal payment failed. Please try again.")}},onError:()=>{c("PayPal could not process the payment. Please try again.")}}),b.render(o.current).then(()=>{g||p(!0)})}).catch(()=>{g||c("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{g=!0,b?.close?.()}},[n,t.currency,i]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:s(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!f&&!d&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:o}),d&&e(q,{role:"alert",children:d}),e("button",{type:"button",onClick:h,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const L="square-web-sdk";let A=null;function ke(t){const n=t==="sandbox"?"sandbox":"production";if(A?.key===n)return A.promise;const i=new Promise((u,h)=>{document.getElementById(L)?.remove();const s=document.createElement("script");s.id=L,s.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",s.onload=()=>{const o=window.Square;o?u(o):h(new Error("Square SDK loaded without its namespace"))},s.onerror=()=>h(new Error("Square SDK failed to load")),document.head.appendChild(s)});return A={key:n,promise:i},i}function we({confirmation:t,applicationId:n,locationId:i,environment:u,idemKey:h,onPaid:s,onSkip:o}){const{formatMoney:f}=R(),p=E(null),d=E(null),c=E(null),[k,g]=v(!1),[b,m]=v(!1),[y,N]=v(null);Y(()=>{let l=!1,a=null;return ke(u).then(async w=>{if(l||!p.current)return;const P=w.payments(n,i);c.current=P,a=await P.card(),await a.attach(p.current),d.current=a,l||g(!0)}).catch(()=>{l||N("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{l=!0,a?.destroy?.()}},[n,i,u]);async function C(){const l=d.current;if(!(!l||b)){m(!0),N(null);try{const a=await l.tokenize();if(a.status!=="OK"||!a.token){N(a.errors?.[0]?.message??"Please check the card details and try again."),m(!1);return}let w;try{w=(await c.current?.verifyBuyer?.(a.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await I.chargeSquare({idempotencyKey:h,sourceId:a.token,...w?{verificationToken:w}:{}})).status==="paid"){s();return}N("Square did not complete the payment. Please try again.")}catch(a){N(a instanceof B?a.message:"Square payment failed. Please try again.")}m(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:f(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!k&&!y&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:p}),y&&e(q,{role:"alert",children:y}),e("button",{type:"button",onClick:C,disabled:!k||b,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!k||b?"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:b?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",f(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:o,disabled:b,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{fe as PayFirstResultView,pe as default};
|
|
@@ -129,6 +129,7 @@ declare function useCheckoutState({ site, logo, preview }: CheckoutProps): {
|
|
|
129
129
|
saveLabel: string;
|
|
130
130
|
setSaveLabel: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
131
131
|
addressSaveNote: string | null;
|
|
132
|
+
lostChangeNote: string | null;
|
|
132
133
|
idemKey: string;
|
|
133
134
|
confirmation: LandingOrder | null;
|
|
134
135
|
setConfirmation: import("react").Dispatch<import("react").SetStateAction<LandingOrder | null>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
2
|
-
`);return
|
|
3
|
-
${Ae.trim()}`:te,E=JSON.stringify([D,O,J,G,fe,$,v,T,u,i.map(e=>[e.id,e.qty]),Q,It(M),h,A.currency,le?.id??null]),ye=f(null),P=f(!1),H=f(null),he=f(!1),we=f(E);we.current=E;const yt=f(ee);yt.current=ee;const ht=()=>P.current&&we.current!==ye.current,_=f(null);m(()=>{yt.current||(E!==_.current&&(_.current=null),!(!P.current||!g||g.orderNumber)&&(E===ye.current||E===_.current||ge(g)))},[E,g]);async function ge(e){if(!he.current){he.current=!0,b(!0);try{const t=H.current?await $n(H.current):"none";if(t==="succeeded"||t==="processing"){P.current=!1,K(null),t==="succeeded"?await I(void 0,e):bt(e);return}if(t===void 0||!Mn.has(t)){_.current=we.current,K(e),w(t==="requires_action"?Rn:Fe);return}const n=await Et(Y);if(n==="committed"){P.current=!1,K(null),await I(void 0,e);return}if(n!=="released"){_.current=we.current,K(e),w(Fe);return}P.current=!1,H.current=null,_.current=null,w(null),K(null),Ie(Ce())}finally{he.current=!1,b(!1)}}}async function pn(){if(d||ee||he.current)return;if(g){if(P.current&&!g.orderNumber&&E!==ye.current){await ge(g);return}b(!0),w(null),await Me();const r=g.orderNumber?h:"card";r!==h&&be(r),await Nt(g,r,!g.orderNumber);return}if(i.length===0||A.repricing||!h||!z.some(r=>r.key===h))return;const e=i.filter(vt).flatMap(r=>vn(r.components,r.qty));if(e.length===0){w("Pick a size on each wheel's product page before checking out.");return}b(!0),w(null);let t,n=Y;try{const r=le?y.createOrderAuthed:y.createOrder,o=Nn(),s={customer:{email:D,name:`${O} ${J}`.trim(),phone:G.trim()||void 0,address:fe,city:$,state:v||void 0,zipCode:T,country:u},items:e,currency:A.currency,idempotencyKey:Y,shippingMethodId:Q??void 0,couponCode:It(M),...o==="denied"?{}:bn(),...o?{adConsent:o}:{},...Ln(h)?{checkoutFlow:Kt}:{}};B.current=()=>r(s),H.current=null,P.current=!1,_.current=null,ye.current=E,pe.current=i,kt(s,r);const l=await(!s.checkoutFlow&&Re.current===s.idempotencyKey?wt(s,r):r(s).then(R=>({answer:R,request:s})).catch(R=>mn(R,s,r)));if(!l)return;t=l.answer,n=l.request.idempotencyKey,t.orderNumber&&(Ct(t),L()),await Me()}catch(r){const o=Fn(r);o?(Mt(o),w(`${o} Your order has not been placed. Place it again to continue without the code.`)):r instanceof _t?w(Fe):w(r instanceof ke?r.message:"Could not place the order. Please try again."),b(!1);return}await Nt(t,h,!1,n)}async function mn(e,t,n){if(Ye(e))return gt(t,n);if(!_n(e))throw e;return Re.current=t.idempotencyKey,wt(t,n)}async function wt(e,t){const n=await Et(e.idempotencyKey);if(n==="released")return gt(e,t);if(n!=="committed")throw new _t;const r=_e.current?.key===e.idempotencyKey?_e.current:null;pe.current=r?.lines??i;const o=r?.send??(()=>t({...e,checkoutFlow:Kt}));B.current=o;const s=await o();return b(!1),await I(s,{...s,orderNumber:""}),await Me(),null}async function gt(e,t){const n={...e,idempotencyKey:Ce()};return Re.current=null,Ie(n.idempotencyKey),B.current=()=>t(n),kt(n,t),{answer:await t(n),request:n}}function kt(e,t){e.checkoutFlow&&(_e.current={key:e.idempotencyKey,send:()=>t(e),lines:i})}function Ct(e){Sn({confirmation:e,lines:pe.current,adsSendTo:a.googleAdsId&&a.googleAdsConversionLabel?`${a.googleAdsId}/${a.googleAdsConversionLabel}`:null}),An({confirmation:e,lines:pe.current})}async function I(e,t=x){if(!t)return;const n=e?async()=>e:B.current;if(t.orderNumber||!n){U(!0),k(t);return}L(),await Yn({checkoutNumber:t.checkoutNumber,resend:n,page:{setConfirming:an,land:k,markPaid:()=>U(!0),track:Ct,unplaced:lt}})}function bt(e=x){if(e){if(e.orderNumber){k(e);return}L(),lt({kind:"processing",checkoutNumber:e.checkoutNumber})}}async function Me(){const e=JSON.stringify([Ee.trim(),O,J,G.trim(),fe,$,v,T,u]);if(!(!le||!Ve||Qe!=="new"||nt.current===e))try{await j.createAddress({label:Ee.trim()||"Home",contact_name:`${O} ${J}`.trim(),phone:G.trim(),address:fe,city:$,zip_code:T,state:v,country:u}),nt.current=e,tt("Address saved to your account.")}catch{tt("We couldn't save the address to your account — you can add it under Account → Addresses.")}}async function Nt(e,t=h,n=!1,r=Y){K(null);try{if(t==="card"&&a.paymentMethods.includes("card")){const o=await y.createPaymentIntent({idempotencyKey:r});if(H.current=o,n&&ht()){await ge(e);return}let s=e;if(n){const l=await B.current?.().catch(()=>null);if(l?.orderNumber){await I(l,e);return}if(s=Pt(e,l)??{...e,expiresAt:null},ht()){await ge(e);return}}F(s),Oe(!1),de(o)}else if(t==="paypal"&&a.paymentMethods.includes("paypal"))F(e),Zt(!0);else if(t==="afterpay"&&a.paymentMethods.includes("afterpay")){const o=window.location.origin,s=await y.createAfterpayCheckout({idempotencyKey:r,confirmUrl:`${o}/checkout?afterpay=confirm`,cancelUrl:`${o}/checkout?afterpay=cancel`}),l={idempotencyKey:r,confirmation:e};C.setItem(Kn,JSON.stringify(l)),window.location.assign(s.redirectCheckoutUrl);return}else if(t==="square"&&a.paymentMethods.includes("square"))F(e),jt(!0);else if(t==="gocardless"&&a.paymentMethods.includes("gocardless")){const o=window.location.origin,s=await y.createGocardlessBillingRequest({idempotencyKey:r,confirmUrl:`${o}/checkout?gocardless=confirm`,cancelUrl:`${o}/checkout?gocardless=cancel`}),l={idempotencyKey:r,confirmation:e};C.setItem(Le,JSON.stringify(l)),window.location.assign(s.authorisationUrl);return}else if(t==="zip"&&a.paymentMethods.includes("zip")){const o=window.location.origin,s=await y.createZipCheckout({idempotencyKey:r,redirectUrl:`${o}/checkout?zip=return`}),l={idempotencyKey:r,confirmation:e};C.setItem(In,JSON.stringify(l)),window.location.assign(s.redirectUrl);return}else if(t==="klarna"&&a.paymentMethods.includes("klarna")){const o=window.location.origin,s=await y.createKlarnaCheckout({idempotencyKey:r,confirmUrl:`${o}/checkout?klarna=confirm`,cancelUrl:`${o}/checkout?klarna=cancel`}),l={idempotencyKey:r,confirmation:e};C.setItem($e,JSON.stringify(l)),window.location.assign(s.redirectUrl);return}else k(e)}catch(o){if((n||t==="card")&&o instanceof ke&&o.status===409){await I(void 0,e);return}St(e,o),b(!1)}}function Pt(e,t){return t&&!t.orderNumber&&t.status==="open"&&t.checkoutNumber===e.checkoutNumber?t:null}function St(e,t){w(Un(e,t)),!e.orderNumber&&Ye(t)?(P.current=!1,Ie(Ce())):K(e)}async function fn(e){if(!x)return;const t=x;try{const n=await y.createPaymentIntent({idempotencyKey:Y}),r=await B.current?.().catch(()=>null);if(r?.orderNumber){await I(r);return}const o=Pt(t,r);F(o??{...t,expiresAt:null}),Oe(e&&o!==null),H.current=n,de(n)}catch(n){if(n instanceof ke&&n.status===409){await I();return}de(null),F(null),St(t,n),b(!1)}}function yn(){x&&(P.current=!0,K(x),de(null),F(null),Oe(!1),b(!1))}return{site:a,logo:p,items:i,totals:A,coupon:M,deliveryOptions:Ue,courierUnavailable:qt,retryCourier:Dt,shippingMethodId:Q,setShippingMethodId:Lt,pickupLocation:Ft,servedCountries:q,formatMoney:Ut,payChoice:h,setPayChoice:be,placing:ee,email:D,setEmail:Ne,firstName:O,setFirstName:Pe,lastName:J,setLastName:Se,address1:te,setAddress1:ne,address2:Ae,setAddress2:re,city:$,setCity:oe,postcode:T,setPostcode:ce,phone:G,setPhone:ae,country:u,setCountry:se,subdivision:v,setSubdivision:ie,subdivisions:W,destination:We,postcodeLabel:zt,subdivisionLabel:Ht,me:le,savedAddresses:Jt,selectedAddressId:Qe,setSelectedAddressId:Ke,saveAddress:Ve,setSaveAddress:et,saveLabel:Ee,setSaveLabel:Gt,addressSaveNote:Wt,idemKey:Y,confirmation:rt,setConfirmation:k,orderError:Xt,payment:ot,paypalStep:ct,squareStep:at,pendingConf:x,paid:Qt,setPaid:U,unpaidOrder:g,payNote:Vt,afterpayConfirming:en,gocardlessConfirming:nn,zipConfirming:rn,klarnaConfirming:cn,cardConfirming:ut,checkoutResult:Te,confirmCardPayment:I,cardStillProcessing:bt,renewCardPayment:fn,holdRenewed:sn,leaveCardPayment:yn,checkoutRootRef:mt,setCheckoutHeaderEl:un,fillFromAddress:ft,checkoutSignOut:ln,payOptions:z,noPaymentMethod:dn,placeOrder:pn}}const Rt=wn(null);function sr({children:a,...p}){const d=Bn(p);return S(Rt.Provider,{value:d,children:a})}function ir(){const a=gn(Rt);if(!a)throw new Error("useCheckout must be used inside CheckoutStateProvider");return a}export{sr as CheckoutStateProvider,cr as NO_PAYMENT_METHOD_NOTE,ar as SHIPPING_RETRY_NOTE,Tt as buildPayOptions,Un as paymentNotStartedMessage,ir as useCheckout};
|
|
1
|
+
"use client";import{jsx as T}from"react/jsx-runtime";import{createContext as Un,useContext as Bn,useEffect as y,useMemo as zt,useRef as f,useState as o}from"react";import{isOrderable as Dt,useCart as Hn}from"../CartContext.js";import{useCurrency as zn}from"../CurrencyContext.js";import{getClickIds as Dn}from"../../lib/click-ids.js";import{adConsentForOrder as qn}from"../../lib/consent/choice.js";import{trackBeginCheckout as Gn,trackPurchase as Jn}from"../../lib/google-tag.js";import{trackMetaPurchase as Wn}from"../../lib/meta-pixel.js";import{ApiError as Te,api as ie,products as C}from"../../lib/api/index.js";import{uuid as ue}from"../../lib/uuid.js";import{orderLinesForSets as Xn}from"../../lib/commerce.js";import{canPersist as Zn,safeSessionStorage as v}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as jn,AFTERPAY_RETURN as Qn,GOCARDLESS_CONTEXT_KEY as qe,KLARNA_CONTEXT_KEY as Ge,ZIP_CONTEXT_KEY as Vn,ZIP_RETURN as er,runWalletReturn as qt}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as tr}from"../../lib/checkout/match-subdivision.js";import{checkoutGone as Je,checkoutWaiting as Gt,BANK_WAITING as nr,DROPPABLE_INTENT as rr,NOT_CHECKED as We,LOST_CHANGE as Jt,PAY_FIRST_FLOW as Wt,paysFirst as or,readIntentStatus as cr,releaseHeldCheckout as Xt,CHECKOUT_COMMITTED as ar,goodsShapeOf as sr,refusedForGood as Zt,settlePayFirst as ir}from"../../lib/checkout/pay-first.js";import{couponCodeForOrder as jt,couponRefusedByOrder as ur}from"../../lib/cart/coupon-preview.js";function Qt(a){const m=a.indexOf(`
|
|
2
|
+
`);return m===-1?[a,""]:[a.slice(0,m),a.slice(m+1)]}function Vt(a,{canParkContext:m}={canParkContext:!0}){const p=a.paymentMethods,i=[];return p.includes("card")&&i.push({key:"card",title:"Card",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),p.includes("paypal")&&a.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),p.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),p.includes("square")&&a.squareApplicationId&&a.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),p.includes("gocardless")&&m&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),p.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),p.includes("klarna")&&m&&i.push({key:"klarna",title:"Klarna",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),p.includes("bank")&&i.push({key:"bank",title:"Bank transfer",body:null,price:T("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}const xr="This shop does not take payment online yet. Please contact the shop to order.";class Ie extends Error{}function en(a,m){if(!a.orderNumber&&Je(m))return m.message;const p=m instanceof Te?` (${m.message})`:"";return a.orderNumber?`Your order ${a.orderNumber} is saved, but the payment did not start${p}. Try the payment again — your order will not be placed twice.`:`Your items are held under ${a.checkoutNumber}, but the payment did not start${p}. Try the payment again — you will not be charged twice.`}const tn=new Set(["paypal","square","afterpay","gocardless","zip","klarna"]),z=a=>JSON.parse(a),Or="Shipping cannot be calculated right now. Please try again.";function lr({site:a,logo:m,preview:p=!1}){const{items:i,totals:I,coupon:D,refuseCoupon:rn,deliveryOptions:Xe,shippingMethodId:le,setShippingMethodId:on,setQuoteDestination:de,courier:cn,requote:an,identify:Ze,clearCapturedCart:q,replaceItems:je,removeCoupon:Qe}=Hn(),sn=Xe.find(e=>e.id===le)?.pickupLocation??null,{country:Ve,countries:Q,activeCountry:et,formatMoney:un}=zn(),[w,pe]=o(()=>Vt(a)[0]?.key??null),[tt,ln]=o(!0);y(()=>{ln(Zn(v))},[]);const[fe,S]=o(!1),[V,_e]=o(""),[L,Me]=o(""),[ee,Re]=o(""),[me,ye]=o(""),[Le,he]=o(""),[G,we]=o(""),[$,ge]=o(""),[te,ke]=o(""),[l,Ce]=o(()=>Ve||Q[0]?.code||""),[_,be]=o(""),[ne,nt]=o([]),[$e,Fe]=o(null),[Ne,re]=o(null),rt=zt(()=>Q.find(e=>e.code===l)??et,[Q,l,et]),dn=rt?.postalLabel||"Postal Code",pn=ne[0]?.divisionType||"State / Province";y(()=>{if(!l){nt([]),Fe(l);return}Fe(null);let e=!1;return C.listCountrySubdivisions(l).then(t=>{e||(nt(t),Fe(l),be(""))}),()=>{e=!0}},[l]);const ot=me.trim()!==""&&G.trim()!==""&&$.trim()!==""&&$e===l&&(ne.length===0||_!=="")?$.trim():"";y(()=>{de(l?{country:l,subdivision:_,postcode:ot}:null)},[l,_,ot,de]),y(()=>()=>de(null),[de]);const fn=cn?.status==="unavailable",mn=an,[Pe,ct]=o(null),[yn,at]=o([]),[st,Ye]=o("new"),[it,ut]=o(!1),[Ue,hn]=o("Home"),[wn,lt]=o(null),[gn,dt]=o(null),[oe,Se]=o(()=>ue()),pt=f(null),[ft,A]=o(null),[kn,b]=o(null),[mt,Ae]=o(null),[yt,Cn]=o(!1),[ht,bn]=o(!1),[M,J]=o(null),[Nn,W]=o(!1),[N,K]=o(null),[Pn,x]=o(null),[Sn,An]=o(!1),[vn,wt]=o(!1),[Kn,xn]=o(!1),[On,gt]=o(!1),[kt,En]=o(!1),[Tn,Be]=o(!1),[He,Ct]=o(null),F=f(null),ce=f(i),Y=f(null),X=f(null),bt=!!(ft||He&&He.kind!=="processing"||kt||yt||ht||mt&&M?.orderNumber);y(()=>{bt&&(je([]),Qe())},[bt,je,Qe]);const Nt=f(!1);y(()=>{p||Nt.current||!i.some(Dt)||(Nt.current=!0,Gn({lines:i,currency:I.currency,value:I.subtotal-I.discount,coupon:D?.valid?D.code:void 0}))},[i,I,D,p]),y(()=>{Ze(V,L.trim()||void 0)},[V,L,Ze]);const Pt=f(null),[ve,In]=o(null);y(()=>{const e=Pt.current;if(!ve||!e)return;const t=()=>e.style.setProperty("--sf-checkout-header-h",`${ve.offsetHeight}px`);t();const n=new ResizeObserver(t);return n.observe(ve),()=>n.disconnect()},[ve]),y(()=>{const e=n=>({setConfirming:n,land:A,markPaid:()=>W(!0),note:x,fail:b,clearCart:q}),t={search:window.location.search,storage:v,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};qt(Qn,{...t,capture:C.captureAfterpayPayment,page:e(An)}),qt(er,{...t,capture:C.captureZipPayment,page:e(xn)})},[]),y(()=>{const t=new URLSearchParams(window.location.search).get("gocardless");if(t!=="confirm"&&t!=="cancel")return;const n=v.getItem(qe);if(v.removeItem(qe),window.history.replaceState(null,"",window.location.pathname),!n)return;let c;try{c=JSON.parse(n)}catch{return}if(q(),t==="cancel"){x("The direct debit was not set up — our team will follow up on payment."),A(c.confirmation);return}wt(!0),C.completeGocardlessPayment({idempotencyKey:c.idempotencyKey}).then(r=>{r.status==="paid"?W(!0):r.status==="declined"?x("The direct debit was declined — our team will follow up on payment."):x("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{x("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{A(c.confirmation),wt(!1)})},[]),y(()=>{const e=new URLSearchParams(window.location.search),t=e.get("klarna");if(t!=="confirm"&&t!=="cancel")return;const n=v.getItem(Ge);v.removeItem(Ge);const c=e.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!n)return;let r;try{r=JSON.parse(n)}catch{return}if(q(),t==="cancel"||!c){x("The Klarna payment was not completed — our team will follow up on payment."),A(r.confirmation);return}gt(!0),C.captureKlarnaPayment({idempotencyKey:r.idempotencyKey,authorizationToken:c}).then(u=>{u.status==="paid"?W(!0):u.status==="declined"?x("Klarna declined the payment — our team will follow up on payment."):x("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{x("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{A(r.confirmation),gt(!1)})},[]);function St(e){const[t,n]=Qt(e.address);ye(t),he(n),we(e.city),ge(e.zip_code),e.country&&Ce(e.country),e.phone&&ke(e.phone),re({country:e.country||null,state:e.state??""})}y(()=>{if(Ne){if((Ne.country||l)!==l){re(null);return}$e===l&&(be(tr(l,Ne.state,ne)),re(null))}},[Ne,l,$e,ne]),y(()=>{let e=!1;return(async()=>{try{const[t,n,c]=await Promise.all([ie.me(),ie.myProfile().catch(()=>null),ie.myAddresses().catch(()=>[])]);if(e)return;ct(t);const r=c.filter(d=>d.is_active);at(r),_e(t.email);const u=(n?.contact_name??"").split(/\s+/);Me(t.first_name||u[0]||""),Re(t.last_name||u.slice(1).join(" "));const s=t.phone||n?.phone;s&&ke(s);const g=r.find(d=>d.id===t.default_delivery_location)??r[0];if(g)Ye(g.id),St(g);else if(n){const[d,k]=Qt(n.address??"");ye(d),he(k),we(n.city??""),ge(n.zip_code??""),n.country&&Ce(n.country),re({country:n.country||null,state:n.state??""})}}catch{}})(),()=>{e=!0}},[]);function _n(){ie.logout(),ct(null),at([]),Ye("new"),ut(!1),_e(""),Me(""),Re(""),ye(""),he(""),we(""),ge(""),ke(""),Ce(Ve||Q[0]?.code||""),be(""),re(null)}const Z=zt(()=>Vt(a,{canParkContext:tt}),[a,tt]);y(()=>{Z.some(e=>e.key===w)||pe(Z[0]?.key??null)},[Z,w]);const Mn=Z.length===0,Ke=Le.trim()?`${me}
|
|
3
|
+
${Le.trim()}`:me,Rn=sr({email:V,firstName:L,lastName:ee,phone:te,address:Ke,city:G,subdivision:_,postcode:$,country:l,lines:i.map(e=>[e.id,e.qty]),shippingMethodId:le,couponCode:jt(D),currency:I.currency,shopperId:Pe?.id??null}),h=JSON.stringify([Rn,w]),R=f(null),ze=f(null),xe=f(!1),O=f(!1),j=f(null),Oe=f(!1),P=f(h);P.current=h;const At=f(fe);At.current=fe;const vt=()=>O.current&&P.current!==R.current,U=f(null);y(()=>{At.current||(h!==U.current&&(U.current=null),!(!O.current||!N||N.orderNumber)&&(h===R.current||h===U.current||Ee(N)))},[h,N]);async function Ee(e){if(Oe.current)return null;Oe.current=!0,S(!0);try{const t=j.current?await cr(j.current):"none";if(t==="succeeded"||t==="processing")return O.current=!1,K(null),E("card"),t==="succeeded"?await B(void 0,e):Rt(e),null;if(t===void 0||!rr.has(t))return U.current=P.current,K(e),b(t==="requires_action"?nr:We),null;const n=await Xt(oe);if(n==="committed")return O.current=!1,K(null),E("card"),await B(void 0,e),null;if(n!=="released")return U.current=P.current,K(e),b(We),null;O.current=!1,j.current=null,U.current=null,b(null),K(null);const c=ue();return Se(c),c}finally{Oe.current=!1,S(!1)}}async function Ln(){if(!(p||fe||Oe.current)){if(N){if((O.current?h!==R.current:ae())&&!N.orderNumber){const c=await Ee(N);c&&P.current===h&&await Kt(c);return}S(!0),b(null),xe.current=!1,await De();const t=z(P.current)[1],n=N.orderNumber?t:"card";if(n&&tn.has(n)&&ae()&&z(P.current)[0]!==ze.current){xt(N);return}E(n),n!==w&&pe(n),await Lt(N,n,!N.orderNumber);return}await Kt(oe)}}async function Kt(e){if(i.length===0||I.repricing||!w||!Z.some(s=>s.key===w))return;const t=i.filter(Dt).flatMap(s=>Xn(s.components,s.qty));if(t.length===0){b("Pick a size on each wheel's product page before checking out.");return}S(!0),b(null);let n,c=e,r=w,u=!1;try{const s=Pe?C.createOrderAuthed:C.createOrder,g=qn(),d={customer:{email:V,name:`${L} ${ee}`.trim(),phone:te.trim()||void 0,address:Ke,city:G,state:_||void 0,zipCode:$,country:l},items:t,currency:I.currency,idempotencyKey:e,shippingMethodId:le??void 0,couponCode:jt(D),...g==="denied"?{}:Dn(),...g?{adConsent:g}:{},...or(w)?{checkoutFlow:Wt}:{}};F.current=()=>s(d),dt(null),ze.current=null,xe.current=!1,j.current=null,O.current=!1,U.current=null,R.current=h,ce.current=i;const k=Y.current,Yt=k?.key===d.idempotencyKey&&(k.shape!==h&&(!!d.checkoutFlow||!!k.method||!!k.plainMethod)||!!d.checkoutFlow&&!!k.plainMethod);Yt&&(X.current=d.idempotencyKey);const Ut=It(d,s),Bt=Yt||!d.checkoutFlow&&X.current===d.idempotencyKey,Ht=!Ut&&!Bt&&!d.checkoutFlow&&!!k&&!k.method;Ht&&(k.plainMethod=w,k.plainLines=i,k.plainShape=h);const H=await(Bt?Et(d,s):s(d).then(se=>({answer:se,request:d})).catch(se=>(Ut?Ot(se,d.idempotencyKey):Ht&&Zt(se)&&(k.plainMethod=""),$n(se,d,s))));if(!H)return;n=H.answer,c=H.request.idempotencyKey,r=H.method??r,E(r),u=ae()||r!==z(P.current)[1],H.method&&H.method!==w&&pe(H.method),n.orderNumber&&(_t(n),q()),await De()}catch(s){const g=ur(s);g?(rn(g),b(`${g} Your order has not been placed. Place it again to continue without the code.`)):s instanceof Ie?b(We):b(s instanceof Te?s.message:"Could not place the order. Please try again."),S(!1);return}if(r&&tn.has(r)&&(u||ae())){xt(n);return}await Lt(n,r,!1,c)}function xt(e){ze.current=z(P.current)[0],b(`${en(e,null)} ${Jt}`),K(e),S(!1)}function Ot(e,t){Zt(e)&&!Gt(e)&&Y.current?.key===t&&(Y.current=null)}async function $n(e,t,n){if(Je(e))return Tt(t,n);if(!Gt(e))throw e;return X.current=t.idempotencyKey,Et(t,n,!0)}async function Et(e,t,n=!1){const c=await Xt(e.idempotencyKey);if(c==="released")return P.current===h?Tt(e,t):(Se(ue()),S(!1),null);if(c!=="committed")throw new Ie;const r=Y.current?.key===e.idempotencyKey?Y.current:null;if(ce.current=r?.lines??i,r?.method&&!n){X.current=null,F.current=r.send;const g=await r.send().catch(()=>{throw new Ie});return R.current=r.shape,{answer:g,request:e,method:r.method}}const u=r&&!r.method?r.send:()=>t({...e,checkoutFlow:Wt});F.current=u;const s=await u().catch(()=>null);if(!s&&r?.plainMethod)throw new Ie;return s?.orderNumber&&s.status!==ar?(X.current=null,r?.plainMethod&&(ce.current=r.plainLines),r&&(R.current=r.plainMethod?r.plainShape:r.shape),{answer:s,request:e,method:r?.plainMethod||void 0}):(S(!1),r&&(R.current=r.shape),E("card"),await Mt("",s?async()=>s:()=>Promise.reject(new Error("The order request did not answer."))),await De(),null)}function ae(){const e=R.current;return e!==null&&z(e)[0]!==z(P.current)[0]}function E(e){e!==z(P.current)[1]&&(xe.current=!0),dt(xe.current||ae()?Jt:null)}async function Tt(e,t){const n={...e,idempotencyKey:ue()};X.current=null,Se(n.idempotencyKey),F.current=()=>t(n),It(n,t);try{return{answer:await t(n),request:n}}catch(c){throw Ot(c,n.idempotencyKey),c}}function It(e,t){return Y.current?.key===e.idempotencyKey?!1:(Y.current={key:e.idempotencyKey,send:()=>t(e),lines:i,shape:h,method:e.checkoutFlow?"":w??"",plainMethod:"",plainLines:i,plainShape:h},!0)}function _t(e){Jn({confirmation:e,lines:ce.current,adsSendTo:a.googleAdsId&&a.googleAdsConversionLabel?`${a.googleAdsId}/${a.googleAdsConversionLabel}`:null}),Wn({confirmation:e,lines:ce.current})}async function B(e,t=M){if(!t)return;const n=e?async()=>e:F.current;if(t.orderNumber||!n){W(!0),A(t);return}await Mt(t.checkoutNumber,n)}async function Mt(e,t){q(),await ir({checkoutNumber:e,resend:t,page:{setConfirming:En,land:A,markPaid:()=>W(!0),track:_t,unplaced:Ct}})}function Rt(e=M){if(e){if(e.orderNumber){A(e);return}q(),Ct({kind:"processing",checkoutNumber:e.checkoutNumber})}}async function De(){const e=JSON.stringify([Ue.trim(),L,ee,te.trim(),Ke,G,_,$,l]);if(!(!Pe||!it||st!=="new"||pt.current===e))try{await ie.createAddress({label:Ue.trim()||"Home",contact_name:`${L} ${ee}`.trim(),phone:te.trim(),address:Ke,city:G,zip_code:$,state:_,country:l}),pt.current=e,lt("Address saved to your account.")}catch{lt("We couldn't save the address to your account — you can add it under Account → Addresses.")}}async function Lt(e,t=w,n=!1,c=oe){K(null);try{if(t==="card"&&a.paymentMethods.includes("card")){const r=await C.createPaymentIntent({idempotencyKey:c});if(j.current=r,n&&vt()){await Ee(e);return}let u=e;if(n){const s=await F.current?.().catch(()=>null);if(s?.orderNumber){E("card"),await B(s,e);return}if(u=$t(e,s)??{...e,expiresAt:null},vt()){await Ee(e);return}}E("card"),J(u),Be(!1),Ae(r)}else if(t==="paypal"&&a.paymentMethods.includes("paypal"))J(e),Cn(!0);else if(t==="afterpay"&&a.paymentMethods.includes("afterpay")){const r=window.location.origin,u=await C.createAfterpayCheckout({idempotencyKey:c,confirmUrl:`${r}/checkout?afterpay=confirm`,cancelUrl:`${r}/checkout?afterpay=cancel`}),s={idempotencyKey:c,confirmation:e};v.setItem(jn,JSON.stringify(s)),window.location.assign(u.redirectCheckoutUrl);return}else if(t==="square"&&a.paymentMethods.includes("square"))J(e),bn(!0);else if(t==="gocardless"&&a.paymentMethods.includes("gocardless")){const r=window.location.origin,u=await C.createGocardlessBillingRequest({idempotencyKey:c,confirmUrl:`${r}/checkout?gocardless=confirm`,cancelUrl:`${r}/checkout?gocardless=cancel`}),s={idempotencyKey:c,confirmation:e};v.setItem(qe,JSON.stringify(s)),window.location.assign(u.authorisationUrl);return}else if(t==="zip"&&a.paymentMethods.includes("zip")){const r=window.location.origin,u=await C.createZipCheckout({idempotencyKey:c,redirectUrl:`${r}/checkout?zip=return`}),s={idempotencyKey:c,confirmation:e};v.setItem(Vn,JSON.stringify(s)),window.location.assign(u.redirectUrl);return}else if(t==="klarna"&&a.paymentMethods.includes("klarna")){const r=window.location.origin,u=await C.createKlarnaCheckout({idempotencyKey:c,confirmUrl:`${r}/checkout?klarna=confirm`,cancelUrl:`${r}/checkout?klarna=cancel`}),s={idempotencyKey:c,confirmation:e};v.setItem(Ge,JSON.stringify(s)),window.location.assign(u.redirectUrl);return}else E(t),A(e)}catch(r){if((n||t==="card")&&r instanceof Te&&r.status===409){E(t),await B(void 0,e);return}Ft(e,r),S(!1)}}function $t(e,t){return t&&!t.orderNumber&&t.status==="open"&&t.checkoutNumber===e.checkoutNumber?t:null}function Ft(e,t){b(en(e,t)),!e.orderNumber&&Je(t)?(O.current=!1,Se(ue())):K(e)}async function Fn(e){if(!M)return;const t=M;try{const n=await C.createPaymentIntent({idempotencyKey:oe}),c=await F.current?.().catch(()=>null);if(c?.orderNumber){await B(c);return}const r=$t(t,c);J(r??{...t,expiresAt:null}),Be(e&&r!==null),j.current=n,Ae(n)}catch(n){if(n instanceof Te&&n.status===409){await B();return}Ae(null),J(null),Ft(t,n),S(!1)}}function Yn(){M&&(O.current=!0,K(M),Ae(null),J(null),Be(!1),S(!1))}return{site:a,logo:m,items:i,totals:I,coupon:D,deliveryOptions:Xe,courierUnavailable:fn,retryCourier:mn,shippingMethodId:le,setShippingMethodId:on,pickupLocation:sn,servedCountries:Q,formatMoney:un,payChoice:w,setPayChoice:pe,placing:fe,email:V,setEmail:_e,firstName:L,setFirstName:Me,lastName:ee,setLastName:Re,address1:me,setAddress1:ye,address2:Le,setAddress2:he,city:G,setCity:we,postcode:$,setPostcode:ge,phone:te,setPhone:ke,country:l,setCountry:Ce,subdivision:_,setSubdivision:be,subdivisions:ne,destination:rt,postcodeLabel:dn,subdivisionLabel:pn,me:Pe,savedAddresses:yn,selectedAddressId:st,setSelectedAddressId:Ye,saveAddress:it,setSaveAddress:ut,saveLabel:Ue,setSaveLabel:hn,addressSaveNote:wn,lostChangeNote:gn,idemKey:oe,confirmation:ft,setConfirmation:A,orderError:kn,payment:mt,paypalStep:yt,squareStep:ht,pendingConf:M,paid:Nn,setPaid:W,unpaidOrder:N,payNote:Pn,afterpayConfirming:Sn,gocardlessConfirming:vn,zipConfirming:Kn,klarnaConfirming:On,cardConfirming:kt,checkoutResult:He,confirmCardPayment:B,cardStillProcessing:Rt,renewCardPayment:Fn,holdRenewed:Tn,leaveCardPayment:Yn,checkoutRootRef:Pt,setCheckoutHeaderEl:In,fillFromAddress:St,checkoutSignOut:_n,payOptions:Z,noPaymentMethod:Mn,placeOrder:Ln}}const nn=Un(null);function Er({children:a,...m}){const p=lr(m);return T(nn.Provider,{value:p,children:a})}function Tr(){const a=Bn(nn);if(!a)throw new Error("useCheckout must be used inside CheckoutStateProvider");return a}export{Er as CheckoutStateProvider,xr as NO_PAYMENT_METHOD_NOTE,Or as SHIPPING_RETRY_NOTE,Vt as buildPayOptions,en as paymentNotStartedMessage,Tr as useCheckout};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type HeroPriceTemplateProps } from "../ProductHeroPanel.js";
|
|
3
3
|
import type { StoreProduct } from "../../lib/catalog/store-product.js";
|
|
4
4
|
import type { HeroPricePlacement } from "../../lib/sections/hero-price-placement.js";
|
|
5
5
|
import type { HeroLayout, HeroTextAlign } from "../../lib/sections/hero-arrangement.js";
|
|
6
6
|
import type { HeroGalleryMode, HeroImageFit } from "../../lib/sections/hero-gallery.js";
|
|
7
|
-
interface HeroArrangement extends
|
|
7
|
+
interface HeroArrangement extends HeroPriceTemplateProps {
|
|
8
8
|
heroLayout?: HeroLayout;
|
|
9
9
|
imageRatio?: number;
|
|
10
10
|
textAlign?: HeroTextAlign;
|
|
@@ -7,4 +7,10 @@ export interface StageControl {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function stageControls(angleIdx: number, total: number, setAngleIdx: (i: number) => void): StageControl[];
|
|
9
9
|
export declare function decodeStagePhoto(url: string): Promise<void>;
|
|
10
|
+
export declare function decodePhotoAt(url: string, sizes: string): Promise<void>;
|
|
11
|
+
export declare const STAGE_HOLD_LIMIT_MS = 8000;
|
|
12
|
+
export declare function useStagePhotoHold(photos: readonly string[], wanted: string | undefined, decode?: (url: string) => Promise<void>): {
|
|
13
|
+
drawn: string | undefined;
|
|
14
|
+
settled: boolean;
|
|
15
|
+
};
|
|
10
16
|
export declare function useHeldStagePhoto(photos: readonly string[], wanted: string | undefined, decode?: (url: string) => Promise<void>): string | undefined;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{getImageProps as
|
|
2
|
-
`);p(()=>{let
|
|
3
|
-
`):[])
|
|
1
|
+
"use client";import{getImageProps as P}from"next/image";import{useEffect as p,useState as a}from"react";const k="(max-width: 720px) 88vw, (max-width: 1100px) 44vw, 700px";function h(o,e,t){return t<=1?0:((o+e)%t+t)%t}function b(o,e,t){return[{glyph:"◁",label:"Previous angle",onClick:()=>t(h(o,-1,e))},{glyph:"⟳",label:"Reset to first angle",onClick:()=>t(0)},{glyph:"▷",label:"Next angle",onClick:()=>t(h(o,1,e))}]}function m(o){return E(o,k)}function E(o,e){const{props:t}=P({src:o,alt:"",fill:!0,sizes:e}),n=new window.Image;return t.sizes&&(n.sizes=t.sizes),t.srcSet&&(n.srcset=t.srcSet),n.src=t.src,n.decode()}const G=8e3;function T(o,e,t=m){const[n,S]=a(()=>new Set),[s,x]=a(e),[v,y]=a(),c=o.join(`
|
|
2
|
+
`);p(()=>{let i=!0;const g=r=>{S(l=>l.has(r)?l:new Set(l).add(r))};for(const r of c?c.split(`
|
|
3
|
+
`):[])n.has(r)||t(r).then(()=>g(r),()=>{i&&g(r)});return()=>{i=!1}},[c]);const u=e!==void 0&&(n.has(e)||v===e),d=e!==void 0&&!u&&o.includes(e);p(()=>{if(!d)return;const i=setTimeout(()=>y(e),G);return()=>clearTimeout(i)},[d,e]);const f=e===void 0||u||s===void 0;return p(()=>{f&&s!==e&&x(e)},[f,s,e]),{drawn:f?e:s,settled:u}}function z(o,e,t=m){return T(o,e,t).drawn}export{G as STAGE_HOLD_LIMIT_MS,k as STAGE_IMAGE_SIZES,E as decodePhotoAt,m as decodeStagePhoto,b as stageControls,h as stepGalleryAngle,z as useHeldStagePhoto,T as useStagePhotoHold};
|
|
@@ -12,6 +12,9 @@ export interface FinishSelection {
|
|
|
12
12
|
finish: FinishSwatch | undefined;
|
|
13
13
|
shownSrc: string | null;
|
|
14
14
|
showSwatches: boolean;
|
|
15
|
+
awaitingProbe: boolean;
|
|
16
|
+
nearScreen: boolean;
|
|
17
|
+
pictureFailed: (url: string) => void;
|
|
15
18
|
probes: React.ReactNode;
|
|
16
19
|
}
|
|
17
20
|
export declare function useFinishSelection(finishes: FinishSwatch[], cover: string | null, defaultFinish?: string): FinishSelection;
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as se}from"react/jsx-runtime";import{AppRouterContext as oe}from"next/dist/shared/lib/app-router-context.shared-runtime";import{useCallback as U,useContext as re,useEffect as j,useMemo as D,useRef as H,useState as c}from"react";import{ClippedPictures as ce}from"./card-pieces/ClippedPictures.js";import{STAGE_HOLD_LIMIT_MS as ae}from"./product-hero/stage-photo.js";import{holdSignedUrl as le,signedUrlExpired as N}from"../lib/wheels/signed-url.js";function l(n){const o=n.indexOf("?");if(o<0)return n;const d=n.slice(o+1).split("&").filter(u=>!/^x-amz-/i.test(u));return d.length>0?`${n.slice(0,o)}?${d.join("&")}`:n.slice(0,o)}const g=n=>n?{name:n.name,file:l(n.src)}:null,de=300*1e3,T=new WeakMap,ue="1250px";function xe(n,o,d){const[u,y]=c(()=>g(d?n.find(e=>e.name===d):void 0)??void 0),[h,v]=c(null),[f,G]=c(()=>new Set),$=e=>G(t=>t.has(l(e))?t:new Set(t).add(l(e))),w=H(n);w.current=n;const q=U(e=>y(e<0?null:g(w.current[e])),[]),z=U(e=>v(e===null?null:g(w.current[e])),[]),m=re(oe);for(const e of[o,...n.map(t=>t.src)])le(e);const E=()=>{m&&Date.now()-(T.get(m)??0)>=de&&(T.set(m,Date.now()),m.refresh())},K=e=>{N(e)&&E()},V=(e,t)=>{if(!N(t))return $(t);E()},[W,Y]=c(()=>new Set),B=e=>Y(t=>t.has(e)?t:new Set(t).add(e)),[_,J]=c(()=>new Set),R=e=>J(t=>t.has(e)?t:new Set(t).add(e)),M=H(null),[x,Q]=c(!1);j(()=>{const e=M.current;if(!e||typeof IntersectionObserver>"u")return;const t=new IntersectionObserver(s=>{const S=s[s.length-1];S&&Q(S.isIntersecting)},{rootMargin:ue});return t.observe(e),()=>t.disconnect()},[]);const I=n.map(e=>l(e.src)).join(`
|
|
2
|
+
`),i=D(()=>(I?I.split(`
|
|
3
|
+
`):[]).map(e=>!f.has(e)),[I,f]),O=D(()=>i.map((e,t)=>e?t:-1).filter(e=>e!==-1),[i]),k=e=>{const t=s=>s>=0&&i[s]?s:null;return t(n.findIndex(s=>s.name===e.name&&l(s.src)===e.file))??t(n.findIndex((s,S)=>s.name===e.name&&i[S]))},A=u===null?-1:(u===void 0?null:k(u))??O[0]??-1,L=h===null?null:k(h),r=L??A,a=r>=0?n[r]:void 0,X=a?.src??o,Z=O.length>=2,ee=r>=0&&!(a&&W.has(a.src)),[F,te]=c(()=>new Set),b=e=>_.has(n[e].src)||F.has(n[e].src)||f.has(l(n[e].src)),C=!a||b(r)?n.findIndex((e,t)=>!b(t)):-1,P=a&&!b(r)?r:C,p=P>=0?n[P].src:null;j(()=>{if(!x||!p)return;const e=setTimeout(()=>te(t=>t.has(p)?t:new Set(t).add(p)),ae);return()=>clearTimeout(e)},[x,p]);const ne=n.length>0?se(ce,{clipRef:M,pictures:n.flatMap((e,t)=>_.has(e.src)||F.has(e.src)||t===r||t===C?[{src:e.src,onLoad:()=>{R(e.src),B(e.src)},onError:()=>{R(e.src),V(t,e.src)}}]:[])}):null;return{selectedIdx:A,setSelectedIdx:q,hoverIdx:L,setHoverIdx:z,availability:i,finish:a,shownSrc:X,showSwatches:Z,awaitingProbe:ee,nearScreen:x,pictureFailed:K,probes:ne}}export{xe as useFinishSelection};
|
|
@@ -24,6 +24,8 @@ export declare const loadUnifiedProductCatalog: (force?: boolean) => Promise<(({
|
|
|
24
24
|
defaultFinishRenderings?: string[];
|
|
25
25
|
description: string;
|
|
26
26
|
listable?: boolean;
|
|
27
|
+
} & {
|
|
28
|
+
hoverMedia?: import("../lib/api/types.js").components["schemas"]["HoverMedia"];
|
|
27
29
|
} & {
|
|
28
30
|
kind: "alloy-wheel";
|
|
29
31
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r,Fragment as T,jsxs as G}from"react/jsx-runtime";import{CARD_IMAGE_SIZES as M}from"../../lib/sections/card-image-sizes.js";import{LISTING_CARD_SHOW as B}from"../../lib/sections/card-show-defaults.js";import U from"next/image";import{useHeldCardPicture as X}from"../card-pieces/useHeldCardPicture.js";import{useState as H}from"react";import V from"../BrandPlate.js";import Z,{CardBuyDialog as q}from"../card-pieces/CardBuyButton.js";import J from"../card-pieces/CardFinishSwatches.js";import K from"../card-pieces/CardPrice.js";import Q from"../card-pieces/CardProductBadge.js";import{useWheelCardState as Y,WheelCardStateProvider as ee}from"../card-pieces/ProductCardState.js";import{wheelCardEyebrow as re,wheelCardEyebrowShows as oe}from"../ProductCardEyebrow.js";import{withRMark as k}from"efficient-web-builder/render/components/RMark";import ae from"../WheelPlaceholder.js";import{cardSpinOf as se}from"../card-spin.js";import{cardHoverOf as te}from"efficient-web-builder/format/lib/animation/hover";import{CardSpecFacts as ne}from"../card-pieces/CardSpecs.js";import ie from"../WheelCardFrame.js";import{CARD_IMAGE_BG_OFF as le}from"efficient-web-builder/format/lib/content/card-image-background";import{itemBrand as de}from"../../lib/catalog/plp-item.js";import{CARD_INDEX_BADGE_CLASS as me,CARD_INDEX_CLASS as ce,DEFAULT_CARD_INDEX_FORMAT as he,DEFAULT_CARD_OUTLINE as pe}from"efficient-web-builder/format/lib/sections/product-card-style";import{setSecondSrc as ue}from"../../lib/wheels/set-mode.js";import{PLP_GRID_GAP_VAR as fe}from"../../lib/wheels/plp-grid.js";import{FITMENT_FIELD_SEPARATOR as we}from"../../lib/wheels/plp-fitment-match.js";import{coverSrcForWheel as Se,DEFAULT_COVER_INDEX as Ce,resolvePaintedSrc as ge}from"../../lib/wheels/cover-rendering.js";const _e=[],Ee=te({},"AlloyWheelsListing");function Ae({wheel:i,colours:p,fit:l=null,editing:d=!1,brandPlate:m=!1,kindLabel:u=null,showBrand:t=!0,showProcess:f=!1,coverIndex:w=Ce,fieldUsage:S=_e,hover:C=Ee,imageBackgroundFill:g=le,showBadge:_=!0,outline:E=pe,indexBadge:A=he,showCardSizes:F=B.showCardSizes,showCardBuy:b=B.showCardBuy,showCardPage:c=B.showCardPage,showCardPrice:o=!0,showCardFinishes:e=!0,imageSizes:h=M}){return r(ee,{wheel:i,colours:p,editing:d,children:r(Fe,{fit:l,brandPlate:m,kindLabel:u,showBrand:t,showProcess:f,coverIndex:w,fieldUsage:S,hover:C,imageBackgroundFill:g,showBadge:_,outline:E,indexBadge:A,showCardSizes:F,showCardBuy:b,showCardPage:c,showCardPrice:o,showCardFinishes:e,imageSizes:h})})}function Fe({fit:i,brandPlate:p,kindLabel:l,showBrand:d,showProcess:m,coverIndex:u,fieldUsage:t,hover:f,imageBackgroundFill:w,showBadge:S,outline:C,indexBadge:g,showCardSizes:_,showCardBuy:E,showCardPage:A,showCardPrice:F,showCardFinishes:b,imageSizes:c}){const{wheel:o,sel:e,isSet:h}=Y(),x=Se(o,u,e.finish?.name,e.shownSrc,i?.holes),[D,O]=H(()=>new Set),y=a=>{e.pictureFailed(a),O(n=>n.has(a)?n:new Set(n).add(a))},R=ge({overrideSrc:x,hookSrc:e.shownSrc,failed:D}),P=de(o),I=se(f),L=(a,n)=>r(U,{alt:n,src:a,width:800,height:800,sizes:c,className:["block h-full w-full object-contain",I.className].filter(Boolean).join(" "),style:I.style,draggable:!1,onError:()=>y(a)},a),W=e.finish?`${o.name} — ${e.finish.name}`:o.name,v=h?ue(o.finishes?.find(a=>a.name===e.finish?.name),R):null,s=X({src:R,second:v,alt:W,sizes:c,failed:D,onFailed:y,near:e.nearScreen,holdEmpty:e.awaitingProbe}),$=G(T,{children:[s.src?L(s.src,s.alt):r(ae,{imageLabel:o.name,spin:I}),s.trial]}),j=s.second?L(s.second,`${s.alt} — right`):void 0,N=g!=="off"?r("span",{"aria-hidden":!0,className:`${ce} ${me}`}):null,z=re({kindLabel:l,brand:d&&P?k(P):null,process:m&&o.process?k(o.process):null},t);return G(T,{children:[r(ie,{href:`/wheels/${o.slug}`,wide:h,setGridGap:`var(${fe})`,identityLink:!0,containerProps:{onPointerEnter:e.arm,onTouchStart:e.arm,onFocusCapture:e.arm},probes:e.probes,outline:C,imageBackgroundFill:w,indexBadge:N,badges:r(Q,{show:S,numbered:N!=null,sale:!0}),image:$,imageSecond:j,plate:p?r(V,{brand:P,logo:o.brandLogo}):null,eyebrow:z,wholeCardLink:!0,reserveEyebrow:oe({kind:!!l,brand:d,process:m},t),spec:r(ne,{sizes:_,fieldUsage:t,car:i,separator:we}),price:r(K,{show:F,setTotal:!0,wasFollowsSize:!0}),swatches:r(J,{show:b,showSingle:!0}),buy:r(Z,{buy:E,page:A})}),r(q,{})]})}export{Ae as default};
|
|
@@ -1110,7 +1110,10 @@ export interface components {
|
|
|
1110
1110
|
loadRating: string;
|
|
1111
1111
|
inStock: boolean;
|
|
1112
1112
|
};
|
|
1113
|
-
WheelSummary: {
|
|
1113
|
+
WheelSummary: components["schemas"]["WheelCore"] & {
|
|
1114
|
+
hoverMedia?: components["schemas"]["HoverMedia"];
|
|
1115
|
+
};
|
|
1116
|
+
WheelCore: {
|
|
1114
1117
|
name: string;
|
|
1115
1118
|
slug: string;
|
|
1116
1119
|
designCode?: string;
|
|
@@ -1141,6 +1144,16 @@ export interface components {
|
|
|
1141
1144
|
thumbnailUrl: string;
|
|
1142
1145
|
kind: "image" | "video";
|
|
1143
1146
|
};
|
|
1147
|
+
HoverMediaGroup: {
|
|
1148
|
+
finish: string;
|
|
1149
|
+
items: components["schemas"]["MediaGroupItem"][];
|
|
1150
|
+
};
|
|
1151
|
+
HoverMedia: {
|
|
1152
|
+
photos?: components["schemas"]["HoverMediaGroup"][];
|
|
1153
|
+
lifestyle?: components["schemas"]["HoverMediaGroup"][];
|
|
1154
|
+
accessories?: components["schemas"]["HoverMediaGroup"][];
|
|
1155
|
+
others?: components["schemas"]["HoverMediaGroup"][];
|
|
1156
|
+
};
|
|
1144
1157
|
MediaGroup: {
|
|
1145
1158
|
name: string;
|
|
1146
1159
|
vehicle?: string;
|
|
@@ -1276,7 +1289,7 @@ export interface components {
|
|
|
1276
1289
|
oemSizes: string[];
|
|
1277
1290
|
variants: components["schemas"]["TyreFitVariant"][];
|
|
1278
1291
|
};
|
|
1279
|
-
Wheel: components["schemas"]["
|
|
1292
|
+
Wheel: components["schemas"]["WheelCore"] & {
|
|
1280
1293
|
fitments: components["schemas"]["FitmentRow"][];
|
|
1281
1294
|
mediaGroups: components["schemas"]["MediaGroups"];
|
|
1282
1295
|
relatedProducts: components["schemas"]["RelatedProduct"][];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CARD_HOVER_KEYS as o}from"efficient-web-builder/format/lib/animation/hover";const
|
|
1
|
+
import{CARD_HOVER_KEYS as o,HOVER_GROUP_KEY as r}from"efficient-web-builder/format/lib/animation/hover";const i={kind:"tyre",tyres:[]},s={kind:"alloy-wheel",wheels:[]},l=[{key:"tyres-that-fit",label:"Tyres that fit this product",from:["alloy-wheel"],to:"tyre",heading:"Compatible *tyres.*",resolve:e=>e.kind==="alloy-wheel"?{kind:"tyre",tyres:e.source.compatibleTyres??[]}:i},{key:"wheels-that-fit",label:"Wheels this product fits",from:["tyre"],to:"alloy-wheel",heading:"Wheels that *fit.*",resolve:(e,t)=>e.kind==="tyre"?{kind:"alloy-wheel",wheels:t}:s},{key:"more-like-this",label:"More like this",from:["alloy-wheel"],to:"alloy-wheel",heading:"Others you might *like.*",resolve:(e,t)=>({kind:"alloy-wheel",wheels:t})}],a="more-like-this",y=l.map(e=>({value:e.key,label:e.label}));function n(e){return l.find(t=>t.key===e)}function c(e){return l.filter(t=>t.from.includes(e))}function d(e,t){return e.from.includes(t)}const p=["coverIndex","imageBackground",r,...Object.values(o),"showBadge"];function f(e){return n(e)?.to==="tyre"}export{p as CARD_ROWS_NOT_ON_A_TYRE,a as DEFAULT_RELATIONSHIP,l as RELATIONSHIPS,y as RELATIONSHIP_OPTIONS,f as answersWithTyres,d as relationshipApplies,n as relationshipByKey,c as relationshipsFor};
|
|
@@ -4,7 +4,9 @@ export declare const PAY_FIRST_FLOW = 2;
|
|
|
4
4
|
export declare function paysFirst(method: string | null): boolean;
|
|
5
5
|
export declare const CHECKOUT_UNAVAILABLE = "checkout_unavailable";
|
|
6
6
|
export declare const CHECKOUT_WAITING = "checkout_waiting";
|
|
7
|
+
export declare const CHECKOUT_COMMITTED = "committed";
|
|
7
8
|
export declare const NOT_CHECKED = "We could not check your payment. Please try again.";
|
|
9
|
+
export declare const LOST_CHANGE = "Your last change was not saved. This is your order as placed.";
|
|
8
10
|
export declare const BANK_WAITING = "Your bank is still waiting for you to approve this payment, so your order stays as it was. Finish the approval, or try again in a few minutes.";
|
|
9
11
|
export declare const INTENT_READ_MS = 10000;
|
|
10
12
|
export declare function readIntentStatus(intent: {
|
|
@@ -15,6 +17,23 @@ export declare const DROPPABLE_INTENT: Set<string>;
|
|
|
15
17
|
export declare function releaseHeldCheckout(idempotencyKey: string, ms?: number): Promise<CheckoutRelease["status"] | undefined>;
|
|
16
18
|
export declare function checkoutGone(err: unknown): boolean;
|
|
17
19
|
export declare function checkoutWaiting(err: unknown): boolean;
|
|
20
|
+
export declare function refusedForGood(err: unknown): boolean;
|
|
21
|
+
export declare function goodsShapeOf(goods: {
|
|
22
|
+
email: string;
|
|
23
|
+
firstName: string;
|
|
24
|
+
lastName: string;
|
|
25
|
+
phone: string;
|
|
26
|
+
address: string;
|
|
27
|
+
city: string;
|
|
28
|
+
subdivision: string;
|
|
29
|
+
postcode: string;
|
|
30
|
+
country: string;
|
|
31
|
+
lines: [string, number][];
|
|
32
|
+
shippingMethodId: unknown;
|
|
33
|
+
couponCode: unknown;
|
|
34
|
+
currency: string;
|
|
35
|
+
shopperId: unknown;
|
|
36
|
+
}): string;
|
|
18
37
|
export declare function orderReference(conf: Pick<OrderConfirmation, "orderNumber" | "checkoutNumber">): string;
|
|
19
38
|
export type PayFirstResult = {
|
|
20
39
|
kind: "pending" | "processing" | "refunded" | "expired";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{loadStripe as
|
|
1
|
+
import{loadStripe as s}from"@stripe/stripe-js";import{ApiError as o,products as p}from"../api/index.js";const h=2;function x(e){return e==="card"}const d="checkout_unavailable",l="checkout_waiting",N="committed",T="We could not check your payment. Please try again.",k="Your last change was not saved. This is your order as placed.",_="Your bank is still waiting for you to approve this payment, so your order stays as it was. Finish the approval, or try again in a few minutes.",u=1e4;async function C(e,n=u){let t;const r=new Promise(a=>{t=setTimeout(()=>a(void 0),n)}),i=(async()=>{try{return(await(await s(e.publishableKey))?.retrievePaymentIntent(e.clientSecret))?.paymentIntent?.status}catch{return}})();try{return await Promise.race([i,r])}finally{clearTimeout(t)}}const I=new Set(["none","requires_payment_method","canceled"]);async function w(e,n=u){let t;const r=new Promise(i=>{t=setTimeout(()=>i(void 0),n)});try{return await Promise.race([p.releaseCheckout({idempotencyKey:e}).then(i=>i.status,()=>{}),r])}finally{clearTimeout(t)}}function c(e,n){return e instanceof o&&typeof e.data=="object"&&e.data!==null&&e.data.code===n}function E(e){return c(e,d)}function b(e){return c(e,l)}function A(e){return e instanceof o&&e.status>=400&&e.status<500&&e.status!==408}function O(e){return JSON.stringify([e.email,e.firstName,e.lastName,e.phone,e.address,e.city,e.subdivision,e.postcode,e.country,e.lines,e.shippingMethodId,e.couponCode,e.currency,e.shopperId])}function P(e){return e.orderNumber||e.checkoutNumber}function m(e){return e.orderNumber?{kind:"placed",order:e}:{kind:e.status==="released"?"refunded":e.status==="expired"?"expired":"pending",checkoutNumber:e.checkoutNumber}}async function S({checkoutNumber:e,resend:n,page:t}){t.setConfirming(!0);let r;try{r=m(await n())}catch{r={kind:"pending",checkoutNumber:e}}r.kind==="placed"?(t.markPaid(),t.track(r.order),t.land(r.order)):t.unplaced({...r,checkoutNumber:r.checkoutNumber||e}),t.setConfirming(!1)}export{_ as BANK_WAITING,N as CHECKOUT_COMMITTED,d as CHECKOUT_UNAVAILABLE,l as CHECKOUT_WAITING,I as DROPPABLE_INTENT,u as INTENT_READ_MS,k as LOST_CHANGE,T as NOT_CHECKED,h as PAY_FIRST_FLOW,E as checkoutGone,b as checkoutWaiting,O as goodsShapeOf,P as orderReference,m as payFirstOutcome,x as paysFirst,C as readIntentStatus,A as refusedForGood,w as releaseHeldCheckout,S as settlePayFirst};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{PART_MOTION_PROP as s}from"efficient-web-builder/render/lib/animation/part-motion";import{PART_STYLES_PROP as m,readPartStyles as u}from"efficient-web-builder/render/lib/document/part-styles";import{seedNodes as p}from"efficient-web-builder/format/lib/document/seed-parts";const R="ProductPrice",d="@price";function _(e){const{[d]:o,...t}=e&&typeof e=="object"?e:{};return{price:o,others:t}}function T(e){if(e.template!==void 0)return e;const o=typeof e.id=="string"&&e.id.trim()?e.id:"ProductHero",[t]=p([{type:R}],()=>`${o}~price`),r={...e},c={};for(const[n,f]of[[m,u(e)],[s,e[s]]]){const{price:i,others:P}=_(f);i&&(c[n]={[d]:i},Object.keys(P).length>0?r[n]=P:delete r[n])}return r.template=[{...t,props:{...t.props,...c}}],r}export{R as HERO_PRICE_BLOCK,T as withHeroPriceTemplate};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type SeededNode } from "efficient-web-builder/format/lib/document/seed-parts";
|
|
2
|
+
type Props = Record<string, unknown>;
|
|
3
|
+
export declare const MENU_LINK_BLOCK = "MenuLinkBlock";
|
|
4
|
+
export declare function menuCardSeed(nodeId: string): SeededNode[];
|
|
5
|
+
export declare function withMenuTemplate(props: Props): Props;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{seedNodes as n}from"efficient-web-builder/format/lib/document/seed-parts";const i="MenuLinkBlock";function u(e){return n([{type:i}],()=>`${e}~link`)}function r(e){if(e.template!==void 0)return e;const t=typeof e.id=="string"&&e.id.trim()?e.id:"Menu";return{...e,template:u(t)}}export{i as MENU_LINK_BLOCK,u as menuCardSeed,r as withMenuTemplate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_HERO_PRICE_PLACEMENT as e}from"../../../../sections/hero-price-placement.js";import{DEFAULT_HERO_LAYOUT as
|
|
1
|
+
import{DEFAULT_HERO_PRICE_PLACEMENT as e}from"../../../../sections/hero-price-placement.js";import{DEFAULT_HERO_LAYOUT as r,DEFAULT_HERO_RATIO as l,DEFAULT_HERO_TEXT_ALIGN as E}from"../../../../sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as _,DEFAULT_HERO_IMAGE_FIT as T}from"../../../../sections/hero-gallery.js";import{cardTemplateSlot as L}from"efficient-web-builder/format/lib/content/card-template";import{HERO_PRICE_BLOCK as m}from"../../../../content/hero-price-seed.js";import{TRUST_BULLETS_ALLOW as a,TRUST_BULLETS_SLOT as o}from"../../../../sections/hero-trust-bullets.js";const t=L(),i={template:{...t,allow:[...t.allow,m]},[o]:{type:"slot",allow:a}},u={label:"Product Hero",fields:i,defaultProps:{source:null,pricePlacement:e,showVehicleFitment:!0,heroLayout:r,imageRatio:l,textAlign:E,showSpecTable:!0,showPriceQuote:!0,galleryMode:_,imageFit:T,[o]:[]}};export{u as ProductHeroMeta,i as ProductHeroSlots};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r}from"react/jsx-runtime";import{SITE_WIDTH_CAP as h}from"efficient-web-builder/format/lib/content/page-width";import{resolveWidth as
|
|
1
|
+
import{jsx as r}from"react/jsx-runtime";import{SITE_WIDTH_CAP as h}from"efficient-web-builder/format/lib/content/page-width";import{resolveWidth as H}from"efficient-web-builder/format/lib/content/section-width";import L from"../../../../../components/LinkedProductHero.js";import m from"../../../../../components/pdp-dynamic/DynamicProductHero.js";import P from"../../../../../components/SectionNotice.js";import{trustBulletsRow as g,trustBulletsSlot as A}from"../../../../../components/product-hero/trust-bullets.js";import{TRUST_BULLETS_SLOT as R}from"../../../../sections/hero-trust-bullets.js";import{useCurrentProduct as F}from"../../../current-product.js";import{isEditorOnDynamicPage as y}from"efficient-web-builder/format/lib/document/editor-page-context";import{DEFAULT_HERO_PRICE_PLACEMENT as O,parseHeroPricePlacement as w}from"../../../../sections/hero-price-placement.js";import{DEFAULT_HERO_LAYOUT as D,DEFAULT_HERO_RATIO as I,DEFAULT_HERO_TEXT_ALIGN as U,parseHeroLayout as S,parseHeroRatio as M,parseHeroTextAlign as p}from"../../../../sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as x,DEFAULT_HERO_IMAGE_FIT as B,parseHeroGalleryMode as C,parseHeroImageFit as k}from"../../../../sections/hero-gallery.js";import{say as G}from"efficient-web-builder/format/lib/editor-words";import{ProductHeroMeta as N}from"./meta.js";function V({source:e,editing:t=!1,pricePlacement:i=O,showVehicleFitment:o=!0,heroLayout:l=D,imageRatio:u=I,textAlign:a=U,showSpecTable:c=!0,showPriceQuote:d=!0,galleryMode:f=x,imageFit:s=B,trustBullets:E,nodeId:T,priceTemplate:_}){const n={heroLayout:l,imageRatio:u,textAlign:a,showSpecTable:c,showPriceQuote:d,galleryMode:f,imageFit:s,trustBullets:g(E,t),nodeId:T,priceTemplate:_};return F()||t&&y()?r(m,{editing:t,pricePlacement:i,showVehicleFitment:o,...n}):e?.slug?r(L,{slug:e.slug,kind:e.kind??"wheel",editing:t,pricePlacement:i,showVehicleFitment:o,...n}):t?r(P,{size:"tall",children:G("Pick a product in the panel to fill this hero.")}):r(m,{pricePlacement:i,showVehicleFitment:o,...n})}function b(e,t){return H(e,"full").mode!=="page"?t:r("div",{style:{"--sf-content-cap":h},children:t})}const oe={...N,render:e=>b(e,r(V,{source:e.source,editing:e.editor?.isEditing,pricePlacement:w(e.pricePlacement),showVehicleFitment:e.showVehicleFitment??!0,heroLayout:S(e.heroLayout),imageRatio:M(e.imageRatio),textAlign:p(e.textAlign),showSpecTable:e.showSpecTable??!0,showPriceQuote:e.showPriceQuote??!0,galleryMode:C(e.galleryMode),imageFit:k(e.imageFit),trustBullets:A(e[R]),nodeId:typeof e.id=="string"?e.id:void 0,priceTemplate:typeof e.template=="function"?e.template:void 0}))};export{oe as ProductHeroRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import o from"../../../../../components/card-pieces/CardPrice.js";import d from"../../../../../components/card-pieces/HostPart.js";import{readPartStyles as n}from"efficient-web-builder/render/lib/document/part-styles";import{ProductPriceMeta as i}from"./meta.js";const s={...i,render:r=>{const e=!!r.editor?.isEditing;return t(d,{label:i.label??"",editing:e,onHero:!0,children:t(o,{region:{nodeId:typeof r.id=="string"?r.id:void 0,partStyles:n(r),editing:e}})})}};export{s as ProductPriceRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={label:"Menu",defaultProps:{accordionMobile:!1,showDividers:!1}};export{
|
|
1
|
+
import{cardTemplateSlot as e}from"efficient-web-builder/format/lib/content/card-template";import{MENU_LINK_BLOCK as t}from"../../../../content/menu-card-seed.js";const o=e(),l={template:{...o,allow:[...o.allow,t]}},s={label:"Menu",fields:l,defaultProps:{accordionMobile:!1,showDividers:!1}};export{s as FooterMenuMeta,l as FooterMenuSlots};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import s from"../../../../../components/FooterMenu.js";import{FooterMenuMeta as p}from"./meta.js";const f={...p,render:({id:e,menu:o,heading:r,accordionMobile:i,showDividers:n,template:t,editor:d})=>m(s,{owner:{id:String(e??""),type:"FooterMenu",template:t},menu:o,heading:r||void 0,accordionMobile:i,showDividers:n,editing:d?.isEditing})};export{f as FooterMenuRender};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e={label:"Menu link",defaultProps:{}};export{e as MenuLinkBlockMeta};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import r from"../../../../../components/MenuLinkBlock.js";import{MenuLinkBlockMeta as e}from"./meta.js";const m={...e,render:()=>o(r,{})};export{m as MenuLinkBlockRender};
|
|
@@ -15,6 +15,7 @@ export declare const SERVICE_METAS: {
|
|
|
15
15
|
FooterText: Omit<BlockRender, "render">;
|
|
16
16
|
Form: Omit<BlockRender, "render">;
|
|
17
17
|
LegalLineBlock: Omit<BlockRender, "render">;
|
|
18
|
+
MenuLinkBlock: Omit<BlockRender, "render">;
|
|
18
19
|
OpeningHours: Omit<BlockRender, "render">;
|
|
19
20
|
RateTable: Omit<BlockRender, "render">;
|
|
20
21
|
MessagingCards: Omit<BlockRender, "render">;
|