efficient-storefront-blocks 0.63.0 → 0.65.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 (40) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/chunks/{EditorPreviewCheckout-6776GNNO.js → EditorPreviewCheckout-4KZCYPQT.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-GTIZ4RNX.js → SiteEditorProvider-ZYGNRWSB.js} +1 -1
  4. package/dist/chunks/{chunk-JBLNH3P5.js → chunk-GR7OHU32.js} +1 -1
  5. package/dist/chunks/{chunk-A3PXLZZP.js → chunk-OU2WWXMT.js} +1 -1
  6. package/dist/chunks/chunk-YAO6XQYA.js +250 -0
  7. package/dist/chunks/{fitment-data-DGKKOAWL.js → fitment-data-IKFCBT6E.js} +1 -1
  8. package/dist/consent.js +1 -1
  9. package/dist/editor/components/StorefrontEditorFurniture.d.ts +1 -1
  10. package/dist/editor/components/StorefrontEditorFurniture.js +1 -1
  11. package/dist/editor/lib/efficient-backend.d.ts +3 -2
  12. package/dist/editor/lib/efficient-backend.js +1 -1
  13. package/dist/editor/lib/efficient-block-sources.d.ts +2 -0
  14. package/dist/editor/lib/efficient-block-sources.js +1 -1
  15. package/dist/editor/lib/puck/blocks/service/FooterText/fields.js +1 -1
  16. package/dist/editor/lib/storefront-editor-words.d.ts +9 -2
  17. package/dist/editor/lib/storefront-editor-words.js +1 -1
  18. package/dist/index.js +42 -42
  19. package/dist/render/built-with.json +1 -1
  20. package/dist/render/components/ConsentPanel.js +1 -1
  21. package/dist/render/components/ContactRouting.js +1 -1
  22. package/dist/render/components/DetailRows.js +1 -1
  23. package/dist/render/components/FooterText.d.ts +2 -1
  24. package/dist/render/components/FooterText.js +1 -1
  25. package/dist/render/components/Header.js +1 -1
  26. package/dist/render/components/HeaderToolBlocks.d.ts +1 -1
  27. package/dist/render/components/HeaderToolBlocks.js +1 -1
  28. package/dist/render/lib/api/index.d.ts +19 -0
  29. package/dist/render/lib/api/index.js +1 -1
  30. package/dist/render/lib/consent/rules.d.ts +4 -2
  31. package/dist/render/lib/consent/rules.js +1 -1
  32. package/dist/render/lib/content/english-variant.js +1 -1
  33. package/dist/render/lib/puck/blocks/service/FooterText/render.js +1 -1
  34. package/dist/words.d.ts +13 -2
  35. package/dist/words.js +3 -3
  36. package/package.json +2 -2
  37. package/dist/chunks/chunk-VDYPGGK3.js +0 -250
  38. /package/dist/chunks/{chunk-XKTD3BPL.js → chunk-B44XQA2J.js} +0 -0
  39. /package/dist/chunks/{chunk-IT33OG3G.js → chunk-I7BIOONR.js} +0 -0
  40. /package/dist/chunks/{chunk-VDYPGGK3.js.LEGAL.txt → chunk-YAO6XQYA.js.LEGAL.txt} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- "efficient-web-builder": "40.0.0"
