efficient-storefront-blocks 0.133.5 → 0.133.6
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 +52 -0
- package/dist/chunks/{CustomHtmlCodeWindow-ZPYYAXIT.js → CustomHtmlCodeWindow-2CJO3FRG.js} +1 -1
- package/dist/chunks/{EditorPreviewCheckout-BYCGH5HR.js → EditorPreviewCheckout-524ZFYDR.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-WZHTXNWZ.js → SiteEditorProvider-E53DXAEH.js} +1 -1
- package/dist/chunks/{chunk-RG2VEZZ7.js → chunk-5W6M2F4B.js} +1 -1
- package/dist/chunks/chunk-6JIG2WYA.js +1 -0
- package/dist/chunks/{chunk-MJ4NDWP7.js → chunk-LUHOZIHO.js} +1 -1
- package/dist/editor/components/ProductHeroSource.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductGallery/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductHero/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductName/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SpecTable/fields.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +18 -6
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +26 -26
- package/dist/links.js +1 -1
- package/dist/render/components/PopupHost.js +1 -1
- package/dist/render/components/ProductGallery.d.ts +2 -1
- package/dist/render/components/ProductGallery.js +1 -1
- package/dist/render/components/ProductHeroPanel.d.ts +2 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/QuoteLink.d.ts +5 -0
- package/dist/render/components/QuoteLink.js +1 -1
- package/dist/render/components/card-pieces/CardBuyButton.js +1 -1
- package/dist/render/components/card-pieces/CardName.d.ts +3 -1
- package/dist/render/components/card-pieces/CardName.js +1 -1
- package/dist/render/components/card-pieces/HeadlineName.d.ts +3 -1
- package/dist/render/components/card-pieces/HeadlineName.js +1 -1
- package/dist/render/components/card-pieces/ProductCardState.d.ts +1 -0
- package/dist/render/components/pdp-dynamic/DynamicProductGallery.d.ts +2 -1
- package/dist/render/components/pdp-dynamic/DynamicProductGallery.js +1 -1
- package/dist/render/components/product-hero/SpinLayer.js +1 -1
- package/dist/render/components/product-hero/WheelHeroFitment.js +1 -1
- package/dist/render/components/product-hero/hero-view.d.ts +1 -0
- package/dist/render/components/product-hero/hero-view.js +1 -1
- package/dist/render/components/useProductSelection.d.ts +1 -0
- package/dist/render/components/useProductSelection.js +1 -1
- package/dist/render/lib/catalog/start-picks.d.ts +2 -0
- package/dist/render/lib/catalog/start-picks.js +1 -0
- package/dist/render/lib/content/title-look.d.ts +4 -0
- package/dist/render/lib/content/title-look.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGallery/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGallery/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductName/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductSku/render.js +1 -1
- package/dist/render/lib/popup/site-popup-opens.d.ts +9 -0
- package/dist/render/lib/popup/site-popup-opens.js +1 -0
- package/dist/render/lib/sections/hero-gallery.d.ts +2 -0
- package/dist/render/lib/sections/hero-gallery.js +1 -1
- package/dist/render/lib/sections/hero-option-looks.d.ts +2 -0
- package/dist/render/lib/sections/hero-option-looks.js +1 -1
- package/dist/render/lib/sections/spin-sets.d.ts +8 -0
- package/dist/render/lib/sections/spin-sets.js +1 -1
- package/dist/render/lib/wheels/price-display.d.ts +9 -0
- package/dist/render/lib/wheels/price-display.js +1 -1
- package/dist/render/lib/wheels/spec-sheet.d.ts +44 -4
- package/dist/render/lib/wheels/spec-sheet.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +18 -6
- package/dist/words.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-JBFEQFNX.js +0 -1
- /package/dist/chunks/{chunk-MJ4NDWP7.js.LEGAL.txt → chunk-LUHOZIHO.js.LEGAL.txt} +0 -0
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],pt=[...ue,"surface"];var ft={bold:g.bold.placeholder,italic:g.italic.placeholder,strike:g.strike.placeholder,code:g.code.placeholder,highlight:g.highlight.placeholder,quiet:g.quiet.placeholder,link:"link text",underline:g.underline.placeholder,sup:g.sup.placeholder,sub:g.sub.placeholder,color:"colored text",style:"styled text"};var pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var O=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],fe=["highlight","quiet"],dt=pe.map(e=>e.style).filter(e=>O.some(t=>t.kind===e)).filter(e=>!fe.includes(e)),mt=[...O,{open:"*",close:"*",kind:"accent"}],ht=[...O,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var gt=["http","https","mailto","tel"];function j(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||gt.includes(t[1].toLowerCase())}var de=["width","profile","rim"];var yt=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,bt={width:[100,500],profile:[20,100],rim:[10,30]};function W(e){let t=yt.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return de.every(o=>{let[s,i]=bt[o];return n[o]>=s&&n[o]<=i})?n:null}function E(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function me(e){return[E({width:e.width}),E({width:e.width,profile:e.profile}),E(e)]}var x=["alloy-wheel","tyre"],he=["alloy-wheel"],_={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Mn=x.map(e=>({value:e,label:_[e]}));function ge(e){return e==null?[...he]:Array.isArray(e)?x.filter(t=>e.includes(t)):[...he]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function H(e){return m(e).brand??""}function ye(e){return m(e).prices??void 0}function be(e){return m(e).inStock!==!1}function Se(e){let t=m(e),n=d(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function Y(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function Pe(e){return Y(e).map(t=>t.family)}function ke(e){if(d(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function xe(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function we(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function Le(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function Te(e){if(d(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>W(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var V=e=>typeof e=="string"&&e?e:void 0;function G(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Ae(e,t){return Object.hasOwn(e,t)}var Oe=null;function Ee(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Ae(t,r)?String(G(t,r)):n):e}function y(e,t){let n=Oe?G(Oe,e):void 0;if(typeof n=="function"){try{let r=V(n(t??{}));if(r)return r}catch{}return Ee(e,t)}return Ee(V(n)??e,t)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),Wn=F(30,0,100,10),Hn=F(0,0,100,5),Yn=F(100,0,100,5);var Vn=F(2,0,4,.5);var Gn=["button","summary",'[role="button"]','[role="checkbox"]','[role="switch"]',"video[controls]","audio[controls]",...["checkbox","button","submit","reset","image","color","file"].map(e=>`input[type="${e}"]`)].join(", "),qn=["menuitem","option","listbox","slider","tab","tablist","combobox","radio","radiogroup","spinbutton","menu","menubar","tree","treeitem","grid","gridcell"].map(e=>`[role="${e}"]`).concat('input[type="radio"]','input[type="range"]').join(", "),St="data-motion-pin-free",Zn=`.maplibregl-map, .mapboxgl-map, .leaflet-container, .gm-style, [${St}]`;function _e(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Fe="homepage";var I=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function v(e){return e.offersCommerce&&e.offersService?I:I.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Ie(e){return`${Z}${e}`}function ve(e){return e.startsWith(Z)&&e.slice(Z.length).trim()||null}function b(e){return e===Fe?"/":`/${e}`}function R(e){return`/journal/${e}`}function N(e){return`/wheels/${e}`}function C(e,t){return`${b(e)}#${t}`}function M(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let s=_e(o?.props?.anchor);if(!s)continue;let i=q(s);!i||t.has(i)||(t.add(i),n.push({slug:i,name:s}))}return n}function Re(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var Pt=()=>({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 K(e,t,n){if(!e)return"page";if(ve(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Re(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function Ne(e,t){let n=Pt(),r=e.pages.map(c=>({value:b(c.slug),label:c.title})),o=t?.pageOptions?t.pageOptions(r):r,s=o.map(c=>c.value),i=e.pages.map(c=>({label:c.title,options:M(...c.docs).map(u=>({value:C(c.slug,u.slug),label:u.name}))})).filter(c=>c.options.length>0),l=c=>{switch(c){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:i,placeholder:i.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:R(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Ie(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=v(e.offers).map(c=>({value:c.value,label:y(c.label),target:l(c.value),...c.value==="anchor"?{hint:n.sectionHint}:{},...c.value==="blog"||c.value==="product"||c.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:a,rules:{kindOf:c=>K(c,s),targetOf:c=>c,readFilter:()=>null,withFilter:c=>c}};let p=c=>{let u=t.withFilter(c,null);return t.listingPaths.includes(u)?u:c};return{kinds:a,rules:{kindOf:c=>K(c,s,{listingPaths:t.listingPaths,targetOf:p}),targetOf:p,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:c=>t.listingPaths.includes(c)?t.filtersFor(c):null}}var Ce=Object.freeze([]);function X(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Me(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let s=o[n];if(typeof s!="number"||!Number.isFinite(s))continue;let i=r.get(o.fieldKey);(i===void 0||s<i)&&r.set(o.fieldKey,s)}return o=>o?r.get(o):void 0}function Ke(e,t,n,r){let o=new Map;for(let a of n){let p=a[r];typeof p=="number"&&o.set(a.fieldKey,p)}if(o.size===0)return e;let s=[],i=[];e.forEach((a,p)=>{let c=t(a);c&&(s.push(p),i.push({item:a,index:p,order:o.get(c)}))}),i.sort((a,p)=>a.order!==void 0&&p.order!==void 0?a.order-p.order||a.index-p.index:a.order!==void 0?-1:p.order!==void 0?1:a.index-p.index);let l=[...e];return s.forEach((a,p)=>{l[a]=i[p].item}),l.every((a,p)=>a===e[p])?e:l}function $e(e){return xt(e,"filter")}var kt="collection";function Q(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":kt},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function xt(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function wt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ze(e,t){let n=e?.[t];return wt(n)?n:null}function De(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)}function Ue(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var Lt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Cr=Object.keys(Lt);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Tt={diameters:"tyreSizes"};function At(e){if(e.length===0)return[];let t=J.filter(n=>e.every(r=>ee[n].includes(r)));return t.filter(n=>{let r=Tt[n];return!r||!t.includes(r)})}function Ot(e){let t=new Set;for(let n of e)t.add(d(n));return[...t]}var Be={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Et(e,t,n,r=null,o="fail"){let s=d(e),i=l=>o==="fail"||(l==="lugs"?s==="alloy-wheel":ee[l].includes(s));if(r!=="kind"&&t.kind&&s!==t.kind)return!1;for(let l of J){if(r===l)continue;let a=t[l];if(a.length===0||!i(l))continue;let p=a.map(String);if(!je(e,l).some(c=>p.includes(c)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&i("lugs")){let l=Ue(e);if(l===null||!t.lugs.includes(l))return!1}return!(r!=="price"&&!De(ye(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!be(e))}var _t={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function je(e,t){switch(t){case"tyreSizes":return[...new Set(Te(e).flatMap(me))];case"brands":return H(e)?[H(e)]:[];case"finishes":return Pe(e);case"diameters":return Se(e).map(String);case"collections":return ke(e);case"pcds":return xe(e);case"tyreTypes":return we(e);case"speedRatings":return Le(e)}}function Ft(e){let t=new Map;for(let n of e)for(let r of Y(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function We(e,t,n,r=Ot(e),o=Ce,s="fail"){let i=u=>vt(u,r,o),l=Ft(e),p=(s==="pass"?J.filter(u=>r.some(P=>ee[u].includes(P))):At(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let P=t[u].map(String),ce=new Set,B=new Map,A=new Map;for(let f of e){let S=je(f,u);for(let h of S)ce.add(h);for(let h of new Set(S))A.set(h,(A.get(h)??0)+1);if(Et(f,t,n,u,s))for(let h of new Set(S))B.set(h,(B.get(h)??0)+1)}let ut=[...ce].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:B.get(f)??0,checked:P.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,S)=>{if(u==="diameters")return Number(f.value)-Number(S.value);let h=(A.get(S.value)??0)-(A.get(f.value)??0);return h!==0?h:f.value.localeCompare(S.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>It),c=[];for(let u of p){let P=Rt(u.key,r,o);P!==void 0&&c.push({fieldKey:u.key,filterOrder:P})}return[...Ke(p,u=>u.key,c,"filterOrder")]}var It=1;function He(e){return e.showCollection===!1?["collections"]:[]}function vt(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>$e(X(n,r))(Q(e,r)))}function Rt(e,t,n){if(n.length===0)return;let r;for(let o of t){let s=Me(X(n,o),"filter")(Q(e,o));s!==void 0&&(r===void 0||s<r)&&(r=s)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},ne="type";var w=e=>!!e&&typeof e=="object"&&!Array.isArray(e),L=e=>w(e)&&typeof e.type=="string"&&w(e.props);var $=e=>Array.isArray(e)&&e.length>0&&e.every(L);function Nt(e){let t="";for(let n of e)t+=typeof n=="number"?`[${n}]`:t===""?n:`.${n}`;return t}function Ye(e,t){return t==="root"?e.root:e.components[t]}function Ve(e){return e?.fields??{}}function Ge(e,t){return Ve(Ye(e,t))}function qe(e,t){let n=[];return re(e,t,[],n),n}function re(e,t,n,r){for(let o of Object.keys(t)){let s=t[o];if(!s)continue;let i=[...n,o],l=e[o];if(s.type==="slot"){let a=Array.isArray(l);r.push({slot:Nt(i),segments:i,content:a?l:[],present:a})}else if(s.type==="object"&&s.objectFields&&w(l))re(l,s.objectFields,i,r);else if(s.type==="array"&&s.arrayFields&&Array.isArray(l)){let a=s.arrayFields;l.forEach((p,c)=>{w(p)&&re(p,a,[...i,c],r)})}}}function oe(e,t,n){return Mt(e,t,n).map(({slot:r,content:o})=>({slot:r,content:o}))}function z(e){let t=new TextEncoder,n=new Map(e.map(r=>[r,t.encode(r)]));return[...e].sort((r,o)=>{let s=n.get(r),i=n.get(o);if(s.length!==i.length)return s.length-i.length;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return s[l]-i[l];return 0})}function Mt(e,t,n){let r=qe(e.props,Ge(t,e.type));if(n?.order!=="stored")return r;let o=z(Object.keys(e.props)),s=i=>{let l=i.present?o.indexOf(String(i.segments[0])):-1;return l<0?Number.POSITIVE_INFINITY:l};return r.map((i,l)=>({loc:i,i:l,r:s(i)})).sort((i,l)=>i.r-l.r||i.i-l.i).map(({loc:i})=>i)}var Ze=["Text","ImageBlock","ButtonBlock","Flex"];function k(){return{type:"slot",allow:[...Ze]}}var Kt=Ze.filter(e=>e!=="ButtonBlock");function Xe(){return{type:"slot",allow:[...Kt]}}var $t="boxes",Qe={CardList:{template:Xe()},Cards:{template:k()},FAQ:{template:k()},Flex:{rowTitle:{type:"slot",allow:["Text"]},content:{type:"slot"}},Footprint:{template:k()},Grid:{content:{type:"slot"}},Hero:{slides:{type:"slot",ownPictures:!0},strip:{type:"slot",allow:["Flex"]}},HeroGroup:{content:{type:"slot"}},HeroSingle:{boxes:{type:"slot",allow:["HeroGroup"]}},HeroSlide:{groups:{type:"slot",allow:["HeroGroup"]}},Logos:{logos:{type:"slot",allow:["LogoBlock"]},template:{type:"slot",allow:["LogoBlock"]}},OrderSummary:{template:k()},ProcessSteps:{[$t]:{type:"slot"},template:k()}};var zt={},Dt=null;function Ut(){let e=Object.fromEntries(Object.entries(Qe).map(([t,n])=>[t,{fields:n}]));return Dt??={components:{...e,...zt}}}function Bt(e){let t=e.props??{},n=typeof e.type=="string"?e.type:"",r=Ut(),o=n!==""&&Object.prototype.hasOwnProperty.call(r.components,n)?oe({type:n,props:t},r).map(l=>l.slot).filter(l=>!l.includes(".")):[],s=o.filter(l=>$(t[l])),i=z(Object.keys(t).filter(l=>!o.includes(l)&&$(t[l])));return[...s,...i]}function Je(e,t){let n=null;for(let r of Bt(e)){let o=e.props[r],s=t(o,r);s!==o&&((n??={...e.props})[r]=s)}return n?{...e,props:n}:e}var et="FilterBlock";var tt="AlloyWheelsListing";function jt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function Wt(e){let t=[],n=(r,o)=>{let s=[r,...o];for(let i of r)L(i)&&(t.push({node:i,order:t.length,lists:s}),Je(i,l=>(n(l,s),l)))};for(let r of jt(e))n(r,[]);return t}function nt(e){return Wt(e).map(t=>t.node)}function rt(e){return j(e.trim())}var T="/wheels",D="Products";function ot(e,t){return t>1?`${D} \xB7 ${e}`:D}function se(...e){for(let t of[tt,et])for(let n of e){let r=nt({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function U(...e){return se(...e)!==null}function st(e,t){let n=e.filter(r=>U(...r.docs)).map(r=>b(r.slug));return t.fallback&&!n.includes(T)?[...n,T]:n}var ie=[ne,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function it(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Ht(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function lt(e){let t=new URLSearchParams(it(e).query);for(let n of ie){let r=t.get(n);if(r)return{param:n,value:r}}return null}function le(e,t){let{path:n,query:r,hash:o}=it(e),s=r.split("&").filter(i=>i&&!ie.includes(Ht(i.split("=")[0])));return t?.value&&s.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${s.length?`?${s.join("&")}`:""}${o}`}function at(e,t){let n=le(e,null);return t.includes(n)?n:e}function Yt(e,t,n=[]){return K(e,t,{listingPaths:n,targetOf:r=>at(r,n)})}function Vt(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var ct="Product type",Gt="AUD";function ae(e,t){let n=t.listing??{},r=ge(n.kinds),o=e.filter(a=>r.includes(d(a))),s=He(n),i=We(o,Be,Gt,r,t.fieldUsage).filter(a=>!s.includes(a.key)).map(a=>({param:te[a.key],label:a.label,values:a.options.filter(p=>!p.value.includes(",")).map(p=>({value:p.value,label:p.label}))})).filter(a=>a.values.length>0),l=x.filter(a=>r.includes(a)&&o.some(p=>d(p)===a));return l.length>1&&i.unshift({param:ne,label:ct,values:l.map(a=>({value:a,label:_[a]}))}),i}function qt(e){return t=>{let n=st(t,{fallback:e.offersCommerce}),r=t.filter(o=>U(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let s=o.map(i=>{let l=t.find(a=>b(a.slug)===i.value);return l&&U(...l.docs)?{...i,label:ot(l.title,r)}:i});return r===0&&e.offersCommerce&&!s.some(i=>i.value===T)&&s.push({value:T,label:D}),s},filtersFor:o=>{if(!n.includes(o))return null;let s=t.find(i=>b(i.slug)===o);return ae(e.catalogue,{listing:s?se(...s.docs):null,fieldUsage:e.fieldUsage})},readFilter:lt,withFilter:le}}}function Zt(e){let t=qt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=Ne({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:N(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:rt},filtersFor:n.filtersFor??(()=>null)}}function ns(e,t){return ae(e,t)}export{T as BUILT_IN_LISTING_PATH,I as LINK_KINDS,ie as LISTING_FILTER_PARAMS,D as LISTING_PAGE_LABEL,ct as PRODUCT_TYPE_FILTER_LABEL,C as anchorPath,Vt as fieldUsageFromAdminRows,Yt as inferLinkKind,U as isProductListingPage,rt as isSafeLink,v as linkKindsFor,Zt as linkPickerSetup,ns as listingFilterFields,se as listingNode,ot as listingPageLabel,at as listingTarget,M as pageAnchors,b as pagePath,R as postPath,st as productListingPaths,lt as readListingFilter,N as wheelPath,le as withListingFilter};
|
|
1
|
+
var g={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],pt=[...ue,"surface"];var ft={bold:g.bold.placeholder,italic:g.italic.placeholder,strike:g.strike.placeholder,code:g.code.placeholder,highlight:g.highlight.placeholder,quiet:g.quiet.placeholder,link:"link text",underline:g.underline.placeholder,sup:g.sup.placeholder,sub:g.sub.placeholder,color:"colored text",style:"styled text"};var pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var O=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],fe=["highlight","quiet"],dt=pe.map(e=>e.style).filter(e=>O.some(t=>t.kind===e)).filter(e=>!fe.includes(e)),mt=[...O,{open:"*",close:"*",kind:"accent"}],ht=[...O,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var gt=["http","https","mailto","tel"];function j(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||gt.includes(t[1].toLowerCase())}var de=["width","profile","rim"];var yt=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,bt={width:[100,500],profile:[20,100],rim:[10,30]};function W(e){let t=yt.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return de.every(o=>{let[s,i]=bt[o];return n[o]>=s&&n[o]<=i})?n:null}function E(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function me(e){return[E({width:e.width}),E({width:e.width,profile:e.profile}),E(e)]}var x=["alloy-wheel","tyre"],he=["alloy-wheel"],_={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Mn=x.map(e=>({value:e,label:_[e]}));function ge(e){return e==null?[...he]:Array.isArray(e)?x.filter(t=>e.includes(t)):[...he]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function H(e){return m(e).brand??""}function ye(e){return m(e).prices??void 0}function be(e){return m(e).inStock!==!1}function Se(e){let t=m(e),n=d(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function Y(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function Pe(e){return Y(e).map(t=>t.family)}function ke(e){if(d(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function xe(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function we(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function Te(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function Le(e){if(d(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>W(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var V=e=>typeof e=="string"&&e?e:void 0;function G(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Ae(e,t){return Object.hasOwn(e,t)}var Oe=null;function Ee(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Ae(t,r)?String(G(t,r)):n):e}function y(e,t){let n=Oe?G(Oe,e):void 0;if(typeof n=="function"){try{let r=V(n(t??{}));if(r)return r}catch{}return Ee(e,t)}return Ee(V(n)??e,t)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),Wn=F(30,0,100,10),Hn=F(0,0,100,5),Yn=F(100,0,100,5);var Vn=F(2,0,4,.5);var Gn=["button","summary",'[role="button"]','[role="checkbox"]','[role="switch"]',"video[controls]","audio[controls]",...["checkbox","button","submit","reset","image","color","file"].map(e=>`input[type="${e}"]`)].join(", "),qn=["menuitem","option","listbox","slider","tab","tablist","combobox","radio","radiogroup","spinbutton","menu","menubar","tree","treeitem","grid","gridcell"].map(e=>`[role="${e}"]`).concat('input[type="radio"]','input[type="range"]').join(", "),St="data-motion-pin-free",Zn=`.maplibregl-map, .mapboxgl-map, .leaflet-container, .gm-style, [${St}]`;function _e(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Fe="homepage";var I=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function v(e){return e.offersCommerce&&e.offersService?I:I.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Ie(e){return`${Z}${e}`}function ve(e){return e.startsWith(Z)&&e.slice(Z.length).trim()||null}function b(e){return e===Fe?"/":`/${e}`}function R(e){return`/journal/${e}`}function N(e){return`/wheels/${e}`}function C(e,t){return`${b(e)}#${t}`}function M(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let s=_e(o?.props?.anchor);if(!s)continue;let i=q(s);!i||t.has(i)||(t.add(i),n.push({slug:i,name:s}))}return n}function Re(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var Pt=()=>({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 K(e,t,n){if(!e)return"page";if(ve(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Re(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function Ne(e,t){let n=Pt(),r=e.pages.map(c=>({value:b(c.slug),label:c.title})),o=t?.pageOptions?t.pageOptions(r):r,s=o.map(c=>c.value),i=e.pages.map(c=>({label:c.title,options:M(...c.docs).map(u=>({value:C(c.slug,u.slug),label:u.name}))})).filter(c=>c.options.length>0),l=c=>{switch(c){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:i,placeholder:i.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:R(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Ie(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=v(e.offers).map(c=>({value:c.value,label:y(c.label),target:l(c.value),...c.value==="anchor"?{hint:n.sectionHint}:{},...c.value==="blog"||c.value==="product"||c.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:a,rules:{kindOf:c=>K(c,s),targetOf:c=>c,readFilter:()=>null,withFilter:c=>c}};let p=c=>{let u=t.withFilter(c,null);return t.listingPaths.includes(u)?u:c};return{kinds:a,rules:{kindOf:c=>K(c,s,{listingPaths:t.listingPaths,targetOf:p}),targetOf:p,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:c=>t.listingPaths.includes(c)?t.filtersFor(c):null}}var Ce=Object.freeze([]);function X(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Me(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let s=o[n];if(typeof s!="number"||!Number.isFinite(s))continue;let i=r.get(o.fieldKey);(i===void 0||s<i)&&r.set(o.fieldKey,s)}return o=>o?r.get(o):void 0}function Ke(e,t,n,r){let o=new Map;for(let a of n){let p=a[r];typeof p=="number"&&o.set(a.fieldKey,p)}if(o.size===0)return e;let s=[],i=[];e.forEach((a,p)=>{let c=t(a);c&&(s.push(p),i.push({item:a,index:p,order:o.get(c)}))}),i.sort((a,p)=>a.order!==void 0&&p.order!==void 0?a.order-p.order||a.index-p.index:a.order!==void 0?-1:p.order!==void 0?1:a.index-p.index);let l=[...e];return s.forEach((a,p)=>{l[a]=i[p].item}),l.every((a,p)=>a===e[p])?e:l}function $e(e){return xt(e,"filter")}var kt="collection";function Q(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":kt},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function xt(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function wt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ze(e,t){let n=e?.[t];return wt(n)?n:null}function De(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)}function Ue(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var Tt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Cr=Object.keys(Tt);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Lt={diameters:"tyreSizes"};function At(e){if(e.length===0)return[];let t=J.filter(n=>e.every(r=>ee[n].includes(r)));return t.filter(n=>{let r=Lt[n];return!r||!t.includes(r)})}function Ot(e){let t=new Set;for(let n of e)t.add(d(n));return[...t]}var Be={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Et(e,t,n,r=null,o="fail"){let s=d(e),i=l=>o==="fail"||(l==="lugs"?s==="alloy-wheel":ee[l].includes(s));if(r!=="kind"&&t.kind&&s!==t.kind)return!1;for(let l of J){if(r===l)continue;let a=t[l];if(a.length===0||!i(l))continue;let p=a.map(String);if(!je(e,l).some(c=>p.includes(c)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&i("lugs")){let l=Ue(e);if(l===null||!t.lugs.includes(l))return!1}return!(r!=="price"&&!De(ye(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!be(e))}var _t={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function je(e,t){switch(t){case"tyreSizes":return[...new Set(Le(e).flatMap(me))];case"brands":return H(e)?[H(e)]:[];case"finishes":return Pe(e);case"diameters":return Se(e).map(String);case"collections":return ke(e);case"pcds":return xe(e);case"tyreTypes":return we(e);case"speedRatings":return Te(e)}}function Ft(e){let t=new Map;for(let n of e)for(let r of Y(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function We(e,t,n,r=Ot(e),o=Ce,s="fail"){let i=u=>vt(u,r,o),l=Ft(e),p=(s==="pass"?J.filter(u=>r.some(P=>ee[u].includes(P))):At(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let P=t[u].map(String),ce=new Set,B=new Map,A=new Map;for(let f of e){let S=je(f,u);for(let h of S)ce.add(h);for(let h of new Set(S))A.set(h,(A.get(h)??0)+1);if(Et(f,t,n,u,s))for(let h of new Set(S))B.set(h,(B.get(h)??0)+1)}let ut=[...ce].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:B.get(f)??0,checked:P.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,S)=>{if(u==="diameters")return Number(f.value)-Number(S.value);let h=(A.get(S.value)??0)-(A.get(f.value)??0);return h!==0?h:f.value.localeCompare(S.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>It),c=[];for(let u of p){let P=Rt(u.key,r,o);P!==void 0&&c.push({fieldKey:u.key,filterOrder:P})}return[...Ke(p,u=>u.key,c,"filterOrder")]}var It=1;function He(e){return e.showCollection===!1?["collections"]:[]}function vt(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>$e(X(n,r))(Q(e,r)))}function Rt(e,t,n){if(n.length===0)return;let r;for(let o of t){let s=Me(X(n,o),"filter")(Q(e,o));s!==void 0&&(r===void 0||s<r)&&(r=s)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},ne="type";var w=e=>!!e&&typeof e=="object"&&!Array.isArray(e),T=e=>w(e)&&typeof e.type=="string"&&w(e.props);var $=e=>Array.isArray(e)&&e.length>0&&e.every(T);function Nt(e){let t="";for(let n of e)t+=typeof n=="number"?`[${n}]`:t===""?n:`.${n}`;return t}function Ye(e,t){return t==="root"?e.root:e.components[t]}function Ve(e){return e?.fields??{}}function Ge(e,t){return Ve(Ye(e,t))}function qe(e,t){let n=[];return re(e,t,[],n),n}function re(e,t,n,r){for(let o of Object.keys(t)){let s=t[o];if(!s)continue;let i=[...n,o],l=e[o];if(s.type==="slot"){let a=Array.isArray(l);r.push({slot:Nt(i),segments:i,content:a?l:[],present:a})}else if(s.type==="object"&&s.objectFields&&w(l))re(l,s.objectFields,i,r);else if(s.type==="array"&&s.arrayFields&&Array.isArray(l)){let a=s.arrayFields;l.forEach((p,c)=>{w(p)&&re(p,a,[...i,c],r)})}}}function oe(e,t,n){return Mt(e,t,n).map(({slot:r,content:o})=>({slot:r,content:o}))}function z(e){let t=new TextEncoder,n=new Map(e.map(r=>[r,t.encode(r)]));return[...e].sort((r,o)=>{let s=n.get(r),i=n.get(o);if(s.length!==i.length)return s.length-i.length;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return s[l]-i[l];return 0})}function Mt(e,t,n){let r=qe(e.props,Ge(t,e.type));if(n?.order!=="stored")return r;let o=z(Object.keys(e.props)),s=i=>{let l=i.present?o.indexOf(String(i.segments[0])):-1;return l<0?Number.POSITIVE_INFINITY:l};return r.map((i,l)=>({loc:i,i:l,r:s(i)})).sort((i,l)=>i.r-l.r||i.i-l.i).map(({loc:i})=>i)}var Ze=["Text","ImageBlock","ButtonBlock","Flex"];function k(){return{type:"slot",allow:[...Ze]}}var Kt=Ze.filter(e=>e!=="ButtonBlock");function Xe(){return{type:"slot",allow:[...Kt]}}var $t="boxes",Qe={CardList:{template:Xe()},Cards:{template:k()},FAQ:{template:k()},Flex:{rowTitle:{type:"slot",allow:["Text"]},content:{type:"slot"}},Footprint:{template:k()},Grid:{content:{type:"slot"}},Hero:{slides:{type:"slot",ownPictures:!0},strip:{type:"slot",allow:["Flex"]}},HeroGroup:{content:{type:"slot"}},HeroSingle:{boxes:{type:"slot",allow:["HeroGroup"]}},HeroSlide:{groups:{type:"slot",allow:["HeroGroup"]}},Logos:{logos:{type:"slot",allow:["LogoBlock"]},template:{type:"slot",allow:["LogoBlock"]}},OrderSummary:{template:k()},ProcessSteps:{[$t]:{type:"slot"},template:k()}};var zt={},Dt=null;function Ut(){let e=Object.fromEntries(Object.entries(Qe).map(([t,n])=>[t,{fields:n}]));return Dt??={components:{...e,...zt}}}function Bt(e){let t=e.props??{},n=typeof e.type=="string"?e.type:"",r=Ut(),o=n!==""&&Object.prototype.hasOwnProperty.call(r.components,n)?oe({type:n,props:t},r).map(l=>l.slot).filter(l=>!l.includes(".")):[],s=o.filter(l=>$(t[l])),i=z(Object.keys(t).filter(l=>!o.includes(l)&&$(t[l])));return[...s,...i]}function Je(e,t){let n=null;for(let r of Bt(e)){let o=e.props[r],s=t(o,r);s!==o&&((n??={...e.props})[r]=s)}return n?{...e,props:n}:e}var et="FilterBlock";var tt="AlloyWheelsListing";function jt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function Wt(e){let t=[],n=(r,o)=>{let s=[r,...o];for(let i of r)T(i)&&(t.push({node:i,order:t.length,lists:s}),Je(i,l=>(n(l,s),l)))};for(let r of jt(e))n(r,[]);return t}function nt(e){return Wt(e).map(t=>t.node)}function rt(e){return j(e.trim())}var L="/wheels",D="Products";function ot(e,t){return t>1?`${D} \xB7 ${e}`:D}function se(...e){for(let t of[tt,et])for(let n of e){let r=nt({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function U(...e){return se(...e)!==null}function st(e,t){let n=e.filter(r=>U(...r.docs)).map(r=>b(r.slug));return t.fallback&&!n.includes(L)?[...n,L]:n}var ie=[ne,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function it(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Ht(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function lt(e){let t=new URLSearchParams(it(e).query);for(let n of ie){let r=t.get(n);if(r)return{param:n,value:r}}return null}function le(e,t){let{path:n,query:r,hash:o}=it(e),s=r.split("&").filter(i=>i&&!ie.includes(Ht(i.split("=")[0])));return t?.value&&s.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${s.length?`?${s.join("&")}`:""}${o}`}function at(e,t){let n=le(e,null);return t.includes(n)?n:e}function Yt(e,t,n=[]){return K(e,t,{listingPaths:n,targetOf:r=>at(r,n)})}function Vt(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var ct="Product type",Gt="AUD";function ae(e,t){let n=t.listing??{},r=ge(n.kinds),o=e.filter(a=>r.includes(d(a))),s=He(n),i=We(o,Be,Gt,r,t.fieldUsage).filter(a=>!s.includes(a.key)).map(a=>({param:te[a.key],label:a.label,values:a.options.filter(p=>!p.value.includes(",")).map(p=>({value:p.value,label:p.label}))})).filter(a=>a.values.length>0),l=x.filter(a=>r.includes(a)&&o.some(p=>d(p)===a));return l.length>1&&i.unshift({param:ne,label:ct,values:l.map(a=>({value:a,label:_[a]}))}),i}function qt(e){return t=>{let n=st(t,{fallback:e.offersCommerce}),r=t.filter(o=>U(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let s=o.map(i=>{let l=t.find(a=>b(a.slug)===i.value);return l&&U(...l.docs)?{...i,label:ot(l.title,r)}:i});return r===0&&e.offersCommerce&&!s.some(i=>i.value===L)&&s.push({value:L,label:D}),s},filtersFor:o=>{if(!n.includes(o))return null;let s=t.find(i=>b(i.slug)===o);return ae(e.catalogue,{listing:s?se(...s.docs):null,fieldUsage:e.fieldUsage})},readFilter:lt,withFilter:le}}}function Zt(e){let t=qt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=Ne({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:N(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:rt},filtersFor:n.filtersFor??(()=>null)}}function ns(e,t){return ae(e,t)}export{L as BUILT_IN_LISTING_PATH,I as LINK_KINDS,ie as LISTING_FILTER_PARAMS,D as LISTING_PAGE_LABEL,ct as PRODUCT_TYPE_FILTER_LABEL,C as anchorPath,Vt as fieldUsageFromAdminRows,Yt as inferLinkKind,U as isProductListingPage,rt as isSafeLink,v as linkKindsFor,Zt as linkPickerSetup,ns as listingFilterFields,se as listingNode,ot as listingPageLabel,at as listingTarget,M as pageAnchors,b as pagePath,R as postPath,st as productListingPaths,lt as readListingFilter,N as wheelPath,le as withListingFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as O}from"react/jsx-runtime";import{usePathname as T}from"next/navigation";import{createContext as _,useCallback as k,useContext as B,useEffect as h,useMemo as y,useRef as m,useState as H}from"react";import{SUBSCRIBE_POPUP_SLUG as K}from"efficient-web-builder/format/lib/content/subscribe";import{GRID_PHONE_BREAKPOINT as A}from"efficient-web-builder/format/lib/content/grid-span";import{popupSlugOf as I}from"efficient-web-builder/format/lib/links/page-link-rules";import{resolvePopupBehavior as U}from"efficient-web-builder/format/lib/popup/behavior";import{effectiveTrigger as j,localDay as M,markPopupClosed as F,markPopupSent as G,pickAutoPopup as N,popupAllowedOnPath as Y,scrolledPercent as $}from"efficient-web-builder/format/lib/popup/rules";import q from"./PopupFrame.js";import{useSubscribePopup as z}from"./SubscribePopupContext.js";import{isEditorRoute as J}from"../lib/editor-route.js";import{POPUP_STORES as v}from"../lib/popup/popup-stores.js";import{popupOpens as Q,publishSitePopups as x}from"../lib/popup/site-popup-opens.js";const L=_(null);function fe(){return B(L)}function V(){try{return window.matchMedia("(hover: hover) and (pointer: fine)").matches}catch{return!1}}function W(){try{return window.matchMedia(`(max-width: ${A-1}px)`).matches}catch{return!1}}function X({popups:r}){const w=z(),[o,P]=H(null),s=T()??"/",n=J(s),S=m(s);S.current=s;const g=m(!1),f=y(()=>r.map(e=>({...e,id:e.slug,behavior:U(e.settings)})),[r]),E=f.filter(e=>e.behavior.autoOpen&&Y(s,e.behavior.showOn,e.behavior.showOnPages)).map(e=>e.slug).join(" "),d=m(w);d.current=w;const b=m(r);b.current=r;const l=k((e,t)=>{if(e===K){t?d.current.openByItself():d.current.open();return}Q(b.current,e)&&P(e)},[]);h(()=>(x(n?[]:r),()=>x([])),[r,n]),h(()=>{if(n)return;const e=t=>{if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const u=t.target?.closest?.("a[href]"),c=u?I(u.getAttribute("href")??""):null;c&&(t.preventDefault(),l(c,!1))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[n,l]),h(()=>{if(n||g.current||!E)return;const e=N(f,{path:S.current,isPhone:W(),today:M(new Date),inEditor:n},v,Date.now());if(!e)return;const t=()=>{g.current=!0,l(e.slug,!0)},u=e.behavior,c=j(u.trigger,V());if(c==="scroll"){const i=()=>{$(window.scrollY,window.innerHeight,document.documentElement.scrollHeight)>=u.scrollPercent&&(window.removeEventListener("scroll",i),t())};return window.addEventListener("scroll",i,{passive:!0}),()=>window.removeEventListener("scroll",i)}if(c==="exit"){const i=p=>{p.relatedTarget===null&&p.clientY<=0&&(document.removeEventListener("mouseout",i),t())};return document.addEventListener("mouseout",i),()=>document.removeEventListener("mouseout",i)}const D=window.setTimeout(t,u.autoOpenDelaySec*1e3);return()=>window.clearTimeout(D)},[n,E,f,l]);const R=k(()=>{o&&F(o,v,Date.now()),P(null)},[o]),C=y(()=>({markSent:()=>{o&&G(o,v,Date.now())}}),[o]),a=o?r.find(e=>e.slug===o):void 0;return a?.look?O(L.Provider,{value:C,children:O(q,{look:a.look,label:a.title,open:!0,onClose:R,children:a.body})}):null}export{X as default,fe as usePopupScope};
|
|
@@ -3,7 +3,7 @@ import { type HeroView } from "./product-hero/hero-view.js";
|
|
|
3
3
|
import type { StoreProduct } from "../lib/catalog/store-product.js";
|
|
4
4
|
import { type HeroGalleryMode, type HeroGalleryShow, type HeroImageFit, type HeroPhotoGround } from "../lib/sections/hero-gallery.js";
|
|
5
5
|
import { type SpinSets } from "../lib/sections/spin-sets.js";
|
|
6
|
-
export default function ProductGallery({ product, view, angleIdx, onSelect, isLight, onLightbox, galleryMode, imageFit, style, takesViewHide, spin, ground, show, marks, gap, }: {
|
|
6
|
+
export default function ProductGallery({ product, view, angleIdx, onSelect, isLight, onLightbox, galleryMode, imageFit, style, takesViewHide, spin, ground, show, marks, gap, closeUpsFill, }: {
|
|
7
7
|
product: StoreProduct;
|
|
8
8
|
view: HeroView;
|
|
9
9
|
angleIdx: number;
|
|
@@ -19,4 +19,5 @@ export default function ProductGallery({ product, view, angleIdx, onSelect, isLi
|
|
|
19
19
|
show?: HeroGalleryShow;
|
|
20
20
|
marks?: boolean;
|
|
21
21
|
gap?: number;
|
|
22
|
+
closeUpsFill?: boolean;
|
|
22
23
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as l,Fragment as O,jsxs as u}from"react/jsx-runtime";import{useRef as G}from"react";import{photoLabel as N}from"./product-hero/hero-view.js";import R from"./product-hero/SpinLayer.js";import{stageControls as $,useHeldStagePhoto as I}from"./product-hero/stage-photo.js";import{DEFAULT_HERO_CLOSE_UPS_FILL as z,DEFAULT_HERO_GALLERY_GAP as F,DEFAULT_HERO_GALLERY_MARKS as v,DEFAULT_HERO_GALLERY_MODE as B,DEFAULT_HERO_GALLERY_SHOW as V,DEFAULT_HERO_IMAGE_FIT as Y,DEFAULT_HERO_PHOTO_GROUND as w,parseHeroGalleryGap as W,parseHeroCloseUpsFill as q,parseHeroGalleryMarks as X,parseHeroGalleryMode as Z,parseHeroGalleryShow as K,parseHeroImageFit as J,parseHeroPhotoGround as Q,resolveHeroImageFit as ee}from"../lib/sections/hero-gallery.js";import{spinSetFor as te}from"../lib/sections/spin-sets.js";import{productHasComposedRender as ae}from"../lib/wheels/set-mode.js";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";import{swipeEnabled as le,swipeStep as ne}from"efficient-web-builder/format/lib/hero-swipe";function oe({product:t,view:e,angleIdx:o,onSelect:c,isLight:n,onLightbox:s,galleryMode:i=B,imageFit:h=Y,style:a,takesViewHide:m=!1,spin:p=re,ground:d=w,show:g=V,marks:y=v,gap:S=F,closeUpsFill:_=z}){const b=te(p,t.slug,e.metaValue),L=se(Q(d),n),f=K(g)==="closeUps"||b?ie(e):e,E=X(y),T=ce(e,f,q(_)),r=Z(i),x=ee(J(h),ae(t)),H=l(ue,{name:t.name,view:f,wellGround:L,angleIdx:o,onSelect:c,onLightbox:s,fit:x,spinSet:b,marks:E,fillsTile:T});return r==="stacked"?l(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,style:a,children:f.photos.length<2&&!b?H:u(O,{children:[l(me,{name:t.name,view:f,wellGround:L,onLightbox:s,fit:x,spinSet:b,gap:W(S),fillsTile:T}),l(pe,{angleIdx:o,total:U(f),onSelect:c,children:H})]})}):u(C,{as:"div",takes:m,"data-hero-gallery":r,"data-hero-fit":x,className:r==="tiled"?"flex items-start gap-3 max-view-tablet:gap-2":void 0,style:a,children:[l("div",{className:r==="tiled"?"min-w-0 flex-1":void 0,children:H}),r!=="main"&&l(he,{name:t.name,view:f,angleIdx:o,onSelect:c,isLight:n,tiled:r==="tiled"})]})}function U(t){return t.photos.length>0?t.photos.length:t.thumbFallbackCells}const j="relative flex aspect-square items-center justify-center overflow-hidden",re={},k="sf-photo-ground-studio";function se(t,e){return t==="studio"?k:e?"bg-bg":""}function ie(t){return t.photos.length===0||t.closeUps.length===0?t:{...t,photos:[t.photos[0],...t.closeUps.map(e=>e.url)],captions:[t.captions[0],...t.closeUps.map(e=>e.title)]}}const A=()=>!1;function ce(t,e,o){if(!o||e===t)return A;const c=new Set(t.closeUps.map(n=>n.url));return(n,s)=>s>0&&n!==void 0&&c.has(n)}const M=(t,e,o)=>[t,e.metaValue,o].filter(Boolean).join(" — "),P=(t,e)=>[t,e.metaValue].filter(Boolean).join(" "),D=(t,e)=>`Open ${[t,e.metaValue].filter(Boolean).join(" ")} at full resolution`;function me({name:t,view:e,wellGround:o,onLightbox:c,fit:n,spinSet:s,gap:i,fillsTile:h=A}){const a=s?l(R,{set:s,name:P(t,e)}):null,m=i===F;return l("div",{"data-hero-stack":!0,className:m?"flex flex-col gap-2 max-view-tablet:hidden":"flex flex-col max-view-tablet:hidden",style:m?void 0:{gap:`${i}px`},children:e.photos.map((p,d)=>{const g=M(t,e,N(e,d));return l("div",{"data-hero-stack-photo":!0,className:[j,o].join(" "),style:{color:e.tint},children:d===0&&a?a:e.stageImage({photo:p,alt:g,label:D(t,e),onZoom:()=>c(p,g),fit:n,eager:d===0,fillsTile:h(p,d)})},p)})})}function pe({angleIdx:t,total:e,onSelect:o,children:c}){const n=G(null),s=G(null),i=le({count:e}),h=a=>({x:a.touches[0].clientX,y:a.touches[0].clientY});return l("div",{"data-hero-phone-stage":!0,className:"view-tablet:hidden",onTouchStart:a=>{n.current=i&&a.touches.length===1?h(a):null,s.current=n.current},onTouchMove:a=>{n.current&&(a.touches.length!==1?n.current=null:s.current=h(a))},onTouchEnd:()=>{const a=n.current,m=s.current;if(n.current=null,s.current=null,!a||!m)return;const p=ne(m.x-a.x,m.y-a.y,t,e);p!==t&&o(p)},children:c})}const de=6;function ue({name:t,view:e,angleIdx:o,onSelect:c,onLightbox:n,fit:s,spinSet:i,wellGround:h,marks:a,fillsTile:m=A}){const p=e.photos[Math.min(o,e.photos.length-1)],d=I(e.photos,p),g=U(e),y=g>=2,S=String(g).padStart(2,"0"),_=Math.min(o,Math.max(e.photos.length-1,0)),b=y||e.captions[_]?N(e,_):"",L=M(t,e,b),f="max-view-tablet:static",E=[`${j} max-view-tablet:col-span-2`,h].join(" ");return u("div",{className:"relative max-view-tablet:grid max-view-tablet:grid-cols-[minmax(0,1fr)_auto] max-view-tablet:items-start max-view-tablet:gap-x-3 max-view-tablet:gap-y-2",style:{color:e.tint},children:[a&&u("div",{className:`absolute left-0 top-0 z-10 flex items-center gap-3 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-fg ${f} max-view-tablet:min-w-0 max-view-tablet:flex-wrap max-view-tablet:gap-x-2 max-view-tablet:gap-y-1`,children:[y&&u(O,{children:[u("span",{className:"text-accent",children:[String(o+1).padStart(2,"0")," / ",S]}),l("span",{className:"text-fg-dim",children:"·"})]}),l("span",{children:t}),e.metaValue&&u(O,{children:[l("span",{className:"text-fg-dim",children:"·"}),l("span",{className:"text-accent",children:e.metaValue})]})]}),a&&y&&l("div",{className:`absolute right-5 top-5 z-10 flex gap-1 ${f}`,children:$(o,g,c).map(r=>l("button",{type:"button","aria-label":r.label,title:r.label,onClick:r.onClick,className:"flex h-7 w-7 items-center justify-center border border-fg-dim/60 text-fg transition-colors hover:border-accent hover:text-accent",children:r.glyph},r.label))}),u("div",{className:E,children:[h!==k&&["top-3 left-3","top-3 right-3","bottom-3 left-3","bottom-3 right-3"].map((r,x)=>l("span",{className:`absolute ${r} h-3 w-3 border border-fg-dim/40`,style:{borderTop:r.includes("top")?"1px solid var(--site-line)":"none",borderBottom:r.includes("bottom")?"1px solid var(--site-line)":"none",borderLeft:r.includes("left")?"1px solid var(--site-line)":"none",borderRight:r.includes("right")?"1px solid var(--site-line)":"none"}},x)),i&&_===0?l(R,{set:i,name:P(t,e)}):e.stageImage({photo:d,alt:L,label:D(t,e),onZoom:()=>n(d,L),fit:s,fillsTile:m(d,e.photos.indexOf(d??""))})]}),a&&u("div",{className:`absolute bottom-0 left-0 right-0 z-10 flex items-end justify-between gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim ${f} max-view-tablet:col-span-2 max-view-tablet:flex-wrap`,children:[u("span",{className:"flex min-w-0 flex-col gap-1",children:[e.specCaption&&l("span",{children:e.specCaption}),e.referenceNote&&l("span",{"data-hero-reference-note":!0,children:e.referenceNote}),e.galleryHint&&l("span",{"data-hero-gallery-hint":!0,children:e.galleryHint})]}),l("span",{children:e.originCaption})]})]})}function he({name:t,view:e,angleIdx:o,onSelect:c,isLight:n,tiled:s=!1}){const i=U(e);return i<2?null:l("div",{className:s?"order-[-1] flex w-16 flex-col gap-2 max-view-tablet:w-12 max-view-tablet:gap-1":"mt-2 grid grid-cols-4 gap-2 max-view-tablet:gap-1",style:!s&&i>4?{gridTemplateColumns:`repeat(${Math.min(i,de)}, minmax(0, 1fr))`}:void 0,children:Array.from({length:i}).map((h,a)=>{const m=e.photos[a];return u("button",{type:"button",onClick:()=>c(a),"aria-label":`View ${N(e,a)}`,"aria-pressed":a===o,className:["relative flex aspect-square items-center justify-center overflow-hidden transition-colors",n?"bg-bg":"",a===o?"border border-accent":"border border-transparent hover:border-fg-dim"].join(" "),style:{color:e.tint},children:[l("span",{className:"absolute top-1.5 left-2 z-10 font-mono text-[length:var(--size-label,8px)] uppercase tracking-[0.18em] text-fg-dim",children:String(a+1).padStart(2,"0")}),e.thumbImage({photo:m,alt:`${t} — ${N(e,a)}`})]},a)})})}export{oe as default};
|
|
@@ -13,6 +13,7 @@ export interface HeroTemplateProps {
|
|
|
13
13
|
tileTemplate?: SlotComponent;
|
|
14
14
|
optionLooks?: HeroOptionLooks;
|
|
15
15
|
spareWords?: string;
|
|
16
|
+
startChosen?: boolean;
|
|
16
17
|
}
|
|
17
18
|
interface Props extends HeroTemplateProps {
|
|
18
19
|
product: StoreProduct;
|
|
@@ -28,5 +29,5 @@ interface Props extends HeroTemplateProps {
|
|
|
28
29
|
stageToEdge?: boolean;
|
|
29
30
|
showBreadcrumb?: boolean;
|
|
30
31
|
}
|
|
31
|
-
export default function ProductHeroPanel({ product, selection, onLightbox, editing, showVehicleFitment, heroLayout, imageRatio, textAlign, showSpecTable, stickyColumns, stageToEdge, showBreadcrumb, nodeId, template, optionTemplate, optionPressTitles, tileTemplate, buyTemplate, optionLooks, spareWords, }: Props): import("react").JSX.Element;
|
|
32
|
+
export default function ProductHeroPanel({ product, selection, onLightbox, editing, showVehicleFitment, heroLayout, imageRatio, textAlign, showSpecTable, stickyColumns, stageToEdge, showBreadcrumb, nodeId, template, optionTemplate, optionPressTitles, tileTemplate, buyTemplate, optionLooks, spareWords, startChosen, }: Props): import("react").JSX.Element;
|
|
32
33
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as l,jsxs as i,Fragment as y}from"react/jsx-runtime";import{partSkus as We}from"../lib/catalog/part-skus.js";import oe from"next/link";import{useEffect as me,useRef as ce,useState as Ye}from"react";import{useCart as Ge}from"./CartContext.js";import{useSiteTakesOrders as Qe}from"./SiteRecordContext.js";import Xe from"./EmailCaptureForm.js";import{useEnglish as pe}from"./EnglishVariant.js";import{MarkedLabel as de,heroView as qe}from"./product-hero/hero-view.js";import{HeroOptionLooksProvider as Je,OptionDropdown as Ze,OptionLabel as ue,optionWords as et,useHeroOptionLooks as tt}from"./product-hero/OptionLooks.js";import{DEFAULT_HERO_OPTION_LOOKS as lt}from"../lib/sections/hero-option-looks.js";import{useRootIsDark as at}from"efficient-shell/theme";import{useStockAlertSignup as nt}from"./useStockAlertSignup.js";import{SPARE_WORDS as st,productCartLine as rt}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as D}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as it}from"../lib/catalog/product-options.js";import{trackViewItem as ot}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as mt,DEFAULT_HERO_RATIO as ct,DEFAULT_HERO_TEXT_ALIGN as pt,parseHeroLayout as dt,parseHeroRatio as ut,parseHeroTextAlign as ft}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as ht,UNITS_PER_SET as fe,formatPrice as he,spareAxleOf as bt}from"../lib/commerce.js";import{formatSelectionPrice as be}from"../lib/wheels/price-display.js";import{productIsDually as gt,productIsTwoObjects as xt,setSuppressesRow as vt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ge}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as kt,STICKY_SECTION_ATTR as Tt}from"../lib/sections/hero-sticky.js";import{STAGE_EDGE_ATTR as yt,stageEdgeClass as St,stageEdgeCols as Ot}from"../lib/sections/hero-stage-edge.js";import{useStickyColumns as _t}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as Rt}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as M}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as z}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as Et}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as Nt}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as Lt,HERO_TILE_SLOT as wt}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as At,HERO_QUANTITY_PART as Ct,HERO_SAVE_PART as It}from"../lib/content/hero-buy-seed.js";import{HERO_PART as g}from"../lib/content/hero-seed.js";import $t from"./card-pieces/CardQuantity.js";import Pt from"./card-pieces/CardSave.js";import Ht from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as Dt}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as U}from"../lib/document/document-nodes.js";import{withSideOnce as xe}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as Mt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as ve}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as zt}from"./SectionPadScope.js";const Ut=4e3;function jt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ke=[{}],Ft=(e,n)=>n===Ct?l($t,{}):n===It?l(Pt,{}):null,Kt="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Vt({product:e,selection:n,onLightbox:r,editing:s=!1,showVehicleFitment:o=!0,heroLayout:m=mt,imageRatio:c=ct,textAlign:t=pt,showSpecTable:d=!0,stickyColumns:ye=!1,stageToEdge:Se=!1,showBreadcrumb:j=!0,nodeId:_,template:Oe,optionTemplate:_e,optionPressTitles:Re,tileTemplate:Ee,buyTemplate:Ne,optionLooks:F=lt,spareWords:Le}){const K=Mt(),we=pe(),f=dt(m),V=ft(t),T=ut(c),R=ye===!0&&f!=="stacked",S=Se===!0&&f!=="stacked",B=ce(null);_t(B,R);const Ae=S?Ot(T,f==="imageRight"):f==="imageRight"?`${100-T}fr ${T}fr`:`${T}fr ${100-T}fr`,E=S?{gap:"",y:"",yTablet:""}:{gap:"gap-10 ",y:"py-14 ",yTablet:"max-view-tablet:py-8 "},{picked:Ce,pick:W,qty:Y,setQty:Ie,choice:G,setChoice:$e,angleIdx:qt,setAngleIdx:Jt,showValidation:Pe,setShowValidation:N,manualMode:Q,vehicle:L,rows:X,facts:He,part:h,outOfStock:q,offer:w,preOrder:A,canAddToCart:J,currency:x,price:u,set:Z,msrpLabel:De}=n,p=qe(e,n,s),ee=gt(e),Me=xt(e),C=o?p.vehicle:null,ze=o?p.vehicleMemory:null,te=!at({whenUnset:!0}),{warmCatalog:le}=Ge(),O=Qe();me(()=>{!s&&O&&le(e.kind,e.slug)},[s,O,e.kind,e.slug,le]);const ae=X.filter(a=>!A||a.values.length>0),ne=ae.filter(a=>a.role==="resolves"),I=ae.filter(a=>a.role==="describes"&&!vt(Me,a.key)),se=I.findIndex(a=>a.chosen===null),re=(!C||!p.vehicleAnswersSpecs||n.fitmentSet)&&it(X,A)?se===-1?I:I.slice(0,se+1):[],Ue=[...ne,...re];function je(){return J?(N(!1),s?null:rt(e,h,Ce,{choice:G,qty:Y},{fitmentLabel:Q?p.specCaption:L.appliedName?`For ${L.appliedName}`:"",fitmentKey:Q?`manual|${p.specCaption}`:`vehicle|${jt(L.applied?.vehicle)}`})):(N(!0),window.setTimeout(()=>N(!1),Ut),null)}const Fe={kind:"hero",msrpLabel:De||null,amount:be(u,x),unitLabel:u.priced?p.unitLabel:null,packBadge:u.setTotal!=null?`${w.quantityLabel}: ${he(Z,x)}`:null,buy:{isSet:ee,priced:u.priced,outOfStock:q,canAdd:J,totalLabel:u.setTotal!=null?he(Z,x):null,lineToAdd:je},qty:Y,setQty:Ie,takesQty:O&&!(ee&&!u.priced),save:{slug:e.slug,name:e.name},facts:d?He:null,title:{eyebrow:e.eyebrow,name:p.heading,badge:e.badge||null},product:e,selection:n,openLightbox:r,sku:We(h),designCode:e.kind==="alloy-wheel"&&e.source.designCode||null,setLine:Yt(u,Wt(w.quantityLabel,e.kind),x)},$={nodeId:_??"",template:_e,tileTemplate:Ee,pressTitles:Re,editing:s},b=!!(A&&p.preOrder),Ke={[g.fitmentLine]:ze,[g.options]:i(Je,{looks:F,children:[ne.map(a=>l(Te,{row:a,onPick:W,options:$},a.key)),!b&&C,!b&&re.map(a=>l(Te,{row:a,onPick:W,options:$},a.key))]}),[g.facts]:b?null:l(Ht,{}),[g.howMany]:b?null:l(Qt,{offer:w,takesOrders:O,choice:G,setChoice:$e,options:$,spareLook:F.spare,spareWords:Le}),[g.buy]:b?p.preOrder:l(z,{children:l(M,{ownerId:_??"",ownerType:U,slot:At,Template:Ne,rows:ke,fallback:null,hostParts:Ft,children:a=>a})}),[g.notify]:!b&&q&&h?l(Xt,{partNumbers:h.components.map(a=>a.partNumber),productSlug:e.slug},h.id):null,[g.reminder]:!b&&Pe?Be():null},Ve=(a,v)=>Ke[v]??null;function Be(){const a=Ue.filter(H=>H.chosen===null).map(H=>we(H.prompt).replace(/^Select\s+/i,""));if(C&&p.vehicleAnswersSpecs&&!n.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const v=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return i("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",v," first."]})}const ie=ce(null);me(()=>{s||ie.current===e.slug||(ie.current=e.slug,ot({itemId:h?`${e.slug}|${h.id}`:e.slug,itemName:e.name,variant:p.metaValue,pricePerSet:u.setTotal??u.fromSetTotal??0,currency:x}))},[s,e.slug,e.name,p.metaValue,h,u,x]);const P=zt();return i(y,{children:[j&&l("nav",{...ve(xe(`border-b border-line ${ge} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,K),P?.first?.atTop,te?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,v)=>i("span",{children:[v>0&&i(y,{children:[l("span",{className:"mx-3 text-accent",children:"/"}),l("wbr",{})]}),a.href?l(oe,{href:a.href,className:"hover:text-fg",children:l(de,{text:a.label})}):l("span",{className:"text-fg",children:l(de,{text:a.label})})]},`${a.label}-${v}`))}),l("section",{ref:B,"data-hero-layout":f,"data-hero-align":V,...R?{[Tt]:""}:{},...S?{[yt]:""}:{},...ve([xe(`grid ${E.gap}${ge} ${E.y}max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] ${E.yTablet}${Kt}`,K),V==="center"?Rt.center:"",f==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",R?kt:"",S?St(f==="imageRight"):""].filter(Boolean).join(" "),j?P?.second?.atTop:P?.secondOnly?.atTop,{...te?{}:{background:"var(--section-bg)"},...f==="stacked"?{}:{"--hero-cols":Ae}}),children:l(Dt,{value:Fe,children:l(z,{children:l(M,{ownerId:_??"",ownerType:U,Template:Oe,rows:ke,fallback:null,hostParts:Ve,children:a=>a})})})})]})}const Bt="wheels";function Wt(e,n){return n==="alloy-wheel"&&/\d$/.test(e)?`${e} ${Bt}`:e}function Yt(e,n,r){if(!e.priced)return null;const s=e.setTotal??e.fromSetTotal;return s==null?null:{label:n,total:be({...e,unit:s,isFrom:e.setTotal==null},r)}}const Gt={caps:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em]",plain:"font-body text-[length:var(--size-body,13px)]"};function Qt({offer:e,takesOrders:n,choice:r,setChoice:s,options:o,spareLook:m,spareWords:c}){return e.packs.length>0||n&&(e.extra||e.spareCounts.length>0)?i("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&i(y,{children:[l("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),l("div",{className:"flex flex-wrap gap-1.5",children:l(k,{hero:o,values:e.packs,item:t=>({label:t.label}),picked:t=>r.unit===t.value,press:t=>()=>s(d=>({...d,unit:t.value}))})})]}),n&&e.extra&&i("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 ${Gt[m]} text-fg`,children:[l("input",{type:"checkbox",checked:r.spares>0,onChange:t=>s(d=>({...d,spares:t.target.checked?ht:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),c?.trim()||e.extra.label]}),n&&e.spareCounts.length>0&&i(y,{children:[l("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:st.howMany}),l("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:l(k,{hero:o,values:e.spareCounts,item:t=>({label:`${t.value} · ${t.label}`}),picked:t=>r.spares===t.value-fe,press:t=>()=>s(d=>({...d,spares:t.value-fe}))})})]}),n&&e.spareSide&&i(y,{children:[l("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.spareSide.label}),l("div",{className:"flex flex-wrap gap-1.5",children:l(k,{hero:o,values:e.spareSide.options,item:t=>({label:t.label}),picked:t=>r.spareSide===t.value&&(t.axle===void 0||bt(r)===t.axle),press:t=>()=>s(d=>({...d,spareSide:t.value,...t.axle?{spareAxle:t.axle}:{}}))})})]})]}):null}function Te({row:e,onPick:n,options:r}){const s=pe(),o=tt();if(e.values.length===0&&!e.empty)return null;const m=e.values.find(t=>t.value===e.chosen),c=m&&[m.label,m.note].filter(Boolean).join(" · ");return e.values.length>0&&e.display==="swatch"&&o.finish==="tiles"?i("div",{[D]:e.key,children:[l(ue,{label:s(e.label),chosen:m?.label}),l("div",{className:"flex flex-wrap gap-2","data-option-tiles":"",children:l(k,{hero:r,tiles:!0,values:e.values,item:t=>({swatch:t.swatch??"",name:t.label}),label:t=>t.label,picked:t=>t.value===e.chosen,press:t=>()=>n(e.key,t.value)})})]}):e.values.length>0&&e.display==="pill"&&e.role==="resolves"&&o.size==="dropdown"?i("div",{[D]:e.key,children:[l(ue,{label:s(e.label)}),l(Ze,{rowKey:e.key,label:s(e.label),shown:c||s(e.prompt),items:e.values.map(t=>({value:t.value,label:et(t)})),value:e.chosen??"",onPick:t=>n(e.key,t),editing:r.editing})]}):i("div",{className:"border-b border-line pb-[26px]",[D]:e.key,children:[i("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[s(e.label)," · ",l("span",{className:"text-accent",children:c??s(e.prompt)})]}),e.values.length===0?i("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",l(oe,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?l("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:l(k,{hero:r,values:e.values,item:t=>({swatch:t.swatch??"",name:t.label}),picked:t=>t.value===e.chosen,press:t=>()=>n(e.key,t.value)})}):l("div",{className:"flex flex-wrap gap-1.5",children:l(k,{hero:r,values:e.values,item:t=>({label:t.label,note:t.note??""}),picked:t=>t.value===e.chosen,press:t=>()=>n(e.key,t.value)})})]})}function k({hero:e,values:n,item:r,label:s,picked:o,press:m,tiles:c=!1}){const t=Nt(n,{item:r,selected:o,press:m,label:s});return l(z,{children:l(M,{ownerId:e.nodeId,ownerType:U,slot:c?wt:Lt,Template:c?e.tileTemplate:e.template,rows:t.items.map(Et),items:t.items,states:t.states,actions:e.editing?void 0:t.actions,pressTitles:c?void 0:e.pressTitles,fallback:null,children:d=>d})})}function Xt({partNumbers:e,productSlug:n}){const[r,s]=Ye(""),{status:o,submit:m,reset:c}=nt();function t(){m({partNumbers:e,email:r,productSlug:n})}return o==="sent"?l("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):l(Xe,{className:"-mt-1",email:r,onEmailChange:s,status:o,onResetVerdict:c,onSubmit:t,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{Vt as default};
|
|
1
|
+
"use client";import{jsx as t,jsxs as m,Fragment as S}from"react/jsx-runtime";import{partSkus as Ge}from"../lib/catalog/part-skus.js";import pe from"next/link";import{useEffect as z,useRef as de,useState as Qe}from"react";import{useCart as Xe}from"./CartContext.js";import{useSiteTakesOrders as qe}from"./SiteRecordContext.js";import Je from"./EmailCaptureForm.js";import{useEnglish as ue}from"./EnglishVariant.js";import{MarkedLabel as fe,heroView as Ze}from"./product-hero/hero-view.js";import{HeroOptionLooksProvider as et,OptionDropdown as tt,OptionLabel as he,optionWords as lt,useHeroOptionLooks as at}from"./product-hero/OptionLooks.js";import{DEFAULT_HERO_OPTION_LOOKS as nt}from"../lib/sections/hero-option-looks.js";import{useRootIsDark as st}from"efficient-shell/theme";import{useStockAlertSignup as rt}from"./useStockAlertSignup.js";import{SPARE_WORDS as it,productCartLine as ot}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as U}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as mt}from"../lib/catalog/product-options.js";import{trackViewItem as ct}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as pt,DEFAULT_HERO_RATIO as dt,DEFAULT_HERO_TEXT_ALIGN as ut,parseHeroLayout as ft,parseHeroRatio as ht,parseHeroTextAlign as bt}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as gt,UNITS_PER_SET as be,formatPrice as ge,spareAxleOf as xt}from"../lib/commerce.js";import{formatSelectionPrice as xe,formatSparePrice as vt}from"../lib/wheels/price-display.js";import{productIsDually as Tt,productIsTwoObjects as kt,setSuppressesRow as yt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ve}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as St,STICKY_SECTION_ATTR as Ot}from"../lib/sections/hero-sticky.js";import{STAGE_EDGE_ATTR as _t,stageEdgeClass as Nt,stageEdgeCols as Rt}from"../lib/sections/hero-stage-edge.js";import{useStickyColumns as Et}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as Lt}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as j}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as F}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as wt}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as At}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as Ct,HERO_TILE_SLOT as It}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as $t,HERO_QUANTITY_PART as Pt,HERO_SAVE_PART as Ht}from"../lib/content/hero-buy-seed.js";import{HERO_PART as v}from"../lib/content/hero-seed.js";import Dt from"./card-pieces/CardQuantity.js";import Mt from"./card-pieces/CardSave.js";import zt from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as Ut}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as K}from"../lib/document/document-nodes.js";import{withSideOnce as Te}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as jt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as ke}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as Ft}from"./SectionPadScope.js";const Kt=4e3;function Vt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ye=[{}],Bt=(e,s)=>s===Pt?t(Dt,{}):s===Ht?t(Mt,{}):null,Wt="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Yt({product:e,selection:s,onLightbox:i,editing:r=!1,showVehicleFitment:o=!0,heroLayout:p=pt,imageRatio:d=dt,textAlign:l=ut,showSpecTable:n=!0,stickyColumns:f=!1,stageToEdge:Oe=!1,showBreadcrumb:V=!0,nodeId:N,template:_e,optionTemplate:Ne,optionPressTitles:Re,tileTemplate:Ee,buyTemplate:Le,optionLooks:B=nt,spareWords:we,startChosen:R=!1}){const W=jt(),Ae=ue(),h=ft(p),Y=bt(l),y=ht(d),E=f===!0&&h!=="stacked",O=Oe===!0&&h!=="stacked",G=de(null);Et(G,E);const Ce=O?Rt(y,h==="imageRight"):h==="imageRight"?`${100-y}fr ${y}fr`:`${y}fr ${100-y}fr`,L=O?{gap:"",y:"",yTablet:""}:{gap:"gap-10 ",y:"py-14 ",yTablet:"max-view-tablet:py-8 "},{picked:Ie,pick:Q,qty:X,setQty:$e,choice:q,setChoice:Pe,angleIdx:el,setAngleIdx:tl,showValidation:He,setShowValidation:w,manualMode:J,vehicle:A,rows:Z,facts:De,part:b,outOfStock:ee,offer:C,preOrder:I,canAddToCart:te,currency:g,price:c,set:le,msrpLabel:Me}=s,u=Ze(e,s,r),{chooseStart:ze}=s;z(()=>{R&&ze()},[R,e.slug]);const ae=Tt(e),Ue=kt(e),$=o?u.vehicle:null,je=o?u.vehicleMemory:null,ne=!st({whenUnset:!0}),{warmCatalog:se}=Xe(),_=qe();z(()=>{!r&&_&&se(e.kind,e.slug)},[r,_,e.kind,e.slug,se]);const re=Z.filter(a=>!I||a.values.length>0),ie=re.filter(a=>a.role==="resolves"),P=re.filter(a=>a.role==="describes"&&!yt(Ue,a.key)),oe=P.findIndex(a=>a.chosen===null),me=(!$||!u.vehicleAnswersSpecs||s.fitmentSet)&&mt(Z,I)?oe===-1?P:P.slice(0,oe+1):[],Fe=[...ie,...me];function Ke(){return te?(w(!1),r?null:ot(e,b,Ie,{choice:q,qty:X},{fitmentLabel:J?u.specCaption:A.appliedName?`For ${A.appliedName}`:"",fitmentKey:J?`manual|${u.specCaption}`:`vehicle|${Vt(A.applied?.vehicle)}`})):(w(!0),window.setTimeout(()=>w(!1),Kt),null)}const Ve={kind:"hero",msrpLabel:Me||null,amount:xe(c,g),unitLabel:c.priced?u.unitLabel:null,packBadge:c.setTotal!=null?`${C.quantityLabel}: ${ge(le,g)}`:null,buy:{isSet:ae,priced:c.priced,outOfStock:ee,canAdd:te,totalLabel:c.setTotal!=null?ge(le,g):null,lineToAdd:Ke},qty:X,setQty:$e,takesQty:_&&!(ae&&!c.priced),save:{slug:e.slug,name:e.name},facts:n?De:null,title:{eyebrow:e.eyebrow,name:u.heading,badge:e.badge||null},product:e,selection:s,openLightbox:i,sku:Ge(b),designCode:e.kind==="alloy-wheel"&&e.source.designCode||null,setLine:Xt(c,Qt(C.quantityLabel,e.kind),g),startChosen:R},H={nodeId:N??"",template:Ne,tileTemplate:Ee,pressTitles:Re,editing:r},x=!!(I&&u.preOrder),Be={[v.fitmentLine]:je,[v.options]:m(et,{looks:B,children:[ie.map(a=>t(Se,{row:a,onPick:Q,options:H},a.key)),!x&&$,!x&&me.map(a=>t(Se,{row:a,onPick:Q,options:H},a.key))]}),[v.facts]:x?null:t(zt,{}),[v.howMany]:x?null:t(Jt,{offer:C,asksSpares:_&&c.priced,choice:q,setChoice:Pe,options:H,spareLook:B.spare,spareWords:we,spareCost:c.priced?vt(c,g):null}),[v.buy]:x?u.preOrder:t(F,{children:t(j,{ownerId:N??"",ownerType:K,slot:$t,Template:Le,rows:ye,fallback:null,hostParts:Bt,children:a=>a})}),[v.notify]:!x&&ee&&c.priced&&b?t(Zt,{partNumbers:b.components.map(a=>a.partNumber),productSlug:e.slug},b.id):null,[v.reminder]:!x&&He?Ye():null},We=(a,T)=>Be[T]??null;function Ye(){const a=Fe.filter(M=>M.chosen===null).map(M=>Ae(M.prompt).replace(/^Select\s+/i,""));if($&&u.vehicleAnswersSpecs&&!s.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const T=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return m("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",T," first."]})}const ce=de(null);z(()=>{r||ce.current===e.slug||(ce.current=e.slug,ct({itemId:b?`${e.slug}|${b.id}`:e.slug,itemName:e.name,variant:u.metaValue,pricePerSet:c.setTotal??c.fromSetTotal??0,currency:g}))},[r,e.slug,e.name,u.metaValue,b,c,g]);const D=Ft();return m(S,{children:[V&&t("nav",{...ke(Te(`border-b border-line ${ve} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,W),D?.first?.atTop,ne?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,T)=>m("span",{children:[T>0&&m(S,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(pe,{href:a.href,className:"hover:text-fg",children:t(fe,{text:a.label})}):t("span",{className:"text-fg",children:t(fe,{text:a.label})})]},`${a.label}-${T}`))}),t("section",{ref:G,"data-hero-layout":h,"data-hero-align":Y,...E?{[Ot]:""}:{},...O?{[_t]:""}:{},...ke([Te(`grid ${L.gap}${ve} ${L.y}max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] ${L.yTablet}${Wt}`,W),Y==="center"?Lt.center:"",h==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",E?St:"",O?Nt(h==="imageRight"):""].filter(Boolean).join(" "),V?D?.second?.atTop:D?.secondOnly?.atTop,{...ne?{}:{background:"var(--section-bg)"},...h==="stacked"?{}:{"--hero-cols":Ce}}),children:t(Ut,{value:Ve,children:t(F,{children:t(j,{ownerId:N??"",ownerType:K,Template:_e,rows:ye,fallback:null,hostParts:We,children:a=>a})})})})]})}const Gt="wheels";function Qt(e,s){return s==="alloy-wheel"&&/\d$/.test(e)?`${e} ${Gt}`:e}function Xt(e,s,i){if(!e.priced)return null;const r=e.setTotal==null?e.openSettled?.setTotal??null:null,o=e.setTotal??r??e.fromSetTotal;return o==null?null:{label:s,total:xe({...e,unit:o,isFrom:e.setTotal==null&&r==null},i)}}const qt={caps:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em]",plain:"font-body text-[length:var(--size-body,13px)]"};function Jt({offer:e,asksSpares:s,choice:i,setChoice:r,options:o,spareLook:p,spareWords:d,spareCost:l}){return e.packs.length>0||s&&(e.extra||e.spareCounts.length>0)?m("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&m(S,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:o,values:e.packs,item:n=>({label:n.label}),picked:n=>i.unit===n.value,press:n=>()=>r(f=>({...f,unit:n.value}))})})]}),s&&e.extra&&m("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 ${qt[p]} text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:n=>r(f=>({...f,spares:n.target.checked?gt:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),d?.trim()||e.extra.label,l&&t("span",{className:"ml-auto whitespace-nowrap",children:l})]}),s&&e.spareCounts.length>0&&m(S,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:it.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(k,{hero:o,values:e.spareCounts,item:n=>({label:`${n.value} · ${n.label}`}),picked:n=>i.spares===n.value-be,press:n=>()=>r(f=>({...f,spares:n.value-be}))})})]}),s&&e.spareSide&&m(S,{children:[t("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.spareSide.label}),t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:o,values:e.spareSide.options,item:n=>({label:n.label}),picked:n=>i.spareSide===n.value&&(n.axle===void 0||xt(i)===n.axle),press:n=>()=>r(f=>({...f,spareSide:n.value,...n.axle?{spareAxle:n.axle}:{}}))})})]})]}):null}function Se({row:e,onPick:s,options:i}){const r=ue(),o=at();if(e.values.length===0&&!e.empty)return null;const p=e.values.find(l=>l.value===e.chosen),d=p&&[p.label,p.note].filter(Boolean).join(" · ");return e.values.length>0&&e.display==="swatch"&&o.finish==="tiles"?m("div",{[U]:e.key,children:[t(he,{label:r(e.label),chosen:p?.label}),t("div",{className:"flex flex-wrap gap-2","data-option-tiles":"",children:t(k,{hero:i,tiles:!0,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),label:l=>l.label,picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]}):e.values.length>0&&e.display==="pill"&&e.role==="resolves"&&o.size==="dropdown"?m("div",{[U]:e.key,children:[t(he,{label:r(e.label)}),t(tt,{rowKey:e.key,label:r(e.label),shown:d||r(e.prompt),items:e.values.map(l=>({value:l.value,label:lt(l)})),value:e.chosen??"",onPick:l=>s(e.key,l),editing:i.editing})]}):m("div",{className:"border-b border-line pb-[26px]",[U]:e.key,children:[m("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[r(e.label)," · ",t("span",{className:"text-accent",children:d??r(e.prompt)})]}),e.values.length===0?m("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",t(pe,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?t("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:t(k,{hero:i,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:i,values:e.values,item:l=>({label:l.label,note:l.note??""}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]})}function k({hero:e,values:s,item:i,label:r,picked:o,press:p,tiles:d=!1}){const l=At(s,{item:i,selected:o,press:p,label:r});return t(F,{children:t(j,{ownerId:e.nodeId,ownerType:K,slot:d?It:Ct,Template:d?e.tileTemplate:e.template,rows:l.items.map(wt),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:d?void 0:e.pressTitles,fallback:null,children:n=>n})})}function Zt({partNumbers:e,productSlug:s}){const[i,r]=Qe(""),{status:o,submit:p,reset:d}=rt();function l(){p({partNumbers:e,email:i,productSlug:s})}return o==="sent"?t("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):t(Je,{className:"-mt-1",email:i,onEmailChange:r,status:o,onResetVerdict:d,onSubmit:l,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{Yt as default};
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export declare const QUOTE_HREF = "/contact";
|
|
2
|
+
export declare const FITTER_POPUP_SLUG = "talk-to-a-fitter";
|
|
3
|
+
export declare function PriceOnRequestLink({ className, attrs }: {
|
|
4
|
+
className: string;
|
|
5
|
+
attrs?: Record<string, string>;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
2
7
|
export default function QuoteLink({ className, attrs, }: {
|
|
3
8
|
className: string;
|
|
4
9
|
attrs?: Record<string, string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import i from"next/link";import{popupPath as p}from"efficient-web-builder/format/lib/links/page-link-rules";import{useSitePopupOpens as s}from"../lib/popup/site-popup-opens.js";import{SET_QUOTE_LABEL as c,UNPRICED_LABEL as f}from"../lib/wheels/price-display.js";const o="/contact",n="talk-to-a-fitter",u=p(n);function m(){return s(n)?u:o}function l({className:t,attrs:r}){return e("a",{href:m(),className:t,...r,children:f})}function a({className:t,attrs:r}){return e(i,{href:o,className:t,...r,children:c})}export{n as FITTER_POPUP_SLUG,l as PriceOnRequestLink,o as QUOTE_HREF,a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as b}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as o,jsxs as b}from"react/jsx-runtime";import P from"next/link";import{useEffect as g}from"react";import{useCart as S}from"../CartContext.js";import _,{PriceOnRequestLink as z}from"../QuoteLink.js";import{NO_HIDE as I,useTakeViewHide as U,withViewHide as h}from"efficient-web-builder/render/components/ViewHideRoot";import{useSiteTakesOrders as C}from"../SiteRecordContext.js";import V from"../wheels-plp/PlpNotifyMeDialog.js";import{DEFAULT_PURCHASE_STATE as D}from"../../lib/catalog/purchase.js";import{ADD_TO_BASKET_ATTR as k}from"../../lib/commerce.js";import{STOCK_WORDS as W}from"../../lib/content/stock-words.js";import{DEFAULT_BUY_BUTTON_LOOK as L}from"../../lib/content/buy-button-look.js";import{tyreCartLine as j}from"../../lib/tyres/tyre-purchase.js";import{priceIn as q,resolveWheelPrice as F}from"../../lib/wheels/price-display.js";import{isOneWheelDesign as Y,setLabel as K}from"../../lib/wheels/variants.js";import{splitWheelName as G}from"../../lib/wheels/wheel-name.js";import{CARD_TEXT_SIZE as O,CardButtonRow as x}from"./card-row.js";import{TYRE_BUY_CHIPS_CLASS as M,TyreSizeChips as Q}from"./CardSizes.js";import{useHeroStateOrNull as X,useProductCardStateOrNull as Z,useWheelCardState as J}from"./ProductCardState.js";import{blockParts as tt}from"../../lib/block-parts.js";const l=tt("ProductCard"),v="mt-3 flex flex-col gap-2",f=`cursor-pointer bg-btn px-4 py-3 font-mono ${O.labelSmall} font-bold uppercase tracking-[0.24em] text-btn-ink transition-colors hover:bg-fg`,et=`border border-btn px-4 py-3 text-center font-mono ${O.labelSmall} font-bold uppercase tracking-[0.24em] text-btn transition-colors hover:bg-btn hover:text-btn-ink`,rt="View sizes & fitment",ot="mt-3 block font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.18em] text-accent underline-offset-4 group-hover:underline";function nt({wheel:t,sel:r,price:n,editing:e}){const{addAndOpen:a,warmCatalog:c}=S();g(()=>{e||c(void 0,t.slug)},[e,c,t.slug]);const{arm:i}=r;g(()=>{i()},[i]);function d(){const s=r.selectedVariant;!s||!r.canAdd||n.priced&&(e||a({id:`${t.slug}|${s.finishName}|${s.size}|quick`,slug:t.slug,name:G(t.name),process:t.process,positionNo:"01",config:[{label:s.size},{label:s.finishName,gold:!0},{label:K(s)}],finishName:s.finishName,size:s.size,components:s.components,qty:1}))}return o("button",{type:"button",onClick:d,[k]:"",disabled:!r.canAdd,className:r.canAdd?f:`${f} opacity-80`,...l("button"),children:"Add to basket"})}function at(t,r,n){return Y(t)?r.outOfStock&&n?"notify":r.unsellable||!n||r.detailState==="ready"&&!r.canAdd?"choose":"add":"choose"}function it({state:t,buy:r,page:n}){const{wheel:e,sel:a,price:c,editing:i,setNotifyOpen:d}=t,s=C(),u=at(e,a,c.priced),m=r?u==="notify"?o("button",{type:"button",onClick:()=>d(!0),className:f,...l("button"),children:"Notify me when back"}):u==="add"?s?o(nt,{wheel:e,sel:a,price:c,editing:i}):o(_,{className:f,attrs:l("button")}):null:null,p=!n||m?null:b("span",{"aria-hidden":!0,className:ot,...l("page-label"),children:[rt," →"]});return o(x,{children:m||p?b("div",{className:v,children:[m,p]}):null})}function st({state:t}){const{tyre:r,currency:n,pagePath:e,detail:a,variant:c,canAdd:i,detailReady:d,unsellable:s,editing:u}=t,{addAndOpen:m,warmCatalog:p}=S(),A=C();g(()=>{!u&&A&&p("tyre")},[u,A,p]);const E=F(q(r.prices,n),null).priced;function H(){!a||!c||!i||u||m(j(a,c,D.choice,D.qty))}return b(x,{children:[o("div",{className:M,children:o(Q,{state:t})}),b("div",{className:v,children:[!s&&E&&!A&&o(_,{className:f,attrs:l("button")}),!s&&E&&A&&o("button",{type:"button",onClick:H,[k]:"",disabled:d&&!i,className:i||!d?`${f}${i?"":" opacity-80"}`:`cursor-not-allowed border border-dashed border-accent/50 px-4 py-3 font-mono ${O.labelSmall} font-bold uppercase tracking-[0.24em] text-accent/70`,...l("button"),children:d&&!i?"Select a size":"Add to basket"}),e&&o(P,{href:e,className:et,...l("button"),children:"Open product page"})]})]})}const T="px-6 py-4",y="font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em]",ct=`w-full ${T} ${y}`,dt=`w-full cursor-not-allowed border-2 border-dashed border-fg-dim/20 ${T} ${y} text-fg-dim/40`,R=`w-full cursor-pointer bg-btn ${T} text-center ${y} text-btn-ink transition-colors hover:bg-fg`,$="flex h-12 w-full items-center justify-center px-6 text-[length:var(--size-label,14px)] font-medium normal-case tracking-normal transition-colors",N=`${$} cursor-pointer bg-btn text-btn-ink hover:bg-btn-2`,lt=`${$} cursor-not-allowed border-2 border-dashed border-fg-dim/20 text-fg-dim/40`;function w(t,r){return!r||t.isSet&&!t.priced?"quote":t.priced?t.outOfStock?"outOfStock":"add":"unpriced"}function B({buy:t,takesOrders:r,add:n,take:e=I,look:a=L}){const c=w(t,r),i=a==="solid";return c==="quote"?o(_,{className:h(i?N:R,e.className)??"",attrs:e.attrs}):c==="unpriced"?o(z,{className:h(i?N:R,e.className)??"",attrs:e.attrs}):c==="outOfStock"?o("button",{type:"button",disabled:!0,"aria-disabled":!0,className:h(i?lt:dt,e.className),...e.attrs,children:W.outOfStock}):b("button",{type:"button",[k]:"",onClick:()=>{const d=t.lineToAdd();d&&n(d)},"aria-disabled":!t.canAdd,className:h(i?N:[`${ct} transition-colors`,t.canAdd?"cursor-pointer bg-btn text-btn-ink hover:bg-fg hover:text-bg":"cursor-pointer border-2 border-dashed border-accent/50 text-accent/80 hover:border-accent hover:text-accent"].join(" "),e.className),style:i||t.canAdd?void 0:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},...e.attrs,children:["Add to cart",t.totalLabel!=null?` · ${t.totalLabel}`:""]})}const ut=()=>{};function ft({buy:t,take:r,look:n}){const{addAndOpen:e}=S();return o(B,{buy:t,takesOrders:!0,add:a=>e(a),take:r,look:n})}function mt({buy:t,look:r}){const n=C(),e=U();return e.scope(w(t,n)==="add"?o(ft,{buy:t,take:e,look:r}):o(B,{buy:t,takesOrders:n,add:ut,take:e,look:r}))}function pt({buy:t=!0,page:r=!0,look:n=L}){const e=X(),a=Z();if(e)return e.buy?o(mt,{buy:e.buy,look:n}):null;if(!a)throw new Error("A product card piece was drawn outside a product card (no ProductCardState).");return a.kind==="bundle"?o(x,{}):a.kind==="tyre"?o(st,{state:a}):o(it,{state:a,buy:t,page:r})}function Bt(){const{wheel:t,sel:r,editing:n,notifyOpen:e,setNotifyOpen:a}=J();return e?o(V,{wheelName:t.name,productSlug:t.slug,finishName:r.confirmedFinishName,variants:r.outOfStockVariants,initialSize:r.selectedVariant?.size,onClose:()=>a(!1),editing:n}):null}export{rt as CARD_PAGE_WORDS,Bt as CardBuyDialog,B as HeroBuyButton,pt as default};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import { type ProductCardState } from "./ProductCardState.js";
|
|
3
3
|
import { type CardTextRegion } from "./card-text-region.js";
|
|
4
|
+
import type { TextTag } from "efficient-web-builder/format/lib/content/text-tag";
|
|
4
5
|
export declare function cardNameWords(state: ProductCardState | null): string | null;
|
|
5
|
-
export default function CardName({ children: name, region, fixedHeight, }: {
|
|
6
|
+
export default function CardName({ children: name, region, fixedHeight, as, }: {
|
|
6
7
|
children?: ReactNode;
|
|
7
8
|
region?: CardTextRegion;
|
|
8
9
|
fixedHeight?: boolean;
|
|
10
|
+
as?: TextTag;
|
|
9
11
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as s}from"react/jsx-runtime";import{HideTaker as u}from"efficient-web-builder/render/components/ViewHideRoot";import{withRMark as p}from"efficient-web-builder/render/components/RMark";import{tyreModelLine as f}from"../../lib/tyres/tyre-brand-name.js";import{CARD_TEXT_SIZE as r,useCatalogCard as h}from"./card-row.js";import{useProductCardStateOrNull as g}from"./ProductCardState.js";import{RegionBridge as k,RegionWords as w,regionAttr as x}from"./card-text-region.js";import{blockParts as N}from"../../lib/block-parts.js";const m=N("ProductCard");function y(e){return e?.kind==="wheel"?e.wheel.name:e?.kind==="bundle"?e.bundle.name:e?.kind==="tyre"?f(e.tyre.brand??"",e.tyre.name):null}function C({children:e,region:a,fixedHeight:l=!0,as:c}){const o=h(),n=g(),d=n?.kind==="wheel"?p(n.wheel.name):y(n);e===void 0&&d===null&&process.env.NODE_ENV!=="production"&&console.warn("[CardName] no name given and no wheel card state: the name block is empty");const i=n?.kind==="tyre"?n.tyre.treadPattern?.trim():"";return s(k,{region:a,sectionType:"ProductName",children:[t(u,{as:c,...x(a,"name"),className:o&&!l?`font-heading3 ${r.headingSmall2} font-medium uppercase leading-none tracking-[-0.02em]`:o?`mt-2 h-[60px] overflow-hidden break-words [.sf-card-rows_&]:h-auto [.sf-card-rows_&]:max-h-[60px] font-heading3 ${r.headingSmall2} font-medium uppercase leading-none tracking-[-0.02em]`:`mt-2 font-heading3 ${r.headingSmall1} font-medium tracking-[-0.02em]`,...m("product-name"),children:t(w,{region:a,at:"name",children:e??d})}),i?t("div",{className:`sf-card-pattern mt-1 font-mono ${r.labelSmall} uppercase tracking-[0.18em] text-accent`,...m("pattern"),children:i}):null]})}export{y as cardNameWords,C as default};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { TextTag } from "efficient-web-builder/format/lib/content/text-tag";
|
|
1
2
|
import { type CardTextRegion } from "./card-text-region.js";
|
|
2
|
-
export default function HeadlineName({ name, accentLastWord, region, }: {
|
|
3
|
+
export default function HeadlineName({ name, accentLastWord, region, tag: Tag, }: {
|
|
4
|
+
tag?: TextTag;
|
|
3
5
|
name: string;
|
|
4
6
|
region?: CardTextRegion;
|
|
5
7
|
accentLastWord: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as o,Fragment as m,jsx as r}from"react/jsx-runtime";import{HideTaker as d}from"efficient-web-builder/render/components/ViewHideRoot";import{PART_SIZE_CAP_VAR as f,partCanvasDeclarations as h,regionSheetStyle as g}from"efficient-web-builder/render/lib/document/part-styles";import{VIEW_TIERS as p}from"efficient-easel/screen/lib/content/view-tiers";import{textRegionPartKey as l}from"efficient-web-builder/format/lib/sections/text-regions";import{RegionBridge as x,RegionWords as E,regionAttr as S}from"./card-text-region.js";const _=.72;function u(e,n=!0){const t=e.trim().split(/\s+/).filter(Boolean);if(t.length===0)return;const a=t.map((i,s)=>i.length+(n&&t.length>1&&s===t.length-1?1:0));return`calc(100cqi / ${(Math.max(...a)*_).toFixed(2)})`}const c="text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))]",A=`font-heading2 ${c} [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]`,N=c,y=e=>g(e?.partStyles?.[l("name")])?.textStyle!==void 0,v=e=>{const n=e?.partStyles?.[l("name")];return!!n&&p.some(t=>!!h(n,t).fontSize)},w=(e,n)=>({"--hero-name-fit":e,...e&&n?{[f]:e}:{}});function R({name:e,accentLastWord:n,region:t,tag:a="h1"}){const i=n?e.lastIndexOf(" "):-1,s=r(E,{region:t,at:"name",children:i===-1?e:o(m,{children:[e.slice(0,i)," ",o("em",{className:"font-normal italic text-accent",children:[e.slice(i+1),"."]})]})});return r(x,{region:t,sectionType:"ProductName",children:r(d,{as:"div",className:"w-full [container-type:inline-size]",children:r(a,{...S(t,"name"),className:y(t)?N:A,style:w(u(e,n),v(t)),children:s})})})}export{R as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HeroGalleryMode, HeroGalleryShow, HeroImageFit, HeroPhotoGround } from "../../lib/sections/hero-gallery.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type SpinSets } from "../../lib/sections/spin-sets.js";
|
|
3
3
|
interface GalleryLook {
|
|
4
4
|
galleryMode?: HeroGalleryMode;
|
|
5
5
|
imageFit?: HeroImageFit;
|
|
@@ -8,6 +8,7 @@ interface GalleryLook {
|
|
|
8
8
|
show?: HeroGalleryShow;
|
|
9
9
|
marks?: boolean;
|
|
10
10
|
gap?: number;
|
|
11
|
+
closeUpsFill?: boolean;
|
|
11
12
|
autoTurn?: boolean;
|
|
12
13
|
turnHint?: boolean;
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,Fragment as
|
|
1
|
+
"use client";import{jsx as o,Fragment as p,jsxs as d}from"react/jsx-runtime";import{useEffect as g}from"react";import h from"../ProductGallery.js";import{SpinChoices as x}from"../product-hero/SpinLayer.js";import S from"../ProductLightbox.js";import{SECTION_NOTICE_TEXT_CLASS as L}from"../SectionNotice.js";import{heroView as y}from"../product-hero/hero-view.js";import{useRootIsDark as P}from"efficient-shell/theme";import{useLightbox as b}from"../useLightbox.js";import{useProductSelection as C}from"../useProductSelection.js";import{useHeroStateOrNull as I,useNearestProduct as N}from"../card-pieces/ProductCardState.js";import{spinPreference as _}from"../../lib/sections/spin-sets.js";import{say as G}from"efficient-web-builder/format/lib/editor-words";import{useSampleProduct as O}from"./useSampleProduct.js";import{HideTaker as T}from"efficient-web-builder/render/components/ViewHideRoot";function j({editing:e=!1,...r}){const t=N();return t?o(u,{product:t.product,selection:t.selection,onLightbox:t.openLightbox,editing:e,...r}):e?o(w,{...r}):null}function u({product:e,selection:r,onLightbox:t,editing:i,autoTurn:l=!1,turnHint:a=!1,...s}){const c=!P({whenUnset:!0}),m=I()?.startChosen===!0,n=_(s.spin,e.slug),{chooseStart:f}=r;return g(()=>{m&&n&&f(n)},[m,e.slug,JSON.stringify(n)]),o(x.Provider,{value:{autoTurn:l,turnHint:a},children:o(h,{product:e,view:y(e,r,i),angleIdx:r.angleIdx,onSelect:r.setAngleIdx,isLight:c,onLightbox:t,...s,takesViewHide:!0})})}function w(e){const r=O(!0);return r?o(E,{product:r,...e}):o(T,{as:"p",className:L,children:G("Loading sample product…")})}function E({product:e,...r}){const t=C(e,{editing:!0}),i=b();return d(p,{children:[o(u,{product:e,selection:t,onLightbox:i.open,editing:!0,...r}),o(S,{item:i.item,onClose:i.close})]})}export{j as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as x,Fragment as ie,jsxs as M}from"react/jsx-runtime";import{createContext as Me,useCallback as ae,useContext as Le,useEffect as w,useRef as y,useState as h}from"react";import{VIEW_TABLET_MIN as De}from"efficient-easel/screen/lib/content/view-tiers";import{cssStringBody as Ne}from"efficient-web-builder/format/lib/document/style-text";import{HALF_SIZES as j,sizedImage as He}from"efficient-web-builder/format/lib/sized-image";import{prefersReducedMotion as X}from"efficient-web-builder/render/components/useReducedMotion";import{DEFAULT_SPIN_AUTO_TURN as Re,DEFAULT_SPIN_HINT as $e,SPIN_HINT_HIDE_MS as Ce,SPIN_HINT_SHOW_MS as ce,SPIN_RESUME_MS as Oe,isFullTurn as le,spinAutoTurnStep as We,spinBlend as Ue,spinClampPosition as je,spinFrameIndex as L,spinPositionAfterDrag as ue,spinCell as z,spinStartPosition as B}from"../../lib/sections/spin-sets.js";const Xe=.3,ze=.85,de=24,fe=4,me=1e3,he=77/72,pe=`${(1-he)/2*100}%`,we=`${he*100}%`,q={left:pe,top:pe,width:we,height:we},Be=`(max-width: ${De-.02}px)`,K=new Map,ge=new Map;function G(t,v){let p=K.get(t);return p||(p=new Promise(P=>{const a=new Image,b=()=>{K.delete(t),ge.delete(t),P(null)},d=()=>P({w:a.naturalWidth,h:a.naturalHeight});a.onload=()=>{if(typeof a.decode!="function")return d();a.decode().then(d,b)},a.onerror=b,v&&(a.sizes=j,a.srcset=v),a.src=t,ge.set(t,a)}),K.set(t,p)),p}const qe=Me({autoTurn:Re,turnHint:$e});let D=!1;const Ke="M3 4.5c3.2 3.6 18.8 3.6 22 0M5.6 2.6 3 4.5l3 1.2M22.4 2.6 25 4.5l-3 1.2",N=t=>He(t,{fallbackWidth:me,maxWidth:me}),ye=(t,v)=>!!t.frames&&v===t.frames[0],ve=t=>({...q,backgroundImage:`url("${Ne(t.url)}")`,backgroundSize:`${t.cols*100}% ${t.rows*100}%`,backgroundPosition:`${t.cols>1?t.col*100/(t.cols-1):0}% ${t.rows>1?t.row*100/(t.rows-1):0}%`});function Ge({set:t,name:v}){const[p,P]=h(()=>B(t)),a=y(null),b=y(0),d=y(p),F=y(null),S=y(null),{autoTurn:f,turnHint:H}=Le(qe),[be,R]=h(!1),[Se,Z]=h(!1),[$,Q]=h(0),V=y(0),[Ee,Y]=h(!1),[_e,ke]=h(!0),[J,xe]=h(null),i=t.count,[C,ee]=h(null),O=y(null),[E,te]=h(null),g=le(t),_=L(p,i,g),A=ae(e=>{const n=je(e,i,g);return d.current=n,P(n),n},[i,g]),T=ae(()=>cancelAnimationFrame(b.current),[]);w(()=>{const e=window.matchMedia?.(Be);if(!e)return te(!1);const n=()=>te(e.matches);return n(),e.addEventListener?.("change",n),()=>e.removeEventListener?.("change",n)},[]),w(()=>{if(!t.sheets||!t.startFrame||E===null)return;const e=E?t.sheets.phone:t.sheets.desktop,n=`${t.startFrame} ${e.urls[0]}`;if(S.current===n)return;S.current=n,ee({key:n,sheet:e,ready:new Set});const r=Math.floor(B(t)/(e.cols*e.rows)),u=e.urls.map((l,o)=>e.urls[(r+o)%e.urls.length]),c=N(t.startFrame);G(c.src,c.srcSet).then(()=>{for(const l of u)G(l).then(o=>{!o||o.w!==e.cols*e.frame||o.h!==e.rows*e.frame||S.current===n&&ee(m=>m?.key===n?{...m,ready:new Set(m.ready).add(l)}:m)})})},[t,E]),w(()=>{if(!t.frames)return;const e=t.frames,n=e[0];if(S.current===n)return;S.current=n;const r=L(B(t),i,le(t)),u=[];for(let l=0;l<fe;l+=1)for(let o=l;o<i;o+=fe)u.push((r+o)%i);const c=l=>{const o=N(e[l]);return G(o.src,o.srcSet)};c(u[0]).then(()=>Promise.all(u.slice(1).map(c))).then(l=>{S.current===n&&l.every(Boolean)&&xe(n)})},[i,t]),w(()=>T,[T]),w(()=>{if(!H||D)return;const e=window.setTimeout(()=>R(!D),ce),n=window.setTimeout(()=>{D=!0,R(!1)},ce+Ce);return()=>{window.clearTimeout(e),window.clearTimeout(n)}},[H]),w(()=>{const e=a.current;if(!f||!e)return;if(typeof IntersectionObserver>"u")return Y(!0);const n=new IntersectionObserver(r=>Y(r.some(u=>u.isIntersecting)));return n.observe(e),()=>n.disconnect()},[f]),w(()=>{if(!f)return;const e=()=>ke(document.visibilityState!=="hidden");return e(),document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[f]);const Pe=e=>{T(),f&&Z(!0),H&&(D=!0,R(!1)),e.currentTarget.setPointerCapture?.(e.pointerId),F.current={x0:e.clientX,f0:d.current,last:e.clientX,speed:0}},Ae=e=>{const n=F.current,r=a.current;!n||!r||(n.speed=e.clientX-n.last,n.last=e.clientX,A(ue(n.f0,e.clientX-n.x0,r.clientWidth,i)))},ne=()=>{const e=F.current;F.current=null,f&&e&&(Z(!1),Q(c=>c+1));const n=a.current;if(!e||!n||X())return;let r=Math.max(-de,Math.min(de,e.speed));const u=()=>{if(Math.abs(r)<Xe)return;const c=ue(d.current,r,n.clientWidth,i);A(c)===c&&(r*=ze,b.current=requestAnimationFrame(u))};b.current=requestAnimationFrame(u)},Ie=e=>{const n=e.key==="ArrowRight"||e.key==="ArrowUp"?1:e.key==="ArrowLeft"||e.key==="ArrowDown"?-1:0;if(e.key==="Home")A(0);else if(e.key==="End")A(i-1);else if(n)A(Math.round(d.current)+n);else return;T(),f&&Q(r=>r+1),e.preventDefault()},s=t.sheets&&C&&C.key.startsWith(`${t.startFrame} `)?C:null;s&&s.ready.has(z(s.sheet,_).url)&&(O.current={key:s.key,frame:_});const W=s&&O.current?.key===s.key?O.current.frame:null,I=s&&W!==null?{...z(s.sheet,W),cols:s.sheet.cols,rows:s.sheet.rows}:null,k=Ue(p,i,g,X()),U=s&&k.b!==null&&W===_?z(s.sheet,k.b):null,re=I&&U&&s.ready.has(U.url)?{...U,cols:I.cols,rows:I.rows}:null,oe=!s&&t.frames&&k.b!==null&&ye(t,J)?t.frames[k.b]:null,Fe=t.frames?ye(t,J):!!s&&s.ready.size===s.sheet.urls.length,se=f&&Fe&&Ee&&_e&&!Se;return w(()=>{if(!se)return;const e=V.current!==$;let n=-1,r=-1,u=1,c=0;const l=o=>{if(c=requestAnimationFrame(l),n<0&&(n=o),e&&o-n<Oe)return;if(V.current=$,r<0){r=o;return}const m=We(t,d.current,u,o-r);r=o,u=m.way;const Te=L(d.current,i,g);d.current=m.position,(!X()||L(m.position,i,g)!==Te)&&P(m.position)};return c=requestAnimationFrame(l),()=>cancelAnimationFrame(c)},[se,$,t,i,g]),M("div",{ref:a,"data-spin-well":!0,role:"slider",tabIndex:0,"aria-label":`${v}, 360° view: drag or use the arrow keys to turn`,"aria-valuemin":1,"aria-valuemax":i,"aria-valuenow":_+1,"aria-valuetext":`Angle ${_+1} of ${i}`,"data-spin-auto-turn":f?"":void 0,onKeyDown:Ie,className:"absolute inset-0 select-none overflow-hidden cursor-grab active:cursor-grabbing focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-fg",style:{touchAction:"pan-y"},onPointerDown:Pe,onPointerMove:Ae,onPointerUp:ne,onPointerCancel:ne,onTouchStart:e=>e.stopPropagation(),onTouchMove:e=>e.stopPropagation(),onTouchEnd:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),children:[I?M(ie,{children:[x("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:ve(I)}),re?x("div",{"data-spin-frame":!0,className:"pointer-events-none absolute",style:{...ve(re),opacity:k.mix}}):null]}):M(ie,{children:[x("img",{...N(t.frames?t.frames[_]:t.startFrame??""),sizes:j,alt:"",draggable:!1,fetchPriority:"high","data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:q}),oe?x("img",{...N(oe),sizes:j,alt:"",draggable:!1,"data-spin-frame":!0,className:"pointer-events-none absolute max-w-none object-contain",style:{...q,opacity:k.mix}}):null]}),be?M("span",{"data-spin-hint":!0,className:`pointer-events-none absolute inset-x-0 flex flex-col items-center gap-1 text-xs text-fg ${E?"bottom-3":"bottom-5"}`,children:[E?null:x("svg",{viewBox:"0 0 28 12",width:"28",height:"12","aria-hidden":"true",children:x("path",{d:Ke,fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})}),E?"Swipe to turn":"Drag to turn"]}):null]})}export{qe as SpinChoices,Ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n,Fragment as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as b}from"react/jsx-runtime";import o from"next/link";import{Notice as s}from"../Notice.js";import w from"./VehicleQuestion.js";import{useHeroOptionLooks as x}from"./OptionLooks.js";import{resolvingRowsAnswered as k}from"../../lib/catalog/product-options.js";import{fitRefusal as h,pdpFitVerdict as N}from"../../lib/wheels/pdp-fit-verdict.js";import{variantIsDually as y}from"../../lib/wheels/set-mode.js";function v({selection:r,spec:a,vehicle:t,wheel:l}){const{manualMode:c,setManualMode:d}=r,{specsLink:m}=x(),u=k(r.rows,r.preOrder),f=t.appliedName!=="",p=(l?.variants??[]).some(y),i=N({wheel:l,applied:f,fit:t.fit,resolving:t.resolving});return e(w,{vehicle:t,escape:m?e("button",{type:"button",className:"cursor-pointer text-right text-accent hover:underline",onClick:()=>d(g=>!g),children:c?"← Find by vehicle":"Select by specs instead →"}):null,override:c?n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"You are choosing by the numbers."}),n("span",{className:"mt-2 block",children:[a?`${p?"The set is":"All four wheels are"} ${a}. We have not checked that against any car — make sure it matches yours.`:u?"Answer the bolt pattern and the offset below. We will not check them against a car.":"Pick a finish and a size below. The bolt pattern and the offset come next, and we will not check them against a car."," ",e(o,{href:"/fitment",className:"text-accent hover:underline",children:"Talk to an engineer →"})]})]}):null,verdict:e(F,{verdict:i,car:t.appliedName}),showChangeCar:i.state!=="fits"&&i.state!=="checking",cascadeErrorNote:n(b,{children:["Vehicle data is unavailable right now. Pick your wheel by its specs instead, or"," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"ask us to check it →"})]})})}function F({verdict:r,car:a}){switch(r.state){case"checking":return n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:"Checking fitment…"})," ",n("span",{children:["Reading the factory wheel specs for your ",a,"."]})]});case"fits":return n(s,{tone:"good",children:[n("strong",{className:"font-semibold text-accent",children:["✓ Fits your ",a]}),e("ul",{className:"mt-2 flex flex-wrap gap-2",children:r.checks.map(t=>e("li",{className:["px-2 py-1 font-mono text-[11px] uppercase tracking-[0.14em] text-fg-dim",t.value!==null?"border border-line":"border border-dashed border-line"].join(" "),children:t.value??`${t.name} not published, not checked`},t.key))})]});case"fits-with-warning":return n(s,{tone:"good",children:[n("strong",{className:"font-semibold text-accent",children:["✓ Fits your ",a]}),e("ul",{className:"mt-2 flex flex-wrap gap-2",children:r.checks.map(t=>e("li",{className:["px-2 py-1 font-mono text-[11px] uppercase tracking-[0.14em] text-fg-dim",t.value!==null?"border border-line":"border border-dashed border-line"].join(" "),children:t.value??`${t.name} not published, not checked`},t.key))}),n("span",{className:"mt-2 block border-l-2 border-alert pl-3",children:[e("strong",{className:"font-semibold text-fg",children:"Check the offset. "}),h(r.warning)," An offset this far out is what an aftermarket wheel is for, but it changes how far the wheel sits from the guard."," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"Ask us if you are unsure →"})]})]});case"no-fit":return n(s,{tone:"bad",children:[n("strong",{className:"font-semibold",style:{color:"var(--alert)"},children:["✗ Does not fit your ",a]}),e("span",{className:"mt-2 block",children:h(r.failure)})]});case"unknown":return n(s,{tone:"quiet",children:[e("strong",{className:"font-semibold text-fg",children:r.missing==="vehicle"?`We cannot check this wheel against your ${a}`:"We cannot check this wheel"}),n("span",{className:"mt-2 block",children:[r.missing==="vehicle"?`We have no factory wheel data for the ${a}, and we will not guess at a fit.`:"We do not hold a bolt pattern for this wheel, and we will not guess at a fit."," ",e(o,{href:"/contact",className:"text-accent hover:underline",children:"Ask us before you order →"})]})]});default:return null}}export{v as default};
|