efficient-storefront-blocks 0.116.0 → 0.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/README.md +9 -10
- package/dist/chunks/{EditorPreviewCheckout-ZLZS26RB.js → EditorPreviewCheckout-JKTRIRSH.js} +4 -4
- package/dist/chunks/{SiteEditorProvider-E5ZSDH4Y.js → SiteEditorProvider-ZVNXSXBQ.js} +1 -1
- package/dist/chunks/{chunk-VTAJ6NIH.js → chunk-3XS3LIPN.js} +1 -1
- package/dist/chunks/chunk-NMYHWA3M.js +96 -0
- package/dist/chunks/chunk-XVPVTQYY.js +342 -0
- package/dist/chunks/{chunk-6MJVBHOY.js → chunk-XZPK5PGX.js} +1 -1
- package/dist/chunks/{fitment-data-25XLESAA.js → fitment-data-3N56LEBE.js} +1 -1
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/components/MenuPicker.d.ts +3 -0
- package/dist/editor/components/MenuPicker.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +3 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +103 -31
- package/dist/links.js +1 -1
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/ChatContext.d.ts +1 -1
- package/dist/render/components/ChatContext.js +1 -1
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/DeliveryOptionsSource.js +1 -1
- package/dist/render/components/HeaderNavItem.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +1 -0
- package/dist/render/components/fitment/FitmentFinder.js +1 -1
- package/dist/render/components/fitment/FitmentPickerGrid.js +1 -1
- package/dist/render/components/fitment/PickerField.d.ts +2 -1
- package/dist/render/components/fitment/PickerField.js +1 -1
- package/dist/render/components/fitment/useFitmentCascade.d.ts +8 -0
- package/dist/render/components/fitment/useFitmentCascade.js +1 -1
- package/dist/render/components/fitment/useVehicleFit.js +1 -1
- package/dist/render/components/fitment/vehicle-level-state.d.ts +1 -0
- package/dist/render/components/fitment/vehicle-level-state.js +1 -1
- package/dist/render/lib/api/types.d.ts +1 -0
- package/dist/words.d.ts +12 -0
- package/dist/words.js +4 -4
- package/package.json +4 -4
- package/dist/chunks/chunk-57R5GY5W.js +0 -341
- package/dist/chunks/chunk-P4KTLII2.js +0 -96
- /package/dist/chunks/{chunk-LBW7HOQO.js → chunk-JVAY6GGN.js} +0 -0
- /package/dist/chunks/{chunk-57R5GY5W.js.LEGAL.txt → chunk-XVPVTQYY.js.LEGAL.txt} +0 -0
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ie=["main","text","background","muted"],et=[...ie,"surface"];var tt={bold:g.bold.placeholder,italic:g.italic.placeholder,strike:g.strike.placeholder,code:g.code.placeholder,highlight:g.highlight.placeholder,quiet:g.quiet.placeholder,link:"link text",underline:g.underline.placeholder,sup:g.sup.placeholder,sub:g.sub.placeholder,color:"colored text",style:"styled text"};var se=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var T=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],le=["highlight","quiet"],nt=se.map(e=>e.style).filter(e=>T.some(t=>t.kind===e)).filter(e=>!le.includes(e)),rt=[...T,{open:"*",close:"*",kind:"accent"}],ot=[...T,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var it=["http","https","mailto","tel"];function D(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||it.includes(t[1].toLowerCase())}var ae=["width","profile","rim"];var st=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,lt={width:[100,500],profile:[20,100],rim:[10,30]};function U(e){let t=st.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return ae.every(o=>{let[i,a]=lt[o];return n[o]>=i&&n[o]<=a})?n:null}function _(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function ue(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var k=["alloy-wheel","tyre"],ce=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var hn=k.map(e=>({value:e,label:F[e]}));function pe(e){return e==null?[...ce]:Array.isArray(e)?k.filter(t=>e.includes(t)):[...ce]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function $(e){return m(e).brand??""}function de(e){return m(e).prices??void 0}function fe(e){return m(e).inStock!==!1}function me(e){let t=m(e),n=f(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function B(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function he(e){return B(e).map(t=>t.family)}function ge(e){if(f(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function ye(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function Pe(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function be(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function Se(e){if(f(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>U(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var W=e=>typeof e=="string"&&e?e:void 0;function H(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function ke(e,t){return Object.hasOwn(e,t)}var xe=null;function Le(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>ke(t,r)?String(H(t,r)):n):e}function y(e,t){let n=xe?H(xe,e):void 0;if(typeof n=="function"){try{let r=W(n(t??{}));if(r)return r}catch{}return Le(e,t)}return Le(W(n)??e,t)}function Y(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var w=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),Ln=w(30,0,100,10),Tn=w(0,0,100,5),_n=w(100,0,100,5),Fn=w(2,0,4,.5);function Te(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var _e="homepage";var A=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function R(e){return e.offersCommerce&&e.offersService?A:A.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var V="#popup:";function Fe(e){return`${V}${e}`}function we(e){return e.startsWith(V)&&e.slice(V.length).trim()||null}function P(e){return e===_e?"/":`/${e}`}function E(e){return`/journal/${e}`}function O(e){return`/wheels/${e}`}function I(e,t){return`${P(e)}#${t}`}function N(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let i=Te(o?.props?.anchor);if(!i)continue;let a=Y(i);!a||t.has(a)||(t.add(a),n.push({slug:a,name:i}))}return n}function Ae(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var at=()=>({choosePage:y("Choose a page"),chooseSection:y("Choose a section"),noSections:y("No section anchors yet"),sectionHint:y("Jumps to a section on that page."),choosePost:y("Choose a post"),chooseProduct:y("Choose a product"),choosePopup:y("Choose a popup")});function C(e,t,n){if(!e)return"page";if(we(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ae(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function Re(e,t){let n=at(),r=e.pages.map(s=>({value:P(s.slug),label:s.title})),o=t?.pageOptions?t.pageOptions(r):r,i=o.map(s=>s.value),a=e.pages.map(s=>({label:s.title,options:N(...s.docs).map(u=>({value:I(s.slug,u.slug),label:u.name}))})).filter(s=>s.options.length>0),p=s=>{switch(s){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:a,placeholder:a.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:E(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Fe(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},l=R(e.offers).map(s=>({value:s.value,label:y(s.label),target:p(s.value),...s.value==="anchor"?{hint:n.sectionHint}:{},...s.value==="blog"||s.value==="product"||s.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:l,rules:{kindOf:s=>C(s,i),targetOf:s=>s,readFilter:()=>null,withFilter:s=>s}};let c=s=>{let u=t.withFilter(s,null);return t.listingPaths.includes(u)?u:s};return{kinds:l,rules:{kindOf:s=>C(s,i,{listingPaths:t.listingPaths,targetOf:c}),targetOf:c,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:s=>t.listingPaths.includes(s)?t.filtersFor(s):null}}var Ee=Object.freeze([]);function G(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Oe(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let i=o[n];if(typeof i!="number"||!Number.isFinite(i))continue;let a=r.get(o.fieldKey);(a===void 0||i<a)&&r.set(o.fieldKey,i)}return o=>o?r.get(o):void 0}function Ie(e,t,n,r){let o=new Map;for(let l of n){let c=l[r];typeof c=="number"&&o.set(l.fieldKey,c)}if(o.size===0)return e;let i=[],a=[];e.forEach((l,c)=>{let s=t(l);s&&(i.push(c),a.push({item:l,index:c,order:o.get(s)}))}),a.sort((l,c)=>l.order!==void 0&&c.order!==void 0?l.order-c.order||l.index-c.index:l.order!==void 0?-1:c.order!==void 0?1:l.index-c.index);let p=[...e];return i.forEach((l,c)=>{p[l]=a[c].item}),p.every((l,c)=>l===e[c])?e:p}function Ne(e){return ct(e,"filter")}var ut="collection";function j(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":ut},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function ct(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function pt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ce(e,t){let n=e?.[t];return pt(n)?n:null}function ve(e,t,n,r){if(n==null&&r==null)return!0;let o=Ce(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}function Ke(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var dt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},pr=Object.keys(dt);var q=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Z={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},ft={diameters:"tyreSizes"};function mt(e){if(e.length===0)return[];let t=q.filter(n=>e.every(r=>Z[n].includes(r)));return t.filter(n=>{let r=ft[n];return!r||!t.includes(r)})}function ht(e){let t=new Set;for(let n of e)t.add(f(n));return[...t]}var Me={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function gt(e,t,n,r=null,o="fail"){let i=f(e),a=p=>o==="fail"||(p==="lugs"?i==="alloy-wheel":Z[p].includes(i));if(r!=="kind"&&t.kind&&i!==t.kind)return!1;for(let p of q){if(r===p)continue;let l=t[p];if(l.length===0||!a(p))continue;let c=l.map(String);if(!ze(e,p).some(s=>c.includes(s)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&a("lugs")){let p=Ke(e);if(p===null||!t.lugs.includes(p))return!1}return!(r!=="price"&&!ve(de(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!fe(e))}var yt={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function ze(e,t){switch(t){case"tyreSizes":return[...new Set(Se(e).flatMap(ue))];case"brands":return $(e)?[$(e)]:[];case"finishes":return he(e);case"diameters":return me(e).map(String);case"collections":return ge(e);case"pcds":return ye(e);case"tyreTypes":return Pe(e);case"speedRatings":return be(e)}}function Pt(e){let t=new Map;for(let n of e)for(let r of B(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function De(e,t,n,r=ht(e),o=Ee,i="fail"){let a=u=>St(u,r,o),p=Pt(e),c=(i==="pass"?q.filter(u=>r.some(S=>Z[u].includes(S))):mt(r)).filter(u=>u!=="tyreSizes").filter(a).map(u=>{let S=t[u].map(String),oe=new Set,z=new Map,L=new Map;for(let d of e){let b=ze(d,u);for(let h of b)oe.add(h);for(let h of new Set(b))L.set(h,(L.get(h)??0)+1);if(gt(d,t,n,u,i))for(let h of new Set(b))z.set(h,(z.get(h)??0)+1)}let Je=[...oe].map(d=>({value:d,label:u==="diameters"?`${d}\u2033`:d,count:z.get(d)??0,checked:S.includes(d),swatch:u==="finishes"?p.get(d)??null:null})).sort((d,b)=>{if(u==="diameters")return Number(d.value)-Number(b.value);let h=(L.get(b.value)??0)-(L.get(d.value)??0);return h!==0?h:d.value.localeCompare(b.value)});return{key:u,label:yt[u],options:Je}}).filter(u=>u.options.length>bt),s=[];for(let u of c){let S=kt(u.key,r,o);S!==void 0&&s.push({fieldKey:u.key,filterOrder:S})}return[...Ie(c,u=>u.key,s,"filterOrder")]}var bt=1;function Ue(e){return e.showCollection===!1?["collections"]:[]}function St(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>Ne(G(n,r))(j(e,r)))}function kt(e,t,n){if(n.length===0)return;let r;for(let o of t){let i=Oe(G(n,o),"filter")(j(e,o));i!==void 0&&(r===void 0||i<r)&&(r=i)}return r}var X={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},Q="type";var $e=e=>!!e&&typeof e=="object"&&!Array.isArray(e),v=e=>$e(e)&&typeof e.type=="string"&&$e(e.props);var J=e=>Array.isArray(e)&&e.length>0&&e.every(v);function Be(e,t){let n=null;for(let[r,o]of Object.entries(e.props??{})){if(!J(o))continue;let i=t(o,r);i!==o&&((n??={...e.props})[r]=i)}return n?{...e,props:n}:e}var We="FilterBlock";var He="AlloyWheelsListing";function xt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function Lt(e){let t=[],n=(r,o)=>{let i=[r,...o];for(let a of r)v(a)&&(t.push({node:a,order:t.length,lists:i}),Be(a,p=>(n(p,i),p)))};for(let r of xt(e))n(r,[]);return t}function Ye(e){return Lt(e).map(t=>t.node)}function Ve(e){return D(e.trim())}var x="/wheels",K="Products";function Ge(e,t){return t>1?`${K} \xB7 ${e}`:K}function ee(...e){for(let t of[He,We])for(let n of e){let r=Ye({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function M(...e){return ee(...e)!==null}function je(e,t){let n=e.filter(r=>M(...r.docs)).map(r=>P(r.slug));return t.fallback&&!n.includes(x)?[...n,x]:n}var te=[Q,...Object.entries(X).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function qe(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Tt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ze(e){let t=new URLSearchParams(qe(e).query);for(let n of te){let r=t.get(n);if(r)return{param:n,value:r}}return null}function ne(e,t){let{path:n,query:r,hash:o}=qe(e),i=r.split("&").filter(a=>a&&!te.includes(Tt(a.split("=")[0])));return t?.value&&i.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${i.length?`?${i.join("&")}`:""}${o}`}function Xe(e,t){let n=ne(e,null);return t.includes(n)?n:e}function _t(e,t,n=[]){return C(e,t,{listingPaths:n,targetOf:r=>Xe(r,n)})}function Ft(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var Qe="Product type",wt="AUD";function re(e,t){let n=t.listing??{},r=pe(n.kinds),o=e.filter(l=>r.includes(f(l))),i=Ue(n),a=De(o,Me,wt,r,t.fieldUsage).filter(l=>!i.includes(l.key)).map(l=>({param:X[l.key],label:l.label,values:l.options.filter(c=>!c.value.includes(",")).map(c=>({value:c.value,label:c.label}))})).filter(l=>l.values.length>0),p=k.filter(l=>r.includes(l)&&o.some(c=>f(c)===l));return p.length>1&&a.unshift({param:Q,label:Qe,values:p.map(l=>({value:l,label:F[l]}))}),a}function At(e){return t=>{let n=je(t,{fallback:e.offersCommerce}),r=t.filter(o=>M(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let i=o.map(a=>{let p=t.find(l=>P(l.slug)===a.value);return p&&M(...p.docs)?{...a,label:Ge(p.title,r)}:a});return r===0&&e.offersCommerce&&!i.some(a=>a.value===x)&&i.push({value:x,label:K}),i},filtersFor:o=>{if(!n.includes(o))return null;let i=t.find(a=>P(a.slug)===o);return re(e.catalogue,{listing:i?ee(...i.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ze,withFilter:ne}}}function Rt(e){let t=At({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=Re({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:O(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:Ve},filtersFor:n.filtersFor??(()=>null)}}function vr(e,t){return re(e,t)}export{x as BUILT_IN_LISTING_PATH,A as LINK_KINDS,te as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,Qe as PRODUCT_TYPE_FILTER_LABEL,I as anchorPath,Ft as fieldUsageFromAdminRows,_t as inferLinkKind,M as isProductListingPage,Ve as isSafeLink,R as linkKindsFor,Rt as linkPickerSetup,vr as listingFilterFields,ee as listingNode,Ge as listingPageLabel,Xe as listingTarget,N as pageAnchors,P as pagePath,E as postPath,je as productListingPaths,Ze as readListingFilter,O as wheelPath,ne as withListingFilter};
|
|
1
|
+
var y={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],pt=[...ue,"surface"];var ft={bold:y.bold.placeholder,italic:y.italic.placeholder,strike:y.strike.placeholder,code:y.code.placeholder,highlight:y.highlight.placeholder,quiet:y.quiet.placeholder,link:"link text",underline:y.underline.placeholder,sup:y.sup.placeholder,sub:y.sub.placeholder,color:"colored text",style:"styled text"};var pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var A=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],fe=["highlight","quiet"],dt=pe.map(e=>e.style).filter(e=>A.some(t=>t.kind===e)).filter(e=>!fe.includes(e)),mt=[...A,{open:"*",close:"*",kind:"accent"}],ht=[...A,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var yt=["http","https","mailto","tel"];function j(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||yt.includes(t[1].toLowerCase())}var de=["width","profile","rim"];var gt=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,bt={width:[100,500],profile:[20,100],rim:[10,30]};function W(e){let t=gt.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return de.every(o=>{let[s,i]=bt[o];return n[o]>=s&&n[o]<=i})?n:null}function _(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function me(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var x=["alloy-wheel","tyre"],he=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Cn=x.map(e=>({value:e,label:F[e]}));function ye(e){return e==null?[...he]:Array.isArray(e)?x.filter(t=>e.includes(t)):[...he]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function H(e){return m(e).brand??""}function ge(e){return m(e).prices??void 0}function be(e){return m(e).inStock!==!1}function Pe(e){let t=m(e),n=d(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function Y(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function Se(e){return Y(e).map(t=>t.family)}function ke(e){if(d(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function xe(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function we(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function Le(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function Te(e){if(d(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>W(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var G=e=>typeof e=="string"&&e?e:void 0;function V(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Oe(e,t){return Object.hasOwn(e,t)}var Ae=null;function _e(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Oe(t,r)?String(V(t,r)):n):e}function g(e,t){let n=Ae?V(Ae,e):void 0;if(typeof n=="function"){try{let r=G(n(t??{}));if(r)return r}catch{}return _e(e,t)}return _e(G(n)??e,t)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var E=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),jn=E(30,0,100,10),Wn=E(0,0,100,5),Hn=E(100,0,100,5),Yn=E(2,0,4,.5);function Fe(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Ee="homepage";var R=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function I(e){return e.offersCommerce&&e.offersService?R:R.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Re(e){return`${Z}${e}`}function Ie(e){return e.startsWith(Z)&&e.slice(Z.length).trim()||null}function b(e){return e===Ee?"/":`/${e}`}function N(e){return`/journal/${e}`}function v(e){return`/wheels/${e}`}function C(e,t){return`${b(e)}#${t}`}function M(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let s=Fe(o?.props?.anchor);if(!s)continue;let i=q(s);!i||t.has(i)||(t.add(i),n.push({slug:i,name:s}))}return n}function Ne(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var Pt=()=>({choosePage:g("Choose a page"),chooseSection:g("Choose a section"),noSections:g("No section anchors yet"),sectionHint:g("Jumps to a section on that page."),choosePost:g("Choose a post"),chooseProduct:g("Choose a product"),choosePopup:g("Choose a popup")});function K(e,t,n){if(!e)return"page";if(Ie(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ne(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function ve(e,t){let n=Pt(),r=e.pages.map(c=>({value:b(c.slug),label:c.title})),o=t?.pageOptions?t.pageOptions(r):r,s=o.map(c=>c.value),i=e.pages.map(c=>({label:c.title,options:M(...c.docs).map(u=>({value:C(c.slug,u.slug),label:u.name}))})).filter(c=>c.options.length>0),l=c=>{switch(c){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:i,placeholder:i.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:N(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Re(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=I(e.offers).map(c=>({value:c.value,label:g(c.label),target:l(c.value),...c.value==="anchor"?{hint:n.sectionHint}:{},...c.value==="blog"||c.value==="product"||c.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:a,rules:{kindOf:c=>K(c,s),targetOf:c=>c,readFilter:()=>null,withFilter:c=>c}};let p=c=>{let u=t.withFilter(c,null);return t.listingPaths.includes(u)?u:c};return{kinds:a,rules:{kindOf:c=>K(c,s,{listingPaths:t.listingPaths,targetOf:p}),targetOf:p,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:c=>t.listingPaths.includes(c)?t.filtersFor(c):null}}var Ce=Object.freeze([]);function X(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Me(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let s=o[n];if(typeof s!="number"||!Number.isFinite(s))continue;let i=r.get(o.fieldKey);(i===void 0||s<i)&&r.set(o.fieldKey,s)}return o=>o?r.get(o):void 0}function Ke(e,t,n,r){let o=new Map;for(let a of n){let p=a[r];typeof p=="number"&&o.set(a.fieldKey,p)}if(o.size===0)return e;let s=[],i=[];e.forEach((a,p)=>{let c=t(a);c&&(s.push(p),i.push({item:a,index:p,order:o.get(c)}))}),i.sort((a,p)=>a.order!==void 0&&p.order!==void 0?a.order-p.order||a.index-p.index:a.order!==void 0?-1:p.order!==void 0?1:a.index-p.index);let l=[...e];return s.forEach((a,p)=>{l[a]=i[p].item}),l.every((a,p)=>a===e[p])?e:l}function ze(e){return kt(e,"filter")}var St="collection";function Q(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":St},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function kt(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function xt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function $e(e,t){let n=e?.[t];return xt(n)?n:null}function De(e,t,n,r){if(n==null&&r==null)return!0;let o=$e(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}function Ue(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var wt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Rr=Object.keys(wt);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Lt={diameters:"tyreSizes"};function Tt(e){if(e.length===0)return[];let t=J.filter(n=>e.every(r=>ee[n].includes(r)));return t.filter(n=>{let r=Lt[n];return!r||!t.includes(r)})}function Ot(e){let t=new Set;for(let n of e)t.add(d(n));return[...t]}var Be={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function At(e,t,n,r=null,o="fail"){let s=d(e),i=l=>o==="fail"||(l==="lugs"?s==="alloy-wheel":ee[l].includes(s));if(r!=="kind"&&t.kind&&s!==t.kind)return!1;for(let l of J){if(r===l)continue;let a=t[l];if(a.length===0||!i(l))continue;let p=a.map(String);if(!je(e,l).some(c=>p.includes(c)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&i("lugs")){let l=Ue(e);if(l===null||!t.lugs.includes(l))return!1}return!(r!=="price"&&!De(ge(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!be(e))}var _t={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function je(e,t){switch(t){case"tyreSizes":return[...new Set(Te(e).flatMap(me))];case"brands":return H(e)?[H(e)]:[];case"finishes":return Se(e);case"diameters":return Pe(e).map(String);case"collections":return ke(e);case"pcds":return xe(e);case"tyreTypes":return we(e);case"speedRatings":return Le(e)}}function Ft(e){let t=new Map;for(let n of e)for(let r of Y(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function We(e,t,n,r=Ot(e),o=Ce,s="fail"){let i=u=>Rt(u,r,o),l=Ft(e),p=(s==="pass"?J.filter(u=>r.some(S=>ee[u].includes(S))):Tt(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let S=t[u].map(String),ce=new Set,B=new Map,O=new Map;for(let f of e){let P=je(f,u);for(let h of P)ce.add(h);for(let h of new Set(P))O.set(h,(O.get(h)??0)+1);if(At(f,t,n,u,s))for(let h of new Set(P))B.set(h,(B.get(h)??0)+1)}let ut=[...ce].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:B.get(f)??0,checked:S.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,P)=>{if(u==="diameters")return Number(f.value)-Number(P.value);let h=(O.get(P.value)??0)-(O.get(f.value)??0);return h!==0?h:f.value.localeCompare(P.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>Et),c=[];for(let u of p){let S=It(u.key,r,o);S!==void 0&&c.push({fieldKey:u.key,filterOrder:S})}return[...Ke(p,u=>u.key,c,"filterOrder")]}var Et=1;function He(e){return e.showCollection===!1?["collections"]:[]}function Rt(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>ze(X(n,r))(Q(e,r)))}function It(e,t,n){if(n.length===0)return;let r;for(let o of t){let s=Me(X(n,o),"filter")(Q(e,o));s!==void 0&&(r===void 0||s<r)&&(r=s)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},ne="type";var w=e=>!!e&&typeof e=="object"&&!Array.isArray(e),L=e=>w(e)&&typeof e.type=="string"&&w(e.props);var z=e=>Array.isArray(e)&&e.length>0&&e.every(L);function Nt(e){let t="";for(let n of e)t+=typeof n=="number"?`[${n}]`:t===""?n:`.${n}`;return t}function Ye(e,t){return t==="root"?e.root:e.components[t]}function Ge(e){return e?.fields??{}}function Ve(e,t){return Ge(Ye(e,t))}function qe(e,t){let n=[];return re(e,t,[],n),n}function re(e,t,n,r){for(let o of Object.keys(t)){let s=t[o];if(!s)continue;let i=[...n,o],l=e[o];if(s.type==="slot"){let a=Array.isArray(l);r.push({slot:Nt(i),segments:i,content:a?l:[],present:a})}else if(s.type==="object"&&s.objectFields&&w(l))re(l,s.objectFields,i,r);else if(s.type==="array"&&s.arrayFields&&Array.isArray(l)){let a=s.arrayFields;l.forEach((p,c)=>{w(p)&&re(p,a,[...i,c],r)})}}}function oe(e,t,n){return Ct(e,t,n).map(({slot:r,content:o})=>({slot:r,content:o}))}function $(e){let t=new TextEncoder,n=new Map(e.map(r=>[r,t.encode(r)]));return[...e].sort((r,o)=>{let s=n.get(r),i=n.get(o);if(s.length!==i.length)return s.length-i.length;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return s[l]-i[l];return 0})}function Ct(e,t,n){let r=qe(e.props,Ve(t,e.type));if(n?.order!=="stored")return r;let o=$(Object.keys(e.props)),s=i=>{let l=i.present?o.indexOf(String(i.segments[0])):-1;return l<0?Number.POSITIVE_INFINITY:l};return r.map((i,l)=>({loc:i,i:l,r:s(i)})).sort((i,l)=>i.r-l.r||i.i-l.i).map(({loc:i})=>i)}var Ze=["Text","ImageBlock","ButtonBlock","Flex"];function k(){return{type:"slot",allow:[...Ze]}}var Mt=Ze.filter(e=>e!=="ButtonBlock");function Xe(){return{type:"slot",allow:[...Mt]}}var Kt="boxes",Qe={CardList:{template:Xe()},Cards:{template:k()},FAQ:{template:k()},Flex:{rowTitle:{type:"slot",allow:["Text"]},content:{type:"slot"}},Footprint:{template:k()},Grid:{content:{type:"slot"}},Hero:{slides:{type:"slot",ownPictures:!0},strip:{type:"slot",allow:["Flex"]}},HeroGroup:{content:{type:"slot"}},HeroSingle:{boxes:{type:"slot",allow:["HeroGroup"]}},HeroSlide:{groups:{type:"slot",allow:["HeroGroup"]}},Logos:{logos:{type:"slot",allow:["LogoBlock"]},template:{type:"slot",allow:["LogoBlock"]}},OrderSummary:{template:k()},ProcessSteps:{[Kt]:{type:"slot"},template:k()}};var zt={},$t=null;function Dt(){let e=Object.fromEntries(Object.entries(Qe).map(([t,n])=>[t,{fields:n}]));return $t??={components:{...e,...zt}}}function Ut(e){let t=e.props??{},n=typeof e.type=="string"?e.type:"",r=Dt(),o=n!==""&&Object.prototype.hasOwnProperty.call(r.components,n)?oe({type:n,props:t},r).map(l=>l.slot).filter(l=>!l.includes(".")):[],s=o.filter(l=>z(t[l])),i=$(Object.keys(t).filter(l=>!o.includes(l)&&z(t[l])));return[...s,...i]}function Je(e,t){let n=null;for(let r of Ut(e)){let o=e.props[r],s=t(o,r);s!==o&&((n??={...e.props})[r]=s)}return n?{...e,props:n}:e}var et="FilterBlock";var tt="AlloyWheelsListing";function Bt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function jt(e){let t=[],n=(r,o)=>{let s=[r,...o];for(let i of r)L(i)&&(t.push({node:i,order:t.length,lists:s}),Je(i,l=>(n(l,s),l)))};for(let r of Bt(e))n(r,[]);return t}function nt(e){return jt(e).map(t=>t.node)}function rt(e){return j(e.trim())}var T="/wheels",D="Products";function ot(e,t){return t>1?`${D} \xB7 ${e}`:D}function se(...e){for(let t of[tt,et])for(let n of e){let r=nt({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function U(...e){return se(...e)!==null}function st(e,t){let n=e.filter(r=>U(...r.docs)).map(r=>b(r.slug));return t.fallback&&!n.includes(T)?[...n,T]:n}var ie=[ne,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function it(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Wt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function lt(e){let t=new URLSearchParams(it(e).query);for(let n of ie){let r=t.get(n);if(r)return{param:n,value:r}}return null}function le(e,t){let{path:n,query:r,hash:o}=it(e),s=r.split("&").filter(i=>i&&!ie.includes(Wt(i.split("=")[0])));return t?.value&&s.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${s.length?`?${s.join("&")}`:""}${o}`}function at(e,t){let n=le(e,null);return t.includes(n)?n:e}function Ht(e,t,n=[]){return K(e,t,{listingPaths:n,targetOf:r=>at(r,n)})}function Yt(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var ct="Product type",Gt="AUD";function ae(e,t){let n=t.listing??{},r=ye(n.kinds),o=e.filter(a=>r.includes(d(a))),s=He(n),i=We(o,Be,Gt,r,t.fieldUsage).filter(a=>!s.includes(a.key)).map(a=>({param:te[a.key],label:a.label,values:a.options.filter(p=>!p.value.includes(",")).map(p=>({value:p.value,label:p.label}))})).filter(a=>a.values.length>0),l=x.filter(a=>r.includes(a)&&o.some(p=>d(p)===a));return l.length>1&&i.unshift({param:ne,label:ct,values:l.map(a=>({value:a,label:F[a]}))}),i}function Vt(e){return t=>{let n=st(t,{fallback:e.offersCommerce}),r=t.filter(o=>U(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let s=o.map(i=>{let l=t.find(a=>b(a.slug)===i.value);return l&&U(...l.docs)?{...i,label:ot(l.title,r)}:i});return r===0&&e.offersCommerce&&!s.some(i=>i.value===T)&&s.push({value:T,label:D}),s},filtersFor:o=>{if(!n.includes(o))return null;let s=t.find(i=>b(i.slug)===o);return ae(e.catalogue,{listing:s?se(...s.docs):null,fieldUsage:e.fieldUsage})},readFilter:lt,withFilter:le}}}function qt(e){let t=Vt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=ve({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:v(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:rt},filtersFor:n.filtersFor??(()=>null)}}function Qo(e,t){return ae(e,t)}export{T as BUILT_IN_LISTING_PATH,R as LINK_KINDS,ie as LISTING_FILTER_PARAMS,D as LISTING_PAGE_LABEL,ct as PRODUCT_TYPE_FILTER_LABEL,C as anchorPath,Yt as fieldUsageFromAdminRows,Ht as inferLinkKind,U as isProductListingPage,rt as isSafeLink,I as linkKindsFor,qt as linkPickerSetup,Qo as listingFilterFields,se as listingNode,ot as listingPageLabel,at as listingTarget,M as pageAnchors,b as pagePath,N as postPath,st as productListingPaths,lt as readListingFilter,v as wheelPath,le as withListingFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as $}from"react/jsx-runtime";import{createContext as q,useCallback as f,useContext as z,useEffect as p,useMemo as B,useRef as x,useState as c}from"react";import{auth as D}from"../lib/auth.js";import{api as F}from"../lib/api/index.js";import{chatSocketUrl as G}from"../lib/chat-socket.js";import{safeLocalStorage as I}from"efficient-web-builder/format/lib/safe-storage";import{getChatThread as Q,postChatMessage as X,startChat as Z}from"../lib/api/chat.js";const ee="sf:aid",A="sf:chat",U=q(null);function te(){const u=I.getItem(A);if(!u)return null;try{return JSON.parse(u)}catch{return null}}function
|
|
1
|
+
"use client";import{jsx as $}from"react/jsx-runtime";import{createContext as q,useCallback as f,useContext as z,useEffect as p,useMemo as B,useRef as x,useState as c}from"react";import{auth as D}from"../lib/auth.js";import{api as F}from"../lib/api/index.js";import{chatSocketUrl as G}from"../lib/chat-socket.js";import{safeLocalStorage as I}from"efficient-web-builder/format/lib/safe-storage";import{getChatThread as Q,postChatMessage as X,startChat as Z}from"../lib/api/chat.js";const ee="sf:aid",A="sf:chat",U=q(null);function te(){const u=I.getItem(A);if(!u)return null;try{return JSON.parse(u)}catch{return null}}function le({children:u,preview:t=!1}){const[m,y]=c(!1),[e,O]=c(null),[b,g]=c([]),[E,T]=c(!1),[v,P]=c(null),[M,C]=c(0),[N,R]=c(!1),[J,H]=c(!1),S=x(m);S.current=m;const h=x(null),_=x(e);_.current=e,p(()=>{t||O(te())},[t]);const l=f(async r=>{try{const o=await Q(r.id,r.token);g(o.messages)}catch{}},[]),i=f(()=>(t||h.current||(h.current=F.restoreSession().then(()=>{R(!0),_.current&&l(_.current)},()=>R(!1))),h.current),[t,l]);p(()=>{t||e&&l(e)},[t,e,l]),p(()=>{if(t||!e)return;const r=D.getAccess()??e.token;let o=!1,s=null,n,a=3e3;const d=()=>{o||(s=new WebSocket(G(e.id,r)),s.onmessage=V=>{try{const k=JSON.parse(V.data);k.type==="chat_event"&&k.event==="message"&&(l(e),!S.current&&k.payload?.sender_role==="employee"&&C(W=>W+1))}catch{}},s.onclose=()=>{o||(n=setTimeout(d,a),a=Math.min(a*2,3e4))},s.onerror=()=>s?.close())};return d(),()=>{o=!0,n&&clearTimeout(n),s?.close()}},[t,e,l]);const K=f(()=>{y(!0),C(0),i()},[i]),Y=f(()=>y(!1),[]),j=f(()=>{S.current||i(),y(r=>(r||C(0),!r))},[i]),w=f(async(r,o)=>{const s=r.trim();if(!s)return!1;if(t)return g(n=>[...n,{id:`preview-${n.length}`,sender_role:"customer",sender_name:o?.name||"You",body:s,image_url:null,created_at:""}]),H(!0),!0;T(!0),P(null),await i();try{if(e){const n=await X(e.id,e.token,s);g(a=>[...a,n])}else{const n=I.getItem(ee)||"",a=await Z({body:s,guestName:o?.name,guestEmail:o?.email,guestKey:n}),d={id:a.id,token:a.guest_token};I.setItem(A,JSON.stringify(d)),O(d),g(a.messages)}return!0}catch{return P("Could not send your message. Please try again shortly."),!1}finally{T(!1)}},[e,t,i]),L=B(()=>({isOpen:m,open:K,close:Y,toggle:j,messages:b,sending:E,error:v,unread:M,hasConversation:t?J:!!e,isSignedIn:N,send:w}),[m,K,Y,j,b,E,v,M,e,N,w,t,J]);return $(U.Provider,{value:L,children:u})}function ie(){const u=z(U);if(!u)throw new Error("useChat must be used within <ChatProvider>");return u}export{le as ChatProvider,ie as useChat};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as W,useRef as z,useState as h}from"react";import{ROW_INPUT_CLASS as D}from"../lib/field-input.js";import{stripMarkup as U}from"efficient-web-builder/format/lib/markup";import{sizedImage as M}from"efficient-web-builder/format/lib/sized-image";import O,{chatLauncherOnLeft as R}from"./ChatLauncher.js";import{useChat as $}from"./ChatContext.js";import{scrollBehavior as F}from"efficient-web-builder/render/components/useReducedMotion";const G="Chat with us",H="We usually reply within a few minutes",K="Hi! Ask us anything — about a wheel, an order, or fitment. Leave your details and we’ll reply.";function Y({m:a}){if(a.sender_role==="system")return e("div",{className:"text-center text-[11px] text-fg/50 py-1",children:a.body});const r=a.sender_role==="bot",s=a.sender_role==="employee"||r;return e("div",{className:`flex ${s?"justify-start":"justify-end"}`,children:n("div",{className:`max-w-[80%] rounded-2xl px-3 py-2 text-sm ${s?"bg-fg/5 text-fg":"bg-accent text-accent-ink"}`,children:[s&&n("div",{className:"mb-0.5 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-fg/50",children:[r&&e("span",{"aria-hidden":"true",children:"✦"}),e("span",{children:r?a.sender_name||"Assistant":a.sender_name||"Support"}),r&&e("span",{className:"font-normal normal-case tracking-normal",children:"· automated"})]}),a.body&&e("p",{className:"whitespace-pre-wrap",children:a.body}),a.image_url&&e("a",{href:a.image_url,target:"_blank",rel:"noopener noreferrer",children:e("img",{...M(a.image_url,{fallbackWidth:640,maxWidth:1280}),sizes:"(max-width: 640px) 80vw, 320px",alt:"Attachment",className:"mt-2 max-h-48 w-auto rounded-lg"})})]})})}function P({title:a,subtitle:r,greeting:s,look:x}={}){const{isOpen:o,toggle:C,close:E,messages:d,sending:c,error:f,unread:g,hasConversation:L,isSignedIn:T,send:S}=$(),b=a?.trim()||G,j=r?.trim()||H,I=s?.trim()||K,[m,y]=h(""),[p,A]=h(""),[i,B]=h(""),v=z(null),l=!T&&!L;W(()=>{o&&v.current?.scrollIntoView({behavior:F(),block:"nearest"})},[d.length,o]);const N=/.+@.+/.test(i),w=m.trim().length>0&&(!l||p.trim()&&N),u=l&&i.trim().length>0&&!N,_=async()=>{if(!w||c)return;const t=m;await S(t,l?{name:p.trim(),email:i.trim()}:void 0)&&y(k=>k===t?"":k)};return o?n("aside",{role:"dialog","aria-label":"Chat with us","data-sf-floating":"",className:`fixed bottom-5 ${R(x)?"left-5":"right-5"} z-[61] flex h-[min(560px,80vh)] w-[min(380px,calc(100vw-2.5rem))] flex-col overflow-hidden rounded-2xl border border-line bg-bg shadow-[0_20px_60px_rgba(0,0,0,.45)]`,style:{color:"var(--fg)"},children:[n("div",{className:"flex items-center justify-between border-b border-line px-4 py-3",children:[n("div",{children:[e("div",{className:"text-sm font-semibold text-fg",children:b}),e("div",{className:"text-[11px] text-fg/50",children:j})]}),e("button",{type:"button",onClick:E,"aria-label":"Close chat",className:"rounded-md p-1 text-fg/60 hover:bg-fg/5",children:e("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n("div",{className:"flex-1 space-y-2 overflow-y-auto px-3 py-3",children:[d.length===0&&e("p",{className:"px-2 py-4 text-center text-sm text-fg/50",children:I}),d.map(t=>e(Y,{m:t},t.id)),e("div",{ref:v})]}),n("div",{className:"border-t border-line p-3",children:[l&&n("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[e("input",{value:p,onChange:t=>A(t.target.value),placeholder:"Your name","aria-label":"Your name",className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"}),e("input",{value:i,onChange:t=>B(t.target.value),type:"email",placeholder:"Email","aria-label":"Email","aria-invalid":u||void 0,"aria-describedby":u?"sf-chat-email-hint":void 0,className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"})]}),u&&e("p",{id:"sf-chat-email-hint",className:"mb-2 text-xs text-fg/60",children:"Enter your full email address to send."}),f&&e("p",{role:"alert",className:"mb-2 text-xs text-alert",children:f}),n("div",{className:"flex items-end gap-2",children:[e("textarea",{value:m,onChange:t=>y(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),_())},rows:1,placeholder:"Type a message…","aria-label":"Message",className:`${D} max-h-28 resize-none rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent`}),e("button",{type:"button",onClick:()=>{_()},disabled:!w||c,className:"rounded-lg bg-btn px-3 py-2 text-sm font-semibold text-btn-ink disabled:opacity-40",children:c?"…":"Send"})]})]})]}):e(O,{label:U(b),onOpen:C,zIndex:60,look:x,badge:g>0&&e("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-red-600 px-1 text-[11px] font-bold text-white",children:g})})}export{K as DEFAULT_GREETING,H as DEFAULT_SUBTITLE,G as DEFAULT_TITLE,P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as y}from"react/jsx-runtime";import{useEffect as h,useState as g}from"react";import{products as E}from"../lib/api/index.js";import{FREE_PRICE as R,FROM_PREFIX_START as b}from"../lib/wheels/price-display.js";import j from"./DeliveryOptions.js";import{useCurrency as M}from"./CurrencyContext.js";function S({eyebrow:s,title:c,body:u,highlightBadge:a,contained:d,omitHead:l=!1}){const{currency:n,formatMoney:f}=M(),[p,r]=g(null);h(()=>{let e=!1;return E.listShippingMethods().then(o=>{e||r(o)}).catch(()=>{e||r([])}),()=>{e=!0}},[]);const m=(p??[]).filter(e=>e.prices[n]!=null).map(e=>{const o=e.prices[n],i=o===0?R:f(o,n),t=e.pickupLocation;return{name:t?`${e.name} — ${t.name}`:e.name,eta:t?t.openingHours||void 0:e.description||void 0,price:e.requiresQuote&&o!==0?`${b}${i}`:i,blurb:t&&[[t.address,t.city,t.state].filter(Boolean).join(", "),t.readyIn].filter(Boolean).join(" · ")||void 0}});return y(j,{eyebrow:s,title:c,body:u,options:m,highlightBadge:a,contained:d,omitHead:l})}export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as b}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as s,jsxs as b}from"react/jsx-runtime";import d from"next/link";import{useEffect as L,useId as D,useRef as g,useState as E}from"react";import{isLabelOnlyMenuUrl as x,isMenuPanel as T}from"../lib/menu-link.js";import{useTakeViewHide as A,withViewHide as w}from"efficient-web-builder/render/components/ViewHideRoot";import{DesktopDropdownPanel as M,PhoneDropdownPanel as O}from"./HeaderDropdownPanel.js";const _=120;function R({item:n,mobile:l=!1,onNavigate:j,dropdownAlign:y="start"}){const[o,c]=E(!1),[N,k]=E(!1),r=()=>{c(!1),k(!1)},f=D(),u=g(null),C=g(null),$=n.dropdownItems.length>0,m=$&&T(n.dropdownItems,n.dropdownAside),p=g(null),h=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)};L(()=>h,[]);const v=!x(n.href),t=A();L(()=>{if(!o)return;const e=u.current?.ownerDocument??document,i=P=>{u.current?.contains(P.target)||r()};return e.addEventListener("pointerdown",i),()=>e.removeEventListener("pointerdown",i)},[o]);const a=()=>{r(),j?.()};if(!$)return v?t.scope(s(d,{href:n.href,onClick:a,className:w(l?"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",t.className),...t.attrs,children:n.label})):t.scope(s("span",{className:w(l?"flex min-h-11 items-center font-display text-3xl":"whitespace-nowrap opacity-80",t.className),...t.attrs,children:n.label}));const I=s("button",{ref:C,type:"button","aria-label":`${o&&(l||N)?"Close":"Open"} ${n.plainLabel} menu`,"aria-expanded":o,"aria-controls":f,onClick:()=>{l?c(e=>!e):o&&N?r():(h(),c(!0),k(!0))},className:l?"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 ${o?"rotate-180":""}`,children:s("path",{d:"m3 5 4 4 4-4"})})});return l?t.scope(b("div",{ref:u,className:t.className||void 0,...t.attrs,children:[b("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[v?s(d,{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}),I]}),o&&m?s(O,{id:f,items:n.dropdownItems,aside:n.dropdownAside,onNavigate:a}):o?s("div",{id:f,className:"mt-3 flex flex-col border-l border-line pl-5",children:n.dropdownItems.map((e,i)=>x(e.href)?s("span",{className:"flex min-h-11 items-center text-base opacity-80",children:e.label},`${e.href}-${i}`):s(d,{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}-${i}`))}):null]})):t.scope(b("div",{ref:u,className:w("relative flex items-center whitespace-nowrap",t.className),...t.attrs,onMouseEnter:()=>{h(),c(!0)},onMouseLeave:()=>{h(),m?p.current=setTimeout(r,_):r()},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||r()},onKeyDown:e=>{e.key==="Escape"&&(r(),C.current?.focus())},children:[v?s(d,{href:n.href,onClick:a,onFocus:()=>c(!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}),I,o&&m?s(M,{id:f,items:n.dropdownItems,aside:n.dropdownAside,onNavigate:a,anchor:u}):o?s("div",{id:f,className:`absolute top-full z-[60] w-72 pt-3 text-fg ${y==="end"?"right-0":y==="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,i)=>x(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}-${i}`):s(d,{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}-${i}`))})}):null]}))}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as v,jsxs as a}from"react/jsx-runtime";import{useId as I}from"react";import V from"next/image";import X from"next/link";import{lineTotal as Z,useCart as J}from"../CartContext.js";import{useCurrency as ee}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{FREE_PRICE as O}from"../../lib/wheels/price-display.js";import te from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as ne}from"../../lib/cart/coupon-preview.js";import{orderReference as ae}from"../../lib/checkout/pay-first.js";import{PRICES_REQUOTED as re}from"../../lib/checkout/checkout-memory.js";import{shippingWords as ie,TAX_PENDING as le}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as oe}from"../../lib/wheels/finish-defaults.js";import D from"../ThemedSelect.js";import g from"../WebFormField.js";import se from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as ce,placedOrderLockNote as de,SHIPPING_RETRY_NOTE as pe,useCheckout as S}from"./checkout-state.js";import{FIELD_INPUT_CLASS as u}from"../../lib/field-input.js";import{FIGURE_UPDATING as P}from"../../lib/wheels/price-display.js";function $e(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:s,setLastName:c,company:f,setCompany:y,me:b,checkoutSignOut:h,orderLocked:x,unpaidOrder:o}=S(),d=I();return a(L,{num:"N° 01",title:"Contact",children:[x&&o&&e(he,{orderNumber:o.orderNumber}),e(g,{label:"Email",htmlFor:d,hint:b?a(v,{children:["Signed in ·"," ",e("button",{type:"button",onClick:h,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{id:d,type:"email",value:t,onChange:p=>i(p.target.value),placeholder:"you@example.com",readOnly:b!==null,className:u})}),a(U,{children:[e(g,{label:"First name",children:e("input",{type:"text",value:n,onChange:p=>l(p.target.value),className:u})}),e(g,{label:"Last name",children:e("input",{type:"text",value:s,onChange:p=>c(p.target.value),className:u})})]}),e(g,{label:"Company (optional)",children:e("input",{type:"text",value:f,onChange:p=>y(p.target.value),autoComplete:"organization",className:u})})]})}function De(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:s,setAddress2:c,city:f,setCity:y,postcode:b,setPostcode:h,phone:x,setPhone:o,country:d,setCountry:p,subdivision:C,setSubdivision:m,subdivisions:w,destination:N,postcodeLabel:q,subdivisionLabel:z,me:A,savedAddresses:B,selectedAddressId:F,setSelectedAddressId:T,saveAddress:R,setSaveAddress:H,saveLabel:G,setSaveLabel:W,fillFromAddress:K,orderLocked:Q}=S(),$=I(),j=I();return a(L,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(v,{children:[A!==null&&B.length>0&&a("div",{className:"grid gap-3",children:[B.map(r=>e(E,{active:F===r.id,onClick:()=>{T(r.id),K(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(E,{active:F==="new",onClick:()=>T("new"),title:"New address",body:null,price:null})]}),e(g,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:u})}),e(g,{label:"Address line 2",children:e("input",{type:"text",value:s,onChange:r=>c(r.target.value),placeholder:"Apartment, unit, garage bay…",className:u})}),a(U,{cols:"three",children:[e(g,{label:"City",children:e("input",{type:"text",value:f,onChange:r=>y(r.target.value),className:u})}),e(g,{label:q,children:e("input",{type:"text",value:b,onChange:r=>h(r.target.value),className:u})}),e(g,{label:"Country",separate:!0,htmlFor:$,children:e(D,{id:$,value:d,onChange:r=>p(r.target.value),className:u+" pr-10",style:Y,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(g,{label:z,separate:!0,htmlFor:j,children:w.length>0?a(D,{id:j,value:C,onChange:r=>m(r.target.value),className:u+" pr-10",style:Y,children:[e("option",{value:"",children:"Select…"}),w.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:j,type:"text",value:C,onChange:r=>m(r.target.value),className:u})})]}),e(g,{label:"Phone",children:e("input",{type:"tel",value:x,onChange:r=>o(r.target.value),className:u})}),!t&&A!==null&&F==="new"&&!Q&&a(v,{children:[e(ge,{checked:R,onChange:H,label:"Save this address to my account"}),R&&e(g,{label:"Address label",children:e("input",{type:"text",value:G,onChange:r=>W(r.target.value),placeholder:"Home",className:u})})]})]})}function Me(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:s,pickupLocation:c,formatMoney:f,city:y,destination:b,courierUnavailable:h,retryCourier:x}=S();return e(L,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(o=>{const d=o.pickupLocation,p=d?[d.address,d.city,d.state,d.zipCode].filter(Boolean).join(", "):null;return e(E,{active:l===o.id,onClick:()=>s(o.id),title:d?`${o.name} — ${d.name}`:o.name,body:d?[p,d.openingHours,d.instructions,o.description].filter(Boolean).join(" · "):o.description||null,price:t.freeShipping||o.amount===0?O:f(o.amount,t.currency),tag:o.tag||void 0},o.id)}),h?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[pe," ",e("button",{type:"button",onClick:x,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Ye(){const{payChoice:t,setPayChoice:i,payment:n,payOptions:l,noPaymentMethod:s}=S();return a(L,{num:"N° 04",title:"Payment",children:[s&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:ce}),e("div",{className:"grid gap-3",children:l.map(c=>e(E,{active:t===c.key,onClick:()=>i(c.key),title:c.title,body:c.body,price:c.price,tag:c.tag},c.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Ue(){const{site:t,items:i,totals:n,coupon:l,formatMoney:s,payChoice:c,placing:f,email:y,orderError:b,payment:h,noPaymentMethod:x,unpaidOrder:o,formLocked:d,restoredPrices:p,placeOrder:C}=S(),m=p==="waiting",w=p==="changed";return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(M,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(M,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(N=>e(fe,{slug:N.slug,name:N.name,qty:N.qty,config:N.config,configSummary:xe(N.config),price:w||m?null:Z(N,n.currency)??0,currency:n.currency},N.id))}),e(ue,{locked:d,className:"border-t border-line px-6 pt-5",children:e(te,{customerEmail:y,disabled:d})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(k,{label:"Subtotal",value:m?P:s(w?n.serverSubtotal??0:n.subtotal,n.currency)}),n.discount>0&&l?.valid&&e(k,{label:`Coupon · ${l.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",s(n.discount,n.currency)]})}),l?.deferred&&e(k,{label:`Coupon · ${l.code}`,value:ne}),l?.valid&&l.effects?.gift&&e(k,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:O})}),e(k,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:O}):ie(n.shippingStatus)??s(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(k,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:s(n.tax.amount,n.currency)}):n.tax.name?e(k,{label:n.tax.name,value:le}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?P:s(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[w&&e(_,{tone:"quiet",children:re}),b&&e(_,{role:"alert",children:b}),n.hasUnpricedLine&&a(_,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:C,disabled:f||!o&&(x||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",f||!o&&(i.length===0||x||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:f?a(v,{children:["Building order… ",e("span",{children:"·"})]}):x?a(v,{children:["No online payment ",e("span",{children:"·"})]}):o?a(v,{children:["Try payment again · ",ae(o),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):n.repricing?a(v,{children:[P," ",e("span",{children:"·"})]}):a(v,{children:[c==="bank"?"Place order":"Continue to payment"," ·"," ",s(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const me=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function ue({locked:t,className:i="",children:n}){return e("fieldset",{disabled:t,className:"m-0 min-w-0 border-0 p-0 "+i+me,children:n})}function M({href:t,className:i="",children:n,...l}){const{placing:s}=S();return s?e("span",{"aria-disabled":"true","aria-label":l["aria-label"],className:i+" pointer-events-none",children:n}):e(X,{href:t,"aria-label":l["aria-label"],className:i,children:n})}function he({orderNumber:t}){return e(_,{tone:"quiet",role:"status",children:a("span",{className:"flex items-start gap-2",children:[a("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[e("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),e("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),e("span",{children:de(t)})]})})}const Y={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function L({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function U({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function E({active:t,onClick:i,title:n,body:l,price:s,tag:c}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,c&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:c})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:s})]})}function ge({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function fe({slug:t,name:i,qty:n,config:l,configSummary:s,price:c,currency:f}){const{catalog:y}=J(),{formatMoney:b}=ee(),h=y.find(m=>m.slug===t),x=h?.spokes??5,o=h?.mesh??!1,d=l.find(m=>m.gold)?.label,p=h?.finishes.find(m=>m.name===d&&m.src)??h?.finishes.find(m=>m.src),C=h?.finishes[0]?.color??oe;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative aspect-square",children:[e("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:p?.src?e(V,{src:p.src,alt:`${i.lead}${i.accent} — ${p.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:C},children:e(se,{spokes:x,mesh:o,className:"block w-full"})})}),e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:s})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:c===null?null:b(c,f)})]})}function k({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function xe(t){return t.map(i=>i.label).join(" · ")}export{$e as CheckoutContact,Ue as CheckoutOrderSummary,Ye as CheckoutPayment,De as CheckoutShippingAddress,Me as CheckoutShippingMethod,ue as FormLock,M as LeaveLink};
|
|
1
|
+
"use client";import{jsx as e,Fragment as v,jsxs as a}from"react/jsx-runtime";import{useId as j}from"react";import V from"next/image";import X from"next/link";import{lineTotal as Z,useCart as J}from"../CartContext.js";import{useCurrency as ee}from"../CurrencyContext.js";import{Notice as _}from"../Notice.js";import{FREE_PRICE as O}from"../../lib/wheels/price-display.js";import te from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as ne}from"../../lib/cart/coupon-preview.js";import{orderReference as ae}from"../../lib/checkout/pay-first.js";import{PRICES_REQUOTED as re}from"../../lib/checkout/checkout-memory.js";import{shippingWords as ie,TAX_PENDING as le}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as oe}from"../../lib/wheels/finish-defaults.js";import D from"../ThemedSelect.js";import g from"../WebFormField.js";import se from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as ce,placedOrderLockNote as de,SHIPPING_RETRY_NOTE as pe,useCheckout as S}from"./checkout-state.js";import{FIELD_INPUT_CLASS as u}from"../../lib/field-input.js";import{FIGURE_UPDATING as P}from"../../lib/wheels/price-display.js";function $e(){const{email:t,setEmail:i,firstName:n,setFirstName:l,lastName:c,setLastName:d,company:f,setCompany:y,me:b,checkoutSignOut:h,orderLocked:x,unpaidOrder:o}=S(),s=j();return a(L,{num:"N° 01",title:"Contact",children:[x&&o&&e(he,{orderNumber:o.orderNumber}),e(g,{label:"Email",htmlFor:s,hint:b?a(v,{children:["Signed in ·"," ",e("button",{type:"button",onClick:h,className:"underline transition-colors enabled:hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{id:s,type:"email",value:t,onChange:p=>i(p.target.value),placeholder:"you@example.com",readOnly:b!==null,className:u})}),a(U,{children:[e(g,{label:"First name",children:e("input",{type:"text",value:n,onChange:p=>l(p.target.value),className:u})}),e(g,{label:"Last name",children:e("input",{type:"text",value:c,onChange:p=>d(p.target.value),className:u})})]}),e(g,{label:"Company (optional)",children:e("input",{type:"text",value:f,onChange:p=>y(p.target.value),autoComplete:"organization",className:u})})]})}function De(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:l,address2:c,setAddress2:d,city:f,setCity:y,postcode:b,setPostcode:h,phone:x,setPhone:o,country:s,setCountry:p,subdivision:C,setSubdivision:m,subdivisions:w,destination:N,postcodeLabel:q,subdivisionLabel:z,me:A,savedAddresses:B,selectedAddressId:I,setSelectedAddressId:T,saveAddress:R,setSaveAddress:H,saveLabel:G,setSaveLabel:W,fillFromAddress:K,orderLocked:Q}=S(),$=j(),F=j();return a(L,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.readyIn&&e("span",{className:"opacity-80",children:t.readyIn}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(v,{children:[A!==null&&B.length>0&&a("div",{className:"grid gap-3",children:[B.map(r=>e(E,{active:I===r.id,onClick:()=>{T(r.id),K(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(E,{active:I==="new",onClick:()=>T("new"),title:"New address",body:null,price:null})]}),e(g,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>l(r.target.value),className:u})}),e(g,{label:"Address line 2",children:e("input",{type:"text",value:c,onChange:r=>d(r.target.value),placeholder:"Apartment, unit, garage bay…",className:u})}),a(U,{cols:"three",children:[e(g,{label:"City",children:e("input",{type:"text",value:f,onChange:r=>y(r.target.value),className:u})}),e(g,{label:q,children:e("input",{type:"text",value:b,onChange:r=>h(r.target.value),className:u})}),e(g,{label:"Country",separate:!0,htmlFor:$,children:e(D,{id:$,value:s,onChange:r=>p(r.target.value),className:u+" pr-10",style:Y,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(g,{label:z,separate:!0,htmlFor:F,children:w.length>0?a(D,{id:F,value:C,onChange:r=>m(r.target.value),className:u+" pr-10",style:Y,children:[e("option",{value:"",children:"Select…"}),w.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:F,type:"text",value:C,onChange:r=>m(r.target.value),className:u})})]}),e(g,{label:"Phone",children:e("input",{type:"tel",value:x,onChange:r=>o(r.target.value),className:u})}),!t&&A!==null&&I==="new"&&!Q&&a(v,{children:[e(ge,{checked:R,onChange:H,label:"Save this address to my account"}),R&&e(g,{label:"Address label",children:e("input",{type:"text",value:G,onChange:r=>W(r.target.value),placeholder:"Home",className:u})})]})]})}function Me(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:l,setShippingMethodId:c,pickupLocation:d,formatMoney:f,city:y,destination:b,courierUnavailable:h,retryCourier:x}=S();return e(L,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(o=>{const s=o.pickupLocation,p=s?[s.address,s.city,s.state,s.zipCode].filter(Boolean).join(", "):null;return e(E,{active:l===o.id,onClick:()=>c(o.id),title:s?`${o.name} — ${s.name}`:o.name,body:s?[p,s.openingHours,s.readyIn,s.instructions,o.description].filter(Boolean).join(" · "):o.description||null,price:t.freeShipping||o.amount===0?O:f(o.amount,t.currency),tag:o.tag||void 0},o.id)}),h?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[pe," ",e("button",{type:"button",onClick:x,className:"underline transition-colors enabled:hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Ye(){const{payChoice:t,setPayChoice:i,payment:n,payOptions:l,noPaymentMethod:c}=S();return a(L,{num:"N° 04",title:"Payment",children:[c&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:ce}),e("div",{className:"grid gap-3",children:l.map(d=>e(E,{active:t===d.key,onClick:()=>i(d.key),title:d.title,body:d.body,price:d.price,tag:d.tag},d.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Ue(){const{site:t,items:i,totals:n,coupon:l,formatMoney:c,payChoice:d,placing:f,email:y,orderError:b,payment:h,noPaymentMethod:x,unpaidOrder:o,formLocked:s,restoredPrices:p,placeOrder:C}=S(),m=p==="waiting",w=p==="changed";return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(M,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(M,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(N=>e(fe,{slug:N.slug,name:N.name,qty:N.qty,config:N.config,configSummary:xe(N.config),price:w||m?null:Z(N,n.currency)??0,currency:n.currency},N.id))}),e(ue,{locked:s,className:"border-t border-line px-6 pt-5",children:e(te,{customerEmail:y,disabled:s})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(k,{label:"Subtotal",value:m?P:c(w?n.serverSubtotal??0:n.subtotal,n.currency)}),n.discount>0&&l?.valid&&e(k,{label:`Coupon · ${l.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",c(n.discount,n.currency)]})}),l?.deferred&&e(k,{label:`Coupon · ${l.code}`,value:ne}),l?.valid&&l.effects?.gift&&e(k,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:O})}),e(k,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:O}):ie(n.shippingStatus)??c(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(k,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:c(n.tax.amount,n.currency)}):n.tax.name?e(k,{label:n.tax.name,value:le}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?P:c(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[w&&e(_,{tone:"quiet",children:re}),b&&e(_,{role:"alert",children:b}),n.hasUnpricedLine&&a(_,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:C,disabled:f||!o&&(x||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",f||!o&&(i.length===0||x||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:f?a(v,{children:["Building order… ",e("span",{children:"·"})]}):x?a(v,{children:["No online payment ",e("span",{children:"·"})]}):o?a(v,{children:["Try payment again · ",ae(o),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):n.repricing?a(v,{children:[P," ",e("span",{children:"·"})]}):a(v,{children:[d==="bank"?"Place order":"Continue to payment"," ·"," ",c(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const me=" [&:disabled_:disabled]:cursor-not-allowed! [&:disabled_:disabled]:opacity-70! [&_input[readonly]]:cursor-not-allowed [&_input[readonly]]:opacity-70";function ue({locked:t,className:i="",children:n}){return e("fieldset",{disabled:t,className:"m-0 min-w-0 border-0 p-0 "+i+me,children:n})}function M({href:t,className:i="",children:n,...l}){const{placing:c}=S();return c?e("span",{"aria-disabled":"true","aria-label":l["aria-label"],className:i+" pointer-events-none",children:n}):e(X,{href:t,"aria-label":l["aria-label"],className:i,children:n})}function he({orderNumber:t}){return e(_,{tone:"quiet",role:"status",children:a("span",{className:"flex items-start gap-2",children:[a("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[e("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),e("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),e("span",{children:de(t)})]})})}const Y={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function L({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function U({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function E({active:t,onClick:i,title:n,body:l,price:c,tag:d}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line enabled:hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,d&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:d})]}),l&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:l})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:c})]})}function ge({checked:t,onChange:i,label:n,sub:l}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,l&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:l})]})]})}function fe({slug:t,name:i,qty:n,config:l,configSummary:c,price:d,currency:f}){const{catalog:y}=J(),{formatMoney:b}=ee(),h=y.find(m=>m.slug===t),x=h?.spokes??5,o=h?.mesh??!1,s=l.find(m=>m.gold)?.label,p=h?.finishes.find(m=>m.name===s&&m.src)??h?.finishes.find(m=>m.src),C=h?.finishes[0]?.color??oe;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative aspect-square",children:[e("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:p?.src?e(V,{src:p.src,alt:`${i.lead}${i.accent} — ${p.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:C},children:e(se,{spokes:x,mesh:o,className:"block w-full"})})}),e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:c})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:d===null?null:b(d,f)})]})}function k({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function xe(t){return t.map(i=>i.label).join(" · ")}export{$e as CheckoutContact,Ue as CheckoutOrderSummary,Ye as CheckoutPayment,De as CheckoutShippingAddress,Me as CheckoutShippingMethod,ue as FormLock,M as LeaveLink};
|
|
@@ -94,6 +94,7 @@ declare function useCheckoutState({ site, logo, preview }: CheckoutProps): {
|
|
|
94
94
|
country: string;
|
|
95
95
|
openingHours: string;
|
|
96
96
|
instructions: string;
|
|
97
|
+
readyIn?: string;
|
|
97
98
|
} | null;
|
|
98
99
|
servedCountries: import("../../lib/content/site.js").SiteCountry[];
|
|
99
100
|
formatMoney: (amount: number, currency?: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as i,Fragment as x}from"react/jsx-runtime";import P from"../SectionBand.js";import S from"next/link";import{useEffect as M,useMemo as F,useRef as $}from"react";import{appendVehicleParams as E}from"../../lib/wheels/plp-vehicle-params.js";import{linkParts as j}from"../../lib/links/link-rules.js";import{shopHrefForVehicle as L,shouldLeaveForTheShop as z}from"../../lib/wheels/picker-goes-to-the-shop.js";import T from"efficient-web-builder/render/components/SectionHeader";import{withRMark as V}from"efficient-web-builder/render/components/RMark";import k from"./FitmentPickerGrid.js";import _ from"./StockFitmentCard.js";import{useVehicleFit as O}from"./useVehicleFit.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const f={body:"text-[length:var(--size-body,18px)]",headingSmall:"text-[length:var(--size-headingSmall,30px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,14px)]"};function Y(l,n,s){if(!s)return l;const{path:c,query:m,hash:h}=j(l),r=E(new URLSearchParams(m),n).toString();return`${c}${r?`?${r}`:""}${h}`}function q({num:l,title:n,description:s,ctaText:c,ctaHref:m,layout:h="full",omitHead:r=!1,initialMakes:b=[],editing:o=!1}){const{cascade:e}=O({initialMakes:b,editing:o,autoApply:!0}),a=h==="bar",u=$(!1),w=F(()=>{if(!a)return e;const d=y=>(...N)=>{u.current=!0,y(...N)};return{...e,setMake:d(e.setMake),setModel:d(e.setModel),setYear:d(e.setYear),setModification:d(e.setModification)}},[a,e]);M(()=>{a&&(typeof window>"u"||z({shopperPicked:u.current,fullyPicked:e.fullyPicked,editing:o,pathname:window.location.pathname})&&window.location.assign(L(e.vehicle)))},[a,e.fullyPicked,e.vehicle,o]);const v=!r&&!a&&!!(l||n||s),p=!a&&c&&m?{text:c,href:m}:null,g=p?Y(p.href,e.vehicle,e.fullyPicked):null;return i(P,{className:a?r?"pt-0 pb-8 max-view-desktop:pb-5":"py-8 max-view-desktop:py-5":r?"pt-0 pb-20 max-view-desktop:pb-[60px]":"py-20 max-view-desktop:py-[60px]",children:[v&&t(T,{num:l,title:n,description:s,accent:!0}),a?i("div",{className:"flex flex-wrap items-center gap-5",children:[!r&&n?.trim()&&t("p",{className:`font-heading3 ${f.headingSmall} [font-weight:var(--sf-heading-weight-strong,600)] leading-none tracking-[-0.02em] whitespace-nowrap`,children:V(n)}),t("div",{className:"min-w-[320px] flex-1 basis-0",children:t(k,{cascade:w,compact:!0,editing:o})})]}):t(k,{cascade:e,editing:o}),!a&&t(_,{loading:e.loading.stock,error:e.
|
|
1
|
+
"use client";import{jsx as t,jsxs as i,Fragment as x}from"react/jsx-runtime";import P from"../SectionBand.js";import S from"next/link";import{useEffect as M,useMemo as F,useRef as $}from"react";import{appendVehicleParams as E}from"../../lib/wheels/plp-vehicle-params.js";import{linkParts as j}from"../../lib/links/link-rules.js";import{shopHrefForVehicle as L,shouldLeaveForTheShop as z}from"../../lib/wheels/picker-goes-to-the-shop.js";import T from"efficient-web-builder/render/components/SectionHeader";import{withRMark as V}from"efficient-web-builder/render/components/RMark";import k from"./FitmentPickerGrid.js";import _ from"./StockFitmentCard.js";import{useVehicleFit as O}from"./useVehicleFit.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const f={body:"text-[length:var(--size-body,18px)]",headingSmall:"text-[length:var(--size-headingSmall,30px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,14px)]"};function Y(l,n,s){if(!s)return l;const{path:c,query:m,hash:h}=j(l),r=E(new URLSearchParams(m),n).toString();return`${c}${r?`?${r}`:""}${h}`}function q({num:l,title:n,description:s,ctaText:c,ctaHref:m,layout:h="full",omitHead:r=!1,initialMakes:b=[],editing:o=!1}){const{cascade:e}=O({initialMakes:b,editing:o,autoApply:!0}),a=h==="bar",u=$(!1),w=F(()=>{if(!a)return e;const d=y=>(...N)=>{u.current=!0,y(...N)};return{...e,setMake:d(e.setMake),setModel:d(e.setModel),setYear:d(e.setYear),setModification:d(e.setModification)}},[a,e]);M(()=>{a&&(typeof window>"u"||z({shopperPicked:u.current,fullyPicked:e.fullyPicked,editing:o,pathname:window.location.pathname})&&window.location.assign(L(e.vehicle)))},[a,e.fullyPicked,e.vehicle,o]);const v=!r&&!a&&!!(l||n||s),p=!a&&c&&m?{text:c,href:m}:null,g=p?Y(p.href,e.vehicle,e.fullyPicked):null;return i(P,{className:a?r?"pt-0 pb-8 max-view-desktop:pb-5":"py-8 max-view-desktop:py-5":r?"pt-0 pb-20 max-view-desktop:pb-[60px]":"py-20 max-view-desktop:py-[60px]",children:[v&&t(T,{num:l,title:n,description:s,accent:!0}),a?i("div",{className:"flex flex-wrap items-center gap-5",children:[!r&&n?.trim()&&t("p",{className:`font-heading3 ${f.headingSmall} [font-weight:var(--sf-heading-weight-strong,600)] leading-none tracking-[-0.02em] whitespace-nowrap`,children:V(n)}),t("div",{className:"min-w-[320px] flex-1 basis-0",children:t(k,{cascade:w,compact:!0,editing:o})})]}):t(k,{cascade:e,editing:o}),!a&&t(_,{loading:e.loading.stock,error:e.stockError,data:e.fullyPicked?e.stock:null}),!a&&i("div",{className:"mt-10 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-8",children:[t("p",{className:`max-w-[680px] font-serif ${f.body} italic leading-[1.55] text-fg-dim`,children:e.fullyPicked?i(x,{children:["Your car ·"," ",i("strong",{className:"font-display [font-weight:var(--sf-heading-weight-strong,500)] not-italic text-fg",children:[e.vehicle.year," ",e.makeName," ",e.modelName," ",e.modName]}),e.stock&&t("span",{className:"ml-3 not-italic text-accent",children:"OEM fitment loaded."})]}):i(x,{children:["Tell us four things — ",t("em",{className:"not-italic text-accent",children:"make, model, year, trim"})," — and we'll show the OEM stock fitment for your car."]})}),p&&g&&i(S,{href:g,className:`group inline-flex items-center gap-4 border border-btn bg-btn px-8 py-5 font-mono ${f.labelLarge} uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg`,children:[p.text,t("span",{className:"transition-transform group-hover:translate-x-[4px]",children:"→"})]})]}),o&&e.makeOptions.length===0&&!e.loading.models&&t("p",{className:`mt-4 font-mono ${f.labelSmall} uppercase tracking-[0.24em] text-fg-dim`,children:R("Vehicle catalog unavailable in this preview — the picker fills from the live fitment API on the published site.")})]})}export{q as default,Y as fitmentCtaHref};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as p}from"react/jsx-runtime";import{PickerField as
|
|
1
|
+
"use client";import{jsx as s,jsxs as p}from"react/jsx-runtime";import{PickerField as a}from"./PickerField.js";import{vehicleLevelStates as f}from"./vehicle-level-state.js";import{VEHICLE_FIELD_LABEL as t}from"../../lib/wheels/vehicle-field-focus.js";import{HideTaker as g}from"efficient-web-builder/render/components/ViewHideRoot";const b={1:"grid-cols-1",2:"grid-cols-2",3:"grid-cols-3",4:"grid-cols-4"},u={1:"max-view-tablet:grid-cols-1",2:"max-view-tablet:grid-cols-2",3:"max-view-tablet:grid-cols-3",4:"max-view-tablet:grid-cols-4"},c=e=>e===1||e===2||e===3||e===4?e:void 0;function h(e,l,r){const d=c(l),n=c(r);if(d===void 0&&n===void 0)return e?"grid-cols-1 @min-[20rem]:grid-cols-2 @min-[39rem]:grid-cols-4":"grid-cols-4 max-view-desktop:grid-cols-2 max-[700px]:grid-cols-1";const o=d!==void 0?b[d]:e?"grid-cols-1 @min-[20rem]:grid-cols-2 @min-[39rem]:grid-cols-4":"grid-cols-4 max-view-desktop:grid-cols-2";return n!==void 0?`${o} ${u[n]}`:o}function x({cascade:e,compact:l=!1,editing:r=!1,columns:d,columnsPhone:n}){const{vehicle:o}=e,i=f(e),m=p(g,{className:["grid gap-[2px] border border-line bg-line",h(l,d,n)].join(" "),children:[s(a,{label:t.make,placeholder:i.make.placeholder,disabled:i.make.disabled,failed:i.make.failed,value:o.make,options:e.makeOptions,onChange:e.setMake,compact:l,editing:r}),s(a,{label:t.model,placeholder:i.model.placeholder,disabled:i.model.disabled,failed:i.model.failed,value:o.model,options:e.modelOptions,onChange:e.setModel,compact:l,editing:r}),s(a,{label:t.year,placeholder:i.year.placeholder,disabled:i.year.disabled,failed:i.year.failed,value:o.year!==null?String(o.year):"",options:e.yearOptions,onChange:e.setYear,compact:l,editing:r}),s(a,{label:t.trim,placeholder:i.trim.placeholder,disabled:i.trim.disabled,failed:i.trim.failed,value:o.modification,options:e.modOptions,onChange:e.setModification,compact:l,editing:r})]});return l?s(g,{className:"@container",children:m}):m}export{x as default,h as pickerGridColumns};
|
|
@@ -4,13 +4,14 @@ export interface PickerOption {
|
|
|
4
4
|
label: string;
|
|
5
5
|
}
|
|
6
6
|
export declare function pickerItems(options: readonly PickerOption[], placeholder?: string): SelectItem[];
|
|
7
|
-
export declare function PickerField({ label, value, options, onChange, placeholder, disabled, compact, editing, }: {
|
|
7
|
+
export declare function PickerField({ label, value, options, onChange, placeholder, disabled, failed, compact, editing, }: {
|
|
8
8
|
label: string;
|
|
9
9
|
value: string;
|
|
10
10
|
options: PickerOption[];
|
|
11
11
|
onChange: (v: string) => void;
|
|
12
12
|
placeholder?: string;
|
|
13
13
|
disabled?: boolean;
|
|
14
|
+
failed?: boolean;
|
|
14
15
|
compact?: boolean;
|
|
15
16
|
editing?: boolean;
|
|
16
17
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as
|
|
1
|
+
"use client";import{jsx as a,jsxs as g}from"react/jsx-runtime";import u from"efficient-web-builder/render/components/PartStyledKind";import{ThemedSelectList as I,useThemedSelect as T}from"../ThemedSelect.js";import{PART_KIND_ATTR as b}from"efficient-web-builder/render/lib/document/text-parts";import{TEXT_KIND_BODY as h,TEXT_KIND_NAME as v}from"efficient-web-builder/format/lib/sections/section-text-kinds";const n={body:"text-[length:var(--size-body,15px)]",headingSmall:"text-[length:var(--size-headingSmall,24px)]",labelXs:"text-[length:var(--size-label,10px)]",labelSmall:"text-[length:var(--size-label,11px)]",labelLarge:"text-[length:var(--size-label,12px)]",labelXl:"text-[length:var(--size-label,14px)]"};function k(o,t){return[{value:"",label:t??"—"},...o.map(i=>({value:i.value,label:i.label}))]}function z({label:o,value:t,options:i,onChange:y,placeholder:d,disabled:l,failed:x=!1,compact:s=!1,editing:m=!1}){const c=(i.find(r=>r.value===t)?.label??t)||d||"—",f=k(i,d),e=T({items:f,value:t,onPick:y}),p=e.open;return g("div",{ref:e.wrapRef,className:"relative min-w-0",children:[g("div",{ref:r=>{e.triggerRef.current=r},role:"button",tabIndex:l?-1:0,"aria-haspopup":"listbox","aria-expanded":p,"aria-controls":p?e.listId:void 0,"aria-activedescendant":e.activeId,"aria-label":`${o}, ${c}`,"aria-disabled":l||void 0,onClick:()=>!l&&e.toggle(),onKeyDown:r=>!l&&e.onTriggerKeyDown(r),className:["relative flex h-full flex-col bg-bg transition-colors",s?"gap-1 px-3 py-3":"min-h-[160px] gap-4 px-6 py-8",x?"":l?"opacity-50":"cursor-pointer hover:bg-surface"].join(" "),children:[a("span",{...m?{[b]:v}:{},className:["font-mono uppercase text-accent",s?`${n.labelXs} tracking-[0.2em]`:`${n.labelLarge} tracking-[0.3em]`].join(" "),children:a(u,{kind:v,children:o})}),a("span",{title:c,className:["truncate font-display font-medium tracking-[-0.02em]",s?`${n.body} leading-[1.2]`:`mt-auto ${n.headingSmall} leading-[1.1]`,t?"text-fg":x?"text-alert":"text-fg-dim"].join(" "),...m?{[b]:h}:{},children:a(u,{kind:h,children:c})}),a("span",{className:["pointer-events-none absolute font-mono text-accent",s?`right-3 top-3 ${n.labelSmall}`:`right-[22px] top-[22px] ${n.labelXl}`].join(" "),children:"▾"})]}),p&&!l&&a(I,{id:e.listId,tone:"cell",items:f,value:t,focusIdx:e.focusIdx,onFocus:e.setFocusIdx,onPick:e.pick,listRef:e.listRef})]})}export{z as PickerField,k as pickerItems};
|
|
@@ -20,6 +20,8 @@ export interface FitmentCascade {
|
|
|
20
20
|
yearOptions: PickerOption[];
|
|
21
21
|
modOptions: PickerOption[];
|
|
22
22
|
loading: CascadeLoading;
|
|
23
|
+
failed: CascadeFailed;
|
|
24
|
+
stockError: string | null;
|
|
23
25
|
cascadeError: string | null;
|
|
24
26
|
stock: StockFitment | null;
|
|
25
27
|
fullyPicked: boolean;
|
|
@@ -27,5 +29,11 @@ export interface FitmentCascade {
|
|
|
27
29
|
modelName: string;
|
|
28
30
|
modName: string;
|
|
29
31
|
}
|
|
32
|
+
export interface CascadeFailed {
|
|
33
|
+
makes?: boolean;
|
|
34
|
+
models?: boolean;
|
|
35
|
+
years?: boolean;
|
|
36
|
+
modifications?: boolean;
|
|
37
|
+
}
|
|
30
38
|
export declare function useFitmentCascade(initialMakes?: FitmentMake[], enabled?: boolean): FitmentCascade;
|
|
31
39
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useCallback as
|
|
1
|
+
import{useCallback as u,useEffect as r,useMemo as k,useState as o}from"react";import{fitment as f}from"../../lib/api/index.js";import{DEFAULT_VEHICLE as Q}from"../../lib/wheels/fitment-options.js";function R(i){return i instanceof Error?i.message:String(i)}function ee(i=[],y=!0){const[t,m]=o(Q),[g,L]=o(i),[h,p]=o([]),[S,M]=o([]),[c,E]=o([]),[N,T]=o(null),[O,l]=o({makes:y&&i.length===0}),[d,Y]=o({}),[b,F]=o(null),n=(e,a)=>Y(s=>!!s[e]===a?s:{...s,[e]:a}),[v,C]=o(0),[V,x]=o(0),[A,D]=o(0);r(()=>{y&&i.length===0&&(l(e=>({...e,makes:!0})),f.listMakes().then(e=>{L(e),n("makes",!1)}).catch(()=>n("makes",!0)).finally(()=>l(e=>({...e,makes:!1}))))},[y,i.length]),r(()=>{if(n("models",!1),!t.make){p([]);return}let e=!1;return l(a=>({...a,models:!0})),f.listModels(t.make).then(a=>{e||p(a)}).catch(()=>{e||(p([]),n("models",!0))}).finally(()=>{e||l(a=>({...a,models:!1}))}),()=>{e=!0}},[t.make,v]),r(()=>{if(n("years",!1),!t.make||!t.model){M([]);return}let e=!1;return l(a=>({...a,years:!0})),f.listYears(t.make,t.model).then(a=>{e||M(a)}).catch(()=>{e||(M([]),n("years",!0))}).finally(()=>{e||l(a=>({...a,years:!1}))}),()=>{e=!0}},[t.make,t.model,V]),r(()=>{if(n("modifications",!1),!t.make||!t.model||t.year===null){E([]);return}let e=!1;return l(a=>({...a,modifications:!0})),f.listModifications(t.make,t.model,t.year).then(a=>{e||E(a)}).catch(()=>{e||(E([]),n("modifications",!0))}).finally(()=>{e||l(a=>({...a,modifications:!1}))}),()=>{e=!0}},[t.make,t.model,t.year,A]),r(()=>{const e=t.year!==null&&t.make&&t.model&&t.modification;if(F(null),!e){T(null);return}let a=!1;return l(s=>({...s,stock:!0})),f.getStockFitment(t.make,t.model,t.year,t.modification).then(s=>{a||T(s)}).catch(s=>{a||F(R(s))}).finally(()=>{a||l(s=>({...s,stock:!1}))}),()=>{a=!0}},[t.make,t.model,t.year,t.modification]),r(()=>{t.year!==null&&t.make&&t.model&&!t.modification&&c.length===1&&m(e=>({...e,modification:c[0].slug}))},[t.year,t.make,t.model,t.modification,c]);const H=u(e=>{m(a=>({...a,make:e,model:"",year:null,modification:""})),C(a=>a+1)},[]),I=u(e=>{m(a=>({...a,model:e,year:null,modification:""})),x(a=>a+1)},[]),P=u(e=>{m(a=>({...a,year:e?Number(e):null,modification:""})),D(a=>a+1)},[]),U=u(e=>m(a=>({...a,modification:e})),[]),_=k(()=>S.map(e=>({value:String(e),label:String(e)})),[S]),j=k(()=>g.map(e=>({value:e.slug,label:e.name})),[g]),q=k(()=>h.map(e=>({value:e.slug,label:e.name})),[h]),w=k(()=>c.map(e=>({value:e.slug,label:e.name})),[c]),z=t.year!==null&&!!t.make&&!!t.model&&!!t.modification,B=g.find(e=>e.slug===t.make)?.name??t.make,G=h.find(e=>e.slug===t.model)?.name??t.model,J=c.find(e=>e.slug===t.modification)?.name??t.modification,K=!!(d.makes||d.models||d.years||d.modifications);return{vehicle:t,setVehicle:m,setMake:H,setModel:I,setYear:P,setModification:U,makeOptions:j,modelOptions:q,yearOptions:_,modOptions:w,loading:O,failed:d,stockError:b,cascadeError:b??(K?"Vehicle data could not be loaded":null),stock:N,fullyPicked:z,makeName:B,modelName:G,modName:J}}export{ee as useFitmentCascade};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useCallback as
|
|
1
|
+
"use client";import{useCallback as d,useEffect as h,useMemo as x,useRef as F,useState as S}from"react";import{useFitmentCascade as M}from"./useFitmentCascade.js";import{DEFAULT_VEHICLE as L}from"../../lib/wheels/fitment-options.js";import{vehicleFitmentFromStock as P}from"../../lib/wheels/plp-fitment-match.js";import{clearAppliedVehicle as j}from"../../lib/wheels/applied-vehicle.js";import{isCompleteVehicle as p,vehicleFromParams as B}from"../../lib/wheels/plp-vehicle-params.js";import{storefrontVehicleMemory as a}from"../../lib/wheels/vehicle-memory.js";function b(t,i,r){return t!==i?t:r||i}function D(t,i){return t.make===i.make&&t.model===i.model&&t.modification===i.modification}function m(t,i){return t.make===i.make&&t.model===i.model&&t.year===i.year&&t.modification===i.modification}function z({initialMakes:t=[],editing:i=!1,enabled:r=!0,autoApply:N=!1,shareStock:y=!1}={}){const e=M(t,r),{setVehicle:n}=e,[l,f]=S(null),[C,w]=S(!1),k=d(()=>({make:e.makeName,model:e.modelName,modification:e.modName}),[e.makeName,e.modelName,e.modName]);h(()=>{if(i||!r){w(!0);return}const o=B(new URLSearchParams(window.location.search)),s=o?null:a.read(),c=o??s?.vehicle??null;c&&(n(c),f({vehicle:c,labels:s?.labels??{make:c.make,model:c.model,modification:c.modification},stock:null})),w(!0)},[i,r,n]),h(()=>{if(!(i||!r))return a.subscribe(()=>{const o=a.read();f(c=>o?c&&m(c.vehicle,o.vehicle)?D(c.labels,o.labels)?c:{...c,labels:o.labels}:{vehicle:o.vehicle,labels:o.labels,stock:null}:null);const s=o?.vehicle??L;n(c=>m(c,s)?c:s)})},[i,r,n]),h(()=>{!N||!p(e.vehicle)||l&&m(l.vehicle,e.vehicle)||f({vehicle:e.vehicle,labels:k(),stock:e.stock})},[N,l,e.vehicle,e.stock,k]),h(()=>{if(!l||!m(e.vehicle,l.vehicle))return;const o={make:b(e.makeName,e.vehicle.make,l.labels.make),model:b(e.modelName,e.vehicle.model,l.labels.model),modification:b(e.modName,e.vehicle.modification,l.labels.modification)};(l.stock!==e.stock||l.labels.make!==o.make||l.labels.model!==o.model||l.labels.modification!==o.modification)&&f(c=>c&&m(e.vehicle,c.vehicle)?{...c,stock:e.stock,labels:o}:c)},[l,e.vehicle,e.stock,e.makeName,e.modelName,e.modName]);const u=F("");h(()=>{if(!(i||!r))try{if(!l){u.current!==""&&(a.clear(),u.current="");return}const o=JSON.stringify({vehicle:l.vehicle,labels:l.labels});if(o===u.current)return;a.write({vehicle:l.vehicle,labels:l.labels}),u.current=o}catch{}},[l,i,r]);const v=F(!1);h(()=>{if(!y||!r)return;if(!l){v.current&&a.writeStock(null),v.current=!1;return}if(!m(e.vehicle,l.vehicle))return;const o=e.loading.stock!==!1,s=a.readStock();s&&m(s.vehicle,l.vehicle)&&s.stock===e.stock&&s.loading===o&&s.error===e.stockError||(a.writeStock({vehicle:l.vehicle,stock:e.stock,loading:o,error:e.stockError}),v.current=!0)},[y,r,l,e.vehicle,e.stock,e.loading.stock,e.stockError]);const A=d(()=>{p(e.vehicle)&&f({vehicle:e.vehicle,labels:k(),stock:e.stock})},[e.vehicle,e.stock,k]),R=d(()=>{f(null),n(L),!i&&r&&j()},[i,r,n]),E=x(()=>P(l?.stock),[l?.stock]),V=!!l&&m(e.vehicle,l.vehicle)&&e.loading.stock!==!1,U=l?[l.vehicle.year,l.labels.make,l.labels.model,l.labels.modification].filter(Boolean).join(" "):"";return{cascade:e,applied:l,fit:E,resolving:V,unresolved:!!l&&E===null&&!V,apply:A,clear:R,canApply:p(e.vehicle),appliedName:U,restored:C}}export{z as useVehicleFit};
|
|
@@ -4,6 +4,7 @@ import { VEHICLE_FIELD_ORDER, type VehicleField } from "../../lib/wheels/vehicle
|
|
|
4
4
|
export interface VehicleLevelState {
|
|
5
5
|
placeholder: string;
|
|
6
6
|
disabled: boolean;
|
|
7
|
+
failed?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const VEHICLE_FIELD_NEEDED: Record<VehicleField, string>;
|
|
9
10
|
export declare function vehicleLevelStates(cascade: FitmentCascade): Record<VehicleField, VehicleLevelState>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{VEHICLE_FIELD_ORDER as
|
|
1
|
+
import{VEHICLE_FIELD_ORDER as p}from"../../lib/wheels/vehicle-field-focus.js";const o={make:"Pick a make first",model:"Pick a model first",year:"Pick a year first",trim:"Pick a trim first"};function a({parentPicked:e,loading:i,failed:l,options:t,waiting:r,loadingLabel:n,readyLabel:d,emptyLabel:m,failedLabel:s}){return e?i?{placeholder:n,disabled:!0}:l?{placeholder:s,disabled:!0,failed:!0}:t.length===0?{placeholder:m,disabled:!0}:{placeholder:d,disabled:!1}:{placeholder:r,disabled:!0}}function u(e){const{vehicle:i,loading:l,failed:t}=e;return{make:a({parentPicked:!0,loading:l.makes,failed:t.makes,failedLabel:"Couldn't load makes",options:e.makeOptions,waiting:"",loadingLabel:"Loading makes…",readyLabel:"Select make",emptyLabel:"Vehicle list unavailable"}),model:a({parentPicked:!!i.make,loading:l.models,failed:t.models,failedLabel:"Couldn't load models",options:e.modelOptions,waiting:o.make,loadingLabel:"Loading models…",readyLabel:"Select model",emptyLabel:"No models listed"}),year:a({parentPicked:!!i.model,loading:l.years,failed:t.years,failedLabel:"Couldn't load years",options:e.yearOptions,waiting:o.model,loadingLabel:"Loading years…",readyLabel:"Select year",emptyLabel:"No years listed"}),trim:a({parentPicked:i.year!==null,loading:l.modifications,failed:t.modifications,failedLabel:"Couldn't load trims",options:e.modOptions,waiting:o.year,loadingLabel:"Loading trims…",readyLabel:"Select trim",emptyLabel:"No trims listed"})}}function y(e){return{make:e.makeOptions,model:e.modelOptions,year:e.yearOptions,trim:e.modOptions}}function L(e){return{make:e.setMake,model:e.setModel,year:e.setYear,trim:e.setModification}}function k(e){const{vehicle:i}=e;return{make:i.make,model:i.model,year:i.year!==null?String(i.year):"",trim:i.modification}}function b(e){const{vehicle:i}=e;return{make:i.make?e.makeName:"",model:i.model?e.modelName:"",year:i.year!==null?String(i.year):"",trim:i.modification?e.modName:""}}export{o as VEHICLE_FIELD_NEEDED,p as VEHICLE_FIELD_ORDER,b as vehicleLevelNames,y as vehicleLevelOptions,L as vehicleLevelSetters,u as vehicleLevelStates,k as vehicleLevelValues};
|
package/dist/words.d.ts
CHANGED
|
@@ -135,9 +135,11 @@ export type WebBuilderPhrase =
|
|
|
135
135
|
| "Add your answer here. Keep it clear and concise so it stays easy to scan."
|
|
136
136
|
| "Add your first question"
|
|
137
137
|
| "Add your numbers."
|
|
138
|
+
| "Add “{name}”"
|
|
138
139
|
| "Address"
|
|
139
140
|
| "After"
|
|
140
141
|
| "All"
|
|
142
|
+
| "All pages"
|
|
141
143
|
| "Alt text"
|
|
142
144
|
| "Alternating"
|
|
143
145
|
| "Alternating (zig-zag)"
|
|
@@ -208,6 +210,7 @@ export type WebBuilderPhrase =
|
|
|
208
210
|
| "Big stat"
|
|
209
211
|
| "Black and white"
|
|
210
212
|
| "Black and white logos"
|
|
213
|
+
| "Blank page"
|
|
211
214
|
| "Block"
|
|
212
215
|
| "Block gap"
|
|
213
216
|
| "Block spacing"
|
|
@@ -303,6 +306,7 @@ export type WebBuilderPhrase =
|
|
|
303
306
|
| "Chip label"
|
|
304
307
|
| "Chips"
|
|
305
308
|
| "Choose a page"
|
|
309
|
+
| "Choose a page and change the text, images and more."
|
|
306
310
|
| "Choose a popup"
|
|
307
311
|
| "Choose a post"
|
|
308
312
|
| "Choose a product"
|
|
@@ -359,6 +363,7 @@ export type WebBuilderPhrase =
|
|
|
359
363
|
| "Couldn’t delete the page — please retry."
|
|
360
364
|
| "Couldn’t duplicate the section — please retry"
|
|
361
365
|
| "Couldn’t load pages"
|
|
366
|
+
| "Couldn’t load the pages — please retry."
|
|
362
367
|
| "Couldn’t open this section."
|
|
363
368
|
| "Couldn’t reach {place}."
|
|
364
369
|
| "Count"
|
|
@@ -556,6 +561,7 @@ export type WebBuilderPhrase =
|
|
|
556
561
|
| "Frequently *asked.*"
|
|
557
562
|
| "From"
|
|
558
563
|
| "From the bottom"
|
|
564
|
+
| "From your template"
|
|
559
565
|
| "Full"
|
|
560
566
|
| "Full width"
|
|
561
567
|
| "Full-bleed intro image the next section scrolls over."
|
|
@@ -825,6 +831,7 @@ export type WebBuilderPhrase =
|
|
|
825
831
|
| "No match (gray ✕)"
|
|
826
832
|
| "No other pages"
|
|
827
833
|
| "No pages match your search"
|
|
834
|
+
| "No pages to start from"
|
|
828
835
|
| "No pages yet. Add one with + above."
|
|
829
836
|
| "No place found. Try another postcode."
|
|
830
837
|
| "No question matches your search."
|
|
@@ -912,6 +919,7 @@ export type WebBuilderPhrase =
|
|
|
912
919
|
| "Page settings for “{name}”"
|
|
913
920
|
| "Page width"
|
|
914
921
|
| "Pages"
|
|
922
|
+
| "Pages for your site"
|
|
915
923
|
| "Panel heading"
|
|
916
924
|
| "Panels & cards"
|
|
917
925
|
| "Panels and cards"
|
|
@@ -1171,6 +1179,7 @@ export type WebBuilderPhrase =
|
|
|
1171
1179
|
| "Stacked"
|
|
1172
1180
|
| "Stacks below"
|
|
1173
1181
|
| "Standard"
|
|
1182
|
+
| "Start with a blank page, then add sections."
|
|
1174
1183
|
| "Starts open"
|
|
1175
1184
|
| "Stat"
|
|
1176
1185
|
| "Stat & note"
|
|
@@ -1684,7 +1693,10 @@ export type StorefrontBlocksPhrase =
|
|
|
1684
1693
|
| "Copyright"
|
|
1685
1694
|
| "Could not load header settings."
|
|
1686
1695
|
| "Could not save. Please retry."
|
|
1696
|
+
| "Couldn’t load menus"
|
|
1697
|
+
| "Couldn’t load this site’s menus."
|
|
1687
1698
|
| "Couldn’t reach the product catalog."
|
|
1699
|
+
| "Couldn’t update the links. Try again:"
|
|
1688
1700
|
| "Country name"
|
|
1689
1701
|
| "Country selector"
|
|
1690
1702
|
| "Counts visits and pages so we can improve the site. Google Analytics and our own visit count."
|