2
+ "efficient-web-builder": "40.1.0"
3
3
  }
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useEffect as w,useRef as O,useState as g}from"react";import j from"./SiteSwitch.js";import{CONSENT_CHOICE_BUTTON as k,ConsentEyebrow as E}from"./ConsentBanner.js";import{useModalDismiss as T}from"./useModalDismiss.js";import{CONSENT_BUTTONS as c,GPC_HONOURED as v,PANEL_ROWS as l}from"../lib/consent/rules.js";const _="flex items-center justify-center gap-5 border border-btn bg-btn px-6 py-4 font-mono text-[14px] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",R="text-fg underline decoration-line underline-offset-4";function m({name:n,body:s,checked:o,onChange:t,locked:i=!1}){return a("div",{className:"flex items-start justify-between gap-6 border-t border-line py-5",children:[a("div",{className:"min-w-0",children:[e("div",{className:"font-display text-[17px] text-fg",children:n}),e("p",{className:"mt-1 font-body text-[14px] leading-[1.5] text-fg-dim",children:s})]}),e(j,{checked:o,onChange:r=>t?.(r),ariaLabel:n,disabled:i,className:"flex flex-none cursor-pointer items-center gap-3 pt-1",children:i&&e("span",{className:"order-first font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:c.alwaysOn})})]})}function L({rule:n,analytics:s,ads:o,gpc:t,privacyHref:i,open:r=!0,onSave:d,onClose:x,inline:p=!1}){const[f,b]=g(s),[u,h]=g(o&&!t),y=O(null);if(w(()=>{r&&(b(s),h(o&&!t))},[r,s,o,t]),T({active:!p&&r,onDismiss:x,focusRef:y}),!r)return null;const N=a("div",{ref:y,tabIndex:-1,onClick:C=>C.stopPropagation(),className:"relative w-[min(640px,100%)] overflow-auto border border-line bg-bg p-10 outline-none [border-radius:var(--sf-section-radius,0px)] max-[880px]:max-h-[88dvh] max-[880px]:w-full max-[880px]:border-x-0 max-[880px]:border-b-0 max-[880px]:px-5 max-[880px]:pb-8 max-[880px]:pt-7 max-[880px]:[border-radius:0]",children:[e(E,{text:n.panelEyebrow}),a("h2",{id:"consent-panel-title",className:"mt-4 font-display text-[36px] leading-[1.05] tracking-[-0.01em] text-fg max-[880px]:text-[28px]",children:["Your privacy ",e("span",{className:"font-serif font-light italic text-accent",children:"choices."})]}),t&&a("div",{className:"mt-5 border border-line bg-surface px-4 py-3 font-body text-[14px] leading-[1.5] text-fg",children:[e("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-accent",children:v.title}),e("br",{}),v.body]}),a("div",{className:"mt-6",children:[e(m,{name:l.necessary.name,body:l.necessary.body,checked:!0,locked:!0}),e(m,{name:l.analytics.name,body:l.analytics.body,checked:f,onChange:b}),e(m,{name:n.adsRowName,body:l.ads.body,checked:u,onChange:h,locked:t})]}),a("div",{className:"mt-2 grid grid-cols-3 gap-3 border-t border-line pt-6 max-[880px]:grid-cols-1",children:[e("button",{type:"button",className:_,onClick:()=>d({analytics:f,ads:u&&!t}),children:c.save}),e("button",{type:"button",className:k,onClick:()=>d({analytics:!1,ads:!1}),children:c.reject}),e("button",{type:"button",className:k,onClick:()=>d({analytics:!0,ads:!t}),children:c.accept})]}),i&&a("p",{className:"mt-5 font-body text-[13px] text-fg-dim",children:["More in our"," ",e("a",{className:R,href:i,children:c.privacyPolicy}),"."]})]});return p?e("div",{className:"flex w-full justify-center p-6",children:N}):e("div",{role:"dialog","aria-modal":"true","aria-labelledby":"consent-panel-title",onClick:x,className:"fixed inset-0 z-[95] flex items-center justify-center p-6 backdrop-blur-[8px] max-[880px]:items-end max-[880px]:p-0",style:{background:"color-mix(in oklab, var(--bg) 78%, transparent)"},children:N})}export{L as ConsentPanelView};
1
+ "use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useEffect as O,useRef as S,useState as k}from"react";import j from"./SiteSwitch.js";import{CONSENT_CHOICE_BUTTON as v,ConsentEyebrow as T}from"./ConsentBanner.js";import{useModalDismiss as _}from"./useModalDismiss.js";import{useEnglish as R}from"./EnglishVariant.js";import{useSiteSells as P}from"./SiteRecordContext.js";import{CONSENT_BUTTONS as c,GPC_HONOURED as C,PANEL_ROWS as r}from"../lib/consent/rules.js";const U="flex items-center justify-center gap-5 border border-btn bg-btn px-6 py-4 font-mono text-[14px] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",B="text-fg underline decoration-line underline-offset-4";function m({name:n,body:o,checked:i,onChange:t,locked:l=!1}){return a("div",{className:"flex items-start justify-between gap-6 border-t border-line py-5",children:[a("div",{className:"min-w-0",children:[e("div",{className:"font-display text-[17px] text-fg",children:n}),e("p",{className:"mt-1 font-body text-[14px] leading-[1.5] text-fg-dim",children:o})]}),e(j,{checked:i,onChange:s=>t?.(s),ariaLabel:n,disabled:l,className:"flex flex-none cursor-pointer items-center gap-3 pt-1",children:l&&e("span",{className:"order-first font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:c.alwaysOn})})]})}function K({rule:n,analytics:o,ads:i,gpc:t,privacyHref:l,open:s=!0,onSave:d,onClose:x,inline:p=!1}){const[f,b]=k(o),[u,y]=k(i&&!t),h=P(),w=R(),N=S(null);if(O(()=>{s&&(b(o),y(i&&!t))},[s,o,i,t]),_({active:!p&&s,onDismiss:x,focusRef:N}),!s)return null;const g=a("div",{ref:N,tabIndex:-1,onClick:E=>E.stopPropagation(),className:"relative w-[min(640px,100%)] overflow-auto border border-line bg-bg p-10 outline-none [border-radius:var(--sf-section-radius,0px)] max-[880px]:max-h-[88dvh] max-[880px]:w-full max-[880px]:border-x-0 max-[880px]:border-b-0 max-[880px]:px-5 max-[880px]:pb-8 max-[880px]:pt-7 max-[880px]:[border-radius:0]",children:[e(T,{text:n.panelEyebrow}),a("h2",{id:"consent-panel-title",className:"mt-4 font-display text-[36px] leading-[1.05] tracking-[-0.01em] text-fg max-[880px]:text-[28px]",children:["Your privacy ",e("span",{className:"font-serif font-light italic text-accent",children:"choices."})]}),t&&a("div",{className:"mt-5 border border-line bg-surface px-4 py-3 font-body text-[14px] leading-[1.5] text-fg",children:[e("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-accent",children:w(C.title)}),e("br",{}),C.body]}),a("div",{className:"mt-6",children:[e(m,{name:r.necessary.name,body:h?r.necessary.body:r.necessary.bodyNoSale,checked:!0,locked:!0}),e(m,{name:r.analytics.name,body:r.analytics.body,checked:f,onChange:b}),e(m,{name:n.adsRowName,body:h?r.ads.body:r.ads.bodyNoSale,checked:u,onChange:y,locked:t})]}),a("div",{className:"mt-2 grid grid-cols-3 gap-3 border-t border-line pt-6 max-[880px]:grid-cols-1",children:[e("button",{type:"button",className:U,onClick:()=>d({analytics:f,ads:u&&!t}),children:c.save}),e("button",{type:"button",className:v,onClick:()=>d({analytics:!1,ads:!1}),children:c.reject}),e("button",{type:"button",className:v,onClick:()=>d({analytics:!0,ads:!t}),children:c.accept})]}),l&&a("p",{className:"mt-5 font-body text-[13px] text-fg-dim",children:["More in our"," ",e("a",{className:B,href:l,children:c.privacyPolicy}),"."]})]});return p?e("div",{className:"flex w-full justify-center p-6",children:g}):e("div",{role:"dialog","aria-modal":"true","aria-labelledby":"consent-panel-title",onClick:x,className:"fixed inset-0 z-[95] flex items-center justify-center p-6 backdrop-blur-[8px] max-[880px]:items-end max-[880px]:p-0",style:{background:"color-mix(in oklab, var(--bg) 78%, transparent)"},children:g})}export{K as ConsentPanelView};
@@ -1 +1 @@
1
- "use client";import{jsx as n,jsxs as l,Fragment as Y}from"react/jsx-runtime";import A from"./SectionBand.js";import{useEffect as F,useState as M}from"react";import{OTHER_REASON_ID as h}from"efficient-web-builder/format/lib/content/contact";import{FormFieldInput as T,FormHoneypot as ee,successMessageFor as ne,useBoundForm as te,useFormSubmission as ae}from"./formSubmission.js";import re from"efficient-web-builder/render/components/SectionEyebrow";import le,{FieldCaption as oe}from"./WebFormField.js";import{scrollBehavior as ie}from"efficient-web-builder/render/components/useReducedMotion";import{renderChrome as L,renderGold as $,renderHeadline as se,splitParagraphs as ce}from"efficient-web-builder/render/components/goldPhrases";import{say as q}from"efficient-web-builder/format/lib/editor-words";import{phoneHref as de}from"efficient-web-builder/format/lib/links/phone-href";const t={bodySmall:"text-[length:var(--size-body,14px)]",body:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,18px)]",headingSmall1:"text-[length:var(--size-headingSmall,24px)]",headingSmall2:"text-[length:var(--size-headingSmall,26px)]",labelXs:"text-[length:var(--size-label,10px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"};function P(p){if(p.href)return p.href;const o=(p.value??"").trim();if(o.includes("@"))return`mailto:${o}`;if(/^\+?[\d\s().-]{6,}$/.test(o))return de(o)}function me(p){const o=[],f=new Map;for(const r of p){if(!r.groupId){o.push(r);continue}const d=r.value.trim().toLowerCase(),u=f.get(d);if(u)u.label=`${u.label} · ${r.label}`;else{const b={...r};f.set(d,b),o.push(b)}}return o}function pe(p,o,f){const r=d=>String(d??"").trim().toLowerCase();for(const d of p?.fields??[]){if(d.type!=="select"||!Array.isArray(d.options))continue;const u=d.options.map(String);if(!o.some(s=>u.some(m=>r(m)===r(s.title))))continue;const b=s=>r(s===h?f:o.find(m=>m.id===s)?.title);return{key:d.key,optionFor:s=>u.find(m=>r(m)===b(s)&&b(s)!==""),idFor:s=>{const m=o.find(S=>r(S.title)===r(s));return m?m.id:f&&r(s)===r(f)?h:void 0}}}return null}const B=`border-b border-line bg-transparent py-4 font-display ${t.bodyLarge} tracking-[0.01em] text-fg outline-none transition-colors focus:border-accent`;function fe({routingNumber:p,routingTagline:o,groups:f,formNumber:r,formHeading:d,metaLines:u,showOther:b=!0,otherLabel:s="Other",otherNoteTitle:m,otherNoteBody:S,buttonText:O,consent:_,channels:V,formSlug:R,form:D,editing:C,initialActiveId:y,onActiveChange:H,reasonExtras:G}){const k=[...f.map(e=>e.id),...b?[h]:[]],W=y&&k.includes(y)?y:k[0]??h,[g,w]=M(W);F(()=>{k.includes(g)||w(k[0]??h)},[k.join("|")]),F(()=>{y&&k.includes(y)&&w(y)},[y]);const v=te(R,D),c=ae({form:v,formSlug:R,editing:C}),x=pe(v,f,b?s:void 0),z=e=>{w(e),I(null);const a=x?.optionFor(e);x&&a!==void 0&&c.set(x.key,a),H?.(e)};F(()=>{if(!x||c.valueOf(x.key))return;const e=x.optionFor(g);e!==void 0&&c.set(x.key,e)},[x?.key]);const[X,I]=M(null),N=(V??[]).filter(e=>!e.hidden),Z=e=>X!==null?!e.groupId&&e.value===X:e.groupId===g,J=v===void 0,E=!!v||!!C,[K,Q]=M(!1);return F(()=>{const e=()=>Q(document.documentElement.getAttribute("data-theme")==="light");e();const a=new MutationObserver(e);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[]),l(Y,{children:[l(A,{className:"border-b border-line py-[60px]",style:K?void 0:{background:"var(--section-bg)"},children:[(p||o)&&l("div",{className:"mb-6 flex items-center gap-6 border-b border-line pb-6",children:[p&&n(re,{text:p}),o&&n("span",{className:`font-display ${t.bodySmall} uppercase tracking-[0.04em] text-fg-dim`,children:$(o)})]}),n("div",{className:"sf-card grid grid-cols-4 gap-[2px] border border-line bg-line max-[1100px]:grid-cols-2 max-[700px]:grid-cols-1",children:f.map(e=>{const a=g===e.id;return l("button",{type:"button",onClick:()=>{z(e.id),typeof window<"u"&&window.matchMedia("(max-width: 1100px)").matches&&document.getElementById("contact-form")?.scrollIntoView({behavior:ie(),block:"start"})},className:["flex min-h-[240px] cursor-pointer flex-col gap-4 px-8 py-10 text-left transition-colors",a?"bg-surface outline outline-2 -outline-offset-2 outline-accent":"bg-bg hover:bg-surface"].join(" "),children:[e.eyebrow&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.24em] text-accent`,children:e.eyebrow}),n("h3",{className:`whitespace-pre-line font-heading3 ${t.headingSmall2} font-medium uppercase leading-[1.05] tracking-[-0.02em]`,children:e.title}),e.copy&&n("p",{className:`mt-auto font-display ${t.bodySmall} leading-[1.5] text-fg-dim`,children:e.copy}),e.response&&l("div",{className:`mt-2 flex justify-between border-t border-line pt-4 font-mono ${t.labelSmall} uppercase tracking-[0.22em] text-fg-dim`,children:[n("span",{children:"Response"}),n("strong",{className:"font-normal text-fg",children:e.response})]})]},e.id)})})]}),(E||N.length>0)&&n("section",{id:"contact-form",className:"scroll-mt-[80px] border-b border-line py-20 max-[1100px]:py-[60px]",children:l("div",{className:["mx-auto grid max-w-[var(--sf-site-width,1600px)] gap-20 px-[var(--sf-site-gutter,40px)] max-[1100px]:grid-cols-1 max-[1100px]:gap-[60px] max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",E&&N.length>0?"grid-cols-[1.3fr_1fr]":"grid-cols-1"].join(" "),children:[E&&l("div",{children:[l("div",{className:"mb-8 flex items-end justify-between gap-6 border-b border-line pb-6",children:[l("div",{children:[r&&n("div",{className:`pb-2 font-mono ${t.labelLarge} uppercase tracking-[0.3em] text-accent`,children:$(r)}),d&&n("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(36px,4vw,56px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.03em]",children:se(d,!0)})]}),!!(u&&u.length)&&n("div",{className:`text-right font-mono ${t.labelSmall} uppercase leading-[1.8] tracking-[0.22em] text-fg-dim max-[700px]:text-left`,children:u.map((e,a)=>n("div",{children:e},a))})]}),v?c.done?n("div",{className:`border border-accent bg-accent/[0.08] p-8 font-display ${t.body} leading-[1.6] text-fg-dim`,children:ne(v,"Thanks — we've received your message.")}):l("form",{className:"grid grid-cols-2 gap-5 max-[700px]:grid-cols-1",onSubmit:c.handleSubmit,children:[v.fields.map(e=>n(le,{label:e.label,required:e.required,className:e.type==="textarea"||e.type==="checkbox"?"col-span-2 max-[700px]:col-span-1":void 0,children:n(T,{field:e,value:c.valueOf(e.key),onChange:a=>{c.set(e.key,a);const i=x&&e.key===x.key?x.idFor(a):void 0;i!==void 0&&(w(i),I(null),H?.(i))},className:e.type==="textarea"?`${B} min-h-[140px] resize-y leading-[1.5]`:e.type==="checkbox"?"size-4 self-start accent-accent":B})},e.key)),l("div",{className:"col-span-2 flex flex-col gap-2 max-[700px]:col-span-1",children:[n(oe,{required:!0,children:"Reason"}),l("div",{className:"mt-1 flex flex-wrap gap-2",children:[f.map(e=>{const a=g===e.id;return n("button",{type:"button",onClick:()=>z(e.id),className:[`cursor-pointer border px-4 py-3 font-mono ${t.labelSmall} uppercase tracking-[0.2em] transition-colors`,a?"border-accent bg-accent text-bg":"border-line text-fg-dim hover:text-fg"].join(" "),children:e.title},e.id)}),b&&n("button",{type:"button",onClick:()=>z(h),className:[`cursor-pointer border px-4 py-3 font-mono ${t.labelSmall} uppercase tracking-[0.2em] transition-colors`,g===h?"border-accent bg-accent text-bg":"border-line text-fg-dim hover:text-fg"].join(" "),children:L(s)})]})]}),G?.(g),g===h&&(m||S)&&l("div",{className:"sf-card col-span-2 flex flex-col gap-2 border border-line bg-bg/40 p-5 max-[700px]:col-span-1",children:[m&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.24em] text-accent`,children:$(m)}),S&&ce(S).map((e,a)=>n("p",{className:`font-display ${t.body} leading-[1.55] text-fg-dim`,children:$(e)},a))]}),n(ee,{value:c.honeypot,onChange:c.setHoneypot}),c.error&&n("p",{role:"alert",className:`col-span-2 font-mono ${t.labelSmall} uppercase tracking-[0.18em] text-alert max-[700px]:col-span-1`,children:c.error}),l("div",{className:"col-span-2 mt-5 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-6 max-[700px]:col-span-1 max-[700px]:flex-col max-[700px]:items-stretch",children:[_&&n("span",{className:`max-w-[380px] font-mono ${t.labelSmall} uppercase leading-[1.6] tracking-[0.18em] text-fg-dim`,children:$(_)}),n("button",{type:C?"button":"submit",disabled:c.submitting,className:`cursor-pointer bg-btn px-8 py-5 font-mono ${t.labelXl} uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg disabled:cursor-wait disabled:opacity-60 max-[700px]:w-full`,children:c.submitting?"Sending…":O?L(O):"Send Message →"})]})]}):n("p",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.22em] text-fg-dim`,children:J?q("Loading form…"):q("Choose a form in the inspector, under Message form — until then this column is hidden on the live page and no message can be sent.")})]}),N.length>0&&n("aside",{className:"flex flex-col gap-0 max-[1100px]:hidden",children:N.map((e,a)=>{const i=Z(e),j=!!!e.groupId;return l("div",{onClick:j?()=>I(e.value):void 0,className:["relative flex flex-col gap-3 border-b border-line border-l-2 px-5 py-8 transition-all",j?"cursor-pointer border-t-2 border-t-accent":"",i?"border-l-accent pl-6":j?"border-l-transparent hover:bg-accent/[0.04]":"border-l-transparent"].join(" "),style:i?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[i&&l("span",{className:"absolute right-[18px] top-6 flex flex-col items-end gap-0.5 text-right",children:[n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.24em] text-accent`,children:"→ Message routes here"}),n("span",{className:`font-mono ${t.labelXs} uppercase tracking-[0.18em] text-fg-dim`,children:"Other inboxes filter as spam"})]}),n("span",{className:[`font-mono ${t.labelSmall} uppercase tracking-[0.3em] transition-colors`,i?"text-fg":"text-accent"].join(" "),children:e.label}),j?n("a",{href:e.href,onClick:U=>U.stopPropagation(),className:[`font-heading3 ${t.headingSmall1} font-medium leading-[1.2] tracking-[-0.02em] transition-colors hover:text-accent`,i?"text-accent":"text-fg"].join(" "),children:e.value}):n("a",{href:P(e),className:[`font-heading3 ${t.headingSmall1} font-medium leading-[1.2] tracking-[-0.02em]`,i?"text-accent":"text-fg"].join(" "),children:e.value}),e.sub&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:e.sub})]},`${e.value}-${a}`)})}),N.length>0&&n("div",{"data-contact-phone-list":!0,className:"hidden flex-col gap-0 max-[1100px]:flex",children:me(N).map((e,a)=>{const i=!!e.groupId;return l("div",{className:["flex flex-col gap-3 border-b border-line px-5 py-5",i?"":"border-t-2 border-t-accent"].join(" "),children:[n("span",{className:[`font-mono ${t.labelSmall} uppercase tracking-[0.3em]`,i?"text-fg":"text-accent"].join(" "),children:e.label}),n("a",{href:P(e),className:[`font-heading3 ${t.headingSmall1} font-medium leading-[1.2] tracking-[-0.02em] [overflow-wrap:anywhere]`,i?"text-accent":"text-fg"].join(" "),children:e.value}),e.sub&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:e.sub})]},`${e.value}-${a}`)})})]})})]})}export{P as channelHref,fe as default,B as fieldClass,me as mergeChannelsForPhone,pe as topicFieldOf};
1
+ "use client";import{jsx as n,jsxs as l,Fragment as A}from"react/jsx-runtime";import T from"./SectionBand.js";import{useEffect as C,useState as M}from"react";import{OTHER_REASON_ID as y}from"efficient-web-builder/format/lib/content/contact";import{FormFieldInput as ee,FormHoneypot as ne,successMessageFor as te,useBoundForm as ae,useFormSubmission as re}from"./formSubmission.js";import le from"efficient-web-builder/render/components/SectionEyebrow";import oe,{FieldCaption as ie}from"./WebFormField.js";import{scrollBehavior as se}from"efficient-web-builder/render/components/useReducedMotion";import{renderChrome as L,renderGold as $,renderHeadline as ce,splitParagraphs as de}from"efficient-web-builder/render/components/goldPhrases";import{say as q}from"efficient-web-builder/format/lib/editor-words";import{phoneHref as me}from"efficient-web-builder/format/lib/links/phone-href";const t={bodySmall:"text-[length:var(--size-body,14px)]",body:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,18px)]",headingSmall1:"text-[length:var(--size-headingSmall,24px)]",headingSmall2:"text-[length:var(--size-headingSmall,26px)]",labelXs:"text-[length:var(--size-label,10px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"};function P(f){if(f.href)return f.href;const o=(f.value??"").trim();if(o.includes("@"))return`mailto:${o}`;if(/^\+?[\d\s().-]{6,}$/.test(o))return me(o)}function pe(f){const o=[],d=new Map;for(const r of f){if(!r.groupId){o.push(r);continue}const m=r.value.trim().toLowerCase(),u=d.get(m);if(u)u.label=`${u.label} · ${r.label}`;else{const b={...r};d.set(m,b),o.push(b)}}return o}function fe(f,o,d){const r=m=>String(m??"").trim().toLowerCase();for(const m of f?.fields??[]){if(m.type!=="select"||!Array.isArray(m.options))continue;const u=m.options.map(String);if(!o.some(s=>u.some(p=>r(p)===r(s.title))))continue;const b=s=>r(s===y?d:o.find(p=>p.id===s)?.title);return{key:m.key,optionFor:s=>u.find(p=>r(p)===b(s)&&b(s)!==""),idFor:s=>{const p=o.find(S=>r(S.title)===r(s));return p?p.id:d&&r(s)===r(d)?y:void 0}}}return null}const B=`border-b border-line bg-transparent py-4 font-display ${t.bodyLarge} tracking-[0.01em] text-fg outline-none transition-colors focus:border-accent`;function xe({routingNumber:f,routingTagline:o,groups:d,formNumber:r,formHeading:m,metaLines:u,showOther:b=!0,otherLabel:s="Other",otherNoteTitle:p,otherNoteBody:S,buttonText:O,consent:R,channels:V,formSlug:_,form:D,editing:w,initialActiveId:v,onActiveChange:H,reasonExtras:G}){const k=[...d.map(e=>e.id),...b?[y]:[]],W=v&&k.includes(v)?v:k[0]??y,[g,j]=M(W);C(()=>{k.includes(g)||j(k[0]??y)},[k.join("|")]),C(()=>{v&&k.includes(v)&&j(v)},[v]);const h=ae(_,D),c=re({form:h,formSlug:_,editing:w}),x=fe(h,d,b?s:void 0),z=e=>{j(e),I(null);const a=x?.optionFor(e);x&&a!==void 0&&c.set(x.key,a),H?.(e)};C(()=>{if(!x||c.valueOf(x.key))return;const e=x.optionFor(g);e!==void 0&&c.set(x.key,e)},[x?.key]);const[X,I]=M(null),N=(V??[]).filter(e=>!e.hidden),Z=e=>X!==null?!e.groupId&&e.value===X:e.groupId===g,J=h===void 0,E=!!h||!!w,[K,Q]=M(!1);C(()=>{const e=()=>Q(document.documentElement.getAttribute("data-theme")==="light");e();const a=new MutationObserver(e);return a.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>a.disconnect()},[]);const U=d.length>0||!!w;return l(A,{children:[U&&l(T,{className:"border-b border-line py-[60px]",style:K?void 0:{background:"var(--section-bg)"},children:[(f||o)&&l("div",{className:"mb-6 flex items-center gap-6 border-b border-line pb-6",children:[f&&n(le,{text:f}),o&&n("span",{className:`font-display ${t.bodySmall} uppercase tracking-[0.04em] text-fg-dim`,children:$(o)})]}),n("div",{className:"sf-card grid grid-cols-4 gap-[2px] border border-line bg-line max-[1100px]:grid-cols-2 max-[700px]:grid-cols-1",children:d.map(e=>{const a=g===e.id;return l("button",{type:"button",onClick:()=>{z(e.id),typeof window<"u"&&window.matchMedia("(max-width: 1100px)").matches&&document.getElementById("contact-form")?.scrollIntoView({behavior:se(),block:"start"})},className:["flex min-h-[240px] cursor-pointer flex-col gap-4 px-8 py-10 text-left transition-colors",a?"bg-surface outline outline-2 -outline-offset-2 outline-accent":"bg-bg hover:bg-surface"].join(" "),children:[e.eyebrow&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.24em] text-accent`,children:e.eyebrow}),n("h3",{className:`whitespace-pre-line font-heading3 ${t.headingSmall2} font-medium uppercase leading-[1.05] tracking-[-0.02em]`,children:e.title}),e.copy&&n("p",{className:`mt-auto font-display ${t.bodySmall} leading-[1.5] text-fg-dim`,children:e.copy}),e.response&&l("div",{className:`mt-2 flex justify-between border-t border-line pt-4 font-mono ${t.labelSmall} uppercase tracking-[0.22em] text-fg-dim`,children:[n("span",{children:"Response"}),n("strong",{className:"font-normal text-fg",children:e.response})]})]},e.id)})})]}),(E||N.length>0)&&n("section",{id:"contact-form",className:"scroll-mt-[80px] border-b border-line py-20 max-[1100px]:py-[60px]",children:l("div",{className:["mx-auto grid max-w-[var(--sf-site-width,1600px)] gap-20 px-[var(--sf-site-gutter,40px)] max-[1100px]:grid-cols-1 max-[1100px]:gap-[60px] max-[1100px]:px-[min(24px,var(--sf-site-gutter,40px))]",E&&N.length>0?"grid-cols-[1.3fr_1fr]":"grid-cols-1"].join(" "),children:[E&&l("div",{children:[l("div",{className:"mb-8 flex items-end justify-between gap-6 border-b border-line pb-6",children:[l("div",{children:[r&&n("div",{className:`pb-2 font-mono ${t.labelLarge} uppercase tracking-[0.3em] text-accent`,children:$(r)}),m&&n("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(36px,4vw,56px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.03em]",children:ce(m,!0)})]}),!!(u&&u.length)&&n("div",{className:`text-right font-mono ${t.labelSmall} uppercase leading-[1.8] tracking-[0.22em] text-fg-dim max-[700px]:text-left`,children:u.map((e,a)=>n("div",{children:e},a))})]}),h?c.done?n("div",{className:`border border-accent bg-accent/[0.08] p-8 font-display ${t.body} leading-[1.6] text-fg-dim`,children:te(h,"Thanks — we've received your message.")}):l("form",{className:"grid grid-cols-2 gap-5 max-[700px]:grid-cols-1",onSubmit:c.handleSubmit,children:[h.fields.map(e=>n(oe,{label:e.label,required:e.required,className:e.type==="textarea"||e.type==="checkbox"?"col-span-2 max-[700px]:col-span-1":void 0,children:n(ee,{field:e,value:c.valueOf(e.key),onChange:a=>{c.set(e.key,a);const i=x&&e.key===x.key?x.idFor(a):void 0;i!==void 0&&(j(i),I(null),H?.(i))},className:e.type==="textarea"?`${B} min-h-[140px] resize-y leading-[1.5]`:e.type==="checkbox"?"size-4 self-start accent-accent":B})},e.key)),l("div",{className:"col-span-2 flex flex-col gap-2 max-[700px]:col-span-1",children:[n(ie,{required:!0,children:"Reason"}),l("div",{className:"mt-1 flex flex-wrap gap-2",children:[d.map(e=>{const a=g===e.id;return n("button",{type:"button",onClick:()=>z(e.id),className:[`cursor-pointer border px-4 py-3 font-mono ${t.labelSmall} uppercase tracking-[0.2em] transition-colors`,a?"border-accent bg-accent text-bg":"border-line text-fg-dim hover:text-fg"].join(" "),children:e.title},e.id)}),b&&n("button",{type:"button",onClick:()=>z(y),className:[`cursor-pointer border px-4 py-3 font-mono ${t.labelSmall} uppercase tracking-[0.2em] transition-colors`,g===y?"border-accent bg-accent text-bg":"border-line text-fg-dim hover:text-fg"].join(" "),children:L(s)})]})]}),G?.(g),g===y&&(p||S)&&l("div",{className:"sf-card col-span-2 flex flex-col gap-2 border border-line bg-bg/40 p-5 max-[700px]:col-span-1",children:[p&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.24em] text-accent`,children:$(p)}),S&&de(S).map((e,a)=>n("p",{className:`font-display ${t.body} leading-[1.55] text-fg-dim`,children:$(e)},a))]}),n(ne,{value:c.honeypot,onChange:c.setHoneypot}),c.error&&n("p",{role:"alert",className:`col-span-2 font-mono ${t.labelSmall} uppercase tracking-[0.18em] text-alert max-[700px]:col-span-1`,children:c.error}),l("div",{className:"col-span-2 mt-5 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-6 max-[700px]:col-span-1 max-[700px]:flex-col max-[700px]:items-stretch",children:[R&&n("span",{className:`max-w-[380px] font-mono ${t.labelSmall} uppercase leading-[1.6] tracking-[0.18em] text-fg-dim`,children:$(R)}),n("button",{type:w?"button":"submit",disabled:c.submitting,className:`cursor-pointer bg-btn px-8 py-5 font-mono ${t.labelXl} uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg disabled:cursor-wait disabled:opacity-60 max-[700px]:w-full`,children:c.submitting?"Sending…":O?L(O):"Send Message →"})]})]}):n("p",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.22em] text-fg-dim`,children:J?q("Loading form…"):q("Choose a form in the inspector, under Message form — until then this column is hidden on the live page and no message can be sent.")})]}),N.length>0&&n("aside",{className:"flex flex-col gap-0 max-[1100px]:hidden",children:N.map((e,a)=>{const i=Z(e),F=!!!e.groupId;return l("div",{onClick:F?()=>I(e.value):void 0,className:["relative flex flex-col gap-3 border-b border-line border-l-2 px-5 py-8 transition-all",F?"cursor-pointer border-t-2 border-t-accent":"",i?"border-l-accent pl-6":F?"border-l-transparent hover:bg-accent/[0.04]":"border-l-transparent"].join(" "),style:i?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[i&&!!h&&l("span",{className:"absolute right-[18px] top-6 flex flex-col items-end gap-0.5 text-right",children:[n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.24em] text-accent`,children:"→ Message routes here"}),n("span",{className:`font-mono ${t.labelXs} uppercase tracking-[0.18em] text-fg-dim`,children:"Other inboxes filter as spam"})]}),n("span",{className:[`font-mono ${t.labelSmall} uppercase tracking-[0.3em] transition-colors`,i?"text-fg":"text-accent"].join(" "),children:e.label}),F?n("a",{href:e.href,onClick:Y=>Y.stopPropagation(),className:[`font-heading3 ${t.headingSmall1} font-medium leading-[1.2] tracking-[-0.02em] transition-colors hover:text-accent`,i?"text-accent":"text-fg"].join(" "),children:e.value}):n("a",{href:P(e),className:[`font-heading3 ${t.headingSmall1} font-medium leading-[1.2] tracking-[-0.02em]`,i?"text-accent":"text-fg"].join(" "),children:e.value}),e.sub&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:e.sub})]},`${e.value}-${a}`)})}),N.length>0&&n("div",{"data-contact-phone-list":!0,className:"hidden flex-col gap-0 max-[1100px]:flex",children:pe(N).map((e,a)=>{const i=!!e.groupId;return l("div",{className:["flex flex-col gap-3 border-b border-line px-5 py-5",i?"":"border-t-2 border-t-accent"].join(" "),children:[n("span",{className:[`font-mono ${t.labelSmall} uppercase tracking-[0.3em]`,i?"text-fg":"text-accent"].join(" "),children:e.label}),n("a",{href:P(e),className:[`font-heading3 ${t.headingSmall1} font-medium leading-[1.2] tracking-[-0.02em] [overflow-wrap:anywhere]`,i?"text-accent":"text-fg"].join(" "),children:e.value}),e.sub&&n("span",{className:`font-mono ${t.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:e.sub})]},`${e.value}-${a}`)})})]})})]})}export{P as channelHref,xe as default,B as fieldClass,pe as mergeChannelsForPhone,fe as topicFieldOf};
@@ -1 +1 @@
1
- import{jsx as t,jsxs as r}from"react/jsx-runtime";import j from"./SectionBand.js";import z from"efficient-web-builder/render/components/Placeholder";import{withRMark as s}from"efficient-web-builder/render/components/RMark";import{renderGold as f}from"efficient-web-builder/render/components/goldPhrases";import{say as o}from"efficient-web-builder/format/lib/editor-words";const m={body:"text-[length:var(--size-body,15px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function k({rows:h,startLeft:b=!1,layout:u="even",padTop:c,padBottom:d,editing:v=!1}){const a=u==="narrow",w=typeof c=="number"?c:100,y=typeof d=="number"?d:100,g=(h??[]).filter(e=>(e?.eyebrow??"").trim()||(e?.title??"").trim()||(e?.copy??"").trim()||(e?.tag??"").trim()||(e?.image??"").trim()),p=g.length>0?g:v?[{tag:o("Row {n}",{n:1})},{tag:o("Row {n}",{n:2})},{tag:o("Row {n}",{n:3})}]:[];return p.length===0?null:t(j,{className:"relative z-[2] border-b border-line bg-bg",style:{paddingTop:w,paddingBottom:y},children:p.map((e,l)=>{const n=l%2===1!==b;return r("div",{className:["grid items-center py-[60px]",a?"grid-cols-[1fr_460px] gap-[72px]":"grid-cols-2 gap-12","max-[1100px]:grid-cols-1",n?"[direction:rtl] max-[1100px]:[direction:ltr]":"",l>0?"border-t border-line":""].join(" "),children:[r("div",{className:["[direction:ltr] flex flex-col gap-4",a?"max-w-[560px]":"",a&&!n?"ml-auto max-[1100px]:ml-0":""].join(" "),children:[e.eyebrow?.trim()&&t("div",{className:`font-mono ${m.labelLarge} uppercase tracking-[0.2em] text-accent`,children:s(e.eyebrow)}),e.title?.trim()&&t("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3vw,42px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [&_em]:[font-weight:var(--sf-heading-weight-strong,inherit)] leading-[1.1] tracking-[-0.02em]",children:f(e.title,!0)}),e.copy?.trim()&&t("p",{className:`${m.body} leading-[1.6] text-fg-dim`,children:f(e.copy,!1)}),(()=>{const x=(e.specs??[]).filter(i=>(i?.label??"").trim()||(i?.value??"").trim());return x.length===0?null:t("dl",{className:`mt-2 border-t border-line pt-3 font-mono ${m.label} uppercase tracking-[0.1em] leading-[2.1]`,children:x.map((i,N)=>r("div",{className:"flex items-baseline justify-between gap-6",children:[t("dt",{className:"text-fg-dim",children:s(i.label??"")}),t("dd",{className:"text-fg",children:s(i.value??"")})]},N))})})()]}),r("div",{className:["[direction:ltr] flex flex-col gap-3",a?n?"items-end":"items-start":"",a?"max-[1100px]:items-start":""].join(" "),children:[t("div",{className:["relative overflow-hidden max-w-full",a?e.imageShape==="wide"?"w-[460px] aspect-[16/9]":"w-[360px] aspect-square":"aspect-square"].join(" "),children:t(z,{label:e.tag?.trim()||e.title?.trim()||`row-${l+1}`,src:e.image||void 0,showBackground:!e.image,objectFit:"contain",sizes:a?"(max-width: 1100px) 100vw, 460px":"(max-width: 1100px) 100vw, 50vw"})}),e.tag?.trim()&&t("span",{className:`font-mono ${m.labelSmall} uppercase tracking-[0.2em] text-fg-dim ${n?"text-left":"text-right"}`,children:s(e.tag)})]})]},l)})})}export{k as default};
1
+ import{jsx as t,jsxs as n}from"react/jsx-runtime";import j from"./SectionBand.js";import k from"efficient-web-builder/render/components/Placeholder";import{withRMark as s}from"efficient-web-builder/render/components/RMark";import{renderGold as f}from"efficient-web-builder/render/components/goldPhrases";import{say as o}from"efficient-web-builder/format/lib/editor-words";import{stripMarkup as z}from"efficient-web-builder/format/lib/markup";const m={body:"text-[length:var(--size-body,15px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function $({rows:h,startLeft:b=!1,layout:u="even",padTop:c,padBottom:d,editing:v=!1}){const a=u==="narrow",w=typeof c=="number"?c:100,y=typeof d=="number"?d:100,p=(h??[]).filter(e=>(e?.eyebrow??"").trim()||(e?.title??"").trim()||(e?.copy??"").trim()||(e?.tag??"").trim()||(e?.image??"").trim()),g=p.length>0?p:v?[{tag:o("Row {n}",{n:1})},{tag:o("Row {n}",{n:2})},{tag:o("Row {n}",{n:3})}]:[];return g.length===0?null:t(j,{className:"relative z-[2] border-b border-line bg-bg",style:{paddingTop:w,paddingBottom:y},children:g.map((e,l)=>{const r=l%2===1!==b;return n("div",{className:["grid items-center py-[60px]",a?"grid-cols-[1fr_460px] gap-[72px]":"grid-cols-2 gap-12","max-[1100px]:grid-cols-1",r?"[direction:rtl] max-[1100px]:[direction:ltr]":"",l>0?"border-t border-line":""].join(" "),children:[n("div",{className:["[direction:ltr] flex flex-col gap-4",a?"max-w-[560px]":"",a&&!r?"ml-auto max-[1100px]:ml-0":""].join(" "),children:[e.eyebrow?.trim()&&t("div",{className:`font-mono ${m.labelLarge} uppercase tracking-[0.2em] text-accent`,children:s(e.eyebrow)}),e.title?.trim()&&t("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3vw,42px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [&_em]:[font-weight:var(--sf-heading-weight-strong,inherit)] leading-[1.1] tracking-[-0.02em]",children:f(e.title,!0)}),e.copy?.trim()&&t("p",{className:`${m.body} leading-[1.6] text-fg-dim`,children:f(e.copy,!1)}),(()=>{const x=(e.specs??[]).filter(i=>(i?.label??"").trim()||(i?.value??"").trim());return x.length===0?null:t("dl",{className:`mt-2 border-t border-line pt-3 font-mono ${m.label} uppercase tracking-[0.1em] leading-[2.1]`,children:x.map((i,N)=>n("div",{className:"flex items-baseline justify-between gap-6",children:[t("dt",{className:"text-fg-dim",children:s(i.label??"")}),t("dd",{className:"text-fg",children:s(i.value??"")})]},N))})})()]}),n("div",{className:["[direction:ltr] flex flex-col gap-3",a?r?"items-end":"items-start":"",a?"max-[1100px]:items-start":""].join(" "),children:[t("div",{className:["relative overflow-hidden max-w-full",a?e.imageShape==="wide"?"w-[460px] aspect-[16/9]":"w-[360px] aspect-square":"aspect-square"].join(" "),children:t(k,{label:e.tag?.trim()||e.title?.trim()||`row-${l+1}`,src:e.image||void 0,alt:z(e.title?.trim()||e.tag?.trim()||""),showBackground:!e.image,objectFit:"contain",sizes:a?"(max-width: 1100px) 100vw, 460px":"(max-width: 1100px) 100vw, 50vw"})}),e.tag?.trim()&&t("span",{className:`font-mono ${m.labelSmall} uppercase tracking-[0.2em] text-fg-dim ${r?"text-left":"text-right"}`,children:s(e.tag)})]})]},l)})})}export{$ as default};
@@ -1,7 +1,8 @@
1
1
  export interface FooterTextProps {
2
2
  text?: string;
3
+ lines?: readonly string[];
3
4
  size?: "sm" | "md" | "lg";
4
5
  tone?: "default" | "dim";
5
6
  editing?: boolean;
6
7
  }
7
- export default function FooterText({ text, size, tone, editing, }: FooterTextProps): import("react").JSX.Element | null;
8
+ export default function FooterText({ text, size, tone, editing, lines, }: FooterTextProps): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- import{jsx as d}from"react/jsx-runtime";import{renderGold as f}from"efficient-web-builder/render/components/goldPhrases";import{say as l}from"efficient-web-builder/format/lib/editor-words";const m={sm:"text-[12px]",md:"text-[13px]",lg:"text-[15px]"};function n({text:e,size:o="md",tone:r="default",editing:x=!1}){const t=e||(x?l("Add a line of footer text."):"");return t?d("p",{className:`${m[o]} leading-[1.5] ${r==="dim"?"text-fg-dim":"text-fg"}`,children:f(t)}):null}export{n as default};
1
+ import{jsx as e,jsxs as d}from"react/jsx-runtime";import{Fragment as i}from"react";import{renderGold as s}from"efficient-web-builder/render/components/goldPhrases";import{say as p}from"efficient-web-builder/format/lib/editor-words";const c={sm:"text-[12px]",md:"text-[13px]",lg:"text-[15px]"};function u({text:a,size:l="md",tone:n="default",editing:f=!1,lines:t}){const r=`${c[l]} leading-[1.5] ${n==="dim"?"text-fg-dim":"text-fg"}`;if(t)return t.length?e("p",{className:r,children:t.map((x,m)=>d(i,{children:[m>0&&e("br",{}),s(x)]},m))}):null;const o=a||(f?p("Add a line of footer text."):"");return o?e("p",{className:r,children:s(o)}):null}export{u as default};
@@ -1 +1 @@
1
- "use client";import{jsx as o,Fragment as I,jsxs as s}from"react/jsx-runtime";import te from"next/link";import{usePathname as Ke}from"next/navigation";import{useCallback as Ve,useEffect as O,useState as p}from"react";import{useCart as qe}from"./CartContext.js";import{useSearch as Ye}from"./SearchContext.js";import Je,{useCountrySelectShows as Xe}from"./CountrySelect.js";import{resolveCountryShowAs as Qe}from"../lib/content/country-show-as.js";import ne from"./HeaderNavItem.js";import Ze from"efficient-web-builder/render/components/Logo";import et from"./MenuPlaceholderLabel.js";import{withRMark as re}from"efficient-web-builder/render/components/RMark";import{AccountButton as tt,CartButton as nt,SearchButton as rt}from"./HeaderTools.js";import{useHeaderBar as ot}from"./useHeaderBar.js";import{useModalDismiss as st}from"./useModalDismiss.js";import at from"./ThemeToggle.js";import{products as lt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as it}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as ct}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as dt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as mt,resolveChromeWidth as ut}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as ht}from"../lib/content/header-theme.js";import{headerSolidBackground as ft,isProductPage as pt}from"../lib/content/header-bar.js";import{surfaceIsLight as gt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as bt,HEADER_SET_HEIGHT_CSS as xt}from"efficient-web-builder/render/lib/puck/header-clearance";import{HEADER_INK_ATTR as vt,HEADER_INK_OVERRIDE_ATTR as yt,resolveHeaderInkMode as wt}from"efficient-web-builder/render/lib/puck/header-ink";const oe={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},St=Array.from({length:ct},()=>({href:"#",label:o(et,{})}));function kt({previewSettings:g,initialSettings:$,editorPreview:T,showThemeToggle:se,wordmark:ae,hideLogo:le,hideMenu:ie,siteName:L,commerceEnabled:y=!0}={}){const M=Ke(),[ce,de]=p(!1);O(()=>{const e=x.current?.ownerDocument??document,t=()=>de(e.querySelector(`[${vt}="light"]`)!=null);t();const f=requestAnimationFrame(t);return()=>cancelAnimationFrame(f)},[M]);const z=pt(M),[c,w]=p(!1),{open:me,totals:ue}=qe(),{open:he}=Ye(),[C,fe]=p(!1),[pe,ge]=p(null),[be,xe]=p(null),[n,ve]=p($??null),r=g??(n?{logoUrl:n.logoUrl,reverseLogo:n.reverseLogo,logoReversed:n.logoReversed,logoInkIsDark:n.logoInkIsDark,logoPosition:n.logoPosition,logoSize:n.logoSize,logoSizePx:n.logoSizePx,menuItems:(n.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:n.menuSplit??3,menuPosition:n.menuPosition,menuRow:n.menuRow,menuGapPx:n.menuGapPx??null,searchEnabled:n.searchEnabled,searchPosition:n.searchPosition,searchRow:n.searchRow,countrySelectorEnabled:n.countrySelectorEnabled,countrySelectorShowAs:n.countrySelectorShowAs,countryUrls:n.countryUrls,accountEnabled:n.accountEnabled,cartEnabled:n.cartEnabled,utilStyle:n.utilStyle,navTextCase:n.navTextCase,lightReverseText:n.lightReverseText,topTextColor:n.topTextColor,transparentTop:n.transparentTop,surface:n.surface,theme:n.theme,width:n.width,heightPx:n.heightPx,sticky:n.sticky}:null),ye=le?null:r?.logoUrl??null,we=r?.reverseLogo??!1,Se=r?.logoReversed??null,ke=r?.logoInkIsDark??null,i=r?.logoPosition??"center",Ne=r?.logoSize??"medium",Ee=r?.logoSizePx??null,B=Math.min(Math.max(r?.menuSplit??3,1),4),Pe=(r?.menuPosition??"left")==="center",Ie=(r?.menuPosition??"left")==="beside",U=(r?.menuRow??"top")==="inline",F=r?.menuGapPx??null,$e=F!=null?{gap:`${F}px`}:void 0,S=U?oe.inline:oe.stacked,Te=r?.searchEnabled??!1,G=r?.searchPosition??"right",Le=r?.countrySelectorEnabled??!0,Ce=Qe(r?.countrySelectorShowAs),_=r?.accountEnabled??!0,_e=r?.cartEnabled??!0,A=(r?.utilStyle??"icon")==="text",a=`mono-eyebrow${(r?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,W=r?.countryUrls??{},Ae=ut(r?.width),De=mt(Ae)??void 0,Re=r?.heightPx??bt.default,K=r?.sticky??"always",k=wt(r?.topTextColor),m=ht(r?.theme),N=Object.keys(W),V=Xe(N.length?N:void 0),b=Le?o(Je,{countries:N.length?N:void 0,urls:g?void 0:W,showAs:Ce}):null,{headerRef:x,scrolled:q,navHidden:He}=ot({stickyMode:K,heightPx:Re}),je=m?JSON.stringify(m.style):null;O(()=>{const e=x.current?.ownerDocument??document,t=e.defaultView??window,f=ee=>ee?gt(t.getComputedStyle(ee).getPropertyValue("--bg")):null,Z=()=>{fe(e.documentElement.getAttribute("data-theme")==="light"),ge(f(e.body)),xe(f(x.current))};Z();const j=new MutationObserver(Z);return j.observe(e.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),e.body&&j.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>j.disconnect()},[x,je]);const v=se??dt?o(at,{}):null;O(()=>{if(!it({editorPreview:!!T,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return lt.getHeaderSettings().then(t=>!e&&ve(t)).catch(t=>{console.warn("[header] settings fetch failed; using built-in defaults",t)}),()=>{e=!0}},[T,g,$]);const E=q||z,Y=ft(C,z),J=k==="auto"?ce:k==="light",Oe=E||!J,Me=E?be??C:(pe??C)&&!J,ze=k==="auto"?null:{[yt]:k},Be=Ve(()=>w(!1),[]);st({active:c,onDismiss:Be});const d=(e,t,f="start")=>o(ne,{item:e,dropdownAlign:f},t),Ue=!ie&&(r?.menuItems?.length??0)>0,X=!!T||!!g,l=Ue?r.menuItems.map(e=>({href:e.url||"",label:re(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(t=>({href:t.url||"",label:re(t.label),plainLabel:t.label}))})):X?St.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Fe=l.length>0||y&&_||!!b&&V||!!v,Ge=i==="center"?l.slice(0,B):i==="right"?l:[],We=i==="center"?l.slice(B):i==="left"?l:[],P=Te?o(rt,{onClick:X?void 0:he,asText:A}):null,D=y&&_?o(tt,{asText:A}):null,R=e=>y&&_e?o(nt,{onClick:me,count:ue.sets,asText:A,className:e}):null,u=s(I,{children:[G==="left"?P:null,b,v,D,R(),G==="right"?P:null]}),H=(e,t=!1)=>o(te,{href:"/","aria-label":L?`${L} home`:"Home",className:e,children:o(Ze,{variant:"header",scrolled:Oe,src:ye,reverse:we,onLightSurface:Me,reversedSrc:Se,inkIsDark:ke,size:Ne,sizePx:Ee,wordmark:ae,siteName:L,fitToContainer:t})}),h=H("inline-flex shrink-0 items-center justify-center"),Q="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return s(I,{children:[o("header",{ref:x,"data-scrolled":q||void 0,...ze,className:["sf-site-header",...m?[m.className]:[],K==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",E?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:xt,...He?{transform:"translateY(-100%)"}:null,...E?{background:Y,color:"var(--fg)","--sf-header-ground":Y}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:s("div",{className:"w-full",style:De,children:[Pe?s("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?o("nav",{className:`${a} flex items-center gap-8`,children:u}):o("div",{className:"flex items-center",children:h}),o("nav",{className:`${a} flex items-center justify-center gap-8`,children:l.map((e,t)=>d(e,`${e.href}-${t}`,"center"))}),i==="right"?o("div",{className:"flex items-center justify-end",children:h}):o("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):i==="center"?s("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[o("nav",{className:`${a} flex items-center gap-8`,children:Ge.map((e,t)=>d(e,`${e.href}-${t}`))}),h,s("nav",{className:`${a} flex items-center justify-end gap-8`,children:[We.map((e,t)=>d(e,`${e.href}-${t}`,"end")),u]})]}):Ie?s("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[s("div",{className:"flex items-center gap-8",style:$e,children:[h,o("nav",{className:`${a} flex items-center gap-8`,children:l.map((e,t)=>d(e,`${e.href}-${t}`))})]}),o("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):o("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?s(I,{children:[s("nav",{className:`${a} flex items-center gap-8`,children:[l.map((e,t)=>d(e,`${e.href}-${t}`)),u]}),h]}):s(I,{children:[h,s("nav",{className:`${a} flex items-center gap-8`,children:[l.map((e,t)=>d(e,`${e.href}-${t}`)),u]})]})}),!U&&s("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[s("div",{className:"flex items-center justify-between",children:[H(Q,!0),s("div",{className:`${a} flex shrink-0 items-center gap-5`,children:[P,b,v,D,R()]})]}),o("nav",{className:`${a} flex items-center gap-6 border-t border-line/60 pt-3`,children:l.map((e,t)=>d(e,`${e.href}-${t}`))})]}),s("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[H(Q,!0),s("div",{className:"flex shrink-0 items-center gap-4",children:[P,D,R(a),Fe&&s("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&s("div",{"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[l.map((e,t)=>o(ne,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${t}`)),s("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[y&&_&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),o(te,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),b&&V&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),b]}),v&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{kt as default};
1
+ "use client";import{jsx as o,Fragment as I,jsxs as s}from"react/jsx-runtime";import te from"next/link";import{usePathname as Ke}from"next/navigation";import{useCallback as Ve,useEffect as O,useState as p}from"react";import{useCart as qe}from"./CartContext.js";import{useSearch as Ye}from"./SearchContext.js";import Je,{useCountrySelectShows as Xe}from"./CountrySelect.js";import{resolveCountryShowAs as Qe}from"../lib/content/country-show-as.js";import ne from"./HeaderNavItem.js";import Ze from"efficient-web-builder/render/components/Logo";import et from"./MenuPlaceholderLabel.js";import{withRMark as re}from"efficient-web-builder/render/components/RMark";import{AccountButton as tt,CartButton as nt,SearchButton as rt}from"./HeaderTools.js";import{useHeaderBar as ot}from"./useHeaderBar.js";import{useModalDismiss as st}from"./useModalDismiss.js";import at from"./ThemeToggle.js";import{products as lt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as it}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as ct}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as dt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as mt,resolveChromeWidth as ut}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as ht}from"../lib/content/header-theme.js";import{headerSolidBackground as ft,isProductPage as pt}from"../lib/content/header-bar.js";import{surfaceIsLight as gt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as bt,HEADER_SET_HEIGHT_CSS as xt}from"efficient-web-builder/render/lib/puck/header-clearance";import{HEADER_INK_ATTR as vt,HEADER_INK_OVERRIDE_ATTR as yt,resolveHeaderInkMode as wt}from"efficient-web-builder/render/lib/puck/header-ink";const oe={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},St=Array.from({length:ct},()=>({href:"#",label:o(et,{})}));function kt({previewSettings:g,initialSettings:$,editorPreview:T,showThemeToggle:se,wordmark:ae,hideLogo:le,hideMenu:ie,siteName:L,commerceEnabled:b=!0}={}){const M=Ke(),[ce,de]=p(!1);O(()=>{const e=v.current?.ownerDocument??document,t=()=>de(e.querySelector(`[${vt}="light"]`)!=null);t();const f=requestAnimationFrame(t);return()=>cancelAnimationFrame(f)},[M]);const z=pt(M),[c,w]=p(!1),{open:me,totals:ue}=qe(),{open:he}=Ye(),[C,fe]=p(!1),[pe,ge]=p(null),[be,xe]=p(null),[n,ve]=p($??null),r=g??(n?{logoUrl:n.logoUrl,reverseLogo:n.reverseLogo,logoReversed:n.logoReversed,logoInkIsDark:n.logoInkIsDark,logoPosition:n.logoPosition,logoSize:n.logoSize,logoSizePx:n.logoSizePx,menuItems:(n.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:n.menuSplit??3,menuPosition:n.menuPosition,menuRow:n.menuRow,menuGapPx:n.menuGapPx??null,searchEnabled:n.searchEnabled,searchPosition:n.searchPosition,searchRow:n.searchRow,countrySelectorEnabled:n.countrySelectorEnabled,countrySelectorShowAs:n.countrySelectorShowAs,countryUrls:n.countryUrls,accountEnabled:n.accountEnabled,cartEnabled:n.cartEnabled,utilStyle:n.utilStyle,navTextCase:n.navTextCase,lightReverseText:n.lightReverseText,topTextColor:n.topTextColor,transparentTop:n.transparentTop,surface:n.surface,theme:n.theme,width:n.width,heightPx:n.heightPx,sticky:n.sticky}:null),ye=le?null:r?.logoUrl??null,we=r?.reverseLogo??!1,Se=r?.logoReversed??null,ke=r?.logoInkIsDark??null,i=r?.logoPosition??"center",Ne=r?.logoSize??"medium",Pe=r?.logoSizePx??null,B=Math.min(Math.max(r?.menuSplit??3,1),4),Ee=(r?.menuPosition??"left")==="center",Ie=(r?.menuPosition??"left")==="beside",U=(r?.menuRow??"top")==="inline",F=r?.menuGapPx??null,$e=F!=null?{gap:`${F}px`}:void 0,S=U?oe.inline:oe.stacked,Te=r?.searchEnabled??!1,G=r?.searchPosition??"right",Le=r?.countrySelectorEnabled??!0,Ce=Qe(r?.countrySelectorShowAs),_=r?.accountEnabled??!0,_e=r?.cartEnabled??!0,A=(r?.utilStyle??"icon")==="text",a=`mono-eyebrow${(r?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,W=r?.countryUrls??{},Ae=ut(r?.width),De=mt(Ae)??void 0,Re=r?.heightPx??bt.default,K=r?.sticky??"always",k=wt(r?.topTextColor),m=ht(r?.theme),N=Object.keys(W),V=Xe(N.length?N:void 0),x=Le?o(Je,{countries:N.length?N:void 0,urls:g?void 0:W,showAs:Ce}):null,{headerRef:v,scrolled:q,navHidden:He}=ot({stickyMode:K,heightPx:Re}),je=m?JSON.stringify(m.style):null;O(()=>{const e=v.current?.ownerDocument??document,t=e.defaultView??window,f=ee=>ee?gt(t.getComputedStyle(ee).getPropertyValue("--bg")):null,Z=()=>{fe(e.documentElement.getAttribute("data-theme")==="light"),ge(f(e.body)),xe(f(v.current))};Z();const j=new MutationObserver(Z);return j.observe(e.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),e.body&&j.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>j.disconnect()},[v,je]);const y=se??dt?o(at,{}):null;O(()=>{if(!it({editorPreview:!!T,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return lt.getHeaderSettings().then(t=>!e&&ve(t)).catch(t=>{console.warn("[header] settings fetch failed; using built-in defaults",t)}),()=>{e=!0}},[T,g,$]);const P=q||z,Y=ft(C,z),J=k==="auto"?ce:k==="light",Oe=P||!J,Me=P?be??C:(pe??C)&&!J,ze=k==="auto"?null:{[yt]:k},Be=Ve(()=>w(!1),[]);st({active:c,onDismiss:Be});const d=(e,t,f="start")=>o(ne,{item:e,dropdownAlign:f},t),Ue=!ie&&(r?.menuItems?.length??0)>0,X=!!T||!!g,l=Ue?r.menuItems.map(e=>({href:e.url||"",label:re(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(t=>({href:t.url||"",label:re(t.label),plainLabel:t.label}))})):X?St.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Fe=l.length>0||b&&_||!!x&&V||!!y,Ge=i==="center"?l.slice(0,B):i==="right"?l:[],We=i==="center"?l.slice(B):i==="left"?l:[],E=Te&&b?o(rt,{onClick:X?void 0:he,asText:A}):null,D=b&&_?o(tt,{asText:A}):null,R=e=>b&&_e?o(nt,{onClick:me,count:ue.sets,asText:A,className:e}):null,u=s(I,{children:[G==="left"?E:null,x,y,D,R(),G==="right"?E:null]}),H=(e,t=!1)=>o(te,{href:"/","aria-label":L?`${L} home`:"Home",className:e,children:o(Ze,{variant:"header",scrolled:Oe,src:ye,reverse:we,onLightSurface:Me,reversedSrc:Se,inkIsDark:ke,size:Ne,sizePx:Pe,wordmark:ae,siteName:L,fitToContainer:t})}),h=H("inline-flex shrink-0 items-center justify-center"),Q="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return s(I,{children:[o("header",{ref:v,"data-scrolled":q||void 0,...ze,className:["sf-site-header",...m?[m.className]:[],K==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",P?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:xt,...He?{transform:"translateY(-100%)"}:null,...P?{background:Y,color:"var(--fg)","--sf-header-ground":Y}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:s("div",{className:"w-full",style:De,children:[Ee?s("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?o("nav",{className:`${a} flex items-center gap-8`,children:u}):o("div",{className:"flex items-center",children:h}),o("nav",{className:`${a} flex items-center justify-center gap-8`,children:l.map((e,t)=>d(e,`${e.href}-${t}`,"center"))}),i==="right"?o("div",{className:"flex items-center justify-end",children:h}):o("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):i==="center"?s("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[o("nav",{className:`${a} flex items-center gap-8`,children:Ge.map((e,t)=>d(e,`${e.href}-${t}`))}),h,s("nav",{className:`${a} flex items-center justify-end gap-8`,children:[We.map((e,t)=>d(e,`${e.href}-${t}`,"end")),u]})]}):Ie?s("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[s("div",{className:"flex items-center gap-8",style:$e,children:[h,o("nav",{className:`${a} flex items-center gap-8`,children:l.map((e,t)=>d(e,`${e.href}-${t}`))})]}),o("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):o("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?s(I,{children:[s("nav",{className:`${a} flex items-center gap-8`,children:[l.map((e,t)=>d(e,`${e.href}-${t}`)),u]}),h]}):s(I,{children:[h,s("nav",{className:`${a} flex items-center gap-8`,children:[l.map((e,t)=>d(e,`${e.href}-${t}`)),u]})]})}),!U&&s("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[s("div",{className:"flex items-center justify-between",children:[H(Q,!0),s("div",{className:`${a} flex shrink-0 items-center gap-5`,children:[E,x,y,D,R()]})]}),o("nav",{className:`${a} flex items-center gap-6 border-t border-line/60 pt-3`,children:l.map((e,t)=>d(e,`${e.href}-${t}`))})]}),s("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[H(Q,!0),s("div",{className:"flex shrink-0 items-center gap-4",children:[E,D,R(a),Fe&&s("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&s("div",{"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[l.map((e,t)=>o(ne,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${t}`)),s("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&_&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),o(te,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&V&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),y&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),y]})]})]})]})}export{kt as default};
@@ -3,7 +3,7 @@ export type ToolStyle = "icon" | "text";
3
3
  export declare function SearchTool({ style, editing }: {
4
4
  style?: ToolStyle;
5
5
  editing?: boolean;
6
- }): import("react").JSX.Element;
6
+ }): import("react").JSX.Element | null;
7
7
  export declare function CartTool({ style, editing }: {
8
8
  style?: ToolStyle;
9
9
  editing?: boolean;
@@ -1 +1 @@
1
- "use client";import{jsx as o}from"react/jsx-runtime";import{useCart as c}from"./CartContext.js";import u,{useCountrySelectShows as i}from"./CountrySelect.js";import{AccountButton as a,CartButton as m,SearchButton as h}from"./HeaderTools.js";import f from"./ThemeToggle.js";import{useOfferToPhoneMenu as r}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as p}from"./SearchContext.js";import{useSiteSells as s,useSiteThemeSwitchShown as d}from"./SiteRecordContext.js";import{say as x}from"efficient-web-builder/format/lib/editor-words";function j({style:e="icon",editing:t=!1}){const{open:n}=p();return r("search"),o("span",{"data-phone-menu-tool":"search",className:"contents",children:o(h,{onClick:t?void 0:n,asText:e==="text"})})}function k({style:e="icon",editing:t=!1}){const{open:n,totals:l}=c();return s()?o(m,{onClick:t?()=>{}:n,count:l.sets,asText:e==="text"}):null}function v({style:e="icon"}){const t=s();return r(t?"account":null),t?o(a,{asText:e==="text"}):null}function M(){const e=d();return r(e?"theme":null),e?o("span",{"data-phone-menu-tool":"theme",className:"contents",children:o(f,{})}):null}function O({editing:e=!1,showAs:t}){const n=i();return r(n?"region":null),n?o("span",{"data-phone-menu-tool":"region",className:"contents",children:o(u,{showAs:t})}):e?o("div",{"data-country-placeholder":"",className:"rounded border border-dashed border-line px-3 py-2 text-[13px] text-fg-dim",children:x("No regions yet")}):null}export{v as AccountTool,k as CartTool,O as CountrySwitchTool,j as SearchTool,M as ThemeSwitchTool};
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import{useCart as u}from"./CartContext.js";import c,{useCountrySelectShows as i}from"./CountrySelect.js";import{AccountButton as a,CartButton as m,SearchButton as h}from"./HeaderTools.js";import f from"./ThemeToggle.js";import{useOfferToPhoneMenu as s}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as p}from"./SearchContext.js";import{useSiteSells as l,useSiteThemeSwitchShown as d}from"./SiteRecordContext.js";import{say as x}from"efficient-web-builder/format/lib/editor-words";function j({style:e="icon",editing:o=!1}){const{open:n}=p(),r=l();return s(r?"search":null),r?t("span",{"data-phone-menu-tool":"search",className:"contents",children:t(h,{onClick:o?void 0:n,asText:e==="text"})}):null}function k({style:e="icon",editing:o=!1}){const{open:n,totals:r}=u();return l()?t(m,{onClick:o?()=>{}:n,count:r.sets,asText:e==="text"}):null}function v({style:e="icon"}){const o=l();return s(o?"account":null),o?t(a,{asText:e==="text"}):null}function M(){const e=d();return s(e?"theme":null),e?t("span",{"data-phone-menu-tool":"theme",className:"contents",children:t(f,{})}):null}function O({editing:e=!1,showAs:o}){const n=i();return s(n?"region":null),n?t("span",{"data-phone-menu-tool":"region",className:"contents",children:t(c,{showAs:o})}):e?t("div",{"data-country-placeholder":"",className:"rounded border border-dashed border-line px-3 py-2 text-[13px] text-fg-dim",children:x("No regions yet")}):null}export{v as AccountTool,k as CartTool,O as CountrySwitchTool,j as SearchTool,M as ThemeSwitchTool};
@@ -431,6 +431,21 @@ export interface AdminGeocodeAnswer {
431
431
  label: string;
432
432
  placement: "located" | "approximate" | "";
433
433
  }
