efficient-storefront-blocks 0.101.0 → 0.109.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 (90) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/dist/chunks/{EditorPreviewCheckout-JMBBJSI7.js → EditorPreviewCheckout-IVYEDVVN.js} +1 -1
  3. package/dist/chunks/{SiteEditorProvider-BKZW7KVN.js → SiteEditorProvider-KN5FKGBX.js} +1 -1
  4. package/dist/chunks/chunk-5VN7IA5L.js +1 -0
  5. package/dist/chunks/chunk-G5XZ736Y.js +339 -0
  6. package/dist/chunks/{chunk-YSKMBJ7V.js → chunk-UBOGEIFX.js} +1 -1
  7. package/dist/chunks/chunk-X3ERHC7Y.js +1 -0
  8. package/dist/chunks/{fitment-data-HMD5DDDB.js → fitment-data-Z3FDYFU6.js} +1 -1
  9. package/dist/editor/components/HeaderSettingsPanel.js +1 -1
  10. package/dist/editor/components/MenuPicker.js +1 -1
  11. package/dist/editor/lib/document/blocks/service/SignUp/fields.d.ts +2 -0
  12. package/dist/editor/lib/document/blocks/service/SignUp/fields.js +1 -0
  13. package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
  14. package/dist/editor/lib/document/blocks/service/index.js +1 -1
  15. package/dist/editor/lib/document/box-header.d.ts +3 -4
  16. package/dist/editor/lib/document/box-header.js +1 -1
  17. package/dist/editor/lib/document/config.js +1 -1
  18. package/dist/editor/lib/storefront-editor-words.d.ts +18 -0
  19. package/dist/editor/lib/storefront-editor-words.js +1 -1
  20. package/dist/index.js +30 -30
  21. package/dist/render/app/globals.css +428 -145
  22. package/dist/render/built-with.json +1 -1
  23. package/dist/render/components/CartContext.d.ts +1 -1
  24. package/dist/render/components/CartContext.js +1 -1
  25. package/dist/render/components/FooterGroup.js +1 -1
  26. package/dist/render/components/FooterLogo.js +1 -1
  27. package/dist/render/components/Header.js +1 -1
  28. package/dist/render/components/HeaderDropdownPanel.d.ts +21 -0
  29. package/dist/render/components/HeaderDropdownPanel.js +1 -0
  30. package/dist/render/components/HeaderNavItem.d.ts +5 -5
  31. package/dist/render/components/HeaderNavItem.js +1 -1
  32. package/dist/render/components/MenuLinkBlock.js +1 -1
  33. package/dist/render/components/ProductGridSection.js +1 -1
  34. package/dist/render/components/ProductHeroPanel.d.ts +1 -1
  35. package/dist/render/components/ProductHeroPanel.js +1 -1
  36. package/dist/render/components/SignUpFind.d.ts +25 -0
  37. package/dist/render/components/SignUpFind.js +1 -0
  38. package/dist/render/components/SignUpLink.d.ts +13 -0
  39. package/dist/render/components/SignUpLink.js +1 -0
  40. package/dist/render/components/SignUpSection.d.ts +47 -0
  41. package/dist/render/components/SignUpSection.js +1 -0
  42. package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
  43. package/dist/render/components/card-pieces/CardQuantity.d.ts +1 -0
  44. package/dist/render/components/card-pieces/CardQuantity.js +1 -0
  45. package/dist/render/components/card-pieces/CardSave.d.ts +1 -0
  46. package/dist/render/components/card-pieces/CardSave.js +1 -0
  47. package/dist/render/components/card-pieces/CardStatedFacts.d.ts +1 -0
  48. package/dist/render/components/card-pieces/CardStatedFacts.js +1 -0
  49. package/dist/render/components/card-pieces/ProductCardState.d.ts +9 -0
  50. package/dist/render/components/wheels-plp/useVehicleCatalog.js +1 -1
  51. package/dist/render/lib/api/index.d.ts +31 -8
  52. package/dist/render/lib/api/index.js +1 -1
  53. package/dist/render/lib/api/types.d.ts +12 -0
  54. package/dist/render/lib/catalog/plp-vehicle-slice.d.ts +2 -2
  55. package/dist/render/lib/catalog/plp-vehicle-slice.js +1 -1
  56. package/dist/render/lib/document/blocks/service/ContactCards/meta.d.ts +1 -1
  57. package/dist/render/lib/document/blocks/service/SignUp/meta.d.ts +6 -0
  58. package/dist/render/lib/document/blocks/service/SignUp/meta.js +1 -0
  59. package/dist/render/lib/document/blocks/service/SignUp/render.d.ts +4 -0
  60. package/dist/render/lib/document/blocks/service/SignUp/render.js +1 -0
  61. package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
  62. package/dist/render/lib/document/blocks/service/metas.js +1 -1
  63. package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
  64. package/dist/render/lib/document/blocks/service/renders.js +1 -1
  65. package/dist/render/lib/document/blocks/text-part-shapes.json +34 -0
  66. package/dist/render/lib/document/lazy-draws.js +1 -1
  67. package/dist/render/lib/font-table.json +150 -0
  68. package/dist/render/lib/menu-link.d.ts +19 -2
  69. package/dist/render/lib/menu-link.js +1 -1
  70. package/dist/render/lib/next-fonts.js +1 -1
  71. package/dist/render/lib/sections/product-grid-pages.d.ts +1 -0
  72. package/dist/render/lib/sections/product-grid-pages.js +1 -1
  73. package/dist/render/lib/sections/sign-up-catalogue.d.ts +3 -0
  74. package/dist/render/lib/sections/sign-up-catalogue.js +1 -0
  75. package/dist/render/lib/sections/sign-up-look.d.ts +5 -0
  76. package/dist/render/lib/sections/sign-up-look.js +1 -0
  77. package/dist/render/lib/sections/sign-up.d.ts +205 -0
  78. package/dist/render/lib/sections/sign-up.js +1 -0
  79. package/dist/render/lib/wheels/plp-hydrate.d.ts +2 -1
  80. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  81. package/dist/render/lib/wheels/selected-ranges.d.ts +1 -0
  82. package/dist/render/lib/wheels/selected-ranges.js +1 -1
  83. package/dist/words.d.ts +20 -0
  84. package/dist/words.js +3 -3
  85. package/package.json +2 -2
  86. package/dist/chunks/chunk-AF5TRBQB.js +0 -1
  87. package/dist/chunks/chunk-GJZGQCDM.js +0 -1
  88. package/dist/chunks/chunk-KV3EHFHB.js +0 -339
  89. /package/dist/chunks/{chunk-KV3EHFHB.js.LEGAL.txt → chunk-G5XZ736Y.js.LEGAL.txt} +0 -0
  90. /package/dist/chunks/{chunk-XNUK2QNK.js → chunk-SUX7QH3R.js} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- "efficient-web-builder": "68.0.0"
2
+ "efficient-web-builder": "68.2.0"
3
3
  }
