efficient-storefront-blocks 0.70.0 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/chunks/EditorPreviewCheckout-YQ3F5MSG.js +4 -0
  3. package/dist/chunks/{SiteEditorProvider-3GKJZDL5.js → SiteEditorProvider-Z33JB5BA.js} +1 -1
  4. package/dist/chunks/chunk-5OFEWRWI.js +1 -0
  5. package/dist/chunks/{chunk-TXTTPEQA.js → chunk-BZDVZUF4.js} +1 -1
  6. package/dist/chunks/{chunk-QWHNN7GF.js → chunk-QJDTP7K6.js} +1 -1
  7. package/dist/chunks/chunk-UGXNUQRA.js +246 -0
  8. package/dist/chunks/chunk-UJW4B64R.js +1 -0
  9. package/dist/chunks/{fitment-data-6GK7QQQI.js → fitment-data-DHKRLKNI.js} +1 -1
  10. package/dist/contract.js +2 -2
  11. package/dist/editor/components/CategorySource.js +1 -1
  12. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  13. package/dist/editor/components/PreviewHeader.d.ts +0 -1
  14. package/dist/editor/components/PreviewHeader.js +1 -11
  15. package/dist/editor/lib/document/blocks/service/ContactCards/fields.d.ts +2 -0
  16. package/dist/editor/lib/document/blocks/service/ContactCards/fields.js +1 -0
  17. package/dist/editor/lib/document/blocks/service/ContactRouting/fields.js +1 -1
  18. package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.d.ts +2 -0
  19. package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.js +1 -0
  20. package/dist/editor/lib/document/blocks/service/FooterPayment/fields.d.ts +2 -0
  21. package/dist/editor/lib/document/blocks/service/FooterPayment/fields.js +1 -0
  22. package/dist/editor/lib/document/blocks/service/MessagingCards/fields.d.ts +2 -0
  23. package/dist/editor/lib/document/blocks/service/MessagingCards/fields.js +1 -0
  24. package/dist/editor/lib/document/blocks/service/Reviews/fields.js +1 -1
  25. package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
  26. package/dist/editor/lib/document/blocks/service/index.js +1 -1
  27. package/dist/editor/lib/document/config.d.ts +2 -0
  28. package/dist/editor/lib/document/config.js +1 -1
  29. package/dist/editor/lib/efficient-block-sources.js +1 -1
  30. package/dist/editor/lib/header-settings-source.d.ts +2 -1
  31. package/dist/editor/lib/header-settings-source.js +1 -1
  32. package/dist/editor/lib/storefront-editor-words.d.ts +17 -2
  33. package/dist/editor/lib/storefront-editor-words.js +1 -1
  34. package/dist/editor.css +1 -1
  35. package/dist/index.d.ts +0 -2
  36. package/dist/index.js +97 -200
  37. package/dist/links.d.ts +0 -2
  38. package/dist/links.js +1 -1
  39. package/dist/render/built-with.json +1 -1
  40. package/dist/render/components/ChatLauncher.js +1 -1
  41. package/dist/render/components/ContactCards.d.ts +13 -0
  42. package/dist/render/components/ContactCards.js +1 -0
  43. package/dist/render/components/CopyText.d.ts +4 -0
  44. package/dist/render/components/CopyText.js +1 -0
  45. package/dist/render/components/Events.d.ts +3 -0
  46. package/dist/render/components/Events.js +1 -1
  47. package/dist/render/components/FooterMessaging.d.ts +5 -0
  48. package/dist/render/components/FooterMessaging.js +1 -0
  49. package/dist/render/components/FooterPayment.d.ts +11 -0
  50. package/dist/render/components/FooterPayment.js +1 -0
  51. package/dist/render/components/GalleryItem.js +1 -1
  52. package/dist/render/components/GalleryShowcase.js +1 -1
  53. package/dist/render/components/Header.d.ts +2 -1
  54. package/dist/render/components/Header.js +1 -1
  55. package/dist/render/components/HeaderCallButton.d.ts +9 -0
  56. package/dist/render/components/HeaderCallButton.js +1 -0
  57. package/dist/render/components/MessagingCards.d.ts +9 -0
  58. package/dist/render/components/MessagingCards.js +1 -0
  59. package/dist/render/components/QrCode.d.ts +5 -0
  60. package/dist/render/components/QrCode.js +1 -0
  61. package/dist/render/components/Reviews.d.ts +14 -4
  62. package/dist/render/components/Reviews.js +1 -1
  63. package/dist/render/components/checkout/CheckoutPageClient.d.ts +2 -25
  64. package/dist/render/components/checkout/CheckoutPageClient.js +1 -3
  65. package/dist/render/components/checkout/checkout-parts.d.ts +5 -0
  66. package/dist/render/components/checkout/checkout-parts.js +1 -0
  67. package/dist/render/components/checkout/checkout-state.d.ts +169 -0
  68. package/dist/render/components/checkout/checkout-state.js +3 -0
  69. package/dist/render/lib/api/index.d.ts +1 -0
  70. package/dist/render/lib/api/types.d.ts +3 -0
  71. package/dist/render/lib/document/blocks/service/ContactCards/meta.d.ts +7 -0
  72. package/dist/render/lib/document/blocks/service/ContactCards/meta.js +1 -0
  73. package/dist/render/lib/document/blocks/service/ContactCards/render.d.ts +4 -0
  74. package/dist/render/lib/document/blocks/service/ContactCards/render.js +1 -0
  75. package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
  76. package/dist/render/lib/document/blocks/service/Footer/meta.js +1 -1
  77. package/dist/render/lib/document/blocks/service/FooterGroup/meta.js +1 -1
  78. package/dist/render/lib/document/blocks/service/FooterMessaging/meta.d.ts +2 -0
  79. package/dist/render/lib/document/blocks/service/FooterMessaging/meta.js +1 -0
  80. package/dist/render/lib/document/blocks/service/FooterMessaging/render.d.ts +2 -0
  81. package/dist/render/lib/document/blocks/service/FooterMessaging/render.js +1 -0
  82. package/dist/render/lib/document/blocks/service/FooterPayment/meta.d.ts +3 -0
  83. package/dist/render/lib/document/blocks/service/FooterPayment/meta.js +1 -0
  84. package/dist/render/lib/document/blocks/service/FooterPayment/render.d.ts +2 -0
  85. package/dist/render/lib/document/blocks/service/FooterPayment/render.js +1 -0
  86. package/dist/render/lib/document/blocks/service/MessagingCards/meta.d.ts +2 -0
  87. package/dist/render/lib/document/blocks/service/MessagingCards/meta.js +1 -0
  88. package/dist/render/lib/document/blocks/service/MessagingCards/render.d.ts +4 -0
  89. package/dist/render/lib/document/blocks/service/MessagingCards/render.js +1 -0
  90. package/dist/render/lib/document/blocks/service/Reviews/meta.d.ts +6 -0
  91. package/dist/render/lib/document/blocks/service/Reviews/meta.js +1 -1
  92. package/dist/render/lib/document/blocks/service/Reviews/render.js +1 -1
  93. package/dist/render/lib/document/blocks/service/metas.d.ts +4 -0
  94. package/dist/render/lib/document/blocks/service/metas.js +1 -1
  95. package/dist/render/lib/document/blocks/service/renders.d.ts +4 -0
  96. package/dist/render/lib/document/blocks/service/renders.js +1 -1
  97. package/dist/render/lib/document/blocks/text-part-shapes.json +137 -6
  98. package/dist/render/lib/document/card-templates.d.ts +2 -0
  99. package/dist/render/lib/document/card-templates.js +1 -0
  100. package/dist/render/lib/document/footer-page-blocks.d.ts +1 -0
  101. package/dist/render/lib/document/footer-page-blocks.js +1 -1
  102. package/dist/render/lib/document/lazy-draws.js +1 -1
  103. package/dist/render/lib/document/render-config.d.ts +2 -0
  104. package/dist/render/lib/document/render-config.js +1 -1
  105. package/dist/render/lib/document/section-to-box-rows-reviews.d.ts +1 -0
  106. package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -0
  107. package/dist/render/lib/links/link-rules.d.ts +1 -1
  108. package/dist/render/lib/links/link-rules.js +1 -1
  109. package/dist/render/lib/qr.d.ts +5 -0
  110. package/dist/render/lib/qr.js +1 -0
  111. package/dist/render/lib/sections/messaging.d.ts +45 -0
  112. package/dist/render/lib/sections/messaging.js +1 -0
  113. package/dist/render/lib/sections/reviews.d.ts +1 -0
  114. package/dist/render/lib/sections/reviews.js +1 -0
  115. package/dist/render/lib/wheels/catalog-default-layout.js +1 -1
  116. package/dist/render/lib/wheels/collections.js +1 -1
  117. package/dist/words.d.ts +40 -7
  118. package/dist/words.js +4 -4
  119. package/package.json +4 -4
  120. package/dist/chunks/EditorPreviewCheckout-XI4VULPL.js +0 -4
  121. package/dist/chunks/chunk-RPLNV3WM.js +0 -1
  122. package/dist/chunks/chunk-SQH6XBRG.js +0 -1
  123. package/dist/chunks/chunk-XF2ZAVNU.js +0 -262
  124. package/dist/render/components/useStorefrontReviews.d.ts +0 -2
  125. package/dist/render/components/useStorefrontReviews.js +0 -1
  126. /package/dist/chunks/{chunk-XF2ZAVNU.js.LEGAL.txt → chunk-UGXNUQRA.js.LEGAL.txt} +0 -0