434
+ export interface AdminBlockSource {
435
+ key: string;
436
+ label: string;
437
+ blocks: string[];
438
+ fields: string[];
439
+ }
440
+ export interface AdminRecordType {
441
+ key: string;
442
+ label: string;
443
+ fields: {
444
+ key: string;
445
+ label: string;
446
+ kind: string;
447
+ }[];
448
+ }
434
449
  export interface AdminPagePreviewLink {
435
450
  token: string;
436
451
  expires_at: string;
@@ -670,6 +685,8 @@ export declare function createStorefrontAdmin(client?: AdminClient): {
670
685
  slug: string;
671
686
  }, token: string) => Promise<AdminStorefrontPage>;
672
687
  geocode: (query: string, token: string, country?: string) => Promise<AdminGeocodeAnswer>;
688
+ listBlockSources: (token: string) => Promise<AdminBlockSource[]>;
689
+ listRecordTypes: (token: string) => Promise<AdminRecordType[]>;
673
690
  createPagePreviewLink: (id: string, token: string) => Promise<AdminPagePreviewLink>;
674
691
  claimPageEditLock: (id: string, token: string, clientId: string, takeover?: boolean) => Promise<AdminEditLock>;
675
692
  releasePageEditLock: (id: string, token: string) => Promise<void>;
