efficient-storefront-blocks 0.130.10 → 0.130.12
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 +33 -0
- package/dist/chunks/{EditorPreviewCheckout-MXKJBKHR.js → EditorPreviewCheckout-QA7Z7CGI.js} +1 -1
- package/dist/chunks/chunk-3SIVGMSB.js +1 -0
- package/dist/index.js +23 -23
- package/dist/links.js +1 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/lib/api/types.d.ts +2 -0
- package/dist/render/lib/catalog/purchase.d.ts +7 -1
- package/dist/render/lib/catalog/purchase.js +1 -1
- package/dist/render/lib/commerce.d.ts +6 -0
- package/dist/render/lib/commerce.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductEyebrow/render.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-4RSMAKOH.js +0 -1
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 I=[{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?I:I.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Ie(e){return`${Z}${e}`}function Re(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(Re(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:Ie(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=R(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"},Ir=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=>It(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=Rt(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 It(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>ze(X(n,r))(Q(e,r)))}function Rt(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,I 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,R 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
|
+
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 Se(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 Pe(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 St=()=>({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=St(),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 Pt="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":Pt},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 Pe(e);case"diameters":return Se(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(P=>ee[u].includes(P))):Tt(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let P=t[u].map(String),ce=new Set,B=new Map,O=new Map;for(let f of e){let S=je(f,u);for(let h of S)ce.add(h);for(let h of new Set(S))O.set(h,(O.get(h)??0)+1);if(At(f,t,n,u,s))for(let h of new Set(S))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:P.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,S)=>{if(u==="diameters")return Number(f.value)-Number(S.value);let h=(O.get(S.value)??0)-(O.get(f.value)??0);return h!==0?h:f.value.localeCompare(S.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>Et),c=[];for(let u of p){let P=It(u.key,r,o);P!==void 0&&c.push({fieldKey:u.key,filterOrder:P})}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 t,jsxs as m,Fragment as T}from"react/jsx-runtime";import{partSkus as Be}from"../lib/catalog/part-skus.js";import ie from"next/link";import{useEffect as oe,useRef as me,useState as Ye}from"react";import{useCart as Ge}from"./CartContext.js";import{useSiteTakesOrders as Qe}from"./SiteRecordContext.js";import We from"./EmailCaptureForm.js";import{useEnglish as ce}from"./EnglishVariant.js";import{MarkedLabel as pe,heroView as Xe}from"./product-hero/hero-view.js";import{HeroOptionLooksProvider as qe,OptionDropdown as Je,OptionLabel as de,optionWords as Ze,useHeroOptionLooks as et}from"./product-hero/OptionLooks.js";import{DEFAULT_HERO_OPTION_LOOKS as tt}from"../lib/sections/hero-option-looks.js";import{useRootIsDark as lt}from"efficient-shell/theme";import{useStockAlertSignup as at}from"./useStockAlertSignup.js";import{SPARE_WORDS as nt,productCartLine as st}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as D}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as rt}from"../lib/catalog/product-options.js";import{trackViewItem as it}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as ot,DEFAULT_HERO_RATIO as mt,DEFAULT_HERO_TEXT_ALIGN as ct,parseHeroLayout as pt,parseHeroRatio as dt,parseHeroTextAlign as ut}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as ft,UNITS_PER_SET as ue,formatPrice as fe}from"../lib/commerce.js";import{formatSelectionPrice as he}from"../lib/wheels/price-display.js";import{productIsDually as ht,productIsTwoObjects as bt,setSuppressesRow as gt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as be}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as vt,STICKY_SECTION_ATTR as xt}from"../lib/sections/hero-sticky.js";import{STAGE_EDGE_ATTR as kt,stageEdgeClass as Tt,stageEdgeCols as yt}from"../lib/sections/hero-stage-edge.js";import{useStickyColumns as St}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as Ot}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as M}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as U}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as _t}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as Nt}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as Et,HERO_TILE_SLOT as Rt}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as Lt,HERO_QUANTITY_PART as wt,HERO_SAVE_PART as Ct}from"../lib/content/hero-buy-seed.js";import{HERO_PART as b}from"../lib/content/hero-seed.js";import At from"./card-pieces/CardQuantity.js";import It from"./card-pieces/CardSave.js";import $t from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as Pt}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as z}from"../lib/document/document-nodes.js";import{withSideOnce as ge}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as Ht}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as ve}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as Dt}from"./SectionPadScope.js";const Mt=4e3;function Ut(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const xe=[{}],zt=(e,s)=>s===wt?t(At,{}):s===Ct?t(It,{}):null,jt="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Ft({product:e,selection:s,onLightbox:i,editing:r=!1,showVehicleFitment:c=!0,heroLayout:n=ot,imageRatio:o=mt,textAlign:l=ct,showSpecTable:O=!0,stickyColumns:Te=!1,stageToEdge:ye=!1,showBreadcrumb:j=!0,nodeId:_,template:Se,optionTemplate:Oe,optionPressTitles:_e,tileTemplate:Ne,buyTemplate:Ee,optionLooks:Re=tt}){const F=Ht(),Le=ce(),u=pt(n),K=ut(l),k=dt(o),N=Te===!0&&u!=="stacked",y=ye===!0&&u!=="stacked",V=me(null);St(V,N);const we=y?yt(k,u==="imageRight"):u==="imageRight"?`${100-k}fr ${k}fr`:`${k}fr ${100-k}fr`,E=y?{gap:"",y:"",yTablet:""}:{gap:"gap-10 ",y:"py-14 ",yTablet:"max-view-tablet:py-8 "},{picked:Ce,pick:B,qty:Y,setQty:Ae,choice:G,setChoice:Ie,angleIdx:Qt,setAngleIdx:Wt,showValidation:$e,setShowValidation:R,manualMode:Q,vehicle:L,rows:W,facts:Pe,part:f,outOfStock:X,offer:w,preOrder:C,canAddToCart:q,currency:g,price:d,set:J,msrpLabel:He}=s,p=Xe(e,s,r),Z=ht(e),De=bt(e),A=c?p.vehicle:null,Me=c?p.vehicleMemory:null,ee=!lt({whenUnset:!0}),{warmCatalog:te}=Ge(),S=Qe();oe(()=>{!r&&S&&te(e.kind,e.slug)},[r,S,e.kind,e.slug,te]);const le=W.filter(a=>!C||a.values.length>0),ae=le.filter(a=>a.role==="resolves"),I=le.filter(a=>a.role==="describes"&&!gt(De,a.key)),ne=I.findIndex(a=>a.chosen===null),se=(!A||!p.vehicleAnswersSpecs||s.fitmentSet)&&rt(W,C)?ne===-1?I:I.slice(0,ne+1):[],Ue=[...ae,...se];function ze(){return q?(R(!1),r?null:st(e,f,Ce,{choice:G,qty:Y},{fitmentLabel:Q?p.specCaption:L.appliedName?`For ${L.appliedName}`:"",fitmentKey:Q?`manual|${p.specCaption}`:`vehicle|${Ut(L.applied?.vehicle)}`})):(R(!0),window.setTimeout(()=>R(!1),Mt),null)}const je={kind:"hero",msrpLabel:He||null,amount:he(d,g),unitLabel:d.priced?p.unitLabel:null,packBadge:d.setTotal!=null?`${w.quantityLabel}: ${fe(J,g)}`:null,buy:{isSet:Z,priced:d.priced,outOfStock:X,canAdd:q,totalLabel:d.setTotal!=null?fe(J,g):null,lineToAdd:ze},qty:Y,setQty:Ae,takesQty:S&&!(Z&&!d.priced),save:{slug:e.slug,name:e.name},facts:O?Pe:null,title:{eyebrow:e.eyebrow,name:p.heading,badge:e.badge||null},product:e,selection:s,openLightbox:i,sku:Be(f),designCode:e.kind==="alloy-wheel"&&e.source.designCode||null,setLine:Bt(d,Vt(w.quantityLabel,e.kind),g)},$={nodeId:_??"",template:Oe,tileTemplate:Ne,pressTitles:_e,editing:r},h=!!(C&&p.preOrder),Fe={[b.fitmentLine]:Me,[b.options]:m(qe,{looks:Re,children:[ae.map(a=>t(ke,{row:a,onPick:B,options:$},a.key)),!h&&A,!h&&se.map(a=>t(ke,{row:a,onPick:B,options:$},a.key))]}),[b.facts]:h?null:t($t,{}),[b.howMany]:h?null:t(Yt,{offer:w,takesOrders:S,choice:G,setChoice:Ie,options:$}),[b.buy]:h?p.preOrder:t(U,{children:t(M,{ownerId:_??"",ownerType:z,slot:Lt,Template:Ee,rows:xe,fallback:null,hostParts:zt,children:a=>a})}),[b.notify]:!h&&X&&f?t(Gt,{partNumbers:f.components.map(a=>a.partNumber),productSlug:e.slug},f.id):null,[b.reminder]:!h&&$e?Ve():null},Ke=(a,v)=>Fe[v]??null;function Ve(){const a=Ue.filter(H=>H.chosen===null).map(H=>Le(H.prompt).replace(/^Select\s+/i,""));if(A&&p.vehicleAnswersSpecs&&!s.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const v=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return m("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",v," first."]})}const re=me(null);oe(()=>{r||re.current===e.slug||(re.current=e.slug,it({itemId:f?`${e.slug}|${f.id}`:e.slug,itemName:e.name,variant:p.metaValue,pricePerSet:d.setTotal??d.fromSetTotal??0,currency:g}))},[r,e.slug,e.name,p.metaValue,f,d,g]);const P=Dt();return m(T,{children:[j&&t("nav",{...ve(ge(`border-b border-line ${be} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,F),P?.first?.atTop,ee?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,v)=>m("span",{children:[v>0&&m(T,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(ie,{href:a.href,className:"hover:text-fg",children:t(pe,{text:a.label})}):t("span",{className:"text-fg",children:t(pe,{text:a.label})})]},`${a.label}-${v}`))}),t("section",{ref:V,"data-hero-layout":u,"data-hero-align":K,...N?{[xt]:""}:{},...y?{[kt]:""}:{},...ve([ge(`grid ${E.gap}${be} ${E.y}max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] ${E.yTablet}${jt}`,F),K==="center"?Ot.center:"",u==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",N?vt:"",y?Tt(u==="imageRight"):""].filter(Boolean).join(" "),j?P?.second?.atTop:P?.secondOnly?.atTop,{...ee?{}:{background:"var(--section-bg)"},...u==="stacked"?{}:{"--hero-cols":we}}),children:t(Pt,{value:je,children:t(U,{children:t(M,{ownerId:_??"",ownerType:z,Template:Se,rows:xe,fallback:null,hostParts:Ke,children:a=>a})})})})]})}const Kt="wheels";function Vt(e,s){return s==="alloy-wheel"&&/\d$/.test(e)?`${e} ${Kt}`:e}function Bt(e,s,i){if(!e.priced)return null;const r=e.setTotal??e.fromSetTotal;return r==null?null:{label:s,total:he({...e,unit:r,isFrom:e.setTotal==null},i)}}function Yt({offer:e,takesOrders:s,choice:i,setChoice:r,options:c}){return e.packs.length>0||s&&(e.extra||e.spareCounts.length>0)?m("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&m(T,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),t("div",{className:"flex flex-wrap gap-1.5",children:t(x,{hero:c,values:e.packs,item:n=>({label:n.label}),picked:n=>i.unit===n.value,press:n=>()=>r(o=>({...o,unit:n.value}))})})]}),s&&e.extra&&m("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:n=>r(o=>({...o,spares:n.target.checked?ft:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),e.extra.label]}),s&&e.spareCounts.length>0&&m(T,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:nt.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(x,{hero:c,values:e.spareCounts,item:n=>({label:`${n.value} · ${n.label}`}),picked:n=>i.spares===n.value-ue,press:n=>()=>r(o=>({...o,spares:n.value-ue}))})})]}),s&&e.spareSide&&m(T,{children:[t("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.spareSide.label}),t("div",{className:"flex flex-wrap gap-1.5",children:t(x,{hero:c,values:e.spareSide.options,item:n=>({label:n.label}),picked:n=>i.spareSide===n.value,press:n=>()=>r(o=>({...o,spareSide:n.value}))})})]})]}):null}function ke({row:e,onPick:s,options:i}){const r=ce(),c=et();if(e.values.length===0&&!e.empty)return null;const n=e.values.find(l=>l.value===e.chosen),o=n&&[n.label,n.note].filter(Boolean).join(" · ");return e.values.length>0&&e.display==="swatch"&&c.finish==="tiles"?m("div",{[D]:e.key,children:[t(de,{label:r(e.label),chosen:n?.label}),t("div",{className:"flex flex-wrap gap-2","data-option-tiles":"",children:t(x,{hero:i,tiles:!0,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),label:l=>l.label,picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]}):e.values.length>0&&e.display==="pill"&&e.role==="resolves"&&c.size==="dropdown"?m("div",{[D]:e.key,children:[t(de,{label:r(e.label)}),t(Je,{rowKey:e.key,label:r(e.label),shown:o||r(e.prompt),items:e.values.map(l=>({value:l.value,label:Ze(l)})),value:e.chosen??"",onPick:l=>s(e.key,l),editing:i.editing})]}):m("div",{className:"border-b border-line pb-[26px]",[D]:e.key,children:[m("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[r(e.label)," · ",t("span",{className:"text-accent",children:o??r(e.prompt)})]}),e.values.length===0?m("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",t(ie,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?t("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:t(x,{hero:i,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(x,{hero:i,values:e.values,item:l=>({label:l.label,note:l.note??""}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]})}function x({hero:e,values:s,item:i,label:r,picked:c,press:n,tiles:o=!1}){const l=Nt(s,{item:i,selected:c,press:n,label:r});return t(U,{children:t(M,{ownerId:e.nodeId,ownerType:z,slot:o?Rt:Et,Template:o?e.tileTemplate:e.template,rows:l.items.map(_t),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:o?void 0:e.pressTitles,fallback:null,children:O=>O})})}function Gt({partNumbers:e,productSlug:s}){const[i,r]=Ye(""),{status:c,submit:n,reset:o}=at();function l(){n({partNumbers:e,email:i,productSlug:s})}return c==="sent"?t("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):t(We,{className:"-mt-1",email:i,onEmailChange:r,status:c,onResetVerdict:o,onSubmit:l,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{Ft as default};
|
|
1
|
+
"use client";import{jsx as t,jsxs as m,Fragment as T}from"react/jsx-runtime";import{partSkus as Be}from"../lib/catalog/part-skus.js";import ie from"next/link";import{useEffect as oe,useRef as me,useState as Ye}from"react";import{useCart as Ge}from"./CartContext.js";import{useSiteTakesOrders as Qe}from"./SiteRecordContext.js";import We from"./EmailCaptureForm.js";import{useEnglish as ce}from"./EnglishVariant.js";import{MarkedLabel as pe,heroView as Xe}from"./product-hero/hero-view.js";import{HeroOptionLooksProvider as qe,OptionDropdown as Je,OptionLabel as de,optionWords as Ze,useHeroOptionLooks as et}from"./product-hero/OptionLooks.js";import{DEFAULT_HERO_OPTION_LOOKS as tt}from"../lib/sections/hero-option-looks.js";import{useRootIsDark as lt}from"efficient-shell/theme";import{useStockAlertSignup as at}from"./useStockAlertSignup.js";import{SPARE_WORDS as nt,productCartLine as st}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as D}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as rt}from"../lib/catalog/product-options.js";import{trackViewItem as it}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as ot,DEFAULT_HERO_RATIO as mt,DEFAULT_HERO_TEXT_ALIGN as ct,parseHeroLayout as pt,parseHeroRatio as dt,parseHeroTextAlign as ut}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as ft,UNITS_PER_SET as ue,formatPrice as fe,spareAxleOf as ht}from"../lib/commerce.js";import{formatSelectionPrice as he}from"../lib/wheels/price-display.js";import{productIsDually as bt,productIsTwoObjects as gt,setSuppressesRow as xt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as be}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as vt,STICKY_SECTION_ATTR as kt}from"../lib/sections/hero-sticky.js";import{STAGE_EDGE_ATTR as Tt,stageEdgeClass as yt,stageEdgeCols as St}from"../lib/sections/hero-stage-edge.js";import{useStickyColumns as Ot}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as _t}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as M}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as U}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as Nt}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as Et}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as Rt,HERO_TILE_SLOT as Lt}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as wt,HERO_QUANTITY_PART as At,HERO_SAVE_PART as Ct}from"../lib/content/hero-buy-seed.js";import{HERO_PART as b}from"../lib/content/hero-seed.js";import It from"./card-pieces/CardQuantity.js";import $t from"./card-pieces/CardSave.js";import Pt from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as Ht}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as z}from"../lib/document/document-nodes.js";import{withSideOnce as ge}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as Dt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as xe}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as Mt}from"./SectionPadScope.js";const Ut=4e3;function zt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ve=[{}],jt=(e,s)=>s===At?t(It,{}):s===Ct?t($t,{}):null,Ft="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Kt({product:e,selection:s,onLightbox:i,editing:r=!1,showVehicleFitment:c=!0,heroLayout:n=ot,imageRatio:o=mt,textAlign:l=ct,showSpecTable:O=!0,stickyColumns:Te=!1,stageToEdge:ye=!1,showBreadcrumb:j=!0,nodeId:_,template:Se,optionTemplate:Oe,optionPressTitles:_e,tileTemplate:Ne,buyTemplate:Ee,optionLooks:Re=tt}){const F=Dt(),Le=ce(),u=pt(n),K=ut(l),k=dt(o),N=Te===!0&&u!=="stacked",y=ye===!0&&u!=="stacked",V=me(null);Ot(V,N);const we=y?St(k,u==="imageRight"):u==="imageRight"?`${100-k}fr ${k}fr`:`${k}fr ${100-k}fr`,E=y?{gap:"",y:"",yTablet:""}:{gap:"gap-10 ",y:"py-14 ",yTablet:"max-view-tablet:py-8 "},{picked:Ae,pick:B,qty:Y,setQty:Ce,choice:G,setChoice:Ie,angleIdx:Wt,setAngleIdx:Xt,showValidation:$e,setShowValidation:R,manualMode:Q,vehicle:L,rows:W,facts:Pe,part:f,outOfStock:X,offer:w,preOrder:A,canAddToCart:q,currency:g,price:d,set:J,msrpLabel:He}=s,p=Xe(e,s,r),Z=bt(e),De=gt(e),C=c?p.vehicle:null,Me=c?p.vehicleMemory:null,ee=!lt({whenUnset:!0}),{warmCatalog:te}=Ge(),S=Qe();oe(()=>{!r&&S&&te(e.kind,e.slug)},[r,S,e.kind,e.slug,te]);const le=W.filter(a=>!A||a.values.length>0),ae=le.filter(a=>a.role==="resolves"),I=le.filter(a=>a.role==="describes"&&!xt(De,a.key)),ne=I.findIndex(a=>a.chosen===null),se=(!C||!p.vehicleAnswersSpecs||s.fitmentSet)&&rt(W,A)?ne===-1?I:I.slice(0,ne+1):[],Ue=[...ae,...se];function ze(){return q?(R(!1),r?null:st(e,f,Ae,{choice:G,qty:Y},{fitmentLabel:Q?p.specCaption:L.appliedName?`For ${L.appliedName}`:"",fitmentKey:Q?`manual|${p.specCaption}`:`vehicle|${zt(L.applied?.vehicle)}`})):(R(!0),window.setTimeout(()=>R(!1),Ut),null)}const je={kind:"hero",msrpLabel:He||null,amount:he(d,g),unitLabel:d.priced?p.unitLabel:null,packBadge:d.setTotal!=null?`${w.quantityLabel}: ${fe(J,g)}`:null,buy:{isSet:Z,priced:d.priced,outOfStock:X,canAdd:q,totalLabel:d.setTotal!=null?fe(J,g):null,lineToAdd:ze},qty:Y,setQty:Ce,takesQty:S&&!(Z&&!d.priced),save:{slug:e.slug,name:e.name},facts:O?Pe:null,title:{eyebrow:e.eyebrow,name:p.heading,badge:e.badge||null},product:e,selection:s,openLightbox:i,sku:Be(f),designCode:e.kind==="alloy-wheel"&&e.source.designCode||null,setLine:Yt(d,Bt(w.quantityLabel,e.kind),g)},$={nodeId:_??"",template:Oe,tileTemplate:Ne,pressTitles:_e,editing:r},h=!!(A&&p.preOrder),Fe={[b.fitmentLine]:Me,[b.options]:m(qe,{looks:Re,children:[ae.map(a=>t(ke,{row:a,onPick:B,options:$},a.key)),!h&&C,!h&&se.map(a=>t(ke,{row:a,onPick:B,options:$},a.key))]}),[b.facts]:h?null:t(Pt,{}),[b.howMany]:h?null:t(Gt,{offer:w,takesOrders:S,choice:G,setChoice:Ie,options:$}),[b.buy]:h?p.preOrder:t(U,{children:t(M,{ownerId:_??"",ownerType:z,slot:wt,Template:Ee,rows:ve,fallback:null,hostParts:jt,children:a=>a})}),[b.notify]:!h&&X&&f?t(Qt,{partNumbers:f.components.map(a=>a.partNumber),productSlug:e.slug},f.id):null,[b.reminder]:!h&&$e?Ve():null},Ke=(a,x)=>Fe[x]??null;function Ve(){const a=Ue.filter(H=>H.chosen===null).map(H=>Le(H.prompt).replace(/^Select\s+/i,""));if(C&&p.vehicleAnswersSpecs&&!s.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const x=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return m("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",x," first."]})}const re=me(null);oe(()=>{r||re.current===e.slug||(re.current=e.slug,it({itemId:f?`${e.slug}|${f.id}`:e.slug,itemName:e.name,variant:p.metaValue,pricePerSet:d.setTotal??d.fromSetTotal??0,currency:g}))},[r,e.slug,e.name,p.metaValue,f,d,g]);const P=Mt();return m(T,{children:[j&&t("nav",{...xe(ge(`border-b border-line ${be} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,F),P?.first?.atTop,ee?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,x)=>m("span",{children:[x>0&&m(T,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(ie,{href:a.href,className:"hover:text-fg",children:t(pe,{text:a.label})}):t("span",{className:"text-fg",children:t(pe,{text:a.label})})]},`${a.label}-${x}`))}),t("section",{ref:V,"data-hero-layout":u,"data-hero-align":K,...N?{[kt]:""}:{},...y?{[Tt]:""}:{},...xe([ge(`grid ${E.gap}${be} ${E.y}max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] ${E.yTablet}${Ft}`,F),K==="center"?_t.center:"",u==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",N?vt:"",y?yt(u==="imageRight"):""].filter(Boolean).join(" "),j?P?.second?.atTop:P?.secondOnly?.atTop,{...ee?{}:{background:"var(--section-bg)"},...u==="stacked"?{}:{"--hero-cols":we}}),children:t(Ht,{value:je,children:t(U,{children:t(M,{ownerId:_??"",ownerType:z,Template:Se,rows:ve,fallback:null,hostParts:Ke,children:a=>a})})})})]})}const Vt="wheels";function Bt(e,s){return s==="alloy-wheel"&&/\d$/.test(e)?`${e} ${Vt}`:e}function Yt(e,s,i){if(!e.priced)return null;const r=e.setTotal??e.fromSetTotal;return r==null?null:{label:s,total:he({...e,unit:r,isFrom:e.setTotal==null},i)}}function Gt({offer:e,takesOrders:s,choice:i,setChoice:r,options:c}){return e.packs.length>0||s&&(e.extra||e.spareCounts.length>0)?m("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&m(T,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),t("div",{className:"flex flex-wrap gap-1.5",children:t(v,{hero:c,values:e.packs,item:n=>({label:n.label}),picked:n=>i.unit===n.value,press:n=>()=>r(o=>({...o,unit:n.value}))})})]}),s&&e.extra&&m("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:n=>r(o=>({...o,spares:n.target.checked?ft:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),e.extra.label]}),s&&e.spareCounts.length>0&&m(T,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:nt.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(v,{hero:c,values:e.spareCounts,item:n=>({label:`${n.value} · ${n.label}`}),picked:n=>i.spares===n.value-ue,press:n=>()=>r(o=>({...o,spares:n.value-ue}))})})]}),s&&e.spareSide&&m(T,{children:[t("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.spareSide.label}),t("div",{className:"flex flex-wrap gap-1.5",children:t(v,{hero:c,values:e.spareSide.options,item:n=>({label:n.label}),picked:n=>i.spareSide===n.value&&(n.axle===void 0||ht(i)===n.axle),press:n=>()=>r(o=>({...o,spareSide:n.value,...n.axle?{spareAxle:n.axle}:{}}))})})]})]}):null}function ke({row:e,onPick:s,options:i}){const r=ce(),c=et();if(e.values.length===0&&!e.empty)return null;const n=e.values.find(l=>l.value===e.chosen),o=n&&[n.label,n.note].filter(Boolean).join(" · ");return e.values.length>0&&e.display==="swatch"&&c.finish==="tiles"?m("div",{[D]:e.key,children:[t(de,{label:r(e.label),chosen:n?.label}),t("div",{className:"flex flex-wrap gap-2","data-option-tiles":"",children:t(v,{hero:i,tiles:!0,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),label:l=>l.label,picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]}):e.values.length>0&&e.display==="pill"&&e.role==="resolves"&&c.size==="dropdown"?m("div",{[D]:e.key,children:[t(de,{label:r(e.label)}),t(Je,{rowKey:e.key,label:r(e.label),shown:o||r(e.prompt),items:e.values.map(l=>({value:l.value,label:Ze(l)})),value:e.chosen??"",onPick:l=>s(e.key,l),editing:i.editing})]}):m("div",{className:"border-b border-line pb-[26px]",[D]:e.key,children:[m("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[r(e.label)," · ",t("span",{className:"text-accent",children:o??r(e.prompt)})]}),e.values.length===0?m("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",t(ie,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?t("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:t(v,{hero:i,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(v,{hero:i,values:e.values,item:l=>({label:l.label,note:l.note??""}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]})}function v({hero:e,values:s,item:i,label:r,picked:c,press:n,tiles:o=!1}){const l=Et(s,{item:i,selected:c,press:n,label:r});return t(U,{children:t(M,{ownerId:e.nodeId,ownerType:z,slot:o?Lt:Rt,Template:o?e.tileTemplate:e.template,rows:l.items.map(Nt),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:o?void 0:e.pressTitles,fallback:null,children:O=>O})})}function Qt({partNumbers:e,productSlug:s}){const[i,r]=Ye(""),{status:c,submit:n,reset:o}=at();function l(){n({partNumbers:e,email:i,productSlug:s})}return c==="sent"?t("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):t(We,{className:"-mt-1",email:i,onEmailChange:r,status:c,onResetVerdict:o,onSubmit:l,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{Kt as default};
|
|
@@ -1322,6 +1322,7 @@ export interface components {
|
|
|
1322
1322
|
wheels: number;
|
|
1323
1323
|
prices: components["schemas"]["Prices"];
|
|
1324
1324
|
hand?: "left" | "right" | null;
|
|
1325
|
+
axle?: "front" | "rear" | null;
|
|
1325
1326
|
renderKey?: string;
|
|
1326
1327
|
};
|
|
1327
1328
|
WheelVariant: {
|
|
@@ -1911,6 +1912,7 @@ export interface components {
|
|
|
1911
1912
|
unit: "set" | "single";
|
|
1912
1913
|
spares: number;
|
|
1913
1914
|
spareSide?: "left" | "right";
|
|
1915
|
+
spareAxle?: "front" | "rear" | null;
|
|
1914
1916
|
readonly spare?: boolean;
|
|
1915
1917
|
};
|
|
1916
1918
|
CartCaptureRequest: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PurchaseChoice, type PurchaseUnit, type SetComponent, type SpareSide } from "../commerce.js";
|
|
1
|
+
import { type PurchaseChoice, type PurchaseUnit, type SetComponent, type SpareAxle, type SpareSide } from "../commerce.js";
|
|
2
2
|
import type { CartLine } from "../../components/CartContext.js";
|
|
3
3
|
import type { StorePart, StoreProduct } from "./store-product.js";
|
|
4
4
|
export declare function vehicleGate(product: StoreProduct): "required" | "advisory";
|
|
@@ -19,6 +19,7 @@ export interface PurchaseOffer {
|
|
|
19
19
|
label: string;
|
|
20
20
|
options: readonly {
|
|
21
21
|
value: SpareSide;
|
|
22
|
+
axle?: SpareAxle;
|
|
22
23
|
label: string;
|
|
23
24
|
}[];
|
|
24
25
|
} | null;
|
|
@@ -37,6 +38,11 @@ export declare const SPARE_WORDS: {
|
|
|
37
38
|
readonly whichSide: "Which side is the spare?";
|
|
38
39
|
readonly left: "Left";
|
|
39
40
|
readonly right: "Right";
|
|
41
|
+
readonly whichWheel: "Which wheel is the spare?";
|
|
42
|
+
readonly frontLeft: "Front left";
|
|
43
|
+
readonly frontRight: "Front right";
|
|
44
|
+
readonly rearLeft: "Rear left";
|
|
45
|
+
readonly rearRight: "Rear right";
|
|
40
46
|
};
|
|
41
47
|
export declare function purchaseOffer(product: StoreProduct, part: StorePart | null, state: PurchaseState): PurchaseOffer;
|
|
42
48
|
export interface PurchaseContext {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_PURCHASE_CHOICE as
|
|
1
|
+
import{DEFAULT_PURCHASE_CHOICE as d,MAX_SPARES as L,UNITS_PER_SET as o,WHEELS_PER_SET as p,packLabel as v,setPackComposition as m,spareTargetsByCorner as E,spareTargetsByHand as k,withSpare as R}from"../commerce.js";import{tyreCartLine as w,tyrePackComposition as C}from"../tyres/tyre-purchase.js";import{setLabel as $}from"../wheels/variants.js";import{partVariant as S}from"./from-wheel.js";import{splitWheelName as x}from"../wheels/wheel-name.js";function U(n){return n.kind==="tyre"?"advisory":"required"}const F={choice:d,qty:1};function A(n,e){if(n.kind!=="alloy-wheel")return`Set of ${p}`;const i=S(n.source,e);return i?$(i):`Set of ${p}`}const b=(n,e)=>n===1?e:`${n} × ${e}`;function y(n){return n.unit==="set"?{label:`Add a spare — ${o+1} instead of ${o}`}:null}const l={howMany:"How many wheels",oneSet:"One set",oneSetPlusSpare:"One set + 1 spare",whichSide:"Which side is the spare?",left:"Left",right:"Right",whichWheel:"Which wheel is the spare?",frontLeft:"Front left",frontRight:"Front right",rearLeft:"Rear left",rearRight:"Rear right"};function P(n,e){if(e.unit!=="set")return null;const i=k(n)!==null;return!i&&E(n)===null?null:{counts:[{value:o,label:l.oneSet},{value:o+L,label:l.oneSetPlusSpare}],side:e.spares<=0?null:i?{label:l.whichSide,options:[{value:"left",label:l.left},{value:"right",label:l.right}]}:{label:l.whichWheel,options:[{value:"left",axle:"front",label:l.frontLeft},{value:"right",axle:"front",label:l.frontRight},{value:"left",axle:"rear",label:l.rearLeft},{value:"right",axle:"rear",label:l.rearRight}]}}}function _(n,e,i){if(n.kind==="tyre")return{packs:[{value:"set",label:`A set of ${o}`},{value:"single",label:"Just one"}],extra:y(i.choice),spareCounts:[],spareSide:null,components:e?C({sku:e.id,prices:e.components[0].prices},i.choice):[],quantityLabel:b(i.qty,v(i.choice))};const r=e?P(e.components,i.choice):null;return{packs:[],extra:r?null:y(i.choice),spareCounts:r?.counts??[],spareSide:r?.side??null,components:e?m(e.components,i.choice):[],quantityLabel:b(i.qty,R(A(n,e),i.choice))}}function N(n,e,i,r,c){if(!e)return null;if(n.kind==="tyre"){const f=(n.source.variants??[]).find(g=>g.sku===e.id);return f?w(n.source,f,r.choice,r.qty):null}const t=n.source,u=S(t,e);if(!u)return null;const a=e.options.finish??"",s=u.size,h=r.choice.spares>0;return{id:`${t.slug}|${a}|${s}|${c.fitmentKey}${h?"|spare":""}`,slug:t.slug,name:x(t.name),process:t.process,positionNo:"01",config:[{label:s},{label:a,gold:!0},{label:c.fitmentLabel},{label:_(n,e,r).quantityLabel}],finishName:a,size:s,components:m(e.components,r.choice),qty:r.qty,...h?{pack:r.choice}:{}}}export{F as DEFAULT_PURCHASE_STATE,l as SPARE_WORDS,N as productCartLine,_ as purchaseOffer,U as vehicleGate};
|
|
@@ -5,6 +5,7 @@ export interface SetComponent {
|
|
|
5
5
|
wheels: number;
|
|
6
6
|
prices: Record<string, number | null>;
|
|
7
7
|
hand?: SpareSide | null;
|
|
8
|
+
axle?: SpareAxle | null;
|
|
8
9
|
}
|
|
9
10
|
export declare function orderLinesForSets(components: SetComponent[], sets: number): {
|
|
10
11
|
partNumber: string;
|
|
@@ -14,12 +15,15 @@ export declare function setPrice(components: SetComponent[], currency: string):
|
|
|
14
15
|
export declare const UNITS_PER_SET = 4;
|
|
15
16
|
export type PurchaseUnit = "set" | "single";
|
|
16
17
|
export type SpareSide = "left" | "right";
|
|
18
|
+
export type SpareAxle = "front" | "rear";
|
|
17
19
|
export declare const MAX_SPARES = 1;
|
|
18
20
|
export interface PurchaseChoice {
|
|
19
21
|
unit: PurchaseUnit;
|
|
20
22
|
spares: number;
|
|
21
23
|
spareSide: SpareSide;
|
|
24
|
+
spareAxle?: SpareAxle;
|
|
22
25
|
}
|
|
26
|
+
export declare function spareAxleOf(choice: PurchaseChoice): SpareAxle;
|
|
23
27
|
export declare const DEFAULT_PURCHASE_CHOICE: PurchaseChoice;
|
|
24
28
|
export declare function unitsPerPack(choice: PurchaseChoice): number;
|
|
25
29
|
export declare function packComposition(part: {
|
|
@@ -28,10 +32,12 @@ export declare function packComposition(part: {
|
|
|
28
32
|
}, choice: PurchaseChoice): SetComponent[];
|
|
29
33
|
export declare function setPackComposition(components: SetComponent[], choice: PurchaseChoice): SetComponent[];
|
|
30
34
|
export declare function spareTargetsByHand(components: SetComponent[]): Record<SpareSide, number> | null;
|
|
35
|
+
export declare function spareTargetsByCorner(components: SetComponent[]): Record<SpareSide, Record<SpareAxle, number>> | null;
|
|
31
36
|
export declare function purchaseChoiceFromPack(pack: {
|
|
32
37
|
unit: PurchaseUnit;
|
|
33
38
|
spares?: number;
|
|
34
39
|
spareSide?: SpareSide | null;
|
|
40
|
+
spareAxle?: SpareAxle | null;
|
|
35
41
|
spare?: boolean;
|
|
36
42
|
}): PurchaseChoice;
|
|
37
43
|
export declare function withSpare(label: string, choice: PurchaseChoice): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const A=4;function P(e,r){return e.map(t=>({partNumber:t.partNumber,quantity:t.wheels*r}))}function T(e,r){if(e.length===0)return null;let t=0;for(const n of e){const s=n.prices?.[r];if(typeof s!="number"||!Number.isFinite(s)||s<=0)return null;t+=s*n.wheels}return t}const l=4,y=1;function x(e){return e.spareAxle??"front"}const C={unit:"set",spares:0,spareSide:"left"};function p(e){return e.unit==="single"?1:l+e.spares}function b(e,r){return[{partNumber:e.partNumber,wheels:p(r),prices:e.prices}]}function $(e,r){const t=p(r)-l;if(t<=0||e.length===0)return e;const n=S(e),s=n?null:E(e),u=n?n[r.spareSide]:s?s[r.spareSide][x(r)]:0;return e.map((o,f)=>f===u?{...o,wheels:o.wheels+t}:o)}function S(e){let r,t;for(let n=0;n<e.length;n+=1){const s=e[n].hand;if(s!=="left"&&s!=="right")continue;if((s==="left"?r:t)!==void 0)return null;s==="left"?r=n:t=n}return r!==void 0&&t!==void 0?{left:r,right:t}:null}function E(e){const r={};for(let o=0;o<e.length;o+=1){const{hand:f,axle:i}=e[o];if(f!=="left"&&f!=="right"||i!=="front"&&i!=="rear")return null;const a=`${f}-${i}`;if(r[a]!==void 0)return null;r[a]=o}const{"left-front":t,"left-rear":n,"right-front":s,"right-rear":u}=r;return t!==void 0&&n!==void 0&&s!==void 0&&u!==void 0?{left:{front:t,rear:n},right:{front:s,rear:u}}:null}function w(e){const r=typeof e.spares=="number"?e.spares:e.spare?1:0;return{unit:e.unit,spares:r,spareSide:e.spareSide??"left",...e.spareAxle?{spareAxle:e.spareAxle}:{}}}function g(e,r){return r.spares>0?`${e} + spare`:e}function L(e){return e.unit==="single"?"Single":g(`Set of ${l}`,e)}const N="data-add-to-basket",R=9,h="en",d=new Map;function c(e,r,t){const n=`${e}|${r??""}|${t??""}`;let s=d.get(n);return s||(s=new Intl.NumberFormat(h,{style:"currency",currency:e,...r===void 0?{}:{minimumFractionDigits:r},...t===void 0?{}:{maximumFractionDigits:t}}),d.set(n,s)),s}function _(e,r,t=0){return c(r,0,t).format(e)}function I(e,r){return c(r).format(e)}function v(e,r){const t=e.savings[r];if(t===void 0)return null;const n=_(t,r);return e.savingIsFrom?`Save from ${n}`:`Save ${n}`}export{N as ADD_TO_BASKET_ATTR,C as DEFAULT_PURCHASE_CHOICE,R as MAX_QTY_PER_LINE,y as MAX_SPARES,h as PRICE_LOCALE,l as UNITS_PER_SET,A as WHEELS_PER_SET,v as bundleSaving,c as currencyFormat,I as formatMoneyInCurrency,_ as formatPrice,P as orderLinesForSets,b as packComposition,L as packLabel,w as purchaseChoiceFromPack,$ as setPackComposition,T as setPrice,x as spareAxleOf,E as spareTargetsByCorner,S as spareTargetsByHand,p as unitsPerPack,g as withSpare};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as f,jsx as o,jsxs as p}from"react/jsx-runtime";import{withRMark as c}from"efficient-web-builder/render/components/RMark";import y from"../../../../../components/card-pieces/CardEyebrow.js";import{readPartStyles as h}from"efficient-web-builder/render/lib/document/part-styles";import w from"../../../../../components/card-pieces/HostPart.js";import{useHeroStateOrNull as E,useProductCardStateOrNull as g}from"../../../../../components/card-pieces/ProductCardState.js";import x from"../../../../../components/card-pieces/HeadlineEyebrow.js";import{MarkedLabel as u}from"../../../../../components/product-hero/hero-view.js";import{EYEBROW_BADGE_PROP as k,EYEBROW_SHOW_PROP as P,TITLE_LOOK_PROP as C,parseEyebrowShow as O,parseTitleLook as _}from"../../../../content/title-look.js";import R
|
|
1
|
+
"use client";import{Fragment as f,jsx as o,jsxs as p}from"react/jsx-runtime";import{withRMark as c}from"efficient-web-builder/render/components/RMark";import y from"../../../../../components/card-pieces/CardEyebrow.js";import{readPartStyles as h}from"efficient-web-builder/render/lib/document/part-styles";import w from"../../../../../components/card-pieces/HostPart.js";import{useHeroStateOrNull as E,useProductCardStateOrNull as g}from"../../../../../components/card-pieces/ProductCardState.js";import x from"../../../../../components/card-pieces/HeadlineEyebrow.js";import{MarkedLabel as u}from"../../../../../components/product-hero/hero-view.js";import{EYEBROW_BADGE_PROP as k,EYEBROW_SHOW_PROP as P,TITLE_LOOK_PROP as C,parseEyebrowShow as O,parseTitleLook as _}from"../../../../content/title-look.js";import{SiteLink as R}from"efficient-web-builder/render/lib/site-runtime";import{useGridCard as m}from"../../../../../components/GridCardTemplate.js";import{itemBrand as B,plpKindNoun as L}from"../../../../catalog/plp-item.js";import{productCardEyebrow as S,wheelCardEyebrow as H}from"../../../../../components/ProductCardEyebrow.js";import{keepForCard as N}from"../../../../content/field-usage.js";import{ProductEyebrowMeta as b}from"./meta.js";function T(r){const{fieldUsage:t,tyreFieldUsage:e,eyebrow:n}=m();if(r.kind==="tyre"){const a=(n.tyreBrand??n.brand)&&N(e)("brand")&&r.tyre.brand||null,s=n.kindLabel?L(["tyre"]).one:null;return S(s,a)}const l=r.kind==="wheel"?r.wheel:null,i=l&&n.brand?B(l):null,d={kindLabel:l?n.kindLabel:null,brand:i?c(i):null,process:l&&n.process&&l.process?c(l.process):null};return H(d,t)}function W({state:r,children:t}){return o(f,{children:t(T(r),null)})}const j="data-product-crumbs";function v({product:r}){const t=r.crumbs.slice(1,-1);return t.length===0?null:o("nav",{"aria-label":"Breadcrumb",[j]:"",className:"text-xs text-fg-dim",children:t.map((e,n)=>p("span",{children:[n>0&&" / ",e.href?o(R,{href:e.href,className:"hover:text-fg",children:o(u,{text:e.label})}):o(u,{text:e.label})]},`${e.label}-${n}`))})}function F({props:r,region:t}){const e=E(),n=g(),{reserveEyebrow:l}=m(),i=_(r[C])==="headline",d=(a,s)=>i?o(x,{eyebrow:a,badge:r[k]===!0?s:null,region:t}):o(y,{reserve:l,region:t,children:a});return e&&O(r[P])==="crumbs"?o(v,{product:e.product}):e?d(e.title.eyebrow?o(u,{text:e.title.eyebrow}):null,e.title.badge):n?o(W,{state:n,children:d}):null}const Z={...b,render:r=>{const t=!!r.editor?.isEditing;return o(w,{label:b.label??"",editing:t,onHero:!0,children:o(F,{props:r,region:{nodeId:typeof r.id=="string"?r.id:void 0,partStyles:h(r),editing:t}})})}};export{Z as ProductEyebrowRender};
|