@@ -1,25 +1,2 @@
1
- import { type SiteIdentity } from "../../lib/content/site.js";
2
- type PayKey = "card" | "paypal" | "afterpay" | "square" | "gocardless" | "zip" | "klarna" | "bank";
3
- interface PayOption {
4
- key: PayKey;
5
- title: React.ReactNode;
6
- body: React.ReactNode;
7
- price: React.ReactNode;
8
- tag?: string;
9
- }
10
- export declare function buildPayOptions(site: SiteIdentity, { canParkContext, }?: {
11
- canParkContext: boolean;
12
- }): PayOption[];
13
- export default function CheckoutPageClient({ site, logo, preview, }: {
14
- site: SiteIdentity;
15
- logo?: {
16
- url: string | null;
17
- reversed: string | null;
18
- inkIsDark: boolean | null;
19
- reverse: boolean;
20
- size: "small" | "medium" | "large";
21
- sizePx: number | null;
22
- } | null;
23
- preview?: boolean;
24
- }): import("react").JSX.Element;
25
- export {};
1
+ import { type CheckoutProps } from "./checkout-state.js";
2
+ export default function CheckoutPageClient(props: CheckoutProps): import("react").JSX.Element;
@@ -1,3 +1 @@
1
- "use client";import{jsx as e,Fragment as E,jsxs as r}from"react/jsx-runtime";import Kt from"next/image";import M from"next/link";import{useEffect as S,useMemo as pe,useRef as U,useState as s}from"react";import{Elements as Tt,PaymentElement as Ot,useElements as qt,useStripe as Bt}from"@stripe/react-stripe-js";import{loadStripe as Lt}from"@stripe/stripe-js";import{isOrderable as ot,lineTotal as $t,useCart as it}from"../CartContext.js";import{useCurrency as W}from"../CurrencyContext.js";import{FREE_PRICE as _e}from"../../lib/wheels/price-display.js";import{resolveCopyright as Yt}from"../../lib/content/site.js";import{getClickIds as zt}from"../../lib/click-ids.js";import{adConsentForOrder as Ft}from"../../lib/consent/choice.js";import{trackBeginCheckout as Mt,trackPurchase as Ut}from"../../lib/google-tag.js";import{trackMetaPurchase as Dt}from"../../lib/meta-pixel.js";import{ApiError as je,api as ne,products as A}from"../../lib/api/index.js";import{uuid as Ht}from"../../lib/uuid.js";import{orderLinesForSets as Gt}from"../../lib/commerce.js";import{canPersist as Wt,safeSessionStorage as B}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Zt,AFTERPAY_RETURN as Xt,GOCARDLESS_CONTEXT_KEY as Re,KLARNA_CONTEXT_KEY as Ke,ZIP_CONTEXT_KEY as Jt,ZIP_RETURN as Qt,runWalletReturn as ct}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as Vt}from"../../lib/checkout/match-subdivision.js";import en from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as tn,couponCodeForOrder as nn,couponRefusedByOrder as rn}from"../../lib/cart/coupon-preview.js";import{shippingWords as an,TAX_PENDING as on}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as cn}from"../../lib/wheels/finish-defaults.js";import sn from"efficient-web-builder/render/components/Logo";import st from"../ThemedSelect.js";import T from"../WebFormField.js";import ln from"../WheelSvg.js";function lt(n){const o=n.indexOf(`
2
- `);return o===-1?[n,""]:[n.slice(0,o),n.slice(o+1)]}function dt(n,{canParkContext:o}={canParkContext:!0}){const d=n.paymentMethods,i=[];return d.includes("card")&&i.push({key:"card",title:"Card",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("paypal")&&n.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),d.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),d.includes("square")&&n.squareApplicationId&&n.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("gocardless")&&o&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),d.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),d.includes("klarna")&&o&&i.push({key:"klarna",title:"Klarna",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),i.push({key:"bank",title:"Bank transfer",body:null,price:e("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}function dn({site:n,logo:o,preview:d=!1}){const{items:i,totals:a,coupon:l,refuseCoupon:m,deliveryOptions:x,shippingMethodId:h,setShippingMethodId:y,setQuoteDestination:N,identify:P,clearCapturedCart:w}=it(),u=x.find(t=>t.id===h)?.pickupLocation??null,{country:L,countries:b,activeCountry:_,formatMoney:$}=W(),[f,C]=s(()=>dt(n)[0].key),[F,Z]=s(!0);S(()=>{Z(Wt(B))},[]);const[X,qe]=s(!1),[J,Be]=s(""),[Q,Le]=s(""),[fe,$e]=s(""),[ge,he]=s(""),[xe,ye]=s(""),[be,ke]=s(""),[Ne,ve]=s(""),[we,Ce]=s(""),[v,Pe]=s(()=>L||b[0]?.code||""),[H,re]=s(""),[V,Ye]=s([]),[ze,Se]=s(null),[ae,oe]=s(null),gt=pe(()=>b.find(t=>t.code===v)??_,[b,v,_])?.postalLabel||"Postal Code",ht=V[0]?.divisionType||"State / Province";S(()=>{if(!v){Ye([]),Se(v);return}Se(null);let t=!1;return A.listCountrySubdivisions(v).then(c=>{t||(Ye(c),Se(v),re(""))}),()=>{t=!0}},[v]),S(()=>{N(v?{country:v,subdivision:H}:null)},[v,H,N]),S(()=>()=>N(null),[N]);const[Y,Fe]=s(null),[Me,Ue]=s([]),[ie,ce]=s("new"),[Ae,De]=s(!1),[He,xt]=s("Home"),[Ge,We]=s(null),[j]=s(()=>Ht()),[se,R]=s(null),[Ze,ee]=s(null),[Xe,yt]=s(null),[bt,kt]=s(!1),[Nt,vt]=s(!1),[O,Ee]=s(null),[Je,G]=s(!1),[Qe,z]=s(null),[wt,Ct]=s(!1),[Pt,Ve]=s(!1),[St,At]=s(!1),[Et,et]=s(!1),tt=U(!1);S(()=>{d||tt.current||!i.some(ot)||(tt.current=!0,Mt({lines:i,currency:a.currency,value:a.subtotal-a.discount,coupon:l?.valid?l.code:void 0}))},[i,a,l,d]),S(()=>{P(J,Q.trim()||void 0)},[J,Q,P]);const nt=U(null),[le,It]=s(null);S(()=>{const t=nt.current;if(!le||!t)return;const c=()=>t.style.setProperty("--sf-checkout-header-h",`${le.offsetHeight}px`);c();const p=new ResizeObserver(c);return p.observe(le),()=>p.disconnect()},[le]),S(()=>{const t=p=>({setConfirming:p,land:R,markPaid:()=>G(!0),note:z,fail:ee,clearCart:w}),c={search:window.location.search,storage:B,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};ct(Xt,{...c,capture:A.captureAfterpayPayment,page:t(Ct)}),ct(Qt,{...c,capture:A.captureZipPayment,page:t(At)})},[]),S(()=>{const c=new URLSearchParams(window.location.search).get("gocardless");if(c!=="confirm"&&c!=="cancel")return;const p=B.getItem(Re);if(B.removeItem(Re),window.history.replaceState(null,"",window.location.pathname),!p)return;let k;try{k=JSON.parse(p)}catch{return}if(w(),c==="cancel"){z("The direct debit was not set up — our team will follow up on payment."),R(k.confirmation);return}Ve(!0),A.completeGocardlessPayment({idempotencyKey:k.idempotencyKey}).then(g=>{g.status==="paid"?G(!0):g.status==="declined"?z("The direct debit was declined — our team will follow up on payment."):z("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{z("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{R(k.confirmation),Ve(!1)})},[]),S(()=>{const t=new URLSearchParams(window.location.search),c=t.get("klarna");if(c!=="confirm"&&c!=="cancel")return;const p=B.getItem(Ke);B.removeItem(Ke);const k=t.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!p)return;let g;try{g=JSON.parse(p)}catch{return}if(w(),c==="cancel"||!k){z("The Klarna payment was not completed — our team will follow up on payment."),R(g.confirmation);return}et(!0),A.captureKlarnaPayment({idempotencyKey:g.idempotencyKey,authorizationToken:k}).then(I=>{I.status==="paid"?G(!0):I.status==="declined"?z("Klarna declined the payment — our team will follow up on payment."):z("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{z("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{R(g.confirmation),et(!1)})},[]);function rt(t){const[c,p]=lt(t.address);he(c),ye(p),ke(t.city),ve(t.zip_code),t.country&&Pe(t.country),t.phone&&Ce(t.phone),oe({country:t.country||null,state:t.state??""})}S(()=>{if(ae){if((ae.country||v)!==v){oe(null);return}ze===v&&(re(Vt(v,ae.state,V)),oe(null))}},[ae,v,ze,V]),S(()=>{let t=!1;return(async()=>{try{const[c,p,k]=await Promise.all([ne.me(),ne.myProfile().catch(()=>null),ne.myAddresses().catch(()=>[])]);if(t)return;Fe(c);const g=k.filter(te=>te.is_active);Ue(g),Be(c.email);const I=(p?.contact_name??"").split(/\s+/);Le(c.first_name||I[0]||""),$e(c.last_name||I.slice(1).join(" "));const q=c.phone||p?.phone;q&&Ce(q);const Ie=g.find(te=>te.id===c.default_delivery_location)??g[0];if(Ie)ce(Ie.id),rt(Ie);else if(p){const[te,Rt]=lt(p.address??"");he(te),ye(Rt),ke(p.city??""),ve(p.zip_code??""),p.country&&Pe(p.country),oe({country:p.country||null,state:p.state??""})}}catch{}})(),()=>{t=!0}},[]);function _t(){ne.logout(),Fe(null),Ue([]),ce("new"),De(!1)}const de=pe(()=>dt(n,{canParkContext:F}),[n,F]);S(()=>{de.some(t=>t.key===f)||C(de[0].key)},[de,f]);const at=xe.trim()?`${ge}
3
- ${xe.trim()}`:ge;async function jt(){if(d||X||i.length===0||a.repricing)return;const t=i.filter(ot).flatMap(c=>Gt(c.components,c.qty));if(t.length===0){ee("Pick a size on each wheel's product page before checking out.");return}qe(!0),ee(null);try{const c=Y?A.createOrderAuthed:A.createOrder,p=Ft(),k=await c({customer:{email:J,name:`${Q} ${fe}`.trim(),phone:we.trim()||void 0,address:at,city:be,state:H||void 0,zipCode:Ne,country:v},items:t,currency:a.currency,idempotencyKey:j,shippingMethodId:h??void 0,couponCode:nn(l),...p==="denied"?{}:zt(),...p?{adConsent:p}:{}});if(Ut({confirmation:k,lines:i,adsSendTo:n.googleAdsId&&n.googleAdsConversionLabel?`${n.googleAdsId}/${n.googleAdsConversionLabel}`:null}),Dt({confirmation:k,lines:i}),w(),Y&&Ae&&ie==="new")try{await ne.createAddress({label:He.trim()||"Home",contact_name:`${Q} ${fe}`.trim(),phone:we.trim(),address:at,city:be,zip_code:Ne,state:H,country:v}),We("Address saved to your account.")}catch{We("We couldn't save the address to your account — you can add it under Account → Addresses.")}if(f==="card"&&n.paymentMethods.includes("card")){const g=await A.createPaymentIntent({idempotencyKey:j});Ee(k),yt(g)}else if(f==="paypal"&&n.paymentMethods.includes("paypal"))Ee(k),kt(!0);else if(f==="afterpay"&&n.paymentMethods.includes("afterpay")){const g=window.location.origin,I=await A.createAfterpayCheckout({idempotencyKey:j,confirmUrl:`${g}/checkout?afterpay=confirm`,cancelUrl:`${g}/checkout?afterpay=cancel`}),q={idempotencyKey:j,confirmation:k};B.setItem(Zt,JSON.stringify(q)),window.location.assign(I.redirectCheckoutUrl);return}else if(f==="square"&&n.paymentMethods.includes("square"))Ee(k),vt(!0);else if(f==="gocardless"&&n.paymentMethods.includes("gocardless")){const g=window.location.origin,I=await A.createGocardlessBillingRequest({idempotencyKey:j,confirmUrl:`${g}/checkout?gocardless=confirm`,cancelUrl:`${g}/checkout?gocardless=cancel`}),q={idempotencyKey:j,confirmation:k};B.setItem(Re,JSON.stringify(q)),window.location.assign(I.authorisationUrl);return}else if(f==="zip"&&n.paymentMethods.includes("zip")){const g=window.location.origin,I=await A.createZipCheckout({idempotencyKey:j,redirectUrl:`${g}/checkout?zip=return`}),q={idempotencyKey:j,confirmation:k};B.setItem(Jt,JSON.stringify(q)),window.location.assign(I.redirectUrl);return}else if(f==="klarna"&&n.paymentMethods.includes("klarna")){const g=window.location.origin,I=await A.createKlarnaCheckout({idempotencyKey:j,confirmUrl:`${g}/checkout?klarna=confirm`,cancelUrl:`${g}/checkout?klarna=cancel`}),q={idempotencyKey:j,confirmation:k};B.setItem(Ke,JSON.stringify(q)),window.location.assign(I.redirectUrl);return}else R(k)}catch(c){const p=rn(c);p?(m(p),ee(`${p} Your order has not been placed. Place it again to continue without the code.`)):ee(c instanceof je?c.message:"Could not place the order. Please try again."),qe(!1)}}return se?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:Je?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[Je?r(E,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:se.orderNumber})," has gone through."," "]}):r(E,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:se.orderNumber})," is being reviewed by our team."," "]}),Y?r(E,{children:["Track it under"," ",e(M,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(E,{children:"We’ve emailed you a link to set a password and track it."})]}),Qe&&e("p",{className:"text-sm text-fg-dim",children:Qe}),Ge&&e("p",{className:"text-sm text-fg-dim",children:Ge}),!Y&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(M,{href:`/track?order=${encodeURIComponent(se.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(M,{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"})]}):wt?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."})]}):Pt?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."})]}):St?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."})]}):Et?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."})]}):Xe?e(pn,{payment:Xe,onPaid:()=>{G(!0),R(O)},onSkip:()=>R(O)}):bt&&O?e(fn,{confirmation:O,clientId:n.paypalClientId??"",idemKey:j,onPaid:()=>{G(!0),R(O)},onSkip:()=>R(O)}):Nt&&O?e(hn,{confirmation:O,applicationId:n.squareApplicationId??"",locationId:n.squareLocationId??"",environment:n.squareEnvironment??"production",idemKey:j,onPaid:()=>{G(!0),R(O)},onSkip:()=>R(O)}):r("div",{ref:nt,className:"bg-bg text-fg",children:[r("header",{ref:It,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(M,{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(M,{href:"/","aria-label":`${n.name} home`,className:"inline-flex items-center justify-center",children:e(sn,{variant:"header",scrolled:!0,src:o?.url??null,reverse:o?.reverse??!1,reversedSrc:o?.reversed??null,inkIsDark:o?.inkIsDark??null,size:o?.size??"medium",sizePx:o?.sizePx??null,siteName:n.name})}),n.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-[1100px]: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(t=>r("span",{className:["relative flex items-center gap-2 transition-colors",t.state==="pending"?"text-fg-dim":"text-fg",t.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:t.state==="done"?"text-accent font-bold":"",children:t.n}),e("span",{children:t.label})]},t.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-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[r("div",{children:[r(ue,{num:"N° 01",title:"Contact",children:[e(T,{label:"Email",hint:Y?r(E,{children:["Signed in ·"," ",e("button",{type:"button",onClick:_t,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{type:"email",value:J,onChange:t=>Be(t.target.value),placeholder:"you@example.com",readOnly:Y!==null,className:K+(Y?" opacity-70":"")})}),r(ut,{children:[e(T,{label:"First name",children:e("input",{type:"text",value:Q,onChange:t=>Le(t.target.value),className:K})}),e(T,{label:"Last name",children:e("input",{type:"text",value:fe,onChange:t=>$e(t.target.value),className:K})})]})]}),r(ue,{num:"N° 02",title:u?"Collection":"Shipping address",children:[u?r("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:u.name}),[u.address,u.city,u.state,u.zipCode,u.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[u.address,u.city,u.state,u.zipCode,u.country].filter(Boolean).join(", ")}),u.openingHours&&e("span",{className:"opacity-80",children:u.openingHours}),u.instructions&&e("span",{className:"opacity-80",children:u.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):r(E,{children:[Y!==null&&Me.length>0&&r("div",{className:"grid gap-3",children:[Me.map(t=>e(me,{active:ie===t.id,onClick:()=>{ce(t.id),rt(t)},title:t.label,body:t.formatted_address,price:null},t.id)),e(me,{active:ie==="new",onClick:()=>ce("new"),title:"New address",body:null,price:null})]}),e(T,{label:"Address line 1",children:e("input",{type:"text",value:ge,onChange:t=>he(t.target.value),className:K})}),e(T,{label:"Address line 2",children:e("input",{type:"text",value:xe,onChange:t=>ye(t.target.value),placeholder:"Apartment, unit, garage bay…",className:K})}),r(ut,{cols:"three",children:[e(T,{label:"City",children:e("input",{type:"text",value:be,onChange:t=>ke(t.target.value),className:K})}),e(T,{label:gt,children:e("input",{type:"text",value:Ne,onChange:t=>ve(t.target.value),className:K})}),e(T,{label:"Country",separate:!0,children:e(st,{value:v,onChange:t=>Pe(t.target.value),className:K+" pr-10",style:pt,children:b.map(t=>e("option",{value:t.code,children:t.name},t.code))})})]}),e(T,{label:ht,separate:!0,children:V.length>0?r(st,{value:H,onChange:t=>re(t.target.value),className:K+" pr-10",style:pt,children:[e("option",{value:"",children:"Select…"}),V.map(t=>e("option",{value:t.code||t.name,children:t.name},t.code||t.name))]}):e("input",{type:"text",value:H,onChange:t=>re(t.target.value),className:K})})]}),e(T,{label:"Phone",children:e("input",{type:"tel",value:we,onChange:t=>Ce(t.target.value),placeholder:"+44 7700 900000",className:K})}),!u&&Y!==null&&ie==="new"&&r(E,{children:[e(xn,{checked:Ae,onChange:De,label:"Save this address to my account"}),Ae&&e(T,{label:"Address label",children:e("input",{type:"text",value:He,onChange:t=>xt(t.target.value),placeholder:"Home",className:K})})]})]}),e(ue,{num:"N° 03",title:"Shipping",children:r("div",{className:"grid gap-3",children:[x.map(t=>{const c=t.pickupLocation,p=c?[c.address,c.city,c.state,c.zipCode].filter(Boolean).join(", "):null;return e(me,{active:h===t.id,onClick:()=>y(t.id),title:c?`${t.name} — ${c.name}`:t.name,body:c?[p,c.openingHours,c.instructions,t.description].filter(Boolean).join(" · "):t.description||null,price:a.freeShipping||t.amount===0?_e:$(t.amount,a.currency),tag:t.tag||void 0},t.id)}),x.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})}),r(ue,{num:"N° 04",title:"Payment",children:[e("div",{className:"grid gap-3",children:de.map(t=>e(me,{active:f===t.key,onClick:()=>C(t.key),title:t.title,body:t.body,price:t.price,tag:t.tag},t.key))}),f==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):f==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):f==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):f==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):f==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):f==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):f==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."})]})]}),r("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[r("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(M,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?r("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(M,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(t=>e(yn,{slug:t.slug,name:t.name,qty:t.qty,config:t.config,configSummary:bn(t.config),price:$t(t,a.currency)??0,currency:a.currency},t.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(en,{customerEmail:J})}),r("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(D,{label:"Subtotal",value:$(a.subtotal,a.currency)}),a.discount>0&&l?.valid&&e(D,{label:`Coupon · ${l.code}`,value:r("span",{className:"font-semibold text-green",children:["− ",$(a.discount,a.currency)]})}),l?.deferred&&e(D,{label:`Coupon · ${l.code}`,value:tn}),l?.valid&&l.effects?.gift&&e(D,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:_e})}),e(D,{label:"Shipping",value:a.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:_e}):an(a.shippingStatus)??$(a.shipping,a.currency)}),a.tax&&(a.tax.charged?e(D,{label:a.tax.inclusive?`${a.tax.name} included · ${a.tax.rate}%`:a.tax.name,value:$(a.tax.amount,a.currency)}):a.tax.name?e(D,{label:a.tax.name,value:on}):null)]}),r("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:a.repricing?"…":$(a.grand,a.currency)})]}),r("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[Ze&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:Ze}),a.hasUnpricedLine&&r("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",a.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:jt,disabled:X||i.length===0||a.hasUnpricedLine||a.repricing,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",i.length===0||X||a.hasUnpricedLine||a.repricing?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:X?r(E,{children:["Building order… ",e("span",{children:"·"})]}):a.repricing?r(E,{children:["Updating total… ",e("span",{children:"·"})]}):r(E,{children:[f==="bank"?"Place order":"Continue to payment"," ·"," ",$(a.grand,a.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})]}),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:Yt({legalName:n.legalName,foundedYear:n.foundedYear,siteName:n.name})})})]})}const K="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",pt={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function ue({num:n,title:o,children:d}){return r("section",{className:"mb-6 border border-line bg-bg",children:[r("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:n}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:o})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:d})]})}function ut({cols:n="two",children:o}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",n==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:o})}function me({active:n,onClick:o,title:d,body:i,price:a,tag:l}){return r("button",{type:"button",onClick:o,"aria-pressed":n,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:n?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[n&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",n?"border-accent":"border-fg-dim"].join(" "),children:n&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),r("span",{className:"flex min-w-0 flex-col gap-1",children:[r("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[d,l&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:l})]}),i&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:i})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:a})]})}function pn({payment:n,onPaid:o,onSkip:d}){const{formatMoney:i}=W(),a=pe(()=>Lt(n.publishableKey),[n.publishableKey]),l=pe(()=>{if(typeof document>"u")return;const m=getComputedStyle(document.documentElement),x=(y,N)=>m.getPropertyValue(y).trim()||N,h=document.documentElement.getAttribute("data-theme")!=="light";return{theme:h?"night":"stripe",variables:{colorPrimary:x("--accent",h?"#c9a461":"#8a6a2a"),colorBackground:x("--site-surface",h?"#131313":"#ffffff"),colorText:x("--fg",h?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);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:n.orderNumber}),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:[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:i(Number(n.amount),n.currency)})," ","by card to confirm it now."]}),e(Tt,{stripe:a,options:{clientSecret:n.clientSecret,appearance:l},children:e(un,{payment:n,onPaid:o,onSkip:d})})]})]})})}function un({payment:n,onPaid:o,onSkip:d}){const{formatMoney:i}=W(),a=Bt(),l=qt(),[m,x]=s(!1),[h,y]=s(null);async function N(){if(!a||!l||m)return;x(!0),y(null);const P=await a.confirmPayment({elements:l,redirect:"if_required"});if(P.error){y(P.error.message??"Payment failed. Please try again."),x(!1);return}const w=P.paymentIntent?.status;if(w==="succeeded"||w==="processing"){o();return}y("Payment did not complete. Please try again."),x(!1)}return r("div",{className:"flex flex-col gap-4",children:[e(Ot,{}),h&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:h}),e("button",{type:"button",onClick:N,disabled:!a||!l||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",!a||!l||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(E,{children:["Processing… ",e("span",{children:"·"})]}):r(E,{children:["Pay ",i(Number(n.amount),n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:d,disabled:m,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 mt="paypal-sdk-js";let Te=null;function mn(n,o){const d=`${n}|${o}`;if(Te?.key===d)return Te.promise;const i=new Promise((a,l)=>{document.getElementById(mt)?.remove();const m=document.createElement("script");m.id=mt;const x=new URLSearchParams({"client-id":n,currency:o,intent:"capture"});m.src=`https://www.paypal.com/sdk/js?${x}`,m.onload=()=>{const h=window.paypal;h?a(h):l(new Error("PayPal SDK loaded without its namespace"))},m.onerror=()=>l(new Error("PayPal SDK failed to load")),document.head.appendChild(m)});return Te={key:d,promise:i},i}function fn({confirmation:n,clientId:o,idemKey:d,onPaid:i,onSkip:a}){const{formatMoney:l}=W(),m=U(null),[x,h]=s(!1),[y,N]=s(null),P=U(i);return P.current=i,S(()=>{let w=!1,u=null;return mn(o,n.currency).then(L=>{if(!(w||!m.current))return u=L.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await A.createPaypalOrder({idempotencyKey:d})).paypalOrderId,onApprove:async b=>{try{if((await A.capturePaypalOrder({idempotencyKey:d,paypalOrderId:b.orderID})).status==="paid"){P.current();return}N("PayPal did not complete the payment. Please try again.")}catch(_){N(_ instanceof je?_.message:"PayPal payment failed. Please try again.")}},onError:()=>{N("PayPal could not process the payment. Please try again.")}}),u.render(m.current).then(()=>{w||h(!0)})}).catch(()=>{w||N("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{w=!0,u?.close?.()}},[o,n.currency,d]),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:n.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:l(Number(n.grandTotal),n.currency)})," ","with PayPal to confirm it now."]}),!x&&!y&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:m}),y&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:y}),e("button",{type:"button",onClick:a,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 ft="square-web-sdk";let Oe=null;function gn(n){const o=n==="sandbox"?"sandbox":"production";if(Oe?.key===o)return Oe.promise;const d=new Promise((i,a)=>{document.getElementById(ft)?.remove();const l=document.createElement("script");l.id=ft,l.src=o==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",l.onload=()=>{const m=window.Square;m?i(m):a(new Error("Square SDK loaded without its namespace"))},l.onerror=()=>a(new Error("Square SDK failed to load")),document.head.appendChild(l)});return Oe={key:o,promise:d},d}function hn({confirmation:n,applicationId:o,locationId:d,environment:i,idemKey:a,onPaid:l,onSkip:m}){const{formatMoney:x}=W(),h=U(null),y=U(null),N=U(null),[P,w]=s(!1),[u,L]=s(!1),[b,_]=s(null);S(()=>{let f=!1,C=null;return gn(i).then(async F=>{if(f||!h.current)return;const Z=F.payments(o,d);N.current=Z,C=await Z.card(),await C.attach(h.current),y.current=C,f||w(!0)}).catch(()=>{f||_("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{f=!0,C?.destroy?.()}},[o,d,i]);async function $(){const f=y.current;if(!(!f||u)){L(!0),_(null);try{const C=await f.tokenize();if(C.status!=="OK"||!C.token){_(C.errors?.[0]?.message??"Please check the card details and try again."),L(!1);return}let F;try{F=(await N.current?.verifyBuyer?.(C.token,{amount:String(n.grandTotal),currencyCode:n.currency,intent:"CHARGE"}))?.token}catch{}if((await A.chargeSquare({idempotencyKey:a,sourceId:C.token,...F?{verificationToken:F}:{}})).status==="paid"){l();return}_("Square did not complete the payment. Please try again.")}catch(C){_(C instanceof je?C.message:"Square payment failed. Please try again.")}L(!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:n.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:x(Number(n.grandTotal),n.currency)})," ","by card to confirm it now."]}),!P&&!b&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:h}),b&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:b}),e("button",{type:"button",onClick:$,disabled:!P||u,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!P||u?"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:u?r(E,{children:["Processing… ",e("span",{children:"·"})]}):r(E,{children:["Pay ",x(Number(n.grandTotal),n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:m,disabled:u,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"})]})]})})}function xn({checked:n,onChange:o,label:d,sub:i}){return r("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>o(!n),"aria-pressed":n,"aria-label":d,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",n?"border-accent":"border-line"].join(" "),style:n?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:n&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),r("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[d,i&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:i})]})]})}function yn({slug:n,name:o,qty:d,config:i,configSummary:a,price:l,currency:m}){const{catalog:x}=it(),{formatMoney:h}=W(),y=x.find(b=>b.slug===n),N=y?.spokes??5,P=y?.mesh??!1,w=i.find(b=>b.gold)?.label,u=y?.finishes.find(b=>b.name===w&&b.src)??y?.finishes.find(b=>b.src),L=y?.finishes[0]?.color??cn;return r("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[r("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:d}),u?.src?e(Kt,{src:u.src,alt:`${o.lead}${o.accent} — ${u.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:L},children:e(ln,{spokes:N,mesh:P,className:"block w-full"})})]}),r("div",{className:"flex min-w-0 flex-col gap-0.5",children:[r("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[o.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:o.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:a})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:h(l,m)})]})}function D({label:n,value:o}){return r("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:n}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:o})]})}function bn(n){return n.map(o=>o.label).join(" · ")}export{dt as buildPayOptions,dn as default};
1
+ "use client";import{jsx as e,Fragment as N,jsxs as r}from"react/jsx-runtime";import S from"next/link";import{useEffect as D,useMemo as T,useRef as j,useState as v}from"react";import{Elements as O,PaymentElement as z,useElements as L,useStripe as M}from"@stripe/react-stripe-js";import{loadStripe as $}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{resolveCopyright as F}from"../../lib/content/site.js";import{ApiError as A,products as R}from"../../lib/api/index.js";import U from"efficient-web-builder/render/components/Logo";import{CheckoutStateProvider as G,useCheckout as H}from"./checkout-state.js";import{CheckoutContact as Q,CheckoutOrderSummary as V,CheckoutPayment as W,CheckoutShippingAddress as Z,CheckoutShippingMethod as J}from"./checkout-parts.js";function X(t){return e(G,{...t,children:e(ee,{})})}function ee(){const{site:t,logo:a,items:l,placing:m,email:p,me:o,addressSaveNote:n,idemKey:d,confirmation:s,setConfirmation:c,payment:f,paypalStep:x,squareStep:y,pendingConf:i,paid:k,setPaid:h,payNote:g,afterpayConfirming:q,gocardlessConfirming:b,zipConfirming:u,klarnaConfirming:P,checkoutRootRef:C,setCheckoutHeaderEl:_}=H();return s?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:k?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[k?r(N,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:s.orderNumber})," has gone through."," "]}):r(N,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:s.orderNumber})," is being reviewed by our team."," "]}),o?r(N,{children:["Track it under"," ",e(S,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(N,{children:"We’ve emailed you a link to set a password and track it."})]}),g&&e("p",{className:"text-sm text-fg-dim",children:g}),n&&e("p",{className:"text-sm text-fg-dim",children:n}),!o&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(S,{href:`/track?order=${encodeURIComponent(s.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?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."})]}):b?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."})]}):u?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."})]}):f?e(te,{payment:f,onPaid:()=>{h(!0),c(i)},onSkip:()=>c(i)}):x&&i?e(ae,{confirmation:i,clientId:t.paypalClientId??"",idemKey:d,onPaid:()=>{h(!0),c(i)},onSkip:()=>c(i)}):y&&i?e(se,{confirmation:i,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:d,onPaid:()=>{h(!0),c(i)},onSkip:()=>c(i)}):r("div",{ref:C,className:"bg-bg text-fg",children:[r("header",{ref:_,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(U,{variant:"header",scrolled:!0,src:a?.url??null,reverse:a?.reverse??!1,reversedSrc:a?.reversed??null,inkIsDark:a?.inkIsDark??null,size:a?.size??"medium",sizePx:a?.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-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(w=>r("span",{className:["relative flex items-center gap-2 transition-colors",w.state==="pending"?"text-fg-dim":"text-fg",w.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:w.state==="done"?"text-accent font-bold":"",children:w.n}),e("span",{children:w.label})]},w.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-[1100px]:grid-cols-1 max-[1100px]:gap-10 max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))] max-[1100px]:pt-8 max-[1100px]:pb-20",children:[r("div",{children:[e(Q,{}),e(Z,{}),e(J,{}),e(W,{})]}),e(V,{})]}),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:F({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function te({payment:t,onPaid:a,onSkip:l}){const{formatMoney:m}=E(),p=T(()=>$(t.publishableKey),[t.publishableKey]),o=T(()=>{if(typeof document>"u")return;const n=getComputedStyle(document.documentElement),d=(c,f)=>n.getPropertyValue(c).trim()||f,s=document.documentElement.getAttribute("data-theme")!=="light";return{theme:s?"night":"stripe",variables:{colorPrimary:d("--accent",s?"#c9a461":"#8a6a2a"),colorBackground:d("--site-surface",s?"#131313":"#ffffff"),colorText:d("--fg",s?"#f5f1e8":"#0a0a0a"),borderRadius:"0px"}}},[]);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:"Payment"})]}),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:m(Number(t.amount),t.currency)})," ","by card to confirm it now."]}),e(O,{stripe:p,options:{clientSecret:t.clientSecret,appearance:o},children:e(re,{payment:t,onPaid:a,onSkip:l})})]})]})})}function re({payment:t,onPaid:a,onSkip:l}){const{formatMoney:m}=E(),p=M(),o=L(),[n,d]=v(!1),[s,c]=v(null);async function f(){if(!p||!o||n)return;d(!0),c(null);const x=await p.confirmPayment({elements:o,redirect:"if_required"});if(x.error){c(x.error.message??"Payment failed. Please try again."),d(!1);return}const y=x.paymentIntent?.status;if(y==="succeeded"||y==="processing"){a();return}c("Payment did not complete. Please try again."),d(!1)}return r("div",{className:"flex flex-col gap-4",children:[e(z,{}),s&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:s}),e("button",{type:"button",onClick:f,disabled:!p||!o||n,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!p||!o||n?"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:n?r(N,{children:["Processing… ",e("span",{children:"·"})]}):r(N,{children:["Pay ",m(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:l,disabled:n,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 B="paypal-sdk-js";let I=null;function ne(t,a){const l=`${t}|${a}`;if(I?.key===l)return I.promise;const m=new Promise((p,o)=>{document.getElementById(B)?.remove();const n=document.createElement("script");n.id=B;const d=new URLSearchParams({"client-id":t,currency:a,intent:"capture"});n.src=`https://www.paypal.com/sdk/js?${d}`,n.onload=()=>{const s=window.paypal;s?p(s):o(new Error("PayPal SDK loaded without its namespace"))},n.onerror=()=>o(new Error("PayPal SDK failed to load")),document.head.appendChild(n)});return I={key:l,promise:m},m}function ae({confirmation:t,clientId:a,idemKey:l,onPaid:m,onSkip:p}){const{formatMoney:o}=E(),n=j(null),[d,s]=v(!1),[c,f]=v(null),x=j(m);return x.current=m,D(()=>{let y=!1,i=null;return ne(a,t.currency).then(k=>{if(!(y||!n.current))return i=k.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await R.createPaypalOrder({idempotencyKey:l})).paypalOrderId,onApprove:async h=>{try{if((await R.capturePaypalOrder({idempotencyKey:l,paypalOrderId:h.orderID})).status==="paid"){x.current();return}f("PayPal did not complete the payment. Please try again.")}catch(g){f(g instanceof A?g.message:"PayPal payment failed. Please try again.")}},onError:()=>{f("PayPal could not process the payment. Please try again.")}}),i.render(n.current).then(()=>{y||s(!0)})}).catch(()=>{y||f("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{y=!0,i?.close?.()}},[a,t.currency,l]),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:o(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!d&&!c&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:n}),c&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:c}),e("button",{type:"button",onClick:p,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 Y="square-web-sdk";let K=null;function oe(t){const a=t==="sandbox"?"sandbox":"production";if(K?.key===a)return K.promise;const l=new Promise((m,p)=>{document.getElementById(Y)?.remove();const o=document.createElement("script");o.id=Y,o.src=a==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",o.onload=()=>{const n=window.Square;n?m(n):p(new Error("Square SDK loaded without its namespace"))},o.onerror=()=>p(new Error("Square SDK failed to load")),document.head.appendChild(o)});return K={key:a,promise:l},l}function se({confirmation:t,applicationId:a,locationId:l,environment:m,idemKey:p,onPaid:o,onSkip:n}){const{formatMoney:d}=E(),s=j(null),c=j(null),f=j(null),[x,y]=v(!1),[i,k]=v(!1),[h,g]=v(null);D(()=>{let b=!1,u=null;return oe(m).then(async P=>{if(b||!s.current)return;const C=P.payments(a,l);f.current=C,u=await C.card(),await u.attach(s.current),c.current=u,b||y(!0)}).catch(()=>{b||g("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{b=!0,u?.destroy?.()}},[a,l,m]);async function q(){const b=c.current;if(!(!b||i)){k(!0),g(null);try{const u=await b.tokenize();if(u.status!=="OK"||!u.token){g(u.errors?.[0]?.message??"Please check the card details and try again."),k(!1);return}let P;try{P=(await f.current?.verifyBuyer?.(u.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await R.chargeSquare({idempotencyKey:p,sourceId:u.token,...P?{verificationToken:P}:{}})).status==="paid"){o();return}g("Square did not complete the payment. Please try again.")}catch(u){g(u instanceof A?u.message:"Square payment failed. Please try again.")}k(!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:d(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!x&&!h&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:s}),h&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:h}),e("button",{type:"button",onClick:q,disabled:!x||i,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!x||i?"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:i?r(N,{children:["Processing… ",e("span",{children:"·"})]}):r(N,{children:["Pay ",d(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:n,disabled:i,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{X as default};
@@ -0,0 +1,5 @@
1
+ export declare function CheckoutContact(): import("react").JSX.Element;
2
+ export declare function CheckoutShippingAddress(): import("react").JSX.Element;
3
+ export declare function CheckoutShippingMethod(): import("react").JSX.Element;
4
+ export declare function CheckoutPayment(): import("react").JSX.Element;
5
+ export declare function CheckoutOrderSummary(): import("react").JSX.Element;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,Fragment as y,jsxs as a}from"react/jsx-runtime";import M from"next/image";import P from"next/link";import{lineTotal as D,useCart as H}from"../CartContext.js";import{useCurrency as G}from"../CurrencyContext.js";import{FREE_PRICE as _}from"../../lib/wheels/price-display.js";import W from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as K}from"../../lib/cart/coupon-preview.js";import{shippingWords as X,TAX_PENDING as Z}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as J}from"../../lib/wheels/finish-defaults.js";import O from"../ThemedSelect.js";import f from"../WebFormField.js";import Q from"../WheelSvg.js";import{useCheckout as N}from"./checkout-state.js";function xe(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:c,setLastName:s,me:p,checkoutSignOut:x}=N();return a(C,{num:"N° 01",title:"Contact",children:[e(f,{label:"Email",hint:p?a(y,{children:["Signed in ·"," ",e("button",{type:"button",onClick:x,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{type:"email",value:t,onChange:m=>i(m.target.value),placeholder:"you@example.com",readOnly:p!==null,className:g+(p?" opacity-70":"")})}),a($,{children:[e(f,{label:"First name",children:e("input",{type:"text",value:n,onChange:m=>l(m.target.value),className:g})}),e(f,{label:"Last name",children:e("input",{type:"text",value:c,onChange:m=>s(m.target.value),className:g})})]})]})}function be(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:c,setAddress2:s,city:p,setCity:x,postcode:m,setPostcode:o,phone:d,setPhone:u,country:S,setCountry:v,subdivision:k,setSubdivision:h,subdivisions:A,destination:ne,postcodeLabel:R,subdivisionLabel:T,me:L,savedAddresses:F,selectedAddressId:j,setSelectedAddressId:B,saveAddress:E,setSaveAddress:Y,saveLabel:z,setSaveLabel:U,fillFromAddress:q}=N();return a(C,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(y,{children:[L!==null&&F.length>0&&a("div",{className:"grid gap-3",children:[F.map(r=>e(w,{active:j===r.id,onClick:()=>{B(r.id),q(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(w,{active:j==="new",onClick:()=>B("new"),title:"New address",body:null,price:null})]}),e(f,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:g})}),e(f,{label:"Address line 2",children:e("input",{type:"text",value:c,onChange:r=>s(r.target.value),placeholder:"Apartment, unit, garage bay…",className:g})}),a($,{cols:"three",children:[e(f,{label:"City",children:e("input",{type:"text",value:p,onChange:r=>x(r.target.value),className:g})}),e(f,{label:R,children:e("input",{type:"text",value:m,onChange:r=>o(r.target.value),className:g})}),e(f,{label:"Country",separate:!0,children:e(O,{value:S,onChange:r=>v(r.target.value),className:g+" pr-10",style:I,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(f,{label:T,separate:!0,children:A.length>0?a(O,{value:k,onChange:r=>h(r.target.value),className:g+" pr-10",style:I,children:[e("option",{value:"",children:"Select…"}),A.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{type:"text",value:k,onChange:r=>h(r.target.value),className:g})})]}),e(f,{label:"Phone",children:e("input",{type:"tel",value:d,onChange:r=>u(r.target.value),placeholder:"+44 7700 900000",className:g})}),!t&&L!==null&&j==="new"&&a(y,{children:[e(V,{checked:E,onChange:Y,label:"Save this address to my account"}),E&&e(f,{label:"Address label",children:e("input",{type:"text",value:z,onChange:r=>U(r.target.value),placeholder:"Home",className:g})})]})]})}function ye(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:c,pickupLocation:s,formatMoney:p,city:x,destination:m}=N();return e(C,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(o=>{const d=o.pickupLocation,u=d?[d.address,d.city,d.state,d.zipCode].filter(Boolean).join(", "):null;return e(w,{active:l===o.id,onClick:()=>c(o.id),title:d?`${o.name} — ${d.name}`:o.name,body:d?[u,d.openingHours,d.instructions,o.description].filter(Boolean).join(" · "):o.description||null,price:t.freeShipping||o.amount===0?_:p(o.amount,t.currency),tag:o.tag||void 0},o.id)}),n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function ve(){const{payChoice:t,setPayChoice:i,placing:n,payment:l,payOptions:c}=N();return a(C,{num:"N° 04",title:"Payment",children:[e("div",{className:"grid gap-3",children:c.map(s=>e(w,{active:t===s.key,onClick:()=>i(s.key),title:s.title,body:s.body,price:s.price,tag:s.tag},s.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."})]})}function Ne(){const{site:t,items:i,totals:n,coupon:l,formatMoney:c,payChoice:s,placing:p,email:x,orderError:m,payment:o,placeOrder:d}=N();return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-[1100px]:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(P,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(P,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(u=>e(ee,{slug:u.slug,name:u.name,qty:u.qty,config:u.config,configSummary:te(u.config),price:D(u,n.currency)??0,currency:n.currency},u.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(W,{customerEmail:x})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(b,{label:"Subtotal",value:c(n.subtotal,n.currency)}),n.discount>0&&l?.valid&&e(b,{label:`Coupon · ${l.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",c(n.discount,n.currency)]})}),l?.deferred&&e(b,{label:`Coupon · ${l.code}`,value:K}),l?.valid&&l.effects?.gift&&e(b,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:_})}),e(b,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:_}):X(n.shippingStatus)??c(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(b,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:c(n.tax.amount,n.currency)}):n.tax.name?e(b,{label:n.tax.name,value:Z}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?"…":c(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[m&&e("p",{className:"border border-red-300 bg-red-50 px-3 py-2 text-[13px] text-red-700",children:m}),n.hasUnpricedLine&&a("p",{className:"border border-amber-300 bg-amber-50 px-3 py-2 text-[13px] text-amber-800",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:d,disabled:p||i.length===0||n.hasUnpricedLine||n.repricing,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",i.length===0||p||n.hasUnpricedLine||n.repricing?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:p?a(y,{children:["Building order… ",e("span",{children:"·"})]}):n.repricing?a(y,{children:["Updating total… ",e("span",{children:"·"})]}):a(y,{children:[s==="bank"?"Place order":"Continue to payment"," ·"," ",c(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const g="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",I={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function C({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function $({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function w({active:t,onClick:i,title:n,body:l,price:c,tag:s}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,s&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:s})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:c})]})}function V({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function ee({slug:t,name:i,qty:n,config:l,configSummary:c,price:s,currency:p}){const{catalog:x}=H(),{formatMoney:m}=G(),o=x.find(h=>h.slug===t),d=o?.spokes??5,u=o?.mesh??!1,S=l.find(h=>h.gold)?.label,v=o?.finishes.find(h=>h.name===S&&h.src)??o?.finishes.find(h=>h.src),k=o?.finishes[0]?.color??J;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative flex aspect-square items-center justify-center overflow-hidden border border-line bg-surface",children:[e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n}),v?.src?e(M,{src:v.src,alt:`${i.lead}${i.accent} — ${v.name}`,width:120,height:120,sizes:"60px",className:"relative block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:k},children:e(Q,{spokes:d,mesh:u,className:"block w-full"})})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:c})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:m(s,p)})]})}function b({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function te(t){return t.map(i=>i.label).join(" · ")}export{xe as CheckoutContact,Ne as CheckoutOrderSummary,ve as CheckoutPayment,be as CheckoutShippingAddress,ye as CheckoutShippingMethod};
@@ -0,0 +1,169 @@
1
+ import { type SiteIdentity } from "../../lib/content/site.js";
2
+ import type { ShopAddress, ShopMe } from "../../lib/api/index.js";
3
+ import { type LandingOrder } from "../../lib/checkout/wallet-return.js";
4
+ type PayKey = "card" | "paypal" | "afterpay" | "square" | "gocardless" | "zip" | "klarna" | "bank";
5
+ interface PayOption {
6
+ key: PayKey;
7
+ title: React.ReactNode;
8
+ body: React.ReactNode;
9
+ price: React.ReactNode;
10
+ tag?: string;
11
+ }
12
+ export declare function buildPayOptions(site: SiteIdentity, { canParkContext, }?: {
13
+ canParkContext: boolean;
14
+ }): PayOption[];
15
+ export interface CheckoutProps {
16
+ site: SiteIdentity;
17
+ logo?: {
18
+ url: string | null;
19
+ reversed: string | null;
20
+ inkIsDark: boolean | null;
21
+ reverse: boolean;
22
+ size: "small" | "medium" | "large";
23
+ sizePx: number | null;
24
+ } | null;
25
+ preview?: boolean;
26
+ }
27
+ declare function useCheckoutState({ site, logo, preview }: CheckoutProps): {
28
+ site: SiteIdentity;
29
+ logo: {
30
+ url: string | null;
31
+ reversed: string | null;
32
+ inkIsDark: boolean | null;
33
+ reverse: boolean;
34
+ size: "small" | "medium" | "large";
35
+ sizePx: number | null;
36
+ } | null | undefined;
37
+ items: import("../CartContext.js").CartLine[];
38
+ totals: {
39
+ sets: number;
40
+ units: number;
41
+ subtotal: number;
42
+ hasUnpricedLine: boolean;
43
+ discount: number;
44
+ bundleDiscount: number;
45
+ appliedBundles: import("../../lib/api/index.js").AppliedBundle[];
46
+ shipping: number;
47
+ freeShipping: boolean;
48
+ shippingStatus: import("../../lib/cart/shipping-status.js").ShippingStatus;
49
+ freeUnitsByPartNumber: Record<string, number>;
50
+ tax: {
51
+ name: string;
52
+ rate: number;
53
+ amount: number;
54
+ inclusive: boolean;
55
+ charged: boolean;
56
+ } | null;
57
+ grand: number;
58
+ repricing: boolean;
59
+ currency: import("../../lib/api/index.js").Currency;
60
+ };
61
+ coupon: import("../CartContext.js").AppliedCoupon | null;
62
+ deliveryOptions: {
63
+ id: string;
64
+ name: string;
65
+ description: string;
66
+ tag: string;
67
+ amount: number;
68
+ methodType: "delivery" | "pickup";
69
+ pickupLocation: import("../../lib/api/types.js").components["schemas"]["PickupLocation"] | null;
70
+ }[];
71
+ shippingMethodId: string | null;
72
+ setShippingMethodId: (id: string) => void;
73
+ pickupLocation: {
74
+ id: string;
75
+ name: string;
76
+ address: string;
77
+ city: string;
78
+ state: string;
79
+ zipCode: string;
80
+ country: string;
81
+ openingHours: string;
82
+ instructions: string;
83
+ } | null;
84
+ servedCountries: import("../../lib/content/site.js").SiteCountry[];
85
+ formatMoney: (amount: number, currency?: string) => string;
86
+ payChoice: PayKey;
87
+ setPayChoice: import("react").Dispatch<import("react").SetStateAction<PayKey>>;
88
+ placing: boolean;
89
+ email: string;
90
+ setEmail: import("react").Dispatch<import("react").SetStateAction<string>>;
91
+ firstName: string;
92
+ setFirstName: import("react").Dispatch<import("react").SetStateAction<string>>;
93
+ lastName: string;
94
+ setLastName: import("react").Dispatch<import("react").SetStateAction<string>>;
95
+ address1: string;
96
+ setAddress1: import("react").Dispatch<import("react").SetStateAction<string>>;
97
+ address2: string;
98
+ setAddress2: import("react").Dispatch<import("react").SetStateAction<string>>;
99
+ city: string;
100
+ setCity: import("react").Dispatch<import("react").SetStateAction<string>>;
101
+ postcode: string;
102
+ setPostcode: import("react").Dispatch<import("react").SetStateAction<string>>;
103
+ phone: string;
104
+ setPhone: import("react").Dispatch<import("react").SetStateAction<string>>;
105
+ country: string;
106
+ setCountry: import("react").Dispatch<import("react").SetStateAction<string>>;
107
+ subdivision: string;
108
+ setSubdivision: import("react").Dispatch<import("react").SetStateAction<string>>;
109
+ subdivisions: {
110
+ code: string;
111
+ name: string;
112
+ divisionType: string;
113
+ }[];
114
+ destination: import("../../lib/content/site.js").SiteCountry | null;
115
+ postcodeLabel: string;
116
+ subdivisionLabel: string;
117
+ me: ShopMe | null;
118
+ savedAddresses: ShopAddress[];
119
+ selectedAddressId: string;
120
+ setSelectedAddressId: import("react").Dispatch<import("react").SetStateAction<string>>;
121
+ saveAddress: boolean;
122
+ setSaveAddress: import("react").Dispatch<import("react").SetStateAction<boolean>>;
123
+ saveLabel: string;
124
+ setSaveLabel: import("react").Dispatch<import("react").SetStateAction<string>>;
125
+ addressSaveNote: string | null;
126
+ idemKey: string;
127
+ confirmation: LandingOrder | null;
128
+ setConfirmation: import("react").Dispatch<import("react").SetStateAction<LandingOrder | null>>;
129
+ orderError: string | null;
130
+ payment: {
131
+ clientSecret: string;
132
+ publishableKey: string;
133
+ amount: string;
134
+ currency: string;
135
+ orderNumber: string;
136
+ } | null;
137
+ paypalStep: boolean;
138
+ squareStep: boolean;
139
+ pendingConf: {
140
+ orderNumber: string;
141
+ status: string;
142
+ total: string;
143
+ currency: string;
144
+ freightCharge: string;
145
+ discountAmount: string;
146
+ grandTotal: string;
147
+ shippingMethod?: string | null;
148
+ couponCode?: string | null;
149
+ } | null;
150
+ paid: boolean;
151
+ setPaid: import("react").Dispatch<import("react").SetStateAction<boolean>>;
152
+ payNote: string | null;
153
+ afterpayConfirming: boolean;
154
+ gocardlessConfirming: boolean;
155
+ zipConfirming: boolean;
156
+ klarnaConfirming: boolean;
157
+ checkoutRootRef: import("react").RefObject<HTMLDivElement | null>;
158
+ setCheckoutHeaderEl: import("react").Dispatch<import("react").SetStateAction<HTMLElement | null>>;
159
+ fillFromAddress: (a: ShopAddress) => void;
160
+ checkoutSignOut: () => void;
161
+ payOptions: PayOption[];
162
+ placeOrder: () => Promise<void>;
163
+ };
164
+ export type CheckoutState = ReturnType<typeof useCheckoutState>;
165
+ export declare function CheckoutStateProvider({ children, ...props }: CheckoutProps & {
166
+ children: React.ReactNode;
167
+ }): import("react").JSX.Element;
168
+ export declare function useCheckout(): CheckoutState;
169
+ export {};
@@ -0,0 +1,3 @@
1
+ "use client";import{jsx as w}from"react/jsx-runtime";import{createContext as ht,useContext as gt,useEffect as u,useMemo as Oe,useRef as Re,useState as e}from"react";import{isOrderable as _e,useCart as kt}from"../CartContext.js";import{useCurrency as wt}from"../CurrencyContext.js";import{getClickIds as Ct}from"../../lib/click-ids.js";import{adConsentForOrder as St}from"../../lib/consent/choice.js";import{trackBeginCheckout as bt,trackPurchase as At}from"../../lib/google-tag.js";import{trackMetaPurchase as Pt}from"../../lib/meta-pixel.js";import{ApiError as vt,api as N,products as p}from"../../lib/api/index.js";import{uuid as xt}from"../../lib/uuid.js";import{orderLinesForSets as Nt}from"../../lib/commerce.js";import{canPersist as Kt,safeSessionStorage as g}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Et,AFTERPAY_RETURN as It,GOCARDLESS_CONTEXT_KEY as oe,KLARNA_CONTEXT_KEY as re,ZIP_CONTEXT_KEY as Ot,ZIP_RETURN as Rt,runWalletReturn as Te}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as _t}from"../../lib/checkout/match-subdivision.js";import{couponCodeForOrder as Tt,couponRefusedByOrder as Mt}from"../../lib/cart/coupon-preview.js";function Me(r){const f=r.indexOf(`
2
+ `);return f===-1?[r,""]:[r.slice(0,f),r.slice(f+1)]}function Le(r,{canParkContext:f}={canParkContext:!0}){const l=r.paymentMethods,a=[];return l.includes("card")&&a.push({key:"card",title:"Card",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),l.includes("paypal")&&r.paypalClientId&&a.push({key:"paypal",title:"PayPal",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),l.includes("afterpay")&&a.push({key:"afterpay",title:"Afterpay",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),l.includes("square")&&r.squareApplicationId&&r.squareLocationId&&a.push({key:"square",title:"Card (Square)",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),l.includes("gocardless")&&f&&a.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),l.includes("zip")&&a.push({key:"zip",title:"Zip",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),l.includes("klarna")&&f&&a.push({key:"klarna",title:"Klarna",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),a.push({key:"bank",title:"Bank transfer",body:null,price:w("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),a}function Lt({site:r,logo:f,preview:l=!1}){const{items:a,totals:C,coupon:b,refuseCoupon:Ue,deliveryOptions:se,shippingMethodId:U,setShippingMethodId:ze,setQuoteDestination:K,identify:ce,clearCapturedCart:E}=kt(),Ye=se.find(t=>t.id===U)?.pickupLocation??null,{country:Be,countries:I,activeCountry:ae,formatMoney:qe}=wt(),[y,ie]=e(()=>Le(r)[0].key),[le,Fe]=e(!0);u(()=>{Fe(Kt(g))},[]);const[de,ue]=e(!1),[O,pe]=e(""),[A,me]=e(""),[z,fe]=e(""),[Y,B]=e(""),[q,F]=e(""),[D,J]=e(""),[X,Z]=e(""),[H,G]=e(""),[i,W]=e(()=>Be||I[0]?.code||""),[P,j]=e(""),[R,ye]=e([]),[he,Q]=e(null),[_,T]=e(null),ge=Oe(()=>I.find(t=>t.code===i)??ae,[I,i,ae]),De=ge?.postalLabel||"Postal Code",Je=R[0]?.divisionType||"State / Province";u(()=>{if(!i){ye([]),Q(i);return}Q(null);let t=!1;return p.listCountrySubdivisions(i).then(n=>{t||(ye(n),Q(i),j(""))}),()=>{t=!0}},[i]),u(()=>{K(i?{country:i,subdivision:P}:null)},[i,P,K]),u(()=>()=>K(null),[K]);const[V,ke]=e(null),[Xe,we]=e([]),[Ce,ee]=e("new"),[Se,be]=e(!1),[Ae,Ze]=e("Home"),[He,Pe]=e(null),[m]=e(()=>xt()),[Ge,S]=e(null),[We,v]=e(null),[je,Qe]=e(null),[Ve,et]=e(!1),[tt,nt]=e(!1),[ot,te]=e(null),[rt,M]=e(!1),[st,k]=e(null),[ct,at]=e(!1),[it,ve]=e(!1),[lt,dt]=e(!1),[ut,xe]=e(!1),Ne=Re(!1);u(()=>{l||Ne.current||!a.some(_e)||(Ne.current=!0,bt({lines:a,currency:C.currency,value:C.subtotal-C.discount,coupon:b?.valid?b.code:void 0}))},[a,C,b,l]),u(()=>{ce(O,A.trim()||void 0)},[O,A,ce]);const Ke=Re(null),[L,pt]=e(null);u(()=>{const t=Ke.current;if(!L||!t)return;const n=()=>t.style.setProperty("--sf-checkout-header-h",`${L.offsetHeight}px`);n();const o=new ResizeObserver(n);return o.observe(L),()=>o.disconnect()},[L]),u(()=>{const t=o=>({setConfirming:o,land:S,markPaid:()=>M(!0),note:k,fail:v,clearCart:E}),n={search:window.location.search,storage:g,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};Te(It,{...n,capture:p.captureAfterpayPayment,page:t(at)}),Te(Rt,{...n,capture:p.captureZipPayment,page:t(dt)})},[]),u(()=>{const n=new URLSearchParams(window.location.search).get("gocardless");if(n!=="confirm"&&n!=="cancel")return;const o=g.getItem(oe);if(g.removeItem(oe),window.history.replaceState(null,"",window.location.pathname),!o)return;let c;try{c=JSON.parse(o)}catch{return}if(E(),n==="cancel"){k("The direct debit was not set up — our team will follow up on payment."),S(c.confirmation);return}ve(!0),p.completeGocardlessPayment({idempotencyKey:c.idempotencyKey}).then(s=>{s.status==="paid"?M(!0):s.status==="declined"?k("The direct debit was declined — our team will follow up on payment."):k("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{k("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{S(c.confirmation),ve(!1)})},[]),u(()=>{const t=new URLSearchParams(window.location.search),n=t.get("klarna");if(n!=="confirm"&&n!=="cancel")return;const o=g.getItem(re);g.removeItem(re);const c=t.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!o)return;let s;try{s=JSON.parse(o)}catch{return}if(E(),n==="cancel"||!c){k("The Klarna payment was not completed — our team will follow up on payment."),S(s.confirmation);return}xe(!0),p.captureKlarnaPayment({idempotencyKey:s.idempotencyKey,authorizationToken:c}).then(d=>{d.status==="paid"?M(!0):d.status==="declined"?k("Klarna declined the payment — our team will follow up on payment."):k("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{k("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{S(s.confirmation),xe(!1)})},[]);function Ee(t){const[n,o]=Me(t.address);B(n),F(o),J(t.city),Z(t.zip_code),t.country&&W(t.country),t.phone&&G(t.phone),T({country:t.country||null,state:t.state??""})}u(()=>{if(_){if((_.country||i)!==i){T(null);return}he===i&&(j(_t(i,_.state,R)),T(null))}},[_,i,he,R]),u(()=>{let t=!1;return(async()=>{try{const[n,o,c]=await Promise.all([N.me(),N.myProfile().catch(()=>null),N.myAddresses().catch(()=>[])]);if(t)return;ke(n);const s=c.filter(x=>x.is_active);we(s),pe(n.email);const d=(o?.contact_name??"").split(/\s+/);me(n.first_name||d[0]||""),fe(n.last_name||d.slice(1).join(" "));const h=n.phone||o?.phone;h&&G(h);const ne=s.find(x=>x.id===n.default_delivery_location)??s[0];if(ne)ee(ne.id),Ee(ne);else if(o){const[x,yt]=Me(o.address??"");B(x),F(yt),J(o.city??""),Z(o.zip_code??""),o.country&&W(o.country),T({country:o.country||null,state:o.state??""})}}catch{}})(),()=>{t=!0}},[]);function mt(){N.logout(),ke(null),we([]),ee("new"),be(!1)}const $=Oe(()=>Le(r,{canParkContext:le}),[r,le]);u(()=>{$.some(t=>t.key===y)||ie($[0].key)},[$,y]);const Ie=q.trim()?`${Y}
3
+ ${q.trim()}`:Y;async function ft(){if(l||de||a.length===0||C.repricing)return;const t=a.filter(_e).flatMap(n=>Nt(n.components,n.qty));if(t.length===0){v("Pick a size on each wheel's product page before checking out.");return}ue(!0),v(null);try{const n=V?p.createOrderAuthed:p.createOrder,o=St(),c=await n({customer:{email:O,name:`${A} ${z}`.trim(),phone:H.trim()||void 0,address:Ie,city:D,state:P||void 0,zipCode:X,country:i},items:t,currency:C.currency,idempotencyKey:m,shippingMethodId:U??void 0,couponCode:Tt(b),...o==="denied"?{}:Ct(),...o?{adConsent:o}:{}});if(At({confirmation:c,lines:a,adsSendTo:r.googleAdsId&&r.googleAdsConversionLabel?`${r.googleAdsId}/${r.googleAdsConversionLabel}`:null}),Pt({confirmation:c,lines:a}),E(),V&&Se&&Ce==="new")try{await N.createAddress({label:Ae.trim()||"Home",contact_name:`${A} ${z}`.trim(),phone:H.trim(),address:Ie,city:D,zip_code:X,state:P,country:i}),Pe("Address saved to your account.")}catch{Pe("We couldn't save the address to your account — you can add it under Account → Addresses.")}if(y==="card"&&r.paymentMethods.includes("card")){const s=await p.createPaymentIntent({idempotencyKey:m});te(c),Qe(s)}else if(y==="paypal"&&r.paymentMethods.includes("paypal"))te(c),et(!0);else if(y==="afterpay"&&r.paymentMethods.includes("afterpay")){const s=window.location.origin,d=await p.createAfterpayCheckout({idempotencyKey:m,confirmUrl:`${s}/checkout?afterpay=confirm`,cancelUrl:`${s}/checkout?afterpay=cancel`}),h={idempotencyKey:m,confirmation:c};g.setItem(Et,JSON.stringify(h)),window.location.assign(d.redirectCheckoutUrl);return}else if(y==="square"&&r.paymentMethods.includes("square"))te(c),nt(!0);else if(y==="gocardless"&&r.paymentMethods.includes("gocardless")){const s=window.location.origin,d=await p.createGocardlessBillingRequest({idempotencyKey:m,confirmUrl:`${s}/checkout?gocardless=confirm`,cancelUrl:`${s}/checkout?gocardless=cancel`}),h={idempotencyKey:m,confirmation:c};g.setItem(oe,JSON.stringify(h)),window.location.assign(d.authorisationUrl);return}else if(y==="zip"&&r.paymentMethods.includes("zip")){const s=window.location.origin,d=await p.createZipCheckout({idempotencyKey:m,redirectUrl:`${s}/checkout?zip=return`}),h={idempotencyKey:m,confirmation:c};g.setItem(Ot,JSON.stringify(h)),window.location.assign(d.redirectUrl);return}else if(y==="klarna"&&r.paymentMethods.includes("klarna")){const s=window.location.origin,d=await p.createKlarnaCheckout({idempotencyKey:m,confirmUrl:`${s}/checkout?klarna=confirm`,cancelUrl:`${s}/checkout?klarna=cancel`}),h={idempotencyKey:m,confirmation:c};g.setItem(re,JSON.stringify(h)),window.location.assign(d.redirectUrl);return}else S(c)}catch(n){const o=Mt(n);o?(Ue(o),v(`${o} Your order has not been placed. Place it again to continue without the code.`)):v(n instanceof vt?n.message:"Could not place the order. Please try again."),ue(!1)}}return{site:r,logo:f,items:a,totals:C,coupon:b,deliveryOptions:se,shippingMethodId:U,setShippingMethodId:ze,pickupLocation:Ye,servedCountries:I,formatMoney:qe,payChoice:y,setPayChoice:ie,placing:de,email:O,setEmail:pe,firstName:A,setFirstName:me,lastName:z,setLastName:fe,address1:Y,setAddress1:B,address2:q,setAddress2:F,city:D,setCity:J,postcode:X,setPostcode:Z,phone:H,setPhone:G,country:i,setCountry:W,subdivision:P,setSubdivision:j,subdivisions:R,destination:ge,postcodeLabel:De,subdivisionLabel:Je,me:V,savedAddresses:Xe,selectedAddressId:Ce,setSelectedAddressId:ee,saveAddress:Se,setSaveAddress:be,saveLabel:Ae,setSaveLabel:Ze,addressSaveNote:He,idemKey:m,confirmation:Ge,setConfirmation:S,orderError:We,payment:je,paypalStep:Ve,squareStep:tt,pendingConf:ot,paid:rt,setPaid:M,payNote:st,afterpayConfirming:ct,gocardlessConfirming:it,zipConfirming:lt,klarnaConfirming:ut,checkoutRootRef:Ke,setCheckoutHeaderEl:pt,fillFromAddress:Ee,checkoutSignOut:mt,payOptions:$,placeOrder:ft}}const $e=ht(null);function Qt({children:r,...f}){const l=Lt(f);return w($e.Provider,{value:l,children:r})}function Vt(){const r=gt($e);if(!r)throw new Error("useCheckout must be used inside CheckoutStateProvider");return r}export{Qt as CheckoutStateProvider,Le as buildPayOptions,Vt as useCheckout};
@@ -544,6 +544,7 @@ export interface AdminHeaderSettings {
544
544
  menu_row: "top" | "bottom" | "inline";
545
545
  account_enabled?: boolean;
546
546
  cart_enabled?: boolean;
547
+ call_button?: boolean;
547
548
  util_style?: "icon" | "text";
548
549
  nav_text_case?: "uppercase" | "capitalised";
549
550
  country_selector_enabled: boolean;
@@ -1637,6 +1637,9 @@ export interface components {
1637
1637
  height: "compact" | "standard";
1638
1638
  heightPx: number | null;
1639
1639
  sticky: "none" | "always" | "on_scroll_up";
1640
+ callButton?: boolean;
1641
+ callPhone?: string;
1642
+ callHref?: string;
1640
1643
  borderThickness: number;
1641
1644
  colorSchemeDefault: "light" | "dark";
1642
1645
  colorSchemeInverse: "light" | "dark";
@@ -0,0 +1,7 @@
1
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
2
+ export declare const CONTACT_KIND_OPTIONS: {
3
+ label: string;
4
+ value: "phone" | "whatsapp" | "telegram" | "line" | "wechat" | "email" | "kakaotalk";
5
+ }[];
6
+ export declare const CONTACT_KIND_FALLBACK = "phone";
7
+ export declare const ContactCardsMeta: Omit<BlockRender, "render">;
@@ -0,0 +1 @@
1
+ import{CONTACT_KIND_NAMES as o,CONTACT_KINDS as C}from"../../../../sections/messaging.js";const e=C.map(t=>({label:o[t],value:t})),c="phone",n={label:"Contact cards",widthRows:"two",defaultProps:{title:"Who to ask",description:"",contained:!0,contacts:[]}};export{c as CONTACT_KIND_FALLBACK,e as CONTACT_KIND_OPTIONS,n as ContactCardsMeta};
@@ -0,0 +1,4 @@
1
+ import { type ContactEntry } from "../../../../sections/messaging.js";
2
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
3
+ export declare const contactCardsSample: () => ContactEntry[];
4
+ export declare const ContactCardsRender: BlockRender;
@@ -0,0 +1 @@
1
+ import{jsx as a}from"react/jsx-runtime";import r from"../../../../../components/ContactCards.js";import{contactViews as n}from"../../../../sections/messaging.js";import{readHidable as c}from"efficient-easel/screen/lib/document/hidable";import{ContactCardsMeta as d}from"./meta.js";const s=()=>[{name:"Jessie",kind:"phone",value:"0400 000 000"},{name:"Saki",kind:"line",value:"yourvenue"}],o=t=>{const{text:e,hidden:i}=c(t);return i||!e?void 0:e},x={...d,render:t=>{let e=n(t.contacts);return!e.length&&t.editor?.isEditing&&(e=n(s())),a(r,{title:o(t.title),description:o(t.description),contacts:e,contained:t.contained!==!1})}};export{x as ContactCardsRender,s as contactCardsSample};
@@ -1 +1 @@
1
- import{jsx as y}from"react/jsx-runtime";import h,{readFacets as k}from"../../../../../components/Events.js";import{BLOCK_SOURCE_ROWS_PROP as b,declaredBlockSource as x,sourcedRows as g}from"efficient-web-builder/format/lib/content/block-sources";import{hidableText as v}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as A}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as s}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{say as a}from"efficient-web-builder/format/lib/editor-words";import{EventsMeta as E,EVENTS_PH as u}from"./meta.js";const S=()=>[{key:"sample-1",title:a("First card"),excerpt:a("A line about it appears here.")},{key:"sample-2",title:a("Second card"),excerpt:a("A line about it appears here.")},{key:"sample-3",title:a("Third card"),excerpt:a("A line about it appears here.")},{key:"sample-4",title:a("Fourth card"),excerpt:a("A line about it appears here.")}],f=(e,i,n)=>({slug:e.key||`card-${i}`,title:e.title??"",excerpt:e.excerpt??"",cover:e.cover??"",meta:e.meta||void 0,dateLabel:e.dateLabel||void 0,href:e.href||"#",...n?{facets:n}:{}});function B(e){const i=e[b],n=new Map,d=[];if(!Array.isArray(i))return{byKey:n,byIndex:d};for(const l of i){if(!l||typeof l!="object"||Array.isArray(l))continue;const t=l;if(!Object.values(t).some(c=>typeof c=="string"&&c))continue;const o=k(t.facets);d.push(o),o&&typeof t.key=="string"&&t.key&&n.set(t.key,o)}return{byKey:n,byIndex:d}}const _={...E,render:e=>{const i=A(e.headPlacement)==="own-box",n=r=>i?void 0:r,d=s(e.linkText,u.link,e.editor),t=x(e)!==""?g(e,!!e.editor?.isEditing,S()):null,o=t&&!t.sample?B(e):null,c=t?t.sample?[]:t.rows.map((r,m)=>f(r,m,r.key?o?.byKey.get(r.key):o?.byIndex[m])):e.posts;return y(h,{num:n(s(e.num,u.num,e.editor)),title:n(s(e.title,u.title,e.editor)),link:n(d?{text:d,href:v(e.linkHref)||"/journal"}:void 0),omitHead:i,posts:c,sample:t?.sample?t.rows.map((r,m)=>f(r,m)):void 0,columns:e.columns,limit:e.limit,showAll:e.showAll,layout:e.layout,featuredWidth:e.featuredWidth,listCover:e.listCover,featuredDarken:e.featuredDarken,cardImage:e.cardImage,gap:e.gap,nameFilter:e.nameFilter===!0,padTop:typeof e.padTop=="number"?e.padTop:void 0,padBottom:typeof e.padBottom=="number"?e.padBottom:void 0,editing:e.editor?.isEditing})}};export{_ as EventsRender};
1
+ import{jsx as y}from"react/jsx-runtime";import h,{readFacets as k,readTags as g}from"../../../../../components/Events.js";import{BLOCK_SOURCE_ROWS_PROP as b,declaredBlockSource as x,sourcedRows as A}from"efficient-web-builder/format/lib/content/block-sources";import{hidableText as E}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as S}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as m}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{say as n}from"efficient-web-builder/format/lib/editor-words";import{EventsMeta as T,EVENTS_PH as u}from"./meta.js";const v=()=>[{key:"sample-1",title:n("First card"),excerpt:n("A line about it appears here.")},{key:"sample-2",title:n("Second card"),excerpt:n("A line about it appears here.")},{key:"sample-3",title:n("Third card"),excerpt:n("A line about it appears here.")},{key:"sample-4",title:n("Fourth card"),excerpt:n("A line about it appears here.")}],f=(e,i,a)=>({slug:e.key||`card-${i}`,title:e.title??"",excerpt:e.excerpt??"",cover:e.cover??"",meta:e.meta||void 0,dateLabel:e.dateLabel||void 0,href:e.href||"#",...a?.facets?{facets:a.facets}:{},...a?.tags?{tags:a.tags}:{}});function B(e){const i=e[b],a=new Map,o=[];if(!Array.isArray(i))return{byKey:a,byIndex:o};for(const d of i){if(!d||typeof d!="object"||Array.isArray(d))continue;const t=d;if(!Object.values(t).some(l=>typeof l=="string"&&l))continue;const s={facets:k(t.facets),tags:g(t.tags)};o.push(s),typeof t.key=="string"&&t.key&&a.set(t.key,s)}return{byKey:a,byIndex:o}}const I={...T,render:e=>{const i=S(e.headPlacement)==="own-box",a=r=>i?void 0:r,o=m(e.linkText,u.link,e.editor),t=x(e)!==""?A(e,!!e.editor?.isEditing,v()):null,s=t&&!t.sample?B(e):null,l=t?t.sample?[]:t.rows.map((r,c)=>f(r,c,r.key?s?.byKey.get(r.key):s?.byIndex[c])):e.posts;return y(h,{num:a(m(e.num,u.num,e.editor)),title:a(m(e.title,u.title,e.editor)),link:a(o?{text:o,href:E(e.linkHref)||"/journal"}:void 0),omitHead:i,posts:l,sample:t?.sample?t.rows.map((r,c)=>f(r,c)):void 0,columns:e.columns,limit:e.limit,showAll:e.showAll,layout:e.layout,featuredWidth:e.featuredWidth,listCover:e.listCover,featuredDarken:e.featuredDarken,cardImage:e.cardImage,gap:e.gap,nameFilter:e.nameFilter===!0,padTop:typeof e.padTop=="number"?e.padTop:void 0,padBottom:typeof e.padBottom=="number"?e.padBottom:void 0,editing:e.editor?.isEditing})}};export{I as EventsRender};
@@ -1 +1 @@
1
- import{FOOTER_COLUMNS_DEFAULT as o,LOGO_FILL_DEFAULT as t,LOGO_ROW_FILL_DEFAULT as e}from"efficient-web-builder/format/lib/content/footer";const l={blocks:{type:"slot",allow:["FooterLogo","FooterMenu","FooterDivider","FooterGroup","FooterText","FooterEmailSignup","FooterSocial"]}},r={label:"Footer",fields:l,defaultProps:{columns:o,logoFill:t,logoRowFill:e}};export{r as FooterMeta,l as FooterSlots};
1
+ import{FOOTER_COLUMNS_DEFAULT as o,LOGO_FILL_DEFAULT as t,LOGO_ROW_FILL_DEFAULT as e}from"efficient-web-builder/format/lib/content/footer";const F={blocks:{type:"slot",allow:["FooterLogo","FooterMenu","FooterDivider","FooterGroup","FooterText","FooterEmailSignup","FooterSocial","FooterPayment"]}},r={label:"Footer",fields:F,defaultProps:{columns:o,logoFill:t,logoRowFill:e}};export{r as FooterMeta,F as FooterSlots};
@@ -1 +1 @@
1
- const o={blocks:{type:"slot",allow:["FooterText","FooterEmailSignup","FooterMenu","FooterDivider","FooterSocial"]}},t={label:"Footer Box",fields:o,defaultProps:{direction:"vertical",align:"start"}};export{t as FooterGroupMeta,o as FooterGroupSlots};
1
+ const o={blocks:{type:"slot",allow:["FooterText","FooterEmailSignup","FooterMenu","FooterDivider","FooterSocial","FooterPayment"]}},t={label:"Footer Box",fields:o,defaultProps:{direction:"vertical",align:"start"}};export{t as FooterGroupMeta,o as FooterGroupSlots};
@@ -0,0 +1,2 @@
1
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
2
+ export declare const FooterMessagingMeta: Omit<BlockRender, "render">;
@@ -0,0 +1 @@
1
+ import{MESSAGING_SOURCE as e}from"../../../../sections/messaging.js";const s={label:"Messaging Strip",defaultProps:{heading:"Message us",dataSource:e}};export{s as FooterMessagingMeta};
@@ -0,0 +1,2 @@
1
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
2
+ export declare const FooterMessagingRender: BlockRender;
@@ -0,0 +1 @@
1
+ import{jsx as i}from"react/jsx-runtime";import s from"../../../../../components/FooterMessaging.js";import{messagingChannels as t}from"../../../../sections/messaging.js";import{sourcedRows as m}from"efficient-web-builder/format/lib/content/block-sources";import{readHidable as a}from"efficient-easel/screen/lib/document/hidable";import{messagingSample as d}from"../MessagingCards/render.js";import{FooterMessagingMeta as g}from"./meta.js";const M={...g,render:e=>{const{rows:o}=m(e,!!e.editor?.isEditing,d()),{text:r,hidden:n}=a(e.heading);return i(s,{heading:n?void 0:r||void 0,channels:t(o)})}};export{M as FooterMessagingRender};
@@ -0,0 +1,3 @@
1
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
2
+ export declare const FOOTER_PAYMENT_LEAD: "We accept";
3
+ export declare const FooterPaymentMeta: Omit<BlockRender, "render">;
@@ -0,0 +1 @@
1
+ import{FOOTER_PAYMENT_PH as t}from"efficient-web-builder/format/lib/content/footer";const e=t.lead,a={label:"Payment Logos",defaultProps:{lead:e,methods:[],size:"sm",align:"start"}};export{e as FOOTER_PAYMENT_LEAD,a as FooterPaymentMeta};
@@ -0,0 +1,2 @@
1
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
2
+ export declare const FooterPaymentRender: BlockRender;
@@ -0,0 +1 @@
1
+ import{Fragment as g,jsx as t}from"react/jsx-runtime";import d from"../../../../../components/FooterPayment.js";import{declaredBlockSource as f,sourcedRows as y}from"efficient-web-builder/format/lib/content/block-sources";import{say as l}from"efficient-web-builder/format/lib/editor-words";import{FooterPaymentMeta as h}from"./meta.js";const p=()=>[{label:l("Cash"),kind:"cash"},{label:l("Card"),kind:"card"}],x={...h,render:r=>{const{lead:a,methods:o,size:n,align:i,editor:m}=r;if(f(r)!==""){const e=y(r,!!m?.isEditing,p()).rows;return e.length?t(d,{lead:a,methods:e.map(s=>({name:s.label,kind:s.kind})),size:n,align:i}):t(g,{})}const c=Array.isArray(o)?o:[];return t(d,{lead:a,methods:c.map(e=>({name:e.label})),size:n,align:i,editing:m?.isEditing})}};export{x as FooterPaymentRender};
@@ -0,0 +1,2 @@
1
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
2
+ export declare const MessagingCardsMeta: Omit<BlockRender, "render">;
@@ -0,0 +1 @@
1
+ import{MESSAGING_SOURCE as e}from"../../../../sections/messaging.js";const t={label:"Messaging cards",widthRows:"two",defaultProps:{title:"Message us",description:"",contained:!0,dataSource:e}};export{t as MessagingCardsMeta};
@@ -0,0 +1,4 @@
1
+ import { type SourceRow } from "efficient-web-builder/format/lib/content/block-sources";
2
+ import type { BlockRender } from "efficient-web-builder/format/lib/document/blocks/block-types";
3
+ export declare const messagingSample: () => SourceRow[];
4
+ export declare const MessagingCardsRender: BlockRender;
@@ -0,0 +1 @@
1
+ import{jsx as a}from"react/jsx-runtime";import s from"../../../../../components/MessagingCards.js";import{messagingChannels as o}from"../../../../sections/messaging.js";import{sourcedRows as i}from"efficient-web-builder/format/lib/content/block-sources";import{readHidable as m}from"efficient-easel/screen/lib/document/hidable";import{MessagingCardsMeta as h}from"./meta.js";const p=()=>[{app:"wechat",name:"WeChat",handle:"yourvenue",href:"",qr:"https://u.wechat.com/yourvenue"},{app:"telegram",name:"Telegram",handle:"@yourvenue",href:"https://t.me/yourvenue",qr:"https://t.me/yourvenue"},{app:"whatsapp",name:"WhatsApp",handle:"0400 000 000",href:"https://wa.me/61400000000",qr:"https://wa.me/61400000000"},{app:"line",name:"LINE",handle:"yourvenue",href:"https://line.me/ti/p/~yourvenue",qr:"https://line.me/ti/p/~yourvenue"}],n=e=>{const{text:t,hidden:r}=m(e);return r||!t?void 0:t},v={...h,render:e=>{const{rows:t}=i(e,!!e.editor?.isEditing,p());return a(s,{title:n(e.title),description:n(e.description),channels:o(t),contained:e.contained!==!1})}};export{v as MessagingCardsRender,p as messagingSample};
@@ -3,4 +3,10 @@ export declare const REVIEWS_PH: {
3
3
  eyebrow: string;
4
4
  title: string;
5
5
  };
6
+ export declare const ReviewsSlots: {
7
+ template: {
8
+ type: "slot";
9
+ allow: string[];
10
+ };
11
+ };
6
12
  export declare const ReviewsMeta: Omit<BlockRender, "render">;
@@ -1 +1 @@
1
- const e={eyebrow:"Reviews",title:"From our *customers.*"},o={label:"Reviews",defaultProps:{eyebrow:"",title:"",columns:3,limit:6,designCode:""}};export{e as REVIEWS_PH,o as ReviewsMeta};
1
+ import{cardTemplateSlot as e}from"efficient-web-builder/format/lib/content/card-template";import{PRODUCT_REVIEWS_SOURCE as t}from"../../../../sections/reviews.js";const i={eyebrow:"Reviews",title:"From our *customers.*"},o={template:e()},l={label:"Reviews",fields:o,defaultProps:{eyebrow:"",title:"",columns:3,limit:6,dataSource:t,items:[]}};export{i as REVIEWS_PH,l as ReviewsMeta,o as ReviewsSlots};