@@ -747,6 +764,8 @@ export declare const storefrontAdmin: {
747
764
  slug: string;
748
765
  }, token: string) => Promise<AdminStorefrontPage>;
749
766
  geocode: (query: string, token: string, country?: string) => Promise<AdminGeocodeAnswer>;
767
+ listBlockSources: (token: string) => Promise<AdminBlockSource[]>;
768
+ listRecordTypes: (token: string) => Promise<AdminRecordType[]>;
750
769
  createPagePreviewLink: (id: string, token: string) => Promise<AdminPagePreviewLink>;
751
770
  claimPageEditLock: (id: string, token: string, clientId: string, takeover?: boolean) => Promise<AdminEditLock>;
752
771
  releasePageEditLock: (id: string, token: string) => Promise<void>;
@@ -1 +1 @@
1
- import{PREVIEW_TOKEN_HEADER as Y,SITE_HOST_HEADER as tt,SITE_SLUG_HEADER as et}from"../site-headers.js";import{PRODUCT_API_BASE as rt,PRODUCT_BACKEND_URL as k}from"./origins.js";import{backendHopHeaders as at,clientIpFromForwardedFor as st,FORWARDED_FOR_HEADER as nt,hopCachingOf as ot}from"../forwarded-for.js";import it from"efficient-web-builder/format/lib/puck/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as ct}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as J}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as L}from"../wheels/renderable-finishes.js";const dt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const _="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",ut=new Set([502,503,504]),N=0,lt="This editor runs on its host's own backend, which does not serve this request.",pt=5e3,yt=15e3,ht=()=>typeof window>"u"?pt:yt;function D(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(ht())}const x=t=>t instanceof Error&&t.name==="TimeoutError",H=(t,e)=>ut.has(t)?_:e,ft=["admin","venue"];let F="admin";function ae(t){F=ft.includes(t)?t:"admin"}function gt(){return F}const mt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let M=null;function se(t){M=t&&mt.test(t)?t:null}function wt(){return M}function St(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=j();return!e||/[?&]site=/.test(t)?t:C(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...w}=e;if(typeof window<"u"&&!ct())throw new m(N,lt,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const a=typeof FormData<"u"&&w.body instanceof FormData;let r;try{r=await fetch(`${o??dt}${St(t)}`,{...w,headers:{...a?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:w.signal??D({...w,audience:p})})}catch(y){throw y instanceof TypeError||x(y)?new m(N,_,null):y}let n;try{n=await r.text()}catch(y){throw x(y)?new m(N,_,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(r.status,r.ok?"Expected JSON but received a non-JSON response":H(r.status,r.statusText),n)}if(!r.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??H(r.status,r.statusText);throw new m(r.status,y,c)}return c}let b=null;async function q(){return b||(b=Pt().finally(()=>{b=null}),b)}async function Pt(){const t=P.takeLegacyRefresh(),e=await Ot.refresh(t??void 0);return P.setTokens(e.access),e.access}async function B(){return P.getAccess()??q()}async function h(t,e={}){let s;try{s=await B()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await q();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function G(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function W(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const Ot={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await B();return await W(),t},me:W,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as bt,absolutizeApiUrl as v}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Tt,isSvgUrl as At}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Rt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Et,webRuntimeSiteSlug as j}from"efficient-web-builder/format/lib/web-runtime";function g(t){if(typeof t=="string")return t.startsWith("/media/")?bt(t):t;if(Array.isArray(t))return t.map(g);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[g(l),p])):g(o);return e}return t}import{PRODUCT_API_BASE as ge}from"./origins.js";const z=typeof window>"u"&&k!=="",Ct=z?k:rt,$t=Et,O=()=>({baseUrl:$t(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const Ut=100,K=50;function V(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(Ut)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function _t(t,e){return V("/wheels",{process:t},e)}function Nt(t,e,s){return V("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function vt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function X(t,e,s=()=>!1){const o=[];let l=null;try{for(let p=0;p<K;p++){const w=await i(await e(l),await u());if(o.push(...w.results),l=vt(w.next),!l)break}l&&console.warn(`[${t}] stopped at ${K} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(s(p))throw p;console.warn(`[${t}] product API unavailable, returning []`,p)}return o}const It=t=>t instanceof m&&t.status===400;function kt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?J([e]):[e])}async function Z(){return(await Jt()).host}async function Jt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(tt)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Lt(){try{const{headers:t}=await import("next/headers");return st((await t()).get(nt))}catch{return null}}async function Dt(){try{const{headers:t}=await import("next/headers");return(await t()).get(et)||null}catch{return null}}async function xt(){const t=await Dt();if(t)return`site=${encodeURIComponent(t)}`;const e=await Z();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=j();return e?C(t,`site=${encodeURIComponent(e)}`):t}return C(t,await xt())}function C(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Ht="preview";async function Ft(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(Y)}catch{return null}}async function Mt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function I(t,e){const s=await Ft();if(s===null)return[await f(t),await u(e)];const o=C(await f(t),`${Ht}=${encodeURIComponent(s)}`),{next:l,cache:p,...w}=e??{},a=await u({...w,cache:"no-store"}),r=await Mt();return r&&(a.headers={...a.headers,"user-agent":r}),[o,a]}async function qt(t){if(!z)return;const[e,s]=await Promise.all([Z(),Lt()]),o=at(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await qt(ot(t)),s={baseUrl:Ct,...t};return e&&(s.headers={...e,...t?.headers}),s}const T=typeof window>"u";function A(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const de={listMakes:async t=>{if(T){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(A("/makes",{region:t}),O())).results},listModels:async(t,e)=>{if(T){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(A("/models",{make:t,region:e}),O())).results},listYears:async(t,e,s)=>{if(T){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(A("/years",{make:t,model:e,region:s}),O())).results},listModifications:async(t,e,s,o)=>{if(T){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(A("/modifications",{make:t,model:e,year:s,region:o}),O())).results},getStockFitment:async(t,e,s,o,l)=>{if(T){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(A("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),O())}},ue={listWheels:async t=>{const e=await X("products.listWheels",async s=>await f(_t(t,s)));return J(g(e))},listCatalog:async(t,e)=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await X("products.listCatalog",async o=>await f(Nt(t,e,o)),It);return kt(g(s))},getWheel:async t=>L(g(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>g(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async()=>{try{return await i(await f(d("/bundles")),await u())}catch{return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return g(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,O());return g(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>g(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await I(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return g(await i(o,l))},listBlogPosts:async(t={})=>{const e=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+e,await u())).map(o=>({...o,coverImage:v(o.coverImage)??""}))}catch(s){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:v(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await G(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await G(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=D({method:"GET"}),e=await i(...await I(d("/header-settings"),{signal:t})),s=v(e.logoUrl);let o=null,l=null;if(s&&At(s)){const p=await Tt(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await I(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},le={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class Bt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const $=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},R=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,Gt=t=>`${R(t)}currencies/`,Wt="/api/storefront/media/ingest/";class jt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function zt(){const t=Rt();if(!t)throw new jt;return`${Wt}?${new URLSearchParams({site:t})}`}const U={"X-Puck-Media-Manifest":it.contentHash},pe=Q({});function Q(t){return(e,s={})=>{const o=wt(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??gt()})}}function Kt(t={}){const e=Q(t),s=t.siteDrafts===!0,o=a=>$("header-settings",a,s),l=a=>$("theme-settings",a,s),p=a=>$("chat-settings",a,s),w=a=>$("social-settings",a,s);return{findPageBySlug:async(a,r,n)=>{const c=new URLSearchParams({slug:a});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:r}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new Bt(a,S.length);return S[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,n,c,y)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(a,r,n)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:n}),geocode:(a,r,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:a,country:n}:{q:a})}`,{token:r}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,n,c=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:U,token:n}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,n)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:U,token:n}),listTemplatePages:async(a,r)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(a,r,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(a,r,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:U,token:n}),saveTemplatePageLayout:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:U,token:n}),deleteTemplatePage:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},createPage:(a,r,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:n}),token:c}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(o(r),{token:a}),listMenus:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/menus/?${n}`,{token:a});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(a,r)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,E)=>S.sort_order-E.sort_order||S.name.localeCompare(E.name))},listForms:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,E)=>S.title.localeCompare(E.title))},listWheelSummaries:async(a,r={})=>{const n=new URLSearchParams;r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:a});return g(y)},listProducts:async(a,r={})=>{const n=new URLSearchParams;r.kinds?.length&&n.set("kind",r.kinds.join(",")),r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:a});return g(y)},getWheelDetail:async(a,r,n={})=>{const c=new URLSearchParams({slug:r});return n.siteId&&c.set("site",n.siteId),L(g(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:a})))},updateHeaderSettings:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(R(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return Array.isArray(r)?r:r.results??[]},listSiteCurrencies:async(a,r)=>{const n=await e(Gt(a),{token:r});return Array.isArray(n)?n:[]},publishSite:(a,r)=>e(`${R(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${R(a)}live-state/`,{token:r}),updateSite:(a,r,n)=>e(R(a),{method:"PATCH",body:JSON.stringify(r),token:n}),getThemeSettings:(a,r)=>e(l(r),{token:a}),updateThemeSettings:(a,r,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getChatSettings:(a,r)=>e(p(r),{token:a}),updateChatSettings:(a,r,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(w(r),{token:a}),updateSocialSettings:(a,r,n)=>e(w(n),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,n)=>{const c=new FormData;return c.append("logo",a),e(o(n),{method:"PATCH",body:c,token:r})},clearHeaderLogo:(a,r)=>e(o(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const n=new FormData;return n.append("file",a),e(zt(),{method:"POST",body:n,token:r})},listMedia:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("kind",r);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]}}}const ye=Kt({siteDrafts:!0});export{dt as API_URL,Bt as AmbiguousPageSlugError,m as ApiError,yt as BROWSER_READ_TIMEOUT_MS,lt as EFFICIENT_CLIENT_CLOSED_MESSAGE,jt as MediaUploadDestinationError,Ht as PREVIEW_PARAM,ge as PRODUCT_API_BASE,pt as SERVER_READ_TIMEOUT_MS,_ as SERVER_UNREACHABLE_MESSAGE,N as STATUS_NETWORK_ERROR,pe as adminFetch,Ot as api,i as apiFetch,C as appendSiteQuery,le as bookings,Kt as createStorefrontAdmin,D as defaultRequestDeadline,zt as editorMediaUploadPath,gt as editorPortalAudience,wt as editorRequestLanguage,de as fitment,ue as products,ht as readDeadlineMs,Lt as resolveClientIp,g as resolveMediaUrls,Ft as resolvePreviewToken,Z as resolveSiteHost,Jt as resolveSiteHostSource,Dt as resolveSiteSlug,se as setEditorLanguage,ae as setEditorPortalAudience,ye as storefrontAdmin};
1
+ import{PREVIEW_TOKEN_HEADER as Y,SITE_HOST_HEADER as tt,SITE_SLUG_HEADER as et}from"../site-headers.js";import{PRODUCT_API_BASE as rt,PRODUCT_BACKEND_URL as k}from"./origins.js";import{backendHopHeaders as at,clientIpFromForwardedFor as st,FORWARDED_FOR_HEADER as nt,hopCachingOf as ot}from"../forwarded-for.js";import it from"efficient-web-builder/format/lib/puck/media-manifest.json";import{auth as P}from"../auth.js";import{efficientClientOpen as ct}from"efficient-easel/screen/lib/session";import{listableWheelSummaries as J}from"../wheels/listable-wheels.js";import{dropRenderlessFinishes as L}from"../wheels/renderable-finishes.js";const dt=process.env.NEXT_PUBLIC_API_URL??"http://localhost:8000";class m extends Error{status;data;constructor(e,s,o){super(s),this.status=e,this.data=o}}const _="Unable to reach the server. This could be a problem with your internet connection, or the server may be undergoing maintenance or an upgrade. Please try again shortly.",ut=new Set([502,503,504]),N=0,lt="This editor runs on its host's own backend, which does not serve this request.",pt=5e3,yt=15e3,ht=()=>typeof window>"u"?pt:yt;function D(t){const e=(t.method??"GET").toUpperCase();if(!(t.body!=null||e!=="GET"&&e!=="HEAD")&&!(t.audience!=null&&t.audience!=="shop")&&typeof AbortSignal?.timeout=="function")return AbortSignal.timeout(ht())}const x=t=>t instanceof Error&&t.name==="TimeoutError",H=(t,e)=>ut.has(t)?_:e,ft=["admin","venue"];let F="admin";function ae(t){F=ft.includes(t)?t:"admin"}function gt(){return F}const mt=/^[A-Za-z]{2,3}(?:-[A-Za-z0-9]{1,8})*$/;let M=null;function se(t){M=t&&mt.test(t)?t:null}function wt(){return M}function St(t){if(typeof window>"u"||!t.startsWith("/api/v1/"))return t;const e=j();return!e||/[?&]site=/.test(t)?t:C(t,`site=${encodeURIComponent(e)}`)}async function i(t,e={}){const{token:s,baseUrl:o,headers:l,audience:p,...w}=e;if(typeof window<"u"&&!ct())throw new m(N,lt,null);if(typeof window>"u"&&o===void 0)throw new Error(`apiFetch(${JSON.stringify(t)}) ran on the server without an explicit baseUrl. The API_URL default it would inherit is browser-only (the prod image bakes NEXT_PUBLIC_API_URL="" for same-origin use, which a Node fetch cannot resolve). Pass a base explicitly: \`await backendOpts()\` (or baseUrl: PRODUCT_FETCH_BASE) for product reads, or the server-only PRODUCT_BACKEND_URL env for other backend surfaces.`);const a=typeof FormData<"u"&&w.body instanceof FormData;let r;try{r=await fetch(`${o??dt}${St(t)}`,{...w,headers:{...a?{}:{"Content-Type":"application/json"},...s?{Authorization:`Bearer ${s}`}:{},...p===null?{}:{"X-Portal-Audience":p??"shop"},...l},signal:w.signal??D({...w,audience:p})})}catch(y){throw y instanceof TypeError||x(y)?new m(N,_,null):y}let n;try{n=await r.text()}catch(y){throw x(y)?new m(N,_,null):y}let c=null;if(n)try{c=JSON.parse(n)}catch{throw new m(r.status,r.ok?"Expected JSON but received a non-JSON response":H(r.status,r.statusText),n)}if(!r.ok){const y=(c&&typeof c=="object"&&"detail"in c&&typeof c.detail=="string"?c.detail:null)??H(r.status,r.statusText);throw new m(r.status,y,c)}return c}let O=null;async function B(){return O||(O=Pt().finally(()=>{O=null}),O)}async function Pt(){const t=P.takeLegacyRefresh(),e=await bt.refresh(t??void 0);return P.setTokens(e.access),e.access}async function q(){return P.getAccess()??B()}async function h(t,e={}){let s;try{s=await q()}catch{throw P.clear(),new m(401,"Not signed in",null)}try{return await i(t,{...e,token:s})}catch(o){if(!(o instanceof m)||o.status!==401)throw o;try{const l=await B();return await i(t,{...e,token:l})}catch{throw P.clear(),o}}}async function G(t,e={}){if(P.getAccess())try{return{data:await h(t,e),asShopper:!0}}catch(s){if(!(s instanceof m)||s.status!==401)throw s}return{data:await i(t,e),asShopper:!1}}async function W(){const t=await h("/api/auth/me/");if(t.portal!=="shop")throw P.clear(),new m(403,"This session is not valid for this shop.",null);return t}const bt={login:(t,e)=>i("/api/auth/login/",{method:"POST",body:JSON.stringify({email:t,password:e,portal:"shop"}),credentials:"include"}),refresh:t=>i("/api/auth/refresh/",{method:"POST",body:JSON.stringify(t?{refresh:t,portal:"shop"}:{portal:"shop"}),credentials:"include"}),logout:async()=>{P.clear();try{await i("/api/auth/logout/",{method:"POST",body:JSON.stringify({portal:"shop"}),credentials:"include"})}catch{}},restoreSession:async()=>{const t=await q();return await W(),t},me:W,updateMe:t=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify(t)}),changePassword:(t,e)=>h("/api/auth/me/",{method:"PATCH",body:JSON.stringify({password:e,old_password:t})}),changeEmail:(t,e)=>h("/api/shop-portal/change-email/",{method:"POST",body:JSON.stringify({new_email:t,current_password:e})}),myProfile:()=>h("/api/shop-portal/profile/"),updateMyProfile:t=>h("/api/shop-portal/profile/",{method:"PATCH",body:JSON.stringify(t)}),myAddresses:()=>h("/api/shop-portal/delivery-locations/"),createAddress:t=>h("/api/shop-portal/delivery-locations/",{method:"POST",body:JSON.stringify(t)}),updateAddress:(t,e)=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"PATCH",body:JSON.stringify(e)}),deleteAddress:t=>h(`/api/shop-portal/delivery-locations/${t}/`,{method:"DELETE"}),passwordResetRequest:t=>i("/api/auth/password-reset/",{method:"POST",body:JSON.stringify({email:t})}),passwordResetConfirm:(t,e,s)=>i("/api/auth/password-reset/confirm/",{method:"POST",body:JSON.stringify({uid:t,token:e,new_password:s})}),brands:()=>h("/api/products/brands/"),myOrders:()=>h("/api/shop-portal/orders/").then(t=>t.results),myOrder:t=>h(`/api/shop-portal/orders/${t}/`),cancelOrder:t=>h(`/api/shop-portal/orders/${t}/cancel/`,{method:"POST"}),myReturns:t=>h(`/api/shop-portal/returns/${t?`?order=${encodeURIComponent(t)}`:""}`).then(e=>e.results),createReturn:t=>h("/api/shop-portal/returns/",{method:"POST",body:JSON.stringify(t)}),withdrawReturn:t=>h(`/api/shop-portal/returns/${t}/cancel/`,{method:"POST"}),uploadReturnPhoto:(t,e)=>{const s=new FormData;return s.append("claim_item",t),s.append("file",e),s.append("media_type",e.type.startsWith("video/")?"video":"image"),h("/api/shop-portal/return-media/",{method:"POST",body:s})}};import{media as Ot,absolutizeApiUrl as v}from"efficient-web-builder/render/lib/media";import{analyzeLogoSvg as Tt,isSvgUrl as At}from"efficient-web-builder/format/lib/logo/reverse-svg";import{getEditorSiteId as Rt}from"efficient-web-builder/render/lib/editor-site";import{shopRouteBase as Et,webRuntimeSiteSlug as j}from"efficient-web-builder/format/lib/web-runtime";function g(t){if(typeof t=="string")return t.startsWith("/media/")?Ot(t):t;if(Array.isArray(t))return t.map(g);if(t&&typeof t=="object"){const e={};for(const[s,o]of Object.entries(t))e[s]=s==="captions"&&o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).map(([l,p])=>[g(l),p])):g(o);return e}return t}import{PRODUCT_API_BASE as ge}from"./origins.js";const z=typeof window>"u"&&k!=="",Ct=z?k:rt,$t=Et,b=()=>({baseUrl:$t(),audience:null});function d(t,e){const s=e?`?process=${encodeURIComponent(e)}`:"";return`/api/v1${t}${s}`}const Ut=100,K=50;function V(t,e,s){const o=new URLSearchParams;for(const[l,p]of Object.entries(e))p!=null&&p!==""&&o.set(l,String(p));return o.set("pageSize",String(Ut)),s&&o.set("cursor",s),`/api/v1${t}?${o.toString()}`}function _t(t,e){return V("/wheels",{process:t},e)}function Nt(t,e,s){return V("/products",{kind:t.join(","),make:e?.make,model:e?.model,year:e?.year,modification:e?.modification},s)}function vt(t){if(!t)return null;try{return new URL(t,"http://cursor.invalid").searchParams.get("cursor")}catch{return null}}async function X(t,e,s=()=>!1){const o=[];let l=null;try{for(let p=0;p<K;p++){const w=await i(await e(l),await u());if(o.push(...w.results),l=vt(w.next),!l)break}l&&console.warn(`[${t}] stopped at ${K} pages (${o.length} rows); catalog may be truncated`)}catch(p){if(s(p))throw p;console.warn(`[${t}] product API unavailable, returning []`,p)}return o}const It=t=>t instanceof m&&t.status===400;function kt(t){return t.flatMap(e=>e.kind==="alloy-wheel"?J([e]):[e])}async function Z(){return(await Jt()).host}async function Jt(){try{const{headers:t}=await import("next/headers"),e=await t(),s=p=>p?.split(",")[0]?.split(":")[0]?.trim().toLowerCase()||null,o=s(e.get(tt)??e.get("x-forwarded-host")??e.get("host")),l=s(e.get("host"));return{host:o,matchesRequestHost:o!==null&&o===l}}catch{return{host:null,matchesRequestHost:!1}}}async function Lt(){try{const{headers:t}=await import("next/headers");return st((await t()).get(nt))}catch{return null}}async function Dt(){try{const{headers:t}=await import("next/headers");return(await t()).get(et)||null}catch{return null}}async function xt(){const t=await Dt();if(t)return`site=${encodeURIComponent(t)}`;const e=await Z();return e?`host=${encodeURIComponent(e)}`:""}async function f(t){if(typeof window<"u"){const e=j();return e?C(t,`site=${encodeURIComponent(e)}`):t}return C(t,await xt())}function C(t,e){return e?`${t}${t.includes("?")?"&":"?"}${e}`:t}const Ht="preview";async function Ft(){if(typeof window<"u")return null;try{const{headers:t}=await import("next/headers");return(await t()).get(Y)}catch{return null}}async function Mt(){try{const{headers:t}=await import("next/headers");return(await t()).get("user-agent")}catch{return null}}async function I(t,e){const s=await Ft();if(s===null)return[await f(t),await u(e)];const o=C(await f(t),`${Ht}=${encodeURIComponent(s)}`),{next:l,cache:p,...w}=e??{},a=await u({...w,cache:"no-store"}),r=await Mt();return r&&(a.headers={...a.headers,"user-agent":r}),[o,a]}async function Bt(t){if(!z)return;const[e,s]=await Promise.all([Z(),Lt()]),o=at(e,s,t);return Object.keys(o).length>0?o:void 0}async function u(t){const e=await Bt(ot(t)),s={baseUrl:Ct,...t};return e&&(s.headers={...e,...t?.headers}),s}const T=typeof window>"u";function A(t,e){const s=new URLSearchParams;for(const[l,p]of Object.entries(e))p!==void 0&&p!==""&&s.set(l,String(p));const o=s.toString();return`/api/v1/fitment${t}${o?`?${o}`:""}`}const de={listMakes:async t=>{if(T){const{fitmentData:s}=await import("./fitment-data.js");return s.makes(t)}return(await i(A("/makes",{region:t}),b())).results},listModels:async(t,e)=>{if(T){const{fitmentData:o}=await import("./fitment-data.js");return o.models(t,e)}return(await i(A("/models",{make:t,region:e}),b())).results},listYears:async(t,e,s)=>{if(T){const{fitmentData:l}=await import("./fitment-data.js");return l.years(t,e,s)}return(await i(A("/years",{make:t,model:e,region:s}),b())).results},listModifications:async(t,e,s,o)=>{if(T){const{fitmentData:p}=await import("./fitment-data.js");return p.modifications(t,e,s,o)}return(await i(A("/modifications",{make:t,model:e,year:s,region:o}),b())).results},getStockFitment:async(t,e,s,o,l)=>{if(T){const{fitmentData:p}=await import("./fitment-data.js");return p.stockFitment(t,e,s,o,l)}return i(A("/stock-fitment",{make:t,model:e,year:s,modification:o,region:l}),b())}},ue={listWheels:async t=>{const e=await X("products.listWheels",async s=>await f(_t(t,s)));return J(g(e))},listCatalog:async(t,e)=>{if(t.length===0)throw new Error("products.listCatalog() needs at least one kind. An empty list would omit `kind`, which the contract reads as `alloy-wheel` — so the call would silently return the wheel catalog instead of nothing.");const s=await X("products.listCatalog",async o=>await f(Nt(t,e,o)),It);return kt(g(s))},getWheel:async t=>L(g(await i(await f(d(`/wheels/${t}`)),await u()))),getTyre:async t=>g(await i(await f(d(`/tyres/${t}`)),await u())),listBundles:async()=>{try{return await i(await f(d("/bundles")),await u())}catch{return[]}},getBundle:async t=>i(await f(d(`/bundles/${t}`)),await u()),listGalleryBuilds:async(t={})=>{const{process:e=null,wheelSlug:s=null}=t;if(typeof window>"u"){const{listGalleryBuilds:o}=await import("./gallery-builds-data.js");return g(o(e,s))}try{const o=new URLSearchParams;e&&o.set("process",e),s&&o.set("wheelSlug",s);const l=o.toString(),p=await i(`/api/v1/gallery-builds${l?`?${l}`:""}`,b());return g(p.results)}catch(o){return console.warn("[products.listGalleryBuilds] product API unavailable, returning []",o),[]}},getSite:async()=>i(await f(d("/site")),await u()),getSiteBySlug:async t=>i(`${d("/site")}?${new URLSearchParams({site:t})}`,typeof window>"u"?await u():void 0),listPages:async()=>g(await i(await f(d("/pages")),await u())),listPopups:async()=>i(await f(d("/popups")),await u()),listProductTemplates:async()=>{try{return await i(await f(d("/product-templates")),await u())}catch(t){return console.warn("[products.listProductTemplates] unavailable, returning []",t),[]}},listDynamicPages:async t=>{const e=t?`?recordType=${encodeURIComponent(t)}`:"";try{return await i(await f(`${d("/dynamic-pages")}${e}`),await u())}catch(s){if(s instanceof m&&s.status===404)return[];throw s}},getRecord:async(t,e)=>{try{return await i(await f(d(`/records/${encodeURIComponent(t)}/${encodeURIComponent(e)}`)),await u())}catch(s){if(s instanceof m&&s.status===404)return null;throw s}},listRecordKeys:async t=>{try{const e=await i(await f(d(`/records/${encodeURIComponent(t)}`)),await u({cache:"no-store"}));return Array.isArray(e?.keys)?e.keys.filter(s=>typeof s=="string"&&s!==""):[]}catch(e){if(e instanceof m&&e.status===404)return[];throw e}},listProductTypeChoices:async()=>{try{return await i(await f(d("/product-type-choices")),await u())}catch(t){return console.warn("[products.listProductTypeChoices] unavailable, returning []",t),[]}},listFieldUsage:async()=>{try{return await i(await f(d("/field-usage")),await u())}catch(t){return console.warn("[products.listFieldUsage] unavailable, returning []",t),[]}},getPage:async(t,e={})=>{const s=e.record?`?record=${encodeURIComponent(e.record)}`:"",[o,l]=await I(d(`/pages/${t}`)+s,e.revalidate!==void 0?{next:{revalidate:e.revalidate}}:void 0);return g(await i(o,l))},listBlogPosts:async(t={})=>{const e=t.category?`?category=${encodeURIComponent(t.category)}`:"";try{return(await i(d("/blog-posts")+e,await u())).map(o=>({...o,coverImage:v(o.coverImage)??""}))}catch(s){return console.warn("[products.listBlogPosts] blog API unavailable, returning []",s),[]}},getBlogPost:async t=>{const e=await i(d(`/blog-posts/${t}`),await u());return{...e,coverImage:v(e.coverImage)??""}},createOrder:async t=>i(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),createOrderAuthed:async t=>h(d("/orders"),await u({method:"POST",body:JSON.stringify(t)})),lookupOrder:async t=>i(d("/orders/lookup"),await u({method:"POST",body:JSON.stringify(t)})),createPaymentIntent:async t=>i(d("/payments/intent"),await u({method:"POST",body:JSON.stringify(t)})),createPaypalOrder:async t=>i(d("/payments/paypal/order"),await u({method:"POST",body:JSON.stringify(t)})),capturePaypalOrder:async t=>i(d("/payments/paypal/capture"),await u({method:"POST",body:JSON.stringify(t)})),createAfterpayCheckout:async t=>i(d("/payments/afterpay/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureAfterpayPayment:async t=>i(d("/payments/afterpay/capture"),await u({method:"POST",body:JSON.stringify(t)})),chargeSquare:async t=>i(d("/payments/square/charge"),await u({method:"POST",body:JSON.stringify(t)})),createGocardlessBillingRequest:async t=>i(d("/payments/gocardless/billing-request"),await u({method:"POST",body:JSON.stringify(t)})),completeGocardlessPayment:async t=>i(d("/payments/gocardless/complete"),await u({method:"POST",body:JSON.stringify(t)})),createZipCheckout:async t=>i(d("/payments/zip/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureZipPayment:async t=>i(d("/payments/zip/capture"),await u({method:"POST",body:JSON.stringify(t)})),createKlarnaCheckout:async t=>i(d("/payments/klarna/checkout"),await u({method:"POST",body:JSON.stringify(t)})),captureKlarnaPayment:async t=>i(d("/payments/klarna/capture"),await u({method:"POST",body:JSON.stringify(t)})),createStockAlert:async t=>i(d("/stock-alerts"),await u({method:"POST",body:JSON.stringify(t)})),createPreOrderIntent:async t=>i(d("/pre-order-intents"),await u({method:"POST",body:JSON.stringify(t)})),createNewsletterSubscription:async t=>i(d("/newsletter-subscriptions"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeNewsletter:async t=>i(d("/newsletter-unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),captureCart:async t=>i(d("/carts"),await u({method:"POST",body:JSON.stringify(t)})),restoreCart:async t=>i(d("/carts/restore"),await u({method:"POST",body:JSON.stringify(t)})),unsubscribeCartReminders:async t=>i(d("/carts/unsubscribe"),await u({method:"POST",body:JSON.stringify(t)})),listReviews:async(t={})=>{const e=new URLSearchParams;t.limit&&e.set("limit",String(t.limit)),t.designCode&&e.set("designCode",t.designCode);const s=d("/reviews"),o=e.toString();try{return await i(await f(o?`${s}?${o}`:s),await u())}catch(l){return console.warn("[products.listReviews] product API unavailable, returning []",l),[]}},submitReview:async t=>i(d("/reviews"),await u({method:"POST",body:JSON.stringify(t)})),getForm:async t=>i(d(`/forms/${encodeURIComponent(t)}`),await u()),submitForm:async(t,e)=>i(d(`/forms/${encodeURIComponent(t)}/submissions`),await u({method:"POST",body:JSON.stringify(e)})),listShippingMethods:async()=>{try{return await i(d("/shipping-methods"),await u())}catch(t){return console.warn("[products.listShippingMethods] product API unavailable, returning []",t),[]}},listCountrySubdivisions:async t=>{try{return await i(d(`/countries/${encodeURIComponent(t)}/subdivisions`),await u())}catch(e){return console.warn("[products.listCountrySubdivisions] unavailable, returning []",e),[]}},quoteCart:async t=>{const e=d("/cart/quote"),s=await u({method:"POST",body:JSON.stringify(t)});return t.couponCode?(await G(e,s)).data:i(e,s)},validateCoupon:async t=>{const{data:e,asShopper:s}=await G(d("/coupons/validate"),await u({method:"POST",body:JSON.stringify(t)}));return{...e,askedAsShopper:s}},getHeaderSettings:async()=>{const t=D({method:"GET"}),e=await i(...await I(d("/header-settings"),{signal:t})),s=v(e.logoUrl);let o=null,l=null;if(s&&At(s)){const p=await Tt(s,t);p&&(o=p.reversed,l=p.inkIsDark)}return{...e,logoUrl:s,logoReversed:o,logoInkIsDark:l}},getThemeSettings:async()=>i(...await I(d("/theme-settings"))),getChatSettings:async()=>i(await f(d("/chat-settings")),await u())},le={listServices:async()=>{try{return await i(d("/bookings/services"),await u())}catch(t){return console.warn("[bookings.listServices] API unavailable, returning []",t),{results:[],currency:"USD"}}},getAvailability:async(t,e)=>i(d(`/bookings/availability?service=${encodeURIComponent(t)}&date=${e}`),await u()),create:async t=>i(d("/bookings"),await u({method:"POST",body:JSON.stringify(t)})),get:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}`),await u()),cancel:async t=>i(d(`/bookings/manage/${encodeURIComponent(t)}/cancel`),await u({method:"POST"})),createPaymentIntent:async t=>i(d("/bookings/payments/intent"),await u({method:"POST",body:JSON.stringify({manageToken:t})}))};class qt extends Error{slug;count;constructor(e,s){super(`Slug "${e}" exists on ${s} websites; a site is required to pick one.`),this.slug=e,this.count=s,this.name="AmbiguousPageSlugError"}}const $=(t,e,s)=>{const o=new URLSearchParams({...e?{site:e}:{},...s?{draft:"1"}:{}}).toString();return`/api/storefront/${t}/${o?`?${o}`:""}`},R=t=>`/api/storefront/sites/${encodeURIComponent(t)}/`,Gt=t=>`${R(t)}currencies/`,Wt="/api/storefront/media/ingest/";class jt extends Error{constructor(){super("This editor is not connected to a website, so an upload has nowhere to go. Open the page from the website the file should belong to, then try again."),this.name="MediaUploadDestinationError"}}function zt(){const t=Rt();if(!t)throw new jt;return`${Wt}?${new URLSearchParams({site:t})}`}const U={"X-Puck-Media-Manifest":it.contentHash},pe=Q({});function Q(t){return(e,s={})=>{const o=wt(),l=t.headers||o?{...o?{"Accept-Language":o}:{},...t.headers,...s.headers}:void 0;return i(e,{...s,...t.baseUrl!==void 0?{baseUrl:t.baseUrl}:{},...l?{headers:l}:{},audience:t.audience??gt()})}}function Kt(t={}){const e=Q(t),s=t.siteDrafts===!0,o=a=>$("header-settings",a,s),l=a=>$("theme-settings",a,s),p=a=>$("chat-settings",a,s),w=a=>$("social-settings",a,s);return{findPageBySlug:async(a,r,n)=>{const c=new URLSearchParams({slug:a});n&&c.set("site",n);const y=await e(`/api/storefront/pages/?${c.toString()}`,{token:r}),S=Array.isArray(y)?y:y.results??[];if(!n&&S.length>1)throw new qt(a,S.length);return S[0]??null},getPageById:(a,r)=>e(`/api/storefront/pages/${a}/`,{token:r}),saveLayout:(a,r,n,c,y)=>e(`/api/storefront/pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r,expected_updated_at:c,...y?{client_id:y}:{}}),token:n}),duplicatePage:(a,r,n)=>e(`/api/storefront/pages/${a}/duplicate/`,{method:"POST",body:JSON.stringify({title:r.title,slug:r.slug}),token:n}),geocode:(a,r,n)=>e(`/api/storefront/geocode/?${new URLSearchParams(n?{q:a,country:n}:{q:a})}`,{token:r}),listBlockSources:a=>e("/api/storefront/block-sources/",{token:a}),listRecordTypes:a=>e("/api/storefront/record-types/",{token:a}),createPagePreviewLink:(a,r)=>e(`/api/storefront/pages/${a}/preview-link/`,{method:"POST",token:r}),claimPageEditLock:(a,r,n,c=!1)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"POST",body:JSON.stringify({client_id:n,takeover:c}),token:r}),releasePageEditLock:(a,r)=>e(`/api/storefront/pages/${a}/edit-lock/`,{method:"DELETE",token:r}),createTemplate:(a,r,n)=>e("/api/storefront/page-templates/",{method:"POST",body:JSON.stringify({name:a,layout:r}),headers:U,token:n}),getTemplate:(a,r)=>e(`/api/storefront/page-templates/${a}/`,{token:r}),saveTemplateLayout:(a,r,n)=>e(`/api/storefront/page-templates/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:U,token:n}),listTemplatePages:async(a,r)=>{const n=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}`,{token:r});return Array.isArray(n)?n:n.results??[]},findTemplatePageBySlug:async(a,r,n)=>{const c=await e(`/api/storefront/template-pages/?template=${encodeURIComponent(a)}&slug=${encodeURIComponent(r)}`,{token:n});return(Array.isArray(c)?c:c.results??[])[0]??null},createTemplatePage:(a,r,n)=>e("/api/storefront/template-pages/",{method:"POST",body:JSON.stringify({template:a,...r}),headers:U,token:n}),saveTemplatePageLayout:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"PATCH",body:JSON.stringify({layout:r}),headers:U,token:n}),deleteTemplatePage:(a,r,n)=>e(`/api/storefront/template-pages/${a}/`,{method:"DELETE",token:r,...n?.keepalive?{keepalive:!0}:{}}),listPages:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/pages/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},createPage:(a,r,n,c)=>e("/api/storefront/pages/",{method:"POST",body:JSON.stringify({title:a,slug:r,layout:n}),token:c}),deletePage:(a,r)=>e(`/api/storefront/pages/${a}/`,{method:"DELETE",token:r}),getHeaderSettings:(a,r)=>e(o(r),{token:a}),listMenus:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("site",r);const c=await e(`/api/storefront/menus/?${n}`,{token:a});return Array.isArray(c)?c:c.results??[]},listBlogPosts:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/blog-posts/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]},listFieldUsage:async(a,r)=>{const n=await e(`/api/storefront/field-usage/?site=${encodeURIComponent(r)}`,{token:a});return Array.isArray(n?.entries)?n.entries:[]},listCategories:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.visibleOnly&&n.set("is_visible","true"),r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/categories/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,E)=>S.sort_order-E.sort_order||S.name.localeCompare(E.name))},listForms:async(a,r={})=>{const n=new URLSearchParams({no_page:"true"});r.siteId&&n.set("site",r.siteId);const c=await e(`/api/storefront/forms/?${n.toString()}`,{token:a});return[...Array.isArray(c)?c:c.results??[]].sort((S,E)=>S.title.localeCompare(E.title))},listWheelSummaries:async(a,r={})=>{const n=new URLSearchParams;r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/wheel-curations/summaries/${c?`?${c}`:""}`,{token:a});return g(y)},listProducts:async(a,r={})=>{const n=new URLSearchParams;r.kinds?.length&&n.set("kind",r.kinds.join(",")),r.siteId&&n.set("site",r.siteId);const c=n.toString(),y=await e(`/api/storefront/products/${c?`?${c}`:""}`,{token:a});return g(y)},getWheelDetail:async(a,r,n={})=>{const c=new URLSearchParams({slug:r});return n.siteId&&c.set("site",n.siteId),L(g(await e(`/api/storefront/wheel-curations/detail/?${c.toString()}`,{token:a})))},updateHeaderSettings:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSite:(a,r)=>e(R(a),{token:r}),listSites:async a=>{const r=await e("/api/storefront/sites/?no_page=true",{token:a});return Array.isArray(r)?r:r.results??[]},listSiteCurrencies:async(a,r)=>{const n=await e(Gt(a),{token:r});return Array.isArray(n)?n:[]},publishSite:(a,r)=>e(`${R(a)}publish/`,{method:"POST",token:r}),getSiteLiveState:(a,r)=>e(`${R(a)}live-state/`,{token:r}),updateSite:(a,r,n)=>e(R(a),{method:"PATCH",body:JSON.stringify(r),token:n}),getThemeSettings:(a,r)=>e(l(r),{token:a}),updateThemeSettings:(a,r,n)=>e(l(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getChatSettings:(a,r)=>e(p(r),{token:a}),updateChatSettings:(a,r,n)=>e(p(n),{method:"PATCH",body:JSON.stringify(a),token:r}),getSocialSettings:(a,r)=>e(w(r),{token:a}),updateSocialSettings:(a,r,n)=>e(w(n),{method:"PATCH",body:JSON.stringify(a),token:r}),uploadHeaderLogo:(a,r,n)=>{const c=new FormData;return c.append("logo",a),e(o(n),{method:"PATCH",body:c,token:r})},clearHeaderLogo:(a,r)=>e(o(r),{method:"PATCH",body:JSON.stringify({logo:null}),token:a}),setHeaderLogoFromAsset:(a,r,n)=>e(o(n),{method:"PATCH",body:JSON.stringify({logo_asset_id:a}),token:r}),uploadMedia:async(a,r)=>{const n=new FormData;return n.append("file",a),e(zt(),{method:"POST",body:n,token:r})},listMedia:async(a,r)=>{const n=new URLSearchParams({no_page:"true"});r&&n.set("kind",r);const c=await e(`/api/storefront/media-assets/?${n.toString()}`,{token:a});return Array.isArray(c)?c:c.results??[]}}}const ye=Kt({siteDrafts:!0});export{dt as API_URL,qt as AmbiguousPageSlugError,m as ApiError,yt as BROWSER_READ_TIMEOUT_MS,lt as EFFICIENT_CLIENT_CLOSED_MESSAGE,jt as MediaUploadDestinationError,Ht as PREVIEW_PARAM,ge as PRODUCT_API_BASE,pt as SERVER_READ_TIMEOUT_MS,_ as SERVER_UNREACHABLE_MESSAGE,N as STATUS_NETWORK_ERROR,pe as adminFetch,bt as api,i as apiFetch,C as appendSiteQuery,le as bookings,Kt as createStorefrontAdmin,D as defaultRequestDeadline,zt as editorMediaUploadPath,gt as editorPortalAudience,wt as editorRequestLanguage,de as fitment,ue as products,ht as readDeadlineMs,Lt as resolveClientIp,g as resolveMediaUrls,Ft as resolvePreviewToken,Z as resolveSiteHost,Jt as resolveSiteHostSource,Dt as resolveSiteSlug,se as setEditorLanguage,ae as setEditorPortalAudience,ye as storefrontAdmin};
@@ -33,7 +33,8 @@ export declare function bannerWords(rule: ConsentRule, brand: string, tags: Cons
33
33
  export declare const PANEL_ROWS: {
34
34
  readonly necessary: {
35
35
  readonly name: "Necessary";
36
- readonly body: "Cart, checkout, your country and currency, sign-in, and this choice. The shop cannot work without them.";
36
+ readonly body: "Cart, checkout, your country and currency, sign-in, and this choice. The site cannot work without them.";
37
+ readonly bodyNoSale: "What the site needs to work, such as remembering this choice. The site cannot work without them.";
37
38
  };
38
39
  readonly analytics: {
39
40
  readonly name: "Analytics";
@@ -41,11 +42,12 @@ export declare const PANEL_ROWS: {
41
42
  };
42
43
  readonly ads: {
43
44
  readonly body: "Google Ads and Meta (Facebook, Instagram) tags, and the order details we send to them to measure our ads.";
45
+ readonly bodyNoSale: "Google Ads and Meta (Facebook, Instagram) tags, which measure our ads.";
44
46
  };
45
47
  };
46
48
  export declare const PANEL_HEADING = "Your privacy choices.";
47
49
  export declare const GPC_HONOURED: {
48
- readonly title: "Opt-out request honored";
50
+ readonly title: "Opt-out request honoured";
49
51
  readonly body: "Your browser sent a Global Privacy Control signal. We have turned off sale and sharing of your information for ads.";
50
52
  };
51
53
  export declare const CONSENT_BUTTONS: {
@@ -1 +1 @@
1
- const g=1,s="Ads on. Shopper can opt out.",i="Ads and analytics off until Accept",r={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:s,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:i,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:s,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:s,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:i,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:i,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:i,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}},C="Honoured: ads off",l=new Set(["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","IS","LI","NO"]),c={US:"us",PR:"us",GU:"us",VI:"us",AS:"us",MP:"us",CA:"ca",AU:"au",NZ:"nz",GB:"uk"};function u(o){const e=(o??"").trim().toUpperCase();return e?c[e]?c[e]:l.has(e)?"eu":"other":"other"}const h=new Set(["Pacific/Honolulu","Pacific/Guam","Pacific/Saipan","Pacific/Pago_Pago","America/Puerto_Rico","America/St_Thomas"]),d=new Set(["New_York","Chicago","Denver","Los_Angeles","Phoenix","Anchorage","Adak","Boise","Detroit","Juneau","Sitka","Metlakatla","Yakutat","Nome","Menominee","Indianapolis","Louisville","Fort_Wayne","Knox_IN"]),f=new Set(["Toronto","Vancouver","Edmonton","Winnipeg","Halifax","St_Johns","Regina","Montreal","Moncton","Glace_Bay","Goose_Bay","Iqaluit","Whitehorse","Dawson","Dawson_Creek","Fort_Nelson","Creston","Cambridge_Bay","Inuvik","Rankin_Inlet","Resolute","Swift_Current","Atikokan","Blanc-Sablon","Nipigon","Thunder_Bay","Rainy_River","Pangnirtung","Yellowknife","Coral_Harbour"]);function y(o){const e=(o??"").trim();if(!e)return"other";if(e==="Europe/London"||e==="Europe/Belfast"||e==="GB"||e==="GB-Eire"||e==="Europe/Guernsey"||e==="Europe/Jersey"||e==="Europe/Isle_of_Man")return"uk";if(e.startsWith("Europe/")||e==="Atlantic/Canary"||e==="Atlantic/Madeira"||e==="Atlantic/Azores"||e==="Atlantic/Reykjavik"||e==="Atlantic/Faroe")return"eu";if(e.startsWith("Australia/")||e==="Antarctica/Macquarie")return"au";if(e==="Pacific/Auckland"||e==="Pacific/Chatham"||e==="NZ"||e==="NZ-CHAT")return"nz";if(e.startsWith("US/")||h.has(e))return"us";if(e.startsWith("Canada/"))return"ca";if(e.startsWith("America/")){const n=e.slice(8),t=n.split("/")[0];if(t==="Indiana"||t==="Kentucky"||t==="North_Dakota"||d.has(n))return"us";if(f.has(n))return"ca"}return"other"}function m(o,e){const n=y(o);if(!e)return n;const t=u(e);return r[n].model==="opt-in"?n:(r[t].model==="opt-in",t)}function A(o){const e=new Set,n=[];for(const t of o){const a=u(t);a==="other"||e.has(a)||(e.add(a),n.push(r[a]))}return n.push(r.other),n}function p(o){const e=[...o.googleAds?["Google"]:[],...o.meta?["Facebook","Instagram"]:[]];return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function E(o,e,n){const t=p(n),a=t?`We use cookies to count visits and to show you ${e} ads on ${t}.`:"We use cookies to count visits.";return o.model==="opt-in"?{heading:t?"Cookies and ads":"Cookies",before:`${a} Nothing loads until you choose. You can change this at any time with `,link:o.footerLink,after:" at the bottom of every page."}:{heading:t?"Cookies and ads":"Cookies",before:`${a} You can say no at any time: choose Privacy choices, or use `,link:o.footerLink,after:" at the bottom of every page."}}const k={necessary:{name:"Necessary",body:"Cart, checkout, your country and currency, sign-in, and this choice. The shop cannot work without them."},analytics:{name:"Analytics",body:"Counts visits and pages so we can improve the site. Google Analytics and our own visit count."},ads:{body:"Google Ads and Meta (Facebook, Instagram) tags, and the order details we send to them to measure our ads."}},P="Your privacy choices.",w={title:"Opt-out request honored",body:"Your browser sent a Global Privacy Control signal. We have turned off sale and sharing of your information for ads."},N={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};export{N as CONSENT_BUTTONS,C as CONSENT_GPC_RULE,r as CONSENT_RULES,g as CONSENT_RULES_VERSION,w as GPC_HONOURED,P as PANEL_HEADING,k as PANEL_ROWS,p as adPlaces,E as bannerWords,u as regionOfCountry,y as regionOfTimeZone,A as rulesForCountries,m as visitorRegion};
1
+ const g=1,s="Ads on. Shopper can opt out.",i="Ads and analytics off until Accept",r={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:s,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:i,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:s,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:s,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:i,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:i,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:i,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}},m="Honoured: ads off",l=new Set(["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","PL","PT","RO","SK","SI","ES","SE","IS","LI","NO"]),c={US:"us",PR:"us",GU:"us",VI:"us",AS:"us",MP:"us",CA:"ca",AU:"au",NZ:"nz",GB:"uk"};function u(o){const e=(o??"").trim().toUpperCase();return e?c[e]?c[e]:l.has(e)?"eu":"other":"other"}const h=new Set(["Pacific/Honolulu","Pacific/Guam","Pacific/Saipan","Pacific/Pago_Pago","America/Puerto_Rico","America/St_Thomas"]),d=new Set(["New_York","Chicago","Denver","Los_Angeles","Phoenix","Anchorage","Adak","Boise","Detroit","Juneau","Sitka","Metlakatla","Yakutat","Nome","Menominee","Indianapolis","Louisville","Fort_Wayne","Knox_IN"]),f=new Set(["Toronto","Vancouver","Edmonton","Winnipeg","Halifax","St_Johns","Regina","Montreal","Moncton","Glace_Bay","Goose_Bay","Iqaluit","Whitehorse","Dawson","Dawson_Creek","Fort_Nelson","Creston","Cambridge_Bay","Inuvik","Rankin_Inlet","Resolute","Swift_Current","Atikokan","Blanc-Sablon","Nipigon","Thunder_Bay","Rainy_River","Pangnirtung","Yellowknife","Coral_Harbour"]);function y(o){const e=(o??"").trim();if(!e)return"other";if(e==="Europe/London"||e==="Europe/Belfast"||e==="GB"||e==="GB-Eire"||e==="Europe/Guernsey"||e==="Europe/Jersey"||e==="Europe/Isle_of_Man")return"uk";if(e.startsWith("Europe/")||e==="Atlantic/Canary"||e==="Atlantic/Madeira"||e==="Atlantic/Azores"||e==="Atlantic/Reykjavik"||e==="Atlantic/Faroe")return"eu";if(e.startsWith("Australia/")||e==="Antarctica/Macquarie")return"au";if(e==="Pacific/Auckland"||e==="Pacific/Chatham"||e==="NZ"||e==="NZ-CHAT")return"nz";if(e.startsWith("US/")||h.has(e))return"us";if(e.startsWith("Canada/"))return"ca";if(e.startsWith("America/")){const n=e.slice(8),t=n.split("/")[0];if(t==="Indiana"||t==="Kentucky"||t==="North_Dakota"||d.has(n))return"us";if(f.has(n))return"ca"}return"other"}function C(o,e){const n=y(o);if(!e)return n;const t=u(e);return r[n].model==="opt-in"?n:(r[t].model==="opt-in",t)}function A(o){const e=new Set,n=[];for(const t of o){const a=u(t);a==="other"||e.has(a)||(e.add(a),n.push(r[a]))}return n.push(r.other),n}function p(o){const e=[...o.googleAds?["Google"]:[],...o.meta?["Facebook","Instagram"]:[]];return e.length<=1?e.join(""):`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`}function k(o,e,n){const t=p(n),a=t?`We use cookies to count visits and to show you ${e} ads on ${t}.`:"We use cookies to count visits.";return o.model==="opt-in"?{heading:t?"Cookies and ads":"Cookies",before:`${a} Nothing loads until you choose. You can change this at any time with `,link:o.footerLink,after:" at the bottom of every page."}:{heading:t?"Cookies and ads":"Cookies",before:`${a} You can say no at any time: choose Privacy choices, or use `,link:o.footerLink,after:" at the bottom of every page."}}const w={necessary:{name:"Necessary",body:"Cart, checkout, your country and currency, sign-in, and this choice. The site cannot work without them.",bodyNoSale:"What the site needs to work, such as remembering this choice. The site cannot work without them."},analytics:{name:"Analytics",body:"Counts visits and pages so we can improve the site. Google Analytics and our own visit count."},ads:{body:"Google Ads and Meta (Facebook, Instagram) tags, and the order details we send to them to measure our ads.",bodyNoSale:"Google Ads and Meta (Facebook, Instagram) tags, which measure our ads."}},E="Your privacy choices.",P={title:"Opt-out request honoured",body:"Your browser sent a Global Privacy Control signal. We have turned off sale and sharing of your information for ads."},N={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};export{N as CONSENT_BUTTONS,m as CONSENT_GPC_RULE,r as CONSENT_RULES,g as CONSENT_RULES_VERSION,P as GPC_HONOURED,E as PANEL_HEADING,w as PANEL_ROWS,p as adPlaces,k as bannerWords,u as regionOfCountry,y as regionOfTimeZone,A as rulesForCountries,C as visitorRegion};
@@ -1 +1 @@
1
- const n={tyre:"tire",tyres:"tires",colour:"color",colours:"colors",centre:"center",centres:"centers",catalogue:"catalog",catalogues:"catalogs",enquire:"inquire",enquiry:"inquiry",enquiries:"inquiries",aluminium:"aluminum"},i=new RegExp(`\\b(${Object.keys(n).sort((e,r)=>r.length-e.length).join("|")})\\b`,"gi");function o(e){return e==="us"?"us":"international"}function s(e,r){return e===e.toUpperCase()?r.toUpperCase():e[0]===e[0].toUpperCase()?r[0].toUpperCase()+r.slice(1):r}function a(e,r){return r!=="us"?e:e.replace(i,t=>s(t,n[t.toLowerCase()]))}export{n as US_SPELLING,a as inEnglish,o as normalizeEnglishVariant};
1
+ const t={tyre:"tire",tyres:"tires",colour:"color",colours:"colors",centre:"center",centres:"centers",catalogue:"catalog",catalogues:"catalogs",enquire:"inquire",enquiry:"inquiry",enquiries:"inquiries",aluminium:"aluminum",honour:"honor",honoured:"honored"},i=new RegExp(`\\b(${Object.keys(t).sort((e,r)=>r.length-e.length).join("|")})\\b`,"gi");function s(e){return e==="us"?"us":"international"}function o(e,r){return e===e.toUpperCase()?r.toUpperCase():e[0]===e[0].toUpperCase()?r[0].toUpperCase()+r.slice(1):r}function u(e,r){return r!=="us"?e:e.replace(i,n=>o(n,t[n.toLowerCase()]))}export{t as US_SPELLING,u as inEnglish,s as normalizeEnglishVariant};
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import n from"../../../../../components/FooterText.js";import{FooterTextMeta as x}from"./meta.js";const f={...x,render:({text:e,size:t,tone:o,puck:r})=>i(n,{text:e||void 0,size:t,tone:o,editing:r?.isEditing})};export{f as FooterTextRender};
1
+ import{jsx as i}from"react/jsx-runtime";import n from"../../../../../components/FooterText.js";import{declaredBlockSource as x,sourcedRows as f}from"efficient-web-builder/format/lib/content/block-sources";import{say as a}from"efficient-web-builder/format/lib/editor-words";import{FooterTextMeta as c}from"./meta.js";const l=()=>[{text:a("Add a line of footer text.")}],B={...c,render:e=>{const{text:s,size:t,tone:o,puck:r}=e;if(x(e)!==""){const d=f(e,!!r?.isEditing,l()).rows.map(m=>m.text??"").filter(Boolean);return i(n,{lines:d,size:t,tone:o})}return i(n,{text:s||void 0,size:t,tone:o,editing:r?.isEditing})}};export{B as FooterTextRender};
package/dist/words.d.ts CHANGED
@@ -264,6 +264,7 @@ export type WebBuilderPhrase =
264
264
  | "Card title two"
265
265
  | "Card type"
266
266
  | "Cards"
267
+ | "Cards from"
267
268
  | "Cart"
268
269
  | "Catalog Filter Bar"
269
270
  | "Category"
@@ -679,6 +680,7 @@ export type WebBuilderPhrase =
679
680
  | "Location name"
680
681
  | "Locations"
681
682
  | "Locations Map"
683
+ | "Locations from"
682
684
  | "Logo"
683
685
  | "Logo alt text"
684
686
  | "Logo color"
@@ -712,6 +714,7 @@ export type WebBuilderPhrase =
712
714
  | "Meta line"
713
715
  | "Metadata"
714
716
  | "Metadata rows"
717
+ | "Methods from"
715
718
  | "Middle"
716
719
  | "Middle meta"
717
720
  | "Milestone"
@@ -823,6 +826,7 @@ export type WebBuilderPhrase =
823
826
  | "Part of {name}"
824
827
  | "Paste a link to each profile. A platform left empty shows nothing on the site."
825
828
  | "Payment Methods"
829
+ | "Payment method"
826
830
  | "Payment methods"
827
831
  | "Phone"
828
832
  | "Photo Submission Form"
@@ -1404,9 +1408,9 @@ export type StorefrontBlocksPhrase =
1404
1408
  | "Capitalised"
1405
1409
  | "Car prompt"
1406
1410
  | "Card text"
1407
- | "Cards from"
1408
1411
  | "Cards to show"
1409
- | "Cart, checkout, your country and currency, sign-in, and this choice. The shop cannot work without them."
1412
+ | "Cart, checkout, your country and currency, sign-in, and this choice. The site cannot work without them."
1413
+ | "Cash"
1410
1414
  | "Categories"
1411
1415
  | "Category — wheels only"
1412
1416
  | "Centered"
@@ -1519,6 +1523,7 @@ export type StorefrontBlocksPhrase =
1519
1523
  | "First detail"
1520
1524
  | "First image on the left"
1521
1525
  | "First name"
1526
+ | "First room"
1522
1527
  | "First-name label"
1523
1528
  | "First-name placeholder"
1524
1529
  | "Fits"
@@ -1551,6 +1556,7 @@ export type StorefrontBlocksPhrase =
1551
1556
  | "Globe and code"
1552
1557
  | "Goes to {place}"
1553
1558
  | "Google Ads and Meta (Facebook, Instagram) tags, and the order details we send to them to measure our ads."
1559
+ | "Google Ads and Meta (Facebook, Instagram) tags, which measure our ads."
1554
1560
  | "Group covers"
1555
1561
  | "Group {n}"
1556
1562
  | "Groups"
@@ -1804,6 +1810,7 @@ export type StorefrontBlocksPhrase =
1804
1810
  | "Search your catalog…"
1805
1811
  | "Second card"
1806
1812
  | "Second detail"
1813
+ | "Second room"
1807
1814
  | "Secondary button"
1808
1815
  | "Secondary link"
1809
1816
  | "Section label"
@@ -1900,6 +1907,7 @@ export type StorefrontBlocksPhrase =
1900
1907
  | "Template"
1901
1908
  | "Template pages"
1902
1909
  | "Text color at the top"
1910
+ | "Text from"
1903
1911
  | "Thank-you message"
1904
1912
  | "That didn’t come back — pick the form from the list, or try again."
1905
1913
  | "The EU label appears here for every size with an EPREL registration number. It is read live from the registry and never stored."
@@ -1917,6 +1925,7 @@ export type StorefrontBlocksPhrase =
1917
1925
  | "The whole hero comes from the product record — title, price, pictures, options and Add to Cart. Edit the product in the Products database and this hero updates to match."
1918
1926
  | "Third card"
1919
1927
  | "Third detail"
1928
+ | "Third room"
1920
1929
  | "This column isn't linked to a menu, so the preview shows placeholder links. Pick a menu above."
1921
1930
  | "This form has no fields yet, so there is nothing for a visitor to fill in."
1922
1931
  | "This form is switched off, so it won’t appear on the published page. Turn it back on in {place}."
@@ -1966,6 +1975,8 @@ export type StorefrontBlocksPhrase =
1966
1975
  | "Waiting for editor authorization…"
1967
1976
  | "Welcome heading"
1968
1977
  | "Welcome intro"
1978
+ | "What the site needs to work, such as remembering this choice. The site cannot work without them."
1979
+ | "What this room has."
1969
1980
  | "What would you like to cover?"
1970
1981
  | "Wheel"
1971
1982
  | "Wheel Spec"