efficient-storefront-blocks 0.60.0 → 0.61.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 +16 -0
- package/README.md +2 -1
- package/dist/chunks/{EditorPreviewCheckout-XY2PLPBD.js → EditorPreviewCheckout-55ERZEPV.js} +1 -1
- package/dist/chunks/chunk-VVQ7KFQO.js +1 -0
- package/dist/fitment.d.ts +56 -0
- package/dist/fitment.js +1 -0
- package/dist/index.d.ts +28 -6
- package/dist/index.js +41 -41
- package/dist/links.js +1 -1
- package/dist/render/components/FitmentTable.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +2 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/usePlpFiltersInUrl.d.ts +2 -1
- package/dist/render/components/wheels-plp/usePlpFiltersInUrl.js +1 -1
- package/dist/render/lib/content/field-usage.d.ts +0 -1
- package/dist/render/lib/content/field-usage.js +1 -1
- package/dist/render/lib/wheels/fitment-columns.d.ts +6 -1
- package/dist/render/lib/wheels/fitment-columns.js +1 -1
- package/dist/render/lib/wheels/plp-hydrate.d.ts +2 -0
- package/dist/render/lib/wheels/plp-hydrate.js +1 -1
- package/package.json +8 -1
- package/dist/chunks/chunk-EZQTUHPN.js +0 -1
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h={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 ze={bold:h.bold.placeholder,italic:h.italic.placeholder,strike:h.strike.placeholder,code:h.code.placeholder,highlight:h.highlight.placeholder,quiet:h.quiet.placeholder,link:"link text",underline:h.underline.placeholder,sup:h.sup.placeholder,sub:h.sub.placeholder,color:"colored text"};var X=[{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 x=[{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}],Q=["highlight","quiet"],Ue=X.map(e=>e.style).filter(e=>x.some(n=>n.kind===e)).filter(e=>!Q.includes(e)),De=[...x,{open:"*",close:"*",kind:"accent"}],$e=[...x,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var Be=["http","https","mailto","tel"];function v(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let n=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!n||Be.includes(n[1].toLowerCase())}var J=["width","profile","rim"];var We=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,Ge={width:[100,500],profile:[20,100],rim:[10,30]};function M(e){let n=We.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return J.every(i=>{let[a,u]=Ge[i];return t[i]>=a&&t[i]<=u})?t:null}function L(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let n=`${e.width}/${e.profile}`;return e.rim==null?n:`${n} R${e.rim}`}function ee(e){return[L({width:e.width}),L({width:e.width,profile:e.profile}),L(e)]}var k=["alloy-wheel","tyre"],ne=["alloy-wheel"],w={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Hn=k.map(e=>({value:e,label:w[e]}));function z(e){return e==null?[...ne]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ne]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function U(e){return m(e).brand??""}function te(e){return m(e).prices??void 0}function re(e){return m(e).inStock!==!1}function ie(e){let n=m(e),t=f(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function D(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function oe(e){return D(e).map(n=>n.family)}function le(e){if(f(e)==="tyre")return[];let n=m(e),t=n.categories;return t&&t.length>0?t:n.process?[n.process]:[]}function se(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function ae(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ue(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function ce(e){if(f(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>M(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var pe=null;function de(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Object.prototype.hasOwnProperty.call(n,r)?String(n[r]):t):e}function y(e,n){let t=pe?pe[e]:void 0;if(typeof t=="function"){try{let r=t(n??{});if(typeof r=="string"&&r)return r}catch{}return de(e,n)}return de(typeof t=="string"&&t?t:e,n)}var fe="homepage";function me(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=[{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 T(e){return e.offersCommerce&&e.offersService?F:F.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}var $="#popup:";function ge(e){return`${$}${e}`}function he(e){return e.startsWith($)&&e.slice($.length).trim()||null}function P(e){return e===fe?"/":`/${e}`}function _(e){return`/journal/${e}`}function A(e){return`/wheels/${e}`}function R(e,n){return`${P(e)}#${n}`}function B(e){return me(e)}function Ye(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}function E(...e){let n=new Set,t=[];for(let r of e)for(let i of r?.content??[]){let a=Ye(i?.props?.anchor);if(!a)continue;let u=B(a);!u||n.has(u)||(n.add(u),t.push({slug:u,name:a}))}return t}function ye(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var qe=()=>({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 I(e,n,t){if(!e)return"page";if(he(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(ye(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||n.includes(r))return"anchor"}return e==="/"||n.includes(e)||t&&t.listingPaths.includes(t.targetOf(e))?"page":"custom"}function Pe(e,n){let t=qe(),r=e.pages.map(l=>({value:P(l.slug),label:l.title})),i=n?.pageOptions?n.pageOptions(r):r,a=i.map(l=>l.value),u=e.pages.map(l=>({label:l.title,options:E(...l.docs).map(c=>({value:R(l.slug,c.slug),label:c.name}))})).filter(l=>l.options.length>0),p=l=>{switch(l){case"page":return{type:"select",options:i,placeholder:t.choosePage};case"anchor":return{type:"groups",groups:u,placeholder:u.length?t.chooseSection:t.noSections};case"blog":return{type:"select",options:e.posts.map(c=>({value:_(c.slug),label:c.title||c.slug})),placeholder:t.choosePost};case"product":return{type:"select",options:e.products.map(c=>({value:c.href,label:c.name||c.href})),placeholder:t.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(c=>({value:ge(c.slug),label:c.title||c.slug})),placeholder:t.choosePopup};case"custom":return{type:"text"}}},s=T(e.offers).map(l=>({value:l.value,label:y(l.label),target:p(l.value),...l.value==="anchor"?{hint:t.sectionHint}:{},...l.value==="blog"||l.value==="product"||l.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!n)return{kinds:s,rules:{kindOf:l=>I(l,a),targetOf:l=>l,readFilter:()=>null,withFilter:l=>l}};let o=l=>{let c=n.withFilter(l,null);return n.listingPaths.includes(c)?c:l};return{kinds:s,rules:{kindOf:l=>I(l,a,{listingPaths:n.listingPaths,targetOf:o}),targetOf:o,readFilter:n.readFilter,withFilter:n.withFilter},filtersFor:l=>n.listingPaths.includes(l)?n.filtersFor(l):null}}function W(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function be(e,n){let t=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(let i of e){let a=i[t];if(typeof a!="number"||!Number.isFinite(a))continue;let u=r.get(i.fieldKey);(u===void 0||a<u)&&r.set(i.fieldKey,a)}return i=>i?r.get(i):void 0}function ke(e,n,t,r){let i=new Map;for(let s of t){let o=s[r];typeof o=="number"&&i.set(s.fieldKey,o)}if(i.size===0)return e;let a=[],u=[];e.forEach((s,o)=>{let l=n(s);l&&(a.push(o),u.push({item:s,index:o,order:i.get(l)}))}),u.sort((s,o)=>s.order!==void 0&&o.order!==void 0?s.order-o.order||s.index-o.index:s.order!==void 0?-1:o.order!==void 0?1:s.index-o.index);let p=[...e];return a.forEach((s,o)=>{p[s]=u[o].item}),p.every((s,o)=>s===e[o])?e:p}function Se(e){return je(e,"filter")}var He="collection";function G(e,n){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":He},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function je(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function xe(e,n){let t=e?.[n];return Ze(t)?t:null}function Le(e,n,t,r){if(t==null&&r==null)return!0;let i=xe(e,n);return!(i===null||t!=null&&i<t||r!=null&&i>r)}var Ve={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},_t=Object.keys(Ve);var we=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Xe={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Qe={diameters:"tyreSizes"};function Je(e){if(e.length===0)return[];let n=we.filter(t=>e.every(r=>Xe[t].includes(r)));return n.filter(t=>{let r=Qe[t];return!r||!n.includes(r)})}function en(e){let n=new Set;for(let t of e)n.add(f(t));return[...n]}var Fe={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function nn(e,n,t,r=null){if(r!=="kind"&&n.kind&&f(e)!==n.kind)return!1;for(let i of we){if(r===i)continue;let a=n[i];if(a.length===0)continue;let u=a.map(String);if(!Te(e,i).some(p=>u.includes(p)))return!1}return!(r!=="price"&&!Le(te(e),t,null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!re(e))}var tn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Te(e,n){switch(n){case"tyreSizes":return[...new Set(ce(e).flatMap(ee))];case"brands":return U(e)?[U(e)]:[];case"finishes":return oe(e);case"diameters":return ie(e).map(String);case"collections":return le(e);case"pcds":return se(e);case"tyreTypes":return ae(e);case"speedRatings":return ue(e)}}function rn(e){let n=new Map;for(let t of e)for(let r of D(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function _e(e,n,t,r=en(e),i=[]){let a=o=>ln(o,r,i),u=rn(e),p=Je(r).filter(o=>o!=="tyreSizes").filter(a).map(o=>{let l=n[o].map(String),c=new Set,N=new Map,S=new Map;for(let d of e){let b=Te(d,o);for(let g of b)c.add(g);for(let g of new Set(b))S.set(g,(S.get(g)??0)+1);if(nn(d,n,t,o))for(let g of new Set(b))N.set(g,(N.get(g)??0)+1)}let Me=[...c].map(d=>({value:d,label:o==="diameters"?`${d}\u2033`:d,count:N.get(d)??0,checked:l.includes(d),swatch:o==="finishes"?u.get(d)??null:null})).sort((d,b)=>{if(o==="diameters")return Number(d.value)-Number(b.value);let g=(S.get(b.value)??0)-(S.get(d.value)??0);return g!==0?g:d.value.localeCompare(b.value)});return{key:o,label:tn[o],options:Me}}).filter(o=>o.options.length>on),s=[];for(let o of p){let l=sn(o.key,r,i);l!==void 0&&s.push({fieldKey:o.key,filterOrder:l})}return[...ke(p,o=>o.key,s,"filterOrder")]}var on=1;function Ae(e){return e.showCollection===!1?["collections"]:[]}function ln(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>Se(W(t,r))(G(e,r)))}function sn(e,n,t){if(t.length===0)return;let r;for(let i of n){let a=be(W(t,i),"filter")(G(e,i));a!==void 0&&(r===void 0||a<r)&&(r=a)}return r}var Y={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},q="type";var Re="AlloyWheelsListing";function Ee(e){return v(e.trim())}var C="/wheels",K="Products";function Ie(e,n){return n>1?`${K} \xB7 ${e}`:K}function H(...e){for(let n of e){let t=(n?.content??[]).find(r=>r?.type===Re);if(t)return t.props??{}}return null}function O(...e){return H(...e)!==null}function Ce(e,n){let t=e.filter(r=>O(...r.docs)).map(r=>P(r.slug));return t.length===0&&n.fallback?[C]:t}var j=[q,...Object.entries(Y).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Ke(e){let n=e.indexOf("#"),t=n===-1?"":e.slice(n),r=n===-1?e:e.slice(0,n),i=r.indexOf("?");return{path:i===-1?r:r.slice(0,i),query:i===-1?"":r.slice(i+1),hash:t}}function an(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Oe(e){let n=new URLSearchParams(Ke(e).query);for(let t of j){let r=n.get(t);if(r)return{param:t,value:r}}return null}function Z(e,n){let{path:t,query:r,hash:i}=Ke(e),a=r.split("&").filter(u=>u&&!j.includes(an(u.split("=")[0])));return n?.value&&a.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${a.length?`?${a.join("&")}`:""}${i}`}function Ne(e,n){let t=Z(e,null);return n.includes(t)?t:e}function un(e,n,t=[]){return I(e,n,{listingPaths:t,targetOf:r=>Ne(r,t)})}function cn(e){return Array.isArray(e)?e.filter(n=>typeof n?.kind=="string"&&typeof n.field_key=="string").map(n=>({kind:n.kind,fieldKey:n.field_key,...typeof n.filter=="boolean"?{filter:n.filter}:{},filterOrder:n.filter_order??null})):[]}var ve="Product type",pn="AUD";function V(e,n){let t=n.listing??{},r=z(t.kinds),i=e.filter(s=>r.includes(f(s))),a=Ae(t),u=_e(i,Fe,pn,r,n.fieldUsage).filter(s=>!a.includes(s.key)).map(s=>({param:Y[s.key],label:s.label,values:s.options.filter(o=>!o.value.includes(",")).map(o=>({value:o.value,label:o.label}))})).filter(s=>s.values.length>0),p=k.filter(s=>r.includes(s)&&i.some(o=>f(o)===s));return p.length>1&&u.unshift({param:q,label:ve,values:p.map(s=>({value:s,label:w[s]}))}),u}function dn(e){return n=>{let t=Ce(n,{fallback:e.offersCommerce}),r=n.filter(i=>O(...i.docs)).length;return{listingPaths:t,pageOptions:i=>{let a=i.map(u=>{let p=n.find(s=>P(s.slug)===u.value);return p&&O(...p.docs)?{...u,label:Ie(p.title,r)}:u});return r===0&&e.offersCommerce&&!a.some(u=>u.value===C)&&a.push({value:C,label:K}),a},filtersFor:i=>{if(!t.includes(i))return null;let a=n.find(u=>P(u.slug)===i);return V(e.catalogue,{listing:a?H(...a.docs):null,fieldUsage:e.fieldUsage})},readFilter:Oe,withFilter:Z}}}function fn(e){let n=dn({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Pe({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:A(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Ee},filtersFor:t.filtersFor??(()=>null)}}function Yt(e,n){return V(e,n)}export{C as BUILT_IN_LISTING_PATH,F as LINK_KINDS,j as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,ve as PRODUCT_TYPE_FILTER_LABEL,R as anchorPath,cn as fieldUsageFromAdminRows,un as inferLinkKind,O as isProductListingPage,Ee as isSafeLink,T as linkKindsFor,fn as linkPickerSetup,Yt as listingFilterFields,H as listingNode,Ie as listingPageLabel,Ne as listingTarget,E as pageAnchors,P as pagePath,_ as postPath,Ce as productListingPaths,Oe as readListingFilter,B as slugifyAnchor,A as wheelPath,Z as withListingFilter};
|
|
1
|
+
var h={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 ze={bold:h.bold.placeholder,italic:h.italic.placeholder,strike:h.strike.placeholder,code:h.code.placeholder,highlight:h.highlight.placeholder,quiet:h.quiet.placeholder,link:"link text",underline:h.underline.placeholder,sup:h.sup.placeholder,sub:h.sub.placeholder,color:"colored text"};var Q=[{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 x=[{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}],X=["highlight","quiet"],Ue=Q.map(e=>e.style).filter(e=>x.some(n=>n.kind===e)).filter(e=>!X.includes(e)),De=[...x,{open:"*",close:"*",kind:"accent"}],$e=[...x,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var Be=["http","https","mailto","tel"];function v(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let n=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!n||Be.includes(n[1].toLowerCase())}var J=["width","profile","rim"];var We=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,Ge={width:[100,500],profile:[20,100],rim:[10,30]};function M(e){let n=We.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return J.every(i=>{let[a,u]=Ge[i];return t[i]>=a&&t[i]<=u})?t:null}function L(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let n=`${e.width}/${e.profile}`;return e.rim==null?n:`${n} R${e.rim}`}function ee(e){return[L({width:e.width}),L({width:e.width,profile:e.profile}),L(e)]}var k=["alloy-wheel","tyre"],ne=["alloy-wheel"],w={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Hn=k.map(e=>({value:e,label:w[e]}));function z(e){return e==null?[...ne]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ne]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function U(e){return m(e).brand??""}function te(e){return m(e).prices??void 0}function re(e){return m(e).inStock!==!1}function ie(e){let n=m(e),t=f(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function D(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function oe(e){return D(e).map(n=>n.family)}function le(e){if(f(e)==="tyre")return[];let n=m(e),t=n.categories;return t&&t.length>0?t:n.process?[n.process]:[]}function se(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function ae(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ue(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function ce(e){if(f(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>M(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var pe=null;function de(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Object.prototype.hasOwnProperty.call(n,r)?String(n[r]):t):e}function y(e,n){let t=pe?pe[e]:void 0;if(typeof t=="function"){try{let r=t(n??{});if(typeof r=="string"&&r)return r}catch{}return de(e,n)}return de(typeof t=="string"&&t?t:e,n)}var fe="homepage";function me(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=[{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 T(e){return e.offersCommerce&&e.offersService?F:F.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}var $="#popup:";function ge(e){return`${$}${e}`}function he(e){return e.startsWith($)&&e.slice($.length).trim()||null}function P(e){return e===fe?"/":`/${e}`}function _(e){return`/journal/${e}`}function A(e){return`/wheels/${e}`}function R(e,n){return`${P(e)}#${n}`}function B(e){return me(e)}function Ye(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}function E(...e){let n=new Set,t=[];for(let r of e)for(let i of r?.content??[]){let a=Ye(i?.props?.anchor);if(!a)continue;let u=B(a);!u||n.has(u)||(n.add(u),t.push({slug:u,name:a}))}return t}function ye(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var qe=()=>({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 I(e,n,t){if(!e)return"page";if(he(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(ye(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||n.includes(r))return"anchor"}return e==="/"||n.includes(e)||t&&t.listingPaths.includes(t.targetOf(e))?"page":"custom"}function Pe(e,n){let t=qe(),r=e.pages.map(l=>({value:P(l.slug),label:l.title})),i=n?.pageOptions?n.pageOptions(r):r,a=i.map(l=>l.value),u=e.pages.map(l=>({label:l.title,options:E(...l.docs).map(c=>({value:R(l.slug,c.slug),label:c.name}))})).filter(l=>l.options.length>0),p=l=>{switch(l){case"page":return{type:"select",options:i,placeholder:t.choosePage};case"anchor":return{type:"groups",groups:u,placeholder:u.length?t.chooseSection:t.noSections};case"blog":return{type:"select",options:e.posts.map(c=>({value:_(c.slug),label:c.title||c.slug})),placeholder:t.choosePost};case"product":return{type:"select",options:e.products.map(c=>({value:c.href,label:c.name||c.href})),placeholder:t.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(c=>({value:ge(c.slug),label:c.title||c.slug})),placeholder:t.choosePopup};case"custom":return{type:"text"}}},s=T(e.offers).map(l=>({value:l.value,label:y(l.label),target:p(l.value),...l.value==="anchor"?{hint:t.sectionHint}:{},...l.value==="blog"||l.value==="product"||l.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!n)return{kinds:s,rules:{kindOf:l=>I(l,a),targetOf:l=>l,readFilter:()=>null,withFilter:l=>l}};let o=l=>{let c=n.withFilter(l,null);return n.listingPaths.includes(c)?c:l};return{kinds:s,rules:{kindOf:l=>I(l,a,{listingPaths:n.listingPaths,targetOf:o}),targetOf:o,readFilter:n.readFilter,withFilter:n.withFilter},filtersFor:l=>n.listingPaths.includes(l)?n.filtersFor(l):null}}function W(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function be(e,n){let t=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(let i of e){let a=i[t];if(typeof a!="number"||!Number.isFinite(a))continue;let u=r.get(i.fieldKey);(u===void 0||a<u)&&r.set(i.fieldKey,a)}return i=>i?r.get(i):void 0}function ke(e,n,t,r){let i=new Map;for(let s of t){let o=s[r];typeof o=="number"&&i.set(s.fieldKey,o)}if(i.size===0)return e;let a=[],u=[];e.forEach((s,o)=>{let l=n(s);l&&(a.push(o),u.push({item:s,index:o,order:i.get(l)}))}),u.sort((s,o)=>s.order!==void 0&&o.order!==void 0?s.order-o.order||s.index-o.index:s.order!==void 0?-1:o.order!==void 0?1:s.index-o.index);let p=[...e];return a.forEach((s,o)=>{p[s]=u[o].item}),p.every((s,o)=>s===e[o])?e:p}function Se(e){return je(e,"filter")}var He="collection";function G(e,n){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":He},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function je(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function xe(e,n){let t=e?.[n];return Ze(t)?t:null}function Le(e,n,t,r){if(t==null&&r==null)return!0;let i=xe(e,n);return!(i===null||t!=null&&i<t||r!=null&&i>r)}var Ve={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},_t=Object.keys(Ve);var we=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Qe={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Xe={diameters:"tyreSizes"};function Je(e){if(e.length===0)return[];let n=we.filter(t=>e.every(r=>Qe[t].includes(r)));return n.filter(t=>{let r=Xe[t];return!r||!n.includes(r)})}function en(e){let n=new Set;for(let t of e)n.add(f(t));return[...n]}var Fe={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function nn(e,n,t,r=null){if(r!=="kind"&&n.kind&&f(e)!==n.kind)return!1;for(let i of we){if(r===i)continue;let a=n[i];if(a.length===0)continue;let u=a.map(String);if(!Te(e,i).some(p=>u.includes(p)))return!1}return!(r!=="price"&&!Le(te(e),t,null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!re(e))}var tn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Te(e,n){switch(n){case"tyreSizes":return[...new Set(ce(e).flatMap(ee))];case"brands":return U(e)?[U(e)]:[];case"finishes":return oe(e);case"diameters":return ie(e).map(String);case"collections":return le(e);case"pcds":return se(e);case"tyreTypes":return ae(e);case"speedRatings":return ue(e)}}function rn(e){let n=new Map;for(let t of e)for(let r of D(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function _e(e,n,t,r=en(e),i=[]){let a=o=>ln(o,r,i),u=rn(e),p=Je(r).filter(o=>o!=="tyreSizes").filter(a).map(o=>{let l=n[o].map(String),c=new Set,N=new Map,S=new Map;for(let d of e){let b=Te(d,o);for(let g of b)c.add(g);for(let g of new Set(b))S.set(g,(S.get(g)??0)+1);if(nn(d,n,t,o))for(let g of new Set(b))N.set(g,(N.get(g)??0)+1)}let Me=[...c].map(d=>({value:d,label:o==="diameters"?`${d}\u2033`:d,count:N.get(d)??0,checked:l.includes(d),swatch:o==="finishes"?u.get(d)??null:null})).sort((d,b)=>{if(o==="diameters")return Number(d.value)-Number(b.value);let g=(S.get(b.value)??0)-(S.get(d.value)??0);return g!==0?g:d.value.localeCompare(b.value)});return{key:o,label:tn[o],options:Me}}).filter(o=>o.options.length>on),s=[];for(let o of p){let l=sn(o.key,r,i);l!==void 0&&s.push({fieldKey:o.key,filterOrder:l})}return[...ke(p,o=>o.key,s,"filterOrder")]}var on=1;function Ae(e){return e.showCollection===!1?["collections"]:[]}function ln(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>Se(W(t,r))(G(e,r)))}function sn(e,n,t){if(t.length===0)return;let r;for(let i of n){let a=be(W(t,i),"filter")(G(e,i));a!==void 0&&(r===void 0||a<r)&&(r=a)}return r}var Y={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},q="type";var Re="AlloyWheelsListing";function Ee(e){return v(e.trim())}var C="/wheels",K="Products";function Ie(e,n){return n>1?`${K} \xB7 ${e}`:K}function H(...e){for(let n of e){let t=(n?.content??[]).find(r=>r?.type===Re);if(t)return t.props??{}}return null}function O(...e){return H(...e)!==null}function Ce(e,n){let t=e.filter(r=>O(...r.docs)).map(r=>P(r.slug));return t.length===0&&n.fallback?[C]:t}var j=[q,...Object.entries(Y).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Ke(e){let n=e.indexOf("#"),t=n===-1?"":e.slice(n),r=n===-1?e:e.slice(0,n),i=r.indexOf("?");return{path:i===-1?r:r.slice(0,i),query:i===-1?"":r.slice(i+1),hash:t}}function an(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Oe(e){let n=new URLSearchParams(Ke(e).query);for(let t of j){let r=n.get(t);if(r)return{param:t,value:r}}return null}function Z(e,n){let{path:t,query:r,hash:i}=Ke(e),a=r.split("&").filter(u=>u&&!j.includes(an(u.split("=")[0])));return n?.value&&a.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${a.length?`?${a.join("&")}`:""}${i}`}function Ne(e,n){let t=Z(e,null);return n.includes(t)?t:e}function un(e,n,t=[]){return I(e,n,{listingPaths:t,targetOf:r=>Ne(r,t)})}function cn(e){return Array.isArray(e)?e.filter(n=>typeof n?.kind=="string"&&typeof n.field_key=="string").map(n=>({kind:n.kind,fieldKey:n.field_key,...typeof n.filter=="boolean"?{filter:n.filter}:{},filterOrder:n.filter_order??null})):[]}var ve="Product type",pn="AUD";function V(e,n){let t=n.listing??{},r=z(t.kinds),i=e.filter(s=>r.includes(f(s))),a=Ae(t),u=_e(i,Fe,pn,r,n.fieldUsage).filter(s=>!a.includes(s.key)).map(s=>({param:Y[s.key],label:s.label,values:s.options.filter(o=>!o.value.includes(",")).map(o=>({value:o.value,label:o.label}))})).filter(s=>s.values.length>0),p=k.filter(s=>r.includes(s)&&i.some(o=>f(o)===s));return p.length>1&&u.unshift({param:q,label:ve,values:p.map(s=>({value:s,label:w[s]}))}),u}function dn(e){return n=>{let t=Ce(n,{fallback:e.offersCommerce}),r=n.filter(i=>O(...i.docs)).length;return{listingPaths:t,pageOptions:i=>{let a=i.map(u=>{let p=n.find(s=>P(s.slug)===u.value);return p&&O(...p.docs)?{...u,label:Ie(p.title,r)}:u});return r===0&&e.offersCommerce&&!a.some(u=>u.value===C)&&a.push({value:C,label:K}),a},filtersFor:i=>{if(!t.includes(i))return null;let a=n.find(u=>P(u.slug)===i);return V(e.catalogue,{listing:a?H(...a.docs):null,fieldUsage:e.fieldUsage})},readFilter:Oe,withFilter:Z}}}function fn(e){let n=dn({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Pe({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:A(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Ee},filtersFor:t.filtersFor??(()=>null)}}function Yt(e,n){return V(e,n)}export{C as BUILT_IN_LISTING_PATH,F as LINK_KINDS,j as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,ve as PRODUCT_TYPE_FILTER_LABEL,R as anchorPath,cn as fieldUsageFromAdminRows,un as inferLinkKind,O as isProductListingPage,Ee as isSafeLink,T as linkKindsFor,fn as linkPickerSetup,Yt as listingFilterFields,H as listingNode,Ie as listingPageLabel,Ne as listingTarget,E as pageAnchors,P as pagePath,_ as postPath,Ce as productListingPaths,Oe as readListingFilter,B as slugifyAnchor,A as wheelPath,Z as withListingFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as r,Fragment as q}from"react/jsx-runtime";import F from"./SectionBand.js";import{useEffect as D,useState as A}from"react";import _ from"efficient-web-builder/render/components/SectionHeader";import J from"./SectionFootnote.js";import{renderGold as u,renderHeadline as E}from"efficient-web-builder/render/components/goldPhrases";import M from"./fitment/FitmentRowFit.js";import{useVehicleFit as Q}from"./fitment/useVehicleFit.js";import{fitmentRowAnswer as Y}from"../lib/wheels/fitment-row-fit.js";import{fitmentColumns as ee,loadUnitFor as te}from"../lib/wheels/fitment-columns.js";import{useActiveCountry as ne}from"./CurrencyContext.js";import{say as T}from"efficient-web-builder/format/lib/editor-words";const o={body:"text-[length:var(--size-body,12px)]",labelXs:"text-[length:var(--size-label,11px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"},re=[],le="whitespace-nowrap border-b border-line px-4 py-4",X=`relative cursor-pointer border-2 px-4 py-2 font-mono ${o.labelSmall} font-semibold uppercase tracking-[0.18em] text-fg transition-colors`,j="border-b border-line py-[120px] max-[1100px]:py-20",L="border-b border-line pt-0 pb-[120px] max-[1100px]:pt-0 max-[1100px]:pb-20",R={background:"color-mix(in oklab, var(--accent) 14%, transparent)"},B=(a,i,s)=>i.map(f=>f.cell(a,s)).join("|");function oe({num:a,title:i,description:s,rows:f,showFilter:I=!0,tooltipDefaultOn:b=!0,footnote:H,footnoteLinkText:O,footnoteLinkHref:W,editing:y=!1,omitHead:p=!1,fieldUsage:G=re}){const N=f??[],c=ee(G),h=te(ne()),[x,k]=A(null),[l,S]=A(b);D(()=>S(b),[b]);const K=Q({editing:y}),$=c.length===0;if(N.length===0||$)return y?r(F,{className:p?L:j,children:[p?null:t(_,{num:a!=null?u(a):void 0,title:i!=null?E(i,!1):void 0,description:s!=null?u(s):void 0,accent:!0}),t("p",{className:`border-t border-line py-6 font-mono ${o.labelLarge} uppercase tracking-[0.18em] text-fg-dim`,children:$?T("Every fitment column is hidden in Product Types — show one to draw this table."):T("No fitment data for this wheel — pick a wheel with fitment specs.")})]}):null;const z=new Set,g=N.filter(e=>{const n=B(e,c,h);return z.has(n)?!1:(z.add(n),!0)}),w=Array.from(new Set(g.map(e=>e.diameter))).sort((e,n)=>e-n),d=x!==null&&w.includes(x)?x:null,v=d===null?g:g.filter(e=>e.diameter===d),P=I&&w.length>1,V=e=>{if(e===0)return!1;const n=v[e-1],m=v[e];return n.diameter!==m.diameter||n.width!==m.width};return r(F,{className:p?L:j,children:[p?null:t(_,{num:a!=null?u(a):void 0,title:i!=null?E(i,!1):void 0,description:s!=null?u(s):void 0,accent:!0}),r("div",{className:"mb-6 flex flex-wrap items-center gap-x-2 gap-y-3",children:[P&&r(q,{children:[t("span",{className:`mr-2 font-mono ${o.labelSmall} uppercase tracking-[0.24em] text-fg-dim max-[720px]:mr-0 max-[720px]:mb-1 max-[720px]:w-full`,children:"Filter by size:"}),r("button",{type:"button",onClick:()=>k(null),className:`${X} ${d===null?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:d===null?R:void 0,children:[d===null&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),"All"]}),w.map(e=>{const n=e===d;return r("button",{type:"button",onClick:()=>k(n?null:e),className:`${X} ${n?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"}`,style:n?R:void 0,children:[n&&t("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e,'"']},e)})]}),r("button",{type:"button",onClick:()=>S(e=>!e),"aria-pressed":l,"aria-label":l?"Hide vehicle tooltip":"Show vehicle tooltip",className:`ml-auto inline-flex items-center gap-3 font-mono ${o.labelSmall} uppercase tracking-[0.24em] text-fg-dim transition-colors hover:text-fg max-[720px]:hidden`,children:[t("span",{children:"Vehicle tooltip"}),t("span",{className:`relative inline-flex h-5 w-9 shrink-0 items-center rounded-full border-2 transition-colors ${l?"border-accent":"border-fg-dim/50"}`,style:l?{background:"color-mix(in oklab, var(--accent) 30%, transparent)"}:void 0,"aria-hidden":!0,children:t("span",{className:`block h-3 w-3 rounded-full transition-transform ${l?"translate-x-[18px] bg-accent":"translate-x-[2px] bg-fg-dim"}`})}),t("span",{className:l?"text-accent":"text-fg-dim",children:l?"On":"Off"})]})]}),t("div",{className:"-mx-1 overflow-x-auto",children:r("table",{className:`w-full border-collapse font-mono ${o.labelXl} tracking-[0.06em] text-fg`,children:[t("thead",{children:t("tr",{children:c.map(({header:e},n)=>t("th",{className:`whitespace-nowrap border-b border-line bg-surface px-4 py-4 text-left ${o.body} font-normal uppercase tracking-[0.22em] text-fg-dim`,children:e},n))})}),t("tbody",{children:v.map((e,n)=>t("tr",{className:`group transition-colors hover:[&>td]:bg-surface ${V(n)?"[&>td]:border-t [&>td]:border-line":""}`,children:c.map((m,U)=>{const C=U===c.length-1,Z=m.fieldKey==="diameter";return r("td",{className:`${C?"relative ":""}${le}${Z?" text-accent":""}`,children:[m.cell(e,h),C&&l&&t("span",{role:"tooltip",className:`pointer-events-none absolute top-1/2 right-0 z-20 hidden w-[520px] -translate-y-1/2 whitespace-normal bg-[var(--tooltip-bg)] px-3 py-2 text-right font-mono ${o.labelXs} normal-case tracking-[0.12em] text-fg shadow-lg group-hover:block max-[720px]:!hidden`,children:t(M,{answer:Y(e,K)})})]},m.fieldKey)})},B(e,c,h)))})]})}),t(J,{text:H,linkText:O,linkHref:W})]})}export{oe as default};
|
|
@@ -20,6 +20,7 @@ export interface AlloyWheelsListingProps {
|
|
|
20
20
|
showInStock?: boolean;
|
|
21
21
|
kinds?: string[];
|
|
22
22
|
products?: ProductSummary[];
|
|
23
|
+
requestQuery?: string;
|
|
23
24
|
wheels?: WheelSummary[];
|
|
24
25
|
editing?: boolean;
|
|
25
26
|
coverIndex?: number;
|
|
@@ -39,4 +40,4 @@ export declare const PLP_GATE_DEFAULTS: {
|
|
|
39
40
|
readonly heading: "Let's find wheels that fit your car.";
|
|
40
41
|
readonly intro: "Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you.";
|
|
41
42
|
};
|
|
42
|
-
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, editing, coverIndex, cardImage, spinOnHover, imageBackground, showBadge, showCardSizes, showCardBuy, showCardPage, showCardPrice, showCardFinishes, outline, indexBadge, titleLevel, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
43
|
+
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, requestQuery, editing, coverIndex, cardImage, spinOnHover, imageBackground, showBadge, showCardSizes, showCardBuy, showCardPage, showCardPrice, showCardFinishes, outline, indexBadge, titleLevel, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as s,Fragment as se}from"react/jsx-runtime";import{LISTING_CARD_SHOW as B}from"../../lib/sections/card-show-defaults.js";import{useCallback as d,useEffect as Je,useId as Qe,useMemo as l,useRef as Ze,useState as et}from"react";import{CARD_IMAGE_BG_OFF as tt,resolveCardImageBackground as ot}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as rt}from"efficient-web-builder/format/lib/content/card-image-shape";import{cardIndexCss as nt,DEFAULT_CARD_INDEX_FORMAT as st,DEFAULT_CARD_OUTLINE as it}from"efficient-web-builder/format/lib/sections/product-card-style";import{answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as lt}from"../CurrencyContext.js";import at from"../NoCurrencyNote.js";import{usePreviewDevice as ct}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as pt,renderHeadline as dt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as mt}from"../useProductCatalog.js";import{scrollBehavior as ht}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ut,PLP_GRID_GAP_VAR as ft,plpGridVars as gt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as yt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as xt,cardRowsGridStyle as St}from"../WheelCardFrame.js";import{applyPlpFilters as wt,asPlpSortKey as bt,buildPlpFacets as Ct,buildPlpTypeOptions as Nt,buildTyreSizeBoxes as vt,EMPTY_PLP_FILTERS as le,hasActivePlpFilters as Pt,paginatePlp as kt,pickTyreSize as _t,plpTyreSizeBoxesShown as Tt,plpInStockCount as At,plpOpeningSort as zt,plpPriceBounds as Ft,plpShownKinds as It,plpSortKeysFor as Ot,PLP_SORT_LABELS as Bt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as L,itemTyreSizes as Lt,plpBrandVaries as Vt,plpProcessVaries as Rt,plpItemsOfKinds as Et,plpKindNoun as V,resolvePlpKinds as Dt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Kt,plpVehicleCopy as jt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Gt,oemTyreSizes as Mt}from"../../lib/tyres/tyre-vehicle-fitment.js";import $t from"../TyreSummaryCard.js";import{wheelsFittingVehicle as Wt}from"../../lib/wheels/plp-fitment-match.js";import Ht from"./PlpActiveChips.js";import{DEFAULT_COVER_INDEX as Ut}from"../../lib/wheels/cover-rendering.js";import Xt from"./PlpCard.js";import Yt from"./PlpPagination.js";import qt from"./PlpSidebar.js";import Jt from"./PlpVehicleBar.js";import Qt from"./PlpVehicleGate.js";import{useVehicleCatalog as Zt}from"./useVehicleCatalog.js";import{useVehicleFit as eo}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as to}from"./usePlpFiltersInUrl.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const Do={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function oo({level:C,className:N,children:v}){return r(C===2?"h2":"h1",{className:N,children:v})}const ro=[];function no({heading:C="",intro:N="",askForCar:v=!0,gateHeading:E="",gateIntro:ae="",perPage:D=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:de=[],fieldUsage:g=ro,showPrice:K=!0,showInStock:me=!0,kinds:he,products:ue,wheels:fe,editing:m=!1,coverIndex:ge=Ut,cardImage:ye,spinOnHover:xe=!1,imageBackground:Se,showBadge:we=!0,showCardSizes:be,showCardBuy:Ce,showCardPage:Ne,showCardPrice:ve,showCardFinishes:Pe,outline:ke=it,indexBadge:j=st,titleLevel:_e}){const{currency:a}=lt(),Te=ot(Se,tt),h=Dt(he),G=ct(),M=ut(ce),Ae=gt(M,m?G:null),ze=yt(M,m?G:null),$=`plp-${Qe().replace(/:/g,"")}`,F=nt($,j),Fe=mt(),W=ue??fe??Fe??[],H=l(()=>Et(W,h),[W,h.join(",")]),o=eo({editing:m,enabled:v,autoApply:!0}),[Ie,I]=et(!1),Oe=zt(pe,h),y=o.applied?.vehicle??null,[t,w]=to({editing:m,openingSort:Oe,appliedVehicle:y,vehicleRestored:o.restored}),p=It(h,t.kind),i=d(e=>w(e),[w]),U=d((e,u)=>{const c=t[e],Ye=c.map(String).includes(u)?c.filter(qe=>String(qe)!==u):[...c,e==="diameters"?Number(u):u];i({...t,[e]:Ye,page:1})},[t,i]),X=d(e=>i({...t,priceMax:e,page:1}),[t,i]),Y=d(e=>i({...t,inStockOnly:e,page:1}),[t,i]),q=d(e=>i({...le,kind:e,inStockOnly:t.inStockOnly,priceMax:t.priceMax,sort:t.sort}),[t.inStockOnly,t.priceMax,t.sort,i]),Be=d(e=>i({...t,sort:e,page:1}),[t,i]),Le=d(e=>{i({...t,page:e}),typeof window<"u"&&window.scrollTo({top:0,behavior:ht()})},[t,i]),J=d(()=>i({...le,sort:t.sort}),[t.sort,i]),{clear:k}=o,Q=d(()=>{k(),I(!0),w(e=>({...e,page:1}))},[k]),Ve=d(()=>{k(),I(!1),w(e=>({...e,page:1}))},[k]),_=y?[y.make,y.model,y.year,y.modification].join("|"):"",T=Ze(null);Je(()=>{if(o.restored){if(T.current===null){T.current=_;return}T.current!==_&&(T.current=_,w(e=>e.page===1?e:{...e,page:1}))}},[o.restored,_,w]);const A=Zt({catalog:H,shownKinds:h,vehicle:y,editing:m}),n=l(()=>{if(!o.fit)return A;const e=A.filter(c=>z(c)==="alloy-wheel"),u=new Set(Wt(e,o.fit).map(c=>c.slug));return A.filter(c=>z(c)!=="alloy-wheel"||u.has(L(c)))},[A,o.fit]),b=de.join(","),Re=l(()=>{const e=new Set(b?b.split(","):[]);return Ct(n,t,a,p,g).filter(u=>!e.has(u.key))},[n,t,a,b,p.join(","),g]),x=l(()=>wt(n,t,a),[n,t,a]),Z=p.length>1,Ee=l(()=>ie(g,"alloy-wheel"),[g]),De=l(()=>ie(g,"tyre"),[g]),ee=l(()=>Vt(x),[x]),Ke=l(()=>Rt(x),[x]),je=l(()=>K?Ft(n,a):null,[n,a,K]),Ge=l(()=>At(n,t,a),[n,t,a]),Me=l(()=>Nt(n,h,t,a),[n,h.join(","),t,a]),$e=d((e,u)=>{const c=_t(n.flatMap(Lt),t.tyreSizes[0]??"",e,u);i({...t,tyreSizes:c?[c]:[],page:1})},[n,t,i]),We=l(()=>{const e=new Set(b?b.split(","):[]);return!Tt(n,p)||e.has("tyreSizes")?null:vt(n,t,a)},[n,t,a,b,p.join(","),g]),f=l(()=>kt(x,t.page,D),[x,t.page,D]),S=V(p),O=jt(p),te=Kt(E,ae,p,h),oe=p.length===1&&p[0]==="tyre",re=o.applied?.stock??null,P=l(()=>Mt(re),[re]),He=l(()=>n.filter(e=>p.includes(z(e))).length,[n,p.join(",")]),ne=H.length===0,Ue=!ne&&n.length===0,Xe=v&&!m&&!o.applied&&!Ie;return h.length===0?null:s("section",{style:rt(ye),children:[v&&r(Jt,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:oe&&P.length>0?`Takes ${P.join(" · ")}`:null,resolving:o.resolving,unresolved:oe?!!o.applied&&!o.resolving&&P.length===0:o.unresolved,matchCount:He,copy:O,onAmend:Ve,onClear:Q}),Xe&&r(Qt,{cascade:o.cascade,heading:te.heading,intro:te.intro,ready:o.restored,copy:O,onSkip:()=>I(!0)}),s("div",{className:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[(C||N)&&s("header",{className:"mb-6",children:[C&&r(oo,{level:_e,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:dt(C,!1)}),N&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:pt(N)})]}),s("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(qt,{facets:Re,filters:t,typeOptions:Me,sizeBoxes:We,sizeMatches:t.tyreSizes.length>0?x.length:null,noun:S,priceBounds:je,inStockCount:me?Ge:null,onToggle:U,onPickType:q,onPickSize:$e,onPriceMax:X,onInStockOnly:Y,onClearAll:J}),s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"mb-4 flex min-h-[34px] flex-wrap items-center justify-between gap-x-4 gap-y-2 border-b border-line pb-3",children:[s("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-4 gap-y-2",children:[r("p",{className:"font-mono text-[12px] tabular-nums tracking-[0.08em]",children:f.total===0?s("span",{className:"text-fg-dim",children:["No ",S.many]}):s(se,{children:[s("span",{children:[f.from,"–",f.to]}),s("span",{className:"text-fg-dim",children:[" of ",f.total," ",S.many]})]})}),r(Ht,{filters:t,onToggle:U,onPriceMax:X,onInStockOnly:Y,onPickType:q})]}),s("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Sort by",r("select",{value:t.sort,onChange:e=>Be(bt(e.target.value)),className:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] normal-case tracking-normal text-fg",children:Ot(h).map(e=>r("option",{value:e,children:Bt[e]},e))})]})]}),ne?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?S.many==="wheels"?R("No wheels in this website's catalog yet — curate products to see them here."):S.many==="tyres"?R("No tyres in this website's catalog yet — curate products to see them here."):R("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Ue?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:O.nothingFits}),s("button",{type:"button",onClick:Q,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",S.many]})]}):f.total===0?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",S.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),Pt(t)&&r("button",{type:"button",onClick:J,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):s(se,{children:[F&&r("style",{children:F}),r("div",{className:`${F?`${$} plp-card-grid`:"plp-card-grid"} ${xt}`,style:{...Ae,...St(`var(${ft})`)},children:f.items.map(e=>z(e)==="tyre"?r($t,{item:e,currency:a,fitSize:P.length>0?Gt(e.sizes,P):null,kindLabel:Z?V(["tyre"]).one:null,showBrand:ee,editing:m,fieldUsage:De},`tyre:${L(e)}`):r(Xt,{wheel:e,colours:t.finishes,fit:o.fit,editing:m,kindLabel:Z?V(["alloy-wheel"]).one:null,showBrand:ee,coverIndex:ge,fieldUsage:Ee,showProcess:Ke,spinOnHover:xe,imageBackgroundFill:Te,showBadge:we,outline:ke,indexBadge:j,showCardSizes:be??B.showCardSizes,showCardBuy:Ce??B.showCardBuy,showCardPage:Ne??B.showCardPage,showCardPrice:ve??!0,showCardFinishes:Pe??!0,imageSizes:ze},`wheel:${L(e)}`))})]}),r(Yt,{page:f.page,pageCount:f.pageCount,onPage:Le}),r(at,{editing:m})]})]})]})]})}export{Do as PLP_GATE_DEFAULTS,no as default};
|
|
1
|
+
"use client";import{jsx as r,jsxs as s,Fragment as se}from"react/jsx-runtime";import{LISTING_CARD_SHOW as B}from"../../lib/sections/card-show-defaults.js";import{useCallback as d,useEffect as Qe,useId as Ze,useMemo as l,useRef as et,useState as tt}from"react";import{CARD_IMAGE_BG_OFF as ot,resolveCardImageBackground as rt}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as nt}from"efficient-web-builder/format/lib/content/card-image-shape";import{cardIndexCss as st,DEFAULT_CARD_INDEX_FORMAT as it,DEFAULT_CARD_OUTLINE as lt}from"efficient-web-builder/format/lib/sections/product-card-style";import{answersForKind as ie}from"../../lib/content/field-usage.js";import{useCurrency as at}from"../CurrencyContext.js";import ct from"../NoCurrencyNote.js";import{usePreviewDevice as pt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as dt,renderHeadline as mt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as ht}from"../useProductCatalog.js";import{scrollBehavior as ut}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ft,PLP_GRID_GAP_VAR as gt,plpGridVars as yt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as xt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as St,cardRowsGridStyle as wt}from"../WheelCardFrame.js";import{applyPlpFilters as bt,asPlpSortKey as Ct,buildPlpFacets as Nt,buildPlpTypeOptions as vt,buildTyreSizeBoxes as Pt,EMPTY_PLP_FILTERS as le,hasActivePlpFilters as kt,paginatePlp as _t,pickTyreSize as Tt,plpTyreSizeBoxesShown as At,plpInStockCount as zt,plpOpeningSort as Ft,plpPriceBounds as It,plpShownKinds as Ot,plpSortKeysFor as Bt,PLP_SORT_LABELS as Lt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as L,itemTyreSizes as Vt,plpBrandVaries as Rt,plpProcessVaries as Et,plpItemsOfKinds as Dt,plpKindNoun as V,resolvePlpKinds as Kt}from"../../lib/catalog/plp-item.js";import{plpGateWords as jt,plpVehicleCopy as Gt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Mt,oemTyreSizes as $t}from"../../lib/tyres/tyre-vehicle-fitment.js";import Wt from"../TyreSummaryCard.js";import{wheelsFittingVehicle as Ht}from"../../lib/wheels/plp-fitment-match.js";import Ut from"./PlpActiveChips.js";import{DEFAULT_COVER_INDEX as Xt}from"../../lib/wheels/cover-rendering.js";import Yt from"./PlpCard.js";import qt from"./PlpPagination.js";import Jt from"./PlpSidebar.js";import Qt from"./PlpVehicleBar.js";import Zt from"./PlpVehicleGate.js";import{useVehicleCatalog as eo}from"./useVehicleCatalog.js";import{useVehicleFit as to}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as oo}from"./usePlpFiltersInUrl.js";import{say as R}from"efficient-web-builder/format/lib/editor-words";const Ko={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function ro({level:C,className:N,children:v}){return r(C===2?"h2":"h1",{className:N,children:v})}const no=[];function so({heading:C="",intro:N="",askForCar:v=!0,gateHeading:E="",gateIntro:ae="",perPage:D=24,columns:ce,defaultSort:pe="recommended",hiddenFacets:de=[],fieldUsage:g=no,showPrice:K=!0,showInStock:me=!0,kinds:he,products:ue,wheels:fe,requestQuery:ge,editing:m=!1,coverIndex:ye=Xt,cardImage:xe,spinOnHover:Se=!1,imageBackground:we,showBadge:be=!0,showCardSizes:Ce,showCardBuy:Ne,showCardPage:ve,showCardPrice:Pe,showCardFinishes:ke,outline:_e=lt,indexBadge:j=it,titleLevel:Te}){const{currency:a}=at(),Ae=rt(we,ot),h=Kt(he),G=pt(),M=ft(ce),ze=yt(M,m?G:null),Fe=xt(M,m?G:null),$=`plp-${Ze().replace(/:/g,"")}`,F=st($,j),Ie=ht(),W=ue??fe??Ie??[],H=l(()=>Dt(W,h),[W,h.join(",")]),o=to({editing:m,enabled:v,autoApply:!0}),[Oe,I]=tt(!1),Be=Ft(pe,h),y=o.applied?.vehicle??null,[t,w]=oo({editing:m,openingSort:Be,appliedVehicle:y,vehicleRestored:o.restored,requestQuery:ge}),p=Ot(h,t.kind),i=d(e=>w(e),[w]),U=d((e,u)=>{const c=t[e],qe=c.map(String).includes(u)?c.filter(Je=>String(Je)!==u):[...c,e==="diameters"?Number(u):u];i({...t,[e]:qe,page:1})},[t,i]),X=d(e=>i({...t,priceMax:e,page:1}),[t,i]),Y=d(e=>i({...t,inStockOnly:e,page:1}),[t,i]),q=d(e=>i({...le,kind:e,inStockOnly:t.inStockOnly,priceMax:t.priceMax,sort:t.sort}),[t.inStockOnly,t.priceMax,t.sort,i]),Le=d(e=>i({...t,sort:e,page:1}),[t,i]),Ve=d(e=>{i({...t,page:e}),typeof window<"u"&&window.scrollTo({top:0,behavior:ut()})},[t,i]),J=d(()=>i({...le,sort:t.sort}),[t.sort,i]),{clear:k}=o,Q=d(()=>{k(),I(!0),w(e=>({...e,page:1}))},[k]),Re=d(()=>{k(),I(!1),w(e=>({...e,page:1}))},[k]),_=y?[y.make,y.model,y.year,y.modification].join("|"):"",T=et(null);Qe(()=>{if(o.restored){if(T.current===null){T.current=_;return}T.current!==_&&(T.current=_,w(e=>e.page===1?e:{...e,page:1}))}},[o.restored,_,w]);const A=eo({catalog:H,shownKinds:h,vehicle:y,editing:m}),n=l(()=>{if(!o.fit)return A;const e=A.filter(c=>z(c)==="alloy-wheel"),u=new Set(Ht(e,o.fit).map(c=>c.slug));return A.filter(c=>z(c)!=="alloy-wheel"||u.has(L(c)))},[A,o.fit]),b=de.join(","),Ee=l(()=>{const e=new Set(b?b.split(","):[]);return Nt(n,t,a,p,g).filter(u=>!e.has(u.key))},[n,t,a,b,p.join(","),g]),x=l(()=>bt(n,t,a),[n,t,a]),Z=p.length>1,De=l(()=>ie(g,"alloy-wheel"),[g]),Ke=l(()=>ie(g,"tyre"),[g]),ee=l(()=>Rt(x),[x]),je=l(()=>Et(x),[x]),Ge=l(()=>K?It(n,a):null,[n,a,K]),Me=l(()=>zt(n,t,a),[n,t,a]),$e=l(()=>vt(n,h,t,a),[n,h.join(","),t,a]),We=d((e,u)=>{const c=Tt(n.flatMap(Vt),t.tyreSizes[0]??"",e,u);i({...t,tyreSizes:c?[c]:[],page:1})},[n,t,i]),He=l(()=>{const e=new Set(b?b.split(","):[]);return!At(n,p)||e.has("tyreSizes")?null:Pt(n,t,a)},[n,t,a,b,p.join(","),g]),f=l(()=>_t(x,t.page,D),[x,t.page,D]),S=V(p),O=Gt(p),te=jt(E,ae,p,h),oe=p.length===1&&p[0]==="tyre",re=o.applied?.stock??null,P=l(()=>$t(re),[re]),Ue=l(()=>n.filter(e=>p.includes(z(e))).length,[n,p.join(",")]),ne=H.length===0,Xe=!ne&&n.length===0,Ye=v&&!m&&!o.applied&&!Oe;return h.length===0?null:s("section",{style:nt(xe),children:[v&&r(Qt,{cascade:o.cascade,appliedName:o.appliedName,fit:o.fit,fitSummary:oe&&P.length>0?`Takes ${P.join(" · ")}`:null,resolving:o.resolving,unresolved:oe?!!o.applied&&!o.resolving&&P.length===0:o.unresolved,matchCount:Ue,copy:O,onAmend:Re,onClear:Q}),Ye&&r(Zt,{cascade:o.cascade,heading:te.heading,intro:te.intro,ready:o.restored,copy:O,onSkip:()=>I(!0)}),s("div",{className:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[(C||N)&&s("header",{className:"mb-6",children:[C&&r(ro,{level:Te,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:mt(C,!1)}),N&&r("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:dt(N)})]}),s("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[r(Jt,{facets:Ee,filters:t,typeOptions:$e,sizeBoxes:He,sizeMatches:t.tyreSizes.length>0?x.length:null,noun:S,priceBounds:Ge,inStockCount:me?Me:null,onToggle:U,onPickType:q,onPickSize:We,onPriceMax:X,onInStockOnly:Y,onClearAll:J}),s("div",{className:"min-w-0 flex-1",children:[s("div",{className:"mb-4 flex min-h-[34px] flex-wrap items-center justify-between gap-x-4 gap-y-2 border-b border-line pb-3",children:[s("div",{className:"flex min-w-0 flex-1 flex-wrap items-center gap-x-4 gap-y-2",children:[r("p",{className:"font-mono text-[12px] tabular-nums tracking-[0.08em]",children:f.total===0?s("span",{className:"text-fg-dim",children:["No ",S.many]}):s(se,{children:[s("span",{children:[f.from,"–",f.to]}),s("span",{className:"text-fg-dim",children:[" of ",f.total," ",S.many]})]})}),r(Ut,{filters:t,onToggle:U,onPriceMax:X,onInStockOnly:Y,onPickType:q})]}),s("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:["Sort by",r("select",{value:t.sort,onChange:e=>Le(Ct(e.target.value)),className:"cursor-pointer border border-line bg-transparent px-2 py-2 font-mono text-[12px] normal-case tracking-normal text-fg",children:Bt(h).map(e=>r("option",{value:e,children:Lt[e]},e))})]})]}),ne?r("div",{className:"border border-dashed border-line p-10",children:r("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?S.many==="wheels"?R("No wheels in this website's catalog yet — curate products to see them here."):S.many==="tyres"?R("No tyres in this website's catalog yet — curate products to see them here."):R("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Xe?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",o.appliedName]}),r("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:O.nothingFits}),s("button",{type:"button",onClick:Q,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",S.many]})]}):f.total===0?s("div",{className:"border border-line p-10",children:[s("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",S.many," match those filters"]}),r("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),kt(t)&&r("button",{type:"button",onClick:J,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):s(se,{children:[F&&r("style",{children:F}),r("div",{className:`${F?`${$} plp-card-grid`:"plp-card-grid"} ${St}`,style:{...ze,...wt(`var(${gt})`)},children:f.items.map(e=>z(e)==="tyre"?r(Wt,{item:e,currency:a,fitSize:P.length>0?Mt(e.sizes,P):null,kindLabel:Z?V(["tyre"]).one:null,showBrand:ee,editing:m,fieldUsage:Ke},`tyre:${L(e)}`):r(Yt,{wheel:e,colours:t.finishes,fit:o.fit,editing:m,kindLabel:Z?V(["alloy-wheel"]).one:null,showBrand:ee,coverIndex:ye,fieldUsage:De,showProcess:je,spinOnHover:Se,imageBackgroundFill:Ae,showBadge:be,outline:_e,indexBadge:j,showCardSizes:Ce??B.showCardSizes,showCardBuy:Ne??B.showCardBuy,showCardPage:ve??B.showCardPage,showCardPrice:Pe??!0,showCardFinishes:ke??!0,imageSizes:Fe},`wheel:${L(e)}`))})]}),r(qt,{page:f.page,pageCount:f.pageCount,onPage:Ve}),r(ct,{editing:m})]})]})]})]})}export{Ko as PLP_GATE_DEFAULTS,so as default};
|
|
@@ -6,5 +6,6 @@ export interface PlpUrlFiltersArgs {
|
|
|
6
6
|
openingSort: PlpSortKey;
|
|
7
7
|
appliedVehicle: VehicleSelection | null;
|
|
8
8
|
vehicleRestored: boolean;
|
|
9
|
+
requestQuery?: string;
|
|
9
10
|
}
|
|
10
|
-
export declare function usePlpFiltersInUrl({ editing, openingSort, appliedVehicle, vehicleRestored, }: PlpUrlFiltersArgs): [PlpFilterState, Dispatch<SetStateAction<PlpFilterState>>];
|
|
11
|
+
export declare function usePlpFiltersInUrl({ editing, openingSort, appliedVehicle, vehicleRestored, requestQuery, }: PlpUrlFiltersArgs): [PlpFilterState, Dispatch<SetStateAction<PlpFilterState>>];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{useEffect as
|
|
1
|
+
"use client";import{useEffect as d,useState as l}from"react";import{EMPTY_PLP_FILTERS as E,plpFiltersFromParams as L,plpFiltersToParams as i}from"../../lib/wheels/plp-filters.js";import{appendVehicleParams as P}from"../../lib/wheels/plp-vehicle-params.js";const w="plp:locationchange";let m=!1;function S(t){if(typeof window>"u")return()=>{};if(!m){m=!0;for(const e of["pushState","replaceState"]){const n=window.history[e];window.history[e]=function(...a){n.apply(this,a),window.dispatchEvent(new Event(w))}}}return window.addEventListener("popstate",t),window.addEventListener(w,t),()=>{window.removeEventListener("popstate",t),window.removeEventListener(w,t)}}function y(t,e){const n=L(new URLSearchParams(t));return i(n).toString()===""?{...E,sort:e}:n}function I({editing:t,openingSort:e,appliedVehicle:n,vehicleRestored:s,requestQuery:a}){const[c,p]=l(()=>y(t?"":a??"",e)),[f,h]=l(!1);return d(()=>{if(t||typeof window>"u")return;const r=()=>{const o=y(window.location.search,e);p(u=>i(u).toString()===i(o).toString()?u:o)};return r(),h(!0),S(r)},[t,e]),d(()=>{if(t||!f||!s||typeof window>"u")return;const r=i(c);P(r,n);const o=r.toString();window.history.replaceState(null,"",`${window.location.pathname}${o?`?${o}`:""}`)},[t,f,s,c,n]),[c,p]}export{I as usePlpFiltersInUrl};
|
|
@@ -18,7 +18,6 @@ export declare function applyCardAnswers<T extends {
|
|
|
18
18
|
}>(facts: readonly T[], answers: readonly FieldUsageAnswer[]): readonly T[];
|
|
19
19
|
export declare function answerOrder(answers: readonly FieldUsageAnswer[], place: "filter" | "card"): (fieldKey: string | undefined) => number | undefined;
|
|
20
20
|
export declare function keepForSpec(answers: readonly FieldUsageAnswer[]): (fieldKey: string | undefined) => boolean;
|
|
21
|
-
export declare function keepForFitment(answers: readonly FieldUsageAnswer[]): (fieldKey: string | undefined) => boolean;
|
|
22
21
|
export declare function applySpecAnswers<T extends {
|
|
23
22
|
fieldKey?: string;
|
|
24
23
|
}>(rows: T[], answers: readonly FieldUsageAnswer[]): T[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function g(e,n){return e.length===0?e:e.filter(o=>o.kind===void 0||o.kind===n)}function k(e,n){if(n.length===0)return e;const o=y(n);return s(e.filter(r=>o(r.fieldKey)),r=>r.fieldKey,n,"cardOrder")}function K(e,n){const o=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(const t of e){const d=t[o];if(typeof d!="number"||!Number.isFinite(d))continue;const l=r.get(t.fieldKey);(l===void 0||d<l)&&r.set(t.fieldKey,d)}return t=>t?r.get(t):void 0}function a(e){return c(e,"spec")}function w(e,n){if(n.length===0)return e;const o=a(n),r=e.filter(t=>o(t.fieldKey));return s(r,t=>t.fieldKey,n,"specOrder")}function s(e,n,o,r){const t=new Map;for(const i of o){const f=i[r];typeof f=="number"&&t.set(i.fieldKey,f)}if(t.size===0)return e;const d=[],l=[];e.forEach((i,f)=>{const p=n(i);p&&(d.push(f),l.push({item:i,index:f,order:t.get(p)}))}),l.sort((i,f)=>i.order!==void 0&&f.order!==void 0?i.order-f.order||i.index-f.index:i.order!==void 0?-1:f.order!==void 0?1:i.index-f.index);const u=[...e];return d.forEach((i,f)=>{u[i]=l[f].item}),u.every((i,f)=>i===e[f])?e:u}function y(e){return c(e,"card")}function F(e){return c(e,"filter")}const h="collection";function m(e,n){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":h},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function x(e){return{size:"size",finish:"wheel_finish_ref",loadIndex:"load_index",speedRating:"speed_rating",tyreType:"tire_type",boltPattern:"bolt_pattern",et:"et",centreBore:"center_bore"}[e]}function _(e,n,o){const r=x(e);if(!r)return n;const t=o.find(d=>d.fieldKey===r)?.variant;return t===void 0?n:t==="none"?null:t}function O(e,n){if(n.length===0)return e;const o=[];let r=!1;for(const t of e){const d=_(t.key,t.role,n);if(d===null){r=!0;continue}if(d===t.role){o.push(t);continue}r=!0,o.push({...t,role:d})}return r?o:e}function c(e,n){const o=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!o.has(r)}export{h as COLLECTION_FIELD_KEY,K as answerOrder,g as answersForKind,k as applyCardAnswers,w as applySpecAnswers,O as applyVariantAnswers,m as facetFieldKey,y as keepForCard,F as keepForFilter,a as keepForSpec,x as optionFieldKey,s as orderByAnswers,_ as variantRoleFor};
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { type FieldUsageAnswer } from "../content/field-usage.js";
|
|
2
2
|
import type { FitmentRow } from "./fitments.js";
|
|
3
|
+
export type LoadUnit = "kg" | "lbs";
|
|
3
4
|
export interface FitmentColumn {
|
|
4
5
|
fieldKey: string;
|
|
5
6
|
header: string;
|
|
6
|
-
|
|
7
|
+
shownByDefault: boolean;
|
|
8
|
+
cell: (row: FitmentRow, unit: LoadUnit) => string | number;
|
|
7
9
|
}
|
|
10
|
+
export declare function loadUnitFor(country: string): LoadUnit;
|
|
11
|
+
export declare function formatLoad(text: string, unit: LoadUnit): string;
|
|
8
12
|
export declare const FITMENT_COLUMNS: readonly FitmentColumn[];
|
|
13
|
+
export declare function fitmentColumnShown(column: FitmentColumn, answers: readonly Pick<FieldUsageAnswer, "fieldKey" | "fitment">[]): boolean;
|
|
9
14
|
export declare function fitmentColumns(answers: readonly FieldUsageAnswer[]): readonly FitmentColumn[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{orderByAnswers as h}from"../content/field-usage.js";function B(e){return e.toUpperCase()==="US"?"lbs":"kg"}const s=.45359237,d=/\d[\d,]*(?:\.\d+)?/g,p=/(\d[\d,]*(?:\.\d+)?(?:\s*[–-]\s*\d[\d,]*(?:\.\d+)?)?)\s*(kgs?|lbs?)\b/gi,a=e=>Number(e.replace(/,/g,"")),f=e=>Math.round(e).toLocaleString("en-US");function y(e,t){const o={};for(const[,n,i]of e.matchAll(p)){const u=i.toLowerCase().startsWith("kg")?"kg":"lbs";o[u]??=n}const r=o[t];if(r!==void 0)return`${r.replace(d,n=>f(a(n))).replace(/\s*([–-])\s*/,"$1")} ${t}`;const l=o[t==="kg"?"lbs":"kg"];if(l===void 0)return e.trim();const c=t==="kg"?s:1/s;return`${l.replace(d,n=>f(a(n)*c)).replace(/\s*([–-])\s*/,"$1")} ${t}`}const b=e=>e>0?`+${e}`:e<0?`−${-e}`:"0",m=e=>{const t=/^(\d+)\s*[×x]\s*\d/.exec(e.boltPattern)?.[1];return t!==void 0&&Number(t)===e.holes?e.boltPattern:e.holes>0&&e.pcd?`${e.holes}×${e.pcd}`:e.boltPattern},g=[{fieldKey:"diameter",header:"Size",shownByDefault:!0,cell:e=>`${e.diameter} × ${e.width}`},{fieldKey:"bolt_pattern",header:"Bolt pattern",shownByDefault:!0,cell:m},{fieldKey:"et",header:"Offset",shownByDefault:!0,cell:e=>b(e.et)},{fieldKey:"center_bore",header:"Centre bore",shownByDefault:!1,cell:e=>e.cb},{fieldKey:"cap_code",header:"Cap",shownByDefault:!1,cell:e=>e.cap},{fieldKey:"load_rating",header:"Load",shownByDefault:!0,cell:(e,t)=>y(e.loadRating,t)}];function $(e,t){const o=t.find(r=>r.fieldKey===e.fieldKey)?.fitment;return e.shownByDefault?o!==!1:o===!0}function K(e){const t=g.filter(o=>$(o,e));return e.length===0?t:h(t,o=>o.fieldKey,e,"fitmentOrder")}export{g as FITMENT_COLUMNS,$ as fitmentColumnShown,K as fitmentColumns,y as formatLoad,B as loadUnitFor};
|
|
@@ -6,6 +6,7 @@ export declare const PRODUCT_GRID_TYPE = "ProductGrid";
|
|
|
6
6
|
export declare const GRID_CATALOG_PROP = "catalog";
|
|
7
7
|
export declare const CATALOG_FILTER_BAR_TYPE = "CatalogFilterBar";
|
|
8
8
|
export declare const FIELD_USAGE_PROP = "fieldUsage";
|
|
9
|
+
export declare const LISTING_QUERY_PROP = "requestQuery";
|
|
9
10
|
interface ContentNode {
|
|
10
11
|
type?: string;
|
|
11
12
|
props?: Record<string, unknown>;
|
|
@@ -16,6 +17,7 @@ export declare function hydrateFieldUsage(data: Data, answers: readonly FieldUsa
|
|
|
16
17
|
export declare function listingCatalogKinds(data: Data | null | undefined): ProductKind[];
|
|
17
18
|
export declare function listingWantsWheelsOnly(kinds: readonly ProductKind[]): boolean;
|
|
18
19
|
export declare function hydrateWheelsListing(data: Data, products: ProductSummary[] | WheelSummary[]): Data;
|
|
20
|
+
export declare function stampListingQuery(data: Data, query: string): Data;
|
|
19
21
|
export declare function dehydrateWheelsListing(data: Data): Data;
|
|
20
22
|
export declare function dehydrateWheelsListingNode<T extends ContentNode>(node: T): T;
|
|
21
23
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{resolvePlpKinds as y}from"../catalog/plp-item.js";import{isLinkedSource as
|
|
1
|
+
import{resolvePlpKinds as y}from"../catalog/plp-item.js";import{isLinkedSource as O,rowsForGridSource as G}from"./grid-source.js";const c="AlloyWheelsListing",E="ProductGrid",L="catalog",R="CatalogFilterBar",u="fieldUsage",x="requestQuery";function P(r){return r.props?.source}function i(r){return r?.type===E&&O(P(r))}function f(r){return r?.type===R}function a(r){return r?.type===c||i(r)||f(r)}function g(r){const t=r.content??[],e=r.zones??{};return[...t,...Object.values(e).flat()]}function A(r){return r?g(r).some(t=>t?.type===c||i(t)):!1}function I(r){return r?g(r).some(a):!1}function U(r,t){return t.length===0?r:l(r,a,e=>({...e,props:{...e.props??{},[u]:t}}))}function k(r){if(!r)return[];const t=new Set;for(const e of g(r))if(!(e?.type!==c&&!i(e)))for(const s of y(e.props?.kinds))t.add(s);return[...t]}function C(r){return r.length===1&&r[0]==="alloy-wheel"}function N(r,t){return F(r,e=>i(e)?{...e,props:{...h(e).props,[L]:G(P(e)??{},W(t,y(e.props?.kinds)))}}:{...e,props:{..._(e).props,products:t}})}function z(r,t){const e=t.replace(/^\?/,"");return e?l(r,s=>s?.type===c,s=>({...s,props:{...s.props??{},[x]:e}})):r}function Y(r){return l(r,a,t=>f(t)?m(t):i(t)?h(t):_(t))}function m(r){if(!r.props||!(u in r.props))return r;const{[u]:t,...e}=r.props;return{...r,props:e}}function h(r){const{[L]:t,[u]:e,...s}=r.props??{},n=s.source;if(n&&"wheels"in n){const{wheels:p,...o}=n;s.source=o}return{...r,props:s}}function W(r,t){const e=new Set(t);return r.filter(s=>{const n=s.kind??"alloy-wheel";return e.has(n)})}function D(r){return i(r)?h(r):f(r)?m(r):r?.type===c?_(r):r}function _(r){const{wheels:t,products:e,[u]:s,[x]:n,...p}=r.props??{};return{...r,props:p}}function F(r,t){return l(r,e=>e?.type===c||i(e),t)}function l(r,t,e){const s=o=>t(o)?e(o):o,n=r,p={...r};return n.content&&(p.content=n.content.map(s)),n.zones&&(p.zones=Object.fromEntries(Object.entries(n.zones).map(([o,w])=>[o,w.map(s)]))),p}export{c as ALLOY_WHEELS_LISTING_TYPE,R as CATALOG_FILTER_BAR_TYPE,u as FIELD_USAGE_PROP,L as GRID_CATALOG_PROP,x as LISTING_QUERY_PROP,E as PRODUCT_GRID_TYPE,Y as dehydrateWheelsListing,D as dehydrateWheelsListingNode,U as hydrateFieldUsage,N as hydrateWheelsListing,k as listingCatalogKinds,C as listingWantsWheelsOnly,A as pageHasWheelsListing,I as pageReadsFieldUsage,z as stampListingQuery};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-storefront-blocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.61.0",
|
|
4
4
|
"description": "The EFFICIENT storefront's website editor — the website builder assembled with the storefront's own sections — for an app that edits a storefront website inside its own page. Built from the efficient-storefront-blocks repository.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -37,6 +37,11 @@
|
|
|
37
37
|
"import": "./dist/consent.js",
|
|
38
38
|
"default": "./dist/consent.js"
|
|
39
39
|
},
|
|
40
|
+
"./fitment": {
|
|
41
|
+
"types": "./dist/fitment.d.ts",
|
|
42
|
+
"import": "./dist/fitment.js",
|
|
43
|
+
"default": "./dist/fitment.js"
|
|
44
|
+
},
|
|
40
45
|
"./words": {
|
|
41
46
|
"types": "./dist/words.d.ts",
|
|
42
47
|
"import": "./dist/words.js",
|
|
@@ -65,6 +70,8 @@
|
|
|
65
70
|
"dist/links.d.ts",
|
|
66
71
|
"dist/consent.js",
|
|
67
72
|
"dist/consent.d.ts",
|
|
73
|
+
"dist/fitment.js",
|
|
74
|
+
"dist/fitment.d.ts",
|
|
68
75
|
"dist/words.js",
|
|
69
76
|
"dist/words.d.ts",
|
|
70
77
|
"dist/editor.css",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as ut,i as me,q as ct,s as dt,t as ft,v as B}from"./chunk-FCCEAXMM.js";import{Aa as pe,Ba as st,Ea as $e,Fa as lt,Ia as Be,Ja as We}from"./chunk-I6VNNXUI.js";import{j as at,l as oe}from"./chunk-VT346MLP.js";import{createContext as sn,useContext as ln,useEffect as un,useMemo as he,useState as gt}from"react";function pt(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var qe=4,Pr=1,wr={unit:"set",spares:0,spareSide:"left"};function mt(e){return e.unit==="single"?1:qe+e.spares}function _r(e,t){return[{partNumber:e.partNumber,wheels:mt(t),prices:e.prices}]}function Rr(e,t){let n=mt(t)-qe;if(n<=0||e.length===0)return e;let r=on(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function on(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function an(e,t){return t.spares>0?`${e} + spare`:e}function Nr(e){return e.unit==="single"?"Single":an(`Set of ${qe}`,e)}var Lr="data-add-to-basket",Ge=9,Ne="en";function ge(e,t,n=0){return new Intl.NumberFormat(Ne,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function Ir(e,t){return new Intl.NumberFormat(Ne,{style:"currency",currency:t}).format(e)}import{jsx as pn}from"react/jsx-runtime";var cn="storefront-country",ht=cn,yt=sn(null);function dn(e){return bt(e,"catalogue")}function fn(e){return bt(e,"money")}function bt(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let s=n.get(i)??0;a=new Intl.NumberFormat(Ne,{style:"currency",currency:i,minimumFractionDigits:t==="money"?s:0,maximumFractionDigits:s}),r.set(i,a)}return a.format(o)}}function Mr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=he(()=>t??[],[t]),a=he(()=>n??[],[n]),s=he(()=>r||i.find(y=>y.isDefault)?.code||i[0]?.code||"",[r,i]),c=he(()=>o||a.find(y=>y.isDefault)?.code||a[0]?.code||"",[o,a]),[u,f]=gt(c),[d,S]=gt(!1);un(()=>{let y=oe.getItem(ht);y&&a.some(w=>w.code===y)&&f(y),S(!0)},[a]);function R(y){f(y),oe.setItem(ht,y)}let C=he(()=>{let y=a.find(v=>v.code===u)??null,w=y?.currency,O=w&&i.some(v=>v.code===w)?w:s,M=dn(i),L=fn(i);return{country:u,currency:O,setCountry:R,currencies:i,countries:a,activeCountry:y,formatPrice:(v,x)=>M(v,x??O),formatMoney:(v,x)=>L(v,x??O),ready:d}},[u,i,a,s,d]);return pn(yt.Provider,{value:C,children:e})}function Ct(){let e=ln(yt);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}import{createContext as Nn,useCallback as T,useContext as Ln,useEffect as j,useMemo as Tt,useRef as ae,useState as k}from"react";function St(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var vt="We'll confirm this discount when you place your order.",Hr="Confirmed at checkout";function $r(e){return e&&(e.valid||e.deferred)?e.code:void 0}var xt="coupon_code: ";function Br(e){return!(e instanceof me)||e.status!==400||!e.message.startsWith(xt)?null:e.message.slice(xt.length)}function Et(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Le="Price on request",gn="Request a quote",hn="from ",Kr="From ",zr="each",Pt="Free";function Ke(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ze(e,t){let n=e?.[t];return Ke(n)?n:null}function Xr(e,t,n,r){let o=ze(e,n),i=ze(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function Yr(e,t,n,r){if(n==null&&r==null)return!0;let o=ze(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var yn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function bn(e,t,n){if(!Ke(e))return yn;let r=Ke(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Vr(e,t,n=""){return!e.priced||e.unit==null?Le:`${n}${ge(e.unit,t)}`}function jr(e,t){return e.was==null?null:ge(e.was,t)}function Cn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,s)=>a+s.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var xn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function Qr(e,t,n,r=1){let o=bn(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=Cn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...xn,fromSetTotal:i}}function Sn(e,t){return!e.priced||e.unit==null?Le:`${e.isFrom?hn:""}${ge(e.unit,t)}`}function Zr(e,t){return e.was==null?null:ge(e.was,t)}function Jr(e,t){return!e.priced||e.unit==null?gn:Sn(e,t)}var vn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function wt(e){return vn.test(e.trim())}var _t="sf:ga-purchases",En=20;function Nt(){return typeof window>"u"||window.parent!==window}function ye(...e){try{if(Nt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Pn(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ie(e.components,t)??0,quantity:e.qty}}function Xe(e,t){return e.filter(Ie).map(n=>Pn(n,t))}function io(e){ye("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function Lt(e,t){let n=Xe([e],t);n.length!==0&&ye("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function ao(e){let t=Xe(e.lines,e.currency);t.length!==0&&ye("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var Rt=new Set;function wn(e){if(Rt.has(e))return!1;Rt.add(e);try{let t=JSON.parse(oe.getItem(_t)??"[]");if(t.includes(e))return!1;oe.setItem(_t,JSON.stringify([...t,e].slice(-En)))}catch{}return!0}function so(e){let t=e.confirmation;if(Nt()||!wn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ye("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Xe(e.lines,n)}),e.adsSendTo&&ye("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var _n="Arranged after review",It="Calculated at checkout",Rn=It,co=It;function At({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function fo(e){switch(e){case"arranged":return _n;case"pending":return Rn;case"free":return Pt;case"charged":return null}}import{jsx as kn}from"react/jsx-runtime";var In=400,An=400,Tn=1500;function Ie(e){return(e.components?.length??0)>0}function kt(e,t){return{code:e,valid:t.valid,deferred:St(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Mt(e,t){return ie(e.components,t)}function Ye(e,t){let n=Mt(e,t);return n===null?null:n*e.qty}function Ot(e){return e!=="tyre"}var Dt=Nn(null);function Po({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Ct(),[i,a]=k(t),[s,c]=k([]),[u,f]=k([]),[d,S]=k([]),[R,C]=k(!1),[y,w]=k(!1),[O,M]=k(!1),[L,v]=k(!1),[x,W]=k(null),[I,q]=k(void 0),b=ae(r),_=ae("");b.current=b.current||r;let[p,G]=k(null),[Q,F]=k(!1),[D,ve]=k(null),K=ae(void 0),Y=T(()=>a(!0),[]),le=T(()=>a(!1),[]),Z=T(()=>a(l=>!l),[]);j(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&Y()},[Y,t]);let Ee=T(l=>{v(!0),Ot(l)&&M(!0)},[]),U=O||s.some(l=>Ot(l.kind)),Pe=L||s.length>0;j(()=>{if(t||!U||R)return;let l=!0;return B.listWheels().then(m=>{l&&(f(m),C(!0))}),()=>{l=!1}},[t,U,R]),j(()=>{if(t||!Pe||y)return;let l=!0;return B.listBundles().then(m=>{l&&(S(m),w(!0))}),()=>{l=!1}},[t,Pe,y]);let P=x?.deliveryOptions??[];j(()=>{P.length!==0&&ve(l=>l&&P.some(m=>m.id===l)?l:P[0]?.id??null)},[x]);let J=T(()=>s.filter(Ie).flatMap(l=>pt(l.components,l.qty)),[s]),ee=T(async(l,m)=>{let h=l.trim().toUpperCase();if(!h)return;let g=J();if(g.length===0){G({code:h,valid:!1,message:"Add a wheel to the cart first."});return}F(!0),K.current=m;try{let N=await B.validateCoupon({code:h,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:m});G(kt(h,N))}catch{G({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{F(!1)}},[J,n,D]),ue=T(()=>{G(null),K.current=void 0},[]),ce=T(l=>{if(!p)return;let{code:m}=p;G(h=>h&&h.code===m?{code:m,valid:!1,refused:!0,message:l}:h)},[p]);j(()=>{if(!p||p.refused)return;let l=p.code,m=g=>g!==null&&g.code===l&&!g.refused,h=setTimeout(async()=>{let g=J();if(g.length===0){G(N=>m(N)?{code:l,valid:!1,message:"Add a wheel to the cart first."}:N);return}F(!0);try{let N=await B.validateCoupon({code:l,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:K.current});G(fe=>m(fe)?kt(l,N):fe)}catch{}finally{F(!1)}},In);return()=>clearTimeout(h)},[s,n,D]);let te=p&&!p.refused?p.code:void 0;j(()=>{if(t)return;let l=!0,m=setTimeout(async()=>{let h=J();if(h.length===0){W(null),q(void 0);return}try{let g=await B.quoteCart({items:h,currency:n,shippingMethodId:D??void 0,couponCode:te,customerEmail:K.current||void 0,country:b.current||void 0,subdivision:_.current||void 0});if(!l)return;W(g)}catch{if(!l)return}q(te)},An);return()=>{l=!1,clearTimeout(m)}},[s,n,D,te,r]);let de=T(l=>{c(m=>{let h=m.findIndex(g=>g.id===l.id);return h===-1?[...m,l]:m.map((g,N)=>N===h?{...g,qty:Math.min(Ge,g.qty+l.qty)}:g)}),Lt(l,n)},[n]),ne=T(l=>{c(m=>m.filter(h=>h.id!==l))},[]),we=T((l,m)=>{let h=Math.max(1,Math.min(Ge,m));c(g=>g.map(N=>N.id===l?{...N,qty:h}:N))},[]),_e=T(l=>{c(l)},[]),[E,H]=k(null),V=ae(null);V.current=E;let $=ae(null),Fe=ae(""),tt=T((l,m)=>{let h=l.trim().toLowerCase();wt(h)&&H(g=>g&&g.email===h&&g.firstName===(m??"")?g:{email:h,firstName:m??""})},[]);j(()=>{if(t||!E)return;let l=Et(s.filter(Ie),g=>Ye(g,n)===null?Le:o(Ye(g,n),n)),m={email:E.email,firstName:E.firstName,currency:n,items:l},h=JSON.stringify(m);if(h!==Fe.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Fe.current=h,B.captureCart(m).catch(g=>{})},Tn),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[s,E,n,t]);let nt=T(()=>{$.current&&(clearTimeout($.current),$.current=null);let l=V.current;l&&(Fe.current="",B.captureCart({email:l.email,firstName:l.firstName,currency:n,items:[]}).catch(m=>{}))},[n]),rt=Tt(()=>{let l=s.reduce((A,re)=>{let Re=Ye(re,n);return Re===null?A:A+Re},0),m=s.some(A=>Mt(A,n)===null),h=s.reduce((A,re)=>A+re.qty,0),g=p?.valid?p.effects:void 0,N=g?Math.min(l,Number(g.discountAmount)):0,fe=x?.bundleDiscount??0,Jt=x?.appliedBundles??[],Ue=!!g?.freeShipping,ot=P.find(A=>A.id===D),it=Ue?0:x?.shipping??ot?.amount??0,en=At({quoted:x!==null,optionCount:P.length,chosenAmount:ot?.amount,couponWaivesFreight:Ue}),He={};for(let A of g?.freeUnits??[])He[A.partNumber]=(He[A.partNumber]??0)+A.quantity;let tn=x?.tax??null,nn=x?x.grandTotal:l-N-fe+it;return{sets:h,units:s.reduce((A,re)=>A+(re.components??[]).reduce((Re,rn)=>Re+rn.wheels*re.qty,0),0),subtotal:l,hasUnpricedLine:m,discount:N,bundleDiscount:fe,appliedBundles:Jt,shipping:it,freeShipping:Ue,shippingStatus:en,freeUnitsByPartNumber:He,tax:tn,grand:nn,repricing:!!p?.refused&&x!==null&&I===p?.code,currency:n}},[s,n,p,P,D,x,I]),Zt=Tt(()=>({isOpen:i,preview:t,open:Y,close:le,toggle:Z,items:s,catalog:u,bundles:d,warmCatalog:Ee,add:de,remove:ne,setQty:we,replaceItems:_e,identify:tt,clearCapturedCart:nt,coupon:p,applyCoupon:ee,removeCoupon:ue,refuseCoupon:ce,couponBusy:Q,deliveryOptions:P,shippingMethodId:D,setShippingMethodId:ve,totals:rt}),[i,t,Y,le,Z,s,u,d,Ee,de,ne,we,_e,tt,nt,p,ee,ue,ce,Q,P,D,rt]);return kn(Dt.Provider,{value:Zt,children:e})}function Ft(){let e=Ln(Dt);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as Gn}from"react";function Ut(e,t,n,r){for(;e.size>=t;){let o,i;for(let[s,c]of e){if(c.expiresAt<=r){o=s;break}i===void 0&&n(s)&&(i=s)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var On=6e4,Mn=5e3,Dn=500,Ae=new Map;async function Fn(e){let{host:t,matchesRequestHost:n}=await ct();if(!t)return"";let r=await dt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var Un=e=>e.includes("|slug:")||e.includes("|xhost:");async function Ht(e,t){if(await ft()!==null)return t();let n=await Fn(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",s=a?Mn:On,c=Ae.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,f=a&&u?u:i;return Ut(Ae,Dn,Un,r),Ae.set(n,{load:f,expiresAt:r+s,lastGood:u}),f}var Hn=404;function $n(e){if(e instanceof me&&e.status===Hn)return{state:"absent"};let t=e instanceof me?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Bn="[storefront:chrome-load-failed]";function Wn(e,t){console.error(`${Bn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function $t(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=$n(o);return i.state==="failed"&&Wn(e,i),{value:n,outcome:i}}}function qn(e){return e==="production"?"silent":"banner"}var To=qn("production");function Kn(e,t){return e?.trim()||t}function $o({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Kn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var zn={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e},Bo=Gn(async()=>Ht("site",()=>$t("site",async()=>{let e=await B.getSite();return{name:st(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:lt(e.socialLinks)}},zn)));var Wo={name:pe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e};import{jsx as Ce,jsxs as Ve}from"react/jsx-runtime";import{useEffect as Te,useId as jn,useRef as Wt,useState as ke}from"react";import{efficientClientOpen as Xn}from"efficient-easel/screen/lib/session";var be=new Map,Yn=64;async function Vn(e){if(!Xn())return null;try{let t=await fetch(`${at()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function Bt(e){let t=be.get(e);if(t)return t;let n=Vn(e);if(be.set(e,n),be.size>Yn){let r=be.keys().next();r.done||be.delete(r.value)}return n}var Qn=202/22,Zn=.88,ri=16,Jn="invert(1)";function oi({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:s,size:c="medium",sizePx:u,wordmark:f,siteName:d=pe,fitToContainer:S=!1,fitWordmarkToContainer:R=!1,fitFloorPx:C}){let y=f&&f.trim()?f.trim():d,[w,O]=ke(!1),M=Wt(null),L=E=>{M.current=E};Te(()=>{let E=M.current?.ownerDocument??document,H=()=>{O(E.documentElement.getAttribute("data-theme")==="light")};H();let V=new MutationObserver(H);return V.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>V.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&ut(v),W=i??(w&&t),I=o&&o.trim()?o.trim():null,q=r&&!I,b=`logo-color-${jn().replace(/[^A-Za-z0-9_-]/g,"")}`,_=q&&x&&v&&a!=null?{reversed:a,inkIsDark:s??null}:null,p=_!==null,[G,Q]=ke(null);Te(()=>{if(!q||!v||!x||p){Q(null);return}let E=!1;return Q(null),Bt(v).then(H=>{E||Q(H)}),()=>{E=!0}},[q,v,x,p]);let F=_??G,D=!!F&&F.inkIsDark!==null&&(W?!F.inkIsDark:F.inkIsDark),ve=q&&!!v&&!x&&!W,K=D&&F?F.reversed:v,Y=K?[K]:[],[le,Z]=ke(0);Te(()=>{Z(0)},[v,D]);let Ee=e==="footer"?We:Be[c],U=u&&u>0?u:Ee,Pe=Math.round(U*Qn),P=le<Y.length?Y[le]:null,[J,ee]=ke(K),ue=P!==null&&P===J,ce=Wt(null);Te(()=>{let E=ce.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){ee(P);return}let H=!1;return E.decode().then(()=>!H&&ee(P),()=>!H&&Z(V=>V+1)),()=>{H=!0}},[P]);let te=S||R,de=`calc(100cqi / ${((y.length+1)*Zn).toFixed(2)})`,ne=te&&C&&C>0?Math.min(C,U):null,we=te?ne===null?`min(${U}px, ${de})`:`clamp(${ne}px, ${de}, ${U}px)`:`${U}px`,_e=Ve("span",{className:`font-display font-bold tracking-[0.18em] ${ne===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:we,lineHeight:1,...I?{color:I}:{}},"aria-label":y,children:[y,Ce("span",{className:"text-accent",style:I?{color:I}:void 0,children:"."})]});return Ve("span",{ref:L,className:"inline-flex items-center",children:[!ue&&_e,I&&P&&Ce("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Ve("filter",{id:b,colorInterpolationFilters:"sRGB",children:[Ce("feFlood",{style:{floodColor:I}}),Ce("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),P&&Ce("img",{ref:ce,src:P,alt:y,width:Pe,height:U,className:"shrink-0 object-contain",style:{...ue?{height:`${U}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...ve?{filter:Jn}:{},...I?{filter:`url(#${b})`}:{}},onLoad:()=>ee(P),onError:()=>Z(E=>E+1)},P)]})}import{jsx as xe,jsxs as tr}from"react/jsx-runtime";function er({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,s=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(s.push({x1:a(100+Math.cos(u)*22),y1:a(100+Math.sin(u)*22),x2:a(100+Math.cos(u)*86),y2:a(100+Math.sin(u)*86),main:!0}),t){let f=u+Math.PI/e;s.push({x1:a(100+Math.cos(f)*22*1.4),y1:a(100+Math.sin(f)*22*1.4),x2:a(100+Math.cos(f)*78),y2:a(100+Math.sin(f)*78),main:!1})}}return tr("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[xe("circle",{cx:100,cy:100,r:92,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),xe("circle",{cx:100,cy:100,r:22,strokeWidth:2}),xe("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),s.map((c,u)=>xe("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var li="#c9a461",qt=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],ui={name:"",color:"var(--fg)",family:"silver",src:""};function nr(e,t){let n=r=>{let o=qt.findIndex(i=>i.f===r);return o===-1?qt.length:o};return n(e)-n(t)||e.localeCompare(t)}function ci(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(nr)}import{useState as rr}from"react";import{jsx as se,jsxs as je}from"react/jsx-runtime";function or({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=Ft(),[i,a]=rr("");async function s(){o||!i.trim()||(await n(i,e),a(""))}return je("div",{className:"flex flex-col gap-2",children:[t===null?je("div",{className:"flex border border-line",children:[se("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),s())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),se("button",{type:"button",onClick:()=>{s()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[se("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),se("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:vt}):t&&!t.valid&&t.message&&se("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var Qe="Ads on. Shopper can opt out.",Oe="Ads and analytics off until Accept",ir={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:Qe,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Oe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:Qe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:Qe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function ar(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function yi(e,t,n){let r=ar(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var bi={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var sr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var lr=sr;function vi(e=lr){if(e.asked)return e.ads?"granted":"denied"}function Pi(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as cr,isValidElement as dr,useEffect as Kt,useId as fr,useLayoutEffect as Yt,useRef as z,useState as zt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Ze(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function Je(e,t){return Ze(e,t===1?-1:e.length,t)}function et(e,t){return Me(e,t)?t:Math.max(Je(e,1),0)}function Gt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),s=n.findIndex((c,u)=>Me(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:s>=0?s:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:Ze(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Ze(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:Je(n,1)}),handled:!0};case"End":return{state:i({focus:Je(n,-1)}),handled:!0};case"Enter":case" ":return Me(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as pr}from"efficient-shell/ui";import{Fragment as Cr,jsx as X,jsxs as Vt}from"react/jsx-runtime";var Xt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function mr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,s]=zt(!1),c=r!==void 0,u=c?r:a,[f,d]=zt(0),S=z({text:"",timer:0}),R=z(null),C=z(null),y=z(null),w=fr(),O=z(null),M=e.findIndex(b=>b.value===t),L=b=>{b!==u&&(c||s(b),b?o?.():i?.())},v=b=>{let _=e[b];!_||_.disabled||(n(_.value),L(!1),C.current?.focus())},x=b=>{let _={open:u,focus:u?f:et(e,M),typed:S.current.text},p=Gt(_,b,e);return!p.handled&&p.state.open===u?!1:(p.state.typed!==_.typed&&(S.current.text=p.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(p.state.focus),p.commit!==void 0?v(p.commit):L(p.state.open),p.refocus&&C.current?.focus(),p.handled)},W=z(x);W.current=x;let I=z(()=>L(!1));I.current=()=>L(!1);let q=b=>{u||(O.current=b.nativeEvent,W.current(b.key)&&b.preventDefault())};return Kt(()=>{if(!u)return;let b=p=>{R.current?.contains(p.target)||I.current()},_=p=>{p!==O.current&&W.current(p.key)&&p.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",_),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",_)}},[u]),Kt(()=>{u&&(S.current.text||d(et(e,M)))},[u]),Yt(()=>{if(!u||!y.current)return;y.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,u]),{open:u,toggle:()=>L(!u),close:()=>L(!1),focusIdx:f,setFocusIdx:d,pick:b=>v(e.findIndex(_=>_.value===b)),wrapRef:R,triggerRef:C,listRef:y,listId:w,onTriggerKeyDown:q,activeId:u?`${w}-${f}`:void 0}}var gr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Xt.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Xt.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function hr(e,t){Yt(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let a=n.offsetParent??n.parentElement;if(!a)return;let s=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-s.right)<Math.abs(c.left-s.left)?"end":"start",f=pr({trigger:{left:s.left,right:s.right,top:s.top,bottom:s.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=f.top+Math.min(c.height,f.maxHeight);i.marginBottom=`${Math.max(0,s.top-S)}px`}f.maxHeight<c.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let d=f.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function yr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:s,ariaLabel:c}){let u=gr[t],f=z(null);return hr(f,n.length),X("ul",{ref:d=>{f.current=d,s&&(s.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let R=d.value===r;return X("li",{id:`${e}-${S}`,role:"option","aria-selected":R,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,R&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(R),children:d.meta===void 0?d.label:Vt(Cr,{children:[d.lead,X("span",{className:"flex-1 whitespace-nowrap",children:d.label}),X("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function br({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:s,"aria-label":c}){let u=cr.toArray(r).flatMap(C=>{if(!dr(C))return[];if(C.type!=="option")return[];let w=C.props,O=w.value!==void 0?String(w.value):"",M=w.children,L=typeof M=="string"||typeof M=="number"?String(M):O;return[{value:O,label:L,disabled:!!w.disabled}]}),f=e??"",d=mr({items:u,value:f,onPick:C=>t?.({target:{value:C}})}),R=u.find(C=>C.value===f)?.label??u[0]?.label??"";return Vt("div",{ref:d.wrapRef,className:"relative",children:[a&&X("input",{type:"hidden",name:a,value:f}),X("button",{ref:C=>{d.triggerRef.current=C},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:s,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:X("span",{className:"block w-full truncate text-left",children:R})}),d.open&&X(yr,{id:d.listId,tone:"select",items:u,value:f,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as Se,jsxs as De}from"react/jsx-runtime";var xr="font-mono text-[length:var(--size-label,12px)]",Sr="font-semibold uppercase tracking-[0.22em] text-fg";function jt(e){return`${e??xr} ${Sr}`}function Qt(){return Se("span",{className:"text-accent",children:" *"})}function vr({children:e,required:t,labelFace:n}){return De("span",{className:jt(n),children:[e,t?Se(Qt,{}):null]})}function Er({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:s}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?Se("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:jt(i),children:[e,t?Se(Qt,{}):null]}),s,u]}):De("label",{htmlFor:o,className:c,children:[Se(vr,{required:t,labelFace:i,children:e}),s]})}export{Hr as a,$r as b,Br as c,pt as d,qe as e,Pr as f,wr as g,_r as h,Rr as i,on as j,an as k,Nr as l,Lr as m,Ge as n,Ne as o,ge as p,Ir as q,Le as r,gn as s,hn as t,Kr as u,zr as v,Pt as w,ze as x,Xr as y,Yr as z,bn as A,Vr as B,jr as C,Cn as D,Qr as E,Sn as F,Zr as G,Jr as H,wt as I,io as J,ao as K,so as L,co as M,fo as N,Mr as O,Ct as P,Ie as Q,Ye as R,Po as S,Ft as T,$o as U,zn as V,Wo as W,ri as X,oi as Y,er as Z,li as _,qt as $,ui as aa,nr as ba,ci as ca,or as da,ir as ea,yi as fa,bi as ga,sr as ha,vi as ia,Pi as ja,mr as ka,yr as la,br as ma,vr as na,Er as oa};
|