efficient-storefront-blocks 0.112.0 → 0.114.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 (61) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/dist/chunks/{EditorPreviewCheckout-NBZP252D.js → EditorPreviewCheckout-KJ7WBAJJ.js} +4 -4
  3. package/dist/chunks/{SiteEditorProvider-6V6EJFTL.js → SiteEditorProvider-RH2SMNYG.js} +1 -1
  4. package/dist/chunks/chunk-H7576DO5.js +1 -0
  5. package/dist/chunks/chunk-P3DTJ3CI.js +1 -0
  6. package/dist/chunks/{chunk-7ZIXVUD7.js → chunk-WWVWTSGF.js} +2 -2
  7. package/dist/chunks/{fitment-data-7BV7JBDK.js → fitment-data-RALB36SU.js} +1 -1
  8. package/dist/contract.js +3 -3
  9. package/dist/editor/components/PostListStartsFromPage.d.ts +4 -0
  10. package/dist/editor/components/PostListStartsFromPage.js +1 -0
  11. package/dist/editor/lib/document/blocks/service/Events/fields.js +1 -1
  12. package/dist/editor/lib/document/config.js +1 -1
  13. package/dist/editor/lib/storefront-editor-words.d.ts +2 -0
  14. package/dist/editor/lib/storefront-editor-words.js +1 -1
  15. package/dist/index.js +31 -29
  16. package/dist/links.js +1 -1
  17. package/dist/render/components/CartDrawer.js +1 -1
  18. package/dist/render/components/CartLineThumbnail.d.ts +3 -2
  19. package/dist/render/components/ConsentProvider.js +1 -1
  20. package/dist/render/components/DetailRows.d.ts +1 -0
  21. package/dist/render/components/DetailRows.js +1 -1
  22. package/dist/render/components/Events.d.ts +5 -2
  23. package/dist/render/components/Events.js +1 -1
  24. package/dist/render/components/OpeningHours.js +1 -1
  25. package/dist/render/components/PostListStartsProvider.d.ts +21 -0
  26. package/dist/render/components/PostListStartsProvider.js +1 -0
  27. package/dist/render/components/PublishedFooter.js +1 -1
  28. package/dist/render/components/PublishedHeader.js +1 -1
  29. package/dist/render/components/SignUpSection.js +1 -1
  30. package/dist/render/components/booking/BookingFormState.d.ts +4 -0
  31. package/dist/render/components/booking/BookingFormState.js +1 -1
  32. package/dist/render/components/booking/BookingRegions.js +1 -1
  33. package/dist/render/components/cart/drawer-parts.d.ts +3 -3
  34. package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
  35. package/dist/render/components/useTyreCatalog.d.ts +2 -1
  36. package/dist/render/components/useTyreCatalog.js +3 -1
  37. package/dist/render/lib/booking/appointment-time.d.ts +6 -2
  38. package/dist/render/lib/booking/appointment-time.js +1 -1
  39. package/dist/render/lib/checkout/hold-time.d.ts +1 -0
  40. package/dist/render/lib/checkout/hold-time.js +1 -0
  41. package/dist/render/lib/content/post-list-continue.d.ts +19 -0
  42. package/dist/render/lib/content/post-list-continue.js +1 -0
  43. package/dist/render/lib/document/blocks/service/Events/meta.js +1 -1
  44. package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
  45. package/dist/render/lib/document/current-record.d.ts +1 -0
  46. package/dist/render/lib/document/current-record.js +1 -1
  47. package/dist/render/lib/document/render-client.js +1 -1
  48. package/dist/render/lib/sections/opening-hours.d.ts +1 -1
  49. package/dist/render/lib/sections/opening-hours.js +1 -1
  50. package/dist/render/lib/sections/sign-up.d.ts +1 -1
  51. package/dist/render/lib/sections/sign-up.js +1 -1
  52. package/dist/render/lib/zone.d.ts +2 -0
  53. package/dist/render/lib/zone.js +1 -0
  54. package/dist/words.d.ts +2 -0
  55. package/dist/words.js +1 -1
  56. package/package.json +2 -2
  57. package/dist/chunks/chunk-IY3JZXIQ.js +0 -1
  58. package/dist/chunks/chunk-X6YHQFHP.js +0 -1
  59. /package/dist/chunks/{chunk-7UBABYIY.js → chunk-25XGYFU3.js} +0 -0
  60. /package/dist/chunks/{chunk-37WWMI27.js → chunk-ISCYSRBG.js} +0 -0
  61. /package/dist/chunks/{chunk-7ZIXVUD7.js.LEGAL.txt → chunk-WWVWTSGF.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as r,Fragment as f}from"react/jsx-runtime";import R from"next/link";import{useEffect as O,useMemo as Y,useRef as j,useState as v}from"react";import{stripeAppearance as J}from"../../lib/checkout/stripe-appearance.js";import{Elements as ee,PaymentElement as te,useElements as re,useStripe as ne}from"@stripe/react-stripe-js";import{loadStripe as ae}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{resolveCopyright as ie}from"../../lib/content/site.js";import{ApiError as L,products as T}from"../../lib/api/index.js";import oe,{WORDMARK_FIT_FLOOR_PX as ce}from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as q,orderReference as se}from"../../lib/checkout/pay-first.js";import{CheckoutStateProvider as le,useCheckout as de}from"./checkout-state.js";import{CheckoutContact as me,CheckoutOrderSummary as pe,CheckoutPayment as ue,CheckoutShippingAddress as fe,CheckoutShippingMethod as xe,FormLock as M,LeaveLink as z}from"./checkout-parts.js";function ge(t){return e(le,{...t,children:e(be,{})})}function he({order:t,paid:n}){const{formatMoney:i}=E();if(!t.grandTotal||!t.currency)return null;const m=c=>i(Number(c),t.currency),h=Number(t.freightCharge??0),p=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||h>0)&&r(f,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:m(t.freightCharge??"0")})]}),p>0&&r(f,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",m(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:m(t.grandTotal)})]})}function ye({result:t,lostChangeNote:n=null}){const i=e("span",{className:"font-mono text-fg",children:t.checkoutNumber});return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:t.kind==="refunded"||t.kind==="expired"?"Order not placed":t.kind==="processing"?"Payment processing":"Payment received"}),e("p",{className:"text-fg-dim",children:t.kind==="refunded"?r(f,{children:["An item sold out or an offer ended while you paid for checkout ",i,". Your payment goes back to your card."]}):t.kind==="expired"?r(f,{children:["The hold on checkout ",i," ran out before your payment arrived. Your payment goes back to your card."]}):t.kind==="processing"?r(f,{children:["Your payment for checkout ",i," is being processed. When it goes through, we will email your order confirmation."]}):r(f,{children:["Thank you — your payment",t.checkoutNumber?r(f,{children:[" for checkout ",i]}):null," has gone through. We will email you the order number shortly."]})}),n&&t.kind!=="refunded"&&t.kind!=="expired"&&e("p",{className:"text-sm text-fg-dim",children:n}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function be(){const{site:t,logo:n,items:i,placing:m,formLocked:h,email:p,me:c,addressSaveNote:x,lostChangeNote:d,idemKey:u,confirmation:o,setConfirmation:b,payment:g,paypalStep:k,squareStep:N,pendingConf:l,paid:y,setPaid:C,payNote:s,afterpayConfirming:a,gocardlessConfirming:w,zipConfirming:P,klarnaConfirming:K,cardConfirming:U,checkoutResult:D,confirmCardPayment:W,cardStillProcessing:H,renewCardPayment:G,holdRenewed:Q,leaveCardPayment:V,checkoutRootRef:X,setCheckoutHeaderEl:Z}=de();return o?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:y?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[y?r(f,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," has gone through."," "]}):r(f,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," is being reviewed by our team."," "]}),c?r(f,{children:["Track it under"," ",e(R,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(f,{children:"We’ve emailed you a link to set a password and track it."})]}),e(he,{order:o,paid:y}),d&&e("p",{className:"text-sm text-fg-dim",children:d}),s&&e("p",{className:"text-sm text-fg-dim",children:s}),x&&e("p",{className:"text-sm text-fg-dim",children:x}),!c&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(R,{href:`/track?order=${encodeURIComponent(o.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):D?e(ye,{result:D,lostChangeNote:d}):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:"Placing your order — one moment."})]}):a?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):w?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"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."})]}):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 Zip — one moment."})]}):K?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):g&&l?e(ke,{payment:g,checkout:l,holdRenewed:Q,onPaid:W,onProcessing:H,onRenew:G,onBack:V}):k&&l?e(ve,{confirmation:l,clientId:t.paypalClientId??"",idemKey:u,onPaid:()=>{C(!0),b(l)},onSkip:()=>b(l)}):N&&l?e(Se,{confirmation:l,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:u,onPaid:()=>{C(!0),b(l)},onSkip:()=>b(l)}):r("div",{ref:X,className:"bg-bg text-fg",children:[r("header",{ref:Z,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(z,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:e(z,{href:"/","aria-label":`${t.name} home`,className:"inline-flex max-w-full items-center justify-center overflow-x-clip",children:e(oe,{variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,sizeUnit:n?.sizeUnit??null,siteName:t.name,fitWordmarkToContainer:!0,fitFloorPx:ce})})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(S=>r("span",{className:["relative flex items-center gap-2 transition-colors",S.state==="pending"?"text-fg-dim":"text-fg",S.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:S.state==="done"?"text-accent font-bold":"",children:S.n}),e("span",{children:S.label})]},S.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[r("div",{children:[r(M,{locked:h,children:[e(me,{}),e(fe,{}),e(xe,{})]}),e(M,{locked:m,children:e(ue,{})})]}),e(pe,{})]}),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:ie({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function ke({payment:t,checkout:n,holdRenewed:i,onPaid:m,onProcessing:h,onRenew:p,onBack:c}){const{formatMoney:x}=E(),d=e("span",{className:"text-fg",children:x(Number(t.amount),t.currency)}),u=Y(()=>ae(t.publishableKey),[t.publishableKey]),o=Y(()=>J(),[]);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:se(n)}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:n.orderNumber?r(f,{children:["Your order is placed. Pay ",d," by card to confirm it now."]}):i?r(f,{children:["Your hold ran out, so your items are held again",n.expiresAt?` until ${B(n.expiresAt)}`:"",". Enter your card again, then pay ",d,"."]}):r(f,{children:["Your items are held",n.expiresAt?` until ${B(n.expiresAt)}`:"",". Pay ",d," by card to place your order."]})}),e(ee,{stripe:u,options:{clientSecret:t.clientSecret,appearance:o},children:e(we,{payment:t,checkout:n,onPaid:m,onProcessing:h,onRenew:p,onBack:c})},t.clientSecret)]})]})})}function B(t){return new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}const Ne=5;function we({payment:t,checkout:n,onPaid:i,onProcessing:m,onRenew:h,onBack:p}){const{formatMoney:c}=E(),x=ne(),d=re(),[u,o]=v(!1),[b,g]=v(null),k=j(!1);async function N(){try{return(await x.retrievePaymentIntent(t.clientSecret)).paymentIntent?.status}catch{return}}async function l(s){let a=s;for(let w=0;a==="processing"&&w<Ne;w+=1)await new Promise(P=>setTimeout(P,1e3)),a=await N()??a;if(a==="succeeded"){i();return}if(a==="processing"){m();return}g("Payment did not complete. Please try again."),o(!1)}async function y(){if(!x||!d||u)return;o(!0),g(null),k.current=!0;const s=await x.confirmPayment({elements:d,redirect:"if_required"}).catch(()=>null);if(!s){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}g(a===void 0?q:"Payment failed. Please try again."),o(!1);return}if(s.error){if(!n.orderNumber&&s.error.code==="payment_intent_unexpected_state"){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}if(a===void 0){g(q),o(!1);return}await h(a==="canceled"),o(!1);return}g(s.error.message??"Payment failed. Please try again."),o(!1);return}await l(s.paymentIntent?.status)}async function C(){if(u)return;if(!k.current){p();return}o(!0),g(null);const s=await N();if(s==="succeeded"||s==="processing"){await l(s);return}if(o(!1),s===void 0){g(q);return}p()}return r("div",{className:"flex flex-col gap-4",children:[e(te,{}),b&&e(_,{role:"alert",children:b}),e("button",{type:"button",onClick:y,disabled:!x||!d||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",!x||!d||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(f,{children:["Processing… ",e("span",{children:"·"})]}):r(f,{children:["Pay ",c(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),!n.orderNumber&&!u&&r("button",{type:"button",onClick:C,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{children:"Back to checkout"})]})]})}const F="paypal-sdk-js";let I=null;function Pe(t,n){const i=`${t}|${n}`;if(I?.key===i)return I.promise;const m=new Promise((h,p)=>{document.getElementById(F)?.remove();const c=document.createElement("script");c.id=F;const x=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});c.src=`https://www.paypal.com/sdk/js?${x}`,c.onload=()=>{const d=window.paypal;d?h(d):p(new Error("PayPal SDK loaded without its namespace"))},c.onerror=()=>p(new Error("PayPal SDK failed to load")),document.head.appendChild(c)});return I={key:i,promise:m},m}function ve({confirmation:t,clientId:n,idemKey:i,onPaid:m,onSkip:h}){const{formatMoney:p}=E(),c=j(null),[x,d]=v(!1),[u,o]=v(null),b=j(m);return b.current=m,O(()=>{let g=!1,k=null;return Pe(n,t.currency).then(N=>{if(!(g||!c.current))return k=N.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await T.createPaypalOrder({idempotencyKey:i})).paypalOrderId,onApprove:async l=>{try{if((await T.capturePaypalOrder({idempotencyKey:i,paypalOrderId:l.orderID})).status==="paid"){b.current();return}o("PayPal did not complete the payment. Please try again.")}catch(y){o(y instanceof L?y.message:"PayPal payment failed. Please try again.")}},onError:()=>{o("PayPal could not process the payment. Please try again.")}}),k.render(c.current).then(()=>{g||d(!0)})}).catch(()=>{g||o("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{g=!0,k?.close?.()}},[n,t.currency,i]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:p(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!x&&!u&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:c}),u&&e(_,{role:"alert",children:u}),e("button",{type:"button",onClick:h,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const $="square-web-sdk";let A=null;function Ce(t){const n=t==="sandbox"?"sandbox":"production";if(A?.key===n)return A.promise;const i=new Promise((m,h)=>{document.getElementById($)?.remove();const p=document.createElement("script");p.id=$,p.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",p.onload=()=>{const c=window.Square;c?m(c):h(new Error("Square SDK loaded without its namespace"))},p.onerror=()=>h(new Error("Square SDK failed to load")),document.head.appendChild(p)});return A={key:n,promise:i},i}function Se({confirmation:t,applicationId:n,locationId:i,environment:m,idemKey:h,onPaid:p,onSkip:c}){const{formatMoney:x}=E(),d=j(null),u=j(null),o=j(null),[b,g]=v(!1),[k,N]=v(!1),[l,y]=v(null);O(()=>{let s=!1,a=null;return Ce(m).then(async w=>{if(s||!d.current)return;const P=w.payments(n,i);o.current=P,a=await P.card(),await a.attach(d.current),u.current=a,s||g(!0)}).catch(()=>{s||y("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{s=!0,a?.destroy?.()}},[n,i,m]);async function C(){const s=u.current;if(!(!s||k)){N(!0),y(null);try{const a=await s.tokenize();if(a.status!=="OK"||!a.token){y(a.errors?.[0]?.message??"Please check the card details and try again."),N(!1);return}let w;try{w=(await o.current?.verifyBuyer?.(a.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await T.chargeSquare({idempotencyKey:h,sourceId:a.token,...w?{verificationToken:w}:{}})).status==="paid"){p();return}y("Square did not complete the payment. Please try again.")}catch(a){y(a instanceof L?a.message:"Square payment failed. Please try again.")}N(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:x(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!b&&!l&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:d}),l&&e(_,{role:"alert",children:l}),e("button",{type:"button",onClick:C,disabled:!b||k,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!b||k?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:k?r(f,{children:["Processing… ",e("span",{children:"·"})]}):r(f,{children:["Pay ",x(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:c,disabled:k,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{ye as PayFirstResultView,ge as default};
1
+ "use client";import{jsx as e,jsxs as r,Fragment as x}from"react/jsx-runtime";import R from"next/link";import{useEffect as D,useMemo as Y,useRef as j,useState as v}from"react";import{holdTime as X}from"../../lib/checkout/hold-time.js";import{stripeAppearance as J}from"../../lib/checkout/stripe-appearance.js";import{userZone as ee}from"efficient-shell/format";import{Elements as te,PaymentElement as re,useElements as ne,useStripe as ae}from"@stripe/react-stripe-js";import{loadStripe as ie}from"@stripe/stripe-js";import{useCurrency as E}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{resolveCopyright as oe}from"../../lib/content/site.js";import{ApiError as L,products as q}from"../../lib/api/index.js";import ce,{WORDMARK_FIT_FLOOR_PX as se}from"efficient-web-builder/render/components/Logo";import{NOT_CHECKED as I,orderReference as le}from"../../lib/checkout/pay-first.js";import{CheckoutStateProvider as de,useCheckout as me}from"./checkout-state.js";import{CheckoutContact as pe,CheckoutOrderSummary as ue,CheckoutPayment as fe,CheckoutShippingAddress as xe,CheckoutShippingMethod as ge,FormLock as M,LeaveLink as z}from"./checkout-parts.js";function he(t){return e(de,{...t,children:e(ke,{})})}function ye({order:t,paid:n}){const{formatMoney:i}=E();if(!t.grandTotal||!t.currency)return null;const m=c=>i(Number(c),t.currency),y=Number(t.freightCharge??0),p=Number(t.discountAmount??0);return r("dl",{className:"grid w-full max-w-sm grid-cols-[1fr_auto] gap-x-6 gap-y-1 border-y border-line py-3 text-left text-sm",children:[(t.shippingMethod||y>0)&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Delivery",t.shippingMethod?` · ${t.shippingMethod}`:""]}),e("dd",{className:"text-right font-mono",children:m(t.freightCharge??"0")})]}),p>0&&r(x,{children:[r("dt",{className:"text-fg-dim",children:["Discount",t.couponCode?` · ${t.couponCode}`:""]}),r("dd",{className:"text-right font-mono",children:["−",m(t.discountAmount??"0")]})]}),e("dt",{className:"text-fg",children:n?"Total paid":"Order total"}),e("dd",{className:"text-right font-mono text-fg",children:m(t.grandTotal)})]})}function be({result:t,lostChangeNote:n=null}){const i=e("span",{className:"font-mono text-fg",children:t.checkoutNumber});return r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:t.kind==="refunded"||t.kind==="expired"?"Order not placed":t.kind==="processing"?"Payment processing":"Payment received"}),e("p",{className:"text-fg-dim",children:t.kind==="refunded"?r(x,{children:["An item sold out or an offer ended while you paid for checkout ",i,". Your payment goes back to your card."]}):t.kind==="expired"?r(x,{children:["The hold on checkout ",i," ran out before your payment arrived. Your payment goes back to your card."]}):t.kind==="processing"?r(x,{children:["Your payment for checkout ",i," is being processed. When it goes through, we will email your order confirmation."]}):r(x,{children:["Thank you — your payment",t.checkoutNumber?r(x,{children:[" for checkout ",i]}):null," has gone through. We will email you the order number shortly."]})}),n&&t.kind!=="refunded"&&t.kind!=="expired"&&e("p",{className:"text-sm text-fg-dim",children:n}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]})}function ke(){const{site:t,logo:n,items:i,placing:m,formLocked:y,email:p,me:c,addressSaveNote:g,lostChangeNote:d,idemKey:f,confirmation:o,setConfirmation:u,payment:h,paypalStep:k,squareStep:N,pendingConf:l,paid:b,setPaid:C,payNote:s,afterpayConfirming:a,gocardlessConfirming:w,zipConfirming:P,klarnaConfirming:O,cardConfirming:$,checkoutResult:A,confirmCardPayment:U,cardStillProcessing:W,renewCardPayment:H,holdRenewed:G,leaveCardPayment:Z,checkoutRootRef:Q,setCheckoutHeaderEl:V}=me();return o?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:b?"Payment received":"Order received"}),r("p",{className:"text-fg-dim",children:[b?r(x,{children:["Thank you — your payment for order"," ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," has gone through."," "]}):r(x,{children:["Thank you — your order ",e("span",{className:"font-mono text-fg",children:o.orderNumber})," is being reviewed by our team."," "]}),c?r(x,{children:["Track it under"," ",e(R,{href:"/account/orders",className:"text-accent underline",children:"your orders"}),"."]}):e(x,{children:"We’ve emailed you a link to set a password and track it."})]}),e(ye,{order:o,paid:b}),d&&e("p",{className:"text-sm text-fg-dim",children:d}),s&&e("p",{className:"text-sm text-fg-dim",children:s}),g&&e("p",{className:"text-sm text-fg-dim",children:g}),!c&&r("p",{className:"text-sm text-fg-dim",children:["You can also"," ",e(R,{href:`/track?order=${encodeURIComponent(o.orderNumber)}`,className:"text-accent underline",children:"track this order"})," ","anytime with just your order number and email — no password needed."]}),e(R,{href:"/wheels",className:"mt-2 border-2 border-line px-6 py-3 font-mono text-[12px] uppercase tracking-[0.24em] hover:border-accent",children:"Continue browsing"})]}):A?e(be,{result:A,lostChangeNote:d}):$?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Placing your order — one moment."})]}):a?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Afterpay — one moment."})]}):w?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"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."})]}):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 Zip — one moment."})]}):O?r("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-bg px-6 text-center text-fg",children:[e("h1",{className:"font-display text-3xl",children:"Confirming your payment…"}),e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Checking with Klarna — one moment."})]}):h&&l?e(Ne,{payment:h,checkout:l,holdRenewed:G,onPaid:U,onProcessing:W,onRenew:H,onBack:Z}):k&&l?e(Ce,{confirmation:l,clientId:t.paypalClientId??"",idemKey:f,onPaid:()=>{C(!0),u(l)},onSkip:()=>u(l)}):N&&l?e(je,{confirmation:l,applicationId:t.squareApplicationId??"",locationId:t.squareLocationId??"",environment:t.squareEnvironment??"production",idemKey:f,onPaid:()=>{C(!0),u(l)},onSkip:()=>u(l)}):r("div",{ref:Q,className:"bg-bg text-fg",children:[r("header",{ref:V,className:"sticky top-0 z-30 grid grid-cols-[1fr_auto_1fr] items-center gap-8 max-[640px]:grid-cols-[auto_minmax(0,1fr)_auto] max-[640px]:gap-3 border-b border-line px-[var(--sf-site-gutter,40px)] py-6 backdrop-blur-md max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))] max-[640px]:py-4",style:{background:"color-mix(in oklab, var(--bg) 92%, transparent)"},children:[r(z,{href:"/",className:"inline-flex items-center gap-3 font-mono text-[14px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{className:"max-[640px]:hidden",children:"Back to shop"})]}),e("div",{className:"flex min-w-0 justify-center max-[640px]:[container-type:inline-size]",children:e(z,{href:"/","aria-label":`${t.name} home`,className:"inline-flex max-w-full items-center justify-center overflow-x-clip",children:e(ce,{variant:"header",scrolled:!0,src:n?.url??null,reverse:n?.reverse??!1,reversedSrc:n?.reversed??null,inkIsDark:n?.inkIsDark??null,size:n?.size??"medium",sizePx:n?.sizePx??null,sizeUnit:n?.sizeUnit??null,siteName:t.name,fitWordmarkToContainer:!0,fitFloorPx:se})})}),t.cardPayments?r("span",{className:"flex items-center justify-end gap-3 font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim",children:[e("span",{className:"text-green",children:"●"}),e("span",{className:"max-[640px]:hidden",children:"Encrypted ·"})," Stripe"]}):e("span",{})]}),r("section",{className:"mx-auto flex max-w-[var(--sf-site-width,1600px)] flex-wrap items-center justify-between gap-x-8 gap-y-3 border-b border-line bg-surface px-[var(--sf-site-gutter,40px)] py-4 font-mono text-[13px] font-medium uppercase tracking-[0.24em] text-fg max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",children:[e("span",{className:"inline-flex items-center bg-accent px-3 py-1 font-bold text-bg",children:"Checkout"}),e("nav",{"aria-label":"Checkout steps",className:"flex flex-wrap items-center gap-5",children:[{n:"01",label:"Cart",state:"done"},{n:"02",label:"Ship & pay",state:"active"},{n:"03",label:"Confirmed",state:"pending"}].map(S=>r("span",{className:["relative flex items-center gap-2 transition-colors",S.state==="pending"?"text-fg-dim":"text-fg",S.state==="active"?"font-bold after:absolute after:inset-x-0 after:-bottom-1 after:h-[2px] after:bg-accent":""].join(" "),children:[e("span",{className:S.state==="done"?"text-accent font-bold":"",children:S.n}),e("span",{children:S.label})]},S.n))})]}),r("main",{className:"mx-auto grid max-w-[var(--sf-site-width,1600px)] grid-cols-[1fr_420px] items-start gap-16 px-[var(--sf-site-gutter,40px)] pt-10 pb-[100px] max-view-desktop:grid-cols-1 max-view-desktop:gap-10 max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))] max-view-desktop:pt-8 max-view-desktop:pb-20",children:[r("div",{children:[r(M,{locked:y,children:[e(pe,{}),e(xe,{}),e(ge,{})]}),e(M,{locked:m,children:e(fe,{})})]}),e(ue,{})]}),e("footer",{className:"flex flex-wrap items-center justify-between gap-4 border-t border-line px-[var(--sf-site-gutter,40px)] py-6 font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim max-[640px]:px-[min(20px,var(--sf-site-gutter,40px))]",children:e("span",{children:oe({legalName:t.legalName,foundedYear:t.foundedYear,siteName:t.name})})})]})}function Ne({payment:t,checkout:n,holdRenewed:i,onPaid:m,onProcessing:y,onRenew:p,onBack:c}){const{formatMoney:g}=E(),d=e("span",{className:"text-fg",children:g(Number(t.amount),t.currency)}),f=Y(()=>ie(t.publishableKey),[t.publishableKey]),o=Y(()=>J(),[]),u=X(n.expiresAt??"",ee()??"");return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:le(n)}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Payment"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:n.orderNumber?r(x,{children:["Your order is placed. Pay ",d," by card to confirm it now."]}):i?r(x,{children:["Your hold ran out, so your items are held again",u?` until ${u}`:"",". Enter your card again, then pay ",d,"."]}):r(x,{children:["Your items are held",u?` until ${u}`:"",". Pay ",d," by card to place your order."]})}),e(te,{stripe:f,options:{clientSecret:t.clientSecret,appearance:o},children:e(Pe,{payment:t,checkout:n,onPaid:m,onProcessing:y,onRenew:p,onBack:c})},t.clientSecret)]})]})})}const we=5;function Pe({payment:t,checkout:n,onPaid:i,onProcessing:m,onRenew:y,onBack:p}){const{formatMoney:c}=E(),g=ae(),d=ne(),[f,o]=v(!1),[u,h]=v(null),k=j(!1);async function N(){try{return(await g.retrievePaymentIntent(t.clientSecret)).paymentIntent?.status}catch{return}}async function l(s){let a=s;for(let w=0;a==="processing"&&w<we;w+=1)await new Promise(P=>setTimeout(P,1e3)),a=await N()??a;if(a==="succeeded"){i();return}if(a==="processing"){m();return}h("Payment did not complete. Please try again."),o(!1)}async function b(){if(!g||!d||f)return;o(!0),h(null),k.current=!0;const s=await g.confirmPayment({elements:d,redirect:"if_required"}).catch(()=>null);if(!s){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}h(a===void 0?I:"Payment failed. Please try again."),o(!1);return}if(s.error){if(!n.orderNumber&&s.error.code==="payment_intent_unexpected_state"){const a=await N();if(a==="succeeded"||a==="processing"){await l(a);return}if(a===void 0){h(I),o(!1);return}await y(a==="canceled"),o(!1);return}h(s.error.message??"Payment failed. Please try again."),o(!1);return}await l(s.paymentIntent?.status)}async function C(){if(f)return;if(!k.current){p();return}o(!0),h(null);const s=await N();if(s==="succeeded"||s==="processing"){await l(s);return}if(o(!1),s===void 0){h(I);return}p()}return r("div",{className:"flex flex-col gap-4",children:[e(re,{}),u&&e(_,{role:"alert",children:u}),e("button",{type:"button",onClick:b,disabled:!g||!d||f,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!g||!d||f?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:f?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",c(Number(t.amount),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),!n.orderNumber&&!f&&r("button",{type:"button",onClick:C,className:"inline-flex items-center gap-3 self-start font-mono text-[12px] uppercase tracking-[0.26em] text-fg-dim transition-colors hover:text-accent",children:["←",e("span",{children:"Back to checkout"})]})]})}const B="paypal-sdk-js";let T=null;function ve(t,n){const i=`${t}|${n}`;if(T?.key===i)return T.promise;const m=new Promise((y,p)=>{document.getElementById(B)?.remove();const c=document.createElement("script");c.id=B;const g=new URLSearchParams({"client-id":t,currency:n,intent:"capture"});c.src=`https://www.paypal.com/sdk/js?${g}`,c.onload=()=>{const d=window.paypal;d?y(d):p(new Error("PayPal SDK loaded without its namespace"))},c.onerror=()=>p(new Error("PayPal SDK failed to load")),document.head.appendChild(c)});return T={key:i,promise:m},m}function Ce({confirmation:t,clientId:n,idemKey:i,onPaid:m,onSkip:y}){const{formatMoney:p}=E(),c=j(null),[g,d]=v(!1),[f,o]=v(null),u=j(m);return u.current=m,D(()=>{let h=!1,k=null;return ve(n,t.currency).then(N=>{if(!(h||!c.current))return k=N.Buttons({style:{layout:"vertical",color:"gold",shape:"rect",label:"paypal"},createOrder:async()=>(await q.createPaypalOrder({idempotencyKey:i})).paypalOrderId,onApprove:async l=>{try{if((await q.capturePaypalOrder({idempotencyKey:i,paypalOrderId:l.orderID})).status==="paid"){u.current();return}o("PayPal did not complete the payment. Please try again.")}catch(b){o(b instanceof L?b.message:"PayPal payment failed. Please try again.")}},onError:()=>{o("PayPal could not process the payment. Please try again.")}}),k.render(c.current).then(()=>{h||d(!0)})}).catch(()=>{h||o("PayPal could not be loaded. You can pay later — your order stands either way.")}),()=>{h=!0,k?.close?.()}},[n,t.currency,i]),e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"PayPal"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:p(Number(t.grandTotal),t.currency)})," ","with PayPal to confirm it now."]}),!g&&!f&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading PayPal…"}),e("div",{ref:c}),f&&e(_,{role:"alert",children:f}),e("button",{type:"button",onClick:y,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}const F="square-web-sdk";let K=null;function Se(t){const n=t==="sandbox"?"sandbox":"production";if(K?.key===n)return K.promise;const i=new Promise((m,y)=>{document.getElementById(F)?.remove();const p=document.createElement("script");p.id=F,p.src=n==="sandbox"?"https://sandbox.web.squarecdn.com/v1/square.js":"https://web.squarecdn.com/v1/square.js",p.onload=()=>{const c=window.Square;c?m(c):y(new Error("Square SDK loaded without its namespace"))},p.onerror=()=>y(new Error("Square SDK failed to load")),document.head.appendChild(p)});return K={key:n,promise:i},i}function je({confirmation:t,applicationId:n,locationId:i,environment:m,idemKey:y,onPaid:p,onSkip:c}){const{formatMoney:g}=E(),d=j(null),f=j(null),o=j(null),[u,h]=v(!1),[k,N]=v(!1),[l,b]=v(null);D(()=>{let s=!1,a=null;return Se(m).then(async w=>{if(s||!d.current)return;const P=w.payments(n,i);o.current=P,a=await P.card(),await a.attach(d.current),f.current=a,s||h(!0)}).catch(()=>{s||b("Square could not be loaded. You can pay later — your order stands either way.")}),()=>{s=!0,a?.destroy?.()}},[n,i,m]);async function C(){const s=f.current;if(!(!s||k)){N(!0),b(null);try{const a=await s.tokenize();if(a.status!=="OK"||!a.token){b(a.errors?.[0]?.message??"Please check the card details and try again."),N(!1);return}let w;try{w=(await o.current?.verifyBuyer?.(a.token,{amount:String(t.grandTotal),currencyCode:t.currency,intent:"CHARGE"}))?.token}catch{}if((await q.chargeSquare({idempotencyKey:y,sourceId:a.token,...w?{verificationToken:w}:{}})).status==="paid"){p();return}b("Square did not complete the payment. Please try again.")}catch(a){b(a instanceof L?a.message:"Square payment failed. Please try again.")}N(!1)}}return e("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-bg px-6 py-16 text-fg",children:r("div",{className:"w-full max-w-xl border border-line bg-bg",children:[r("header",{className:"flex items-center justify-between gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t.orderNumber}),e("h1",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:"Card"})]}),r("div",{className:"flex flex-col gap-4 px-6 py-6",children:[r("p",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:["Your order is placed. Pay"," ",e("span",{className:"text-fg",children:g(Number(t.grandTotal),t.currency)})," ","by card to confirm it now."]}),!u&&!l&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Loading card form…"}),e("div",{ref:d}),l&&e(_,{role:"alert",children:l}),e("button",{type:"button",onClick:C,disabled:!u||k,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",!u||k?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:k?r(x,{children:["Processing… ",e("span",{children:"·"})]}):r(x,{children:["Pay ",g(Number(t.grandTotal),t.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})}),e("button",{type:"button",onClick:c,disabled:k,className:"self-center font-mono text-[11px] uppercase tracking-[0.24em] text-fg-dim underline-offset-4 transition-colors hover:text-accent hover:underline",children:"Pay later — our team will be in touch"})]})]})})}export{be as PayFirstResultView,he as default};
@@ -1,2 +1,3 @@
1
1
  import { type TyreSummary } from "../lib/api/index.js";
2
- export declare function useTyreCatalog(needed: boolean): ReadonlyMap<string, TyreSummary>;
2
+ export type TyreThumbnail = Pick<TyreSummary, "coverImage" | "tyreTypes">;
3
+ export declare function useTyreCatalog(slugs: readonly string[]): ReadonlyMap<string, TyreThumbnail>;
@@ -1 +1,3 @@
1
- "use client";import{useEffect as o,useState as u}from"react";import{products as s}from"../lib/api/index.js";const c=new Map;function p(a){const[e,n]=u(null);return o(()=>{if(!a||e)return;let l=!0;return s.listCatalog(["tyre"]).then(t=>{l&&n(new Map(t.flatMap(r=>r.kind==="tyre"?[[r.slug,r]]:[])))}).catch(t=>{console.error("[useTyreCatalog] tyre catalog read failed",t)}),()=>{l=!1}},[a,e]),e??c}export{p as useTyreCatalog};
1
+ "use client";import{useEffect as u,useState as f}from"react";import{products as l}from"../lib/api/index.js";const h=new Map,i=new Map;function p(e){const r=e.variants.map(t=>t.specs?.tireType).filter(t=>!!t);return{coverImage:e.coverImage,tyreTypes:[...new Set(r)]}}function m(e){const r=i.get(e);if(r)return r;const t=l.getTyre(e).then(p).catch(n=>{throw i.delete(e),n});return i.set(e,t),t}function d(e){const[r,t]=f(h),n=[...new Set(e)].sort().join(`
2
+ `);return u(()=>{if(!n)return;let s=!0;for(const o of n.split(`
3
+ `))m(o).then(c=>{s&&t(a=>a.get(o)===c?a:new Map(a).set(o,c))}).catch(c=>{s&&console.error("[useTyreCatalog] tyre read failed",o,c)});return()=>{s=!1}},[n]),r}export{d as useTyreCatalog};
@@ -1,3 +1,7 @@
1
- export declare function formatAppointmentTime(value: string, timezone: string): string;
2
- export declare function formatAppointment(value: string, timezone: string): string;
1
+ export interface AppointmentSpan {
2
+ start: string;
3
+ end?: string | null;
4
+ }
5
+ export declare function formatAppointmentTime(value: string, ...zones: string[]): string;
6
+ export declare function formatAppointment(value: string | AppointmentSpan, ...zones: string[]): string;
3
7
  export declare function startHasPassed(start: string, now: number): boolean;
@@ -1 +1 @@
1
- const i=void 0,r={hour:"numeric",minute:"2-digit"},o={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"};function a(t,e){try{return new Intl.DateTimeFormat(void 0,{...r,timeZone:e}).format(new Date(t))}catch{return new Date(t).toLocaleTimeString([],r)}}function m(t,e){try{return new Intl.DateTimeFormat(void 0,{...o,timeZone:e}).format(new Date(t))}catch{return new Date(t).toLocaleString()}}function c(t,e){const n=Date.parse(t);return Number.isFinite(n)&&n<=e}export{m as formatAppointment,a as formatAppointmentTime,c as startHasPassed};
1
+ import{dayKeyInZone as c,formatDateTime as i,formatTime as u}from"efficient-shell/format";import{firstReadableZone as f,runtimeLocale as l}from"../zone.js";const Z={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit"},d={weekday:"long",day:"numeric",month:"long",year:"numeric"},y={hour:"numeric",minute:"2-digit"},p={...y,timeZoneName:"short"};function m(e){const n=new Date(e);return Number.isFinite(n.getTime())?n:null}function A(e,...n){const t=f(...n);return!t||!m(e)?"":u(e,{locale:l(),timeZone:t})}function k(e,...n){const t=typeof e=="string"?{start:e}:e,o=f(...n),s=m(t.start);if(!o||!s)return"";const r=l(),a=t.end?m(t.end):null;if(!a||a.getTime()<=s.getTime())return i(t.start,{locale:r,timeZone:o,style:Z,zoneName:"short"});const g=i(t.start,{locale:r,timeZone:o,style:d,clock:y}),D=c(t.start,o)===c(t.end,o)?u(t.end,{locale:r,timeZone:o,clock:p}):i(t.end,{locale:r,timeZone:o,style:d,clock:p});return`${g} – ${D}`}function C(e,n){const t=Date.parse(e);return Number.isFinite(t)&&t<=n}export{k as formatAppointment,A as formatAppointmentTime,C as startHasPassed};
@@ -0,0 +1 @@
1
+ export declare function holdTime(expiresAt: string, zone: string): string;
@@ -0,0 +1 @@
1
+ import{formatTime as r}from"efficient-shell/format";import{firstReadableZone as t,runtimeLocale as i}from"../zone.js";function f(e,m){const o=t(m);return!o||Number.isNaN(new Date(e).getTime())?"":r(e,{locale:i(),timeZone:o})}export{f as holdTime};
@@ -0,0 +1,19 @@
1
+ import { type ViewTier } from "efficient-easel/screen/lib/content/view-tiers";
2
+ import { documentNodes } from "../document/document-nodes.js";
3
+ type Page = Parameters<typeof documentNodes>[0];
4
+ export declare const EVENTS_DEFAULT_LIMIT = 3;
5
+ export declare const EVENTS_LAYOUT_COUNT = "count";
6
+ export type PostListStart = Readonly<Record<ViewTier, number> & {
7
+ from: string;
8
+ }>;
9
+ export declare function postCap(props: Readonly<{
10
+ showAll?: unknown;
11
+ limit?: unknown;
12
+ }>): number;
13
+ export declare function continuedPostLists(page: Page): Record<string, PostListStart>;
14
+ export declare function hasPostListAbove(page: Page, id: string): boolean;
15
+ export declare function postListStartsOf(page: Page): {
16
+ starts: Record<string, PostListStart>;
17
+ posts: Record<string, readonly unknown[]>;
18
+ };
19
+ export {};
@@ -0,0 +1 @@
1
+ import{VIEW_TIERS as l}from"efficient-easel/screen/lib/content/view-tiers";import{declaredBlockSource as S}from"efficient-web-builder/format/lib/content/block-sources";import{nodeViewHidden as T}from"efficient-web-builder/format/lib/content/view-hide-class";import{isSectionGroupType as E,SECTION_GROUP_SLOT as I}from"efficient-web-builder/format/lib/document/section-groups";import{documentNodes as L,placedDocumentNodes as N}from"../document/document-nodes.js";const h="Events",y=3,O="count";function _(o){return o.showAll?Number.POSITIVE_INFINITY:typeof o.limit=="number"&&o.limit>0?o.limit:y}function A(o,n,s){return o.layout===O||s[n]?0:_(o)}function d(o){const n=N(o),s=new Map;for(const{node:t,order:r}of n){const e=t.props?.[I];E(t.type)&&Array.isArray(e)&&s.set(e,`group ${r}`)}return n.filter(({node:t})=>t.type===h&&S(t.props??{})==="").map(({node:t,lists:r})=>({id:String(t.props?.id??""),props:t.props??{},chain:r.map(e=>s.get(e)).find(e=>e!==void 0)??"page"}))}function g(o){const n={},s=new Map;for(const{id:t,props:r,chain:e}of d(o)){const i=s.get(e),p=r.continueList===!0&&i!==void 0,m=T(r),u=p?i.from:t,a={},f={};for(const c of l)f[c]=p?i.ends[c]:0,a[c]=f[c]+A(r,c,m);p&&(n[t]={...f,from:u}),s.set(e,{ends:a,from:u})}return n}function v(o,n){const s=new Set;for(const t of d(o)){if(t.id===n)return s.has(t.chain);s.add(t.chain)}return!1}function M(o){const n=g(o),s=new Map(L(o).map(r=>[String(r.props?.id??""),r.props?.posts])),t={};for(const[r,{from:e}]of Object.entries(n)){const i=s.get(e);Array.isArray(i)&&(t[r]=i)}return{starts:n,posts:t}}export{y as EVENTS_DEFAULT_LIMIT,O as EVENTS_LAYOUT_COUNT,g as continuedPostLists,v as hasPostListAbove,_ as postCap,M as postListStartsOf};
@@ -1 +1 @@
1
- import{FRAME_120 as e}from"../../../../sections/band-padding.js";import{PH as t}from"efficient-web-builder/format/lib/document/blocks/placeholders";import{cardTemplateSlot as l}from"efficient-web-builder/format/lib/content/card-template";const s={num:t.sectionNumber,title:"Section title",link:t.viewAll},o={template:l()},m={label:"Latest Posts",innerPadding:e,fields:o,defaultProps:{num:"",title:"",linkText:"",linkHref:"/journal",columns:3,limit:3,showAll:!1}};export{s as EVENTS_PH,m as EventsMeta,o as EventsSlots};
1
+ import{FRAME_120 as e}from"../../../../sections/band-padding.js";import{EVENTS_DEFAULT_LIMIT as o}from"../../../../content/post-list-continue.js";import{PH as t}from"efficient-web-builder/format/lib/document/blocks/placeholders";import{cardTemplateSlot as l}from"efficient-web-builder/format/lib/content/card-template";const a={num:t.sectionNumber,title:"Section title",link:t.viewAll},i={template:l()},p={label:"Latest Posts",innerPadding:e,fields:i,defaultProps:{num:"",title:"",linkText:"",linkHref:"/journal",columns:3,limit:o,showAll:!1}};export{a as EVENTS_PH,p as EventsMeta,i as EventsSlots};
@@ -1 +1 @@
1
- import{jsx as f}from"react/jsx-runtime";import{phoneKey as g}from"efficient-easel/draw";import h,{readFacets as x,readTags as k}from"../../../../../components/Events.js";import{declaredBlockSource as v,sourcedRows as y}from"efficient-web-builder/format/lib/content/block-sources";import{servedListOf as b,servedRowLists as E}from"../../../../content/served-lists.js";import{hidableText as S}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as A}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as l}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{say as a}from"efficient-web-builder/format/lib/editor-words";import{bandPadProps as P}from"../../../../sections/band-padding.js";import{EventsMeta as C,EVENTS_PH as m}from"./meta.js";const F=()=>[{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.")}],o=(e,i,t)=>({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||"#",...t?.facets?{facets:t.facets}:{},...t?.tags?{tags:t.tags}:{}}),H=e=>E(e,i=>({facets:x(i.facets),tags:k(i.tags)})),N={...C,render:e=>{const i=A(e.headPlacement)==="own-box",t=r=>i?void 0:r,s=l(e.linkText,m.link,e.editor),n=v(e)!==""?y(e,!!e.editor?.isEditing,F()):null,c=n&&!n.sample?H(e):null,u=n?n.sample?[]:n.rows.map((r,d)=>o(r,d,b(c,r,d))):e.posts;return f(h,{num:t(l(e.num,m.num,e.editor)),title:t(l(e.title,m.title,e.editor)),link:t(s?{text:s,href:S(e.linkHref)||"/journal"}:void 0),omitHead:i,posts:u,servedCategory:e.servedCategory,sample:n?.sample?n.rows.map((r,d)=>o(r,d)):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,gapPhone:e[g("gap")],nameFilter:e.nameFilter===!0,pads:P(e),editing:e.editor?.isEditing,template:e.template,ownerId:String(e.id??"")})}};export{N as EventsRender};
1
+ import{jsx as f}from"react/jsx-runtime";import{phoneKey as g}from"efficient-easel/draw";import h,{readFacets as x,readTags as k}from"../../../../../components/Events.js";import{declaredBlockSource as v,sourcedRows as y}from"efficient-web-builder/format/lib/content/block-sources";import{servedListOf as b,servedRowLists as E}from"../../../../content/served-lists.js";import{hidableText as H}from"efficient-easel/screen/lib/document/hidable";import{parseSectionHeadPlacement as S}from"efficient-web-builder/format/lib/sections/section-head-placement";import{phHide as l}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{say as a}from"efficient-web-builder/format/lib/editor-words";import{bandPadProps as A}from"../../../../sections/band-padding.js";import{EventsMeta as P,EVENTS_PH as m}from"./meta.js";import{nodeViewHidden as C}from"efficient-web-builder/format/lib/content/view-hide-class";const F=()=>[{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.")}],s=(e,i,t)=>({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||"#",...t?.facets?{facets:t.facets}:{},...t?.tags?{tags:t.tags}:{}}),L=e=>E(e,i=>({facets:x(i.facets),tags:k(i.tags)})),O={...P,render:e=>{const i=S(e.headPlacement)==="own-box",t=d=>i?void 0:d,o=l(e.linkText,m.link,e.editor),n=v(e)!==""?y(e,!!e.editor?.isEditing,F()):null,c=n&&!n.sample?L(e):null,u=n?n.sample?[]:n.rows.map((d,r)=>s(d,r,b(c,d,r))):e.posts;return f(h,{num:t(l(e.num,m.num,e.editor)),title:t(l(e.title,m.title,e.editor)),link:t(o?{text:o,href:H(e.linkHref)||"/journal"}:void 0),omitHead:i,posts:u,servedCategory:e.servedCategory,sample:n?.sample?n.rows.map((d,r)=>s(d,r)):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,gapPhone:e[g("gap")],nameFilter:e.nameFilter===!0,pads:A(e),editing:e.editor?.isEditing,template:e.template,ownerId:String(e.id??""),viewHidden:C(e)})}};export{O as EventsRender};
@@ -15,6 +15,7 @@ export declare function recordPictures(record: CurrentRecord | null | undefined,
15
15
  export interface RecordFact {
16
16
  label: string;
17
17
  value: string;
18
+ at?: string;
18
19
  }
19
20
  export declare function recordFacts(record: CurrentRecord | null | undefined): RecordFact[];
20
21
  export declare function editorPageDrawsOtherRecord(params: unknown): boolean;
@@ -1 +1 @@
1
- "use client";import{jsx as f}from"react/jsx-runtime";import{createContext as R,useContext as p}from"react";import{say as o}from"efficient-web-builder/format/lib/editor-words";import{declaredRecordType as h,PRODUCT_RECORD_TYPE as a}from"efficient-web-builder/format/lib/content/record-types";import{CurrentRecordProvider as k,useCurrentRecord as y,useCurrentRecordOf as C}from"efficient-web-builder/render/components/CurrentRecord";function A(t){const e=t.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return e?e[0].toUpperCase()+e.slice(1):t}const v=/^\d{4}-\d{2}-\d{2}$/;function m(t){return t?t.schema?.length?t.schema.filter(e=>typeof e?.key=="string"&&Object.hasOwn(t.fields,e.key)):Object.entries(t.fields).flatMap(([e,r])=>{const n=Array.isArray(r)?g(r[0])?"rows":"images":typeof r=="string"?v.test(r)?"date":"text":null;return n?[{key:e,label:A(e),kind:n}]:[]}):[]}function w(t,{firstField:e=!1}={}){if(!t)return[];const r=m(t).filter(n=>n.kind==="images");return(e?r.slice(0,1):r).flatMap(n=>{const i=t.fields[n.key];return Array.isArray(i)?i.flatMap(s=>{const c=s?.url;if(typeof c!="string"||!c)return[];const u=s.alt,d=s.video;return[{url:c,alt:typeof u=="string"?u:"",...typeof d=="string"&&d?{video:d}:{}}]}):[]})}function x(t){const e=new Date(`${t}T00:00:00Z`);return Number.isNaN(e.getTime())?t:e.toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric",timeZone:"UTC"})}function g(t){const e=t;return typeof e?.label=="string"&&!!e.label.trim()&&typeof e.value=="string"&&!!e.value.trim()}function _(t){return t?m(t).flatMap(e=>{const r=t.fields[e.key];return e.kind==="rows"?Array.isArray(r)?r.filter(g).map(({label:n,value:i})=>({label:n,value:i})):[]:e.kind!=="text"&&e.kind!=="date"?[]:typeof r!="string"||!r.trim()?[]:[{label:e.label,value:e.kind==="date"?x(r):r}]}):[]}function S(t){const e=t?.appState?.data?.root;return h(e?.props)!==a}const l=R(a);function E({type:t,children:e}){return f(l.Provider,{value:t,children:e})}function M(){return p(l)}function U(t){const e=y(),r=p(l);return e?e.type!==a:t&&r!==a}const j={type:"sample",key:"sample",get title(){return o("Record title")},get fields(){return{first:o("A detail of this record"),second:o("Another detail"),third:o("A third")}},value:void 0,get schema(){return[{key:"first",label:o("First detail"),kind:"text"},{key:"second",label:o("Second detail"),kind:"text"},{key:"third",label:o("Third detail"),kind:"text"}]}},B=4;function F({record:t,children:e}){return f(k,{record:t,dateWords:x,children:e})}export{F as CurrentRecordProvider,E as DeclaredRecordTypeProvider,B as SAMPLE_PICTURE_COUNT,j as SAMPLE_RECORD,S as editorPageDrawsOtherRecord,_ as recordFacts,m as recordFieldSpecs,w as recordPictures,y as useCurrentRecord,C as useCurrentRecordOf,M as useDeclaredRecordType,U as useDrawsOtherRecord};
1
+ "use client";import{jsx as f}from"react/jsx-runtime";import{createContext as h,useContext as p}from"react";import{formatDate as k,fromDateKey as A}from"efficient-shell/format";import{say as o}from"efficient-web-builder/format/lib/editor-words";import{declaredRecordType as C,PRODUCT_RECORD_TYPE as a}from"efficient-web-builder/format/lib/content/record-types";import{CurrentRecordProvider as D,useCurrentRecord as y,useCurrentRecordOf as b}from"efficient-web-builder/render/components/CurrentRecord";function O(e){const t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t?t[0].toUpperCase()+t.slice(1):e}const P=/^\d{4}-\d{2}-\d{2}$/;function m(e){return e?e.schema?.length?e.schema.filter(t=>typeof t?.key=="string"&&Object.hasOwn(e.fields,t.key)):Object.entries(e.fields).flatMap(([t,r])=>{const n=Array.isArray(r)?g(r[0])?"rows":"images":typeof r=="string"?P.test(r)?"date":"text":null;return n?[{key:t,label:O(t),kind:n}]:[]}):[]}function M(e,{firstField:t=!1}={}){if(!e)return[];const r=m(e).filter(n=>n.kind==="images");return(t?r.slice(0,1):r).flatMap(n=>{const i=e.fields[n.key];return Array.isArray(i)?i.flatMap(s=>{const c=s?.url;if(typeof c!="string"||!c)return[];const u=s.alt,d=s.video;return[{url:c,alt:typeof u=="string"?u:"",...typeof d=="string"&&d?{video:d}:{}}]}):[]})}const T=/^\d{4}-\d{2}-\d{2}T/,v={locale:"en-GB",style:{day:"numeric",month:"long",year:"numeric"}},x=e=>T.test(e)&&!Number.isNaN(Date.parse(e));function R(e){return A(e)?k(e,v):x(e)?"":e}function g(e){const t=e;return typeof t?.label=="string"&&!!t.label.trim()&&typeof t.value=="string"&&!!t.value.trim()}function j(e){return e?m(e).flatMap(t=>{const r=e.fields[t.key];return t.kind==="rows"?Array.isArray(r)?r.filter(g).map(({label:n,value:i})=>({label:n,value:i})):[]:t.kind!=="text"&&t.kind!=="date"?[]:typeof r!="string"||!r.trim()?[]:t.kind==="date"&&x(r)?[{label:t.label,value:"",at:r}]:[{label:t.label,value:t.kind==="date"?R(r):r}]}):[]}function B(e){const t=e?.appState?.data?.root;return C(t?.props)!==a}const l=h(a);function F({type:e,children:t}){return f(l.Provider,{value:e,children:t})}function U(){return p(l)}function L(e){const t=y(),r=p(l);return t?t.type!==a:e&&r!==a}const W={type:"sample",key:"sample",get title(){return o("Record title")},get fields(){return{first:o("A detail of this record"),second:o("Another detail"),third:o("A third")}},value:void 0,get schema(){return[{key:"first",label:o("First detail"),kind:"text"},{key:"second",label:o("Second detail"),kind:"text"},{key:"third",label:o("Third detail"),kind:"text"}]}},Y=4;function $({record:e,children:t}){return f(D,{record:e,dateWords:R,children:t})}export{$ as CurrentRecordProvider,F as DeclaredRecordTypeProvider,Y as SAMPLE_PICTURE_COUNT,W as SAMPLE_RECORD,B as editorPageDrawsOtherRecord,j as recordFacts,m as recordFieldSpecs,M as recordPictures,y as useCurrentRecord,b as useCurrentRecordOf,U as useDeclaredRecordType,L as useDrawsOtherRecord};
@@ -1 +1 @@
1
- "use client";import{jsx as a}from"react/jsx-runtime";import{renderConfig as o}from"./render-config.js";import i from"efficient-web-builder/render/lib/document/page-render";import{siteWidthsMetadata as n}from"efficient-web-builder/format/lib/content/section-width";import{siteThemeMetadata as m}from"efficient-web-builder/format/lib/theme";function d({sectionBackgroundWidth:t,sectionContentWidth:e,theme:r}){return{...n(t,e),...m(r)}}function f({data:t,...e}){return a(i,{config:o(),data:t,metadata:d(e)})}export{f as default,d as renderMetadata};
1
+ "use client";import{jsx as a}from"react/jsx-runtime";import{renderConfig as c}from"./render-config.js";import u from"efficient-web-builder/render/lib/document/page-render";import{siteWidthsMetadata as h}from"efficient-web-builder/format/lib/content/section-width";import{siteThemeMetadata as g}from"efficient-web-builder/format/lib/theme";import{publishedPageData as l}from"efficient-web-builder/render/lib/document/published-passes";import{useMemo as m}from"react";import x from"../../components/PostListStartsProvider.js";import{postListStartsOf as d}from"../content/post-list-continue.js";function M({sectionBackgroundWidth:t,sectionContentWidth:r,theme:e}){return{...h(t,r),...g(e)}}function P({data:t,...r}){const{sectionBackgroundWidth:e,sectionContentWidth:s,theme:i}=r,o=m(()=>M({sectionBackgroundWidth:e,sectionContentWidth:s,theme:i}),[e,s,i]),{starts:f,posts:p}=m(()=>{const n=d(t);return Object.keys(n.starts).length===0?n:d(l(t,o))},[t,o]);return a(x,{starts:f,posts:p,children:a(u,{config:c(),data:t,metadata:o})})}export{P as default,M as renderMetadata};
@@ -39,7 +39,7 @@ export declare function parseOpeningWeek(text: string | undefined): OpeningWeek
39
39
  export declare function readOpeningRow(rows: readonly SourceRow[]): OpeningRow | null;
40
40
  export declare function clockLabel(minute: number): string;
41
41
  export declare const periodLabel: (period: OpeningPeriod) => string;
42
- export declare function momentIn(zone: string, instant: number | Date): OpeningMoment;
42
+ export declare function momentIn(zone: string, instant: number | Date): OpeningMoment | null;
43
43
  export declare function openingStatus(week: OpeningWeek, now: OpeningMoment): OpeningStatus;
44
44
  export declare function badgeLabel(status: OpeningStatus): string;
45
45
  export interface WeekLine {
@@ -1 +1 @@
1
- const p={days:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],shortDays:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],closed:"Closed",openNow:"Open now",until:"until",opens:"opens",today:"today",am:"am",pm:"pm"},a=1440,m=/^\s*(\d)\s*:\s*(\d{1,4})\s*-\s*(\d{1,4})\s*$/;function h(e){const n=Array.from({length:7},()=>[]);let o=!1;for(const t of(e??"").split(";")){const r=m.exec(t);if(!r)continue;const s=Number(r[1]),u=Number(r[2]),c=Number(r[3]);s>6||u>a-1||c<=u||c>2*a-1||c-u>a||(n[s].push({opens:u,closes:c}),o=!0)}if(!o)return null;for(const t of n)t.sort((r,s)=>r.opens-s.opens);return n}function $(e){const n=e[0];if(!n)return null;const o=h(n.week??"");return{week:o,zone:o?(n.zone??"").trim():"",hours:(n.hours??"").split(/\r?\n/).map(t=>t.trim()).filter(Boolean)}}function l(e){const n=(e%a+a)%a,o=Math.floor(n/60),t=n%60,r=o%12||12,s=o<12?p.am:p.pm;return t?`${r}:${String(t).padStart(2,"0")} ${s}`:`${r} ${s}`}const x=e=>`${l(e.opens)} – ${l(e.closes)}`,N={Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6};function S(e){const n={weekday:"short",hour:"2-digit",minute:"2-digit",hourCycle:"h23"};if(e)try{return new Intl.DateTimeFormat("en-US",{...n,timeZone:e})}catch{}return new Intl.DateTimeFormat("en-US",n)}function w(e,n){const o=S(e).formatToParts(n),t=s=>o.find(u=>u.type===s)?.value??"",r=Number(t("hour"))%24;return{day:N[t("weekday")]??0,minute:r*60+Number(t("minute"))}}function D(e,n){const{day:o,minute:t}=n,r=e[o]??[],s=r.find(i=>i.opens<=t&&t<i.closes);if(s)return{open:!0,until:s.closes};const c=(e[(o+6)%7]??[]).find(i=>i.closes>a&&t+a<i.closes);if(c)return{open:!0,until:c.closes};const d=r.find(i=>i.opens>t);if(d)return{open:!1,next:{inDays:0,day:o,opens:d.opens}};for(let i=1;i<=7;i+=1){const f=(o+i)%7,y=e[f]?.[0];if(y)return{open:!1,next:{inDays:i,day:f,opens:y.opens}}}return{open:!1,next:null}}function E(e){const n=p;if(e.open)return`${n.openNow} · ${n.until} ${l(e.until)}`;if(!e.next)return n.closed;const o=e.next.inDays===0?n.today:n.shortDays[e.next.day];return`${n.closed} · ${n.opens} ${o} ${l(e.next.opens)}`}function g(e){return e.map((n,o)=>({day:o,name:p.days[o],periods:n.map(x).join(", "),closed:n.length===0}))}const T="0:600-1560;1:600-1560;2:600-1560;3:600-1560;4:600-1620;5:600-1620;6:600-1500",b={day:0,minute:1200};export{b as OPENING_SAMPLE_MOMENT,T as OPENING_SAMPLE_WEEK,p as OPENING_WORDS,E as badgeLabel,l as clockLabel,w as momentIn,D as openingStatus,h as parseOpeningWeek,x as periodLabel,$ as readOpeningRow,g as weekLines};
1
+ import{firstReadableZone as y}from"../zone.js";const l={days:["Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],shortDays:["Mon","Tue","Wed","Thu","Fri","Sat","Sun"],closed:"Closed",openNow:"Open now",until:"until",opens:"opens",today:"today",am:"am",pm:"pm"},a=1440,h=/^\s*(\d)\s*:\s*(\d{1,4})\s*-\s*(\d{1,4})\s*$/;function x(e){const n=Array.from({length:7},()=>[]);let o=!1;for(const r of(e??"").split(";")){const t=h.exec(r);if(!t)continue;const s=Number(t[1]),c=Number(t[2]),u=Number(t[3]);s>6||c>a-1||u<=c||u>2*a-1||u-c>a||(n[s].push({opens:c,closes:u}),o=!0)}if(!o)return null;for(const r of n)r.sort((t,s)=>t.opens-s.opens);return n}function w(e){const n=e[0];if(!n)return null;const o=x(n.week??"");return{week:o,zone:o?(n.zone??"").trim():"",hours:(n.hours??"").split(/\r?\n/).map(r=>r.trim()).filter(Boolean)}}function p(e){const n=(e%a+a)%a,o=Math.floor(n/60),r=n%60,t=o%12||12,s=o<12?l.am:l.pm;return r?`${t}:${String(r).padStart(2,"0")} ${s}`:`${t} ${s}`}const N=e=>`${p(e.opens)} – ${p(e.closes)}`,$={Mon:0,Tue:1,Wed:2,Thu:3,Fri:4,Sat:5,Sun:6};function S(e){const n=y(e);return n?new Intl.DateTimeFormat("en-US",{weekday:"short",hour:"2-digit",minute:"2-digit",hourCycle:"h23",timeZone:n}):null}function D(e,n){const o=S(e);if(!o)return null;const r=o.formatToParts(n),t=c=>r.find(u=>u.type===c)?.value??"",s=Number(t("hour"))%24;return{day:$[t("weekday")]??0,minute:s*60+Number(t("minute"))}}function g(e,n){const{day:o,minute:r}=n,t=e[o]??[],s=t.find(i=>i.opens<=r&&r<i.closes);if(s)return{open:!0,until:s.closes};const u=(e[(o+6)%7]??[]).find(i=>i.closes>a&&r+a<i.closes);if(u)return{open:!0,until:u.closes};const d=t.find(i=>i.opens>r);if(d)return{open:!1,next:{inDays:0,day:o,opens:d.opens}};for(let i=1;i<=7;i+=1){const f=(o+i)%7,m=e[f]?.[0];if(m)return{open:!1,next:{inDays:i,day:f,opens:m.opens}}}return{open:!1,next:null}}function b(e){const n=l;if(e.open)return`${n.openNow} · ${n.until} ${p(e.until)}`;if(!e.next)return n.closed;const o=e.next.inDays===0?n.today:n.shortDays[e.next.day];return`${n.closed} · ${n.opens} ${o} ${p(e.next.opens)}`}function T(e){return e.map((n,o)=>({day:o,name:l.days[o],periods:n.map(N).join(", "),closed:n.length===0}))}const M="0:600-1560;1:600-1560;2:600-1560;3:600-1560;4:600-1620;5:600-1620;6:600-1500",O={day:0,minute:1200};export{O as OPENING_SAMPLE_MOMENT,M as OPENING_SAMPLE_WEEK,l as OPENING_WORDS,b as badgeLabel,p as clockLabel,D as momentIn,g as openingStatus,x as parseOpeningWeek,N as periodLabel,w as readOpeningRow,T as weekLines};
@@ -116,7 +116,7 @@ export interface Choice {
116
116
  }
117
117
  export declare function countryChoices(kept: string, locale?: string): Choice[];
118
118
  export declare function currencyChoices(kept: string, locale?: string): Choice[];
119
- export declare function linkEnds(expiresAt: string, locale?: string, timeZone?: string): string;
119
+ export declare function linkEnds(expiresAt: string, locale?: string, zone?: string): string;
120
120
  export declare function linkTokenOf(pathname: string | null | undefined): string;
121
121
  export declare const SIGN_UP_VERIFY_PATH = "/api/business-sign-ups/verifications/";
122
122
  export type BuildStatus = "pending" | "provisioning" | "ready" | "failed";
@@ -1 +1 @@
1
- import{COUNTRY_CODES as h,CURRENCY_CODES as k}from"./sign-up-catalogue.js";const v={firstName:"",lastName:"",email:"",company:"",slug:"",country:"",currency:""},w=["slug_malformed","slug_reserved","slug_taken"],d=e=>typeof e=="string"&&w.includes(e),C=400,t={title:"Create your {name} workspace",freeLine:"Free to start. No card needed.",firstName:"First name",lastName:"Last name",email:"Work email",company:"Company name",address:"Workspace address",country:"Country",currency:"Currency",countryHint:"Your shop sells in this currency. The country sets its tax and shipping defaults. Both can be changed later.",checking:"Checking",available:"Available",submit:"Create workspace",sending:"Sending…",agree:"By creating a workspace you agree to the {terms} and {privacy}.",terms:"Terms",privacy:"Privacy Policy",haveOne:"Already have a workspace?",find:"Find my workspace",required:"Fill this in.",companyShort:"Use at least 2 characters.",emailWrong:"Enter an email address, like name@company.com.",notOffered:"That choice is not offered. Pick another.",wrong:"Check this and try again.",slugProblem:{slug_malformed:"Use 3 to 30 lower-case letters, digits or single hyphens, starting with a letter.",slug_reserved:"That address is kept for the platform. Choose another.",slug_taken:"That address is taken. Choose another."},trouble:{closed:"Signing up is closed just now.",dailyLimit:"Too many workspaces signed up today. Try again tomorrow.",unavailable:"Signing up is not available just now. Try again later.",tooMany:"You have asked a few times in a row. Wait a minute, then try again.",unreachable:"We couldn't reach the server. Check your connection and try again.",failed:"Something went wrong and nothing was sent. Try again."},closedTitle:"Signing up is closed just now",closedBody:"New {name} workspaces cannot be made just now.",closedLeave:"Leave your email and we'll tell you when it opens.",tellMe:"Tell me when it opens",waitingDone:"Thanks. We'll email {email} when sign-up opens.",sentTitle:"Check your email",sentBody:"We sent a link to {email}. Open it to set up {company}.",sentUntil:"The link works once, until {when}. Asking again sends a new link, and the old one stops working.",sendAgain:"Send it again",sendingAgain:"Sending…",sentAgain:"A new link is on its way. The old one no longer works.",change:"Change the details"};function m(e,n){return e.replace(/\{(\w+)\}/g,(r,i)=>n[i]??r)}function g(e){return e.trim().toLowerCase().replace(/_/g,"-")}function P(e){return e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")}function I(e,n){const r=(e??"").trim().toLowerCase().replace(/^\.+/,"").replace(/\.+$/,"");if(r)return`.${r}`;const i=n.toLowerCase().replace(/\.$/,"").replace(/^www\./,"");return i?`.${i}`:""}const a=e=>typeof e=="string"?e:"";function W(e,n){const r=new URLSearchParams;n&&r.set("slug",n),e&&r.set("product",e);const i=r.toString();return`/api/business-sign-ups/availability/${i?`?${i}`:""}`}const L="/api/business-sign-ups/",O="/api/business-sign-ups/waiting-list/";function U(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{};return r.code==="sign_up_open"?{open:!0,email:null,trouble:null}:r.code==="sign_up_waiting_list_unavailable"?{open:!1,email:null,trouble:"unavailable"}:e===400&&"email"in r?{open:!1,email:t.emailWrong,trouble:null}:e===0?{open:!1,email:null,trouble:"unreachable"}:e===429?{open:!1,email:null,trouble:"tooMany"}:{open:!1,email:null,trouble:"failed"}}function $(e){const n=e.trim();return n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?null:t.emailWrong:t.required}function E(e){const n=e&&typeof e=="object"?e:{};return{open:n.open===!0,country:a(n.country),currency:a(n.currency),slugAvailable:typeof n.slug_available=="boolean"?n.slug_available:null,slugProblem:d(n.slug_problem)?n.slug_problem:null}}function F(e){return e.slugAvailable?{state:"available"}:e.slugProblem?{state:"problem",problem:e.slugProblem}:{state:"unknown"}}function R(e){const n=e&&typeof e=="object"?e:{};return{slug:a(n.slug),expiresAt:a(n.expires_at)}}function D(e,n,r){return{business_name:e.company.trim(),slug:g(e.slug),first_name:e.firstName.trim(),last_name:e.lastName.trim(),email:e.email.trim(),...n?{product:n}:{},...r&&e.country?{country:e.country}:{},...r&&e.currency?{currency:e.currency}:{}}}function j(e,n){const r={};e.firstName.trim()||(r.firstName=t.required);const i=e.email.trim();i?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i)||(r.email=t.emailWrong):r.email=t.required;const o=e.company.trim();return o?o.length<2&&(r.company=t.companyShort):r.company=t.required,g(e.slug)?n.state==="problem"&&(r.slug=t.slugProblem[n.problem]):r.slug=t.required,r}const _={business_name:"company",slug:"slug",first_name:"firstName",last_name:"lastName",email:"email",country:"country",currency:"currency"},u={self_sign_up_off:"closed",sign_up_daily_limit:"dailyLimit",sign_up_unavailable:"unavailable",sign_up_plan_missing:"unavailable"};function B(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},i=r.code;if(d(i))return{fields:{slug:t.slugProblem[i]},trouble:null};if(typeof i=="string"&&u[i])return{fields:{},trouble:u[i]};if(e===0)return{fields:{},trouble:"unreachable"};if(e===429)return{fields:{},trouble:"tooMany"};if(e===400){const o={};for(const l of Object.keys(r)){const s=_[l];s&&(o[s]=s==="slug"?t.slugProblem.slug_malformed:s==="email"?t.emailWrong:s==="country"||s==="currency"?t.notOffered:t.wrong)}if(Object.keys(o).length)return{fields:o,trouble:null}}return{fields:{},trouble:"failed"}}function f(e,n){try{const r=new Intl.DisplayNames(n?[n]:void 0,{type:e,fallback:"code"});return i=>r.of(i)??i}catch{return r=>r}}const y=(e,n)=>n&&!e.includes(n)?[...e,n]:[...e],T=(e,n)=>{const r=new Intl.Collator(n);return e.sort((i,o)=>r.compare(i.label,o.label))};function M(e,n){const r=f("region",n);return T(y(h,e).map(i=>({value:i,label:r(i)})),n)}function H(e,n){const r=f("currency",n);return y(k,e).sort().map(i=>{const o=r(i);return{value:i,label:o===i?i:`${i} · ${o}`}})}function K(e,n,r){const i=new Date(e);if(!e||Number.isNaN(i.getTime()))return"";const o=p=>new Intl.DateTimeFormat(n,{timeZone:r,...p}).format(i),l=`${o({weekday:"long"})} ${o({day:"numeric"})} ${o({month:"long"})}`,s=o({hour:"numeric",minute:"2-digit",hour12:!0}).replace(/\s?([AP])M$/i,(p,b)=>` ${b.toLowerCase()}m`);return`${l}, ${s}`}const x=/^\/sign-up\/verify\/([^/?#]+)\/?$/;function Y(e){const n=x.exec(e??"");if(!n)return"";try{return decodeURIComponent(n[1])}catch{return n[1]}}const q="/api/business-sign-ups/verifications/",A=["pending","provisioning","ready","failed"];function G(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},i=a(r.code),o=a(r.slug);if(e===202||i==="sign_up_already_verified"){const l=a(r.provisioning_status),s=a(r.business_name);return A.includes(l)?l==="ready"?{kind:"ready",company:s,slug:o}:l==="failed"?{kind:"failed",company:s,slug:o}:{kind:"building",company:s,slug:o,status:l}:{kind:"gone"}}return d(i)?{kind:"taken",slug:o}:i==="sign_up_daily_limit"?{kind:"dailyLimit"}:i==="self_sign_up_off"?{kind:"closed"}:i&&u[i]?{kind:"trouble",trouble:u[i]}:e===400&&"token"in r?{kind:"gone"}:e===0?{kind:"trouble",trouble:"unreachable"}:e===429?{kind:"trouble",trouble:"tooMany"}:{kind:"trouble",trouble:"failed"}}function z(e){return e.kind==="building"||e.kind==="trouble"&&e.trouble!=="failed"}function V(e){return e<5?2e3:e<20?5e3:15e3}const J=40;function Q(e,n,r){const i=e.kind==="failed"?"stopped":"running";return[{words:c.confirmed,at:"done"},{words:m(c.reserved,{address:`${e.slug}${r}`}),at:"done"},{words:c.building,at:i},...e.kind==="failed"?[]:[{words:m(c.adding,{name:n}),at:"waiting"}]]}const X=e=>e==="pending"?50:75,c={settingUp:"Setting up {company}",confirmed:"Email confirmed",reserved:"Address reserved: {address}",building:"Building your workspace",adding:"Adding {name}",aboutTen:"This takes about 10 seconds. You can close this page: we'll email you when it's ready.",readyTitle:"Your workspace is ready",workspace:"Workspace",address:"Address",plan:"Plan",planName:"{name} Free",readyNext:"We've emailed you a link to set your password. It's the next step.",failedBody:"We couldn't finish building your workspace. We've been told, and we'll email you when it's ready. You don't need to sign up again.",goneTitle:"This link has run out",goneBody:"This link is not right, or it has run out. Sign up again and we'll send a new one.",again:"Sign up again",takenTitle:"That address has gone",takenBody:"{address} was taken before you opened your link. Choose another address and we'll send a new link.",takenBodyBare:"That address was taken before you opened your link. Choose another address and we'll send a new link.",chooseAnother:"Choose another address",limitTitle:"Not today",limitNext:"Your link still works until it runs out. Open it again tomorrow.",checking:"Checking your link"},Z="/api/business-sign-ups/workspace-finds/",ee="/api/business-sign-ups/workspace-finds/openings/",S=/^\/find\/([^/?#]+)\/?$/;function ne(e){const n=S.exec(e??"");if(!n)return"";try{return decodeURIComponent(n[1])}catch{return n[1]}}const re={title:"Find your workspace",intro:"Enter your work email. We'll send you the address of every workspace you belong to.",submit:"Email me my workspaces",newHere:"New to {name}?",create:"Create a workspace",sentTitle:"Check your email",sentBody:"If {email} belongs to a workspace, the links are on their way.",sentNote:"They work for 30 minutes. Nothing arrives if the address isn't in any workspace.",another:"Use another email",linkGone:"This link is not right, or it has run out. Ask for your workspaces again.",opening:"Opening your workspace"};function ie(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{};return r.code==="workspace_find_unavailable"?{email:null,trouble:"unavailable"}:e===400&&"email"in r?{email:t.emailWrong,trouble:null}:e===0?{email:null,trouble:"unreachable"}:e===429?{email:null,trouble:"tooMany"}:{email:null,trouble:"failed"}}function oe(e){const n=e&&typeof e=="object"?a(e.sign_in_url):"";return/^https?:\/\/[^\s]+$/i.test(n)?n:""}export{C as CHECK_AFTER_MS,v as EMPTY_DRAFT,re as FIND_WORDS,J as LINK_ASKS_AT_MOST,c as LINK_WORDS,L as SIGN_UP_PATH,q as SIGN_UP_VERIFY_PATH,O as SIGN_UP_WAITING_PATH,t as SIGN_UP_WORDS,w as SLUG_PROBLEMS,Z as WORKSPACE_FINDS_PATH,ee as WORKSPACE_FIND_OPEN_PATH,I as addressSuffix,X as buildProgress,Q as buildSteps,j as checkDraft,$ as checkWaitingEmail,M as countryChoices,H as currencyChoices,m as fill,ne as findTokenOf,d as isSlugProblem,V as linkAskAfterMs,z as linkAsksAgain,K as linkEnds,Y as linkTokenOf,g as normaliseSlug,ie as readFindRefusal,G as readLinkAnswer,E as readSignUpAvailability,B as readSignUpRefusal,R as readSignUpSent,U as readWaitingRefusal,oe as signInUrlOf,W as signUpAvailabilityPath,D as signUpBody,F as slugCheckOf,P as slugFromName};
1
+ import{COUNTRY_CODES as y,CURRENCY_CODES as b}from"./sign-up-catalogue.js";import{formatDateTime as h}from"efficient-shell/format";import{firstReadableZone as k,runtimeLocale as w}from"../zone.js";const L={firstName:"",lastName:"",email:"",company:"",slug:"",country:"",currency:""},_=["slug_malformed","slug_reserved","slug_taken"],d=e=>typeof e=="string"&&_.includes(e),W=400,t={title:"Create your {name} workspace",freeLine:"Free to start. No card needed.",firstName:"First name",lastName:"Last name",email:"Work email",company:"Company name",address:"Workspace address",country:"Country",currency:"Currency",countryHint:"Your shop sells in this currency. The country sets its tax and shipping defaults. Both can be changed later.",checking:"Checking",available:"Available",submit:"Create workspace",sending:"Sending…",agree:"By creating a workspace you agree to the {terms} and {privacy}.",terms:"Terms",privacy:"Privacy Policy",haveOne:"Already have a workspace?",find:"Find my workspace",required:"Fill this in.",companyShort:"Use at least 2 characters.",emailWrong:"Enter an email address, like name@company.com.",notOffered:"That choice is not offered. Pick another.",wrong:"Check this and try again.",slugProblem:{slug_malformed:"Use 3 to 30 lower-case letters, digits or single hyphens, starting with a letter.",slug_reserved:"That address is kept for the platform. Choose another.",slug_taken:"That address is taken. Choose another."},trouble:{closed:"Signing up is closed just now.",dailyLimit:"Too many workspaces signed up today. Try again tomorrow.",unavailable:"Signing up is not available just now. Try again later.",tooMany:"You have asked a few times in a row. Wait a minute, then try again.",unreachable:"We couldn't reach the server. Check your connection and try again.",failed:"Something went wrong and nothing was sent. Try again."},closedTitle:"Signing up is closed just now",closedBody:"New {name} workspaces cannot be made just now.",closedLeave:"Leave your email and we'll tell you when it opens.",tellMe:"Tell me when it opens",waitingDone:"Thanks. We'll email {email} when sign-up opens.",sentTitle:"Check your email",sentBody:"We sent a link to {email}. Open it to set up {company}.",sentUntil:"The link works once, until {when}. Asking again sends a new link, and the old one stops working.",sendAgain:"Send it again",sendingAgain:"Sending…",sentAgain:"A new link is on its way. The old one no longer works.",change:"Change the details"};function p(e,n){return e.replace(/\{(\w+)\}/g,(r,o)=>n[o]??r)}function m(e){return e.trim().toLowerCase().replace(/_/g,"-")}function O(e){return e.normalize("NFKD").replace(/[̀-ͯ]/g,"").toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-").replace(/^[^a-z]+/,"").slice(0,30).replace(/-+$/,"")}function U(e,n){const r=(e??"").trim().toLowerCase().replace(/^\.+/,"").replace(/\.+$/,"");if(r)return`.${r}`;const o=n.toLowerCase().replace(/\.$/,"").replace(/^www\./,"");return o?`.${o}`:""}const s=e=>typeof e=="string"?e:"";function E(e,n){const r=new URLSearchParams;n&&r.set("slug",n),e&&r.set("product",e);const o=r.toString();return`/api/business-sign-ups/availability/${o?`?${o}`:""}`}const R="/api/business-sign-ups/",D="/api/business-sign-ups/waiting-list/";function F(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{};return r.code==="sign_up_open"?{open:!0,email:null,trouble:null}:r.code==="sign_up_waiting_list_unavailable"?{open:!1,email:null,trouble:"unavailable"}:e===400&&"email"in r?{open:!1,email:t.emailWrong,trouble:null}:e===0?{open:!1,email:null,trouble:"unreachable"}:e===429?{open:!1,email:null,trouble:"tooMany"}:{open:!1,email:null,trouble:"failed"}}function j(e){const n=e.trim();return n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?null:t.emailWrong:t.required}function $(e){const n=e&&typeof e=="object"?e:{};return{open:n.open===!0,country:s(n.country),currency:s(n.currency),slugAvailable:typeof n.slug_available=="boolean"?n.slug_available:null,slugProblem:d(n.slug_problem)?n.slug_problem:null}}function B(e){return e.slugAvailable?{state:"available"}:e.slugProblem?{state:"problem",problem:e.slugProblem}:{state:"unknown"}}function K(e){const n=e&&typeof e=="object"?e:{};return{slug:s(n.slug),expiresAt:s(n.expires_at)}}function M(e,n,r){return{business_name:e.company.trim(),slug:m(e.slug),first_name:e.firstName.trim(),last_name:e.lastName.trim(),email:e.email.trim(),...n?{product:n}:{},...r&&e.country?{country:e.country}:{},...r&&e.currency?{currency:e.currency}:{}}}function Y(e,n){const r={};e.firstName.trim()||(r.firstName=t.required);const o=e.email.trim();o?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)||(r.email=t.emailWrong):r.email=t.required;const i=e.company.trim();return i?i.length<2&&(r.company=t.companyShort):r.company=t.required,m(e.slug)?n.state==="problem"&&(r.slug=t.slugProblem[n.problem]):r.slug=t.required,r}const T={business_name:"company",slug:"slug",first_name:"firstName",last_name:"lastName",email:"email",country:"country",currency:"currency"},u={self_sign_up_off:"closed",sign_up_daily_limit:"dailyLimit",sign_up_unavailable:"unavailable",sign_up_plan_missing:"unavailable"};function H(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=r.code;if(d(o))return{fields:{slug:t.slugProblem[o]},trouble:null};if(typeof o=="string"&&u[o])return{fields:{},trouble:u[o]};if(e===0)return{fields:{},trouble:"unreachable"};if(e===429)return{fields:{},trouble:"tooMany"};if(e===400){const i={};for(const l of Object.keys(r)){const a=T[l];a&&(i[a]=a==="slug"?t.slugProblem.slug_malformed:a==="email"?t.emailWrong:a==="country"||a==="currency"?t.notOffered:t.wrong)}if(Object.keys(i).length)return{fields:i,trouble:null}}return{fields:{},trouble:"failed"}}function g(e,n){try{const r=new Intl.DisplayNames(n?[n]:void 0,{type:e,fallback:"code"});return o=>r.of(o)??o}catch{return r=>r}}const f=(e,n)=>n&&!e.includes(n)?[...e,n]:[...e],x=(e,n)=>{const r=new Intl.Collator(n);return e.sort((o,i)=>r.compare(o.label,i.label))};function q(e,n){const r=g("region",n);return x(f(y,e).map(o=>({value:o,label:r(o)})),n)}function G(e,n){const r=g("currency",n);return f(b,e).sort().map(o=>{const i=r(o);return{value:o,label:i===o?o:`${o} · ${i}`}})}function z(e,n,r){const o=k(r??"");return!e||Number.isNaN(new Date(e).getTime())||!o?"":h(e,{locale:n||w(),timeZone:o,style:A})}const A={weekday:"long",day:"numeric",month:"long"},S=/^\/sign-up\/verify\/([^/?#]+)\/?$/;function Z(e){const n=S.exec(e??"");if(!n)return"";try{return decodeURIComponent(n[1])}catch{return n[1]}}const V="/api/business-sign-ups/verifications/",N=["pending","provisioning","ready","failed"];function J(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{},o=s(r.code),i=s(r.slug);if(e===202||o==="sign_up_already_verified"){const l=s(r.provisioning_status),a=s(r.business_name);return N.includes(l)?l==="ready"?{kind:"ready",company:a,slug:i}:l==="failed"?{kind:"failed",company:a,slug:i}:{kind:"building",company:a,slug:i,status:l}:{kind:"gone"}}return d(o)?{kind:"taken",slug:i}:o==="sign_up_daily_limit"?{kind:"dailyLimit"}:o==="self_sign_up_off"?{kind:"closed"}:o&&u[o]?{kind:"trouble",trouble:u[o]}:e===400&&"token"in r?{kind:"gone"}:e===0?{kind:"trouble",trouble:"unreachable"}:e===429?{kind:"trouble",trouble:"tooMany"}:{kind:"trouble",trouble:"failed"}}function Q(e){return e.kind==="building"||e.kind==="trouble"&&e.trouble!=="failed"}function X(e){return e<5?2e3:e<20?5e3:15e3}const ee=40;function ne(e,n,r){const o=e.kind==="failed"?"stopped":"running";return[{words:c.confirmed,at:"done"},{words:p(c.reserved,{address:`${e.slug}${r}`}),at:"done"},{words:c.building,at:o},...e.kind==="failed"?[]:[{words:p(c.adding,{name:n}),at:"waiting"}]]}const re=e=>e==="pending"?50:75,c={settingUp:"Setting up {company}",confirmed:"Email confirmed",reserved:"Address reserved: {address}",building:"Building your workspace",adding:"Adding {name}",aboutTen:"This takes about 10 seconds. You can close this page: we'll email you when it's ready.",readyTitle:"Your workspace is ready",workspace:"Workspace",address:"Address",plan:"Plan",planName:"{name} Free",readyNext:"We've emailed you a link to set your password. It's the next step.",failedBody:"We couldn't finish building your workspace. We've been told, and we'll email you when it's ready. You don't need to sign up again.",goneTitle:"This link has run out",goneBody:"This link is not right, or it has run out. Sign up again and we'll send a new one.",again:"Sign up again",takenTitle:"That address has gone",takenBody:"{address} was taken before you opened your link. Choose another address and we'll send a new link.",takenBodyBare:"That address was taken before you opened your link. Choose another address and we'll send a new link.",chooseAnother:"Choose another address",limitTitle:"Not today",limitNext:"Your link still works until it runs out. Open it again tomorrow.",checking:"Checking your link"},oe="/api/business-sign-ups/workspace-finds/",ie="/api/business-sign-ups/workspace-finds/openings/",v=/^\/find\/([^/?#]+)\/?$/;function te(e){const n=v.exec(e??"");if(!n)return"";try{return decodeURIComponent(n[1])}catch{return n[1]}}const ae={title:"Find your workspace",intro:"Enter your work email. We'll send you the address of every workspace you belong to.",submit:"Email me my workspaces",newHere:"New to {name}?",create:"Create a workspace",sentTitle:"Check your email",sentBody:"If {email} belongs to a workspace, the links are on their way.",sentNote:"They work for 30 minutes. Nothing arrives if the address isn't in any workspace.",another:"Use another email",linkGone:"This link is not right, or it has run out. Ask for your workspaces again.",opening:"Opening your workspace"};function se(e,n){const r=n&&typeof n=="object"&&!Array.isArray(n)?n:{};return r.code==="workspace_find_unavailable"?{email:null,trouble:"unavailable"}:e===400&&"email"in r?{email:t.emailWrong,trouble:null}:e===0?{email:null,trouble:"unreachable"}:e===429?{email:null,trouble:"tooMany"}:{email:null,trouble:"failed"}}function le(e){const n=e&&typeof e=="object"?s(e.sign_in_url):"";return/^https?:\/\/[^\s]+$/i.test(n)?n:""}export{W as CHECK_AFTER_MS,L as EMPTY_DRAFT,ae as FIND_WORDS,ee as LINK_ASKS_AT_MOST,c as LINK_WORDS,R as SIGN_UP_PATH,V as SIGN_UP_VERIFY_PATH,D as SIGN_UP_WAITING_PATH,t as SIGN_UP_WORDS,_ as SLUG_PROBLEMS,oe as WORKSPACE_FINDS_PATH,ie as WORKSPACE_FIND_OPEN_PATH,U as addressSuffix,re as buildProgress,ne as buildSteps,Y as checkDraft,j as checkWaitingEmail,q as countryChoices,G as currencyChoices,p as fill,te as findTokenOf,d as isSlugProblem,X as linkAskAfterMs,Q as linkAsksAgain,z as linkEnds,Z as linkTokenOf,m as normaliseSlug,se as readFindRefusal,J as readLinkAnswer,$ as readSignUpAvailability,H as readSignUpRefusal,K as readSignUpSent,F as readWaitingRefusal,le as signInUrlOf,E as signUpAvailabilityPath,M as signUpBody,B as slugCheckOf,O as slugFromName};
@@ -0,0 +1,2 @@
1
+ export declare const runtimeLocale: () => string;
2
+ export declare function firstReadableZone(...zones: readonly string[]): string;
@@ -0,0 +1 @@
1
+ import{knownZone as o}from"efficient-shell/format";const t=()=>new Intl.DateTimeFormat().resolvedOptions().locale;function r(...e){return e.find(o)??""}export{r as firstReadableZone,t as runtimeLocale};
package/dist/words.d.ts CHANGED
@@ -1679,6 +1679,7 @@ export type StorefrontBlocksPhrase =
1679
1679
  | "Contact us"
1680
1680
  | "Contacts"
1681
1681
  | "Content source"
1682
+ | "Continue the list above"
1682
1683
  | "Controls"
1683
1684
  | "Copyright"
1684
1685
  | "Could not load header settings."
@@ -2167,6 +2168,7 @@ export type StorefrontBlocksPhrase =
2167
2168
  | "Specifications *table.*"
2168
2169
  | "Speed rating"
2169
2170
  | "Staggered spread"
2171
+ | "Starts after the posts the list above shows."
2170
2172
  | "Status rail"
2171
2173
  | "Step"
2172
2174
  | "Sticky header"