@@ -51,7 +51,7 @@ interface CartCtx {
51
51
  items: CartLine[];
52
52
  catalog: WheelSummary[];
53
53
  bundles: Bundle[];
54
- warmCatalog: (kind?: ProductKind) => void;
54
+ warmCatalog: (kind?: ProductKind, slug?: string) => void;
55
55
  add: (line: CartLine) => void;
56
56
  addAndOpen: (line: CartLine) => void;
57
57
  setAutoOpen: (on: boolean) => void;
@@ -1 +1 @@
1
- "use client";import{jsx as zt}from"react/jsx-runtime";import{createContext as Jt,useCallback as u,useContext as Xt,useEffect as y,useMemo as Nt,useRef as q,useState as i}from"react";import{usePathname as Yt}from"next/navigation";import{products as E}from"../lib/api/index.js";import{couponDeferredToCheckout as Gt}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as Kt}from"../lib/cart/snapshot-lines.js";import{MAX_QTY_PER_LINE as Tt,orderLinesForSets as Zt,setPrice as $t}from"../lib/commerce.js";import{UNPRICED_LABEL as te}from"../lib/wheels/price-display.js";import{isValidEmail as ee}from"../lib/email-shape.js";import{trackAddToCart as ne}from"../lib/google-tag.js";import{shippingStatus as oe}from"../lib/cart/shipping-status.js";import{useCurrency as se}from"./CurrencyContext.js";const re=400,ue=400,ce=1500;function bt(a){return(a.components?.length??0)>0}function qt(a,s){return{code:a,valid:s.valid,deferred:Gt(s,s.askedAsShopper),message:s.message||void 0,effects:s.effects??void 0}}function Bt(a,s){return $t(a.components,s)}function W(a,s){const r=Bt(a,s);return r===null?null:r*a.qty}function Mt(a){return a!=="tyre"}const Ot=Jt(null);function Ne({children:a,preview:s=!1}){const{currency:r,country:Q,formatMoney:It}=se(),[H,R]=i(s),[l,O]=i([]),[V,xt]=i([]),[j,At]=i([]),[F,St]=i(!1),[v,_t]=i(!1),[Pt,Dt]=i(!1),[Rt,Ut]=i(!1),[m,z]=i(null),[kt,wt]=i(0),J=u(()=>wt(t=>t+1),[]),[X,Y]=i(void 0),[N,Lt]=i(null),[c,C]=i(null),[G,I]=i(!1),[p,K]=i(null),x=q(void 0),T=u(()=>R(!0),[]),A=u(()=>R(!1),[]),Z=u(()=>R(t=>!t),[]);y(()=>{s||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&T()},[T,s]);const S=Yt(),$=q(S);y(()=>{$.current!==S&&($.current=S,s||A())},[S,s,A]);const tt=u(t=>{Lt(e=>e?.country===t?.country&&e?.subdivision===t?.subdivision&&e?.postcode===t?.postcode?e:t)},[]),et=u(t=>{Ut(!0),Mt(t)&&Dt(!0)},[]),nt=Pt||l.some(t=>Mt(t.kind)),ot=Rt||l.length>0;y(()=>{if(s||!nt||F)return;let t=!0;return E.listWheels().then(e=>{t&&(xt(e),St(!0))}),()=>{t=!1}},[s,nt,F]),y(()=>{if(s||!ot||v)return;let t=!0;return E.listBundles().then(e=>{t&&(At(e),_t(!0))}),()=>{t=!1}},[s,ot,v]);const g=m?.deliveryOptions??[],st=m?.courier??null;y(()=>{m&&K(t=>t&&g.some(e=>e.id===t)?t:g[0]?.id??null)},[m]);const _=u(()=>l.filter(bt).flatMap(t=>Zt(t.components,t.qty)),[l]),rt=u(async(t,e)=>{const o=t.trim().toUpperCase();if(!o)return;const n=_();if(n.length===0){C({code:o,valid:!1,message:"Add a wheel to the cart first."});return}I(!0),x.current=e;try{const d=await E.validateCoupon({code:o,items:n,currency:r,shippingMethodId:p??void 0,customerEmail:e});C(qt(o,d))}catch{C({code:o,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{I(!1)}},[_,r,p]),ut=u(()=>{C(null),x.current=void 0},[]),ct=u(t=>{if(!c)return;const{code:e}=c;C(o=>o&&o.code===e?{code:e,valid:!1,refused:!0,message:t}:o)},[c]);y(()=>{if(!c||c.refused)return;const t=c.code,e=n=>n!==null&&n.code===t&&!n.refused,o=setTimeout(async()=>{const n=_();if(n.length===0){C(d=>e(d)?{code:t,valid:!1,message:"Add a wheel to the cart first."}:d);return}I(!0);try{const d=await E.validateCoupon({code:t,items:n,currency:r,shippingMethodId:p??void 0,customerEmail:x.current});C(M=>e(M)?qt(t,d):M)}catch{}finally{I(!1)}},re);return()=>clearTimeout(o)},[l,r,p]);const U=c&&!c.refused?c.code:void 0;y(()=>{if(s)return;let t=!0;const e=setTimeout(async()=>{const o=_();if(o.length===0){z(null),Y(void 0);return}try{const n=await E.quoteCart({items:o,currency:r,shippingMethodId:p??void 0,couponCode:U,customerEmail:x.current||void 0,country:N?.country||Q||void 0,subdivision:N?.country&&N.subdivision||void 0,postcode:N?.country&&N.postcode||void 0});if(!t)return;z(n)}catch{if(!t)return}Y(U)},ue);return()=>{t=!1,clearTimeout(e)}},[l,r,p,U,Q,N,kt]);const P=u(t=>{O(e=>{const o=e.findIndex(n=>n.id===t.id);return o===-1?[...e,t]:e.map((n,d)=>d===o?{...n,qty:Math.min(Tt,n.qty+t.qty)}:n)}),ne(t,r)},[r]),it=u(t=>{O(e=>e.filter(o=>o.id!==t))},[]),at=u((t,e)=>{const o=Math.max(1,Math.min(Tt,e));O(n=>n.map(d=>d.id===t?{...d,qty:o}:d))},[]),lt=u(t=>{O(t)},[]),[B,Wt]=i(null),dt=q(null);dt.current=B;const h=q(null),k=q(""),ft=u((t,e)=>{const o=t.trim().toLowerCase();ee(o)&&Wt(n=>n&&n.email===o&&n.firstName===(e??"")?n:{email:o,firstName:e??""})},[]);y(()=>{if(s||!B)return;const t=Kt(l.filter(bt),n=>W(n,r)===null?te:It(W(n,r),r)),e={email:B.email,firstName:B.firstName,currency:r,items:t},o=JSON.stringify(e);if(o!==k.current)return h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,k.current=o,E.captureCart(e).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",n)})},ce),()=>{h.current&&(clearTimeout(h.current),h.current=null)}},[l,B,r,s]);const mt=u(()=>{h.current&&(clearTimeout(h.current),h.current=null);const t=dt.current;t&&(k.current="",E.captureCart({email:t.email,firstName:t.firstName,currency:r,items:[]}).catch(e=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",e)}))},[r]),pt=Nt(()=>{const t=l.reduce((f,b)=>{const D=W(b,r);return D===null?f:f+D},0),e=l.some(f=>Bt(f,r)===null),o=l.reduce((f,b)=>f+b.qty,0),n=c?.valid?c.effects:void 0,d=n?Math.min(t,Number(n.discountAmount)):0,M=m?.bundleDiscount??0,Ht=m?.appliedBundles??[],w=!!n?.freeShipping,gt=g.find(f=>f.id===p),Et=w?0:m?.shipping??gt?.amount??0,Vt=oe({quoted:m!==null,optionCount:g.length,chosenAmount:gt?.amount,couponWaivesFreight:w}),L={};for(const f of n?.freeUnits??[])L[f.partNumber]=(L[f.partNumber]??0)+f.quantity;const jt=m?.tax??null,Ft=m?m.grandTotal:t-d-M+Et;return{sets:o,units:l.reduce((f,b)=>f+(b.components??[]).reduce((D,vt)=>D+vt.wheels*b.qty,0),0),subtotal:t,hasUnpricedLine:e,discount:d,bundleDiscount:M,appliedBundles:Ht,shipping:Et,freeShipping:w,shippingStatus:Vt,freeUnitsByPartNumber:L,tax:jt,grand:Ft,repricing:!!c?.refused&&m!==null&&X===c?.code,currency:r}},[l,r,c,g,p,m,X]),ht=q(!0),yt=u(t=>{ht.current=t},[]),Ct=u(t=>{P(t),ht.current&&T()},[P,T]),Qt=Nt(()=>({isOpen:H,preview:s,open:T,close:A,toggle:Z,items:l,catalog:V,bundles:j,warmCatalog:et,add:P,addAndOpen:Ct,setAutoOpen:yt,remove:it,setQty:at,replaceItems:lt,identify:ft,clearCapturedCart:mt,coupon:c,applyCoupon:rt,removeCoupon:ut,refuseCoupon:ct,couponBusy:G,deliveryOptions:g,setQuoteDestination:tt,courier:st,requote:J,shippingMethodId:p,setShippingMethodId:K,totals:pt}),[H,s,T,A,Z,l,V,j,et,P,Ct,yt,it,at,lt,ft,mt,c,rt,ut,ct,G,g,tt,st,J,p,pt]);return zt(Ot.Provider,{value:Qt,children:a})}function Te(){const a=Xt(Ot);if(!a)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return a}export{Ne as CartProvider,bt as isOrderable,W as lineTotal,Te as useCart};
1
+ "use client";import{jsx as zt}from"react/jsx-runtime";import{createContext as Jt,useCallback as c,useContext as Xt,useEffect as y,useMemo as Nt,useRef as C,useState as d}from"react";import{usePathname as Yt}from"next/navigation";import{products as N}from"../lib/api/index.js";import{couponDeferredToCheckout as Gt}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as Kt}from"../lib/cart/snapshot-lines.js";import{MAX_QTY_PER_LINE as Tt,orderLinesForSets as Zt,setPrice as $t}from"../lib/commerce.js";import{UNPRICED_LABEL as vt}from"../lib/wheels/price-display.js";import{isValidEmail as te}from"../lib/email-shape.js";import{trackAddToCart as ee}from"../lib/google-tag.js";import{shippingStatus as ne}from"../lib/cart/shipping-status.js";import{useCurrency as oe}from"./CurrencyContext.js";const re=400,se=400,ue=1500;function bt(l){return(l.components?.length??0)>0}function Bt(l,r){return{code:l,valid:r.valid,deferred:Gt(r,r.askedAsShopper),message:r.message||void 0,effects:r.effects??void 0}}function qt(l,r){return $t(l.components,r)}function W(l,r){const s=qt(l,r);return s===null?null:s*l.qty}function Mt(l){return l!=="tyre"}const Ot=Jt(null);function Ee({children:l,preview:r=!1}){const{currency:s,country:V,formatMoney:It}=oe(),[j,k]=d(r),[i,M]=d([]),[F,xt]=d([]),[H,At]=d([]),[z,_t]=d(!1),J=C(new Set),[X,Pt]=d([]),[Dt,kt]=d(!1),[m,Y]=d(null),[Rt,Ut]=d(0),G=c(()=>Ut(t=>t+1),[]),[K,Z]=d(void 0),[T,wt]=d(null),[a,g]=d(null),[$,O]=d(!1),[p,v]=d(null),I=C(void 0),b=c(()=>k(!0),[]),x=c(()=>k(!1),[]),tt=c(()=>k(t=>!t),[]);y(()=>{r||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&b()},[b,r]);const A=Yt(),et=C(A);y(()=>{et.current!==A&&(et.current=A,r||x())},[A,r,x]);const nt=c(t=>{wt(n=>n?.country===t?.country&&n?.subdivision===t?.subdivision&&n?.postcode===t?.postcode?n:t)},[]),ot=c((t,n)=>{kt(!0),!(!n||!Mt(t))&&Pt(e=>e.includes(n)?e:[...e,n])},[]),rt=Dt||i.length>0,R=C(!0);y(()=>(R.current=!0,()=>{R.current=!1}),[]),y(()=>{if(r)return;const t=[...X,...i.filter(e=>Mt(e.kind)).map(e=>e.slug)],n=[...new Set(t)].filter(e=>e&&!J.current.has(e));if(n.length!==0){for(const e of n)J.current.add(e);N.listWheelsBySlug(n).then(e=>{if(!R.current||e.length===0)return;const o=new Set(e.map(u=>u.slug));xt(u=>[...u.filter(S=>!o.has(S.slug)),...e])})}},[r,X,i]),y(()=>{if(r||!rt||z)return;let t=!0;return N.listBundles().then(n=>{t&&(At(n),_t(!0))}),()=>{t=!1}},[r,rt,z]);const E=m?.deliveryOptions??[],st=m?.courier??null;y(()=>{m&&v(t=>t&&E.some(n=>n.id===t)?t:E[0]?.id??null)},[m]);const _=c(()=>i.filter(bt).flatMap(t=>Zt(t.components,t.qty)),[i]),ut=c(async(t,n)=>{const e=t.trim().toUpperCase();if(!e)return;const o=_();if(o.length===0){g({code:e,valid:!1,message:"Add a wheel to the cart first."});return}O(!0),I.current=n;try{const u=await N.validateCoupon({code:e,items:o,currency:s,shippingMethodId:p??void 0,customerEmail:n});g(Bt(e,u))}catch{g({code:e,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{O(!1)}},[_,s,p]),ct=c(()=>{g(null),I.current=void 0},[]),it=c(t=>{if(!a)return;const{code:n}=a;g(e=>e&&e.code===n?{code:n,valid:!1,refused:!0,message:t}:e)},[a]);y(()=>{if(!a||a.refused)return;const t=a.code,n=o=>o!==null&&o.code===t&&!o.refused,e=setTimeout(async()=>{const o=_();if(o.length===0){g(u=>n(u)?{code:t,valid:!1,message:"Add a wheel to the cart first."}:u);return}O(!0);try{const u=await N.validateCoupon({code:t,items:o,currency:s,shippingMethodId:p??void 0,customerEmail:I.current});g(S=>n(S)?Bt(t,u):S)}catch{}finally{O(!1)}},re);return()=>clearTimeout(e)},[i,s,p]);const U=a&&!a.refused?a.code:void 0;y(()=>{if(r)return;let t=!0;const n=setTimeout(async()=>{const e=_();if(e.length===0){Y(null),Z(void 0);return}try{const o=await N.quoteCart({items:e,currency:s,shippingMethodId:p??void 0,couponCode:U,customerEmail:I.current||void 0,country:T?.country||V||void 0,subdivision:T?.country&&T.subdivision||void 0,postcode:T?.country&&T.postcode||void 0});if(!t)return;Y(o)}catch{if(!t)return}Z(U)},se);return()=>{t=!1,clearTimeout(n)}},[i,s,p,U,V,T,Rt]);const P=c(t=>{M(n=>{const e=n.findIndex(o=>o.id===t.id);return e===-1?[...n,t]:n.map((o,u)=>u===e?{...o,qty:Math.min(Tt,o.qty+t.qty)}:o)}),ee(t,s)},[s]),at=c(t=>{M(n=>n.filter(e=>e.id!==t))},[]),lt=c((t,n)=>{const e=Math.max(1,Math.min(Tt,n));M(o=>o.map(u=>u.id===t?{...u,qty:e}:u))},[]),dt=c(t=>{M(t)},[]),[q,Lt]=d(null),ft=C(null);ft.current=q;const h=C(null),w=C(""),mt=c((t,n)=>{const e=t.trim().toLowerCase();te(e)&&Lt(o=>o&&o.email===e&&o.firstName===(n??"")?o:{email:e,firstName:n??""})},[]);y(()=>{if(r||!q)return;const t=Kt(i.filter(bt),o=>W(o,s)===null?vt:It(W(o,s),s)),n={email:q.email,firstName:q.firstName,currency:s,items:t},e=JSON.stringify(n);if(e!==w.current)return h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,w.current=e,N.captureCart(n).catch(o=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",o)})},ue),()=>{h.current&&(clearTimeout(h.current),h.current=null)}},[i,q,s,r]);const pt=c(()=>{h.current&&(clearTimeout(h.current),h.current=null);const t=ft.current;t&&(w.current="",N.captureCart({email:t.email,firstName:t.firstName,currency:s,items:[]}).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",n)}))},[s]),ht=Nt(()=>{const t=i.reduce((f,B)=>{const D=W(B,s);return D===null?f:f+D},0),n=i.some(f=>qt(f,s)===null),e=i.reduce((f,B)=>f+B.qty,0),o=a?.valid?a.effects:void 0,u=o?Math.min(t,Number(o.discountAmount)):0,S=m?.bundleDiscount??0,Wt=m?.appliedBundles??[],L=!!o?.freeShipping,Et=E.find(f=>f.id===p),St=L?0:m?.shipping??Et?.amount??0,Vt=ne({quoted:m!==null,optionCount:E.length,chosenAmount:Et?.amount,couponWaivesFreight:L}),Q={};for(const f of o?.freeUnits??[])Q[f.partNumber]=(Q[f.partNumber]??0)+f.quantity;const jt=m?.tax??null,Ft=m?m.grandTotal:t-u-S+St;return{sets:e,units:i.reduce((f,B)=>f+(B.components??[]).reduce((D,Ht)=>D+Ht.wheels*B.qty,0),0),subtotal:t,hasUnpricedLine:n,discount:u,bundleDiscount:S,appliedBundles:Wt,shipping:St,freeShipping:L,shippingStatus:Vt,freeUnitsByPartNumber:Q,tax:jt,grand:Ft,repricing:!!a?.refused&&m!==null&&K===a?.code,currency:s}},[i,s,a,E,p,m,K]),yt=C(!0),Ct=c(t=>{yt.current=t},[]),gt=c(t=>{P(t),yt.current&&b()},[P,b]),Qt=Nt(()=>({isOpen:j,preview:r,open:b,close:x,toggle:tt,items:i,catalog:F,bundles:H,warmCatalog:ot,add:P,addAndOpen:gt,setAutoOpen:Ct,remove:at,setQty:lt,replaceItems:dt,identify:mt,clearCapturedCart:pt,coupon:a,applyCoupon:ut,removeCoupon:ct,refuseCoupon:it,couponBusy:$,deliveryOptions:E,setQuoteDestination:nt,courier:st,requote:G,shippingMethodId:p,setShippingMethodId:v,totals:ht}),[j,r,b,x,tt,i,F,H,ot,P,gt,Ct,at,lt,dt,mt,pt,a,ut,ct,it,$,E,nt,st,G,p,ht]);return zt(Ot.Provider,{value:Qt,children:l})}function Se(){const l=Xt(Ot);if(!l)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return l}export{Ee as CartProvider,bt as isOrderable,W as lineTotal,Se as useCart};
@@ -1 +1 @@
1
- import{jsx as o}from"react/jsx-runtime";import{containerGapProps as c}from"efficient-web-builder/format/lib/content/container-gap";import{HideTaker as l}from"efficient-web-builder/render/components/ViewHideRoot";const s={start:"items-start",center:"items-center",end:"items-end",stretch:"items-stretch"};function m({direction:t="vertical",gap:n,gapPhone:a,align:e="start",content:i}){const r=c("FooterGroup",n,t==="horizontal"?"inline":"block",a);return o(l,{as:"div",className:"min-w-0",children:o(i,{className:`flex ${t==="horizontal"?"flex-row flex-wrap":"flex-col"} ${Object.hasOwn(s,e)?s[e]:void 0}${r.className}`,style:r.style,minEmptyHeight:80})})}export{m as default};
1
+ import{jsx as r}from"react/jsx-runtime";import{boxLayoutClasses as i}from"efficient-web-builder/format/lib/content/box-layout";import{containerGapProps as n}from"efficient-web-builder/format/lib/content/container-gap";import{HideTaker as m}from"efficient-web-builder/render/components/ViewHideRoot";function p({direction:o="vertical",gap:t,gapPhone:a,align:l="start",content:s}){const e=n("FooterGroup",t,o==="horizontal"?"inline":"block",a);return r(m,{as:"div",className:"min-w-0",children:r(s,{className:`${["flex",o==="horizontal"?"flex-row flex-wrap":"flex-col",i(void 0,l)].filter(Boolean).join(" ")}${e.className}`,style:e.style,minEmptyHeight:80})})}export{p as default};
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as L}from"react/jsx-runtime";import _ from"next/link";import w,{FOOTER_LOGO_PX as N,WORDMARK_FIT_FLOOR_PX as v}from"efficient-web-builder/render/components/Logo";import{useSiteLogo as T}from"efficient-web-builder/render/components/SiteLogoContext";import{renderGold as j}from"efficient-web-builder/render/components/goldPhrases";import{BLOCK_ALIGN_TEXT as m}from"efficient-web-builder/format/lib/content/block-align";import{say as F}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as I}from"efficient-web-builder/render/components/ViewHideRoot";const l={left:"items-start text-left",center:`items-center ${m.center}`,right:`items-end ${m.right}`};function P({tagline:t,widthPct:d=100,align:i="left",reverse:c=!0,color:f=null,padTop:o=0,padRight:s=0,padBottom:n=0,padLeft:a=0,editing:x=!1}){const{src:p,reversedSrc:g,inkIsDark:u,wordmark:h,siteName:r}=T(),O=Math.round(N*(d/100)),k={...o?{paddingTop:o}:{},...s?{paddingRight:s}:{},...n?{paddingBottom:n}:{},...a?{paddingLeft:a}:{}};return L(I,{as:"div",className:`flex min-w-0 flex-col ${Object.hasOwn(l,i)?l[i]:void 0} [container-type:inline-size]`,style:k,children:[e(_,{href:"/","aria-label":r?`${r} home`:"Home",className:"inline-flex max-w-full overflow-x-clip",children:e(w,{variant:"footer",sizePx:O,src:p,reverse:c,color:f,reversedSrc:g,inkIsDark:u,wordmark:h,siteName:r,fitWordmarkToContainer:!0,fitFloorPx:v})}),t?e("p",{className:"mt-4 max-w-[280px] text-[13px] leading-[1.5] text-fg-dim",children:j(t)}):x?e("p",{className:"mt-4 max-w-[280px] text-[13px] italic leading-[1.5] text-fg-dim/60",children:F("Add a short brand tagline →")}):null]})}export{P as default};
1
+ "use client";import{jsx as e,jsxs as k}from"react/jsx-runtime";import w from"next/link";import A,{FOOTER_LOGO_PX as I,WORDMARK_FIT_FLOOR_PX as j}from"efficient-web-builder/render/components/Logo";import{useSiteLogo as v}from"efficient-web-builder/render/components/SiteLogoContext";import{renderGold as G}from"efficient-web-builder/render/components/goldPhrases";import{BLOCK_ALIGN_BOX_WORD as t,BLOCK_ALIGN_TEXT as f}from"efficient-web-builder/format/lib/content/block-align";import{BOX_ALIGN_CLASS as o}from"efficient-web-builder/format/lib/content/box-layout";import{say as S}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as T}from"efficient-web-builder/render/components/ViewHideRoot";const c={left:`${o[t.left]} text-left`,center:`${o[t.center]} ${f.center}`,right:`${o[t.right]} ${f.right}`};function $({tagline:i,widthPct:d=100,align:n="left",reverse:x=!0,color:p=null,padTop:a=0,padRight:l=0,padBottom:s=0,padLeft:m=0,editing:O=!1}){const{src:_,reversedSrc:g,inkIsDark:L,wordmark:h,siteName:r}=v(),u=Math.round(I*(d/100)),N={...a?{paddingTop:a}:{},...l?{paddingRight:l}:{},...s?{paddingBottom:s}:{},...m?{paddingLeft:m}:{}};return k(T,{as:"div",className:["flex min-w-0 flex-col",Object.hasOwn(c,n)?c[n]:"","[container-type:inline-size]"].filter(Boolean).join(" "),style:N,children:[e(w,{href:"/","aria-label":r?`${r} home`:"Home",className:"inline-flex max-w-full overflow-x-clip",children:e(A,{variant:"footer",sizePx:u,src:_,reverse:x,color:p,reversedSrc:g,inkIsDark:L,wordmark:h,siteName:r,fitWordmarkToContainer:!0,fitFloorPx:j})}),i?e("p",{className:"mt-4 max-w-[280px] text-[13px] leading-[1.5] text-fg-dim",children:G(i)}):O?e("p",{className:"mt-4 max-w-[280px] text-[13px] italic leading-[1.5] text-fg-dim/60",children:S("Add a short brand tagline →")}):null]})}export{$ as default};
@@ -1 +1 @@
1
- "use client";import{jsx as r,Fragment as T,jsxs as l}from"react/jsx-runtime";import re from"next/link";import{usePathname as Qe}from"next/navigation";import{useCallback as Ze,useEffect as B,useRef as et,useState as p}from"react";import{rootIsDark as tt,watchRootTheme as nt}from"efficient-shell/format";import{useCart as ot}from"./CartContext.js";import{useSearch as rt}from"./SearchContext.js";import lt,{useCountrySelectShows as at}from"./CountrySelect.js";import{resolveCountryShowAs as st}from"../lib/content/country-show-as.js";import le from"./HeaderNavItem.js";import it from"efficient-web-builder/render/components/Logo";import{siteLengthCss as ct}from"efficient-web-builder/format/lib/content/css-length";import dt from"./MenuPlaceholderLabel.js";import{withRMark as ae}from"efficient-web-builder/render/components/RMark";import{AccountButton as mt,CartButton as ut,SearchButton as ht}from"./HeaderTools.js";import ft from"./HeaderCallButton.js";import{useHeaderBar as pt}from"./useHeaderBar.js";import{useModalDismiss as gt}from"./useModalDismiss.js";import bt from"./ThemeToggle.js";import{products as xt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as yt}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as vt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as wt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as St,resolveChromeWidth as kt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as Nt}from"../lib/content/header-theme.js";import{headerSolidBackground as Pt,isProductPage as Et}from"../lib/content/header-bar.js";import{surfaceIsLight as It}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as Tt,HEADER_MENU_GAP_PX as $t,HEADER_SET_HEIGHT_CSS as Lt}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_ATTR as Ct,HEADER_INK_OVERRIDE_ATTR as _t,resolveHeaderInkMode as Rt}from"efficient-web-builder/render/lib/document/header-ink";const se={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},Ht=Array.from({length:vt},()=>({href:"#",label:r(dt,{})}));function At({previewSettings:g,initialSettings:$,editorPreview:L,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:C,commerceEnabled:b=!0}={}){const G=Qe(),[ue,he]=p(!1);B(()=>{const e=y.current?.ownerDocument??document,o=()=>he(e.querySelector(`[${Ct}="light"]`)!=null);o();const f=requestAnimationFrame(o);return()=>cancelAnimationFrame(f)},[G]);const F=Et(G),[c,w]=p(!1),{open:fe,totals:pe}=ot(),{open:ge}=rt(),[_,be]=p(!1),[xe,ye]=p(null),[ve,we]=p(null),[t,Se]=p($??null),n=g??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),ke=de?null:n?.logoUrl??null,Ne=n?.reverseLogo??!1,Pe=n?.logoReversed??null,Ee=n?.logoInkIsDark??null,i=n?.logoPosition??"center",Ie=n?.logoSize??"medium",Te=n?.logoSizePx??null,$e=n?.logoSizeUnit??null,W=Math.min(Math.max(n?.menuSplit??3,1),4),Le=(n?.menuPosition??"left")==="center",Ce=(n?.menuPosition??"left")==="beside",K=(n?.menuRow??"top")==="inline",R=n?.menuGapPx??null,_e=R!=null?{gap:ct(R,n?.menuGapUnit,"gap",$t)??`${R}px`}:void 0,S=K?se.inline:se.stacked,Re=n?.searchEnabled??!1,V=n?.searchPosition??"right",He=n?.countrySelectorEnabled??!0,Ae=st(n?.countrySelectorShowAs),H=n?.accountEnabled??!0,De=n?.cartEnabled??!0,A=(n?.utilStyle??"icon")==="text",a=`mono-eyebrow${(n?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,q=n?.countryUrls??{},Ue=kt(n?.width),je=St(Ue)??void 0,ze=n?.heightPx??Tt.default,X=n?.sticky??"always",k=Rt(n?.topTextColor),m=Nt(n?.theme),N=Object.keys(q),Y=at(N.length?N:void 0),x=He?r(lt,{countries:N.length?N:void 0,urls:g?void 0:q,showAs:Ae}):null,{headerRef:y,scrolled:J,navHidden:Oe}=pt({stickyMode:X,heightPx:ze}),Me=m?JSON.stringify(m.style):null;B(()=>{const e=y.current?.ownerDocument??document,o=e.defaultView??window,f=oe=>oe?It(o.getComputedStyle(oe).getPropertyValue("--bg")):null,M=()=>{be(!tt({doc:e,whenUnset:!0})),ye(f(e.body)),we(f(y.current))};M();const Je=nt(M,{doc:e}),ne=new MutationObserver(M);return e.body&&ne.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Je(),ne.disconnect()}},[y,Me]);const v=ie??wt?r(bt,{}):null;B(()=>{if(!yt({editorPreview:!!L,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return xt.getHeaderSettings().then(o=>!e&&Se(o)).catch(o=>{console.warn("[header] settings fetch failed; using built-in defaults",o)}),()=>{e=!0}},[L,g,$]);const P=J||F,Q=Pt(_,F),Z=k==="auto"?ue:k==="light",Be=P||!Z,Ge=P?ve??_:(xe??_)&&!Z,Fe=k==="auto"?null:{[_t]:k},We=Ze(()=>w(!1),[]),D=et(null);gt({active:c,onDismiss:We,focusRef:D,trapRef:D});const d=(e,o,f="start")=>r(le,{item:e,dropdownAlign:f},o),Ke=!me&&(n?.menuItems?.length??0)>0,E=!!L||!!g,s=Ke?n.menuItems.map(e=>({href:e.url||"",label:ae(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(o=>({href:o.url||"",label:ae(o.label),plainLabel:o.label}))})):E?Ht.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ve=s.length>0||b&&H||!!x&&Y||!!v,qe=i==="center"?s.slice(0,W):i==="right"?s:[],Xe=i==="center"?s.slice(W):i==="left"?s:[],I=Re&&b?r(ht,{onClick:E?void 0:ge,asText:A}):null,U=b&&H?r(mt,{asText:A}):null,j=e=>b&&De?r(ut,{onClick:fe,count:pe.sets,asText:A,className:e}):null,Ye=n?.callPhone??"",ee=n?.callHref??"",z=e=>n?.callButton&&(ee||E)?r(ft,{href:E?"":ee,label:e?"Call":Ye||"Call"}):null,u=l(T,{children:[V==="left"?I:null,x,v,U,j(),V==="right"?I:null,z(!1)]}),O=(e,o=!1)=>r(re,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(it,{variant:"header",scrolled:Be,src:ke,reverse:Ne,onLightSurface:Ge,reversedSrc:Pe,inkIsDark:Ee,size:Ie,sizePx:Te,sizeUnit:$e,wordmark:ce,siteName:C,fitToContainer:o})}),h=O("inline-flex shrink-0 items-center justify-center"),te="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return l(T,{children:[r("header",{ref:y,"data-scrolled":J||void 0,...Fe,className:["sf-site-header",...m?[m.className]:[],X==="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:Lt,...Oe?{transform:"translateY(-100%)"}:null,...P?{background:Q,color:"var(--fg)","--sf-header-ground":Q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:l("div",{className:"w-full",style:je,children:[Le?l("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${a} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${a} flex items-center justify-center gap-8`,children:s.map((e,o)=>d(e,`${e.href}-${o}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):i==="center"?l("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${a} flex items-center gap-8`,children:qe.map((e,o)=>d(e,`${e.href}-${o}`))}),h,l("nav",{className:`${a} flex items-center justify-end gap-8`,children:[Xe.map((e,o)=>d(e,`${e.href}-${o}`,"end")),u]})]}):Ce?l("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[l("div",{className:"flex items-center gap-8",style:_e,children:[h,r("nav",{className:`${a} flex items-center gap-8`,children:s.map((e,o)=>d(e,`${e.href}-${o}`))})]}),r("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?l(T,{children:[l("nav",{className:`${a} flex items-center gap-8`,children:[s.map((e,o)=>d(e,`${e.href}-${o}`)),u]}),h]}):l(T,{children:[h,l("nav",{className:`${a} flex items-center gap-8`,children:[s.map((e,o)=>d(e,`${e.href}-${o}`)),u]})]})}),!K&&l("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[l("div",{className:"flex items-center justify-between",children:[O(te,!0),l("div",{className:`${a} flex shrink-0 items-center gap-5`,children:[I,x,v,U,j(),z(!1)]})]}),r("nav",{className:`${a} flex items-center gap-6 border-t border-line/60 pt-3`,children:s.map((e,o)=>d(e,`${e.href}-${o}`))})]}),l("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[O(te,!0),l("div",{className:"flex shrink-0 items-center gap-4",children:[I,U,j(a),z(!0),Ve&&l("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:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&l("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"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:[s.map((e,o)=>r(le,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${o}`)),l("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&H&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(re,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&Y&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),v&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{At as default};
1
+ "use client";import{jsx as r,Fragment as T,jsxs as a}from"react/jsx-runtime";import re from"next/link";import{usePathname as Qe}from"next/navigation";import{useCallback as Ze,useEffect as B,useRef as et,useState as p}from"react";import{rootIsDark as tt,watchRootTheme as nt}from"efficient-shell/format";import{useCart as ot}from"./CartContext.js";import{useSearch as rt}from"./SearchContext.js";import at,{useCountrySelectShows as lt}from"./CountrySelect.js";import{resolveCountryShowAs as st}from"../lib/content/country-show-as.js";import ae from"./HeaderNavItem.js";import it from"efficient-web-builder/render/components/Logo";import{siteLengthCss as ct}from"efficient-web-builder/format/lib/content/css-length";import dt from"./MenuPlaceholderLabel.js";import{withRMark as le}from"efficient-web-builder/render/components/RMark";import{AccountButton as mt,CartButton as ut,SearchButton as ht}from"./HeaderTools.js";import ft from"./HeaderCallButton.js";import{useHeaderBar as pt}from"./useHeaderBar.js";import{useModalDismiss as gt}from"./useModalDismiss.js";import bt from"./ThemeToggle.js";import{products as xt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as yt}from"../lib/header-settings-fetch.js";import{menuDropdownAside as vt}from"../lib/menu-link.js";import{HEADER_MENU_PLACEHOLDER_COUNT as wt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as St}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as kt,resolveChromeWidth as Nt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as Pt}from"../lib/content/header-theme.js";import{headerSolidBackground as Et,isProductPage as It}from"../lib/content/header-bar.js";import{surfaceIsLight as Tt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as $t,HEADER_MENU_GAP_PX as Lt,HEADER_SET_HEIGHT_CSS as Ct}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_ATTR as _t,HEADER_INK_OVERRIDE_ATTR as Rt,resolveHeaderInkMode as At}from"efficient-web-builder/render/lib/document/header-ink";const se={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},Ht=Array.from({length:wt},()=>({href:"#",label:r(dt,{})}));function Dt({previewSettings:g,initialSettings:$,editorPreview:L,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:C,commerceEnabled:b=!0}={}){const G=Qe(),[ue,he]=p(!1);B(()=>{const e=y.current?.ownerDocument??document,n=()=>he(e.querySelector(`[${_t}="light"]`)!=null);n();const f=requestAnimationFrame(n);return()=>cancelAnimationFrame(f)},[G]);const F=It(G),[c,w]=p(!1),{open:fe,totals:pe}=ot(),{open:ge}=rt(),[_,be]=p(!1),[xe,ye]=p(null),[ve,we]=p(null),[t,Se]=p($??null),o=g??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[],dropdown_aside:e.dropdownAside??null})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),ke=de?null:o?.logoUrl??null,Ne=o?.reverseLogo??!1,Pe=o?.logoReversed??null,Ee=o?.logoInkIsDark??null,i=o?.logoPosition??"center",Ie=o?.logoSize??"medium",Te=o?.logoSizePx??null,$e=o?.logoSizeUnit??null,W=Math.min(Math.max(o?.menuSplit??3,1),4),Le=(o?.menuPosition??"left")==="center",Ce=(o?.menuPosition??"left")==="beside",K=(o?.menuRow??"top")==="inline",R=o?.menuGapPx??null,_e=R!=null?{gap:ct(R,o?.menuGapUnit,"gap",Lt)??`${R}px`}:void 0,S=K?se.inline:se.stacked,Re=o?.searchEnabled??!1,V=o?.searchPosition??"right",Ae=o?.countrySelectorEnabled??!0,He=st(o?.countrySelectorShowAs),A=o?.accountEnabled??!0,De=o?.cartEnabled??!0,H=(o?.utilStyle??"icon")==="text",l=`mono-eyebrow${(o?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,q=o?.countryUrls??{},Ue=Nt(o?.width),je=kt(Ue)??void 0,ze=o?.heightPx??$t.default,X=o?.sticky??"always",k=At(o?.topTextColor),m=Pt(o?.theme),N=Object.keys(q),Y=lt(N.length?N:void 0),x=Ae?r(at,{countries:N.length?N:void 0,urls:g?void 0:q,showAs:He}):null,{headerRef:y,scrolled:J,navHidden:Oe}=pt({stickyMode:X,heightPx:ze}),Me=m?JSON.stringify(m.style):null;B(()=>{const e=y.current?.ownerDocument??document,n=e.defaultView??window,f=oe=>oe?Tt(n.getComputedStyle(oe).getPropertyValue("--bg")):null,M=()=>{be(!tt({doc:e,whenUnset:!0})),ye(f(e.body)),we(f(y.current))};M();const Je=nt(M,{doc:e}),ne=new MutationObserver(M);return e.body&&ne.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Je(),ne.disconnect()}},[y,Me]);const v=ie??St?r(bt,{}):null;B(()=>{if(!yt({editorPreview:!!L,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return xt.getHeaderSettings().then(n=>!e&&Se(n)).catch(n=>{console.warn("[header] settings fetch failed; using built-in defaults",n)}),()=>{e=!0}},[L,g,$]);const P=J||F,Q=Et(_,F),Z=k==="auto"?ue:k==="light",Be=P||!Z,Ge=P?ve??_:(xe??_)&&!Z,Fe=k==="auto"?null:{[Rt]:k},We=Ze(()=>w(!1),[]),D=et(null);gt({active:c,onDismiss:We,focusRef:D,trapRef:D});const d=(e,n,f="start")=>r(ae,{item:e,dropdownAlign:f},n),Ke=!me&&(o?.menuItems?.length??0)>0,E=!!L||!!g,s=Ke?o.menuItems.map(e=>({href:e.url||"",label:le(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(n=>({href:n.url||"",label:le(n.label),plainLabel:n.label,description:n.description,image:n.image,badge:n.badge})),dropdownAside:vt(e.dropdown_aside)})):E?Ht.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ve=s.length>0||b&&A||!!x&&Y||!!v,qe=i==="center"?s.slice(0,W):i==="right"?s:[],Xe=i==="center"?s.slice(W):i==="left"?s:[],I=Re&&b?r(ht,{onClick:E?void 0:ge,asText:H}):null,U=b&&A?r(mt,{asText:H}):null,j=e=>b&&De?r(ut,{onClick:fe,count:pe.sets,asText:H,className:e}):null,Ye=o?.callPhone??"",ee=o?.callHref??"",z=e=>o?.callButton&&(ee||E)?r(ft,{href:E?"":ee,label:e?"Call":Ye||"Call"}):null,u=a(T,{children:[V==="left"?I:null,x,v,U,j(),V==="right"?I:null,z(!1)]}),O=(e,n=!1)=>r(re,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(it,{variant:"header",scrolled:Be,src:ke,reverse:Ne,onLightSurface:Ge,reversedSrc:Pe,inkIsDark:Ee,size:Ie,sizePx:Te,sizeUnit:$e,wordmark:ce,siteName:C,fitToContainer:n})}),h=O("inline-flex shrink-0 items-center justify-center"),te="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return a(T,{children:[r("header",{ref:y,"data-scrolled":J||void 0,...Fe,className:["sf-site-header",...m?[m.className]:[],X==="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:Ct,...Oe?{transform:"translateY(-100%)"}:null,...P?{background:Q,color:"var(--fg)","--sf-header-ground":Q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:a("div",{className:"w-full",style:je,children:[Le?a("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${l} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${l} flex items-center justify-center gap-8`,children:s.map((e,n)=>d(e,`${e.href}-${n}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):i==="center"?a("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${l} flex items-center gap-8`,children:qe.map((e,n)=>d(e,`${e.href}-${n}`))}),h,a("nav",{className:`${l} flex items-center justify-end gap-8`,children:[Xe.map((e,n)=>d(e,`${e.href}-${n}`,"end")),u]})]}):Ce?a("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[a("div",{className:"flex items-center gap-8",style:_e,children:[h,r("nav",{className:`${l} flex items-center gap-8`,children:s.map((e,n)=>d(e,`${e.href}-${n}`))})]}),r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?a(T,{children:[a("nav",{className:`${l} flex items-center gap-8`,children:[s.map((e,n)=>d(e,`${e.href}-${n}`)),u]}),h]}):a(T,{children:[h,a("nav",{className:`${l} flex items-center gap-8`,children:[s.map((e,n)=>d(e,`${e.href}-${n}`)),u]})]})}),!K&&a("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[a("div",{className:"flex items-center justify-between",children:[O(te,!0),a("div",{className:`${l} flex shrink-0 items-center gap-5`,children:[I,x,v,U,j(),z(!1)]})]}),r("nav",{className:`${l} flex items-center gap-6 border-t border-line/60 pt-3`,children:s.map((e,n)=>d(e,`${e.href}-${n}`))})]}),a("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[O(te,!0),a("div",{className:"flex shrink-0 items-center gap-4",children:[I,U,j(l),z(!0),Ve&&a("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:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&a("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"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:[s.map((e,n)=>r(ae,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${n}`)),a("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&A&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(re,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&Y&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),v&&a("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{Dt as default};
@@ -0,0 +1,21 @@
1
+ import { type ReactNode, type RefObject } from "react";
2
+ import { type MenuDropdownAside } from "../lib/menu-link.js";
3
+ export type HeaderNavigationDropdownItem = {
4
+ href: string;
5
+ label: ReactNode;
6
+ plainLabel: string;
7
+ description?: string;
8
+ image?: string;
9
+ badge?: string;
10
+ };
11
+ type PanelProps = {
12
+ id: string;
13
+ items: HeaderNavigationDropdownItem[];
14
+ aside: MenuDropdownAside | null | undefined;
15
+ onNavigate: () => void;
16
+ };
17
+ export declare function DesktopDropdownPanel({ id, items, aside: rawAside, onNavigate, anchor }: PanelProps & {
18
+ anchor: RefObject<HTMLElement | null>;
19
+ }): import("react").JSX.Element;
20
+ export declare function PhoneDropdownPanel({ id, items, aside: rawAside, onNavigate }: PanelProps): import("react").JSX.Element;
21
+ export {};
@@ -0,0 +1 @@
1
+ "use client";import{jsx as n,jsxs as c,Fragment as L}from"react/jsx-runtime";import x from"next/link";import{useLayoutEffect as E,useState as h}from"react";import{renderGold as b}from"efficient-web-builder/render/components/goldPhrases";import{absolutizeApiUrl as k}from"efficient-web-builder/render/lib/media";import{sizedImage as _}from"efficient-web-builder/format/lib/sized-image";import{isLabelOnlyMenuUrl as w,menuDropdownAside as N}from"../lib/menu-link.js";const v=16,C=12,p="font-body font-normal normal-case tracking-normal",O="shrink-0 rounded-sm border border-line px-1.5 py-1 font-mono text-[11px] uppercase leading-none tracking-[0.18em] text-fg-dim",g="focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",j={outlineOffset:-2},D="160px";function $({item:e}){const[s,i]=h(!1),r=(e.image??"").trim(),l=r&&!s?k(r):null,t=(e.badge??"").trim(),a=(e.description??"").trim();return c(L,{children:[c("span",{className:"flex min-w-0 items-center gap-2.5",children:[l?n("img",{..._(l,{fallbackWidth:320,maxWidth:640}),sizes:D,alt:e.plainLabel,className:"h-10 w-auto min-w-0 max-w-full object-contain object-left",draggable:!1,onError:()=>i(!0)}):n("span",{className:"min-w-0 text-lg font-semibold leading-snug",children:e.label}),t?n("span",{className:O,children:t}):null]}),a?n("span",{className:"text-sm leading-snug text-fg-dim",children:a}):null]})}function y({item:e,className:s,linkClassName:i,inset:r=!1,onNavigate:l}){return w(e.href)?n("span",{"data-menu-panel-item":"",className:s,children:n($,{item:e})}):n(x,{"data-menu-panel-item":"",href:e.href,onClick:l,className:`${s} ${i}`,style:r?j:void 0,children:n($,{item:e})})}function P({aside:e,className:s,navType:i,onNavigate:r}){const l=e.links??[];return c("div",{"data-menu-panel-aside":"",className:s,children:[e.eyebrow?n("p",{className:`${i} text-accent`.trim(),children:e.eyebrow}):null,e.title?n("p",{className:"font-display text-xl font-semibold leading-tight normal-case tracking-normal",children:b(e.title)}):null,e.text?n("p",{className:`${p} text-sm leading-normal text-fg-dim`,children:b(e.text)}):null,l.length?n("div",{className:"mt-1 flex flex-col items-start gap-2",children:l.map((t,a)=>w(t.url)?n("span",{className:`${i} text-fg-dim`.trim(),children:t.label},`${t.url}-${a}`):c(x,{href:t.url,onClick:r,className:`${i} inline-flex items-center gap-2 text-accent transition-opacity hover:opacity-80 focus-visible:rounded-sm ${g}`.trim(),children:[t.label,n("span",{"aria-hidden":"true",children:"→"})]},`${t.url}-${a}`))}):null]})}function M(e){const s=e.ownerDocument.defaultView;if(!s)return null;const i=e.getBoundingClientRect(),r=e.ownerDocument.documentElement.clientWidth;let l=0,t=r;const a=e.closest("[data-header-band], [data-box-header]");if(a){const o=a.getBoundingClientRect(),d=s.getComputedStyle(a);l=o.left+(parseFloat(d.paddingLeft)||0),t=o.right-(parseFloat(d.paddingRight)||0)}if(l=Math.max(l,v),t=Math.min(t,r-v),!(t>l))return null;const m=e.closest("header, [data-box-header]"),f=m?Math.max(0,Math.round(m.getBoundingClientRect().bottom-i.bottom)-1):C;return{left:Math.round(l-i.left),width:Math.round(t-l),gap:f}}function G({id:e,items:s,aside:i,onNavigate:r,anchor:l}){const t=N(i),[a,m]=h(null);E(()=>{const o=l.current,d=o?.ownerDocument.defaultView;if(!o||!d)return;const u=()=>m(M(o));return u(),d.addEventListener("resize",u),()=>d.removeEventListener("resize",u)},[l]);const f=a?{left:a.left,width:a.width,paddingTop:a.gap}:void 0;return n("div",{id:e,"data-menu-panel":"",className:`absolute top-full z-[60] whitespace-normal text-fg ${a?"":"left-0 w-[min(64rem,calc(100vw-2rem))] pt-3"}`.trim(),style:f,children:n("div",{className:"overflow-hidden rounded-[var(--sf-card-radius,0px)] border border-line bg-bg shadow-xl",children:c("div",{className:"flex bg-surface",children:[n("div",{className:`min-w-0 overflow-hidden ${t?"flex-[2]":"flex-1"}`,children:n("div",{className:`-mb-px -mr-px grid ${t?"grid-cols-2":"grid-cols-3"}`,children:s.map((o,d)=>n(y,{item:o,onNavigate:r,className:`flex min-w-0 flex-col justify-center gap-1.5 border-b border-r border-line px-5 py-4 text-base ${p}`,linkClassName:`transition-[background] hover:bg-surface-2 focus-visible:ring-inset ${g}`,inset:!0},`${o.href}-${d}`))})}),t?n(P,{aside:t,navType:"",onNavigate:r,className:"flex min-w-0 flex-1 flex-col gap-2.5 border-l border-line p-[22px]"}):null]})})})}function T({id:e,items:s,aside:i,onNavigate:r}){const l=N(i);return c("div",{id:e,"data-menu-panel":"",className:"mt-3 flex flex-col border-l border-line pl-5",children:[s.map((t,a)=>n(y,{item:t,onNavigate:r,className:`flex min-h-11 flex-col justify-center gap-1 py-2.5 text-base ${p}`,linkClassName:g},`${t.href}-${a}`)),l?n(P,{aside:l,navType:"mono-eyebrow",onNavigate:r,className:"mt-3 flex flex-col gap-2.5 border-t border-line pt-5"}):null]})}export{G as DesktopDropdownPanel,T as PhoneDropdownPanel};
@@ -1,13 +1,13 @@
1
1
  import { type ReactNode } from "react";
2
+ import { type MenuDropdownAside } from "../lib/menu-link.js";
3
+ import { type HeaderNavigationDropdownItem } from "./HeaderDropdownPanel.js";
4
+ export type { HeaderNavigationDropdownItem };
2
5
  export type HeaderNavigationItem = {
3
6
  href: string;
4
7
  label: ReactNode;
5
8
  plainLabel: string;
6
- dropdownItems: {
7
- href: string;
8
- label: ReactNode;
9
- plainLabel: string;
10
- }[];
9
+ dropdownItems: HeaderNavigationDropdownItem[];
10
+ dropdownAside?: MenuDropdownAside | null;
11
11
  };
12
12
  export default function HeaderNavItem({ item, mobile, onNavigate, dropdownAlign, }: {
13
13
  item: HeaderNavigationItem;
@@ -1 +1 @@
1
- "use client";import{jsx as n,jsxs as p}from"react/jsx-runtime";import l from"next/link";import{useEffect as k,useId as $,useRef as g,useState as C}from"react";import{isLabelOnlyMenuUrl as h}from"../lib/menu-link.js";import{useTakeViewHide as j,withViewHide as m}from"efficient-web-builder/render/components/ViewHideRoot";function L({item:s,mobile:c=!1,onNavigate:y,dropdownAlign:b="start"}){const[o,t]=C(!1),u=$(),f=g(null),v=g(null),w=s.dropdownItems.length>0,d=!h(s.href),i=j();k(()=>{if(!o)return;const e=f.current?.ownerDocument??document,r=N=>{f.current?.contains(N.target)||t(!1)};return e.addEventListener("pointerdown",r),()=>e.removeEventListener("pointerdown",r)},[o]);const a=()=>{t(!1),y?.()};if(!w)return d?i.scope(n(l,{href:s.href,onClick:a,className:m(c?"flex min-h-11 items-center font-display text-3xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent":"whitespace-nowrap opacity-80 transition-opacity hover:opacity-100 focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",i.className),...i.attrs,children:s.label})):i.scope(n("span",{className:m(c?"flex min-h-11 items-center font-display text-3xl":"whitespace-nowrap opacity-80",i.className),...i.attrs,children:s.label}));const x=n("button",{ref:v,type:"button","aria-label":`${o?"Close":"Open"} ${s.plainLabel} menu`,"aria-expanded":o,"aria-controls":u,onClick:()=>t(e=>!e),className:c?"flex h-11 w-11 shrink-0 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent":"flex h-8 w-8 shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:n("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",className:`transition-transform ${o?"rotate-180":""}`,children:n("path",{d:"m3 5 4 4 4-4"})})});return c?i.scope(p("div",{ref:f,className:i.className||void 0,...i.attrs,children:[p("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[d?n(l,{href:s.href,onClick:a,className:"min-w-0 flex-1 font-display text-3xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:s.label}):n("span",{className:"min-w-0 flex-1 font-display text-3xl",children:s.label}),x]}),o?n("div",{id:u,className:"mt-3 flex flex-col border-l border-line pl-5",children:s.dropdownItems.map((e,r)=>h(e.href)?n("span",{className:"flex min-h-11 items-center text-base opacity-80",children:e.label},`${e.href}-${r}`):n(l,{href:e.href,onClick:a,className:"flex min-h-11 items-center text-base opacity-80 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:e.label},`${e.href}-${r}`))}):null]})):i.scope(p("div",{ref:f,className:m("relative flex items-center whitespace-nowrap",i.className),...i.attrs,onMouseEnter:()=>t(!0),onMouseLeave:()=>t(!1),onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||t(!1)},onKeyDown:e=>{e.key==="Escape"&&(t(!1),v.current?.focus())},children:[d?n(l,{href:s.href,onClick:a,onFocus:()=>t(!0),className:"opacity-80 transition-opacity hover:opacity-100 focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:s.label}):n("span",{className:"opacity-80",children:s.label}),x,o?n("div",{id:u,className:`absolute top-full z-[60] w-72 pt-3 text-fg ${b==="end"?"right-0":b==="center"?"left-1/2 -translate-x-1/2":"left-0"}`,children:n("div",{className:"overflow-hidden rounded-lg border border-line bg-bg p-2 shadow-xl",children:s.dropdownItems.map((e,r)=>h(e.href)?n("span",{className:"flex min-h-11 items-center rounded-md px-4 py-2 text-sm opacity-80",children:e.label},`${e.href}-${r}`):n(l,{href:e.href,onClick:a,className:"flex min-h-11 items-center rounded-md px-4 py-2 text-sm opacity-80 transition-[background,opacity] hover:bg-[var(--card-bg)] hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:e.label},`${e.href}-${r}`))})}):null]}))}export{L as default};
1
+ "use client";import{jsx as s,jsxs as b}from"react/jsx-runtime";import f from"next/link";import{useEffect as C,useId as L,useRef as v,useState as E}from"react";import{isLabelOnlyMenuUrl as g,isMenuPanel as j}from"../lib/menu-link.js";import{useTakeViewHide as D,withViewHide as x}from"efficient-web-builder/render/components/ViewHideRoot";import{DesktopDropdownPanel as P,PhoneDropdownPanel as T}from"./HeaderDropdownPanel.js";const A=120;function M({item:n,mobile:u=!1,onNavigate:$,dropdownAlign:w="start"}){const[i,r]=E(!1),l=L(),c=v(null),y=v(null),N=n.dropdownItems.length>0,p=N&&j(n.dropdownItems,n.dropdownAside),d=v(null),h=()=>{d.current!==null&&(clearTimeout(d.current),d.current=null)};C(()=>h,[]);const m=!g(n.href),o=D();C(()=>{if(!i)return;const e=c.current?.ownerDocument??document,t=I=>{c.current?.contains(I.target)||r(!1)};return e.addEventListener("pointerdown",t),()=>e.removeEventListener("pointerdown",t)},[i]);const a=()=>{r(!1),$?.()};if(!N)return m?o.scope(s(f,{href:n.href,onClick:a,className:x(u?"flex min-h-11 items-center font-display text-3xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent":"whitespace-nowrap opacity-80 transition-opacity hover:opacity-100 focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",o.className),...o.attrs,children:n.label})):o.scope(s("span",{className:x(u?"flex min-h-11 items-center font-display text-3xl":"whitespace-nowrap opacity-80",o.className),...o.attrs,children:n.label}));const k=s("button",{ref:y,type:"button","aria-label":`${i?"Close":"Open"} ${n.plainLabel} menu`,"aria-expanded":i,"aria-controls":l,onClick:()=>r(e=>!e),className:u?"flex h-11 w-11 shrink-0 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent":"flex h-8 w-8 shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:s("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",className:`transition-transform ${i?"rotate-180":""}`,children:s("path",{d:"m3 5 4 4 4-4"})})});return u?o.scope(b("div",{ref:c,className:o.className||void 0,...o.attrs,children:[b("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[m?s(f,{href:n.href,onClick:a,className:"min-w-0 flex-1 font-display text-3xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:n.label}):s("span",{className:"min-w-0 flex-1 font-display text-3xl",children:n.label}),k]}),i&&p?s(T,{id:l,items:n.dropdownItems,aside:n.dropdownAside,onNavigate:a}):i?s("div",{id:l,className:"mt-3 flex flex-col border-l border-line pl-5",children:n.dropdownItems.map((e,t)=>g(e.href)?s("span",{className:"flex min-h-11 items-center text-base opacity-80",children:e.label},`${e.href}-${t}`):s(f,{href:e.href,onClick:a,className:"flex min-h-11 items-center text-base opacity-80 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:e.label},`${e.href}-${t}`))}):null]})):o.scope(b("div",{ref:c,className:x("relative flex items-center whitespace-nowrap",o.className),...o.attrs,onMouseEnter:()=>{h(),r(!0)},onMouseLeave:()=>{h(),p?d.current=setTimeout(()=>r(!1),A):r(!1)},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||r(!1)},onKeyDown:e=>{e.key==="Escape"&&(r(!1),y.current?.focus())},children:[m?s(f,{href:n.href,onClick:a,onFocus:()=>r(!0),className:"opacity-80 transition-opacity hover:opacity-100 focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:n.label}):s("span",{className:"opacity-80",children:n.label}),k,i&&p?s(P,{id:l,items:n.dropdownItems,aside:n.dropdownAside,onNavigate:a,anchor:c}):i?s("div",{id:l,className:`absolute top-full z-[60] w-72 pt-3 text-fg ${w==="end"?"right-0":w==="center"?"left-1/2 -translate-x-1/2":"left-0"}`,children:s("div",{className:"overflow-hidden rounded-lg border border-line bg-bg p-2 shadow-xl",children:n.dropdownItems.map((e,t)=>g(e.href)?s("span",{className:"flex min-h-11 items-center rounded-md px-4 py-2 text-sm opacity-80",children:e.label},`${e.href}-${t}`):s(f,{href:e.href,onClick:a,className:"flex min-h-11 items-center rounded-md px-4 py-2 text-sm opacity-80 transition-[background,opacity] hover:bg-[var(--card-bg)] hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:e.label},`${e.href}-${t}`))})}):null]}))}export{M as default};
@@ -1 +1 @@
1
- "use client";import{jsx as n,jsxs as f}from"react/jsx-runtime";import{createContext as d,useContext as h,useEffect as k,useRef as x}from"react";import L from"next/link";import w from"./HeaderNavItem.js";import N from"./MenuPlaceholderLabel.js";import{useCardRow as C}from"efficient-web-builder/render/components/CardRowContext";import{renderGold as i}from"efficient-web-builder/render/components/goldPhrases";import{scrollBehavior as _}from"efficient-web-builder/render/components/useReducedMotion";import{useTakeViewHide as g,withViewHide as u}from"efficient-web-builder/render/components/ViewHideRoot";import{isLabelOnlyMenuUrl as v,menuLinkKind as y}from"../lib/menu-link.js";import{CURRENT_LINE as m,TAB_CELLS as p,showCurrentTab as M}from"../lib/content/tab-strip.js";const R=d(null),b="opacity-80 transition-opacity hover:opacity-100";function s({item:e,label:l,link:r,onNavigate:t,current:c=!1,children:a}){const o=g();return v(e.url)?o.scope(n("span",{className:u(l,o.className),...o.attrs,children:i(e.label)})):o.scope(y(e.url)==="off-site"?f("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:u(r,o.className),onClick:t,...o.attrs,children:[i(e.label),a]}):f(L,{href:e.url,className:u(r,o.className),onClick:t,"aria-current":c?"page":void 0,...o.attrs,children:[i(e.label),a]}))}function T(){const e=x(null);return k(()=>{M(e.current?.closest("[data-menu-tabs] > ul")??null,_())},[]),n("span",{ref:e,className:p.underline})}function j(){const e=C(),l=h(R);if(!e||!l)return null;if(l.placeholder)return n(N,{});const r={label:e.row.label??"",url:e.row.href??""},t=!!l.current&&l.current.index===e.index&&l.current.href===r.url;if(l.place==="tab"){const a=p.tab(t);return n(s,{item:r,label:a,link:a,current:t,children:t?n(T,{}):null})}if(l.place==="column")return n(s,{item:r,label:"text-fg",link:"text-fg transition-colors hover:text-accent",current:t});if(l.place==="panel")return n(s,{item:r,label:"",link:` ${b}`,onNavigate:l.onNavigate,current:t});const c=e.item?.dropdown_items??[];return c.length?n(w,{item:{href:r.url,label:i(r.label),plainLabel:r.label,dropdownItems:c.map(a=>({href:a.url,label:i(a.label),plainLabel:a.label}))}}):t?n(s,{item:r,label:"",link:m.rowLink,current:!0,children:n("span",{"aria-hidden":"true",className:m.row})}):n(s,{item:r,label:"",link:` ${b}`})}export{R as MenuPlaceContext,j as default};
1
+ "use client";import{jsx as t,jsxs as m}from"react/jsx-runtime";import{createContext as b,useContext as h,useEffect as w,useRef as k}from"react";import x from"next/link";import L from"./HeaderNavItem.js";import N from"./MenuPlaceholderLabel.js";import{useCardRow as g}from"efficient-web-builder/render/components/CardRowContext";import{renderGold as i}from"efficient-web-builder/render/components/goldPhrases";import{scrollBehavior as C}from"efficient-web-builder/render/components/useReducedMotion";import{useTakeViewHide as _,withViewHide as u}from"efficient-web-builder/render/components/ViewHideRoot";import{isLabelOnlyMenuUrl as v,menuDropdownAside as y,menuLinkKind as M}from"../lib/menu-link.js";import{CURRENT_LINE as f,TAB_CELLS as p,showCurrentTab as R}from"../lib/content/tab-strip.js";const T=b(null),d="opacity-80 transition-opacity hover:opacity-100";function s({item:r,label:l,link:n,onNavigate:a,current:c=!1,children:o}){const e=_();return v(r.url)?e.scope(t("span",{className:u(l,e.className),...e.attrs,children:i(r.label)})):e.scope(M(r.url)==="off-site"?m("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:u(n,e.className),onClick:a,...e.attrs,children:[i(r.label),o]}):m(x,{href:r.url,className:u(n,e.className),onClick:a,"aria-current":c?"page":void 0,...e.attrs,children:[i(r.label),o]}))}function j(){const r=k(null);return w(()=>{R(r.current?.closest("[data-menu-tabs] > ul")??null,C())},[]),t("span",{ref:r,className:p.underline})}function E(){const r=g(),l=h(T);if(!r||!l)return null;if(l.placeholder)return t(N,{});const n={label:r.row.label??"",url:r.row.href??""},a=!!l.current&&l.current.index===r.index&&l.current.href===n.url;if(l.place==="tab"){const e=p.tab(a);return t(s,{item:n,label:e,link:e,current:a,children:a?t(j,{}):null})}if(l.place==="column")return t(s,{item:n,label:"text-fg",link:"text-fg transition-colors hover:text-accent",current:a});if(l.place==="panel")return t(s,{item:n,label:"",link:` ${d}`,onNavigate:l.onNavigate,current:a});const c=r.item,o=c?.dropdown_items??[];return o.length?t(L,{item:{href:n.url,label:i(n.label),plainLabel:n.label,dropdownItems:o.map(e=>({href:e.url,label:i(e.label),plainLabel:e.label,description:e.description,image:e.image,badge:e.badge})),dropdownAside:y(c?.dropdown_aside)}}):a?t(s,{item:n,label:"",link:f.rowLink,current:!0,children:t("span",{"aria-hidden":"true",className:f.row})}):t(s,{item:n,label:"",link:` ${d}`})}export{T as MenuPlaceContext,E as default};
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as h,Fragment as mt}from"react/jsx-runtime";import{useScopeClass as dt}from"../lib/use-scope-class.js";import{useEffect as A,useMemo as p,useState as pe}from"react";import{cardHoverOf as ct}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as pt}from"efficient-web-builder/format/lib/content/container-gap";import ut from"next/link";import{cardRowsGrid as gt,GridCardProvider as ft,GridMixedCards as ht,gridIndexCss as xt}from"./GridCardTemplate.js";import{gridClassImageSizes as wt}from"../lib/sections/card-image-sizes.js";import{fillRowCss as ue}from"../lib/sections/fill-row.js";import{hiddenCardsRule as ge,noHoleBands as fe,noHoleCss as he,ONE_WHEEL_MARK as vt,oneWheelScope as xe,pairScope as yt,showsASetCard as we}from"../lib/sections/grid-no-hole.js";import{setIsWide as bt,summarySetBuild as Ct}from"../lib/wheels/set-mode.js";import{answersForKind as ve,NO_FIELD_ANSWERS as ye}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as St}from"./ProductCardEyebrow.js";import Mt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as Nt,centredCap as Et}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as Tt,SectionWheelsProvider as Pt}from"./ProductRef.js";import{useCurrency as $t}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as Ot,FRAME_ROOM_PRODUCT_GRID_PHONE as _t,framedBandPad as Rt,PRODUCT_GRID_ROOM as zt,withBandClasses as It}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Lt,useCatalogFilter as At}from"./catalog/CatalogFilterContext.js";import{useIsoLayoutEffect as Bt,useShopperMember as Ht}from"./catalog/ShopperScope.js";import Gt from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Ft}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as kt,hasActivePlpFilters as Dt,plpPricedAmounts as Ut}from"../lib/wheels/plp-filters.js";import Wt from"./catalog/ClearAllButton.js";import{gridPagingOf as jt,gridShownOf as Kt}from"../lib/sections/product-grid-pages.js";import Xt from"./SectionBand.js";import{useInsideBox as Zt,useInsideSiteGutter as qt}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as Vt}from"../lib/sections/product-grid-columns.js";import{renderGold as te,renderHeadline as Yt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Jt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as Qt}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as B,plpKindNoun as be}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as er,gridKindsOf as Ce,gridRowsOf as tr}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as rr}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as nr}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as ir}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as sr}from"../lib/wheels/lug-count.js";import{diametersOf as or}from"../lib/wheels/size-range.js";import{say as ar}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as lr}from"../lib/sections/product-grid-title.js";const mr=ct({},"ProductGrid"),i={headingMediumUpTo800Xs:"max-view-wide:text-[length:var(--size-headingMedium,28px)]",headingMediumUpTo800Small:"max-view-wide:text-[length:var(--size-headingMedium,32px)]",headingMediumUpTo800Large:"max-view-wide:text-[length:var(--size-headingMedium,36px)]",headingMediumUpTo800Xl:"max-view-wide:text-[length:var(--size-headingMedium,40px)]",body:"text-[length:var(--size-body,13px)]",headingMedium1:"text-[length:var(--size-headingMedium,40px)]",headingMedium2:"text-[length:var(--size-headingMedium,48px)]",headingMedium3:"text-[length:var(--size-headingMedium,56px)]",headingMedium4:"text-[length:var(--size-headingMedium,64px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},Se=[{value:"para",label:"Paragraph size — 13px",cls:`font-mono font-normal uppercase tracking-[0.22em] ${i.labelLarge}`},{value:"sm",label:"Small — 40px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium1} ${i.headingMediumUpTo800Xs}`},{value:"md",label:"Medium — 48px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium2} ${i.headingMediumUpTo800Small}`},{value:"lg",label:"Large — 56px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium3} ${i.headingMediumUpTo800Large}`},{value:"xl",label:"Extra large — 64px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium4} ${i.headingMediumUpTo800Xl}`}];function dr(S){return(Se.find(x=>x.value===S)??Se.find(x=>x.value===lr)).cls}function cr({num:S,catalog:x,catalogTotal:Me,firstCountInChips:Ne=!1,kinds:P,title:H,titleSize:Ee,pads:Te,noTop:re=!1,description:$,link:M,products:Pe,wheels:$e,source:c,columns:Oe,columnsPhone:_e,columnsTablet:Re,limit:ze,moreProducts:Ie,perPage:Le,editing:N,contentCapped:Ae=!1,hover:Be,fieldUsage:w,ownerId:He="",template:Ge,gap:Fe,gapPhone:ke}){const G=p(()=>w?ve(w,"alloy-wheel"):void 0,[w]),De=p(()=>w?ve(w,"tyre"):void 0,[w]),e=dt("pg"),{paged:v,per:y,limit:l,cap:E}=jt({moreProducts:Ie,perPage:Le,limit:ze}),m=Vt(Oe,_e,Re),ne=Ae,Ue=qt(),We=Zt(),je=Ue||We,F=rr(N===!0&&!!c),s=p(()=>c?Qt(tr(c,P,F??x??[])):null,[x,F,c,P]),k=Ht("grid",s),a=s?k.scope:null,u=er(c),b=u!==null&&!a,{filters:O,reportCount:D,reportLugs:U,reportSizes:W,reportFinishes:j,reportCategories:K,reportPrices:X,vehicle:ie}=At(),{currency:g}=$t(),Z=b&&!!O.process&&O.process!==u,q=a?.state,n=p(()=>s?q?kt(s,q,g):b?Jt(s,O,g,ie.fit):s:null,[s,q,b,O,g,ie.fit]),[Ke,Xe]=pe(1),V=v&&n?Math.max(1,Math.ceil(n.length/y)):1,C=Math.min(V,Math.max(1,a?a.state.page:Ke)),{reportShown:Y}=k,se=a!==null;Bt(()=>{if(!se||!n)return Y(null);Y(Kt(n.length,{paged:v,per:y,cap:E},C))},[se,n,Y,v,C,y,E]);const Ze=r=>a?a.update({page:r}):Xe(r),o=p(()=>v&&n?n.slice((C-1)*y,C*y):n,[v,n,C,y]);A(()=>(K(e,u===null?[]:[u]),()=>K(e,[])),[u,K,e]),A(()=>{if(b)return D(e,Z?0:n?.length??0),()=>D(e,0)},[b,Z,n,D,e]);const T=p(()=>({lugs:sr(s??[]),sizes:or(s??[]),finishes:ir(s??[]),prices:Ut((s??[]).filter(r=>B(r)!=="tyre"),g)}),[s,g]);A(()=>(U(e,T.lugs),W(e,T.sizes),j(e,T.finishes),X(e,T.prices),()=>{U(e,[]),W(e,[]),j(e,[]),X(e,[])}),[T,U,W,j,X,e]);const J=pt("ProductGrid",Fe,"both",ke),qe=`${e} grid${J.className} bg-[var(--catalog-grid-bg)] ${m}`,oe=gt(J),Ve=`${e} grid${oe.className} bg-[var(--catalog-grid-bg)] ${m}`,Ye=oe.style,Je=p(()=>{const r=(n??[]).filter(d=>B(d)!=="tyre");if(r.length===0)return!1;const f=r.some(d=>!!d.process);return r.some(d=>!!d.setWords)||St({kind:!1,brand:!1,process:f},G??[])},[n,G]),Qe=o?o.length>0?t("div",{className:Ve,style:Ye,children:t(ht,{items:o,tyreOf:r=>B(r)==="tyre"?r:null})}):a&&Dt(a.state)?h("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${be(Ce(c,P)).many} match those filters`}),t(Wt,{onClick:a.clear})]}):N?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:ar("No products in “{name}” yet",{name:c?.name??""})})}):null:t(Pe,{className:qe,style:J.style,minEmptyHeight:320}),et=a?a.countInChips:Ne,_=n&&!et?n===s&&!F?Me??n.length:n.length:null,ae=be(Ce(c,P)),tt=S||H||$||M?h("div",{className:`${nr} sticky top-[var(--sf-header-h,88px)] z-30 mb-5 flex items-center justify-between gap-4 max-view-wide:flex-wrap max-view-wide:gap-y-2 border-b border-line bg-bg/95 py-3 backdrop-blur-md ${ne||je?"":"-mx-[var(--sf-site-gutter,40px)] px-[var(--sf-site-gutter,40px)] max-view-wide:-mx-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]"}`,children:[h("div",{className:"flex min-w-0 items-end gap-6 max-view-wide:flex-col max-view-wide:items-stretch max-view-wide:gap-3",children:[S&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,children:te(S)}),H&&t("h2",{className:`${dr(Ee)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,children:Yt(H,!1)})]}),($||M||_!==null)&&h("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[$&&t("span",{className:`max-w-[340px] truncate font-display ${i.body} leading-[1.4] text-fg-dim max-view-wide:hidden view-wide:w-0 view-wide:grow view-wide:text-right`,children:te($)}),M&&h(ut,{href:M.href,className:`inline-flex items-center gap-2 whitespace-nowrap font-mono ${i.labelLarge} uppercase tracking-[0.2em] text-fg-dim transition-colors hover:text-fg`,children:[te(M.text),t("span",{"aria-hidden":!0,children:"→"})]}),_!==null&&h("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:[_," ",_===1?ae.one:ae.many]})]})]}):null,R=Rt(Te,zt,{noTop:re}),{paddingTop:rt,...nt}=R.style,z=re?0:rt,it={...z===void 0?{}:{"--pg-pt":typeof z=="number"?`${z}px`:z},...nt},I=p(()=>{if(!o)return null;const r=o.map(f=>B(f)!=="tyre"&&bt(Ct(f))?2:1);return we(r,l)?fe(m,r,l):null},[o,m,l]),[st,ot]=pe("");A(()=>{if(o)return;const r=document.querySelector(`.${e}`);if(!r)return;const f=()=>{const d=[...r.children].map(ce=>ce.classList.contains("col-span-2")&&!ce.querySelector(vt)?2:1);ot(we(d,l)?he(e,fe(m,d,l,!1),d.length):"")};f();const ee=new MutationObserver(f);return ee.observe(r,{childList:!0}),()=>ee.disconnect()},[o,e,m,l]);const at=I?I[0].tracks:o?E?Math.min(o.length,l):o.length:void 0,L=I?he(yt(e),I,o.length)+(E?ge(xe(e),l+1):"")+ue(xe(e),m,{limit:l,cards:o.length}):st,le=L?"":ue(e,m,{limit:l,cards:o?.length}),me=xt(e),de=h(mt,{children:[E&&!L&&t("style",{children:ge(e,l+1)}),L&&t("style",{children:L}),le&&t("style",{children:le}),me&&t("style",{children:me}),tt,Qe,v&&V>1&&t(Gt,{textSize:Ft.labelSmall,page:C,pageCount:V,onPage:Ze}),t(Mt,{editing:N})]});if(Z)return null;const Q=t(Xt,{rootRef:k.ref,attrs:b&&u!==null?{...R.attrs,[Lt]:u}:R.attrs,className:It(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${Ot} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${_t}`,R),column:null,inAnyBox:!0,style:it,defaults:{"--pg-pt":"120px"},children:ne?t("div",{style:Et(Nt),children:de}):de}),lt=s?Q:N?t(Tt,{currency:g,children:Q}):t(Pt,{wheels:$e,currency:g,children:Q});return t(ft,{value:{ownerId:He,Template:Ge,hover:Be??mr,imageSizes:wt(m,at),fieldUsage:G??ye,tyreFieldUsage:De??ye,reserveEyebrow:Je,editing:N===!0},children:lt})}export{Se as TITLE_SIZES,cr as default};
1
+ "use client";import{jsx as t,jsxs as x,Fragment as mt}from"react/jsx-runtime";import{useScopeClass as dt}from"../lib/use-scope-class.js";import{useEffect as A,useMemo as p,useState as pe}from"react";import{cardHoverOf as ct}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as pt}from"efficient-web-builder/format/lib/content/container-gap";import ut from"next/link";import{cardRowsGrid as gt,GridCardProvider as ft,GridMixedCards as ht,gridIndexCss as xt}from"./GridCardTemplate.js";import{gridClassImageSizes as wt}from"../lib/sections/card-image-sizes.js";import{fillRowCss as ue}from"../lib/sections/fill-row.js";import{hiddenCardsRule as ge,noHoleBands as fe,noHoleCss as he,ONE_WHEEL_MARK as vt,oneWheelScope as xe,pairScope as yt,showsASetCard as we}from"../lib/sections/grid-no-hole.js";import{setIsWide as bt,summarySetBuild as Ct}from"../lib/wheels/set-mode.js";import{answersForKind as ve,NO_FIELD_ANSWERS as ye}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as St}from"./ProductCardEyebrow.js";import Mt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as Pt,centredCap as Et}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as Nt,SectionWheelsProvider as Tt}from"./ProductRef.js";import{useCurrency as _t}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as Ot,FRAME_ROOM_PRODUCT_GRID_PHONE as $t,framedBandPad as Rt,PRODUCT_GRID_ROOM as It,withBandClasses as zt}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Lt,useCatalogFilter as At}from"./catalog/CatalogFilterContext.js";import{useIsoLayoutEffect as Bt,useShopperMember as Gt}from"./catalog/ShopperScope.js";import Ht from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Ft}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as Dt,hasActivePlpFilters as Ut,plpPricedAmounts as kt}from"../lib/wheels/plp-filters.js";import Wt from"./catalog/ClearAllButton.js";import{GRID_TOP_UP_SPARE as jt,gridPagingOf as Kt,gridShownOf as Xt}from"../lib/sections/product-grid-pages.js";import Zt from"./SectionBand.js";import{useInsideBox as qt,useInsideSiteGutter as Vt}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as Yt}from"../lib/sections/product-grid-columns.js";import{renderGold as te,renderHeadline as Jt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Qt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as er}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as B,plpKindNoun as be}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as tr,gridKindsOf as Ce,gridRowsOf as rr}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as nr}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as ir}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as sr}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as ar}from"../lib/wheels/lug-count.js";import{diametersOf as or}from"../lib/wheels/size-range.js";import{say as lr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as mr}from"../lib/sections/product-grid-title.js";const dr=ct({},"ProductGrid"),i={headingMediumUpTo800Xs:"max-view-wide:text-[length:var(--size-headingMedium,28px)]",headingMediumUpTo800Small:"max-view-wide:text-[length:var(--size-headingMedium,32px)]",headingMediumUpTo800Large:"max-view-wide:text-[length:var(--size-headingMedium,36px)]",headingMediumUpTo800Xl:"max-view-wide:text-[length:var(--size-headingMedium,40px)]",body:"text-[length:var(--size-body,13px)]",headingMedium1:"text-[length:var(--size-headingMedium,40px)]",headingMedium2:"text-[length:var(--size-headingMedium,48px)]",headingMedium3:"text-[length:var(--size-headingMedium,56px)]",headingMedium4:"text-[length:var(--size-headingMedium,64px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},Se=[{value:"para",label:"Paragraph size — 13px",cls:`font-mono font-normal uppercase tracking-[0.22em] ${i.labelLarge}`},{value:"sm",label:"Small — 40px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium1} ${i.headingMediumUpTo800Xs}`},{value:"md",label:"Medium — 48px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium2} ${i.headingMediumUpTo800Small}`},{value:"lg",label:"Large — 56px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium3} ${i.headingMediumUpTo800Large}`},{value:"xl",label:"Extra large — 64px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium4} ${i.headingMediumUpTo800Xl}`}];function cr(M){return(Se.find(w=>w.value===M)??Se.find(w=>w.value===mr)).cls}function pr({num:M,catalog:w,catalogTotal:Me,firstCountInChips:Pe=!1,kinds:T,title:G,titleSize:Ee,pads:Ne,noTop:re=!1,description:_,link:P,products:Te,wheels:_e,source:c,columns:Oe,columnsPhone:$e,columnsTablet:Re,limit:Ie,moreProducts:ze,perPage:Le,editing:E,contentCapped:Ae=!1,hover:Be,fieldUsage:v,ownerId:Ge="",template:He,gap:Fe,gapPhone:De}){const H=p(()=>v?ve(v,"alloy-wheel"):void 0,[v]),Ue=p(()=>v?ve(v,"tyre"):void 0,[v]),e=dt("pg"),{paged:y,per:b,limit:o,cap:u}=Kt({moreProducts:ze,perPage:Le,limit:Ie}),m=Yt(Oe,$e,Re),ne=Ae,ke=Vt(),We=qt(),je=ke||We,F=nr(E===!0&&!!c),s=p(()=>c?er(rr(c,T,F??w??[])):null,[w,F,c,T]),D=Gt("grid",s),l=s?D.scope:null,g=tr(c),C=g!==null&&!l,{filters:O,reportCount:U,reportLugs:k,reportSizes:W,reportFinishes:j,reportCategories:K,reportPrices:X,vehicle:ie}=At(),{currency:f}=_t(),Z=C&&!!O.process&&O.process!==g,q=l?.state,r=p(()=>s?q?Dt(s,q,f):C?Qt(s,O,f,ie.fit):s:null,[s,q,C,O,f,ie.fit]),[Ke,Xe]=pe(1),V=y&&r?Math.max(1,Math.ceil(r.length/b)):1,S=Math.min(V,Math.max(1,l?l.state.page:Ke)),{reportShown:Y}=D,se=l!==null;Bt(()=>{if(!se||!r)return Y(null);Y(Xt(r.length,{paged:y,per:b,cap:u},S))},[se,r,Y,y,S,b,u]);const Ze=n=>l?l.update({page:n}):Xe(n),a=p(()=>r&&(y?r.slice((S-1)*b,S*b):u?r.slice(0,Math.ceil(o)+jt):r),[y,u,o,r,S,b]);A(()=>(K(e,g===null?[]:[g]),()=>K(e,[])),[g,K,e]),A(()=>{if(C)return U(e,Z?0:r?.length??0),()=>U(e,0)},[C,Z,r,U,e]);const N=p(()=>({lugs:ar(s??[]),sizes:or(s??[]),finishes:sr(s??[]),prices:kt((s??[]).filter(n=>B(n)!=="tyre"),f)}),[s,f]);A(()=>(k(e,N.lugs),W(e,N.sizes),j(e,N.finishes),X(e,N.prices),()=>{k(e,[]),W(e,[]),j(e,[]),X(e,[])}),[N,k,W,j,X,e]);const J=pt("ProductGrid",Fe,"both",De),qe=`${e} grid${J.className} bg-[var(--catalog-grid-bg)] ${m}`,ae=gt(J),Ve=`${e} grid${ae.className} bg-[var(--catalog-grid-bg)] ${m}`,Ye=ae.style,Je=p(()=>{const n=(r??[]).filter(d=>B(d)!=="tyre");if(n.length===0)return!1;const h=n.some(d=>!!d.process);return n.some(d=>!!d.setWords)||St({kind:!1,brand:!1,process:h},H??[])},[r,H]),Qe=a?a.length>0?t("div",{className:Ve,style:Ye,children:t(ht,{items:a,tyreOf:n=>B(n)==="tyre"?n:null})}):l&&Ut(l.state)?x("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${be(Ce(c,T)).many} match those filters`}),t(Wt,{onClick:l.clear})]}):E?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:lr("No products in “{name}” yet",{name:c?.name??""})})}):null:t(Te,{className:qe,style:J.style,minEmptyHeight:320}),et=l?l.countInChips:Pe,$=r&&!et?r===s&&!F?Me??r.length:r.length:null,oe=be(Ce(c,T)),tt=M||G||_||P?x("div",{className:`${ir} sticky top-[var(--sf-header-h,88px)] z-30 mb-5 flex items-center justify-between gap-4 max-view-wide:flex-wrap max-view-wide:gap-y-2 border-b border-line bg-bg/95 py-3 backdrop-blur-md ${ne||je?"":"-mx-[var(--sf-site-gutter,40px)] px-[var(--sf-site-gutter,40px)] max-view-wide:-mx-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]"}`,children:[x("div",{className:"flex min-w-0 items-end gap-6 max-view-wide:flex-col max-view-wide:items-stretch max-view-wide:gap-3",children:[M&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,children:te(M)}),G&&t("h2",{className:`${cr(Ee)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,children:Jt(G,!1)})]}),(_||P||$!==null)&&x("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[_&&t("span",{className:`max-w-[340px] truncate font-display ${i.body} leading-[1.4] text-fg-dim max-view-wide:hidden view-wide:w-0 view-wide:grow view-wide:text-right`,children:te(_)}),P&&x(ut,{href:P.href,className:`inline-flex items-center gap-2 whitespace-nowrap font-mono ${i.labelLarge} uppercase tracking-[0.2em] text-fg-dim transition-colors hover:text-fg`,children:[te(P.text),t("span",{"aria-hidden":!0,children:"→"})]}),$!==null&&x("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:[$," ",$===1?oe.one:oe.many]})]})]}):null,R=Rt(Ne,It,{noTop:re}),{paddingTop:rt,...nt}=R.style,I=re?0:rt,it={...I===void 0?{}:{"--pg-pt":typeof I=="number"?`${I}px`:I},...nt},z=p(()=>{if(!a)return null;const n=a.map(h=>B(h)!=="tyre"&&bt(Ct(h))?2:1);return we(n,o)?fe(m,n,o):null},[a,m,o]),[st,at]=pe("");A(()=>{if(a)return;const n=document.querySelector(`.${e}`);if(!n)return;const h=()=>{const d=[...n.children].map(ce=>ce.classList.contains("col-span-2")&&!ce.querySelector(vt)?2:1);at(we(d,o)?he(e,fe(m,d,o,!1),d.length):"")};h();const ee=new MutationObserver(h);return ee.observe(n,{childList:!0}),()=>ee.disconnect()},[a,e,m,o]);const ot=z?z[0].tracks:a?u?Math.min(a.length,o):a.length:void 0,L=z?he(yt(e),z,a.length)+(u?ge(xe(e),o+1):"")+ue(xe(e),m,{limit:o,cards:a.length}):st,le=L?"":ue(e,m,{limit:o,cards:a?.length}),me=xt(e),de=x(mt,{children:[u&&!L&&t("style",{children:ge(e,o+1)}),L&&t("style",{children:L}),le&&t("style",{children:le}),me&&t("style",{children:me}),tt,Qe,y&&V>1&&t(Ht,{textSize:Ft.labelSmall,page:S,pageCount:V,onPage:Ze}),t(Mt,{editing:E})]});if(Z)return null;const Q=t(Zt,{rootRef:D.ref,attrs:C&&g!==null?{...R.attrs,[Lt]:g}:R.attrs,className:zt(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${Ot} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${$t}`,R),column:null,inAnyBox:!0,style:it,defaults:{"--pg-pt":"120px"},children:ne?t("div",{style:Et(Pt),children:de}):de}),lt=s?Q:E?t(Nt,{currency:f,children:Q}):t(Tt,{wheels:_e,currency:f,children:Q});return t(ft,{value:{ownerId:Ge,Template:He,hover:Be??dr,imageSizes:wt(m,ot),fieldUsage:H??ye,tyreFieldUsage:Ue??ye,reserveEyebrow:Je,editing:E===!0},children:lt})}export{Se as TITLE_SIZES,pr as default};
@@ -8,7 +8,7 @@ import type { CardPressTitle } from "efficient-web-builder/render/lib/document/c
8
8
  import type { SlotComponent } from "efficient-easel/blocks";
9
9
  export interface HeroPriceTemplateProps {
10
10
  nodeId?: string;
11
- priceTemplate?: SlotComponent;
11
+ priceTemplate: SlotComponent | undefined;
12
12
  optionTemplate?: SlotComponent;
13
13
  optionPressTitles?: readonly CardPressTitle[];
14
14
  }
@@ -1 +1 @@
1
- "use client";import{jsx as a,Fragment as h,jsxs as l}from"react/jsx-runtime";import ee from"next/link";import{BUY_ROW_CLASS as Ee}from"./buy-row.js";import{useEffect as te,useRef as Le,useState as Oe}from"react";import{useCart as Ce}from"./CartContext.js";import{useSiteTakesOrders as Ae}from"./SiteRecordContext.js";import Ie from"./EmailCaptureForm.js";import{useEnglish as M}from"./EnglishVariant.js";import $e from"./QuantityStepper.js";import{MarkedLabel as P,heroView as Me}from"./product-hero/hero-view.js";import Pe from"./ProductGallery.js";import{useRootIsDark as ze}from"efficient-shell/theme";import{useWishlist as He}from"./WishlistContext.js";import{useStockAlertSignup as Fe}from"./useStockAlertSignup.js";import{SPARE_WORDS as je,productCartLine as De}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as Be}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Ue}from"../lib/catalog/product-options.js";import{trackViewItem as Ve}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as Ge,DEFAULT_HERO_RATIO as We,DEFAULT_HERO_TEXT_ALIGN as qe,parseHeroLayout as Ke,parseHeroRatio as Xe,parseHeroTextAlign as Ye}from"../lib/sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as Qe,DEFAULT_HERO_IMAGE_FIT as Je}from"../lib/sections/hero-gallery.js";import{MAX_SPARES as Ze,UNITS_PER_SET as ae,formatPrice as le}from"../lib/commerce.js";import{formatSelectionPrice as et,setPriceLabel as tt}from"../lib/wheels/price-display.js";import{productIsDually as at,productIsTwoObjects as lt,setSuppressesRow as nt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ne}from"../lib/sections/content-cap-gutter.js";import{CardTemplateRows as re}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as rt}from"efficient-web-builder/render/components/SiteGutterFrame";import{BLOCK_ALIGN_TEXT as st}from"efficient-web-builder/format/lib/content/block-align";import{cardRow as it}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as ot}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as ct}from"../lib/content/hero-option-seed.js";import mt from"./card-pieces/CardPrice.js";import pt from"./card-pieces/CardBuyButton.js";import{HeroStateProvider as se}from"./card-pieces/ProductCardState.js";const dt=4e3;function ft(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ht=[{}],ut=.72;function gt(e){const n=e.trim().split(/\s+/).filter(Boolean);if(n.length===0)return;const o=n.map((i,s)=>i.length+(n.length>1&&s===n.length-1?1:0));return`calc(100cqi / ${(Math.max(...o)*ut).toFixed(2)})`}function bt({product:e,selection:n,onLightbox:o,editing:i=!1,pricePlacement:s="top",showVehicleFitment:d=!0,heroLayout:r=Ge,imageRatio:T=We,textAlign:oe=qe,showSpecTable:ce=!0,showPriceQuote:R=!0,galleryMode:me=Qe,imageFit:pe=Je,trustBullets:de,nodeId:z,priceTemplate:H,optionTemplate:fe,optionPressTitles:he}){const ue=M(),b=Ke(r),F=Ye(oe),S=Xe(T),ge=b==="imageRight"?`${100-S}fr ${S}fr`:`${S}fr ${100-S}fr`,{picked:be,pick:j,qty:D,setQty:xe,choice:v,setChoice:w,angleIdx:ve,setAngleIdx:ke,showValidation:Ne,setShowValidation:_,manualMode:B,vehicle:E,rows:U,facts:ye,part:u,outOfStock:V,offer:m,preOrder:L,canAddToCart:G,currency:x,price:f,set:W,msrpLabel:Se}=n,c=Me(e,n,i),O=at(e),we=lt(e),C=d?c.vehicle:null,Te=d?c.vehicleMemory:null,A=!ze({whenUnset:!0}),{warmCatalog:q}=Ce(),g=Ae();te(()=>{!i&&g&&q(e.kind)},[i,g,e.kind,q]);const K=U.filter(t=>!L||t.values.length>0),X=K.filter(t=>t.role==="resolves"),I=K.filter(t=>t.role==="describes"&&!nt(we,t.key)),Y=I.findIndex(t=>t.chosen===null),Q=(!C||!c.vehicleAnswersSpecs||n.fitmentSet)&&Ue(U,L)?Y===-1?I:I.slice(0,Y+1):[],Re=[...X,...Q];function _e(){return G?(_(!1),i?null:De(e,u,be,{choice:v,qty:D},{fitmentLabel:B?c.specCaption:E.appliedName?`For ${E.appliedName}`:"",fitmentKey:B?`manual|${c.specCaption}`:`vehicle|${ft(E.applied?.vehicle)}`})):(_(!0),window.setTimeout(()=>_(!1),dt),null)}const J={kind:"hero",msrpLabel:Se||null,amount:O?tt(f,x):et(f,x),unitLabel:f.priced?c.unitLabel:null,packBadge:f.setTotal!=null?`${m.quantityLabel}: ${le(W,x)}`:null,buy:{isSet:O,priced:f.priced,outOfStock:V,canAdd:G,totalLabel:f.setTotal!=null?le(W,x):null,lineToAdd:_e}},$=a(se,{value:J,children:H?a(re,{ownerId:z??"",ownerType:"ProductHero",Template:H,rows:ht,fallback:null,children:t=>t}):a(mt,{})}),k={nodeId:z??"",template:fe,pressTitles:he,editing:i},Z=Le(null);return te(()=>{i||Z.current===e.slug||(Z.current=e.slug,Ve({itemId:u?`${e.slug}|${u.id}`:e.slug,itemName:e.name,variant:c.metaValue,pricePerSet:f.setTotal??f.fromSetTotal??0,currency:x}))},[i,e.slug,e.name,c.metaValue,u,f,x]),l(h,{children:[a("nav",{className:`border-b border-line ${ne} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,style:A?void 0:{background:"var(--section-bg)"},children:e.crumbs.map((t,p)=>l("span",{children:[p>0&&l(h,{children:[a("span",{className:"mx-3 text-accent",children:"/"}),a("wbr",{})]}),t.href?a(ee,{href:t.href,className:"hover:text-fg",children:a(P,{text:t.label})}):a("span",{className:"text-fg",children:a(P,{text:t.label})})]},`${t.label}-${p}`))}),l("section",{"data-hero-layout":b,"data-hero-align":F,className:[`grid gap-10 ${ne} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8`,b==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]"].join(" "),style:{...A?{}:{background:"var(--section-bg)"},...b==="stacked"?{}:{"--hero-cols":ge}},children:[a(Pe,{product:e,view:c,angleIdx:ve,onSelect:ke,isLight:A,onLightbox:o,galleryMode:me,imageFit:pe,style:b==="imageRight"?{order:2}:void 0}),l("div",{className:["flex flex-col gap-7",F==="center"?`items-center ${st.center}`:""].filter(Boolean).join(" "),style:b==="imageRight"?{order:1}:void 0,children:[l("div",{className:"w-full [container-type:inline-size]",children:[l("div",{className:"mb-2.5 flex items-center gap-2.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-accent",children:[a("span",{children:a(P,{text:e.eyebrow})}),e.badge&&l(h,{children:[a("span",{children:"·"}),a("span",{children:e.badge})]})]}),a("h1",{className:"font-heading2 text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]",style:{"--hero-name-fit":gt(c.heading)},children:(()=>{const t=c.heading.lastIndexOf(" ");if(t===-1)return c.heading;const p=c.heading.slice(0,t),N=c.heading.slice(t+1);return l(h,{children:[p," ",l("em",{className:"font-normal italic text-accent",children:[N,"."]})]})})()})]}),s!=="belowSpecs"&&R&&$,Te,X.map(t=>a(ie,{row:t,onPick:j,options:k},t.key)),L&&c.preOrder?l(h,{children:[s==="belowSpecs"&&R&&$,c.preOrder]}):l(h,{children:[C,Q.map(t=>a(ie,{row:t,onPick:j,options:k},t.key)),ce&&a(xt,{facts:ye}),(m.packs.length>0||g&&(m.extra||m.spareCounts.length>0))&&l("div",{className:"border-b border-line pb-[26px]",children:[m.packs.length>0&&l(h,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:k,values:m.packs,item:t=>({label:t.label}),picked:t=>v.unit===t.value,press:t=>()=>w(p=>({...p,unit:t.value}))})})]}),g&&m.extra&&l("label",{className:`${m.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[a("input",{type:"checkbox",checked:v.spares>0,onChange:t=>w(p=>({...p,spares:t.target.checked?Ze:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),m.extra.label]}),g&&m.spareCounts.length>0&&l(h,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:je.howMany}),a("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:a(y,{hero:k,values:m.spareCounts,item:t=>({label:`${t.value} · ${t.label}`}),picked:t=>v.spares===t.value-ae,press:t=>()=>w(p=>({...p,spares:t.value-ae}))})})]}),g&&m.spareSide&&l(h,{children:[a("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:m.spareSide.label}),a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:k,values:m.spareSide.options,item:t=>({label:t.label}),picked:t=>v.spareSide===t.value,press:t=>()=>w(p=>({...p,spareSide:t.value}))})})]})]}),s==="belowSpecs"&&R&&$,l("div",{className:Ee,children:[g&&!(O&&!f.priced)&&a($e,{value:D,onChange:xe,size:"large"}),a(se,{value:J,children:a(pt,{})}),a(vt,{slug:e.slug,name:e.name})]}),V&&u&&a(kt,{partNumbers:u.components.map(t=>t.partNumber),productSlug:e.slug},u.id),Ne&&(()=>{const t=Re.filter(N=>N.chosen===null).map(N=>ue(N.prompt).replace(/^Select\s+/i,""));if(C&&c.vehicleAnswersSpecs&&!n.fitmentSet&&t.push("vehicle fitment"),t.length===0)return null;const p=t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`;return l("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",p," first."]})})()]}),de]})]})]})}function xt({facts:e}){const n=M();return e.length===0?null:a("div",{className:"border-b border-line pb-[26px]",children:a("dl",{className:"flex flex-col gap-2",children:e.map(o=>l("div",{className:"flex flex-wrap items-baseline gap-x-2 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.22em]",children:[l("dt",{className:"text-fg-dim",children:[n(o.label)," ·"]}),a("dd",{className:"font-semibold text-fg",children:o.value.label})]},o.key))})})}function ie({row:e,onPick:n,options:o}){const i=M();if(e.values.length===0&&!e.empty)return null;const s=e.values.find(r=>r.value===e.chosen),d=s&&[s.label,s.note].filter(Boolean).join(" · ");return l("div",{className:"border-b border-line pb-[26px]",[Be]:e.key,children:[l("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[i(e.label)," · ",a("span",{className:"text-accent",children:d??i(e.prompt)})]}),e.values.length===0?l("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",a(ee,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?a("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:a(y,{hero:o,values:e.values,item:r=>({swatch:r.swatch??"",name:r.label}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})}):a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:o,values:e.values,item:r=>({label:r.label,note:r.note??""}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})})]})}function y({hero:e,values:n,item:o,picked:i,press:s}){const d=ot(n,{item:o,selected:i,press:s});return a(rt,{children:a(re,{ownerId:e.nodeId,ownerType:"ProductHero",slot:ct,Template:e.template,rows:d.items.map(it),items:d.items,states:d.states,actions:e.editing?void 0:d.actions,pressTitles:e.pressTitles,fallback:null,children:r=>r})})}function vt({slug:e,name:n}){const{has:o,toggle:i}=He(),s=o(e);return a("button",{type:"button",title:s?"Saved":"Save","aria-label":s?`Remove ${n} from wishlist`:`Save ${n} to wishlist`,"aria-pressed":s,onClick:()=>i(e),className:["h-12 w-12 cursor-pointer border-2 bg-transparent transition-colors",s?"border-accent text-accent":"border-fg-dim/50 text-fg hover:border-accent hover:text-accent"].join(" "),children:s?"♥":"♡"})}function kt({partNumbers:e,productSlug:n}){const[o,i]=Oe(""),{status:s,submit:d,reset:r}=Fe();function T(){d({partNumbers:e,email:o,productSlug:n})}return s==="sent"?a("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):a(Ie,{className:"-mt-1",email:o,onEmailChange:i,status:s,onResetVerdict:r,onSubmit:T,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{bt as default};
1
+ "use client";import{jsx as a,Fragment as u,jsxs as l}from"react/jsx-runtime";import Z from"next/link";import{BUY_ROW_CLASS as Oe}from"./buy-row.js";import{useEffect as ee,useRef as Re,useState as Ee}from"react";import{useCart as Ae}from"./CartContext.js";import{useSiteTakesOrders as Ce}from"./SiteRecordContext.js";import Ie from"./EmailCaptureForm.js";import{useEnglish as te}from"./EnglishVariant.js";import{MarkedLabel as P,heroView as $e}from"./product-hero/hero-view.js";import Me from"./ProductGallery.js";import{useRootIsDark as Pe}from"efficient-shell/theme";import{useStockAlertSignup as He}from"./useStockAlertSignup.js";import{SPARE_WORDS as ze,productCartLine as Be}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as De}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Fe}from"../lib/catalog/product-options.js";import{trackViewItem as je}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as Ue,DEFAULT_HERO_RATIO as Ge,DEFAULT_HERO_TEXT_ALIGN as Ve,parseHeroLayout as We,parseHeroRatio as Xe,parseHeroTextAlign as Ke}from"../lib/sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as qe,DEFAULT_HERO_IMAGE_FIT as Ye}from"../lib/sections/hero-gallery.js";import{MAX_SPARES as Qe,UNITS_PER_SET as ae,formatPrice as le}from"../lib/commerce.js";import{formatSelectionPrice as Je,setPriceLabel as Ze}from"../lib/wheels/price-display.js";import{productIsDually as et,productIsTwoObjects as tt,setSuppressesRow as at}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ne}from"../lib/sections/content-cap-gutter.js";import{CardTemplateRows as re}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as lt}from"efficient-web-builder/render/components/SiteGutterFrame";import{BLOCK_ALIGN_BOX_WORD as nt,BLOCK_ALIGN_TEXT as rt}from"efficient-web-builder/format/lib/content/block-align";import{BOX_ALIGN_CLASS as st}from"efficient-web-builder/format/lib/content/box-layout";import{cardRow as it}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as ot}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as ct}from"../lib/content/hero-option-seed.js";import mt from"./card-pieces/CardBuyButton.js";import pt from"./card-pieces/CardQuantity.js";import dt from"./card-pieces/CardSave.js";import ft from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as H}from"./card-pieces/ProductCardState.js";const ut=4e3;function ht(t){return t?[t.year,t.make,t.model,t.modification].join("-"):""}const gt=[{}],bt=.72;function xt(t){const s=t.trim().split(/\s+/).filter(Boolean);if(s.length===0)return;const p=s.map((i,o)=>i.length+(s.length>1&&o===s.length-1?1:0));return`calc(100cqi / ${(Math.max(...p)*bt).toFixed(2)})`}function vt({product:t,selection:s,onLightbox:p,editing:i=!1,pricePlacement:o="top",showVehicleFitment:d=!0,heroLayout:n=Ue,imageRatio:_=Ge,textAlign:ie=Ve,showSpecTable:oe=!0,showPriceQuote:w=!0,galleryMode:ce=qe,imageFit:me=Ye,trustBullets:pe,nodeId:z,priceTemplate:de,optionTemplate:fe,optionPressTitles:ue}){const he=te(),b=We(n),B=Ke(ie),S=Xe(_),ge=b==="imageRight"?`${100-S}fr ${S}fr`:`${S}fr ${100-S}fr`,{picked:be,pick:D,qty:F,setQty:xe,choice:v,setChoice:T,angleIdx:ve,setAngleIdx:ke,showValidation:ye,setShowValidation:L,manualMode:j,vehicle:O,rows:U,facts:Ne,part:h,outOfStock:G,offer:c,preOrder:R,canAddToCart:V,currency:x,price:f,set:W,msrpLabel:Se}=s,r=$e(t,s,i),E=et(t),Te=tt(t),A=d?r.vehicle:null,_e=d?r.vehicleMemory:null,C=!Pe({whenUnset:!0}),{warmCatalog:X}=Ae(),g=Ce();ee(()=>{!i&&g&&X(t.kind,t.slug)},[i,g,t.kind,t.slug,X]);const K=U.filter(e=>!R||e.values.length>0),q=K.filter(e=>e.role==="resolves"),I=K.filter(e=>e.role==="describes"&&!at(Te,e.key)),Y=I.findIndex(e=>e.chosen===null),Q=(!A||!r.vehicleAnswersSpecs||s.fitmentSet)&&Fe(U,R)?Y===-1?I:I.slice(0,Y+1):[],we=[...q,...Q];function Le(){return V?(L(!1),i?null:Be(t,h,be,{choice:v,qty:F},{fitmentLabel:j?r.specCaption:O.appliedName?`For ${O.appliedName}`:"",fitmentKey:j?`manual|${r.specCaption}`:`vehicle|${ht(O.applied?.vehicle)}`})):(L(!0),window.setTimeout(()=>L(!1),ut),null)}const $={kind:"hero",msrpLabel:Se||null,amount:E?Ze(f,x):Je(f,x),unitLabel:f.priced?r.unitLabel:null,packBadge:f.setTotal!=null?`${c.quantityLabel}: ${le(W,x)}`:null,buy:{isSet:E,priced:f.priced,outOfStock:G,canAdd:V,totalLabel:f.setTotal!=null?le(W,x):null,lineToAdd:Le},qty:F,setQty:xe,takesQty:g&&!(E&&!f.priced),save:{slug:t.slug,name:t.name},facts:oe?Ne:null},M=a(H,{value:$,children:a(re,{ownerId:z??"",ownerType:"ProductHero",Template:de,rows:gt,fallback:null,children:e=>e})}),k={nodeId:z??"",template:fe,pressTitles:ue,editing:i},J=Re(null);return ee(()=>{i||J.current===t.slug||(J.current=t.slug,je({itemId:h?`${t.slug}|${h.id}`:t.slug,itemName:t.name,variant:r.metaValue,pricePerSet:f.setTotal??f.fromSetTotal??0,currency:x}))},[i,t.slug,t.name,r.metaValue,h,f,x]),l(u,{children:[a("nav",{className:`border-b border-line ${ne} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,style:C?void 0:{background:"var(--section-bg)"},children:t.crumbs.map((e,m)=>l("span",{children:[m>0&&l(u,{children:[a("span",{className:"mx-3 text-accent",children:"/"}),a("wbr",{})]}),e.href?a(Z,{href:e.href,className:"hover:text-fg",children:a(P,{text:e.label})}):a("span",{className:"text-fg",children:a(P,{text:e.label})})]},`${e.label}-${m}`))}),l("section",{"data-hero-layout":b,"data-hero-align":B,className:[`grid gap-10 ${ne} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8`,b==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]"].join(" "),style:{...C?{}:{background:"var(--section-bg)"},...b==="stacked"?{}:{"--hero-cols":ge}},children:[a(Me,{product:t,view:r,angleIdx:ve,onSelect:ke,isLight:C,onLightbox:p,galleryMode:ce,imageFit:me,style:b==="imageRight"?{order:2}:void 0}),l("div",{className:["flex flex-col gap-7",B==="center"?`${st[nt.center]} ${rt.center}`:""].filter(Boolean).join(" "),style:b==="imageRight"?{order:1}:void 0,children:[l("div",{className:"w-full [container-type:inline-size]",children:[l("div",{className:"mb-2.5 flex items-center gap-2.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-accent",children:[a("span",{children:a(P,{text:t.eyebrow})}),t.badge&&l(u,{children:[a("span",{children:"·"}),a("span",{children:t.badge})]})]}),a("h1",{className:"font-heading2 text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]",style:{"--hero-name-fit":xt(r.heading)},children:(()=>{const e=r.heading.lastIndexOf(" ");if(e===-1)return r.heading;const m=r.heading.slice(0,e),y=r.heading.slice(e+1);return l(u,{children:[m," ",l("em",{className:"font-normal italic text-accent",children:[y,"."]})]})})()})]}),o!=="belowSpecs"&&w&&M,_e,q.map(e=>a(se,{row:e,onPick:D,options:k},e.key)),R&&r.preOrder?l(u,{children:[o==="belowSpecs"&&w&&M,r.preOrder]}):l(u,{children:[A,Q.map(e=>a(se,{row:e,onPick:D,options:k},e.key)),a(H,{value:$,children:a(ft,{})}),(c.packs.length>0||g&&(c.extra||c.spareCounts.length>0))&&l("div",{className:"border-b border-line pb-[26px]",children:[c.packs.length>0&&l(u,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),a("div",{className:"flex flex-wrap gap-1.5",children:a(N,{hero:k,values:c.packs,item:e=>({label:e.label}),picked:e=>v.unit===e.value,press:e=>()=>T(m=>({...m,unit:e.value}))})})]}),g&&c.extra&&l("label",{className:`${c.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[a("input",{type:"checkbox",checked:v.spares>0,onChange:e=>T(m=>({...m,spares:e.target.checked?Qe:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),c.extra.label]}),g&&c.spareCounts.length>0&&l(u,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:ze.howMany}),a("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:a(N,{hero:k,values:c.spareCounts,item:e=>({label:`${e.value} · ${e.label}`}),picked:e=>v.spares===e.value-ae,press:e=>()=>T(m=>({...m,spares:e.value-ae}))})})]}),g&&c.spareSide&&l(u,{children:[a("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:c.spareSide.label}),a("div",{className:"flex flex-wrap gap-1.5",children:a(N,{hero:k,values:c.spareSide.options,item:e=>({label:e.label}),picked:e=>v.spareSide===e.value,press:e=>()=>T(m=>({...m,spareSide:e.value}))})})]})]}),o==="belowSpecs"&&w&&M,a("div",{className:Oe,children:l(H,{value:$,children:[a(pt,{}),a(mt,{}),a(dt,{})]})}),G&&h&&a(kt,{partNumbers:h.components.map(e=>e.partNumber),productSlug:t.slug},h.id),ye&&(()=>{const e=we.filter(y=>y.chosen===null).map(y=>he(y.prompt).replace(/^Select\s+/i,""));if(A&&r.vehicleAnswersSpecs&&!s.fitmentSet&&e.push("vehicle fitment"),e.length===0)return null;const m=e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e.at(-1)}`;return l("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",m," first."]})})()]}),pe]})]})]})}function se({row:t,onPick:s,options:p}){const i=te();if(t.values.length===0&&!t.empty)return null;const o=t.values.find(n=>n.value===t.chosen),d=o&&[o.label,o.note].filter(Boolean).join(" · ");return l("div",{className:"border-b border-line pb-[26px]",[De]:t.key,children:[l("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[i(t.label)," · ",a("span",{className:"text-accent",children:d??i(t.prompt)})]}),t.values.length===0?l("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[t.empty.text," ",a(Z,{href:t.empty.href,className:"text-accent hover:underline",children:t.empty.linkText})]}):t.display==="swatch"?a("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:a(N,{hero:p,values:t.values,item:n=>({swatch:n.swatch??"",name:n.label}),picked:n=>n.value===t.chosen,press:n=>()=>s(t.key,n.value)})}):a("div",{className:"flex flex-wrap gap-1.5",children:a(N,{hero:p,values:t.values,item:n=>({label:n.label,note:n.note??""}),picked:n=>n.value===t.chosen,press:n=>()=>s(t.key,n.value)})})]})}function N({hero:t,values:s,item:p,picked:i,press:o}){const d=ot(s,{item:p,selected:i,press:o});return a(lt,{children:a(re,{ownerId:t.nodeId,ownerType:"ProductHero",slot:ct,Template:t.template,rows:d.items.map(it),items:d.items,states:d.states,actions:t.editing?void 0:d.actions,pressTitles:t.pressTitles,fallback:null,children:n=>n})})}function kt({partNumbers:t,productSlug:s}){const[p,i]=Ee(""),{status:o,submit:d,reset:n}=He();function _(){d({partNumbers:t,email:p,productSlug:s})}return o==="sent"?a("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):a(Ie,{className:"-mt-1",email:p,onEmailChange:i,status:o,onResetVerdict:n,onSubmit:_,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{vt as default};
@@ -0,0 +1,25 @@
1
+ import { type FormEvent } from "react";
2
+ import { type SignUpTrouble } from "../lib/sections/sign-up.js";
3
+ interface SignUpFindProps {
4
+ product: string;
5
+ productName: string;
6
+ startHref: string;
7
+ inert?: boolean;
8
+ }
9
+ type FindStage = "form" | "sent" | "opening";
10
+ export default function SignUpFind({ product, productName, startHref, inert }: SignUpFindProps): import("react").JSX.Element;
11
+ interface SignUpFindViewProps {
12
+ stage: FindStage;
13
+ productName: string;
14
+ startHref: string;
15
+ email: string;
16
+ wrong?: string | null;
17
+ trouble?: SignUpTrouble | null;
18
+ linkGone?: boolean;
19
+ busy?: boolean;
20
+ onEmail?: (value: string) => void;
21
+ onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
22
+ onAnother?: () => void;
23
+ }
24
+ export declare function SignUpFindView({ stage, productName, startHref, email, wrong, trouble, linkGone, busy, onEmail, onSubmit, onAnother, }: SignUpFindViewProps): import("react").JSX.Element;
25
+ export {};
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,jsxs as h}from"react/jsx-runtime";import D from"next/link";import{usePathname as I}from"next/navigation";import{useEffect as T,useId as j,useState as o}from"react";import{ApiError as A,askForWorkspaces as G,openWorkspaceFind as _}from"../lib/api/index.js";import{BANNER as W,CARD as $,PRIMARY as C,QUIET as b,TITLE as w}from"../lib/sections/sign-up-look.js";import{FIND_WORDS as t,SIGN_UP_WORDS as v,checkWaitingEmail as L,fill as O,findTokenOf as U,readFindRefusal as B}from"../lib/sections/sign-up.js";function P({product:d,productName:x,startHref:f,inert:c=!1}){const n=c?"":U(I()),[p,r]=o(n?"opening":"form"),[i,N]=o(""),[g,m]=o(null),[s,l]=o(null),[k,y]=o(!1),[E,R]=o(!1);return T(()=>{if(!n)return;let a=!1;return _(n).then(u=>{a||(u?window.location.assign(u):(y(!0),r("form")))}).catch(()=>{a||(y(!0),r("form"))}),()=>{a=!0}},[n]),e(V,{stage:p,productName:x,startHref:f,email:i,wrong:g,trouble:s,linkGone:k,busy:E,onEmail:a=>{N(a),m(null),l(null)},onSubmit:async a=>{if(a.preventDefault(),c||E)return;const u=L(i);if(m(u),l(null),!u){R(!0);try{await G(d,i),y(!1),r("sent")}catch(S){const F=S instanceof A?B(S.status,S.data):{email:null,trouble:"failed"};m(F.email),l(F.trouble)}finally{R(!1)}}},onAnother:()=>r("form")})}function V({stage:d,productName:x,startHref:f,email:c,wrong:n,trouble:p,linkGone:r=!1,busy:i=!1,onEmail:N,onSubmit:g,onAnother:m}){const s=j();if(d==="opening")return e("div",{className:$,role:"status",children:e("p",{className:b,children:t.opening})});if(d==="sent"){const[l,k]=t.sentBody.split("{email}");return h("div",{className:$,children:[e("h2",{className:w,children:t.sentTitle}),h("p",{className:"mt-[10px]",children:[l,e("span",{className:"font-medium",children:c.trim()}),k]}),e("p",{className:`${b} mt-[10px]`,children:t.sentNote}),e("button",{type:"button",onClick:m,className:"mt-[18px] flex h-11 w-full cursor-pointer items-center justify-center rounded-[10px] border border-line font-medium text-fg",children:t.another})]})}return h("form",{noValidate:!0,onSubmit:g,className:$,children:[e("h2",{className:w,children:t.title}),r?e("p",{role:"alert",className:`${W} mt-[10px]`,children:t.linkGone}):e("p",{className:`${b} mt-1`,children:t.intro}),e("label",{htmlFor:`${s}-email`,className:"mb-1 mt-3 block text-[13px] font-medium",children:v.email}),e("div",{className:`flex h-11 items-center rounded-[10px] border bg-bg px-3 ${n?"border-alert":"border-line focus-within:border-accent"}`,children:e("input",{id:`${s}-email`,name:"email",type:"email",autoComplete:"email",maxLength:254,value:c,"aria-invalid":n?!0:void 0,"aria-describedby":n?`${s}-email-said`:void 0,onChange:l=>N?.(l.target.value),className:"h-full w-full bg-transparent text-[14px] text-fg outline-none focus-visible:outline-none!"})}),n&&e("p",{id:`${s}-email-said`,role:"alert",className:"mt-1 text-[13px] text-alert",children:n}),p&&e("p",{role:"alert",className:W,children:v.trouble[p]}),e("button",{type:"submit",disabled:i,className:C,children:i?v.sending:t.submit}),f&&h("p",{className:`${b} mt-3 text-center`,children:[O(t.newHere,{name:x})," ",e(D,{href:f,className:"text-accent",children:t.create})]})]})}export{V as SignUpFindView,P as default};
@@ -0,0 +1,13 @@
1
+ import { type LinkState } from "../lib/sections/sign-up.js";
2
+ interface SignUpLinkProps {
3
+ token: string;
4
+ productName: string;
5
+ suffix: string;
6
+ startHref: string;
7
+ findHref: string;
8
+ }
9
+ export default function SignUpLink({ token, productName, suffix, startHref, findHref }: SignUpLinkProps): import("react").JSX.Element;
10
+ export declare function SignUpLinkView({ state, productName, suffix, startHref, findHref, }: Omit<SignUpLinkProps, "token"> & {
11
+ state: LinkState | null;
12
+ }): import("react").JSX.Element;
13
+ export {};
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,jsxs as s}from"react/jsx-runtime";import b from"next/link";import{useEffect as A,useState as y}from"react";import{openSignUpLink as L}from"../lib/api/index.js";import{BANNER as f,CARD as r,PRIMARY as R,QUIET as p,TITLE as c}from"../lib/sections/sign-up-look.js";import{LINK_ASKS_AT_MOST as _,LINK_WORDS as n,SIGN_UP_WORDS as d,buildProgress as w,buildSteps as B,fill as h,linkAskAfterMs as U,linkAsksAgain as I}from"../lib/sections/sign-up.js";function O({token:a,productName:m,suffix:o,startHref:N,findHref:u}){const[t,l]=y(null),[i,v]=y(0);return A(()=>{let x=!1;const k=t!==null;if(k&&(!I(t)||i>=_))return;const $=window.setTimeout(()=>{L(a).then(S=>{x||(l(S),v(T=>T+1))}).catch(()=>{x||l({kind:"trouble",trouble:"failed"})})},k?U(i):0);return()=>{x=!0,window.clearTimeout($)}},[a,i]),e(j,{state:t,productName:m,suffix:o,startHref:N,findHref:u})}const g={done:{sign:"✓",tone:"text-green",spin:!1},running:{sign:"◌",tone:"text-accent",spin:!0},waiting:{sign:"○",tone:"text-fg-dim",spin:!1},stopped:{sign:"!",tone:"text-alert",spin:!1}};function j({state:a,productName:m,suffix:o,startHref:N,findHref:u}){const t=l=>e(b,{href:N,className:R,children:l});if(a===null)return e("div",{className:r,role:"status",children:e("p",{className:p,children:n.checking})});switch(a.kind){case"building":case"failed":{const l=B(a,m,o);return s("div",{className:r,children:[e("h2",{className:c,children:h(n.settingUp,{company:a.company})}),a.kind==="building"&&e("div",{role:"progressbar","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":w(a.status),"aria-label":h(n.settingUp,{company:a.company}),className:"mb-[10px] mt-[14px] h-[6px] rounded-[3px] bg-line",children:e("div",{className:"h-[6px] rounded-[3px] bg-accent transition-[width] duration-500",style:{width:`${w(a.status)}%`}})}),e("ul",{className:a.kind==="failed"?"mt-2":void 0,children:l.map(i=>s("li",{className:"flex items-center gap-[10px] py-[7px]",children:[e("span",{"aria-hidden":!0,className:`inline-block w-5 text-center text-[18px] leading-none ${g[i.at].tone} ${g[i.at].spin?"animate-spin":""}`,children:g[i.at].sign}),e("span",{children:i.words})]},i.words))}),a.kind==="failed"?e("p",{role:"alert",className:f,children:n.failedBody}):e("p",{role:"status",className:`${p} mt-3`,children:n.aboutTen})]})}case"ready":return s("div",{className:r,children:[e("span",{"aria-hidden":!0,className:"block text-[28px] leading-none text-green",children:"✓"}),e("h2",{className:`${c} mt-[6px]`,children:n.readyTitle}),e("dl",{className:"mt-[10px]",children:[[n.workspace,a.company],[n.address,`${a.slug}${o}`],[n.plan,h(n.planName,{name:m})]].map(([l,i])=>s("div",{className:"flex border-b border-line py-2",children:[e("dt",{className:`${p} w-24 shrink-0`,children:l}),e("dd",{className:"min-w-0 break-words font-medium",children:i})]},l))}),e("p",{className:"mt-[14px]",children:n.readyNext})]});case"taken":return s("div",{className:r,children:[e("h2",{className:c,children:n.takenTitle}),e("p",{className:"mt-[6px]",children:a.slug?h(n.takenBody,{address:`${a.slug}${o}`}):n.takenBodyBare}),t(n.chooseAnother)]});case"dailyLimit":return s("div",{className:r,children:[e("h2",{className:c,children:n.limitTitle}),e("p",{role:"alert",className:`${f} mt-1`,children:d.trouble.dailyLimit}),e("p",{className:`${p} mt-2`,children:n.limitNext})]});case"closed":return s("div",{className:r,children:[e("h2",{className:c,children:d.closedTitle}),e("p",{className:"mt-1",children:h(d.closedBody,{name:m})}),u&&s("p",{className:`${p} mt-[10px] text-center`,children:[d.haveOne," ",e(b,{href:u,className:"text-accent",children:d.find})]})]});case"trouble":return e("div",{className:r,children:e("p",{role:"alert",className:`${f} mt-0`,children:d.trouble[a.trouble]})});default:return s("div",{className:r,children:[e("h2",{className:c,children:n.goneTitle}),e("p",{className:"mt-[6px]",children:n.goneBody}),t(n.again)]})}}export{j as SignUpLinkView,O as default};
@@ -0,0 +1,47 @@
1
+ import { type FormEvent } from "react";
2
+ import { type SignUpDraft, type SignUpField, type SignUpSent, type SignUpTrouble, type SlugCheck } from "../lib/sections/sign-up.js";
3
+ export interface SignUpProps {
4
+ mode?: "create" | "find";
5
+ product: string;
6
+ productName: string;
7
+ freeLine: string;
8
+ zone?: string;
9
+ askCountry: boolean;
10
+ termsHref: string;
11
+ privacyHref: string;
12
+ findHref: string;
13
+ contained: boolean;
14
+ sample?: SignUpDraft;
15
+ }
16
+ type Stage = "form" | "sent" | "closed";
17
+ export default function SignUp(props: SignUpProps): import("react").JSX.Element;
18
+ interface SignUpViewProps {
19
+ stage: Stage;
20
+ product?: string;
21
+ onOpen?: () => void;
22
+ productName: string;
23
+ freeLine: string;
24
+ suffix: string;
25
+ askCountry: boolean;
26
+ termsHref: string;
27
+ privacyHref: string;
28
+ findHref: string;
29
+ draft: SignUpDraft;
30
+ wrong: Partial<Record<SignUpField, string>>;
31
+ slug: SlugCheck;
32
+ trouble: SignUpTrouble | null;
33
+ busy?: boolean;
34
+ sent: SignUpSent | null;
35
+ resent?: boolean;
36
+ locale?: string;
37
+ timeZone?: string;
38
+ onChange?: (next: Partial<SignUpDraft>) => void;
39
+ onCompany?: (value: string) => void;
40
+ onSlug?: (value: string) => void;
41
+ onCountry?: (value: string) => void;
42
+ onSubmit?: (event: FormEvent<HTMLFormElement>) => void;
43
+ onAgain?: () => void;
44
+ onEdit?: () => void;
45
+ }
46
+ export declare function SignUpView(props: SignUpViewProps): import("react").JSX.Element;
47
+ export {};
@@ -0,0 +1 @@
1
+ "use client";import{jsx as e,jsxs as x,Fragment as K}from"react/jsx-runtime";import le from"next/link";import{usePathname as ce}from"next/navigation";import{useEffect as P,useId as Z,useMemo as ee,useRef as oe,useState as m}from"react";import Q from"efficient-web-builder/render/components/BlockFrame";import{ApiError as ne,askToSignUp as ue,fetchSignUpAvailability as te,joinSignUpWaitingList as de}from"../lib/api/index.js";import me from"./SignUpFind.js";import fe from"./SignUpLink.js";import{BANNER as X,CARD as q,PRIMARY as re,QUIET as E,TITLE as z}from"../lib/sections/sign-up-look.js";import{ROW_INPUT_CLASS as he}from"../lib/field-input.js";import{COUNTRY_CURRENCY as pe}from"../lib/sections/sign-up-catalogue.js";import{CHECK_AFTER_MS as ge,EMPTY_DRAFT as be,SIGN_UP_WORDS as n,addressSuffix as ae,checkDraft as Ne,checkWaitingEmail as ye,countryChoices as xe,currencyChoices as ve,fill as D,linkEnds as $e,linkTokenOf as Se,normaliseSlug as ke,readSignUpRefusal as Ce,readWaitingRefusal as Ue,signUpBody as Re,slugCheckOf as Te,slugFromName as Ae}from"../lib/sections/sign-up.js";function Ee(t){return t.mode==="find"?e(Q,{contained:t.contained,className:"py-6",children:e(me,{product:t.product,productName:t.productName,startHref:"/start",inert:!!t.sample})}):e(Oe,{...t})}function Oe({product:t,productName:a,freeLine:l,zone:i,askCountry:o,termsHref:u,privacyHref:c,findHref:s,contained:y,sample:p}){const[g,f]=m(p??be),[U,R]=m(!1),[B,O]=m({}),[T,S]=m(null),[b,h]=m("form"),[G,H]=m(null),[F,L]=m(!1),[_,j]=m(!1),[A,W]=m(()=>ae(i,"")),r=Se(ce()),k=!!r&&!p,w=_e(t,g.slug,!!p||k);P(()=>{W(ae(i,window.location.hostname))},[i]),P(()=>{if(p||k)return;let d=!1;return te(t).then(N=>{d||(N.open||h("closed"),f(v=>({...v,country:v.country||N.country,currency:v.currency||N.currency})))}).catch(()=>{}),()=>{d=!0}},[t,p,k]);const C=d=>{f(N=>({...N,...d})),O(N=>{const v={...N};for(const se of Object.keys(d))delete v[se];return v}),S(null)},$=async d=>{L(!0),S(null);try{H(await ue(Re(g,t,o))),j(d),h("sent")}catch(N){const v=N instanceof ne?Ce(N.status,N.data):{fields:{},trouble:"failed"};v.trouble==="closed"?h("closed"):Object.keys(v.fields).length?(O(v.fields),h("form")):S(v.trouble)}finally{L(!1)}},I=d=>{if(d.preventDefault(),p||F)return;const N=Ne(g,w);O(N),!Object.keys(N).length&&$(!1)};return k?e(Q,{contained:y,className:"py-6",children:e(fe,{token:r,productName:a,suffix:A,startHref:"/start",findHref:s})}):e(Q,{contained:y,className:"py-6",children:e(we,{stage:b,product:t,onOpen:()=>h("form"),productName:a,freeLine:l,suffix:A,askCountry:o,termsHref:u,privacyHref:c,findHref:s,draft:g,wrong:B,slug:w,trouble:T,busy:F,sent:G,resent:_,onChange:C,onCompany:d=>C(U?{company:d}:{company:d,slug:Ae(d)}),onSlug:d=>{R(!0),C({slug:ke(d)})},onCountry:d=>C({country:d,currency:pe[d]??g.currency}),onSubmit:I,onAgain:()=>{$(!0)},onEdit:()=>{R(!0),S(null),h("form")}})})}function _e(t,a,l){const[i,o]=m({slug:"",found:{state:"empty"}}),u=oe("");return P(()=>{if(l||!a)return;u.current=a;const c=window.setTimeout(()=>{te(t,a).then(s=>{u.current===a&&o({slug:a,found:Te(s)})}).catch(()=>{u.current===a&&o({slug:a,found:{state:"unknown"}})})},ge);return()=>window.clearTimeout(c)},[t,a,l]),l?{state:"available"}:a?i.slug===a?i.found:{state:"checking"}:{state:"empty"}}const M="flex h-11 items-center rounded-[10px] border bg-bg px-3",J="h-full w-full bg-transparent text-[14px] text-fg outline-none focus-visible:outline-none! placeholder:text-fg-dim",ie="flex h-11 w-full cursor-pointer items-center justify-center rounded-[10px] border font-medium text-fg disabled:cursor-wait disabled:opacity-60";function we(t){const{stage:a,productName:l,findHref:i,trouble:o}=t,u=i?x("p",{className:`${E} mt-[10px] text-center`,children:[n.haveOne," ",e(le,{href:i,className:"text-accent",children:n.find})]}):null;return a==="closed"?e(De,{...t,children:u}):a==="sent"?e(Fe,{...t}):e(Be,{...t,trouble:o,children:u})}function Y({id:t,label:a,error:l,hint:i,children:o}){return x("div",{className:"min-w-0",children:[e("label",{htmlFor:t,className:"mb-1 mt-3 block text-[13px] font-medium",children:a}),o,l?e("p",{id:`${t}-said`,role:"alert",className:"mt-1 text-[13px] text-alert",children:l}):i&&e("p",{id:`${t}-said`,className:"mt-1 text-[13px]",children:i})]})}const V=t=>t?"border-alert":"border-line focus-within:border-accent";function Be({productName:t,freeLine:a,suffix:l,askCountry:i,termsHref:o,privacyHref:u,draft:c,wrong:s,slug:y,trouble:p,busy:g=!1,locale:f,onChange:U,onCompany:R,onSlug:B,onCountry:O,onSubmit:T,children:S}){const b=Z(),[h,G]=m(f!==void 0);P(()=>G(!0),[]);const H=r=>r?[{value:r,label:r}]:[],F=ee(()=>i?h?xe(c.country,f):H(c.country):[],[i,h,c.country,f]),L=ee(()=>i?h?ve(c.currency,f):H(c.currency):[],[i,h,c.currency,f]),_=(r,k,w,C,$)=>e(Y,{id:`${b}-${r}`,label:k,error:s[r],children:e("div",{className:`${M} ${V(s[r])}`,children:e("input",{id:`${b}-${r}`,name:r,type:w,autoComplete:C,maxLength:$,value:c[r],"aria-invalid":s[r]?!0:void 0,"aria-describedby":s[r]?`${b}-${r}-said`:void 0,onChange:I=>r==="company"?R?.(I.target.value):U?.({[r]:I.target.value}),className:J})})}),j=(r,k,w,C)=>e(Y,{id:`${b}-${r}`,label:k,error:s[r],children:e("div",{className:`${M} ${V(s[r])}`,children:e("select",{id:`${b}-${r}`,name:r,value:c[r],"aria-invalid":s[r]?!0:void 0,onChange:$=>C($.target.value),className:`${J} cursor-pointer`,children:w.map($=>e("option",{value:$.value,children:$.label},$.value))})})}),A=s.slug??(y.state==="problem"?n.slugProblem[y.problem]:void 0),W=y.state==="checking"?e("span",{className:"text-fg-dim",children:n.checking}):y.state==="available"?x("span",{className:"text-green",children:[e("span",{"aria-hidden":!0,children:"✓ "}),n.available]}):void 0;return x("form",{noValidate:!0,onSubmit:T,className:q,children:[e("h2",{className:z,children:D(n.title,{name:t})}),a&&e("p",{className:`${E} mt-1`,children:a}),x("div",{className:"grid grid-cols-2 gap-[10px]",children:[_("firstName",n.firstName,"text","given-name",150),_("lastName",n.lastName,"text","family-name",150)]}),_("email",n.email,"email","email",254),_("company",n.company,"text","organization",200),e(Y,{id:`${b}-slug`,label:n.address,error:A,hint:W,children:x("div",{className:`${M} gap-2 ${V(A)}`,children:[e("input",{id:`${b}-slug`,name:"slug",type:"text",autoComplete:"off",autoCapitalize:"none",spellCheck:!1,maxLength:30,value:c.slug,"aria-invalid":A?!0:void 0,"aria-describedby":A||W?`${b}-slug-said`:void 0,onChange:r=>B?.(r.target.value),className:`${he} h-full bg-transparent text-[14px] text-fg outline-none focus-visible:outline-none!`}),l&&e("span",{className:`${E} shrink-0`,children:l})]})}),i&&x(K,{children:[j("country",n.country,F,r=>O?.(r)),j("currency",n.currency,L,r=>U?.({currency:r})),e("p",{className:`${E} mt-[6px]`,children:n.countryHint})]}),p&&e("p",{role:"alert",className:X,children:n.trouble[p]}),e("button",{type:"submit",disabled:g,className:re,children:g?n.sending:n.submit}),e("p",{className:`${E} mt-3 text-center`,children:e(He,{termsHref:o,privacyHref:u})}),S]})}function De({product:t="",productName:a,children:l,onOpen:i}){const o=Z(),[u,c]=m(""),[s,y]=m(null),[p,g]=m(null),[f,U]=m(!1),[R,B]=m(!1);return x("form",{noValidate:!0,onSubmit:async T=>{if(T.preventDefault(),f)return;const S=ye(u);if(y(S),g(null),!S){U(!0);try{await de(t,u),B(!0)}catch(b){const h=b instanceof ne?Ue(b.status,b.data):{open:!1,email:null,trouble:"failed"};h.open&&i?.(),y(h.email),g(h.trouble)}finally{U(!1)}}},className:q,children:[e("h2",{className:z,children:n.closedTitle}),x("p",{className:"mt-[10px]",children:[D(n.closedBody,{name:a})," ",R?"":n.closedLeave]}),R?e("p",{role:"status",className:"mt-[10px] font-medium",children:D(n.waitingDone,{email:u.trim()})}):x(K,{children:[e(Y,{id:`${o}-email`,label:n.email,error:s??void 0,children:e("div",{className:`${M} ${V(s??void 0)}`,children:e("input",{id:`${o}-email`,name:"email",type:"email",autoComplete:"email",maxLength:254,value:u,"aria-invalid":s?!0:void 0,"aria-describedby":s?`${o}-email-said`:void 0,onChange:T=>{c(T.target.value),y(null),g(null)},className:J})})}),p&&e("p",{role:"alert",className:X,children:n.trouble[p]}),e("button",{type:"submit",disabled:f,className:re,children:f?n.sending:n.tellMe})]}),l]})}function He({termsHref:t,privacyHref:a}){const l=(c,s)=>c?e("a",{href:c,target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2",children:s}):s,[i,o,u]=n.agree.split(/\{terms\}|\{privacy\}/);return x(K,{children:[i,l(t,n.terms),o,l(a,n.privacy),u]})}function Fe({draft:t,sent:a,trouble:l,busy:i=!1,resent:o=!1,locale:u,timeZone:c,onAgain:s,onEdit:y}){const[p,g]=D(n.sentBody,{company:t.company.trim()}).split("{email}"),f=$e(a?.expiresAt??"",u,c);return x("div",{className:q,children:[e("h2",{className:z,children:n.sentTitle}),x("p",{className:"mt-[10px]",children:[p,e("span",{className:"font-medium",children:t.email.trim()}),g]}),f&&e("p",{className:`${E} mt-[10px]`,children:D(n.sentUntil,{when:f})}),l?e("p",{role:"alert",className:X,children:n.trouble[l]}):o&&!i&&e("p",{role:"status",className:`${E} mt-[10px]`,children:n.sentAgain}),e("button",{type:"button",disabled:i,onClick:s,className:`${ie} mt-[18px] border-line`,children:i?n.sendingAgain:n.sendAgain}),e("button",{type:"button",disabled:i,onClick:y,className:`${ie} mt-2 border-transparent`,children:n.change})]})}export{we as SignUpView,Ee as default};