efficient-storefront-blocks 0.115.0 → 0.117.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +9 -10
- package/dist/chunks/EditorPreviewCheckout-JKTRIRSH.js +4 -0
- package/dist/chunks/{SiteEditorProvider-RH2SMNYG.js → SiteEditorProvider-ZVNXSXBQ.js} +1 -1
- package/dist/chunks/{chunk-P3DTJ3CI.js → chunk-3XS3LIPN.js} +1 -1
- package/dist/chunks/chunk-JVAY6GGN.js +1 -0
- package/dist/chunks/chunk-NMYHWA3M.js +96 -0
- package/dist/chunks/chunk-XVPVTQYY.js +342 -0
- package/dist/chunks/chunk-XZPK5PGX.js +1 -0
- package/dist/chunks/{fitment-data-RALB36SU.js → fitment-data-3N56LEBE.js} +1 -1
- package/dist/contract.js +19 -3
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/components/MenuPicker.d.ts +3 -0
- package/dist/editor/components/MenuPicker.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/GalleryB/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/Form/fields.js +1 -1
- package/dist/editor/lib/document/config.d.ts +1 -0
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +3 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +104 -33
- package/dist/links.js +1 -1
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/ChatContext.d.ts +1 -1
- package/dist/render/components/ChatContext.js +1 -1
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/DeliveryOptionsSource.js +1 -1
- package/dist/render/components/FormBlock.d.ts +10 -2
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/GalleryCard.d.ts +1 -0
- package/dist/render/components/GalleryCard.js +1 -1
- package/dist/render/components/GalleryGrid.d.ts +3 -1
- package/dist/render/components/GalleryGrid.js +3 -3
- package/dist/render/components/GalleryItem.d.ts +3 -0
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/HeaderNavItem.js +1 -1
- package/dist/render/components/cart/drawer-parts.js +1 -1
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +3 -1
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/fitment/FitmentFinder.js +1 -1
- package/dist/render/components/fitment/FitmentPickerGrid.js +1 -1
- package/dist/render/components/fitment/PickerField.d.ts +2 -1
- package/dist/render/components/fitment/PickerField.js +1 -1
- package/dist/render/components/fitment/useFitmentCascade.d.ts +8 -0
- package/dist/render/components/fitment/useFitmentCascade.js +1 -1
- package/dist/render/components/fitment/useVehicleFit.js +1 -1
- package/dist/render/components/fitment/vehicle-level-state.d.ts +1 -0
- package/dist/render/components/fitment/vehicle-level-state.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +3 -0
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
- package/dist/render/lib/api/types.d.ts +1 -0
- package/dist/render/lib/checkout/checkout-memory.d.ts +14 -6
- package/dist/render/lib/checkout/checkout-memory.js +1 -1
- package/dist/render/lib/checkout/wallet-return.d.ts +13 -2
- package/dist/render/lib/checkout/wallet-return.js +1 -1
- package/dist/render/lib/document/blocks/commerce/GalleryB/meta.d.ts +4 -0
- package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
- package/dist/render/lib/document/blocks/service/Form/render.js +1 -1
- package/dist/render/lib/document/card-templates.d.ts +2 -0
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/render-config.d.ts +1 -0
- package/dist/render/lib/document/render-config.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-gallery.d.ts +1 -0
- package/dist/render/lib/document/section-to-box-rows-gallery.js +1 -0
- package/dist/render/lib/sections/gallery-frame.d.ts +3 -0
- package/dist/render/lib/sections/gallery-frame.js +1 -0
- package/dist/render/lib/wheels/price-display.d.ts +0 -1
- package/dist/render/lib/wheels/price-display.js +1 -1
- package/dist/words.d.ts +12 -0
- package/dist/words.js +4 -4
- package/package.json +5 -4
- package/dist/chunks/EditorPreviewCheckout-KJ7WBAJJ.js +0 -4
- package/dist/chunks/chunk-25XGYFU3.js +0 -80
- package/dist/chunks/chunk-H7576DO5.js +0 -1
- package/dist/chunks/chunk-ISCYSRBG.js +0 -1
- package/dist/chunks/chunk-WWVWTSGF.js +0 -340
- /package/dist/chunks/{chunk-WWVWTSGF.js.LEGAL.txt → chunk-XVPVTQYY.js.LEGAL.txt} +0 -0
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ie=["main","text","background","muted"],en=[...ie,"surface"];var nn={bold:g.bold.placeholder,italic:g.italic.placeholder,strike:g.strike.placeholder,code:g.code.placeholder,highlight:g.highlight.placeholder,quiet:g.quiet.placeholder,link:"link text",underline:g.underline.placeholder,sup:g.sup.placeholder,sub:g.sub.placeholder,color:"colored text",style:"styled text"};var se=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var T=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],le=["highlight","quiet"],tn=se.map(e=>e.style).filter(e=>T.some(n=>n.kind===e)).filter(e=>!le.includes(e)),rn=[...T,{open:"*",close:"*",kind:"accent"}],on=[...T,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var sn=["http","https","mailto","tel"];function D(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let n=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!n||sn.includes(n[1].toLowerCase())}var ae=["width","profile","rim"];var ln=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,an={width:[100,500],profile:[20,100],rim:[10,30]};function U(e){let n=ln.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return ae.every(o=>{let[i,a]=an[o];return t[o]>=i&&t[o]<=a})?t:null}function _(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let n=`${e.width}/${e.profile}`;return e.rim==null?n:`${n} R${e.rim}`}function ue(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var k=["alloy-wheel","tyre"],ce=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var ht=k.map(e=>({value:e,label:F[e]}));function pe(e){return e==null?[...ce]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ce]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function $(e){return m(e).brand??""}function de(e){return m(e).prices??void 0}function fe(e){return m(e).inStock!==!1}function me(e){let n=m(e),t=f(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function B(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function he(e){return B(e).map(n=>n.family)}function ge(e){if(f(e)==="tyre")return[];let n=m(e);return Array.isArray(n.categories)?n.categories:n.process?[n.process]:[]}function ye(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function Pe(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function be(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function Se(e){if(f(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>U(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var W=e=>typeof e=="string"&&e?e:void 0;function H(e,n){return Object.hasOwn(e,n)?e[n]:void 0}function ke(e,n){return Object.hasOwn(e,n)}var xe=null;function Le(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>ke(n,r)?String(H(n,r)):t):e}function y(e,n){let t=xe?H(xe,e):void 0;if(typeof t=="function"){try{let r=W(t(n??{}));if(r)return r}catch{}return Le(e,n)}return Le(W(t)??e,n)}function Y(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var w=(e,n,t,r)=>({default:e,min:n,max:t,step:r}),Lt=w(30,0,100,10),Tt=w(0,0,100,5),_t=w(100,0,100,5),Ft=w(2,0,4,.5);function Te(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var _e="homepage";var A=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function R(e){return e.offersCommerce&&e.offersService?A:A.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}var G="#popup:";function Fe(e){return`${G}${e}`}function we(e){return e.startsWith(G)&&e.slice(G.length).trim()||null}function P(e){return e===_e?"/":`/${e}`}function E(e){return`/journal/${e}`}function O(e){return`/wheels/${e}`}function I(e,n){return`${P(e)}#${n}`}function N(...e){let n=new Set,t=[];for(let r of e)for(let o of r?.content??[]){let i=Te(o?.props?.anchor);if(!i)continue;let a=Y(i);!a||n.has(a)||(n.add(a),t.push({slug:a,name:i}))}return t}function Ae(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var un=()=>({choosePage:y("Choose a page"),chooseSection:y("Choose a section"),noSections:y("No section anchors yet"),sectionHint:y("Jumps to a section on that page."),choosePost:y("Choose a post"),chooseProduct:y("Choose a product"),choosePopup:y("Choose a popup")});function C(e,n,t){if(!e)return"page";if(we(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ae(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||n.includes(r))return"anchor"}return e==="/"||n.includes(e)||t&&t.listingPaths.includes(t.targetOf(e))?"page":"custom"}function Re(e,n){let t=un(),r=e.pages.map(s=>({value:P(s.slug),label:s.title})),o=n?.pageOptions?n.pageOptions(r):r,i=o.map(s=>s.value),a=e.pages.map(s=>({label:s.title,options:N(...s.docs).map(u=>({value:I(s.slug,u.slug),label:u.name}))})).filter(s=>s.options.length>0),p=s=>{switch(s){case"page":return{type:"select",options:o,placeholder:t.choosePage};case"anchor":return{type:"groups",groups:a,placeholder:a.length?t.chooseSection:t.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:E(u.slug),label:u.title||u.slug})),placeholder:t.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:t.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Fe(u.slug),label:u.title||u.slug})),placeholder:t.choosePopup};case"custom":return{type:"text"}}},l=R(e.offers).map(s=>({value:s.value,label:y(s.label),target:p(s.value),...s.value==="anchor"?{hint:t.sectionHint}:{},...s.value==="blog"||s.value==="product"||s.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!n)return{kinds:l,rules:{kindOf:s=>C(s,i),targetOf:s=>s,readFilter:()=>null,withFilter:s=>s}};let c=s=>{let u=n.withFilter(s,null);return n.listingPaths.includes(u)?u:s};return{kinds:l,rules:{kindOf:s=>C(s,i,{listingPaths:n.listingPaths,targetOf:c}),targetOf:c,readFilter:n.readFilter,withFilter:n.withFilter},filtersFor:s=>n.listingPaths.includes(s)?n.filtersFor(s):null}}var Ee=Object.freeze([]);function V(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function Oe(e,n){let t=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let i=o[t];if(typeof i!="number"||!Number.isFinite(i))continue;let a=r.get(o.fieldKey);(a===void 0||i<a)&&r.set(o.fieldKey,i)}return o=>o?r.get(o):void 0}function Ie(e,n,t,r){let o=new Map;for(let l of t){let c=l[r];typeof c=="number"&&o.set(l.fieldKey,c)}if(o.size===0)return e;let i=[],a=[];e.forEach((l,c)=>{let s=n(l);s&&(i.push(c),a.push({item:l,index:c,order:o.get(s)}))}),a.sort((l,c)=>l.order!==void 0&&c.order!==void 0?l.order-c.order||l.index-c.index:l.order!==void 0?-1:c.order!==void 0?1:l.index-c.index);let p=[...e];return i.forEach((l,c)=>{p[l]=a[c].item}),p.every((l,c)=>l===e[c])?e:p}function Ne(e){return pn(e,"filter")}var cn="collection";function q(e,n){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":cn},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function pn(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}function dn(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ce(e,n){let t=e?.[n];return dn(t)?t:null}function ve(e,n,t,r){if(t==null&&r==null)return!0;let o=Ce(e,n);return!(o===null||t!=null&&o<t||r!=null&&o>r)}function Ke(e){let n=e.spec?.lugs;return typeof n=="number"?n:null}var fn={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},pr=Object.keys(fn);var j=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Z={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},mn={diameters:"tyreSizes"};function hn(e){if(e.length===0)return[];let n=j.filter(t=>e.every(r=>Z[t].includes(r)));return n.filter(t=>{let r=mn[t];return!r||!n.includes(r)})}function gn(e){let n=new Set;for(let t of e)n.add(f(t));return[...n]}var Me={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function yn(e,n,t,r=null,o="fail"){let i=f(e),a=p=>o==="fail"||(p==="lugs"?i==="alloy-wheel":Z[p].includes(i));if(r!=="kind"&&n.kind&&i!==n.kind)return!1;for(let p of j){if(r===p)continue;let l=n[p];if(l.length===0||!a(p))continue;let c=l.map(String);if(!ze(e,p).some(s=>c.includes(s)))return!1}if(r!=="lugs"&&n.lugs&&n.lugs.length>0&&a("lugs")){let p=Ke(e);if(p===null||!n.lugs.includes(p))return!1}return!(r!=="price"&&!ve(de(e),t,n.priceMin??null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!fe(e))}var Pn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function ze(e,n){switch(n){case"tyreSizes":return[...new Set(Se(e).flatMap(ue))];case"brands":return $(e)?[$(e)]:[];case"finishes":return he(e);case"diameters":return me(e).map(String);case"collections":return ge(e);case"pcds":return ye(e);case"tyreTypes":return Pe(e);case"speedRatings":return be(e)}}function bn(e){let n=new Map;for(let t of e)for(let r of B(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function De(e,n,t,r=gn(e),o=Ee,i="fail"){let a=u=>kn(u,r,o),p=bn(e),c=(i==="pass"?j.filter(u=>r.some(S=>Z[u].includes(S))):hn(r)).filter(u=>u!=="tyreSizes").filter(a).map(u=>{let S=n[u].map(String),oe=new Set,z=new Map,L=new Map;for(let d of e){let b=ze(d,u);for(let h of b)oe.add(h);for(let h of new Set(b))L.set(h,(L.get(h)??0)+1);if(yn(d,n,t,u,i))for(let h of new Set(b))z.set(h,(z.get(h)??0)+1)}let Je=[...oe].map(d=>({value:d,label:u==="diameters"?`${d}\u2033`:d,count:z.get(d)??0,checked:S.includes(d),swatch:u==="finishes"?p.get(d)??null:null})).sort((d,b)=>{if(u==="diameters")return Number(d.value)-Number(b.value);let h=(L.get(b.value)??0)-(L.get(d.value)??0);return h!==0?h:d.value.localeCompare(b.value)});return{key:u,label:Pn[u],options:Je}}).filter(u=>u.options.length>Sn),s=[];for(let u of c){let S=xn(u.key,r,o);S!==void 0&&s.push({fieldKey:u.key,filterOrder:S})}return[...Ie(c,u=>u.key,s,"filterOrder")]}var Sn=1;function Ue(e){return e.showCollection===!1?["collections"]:[]}function kn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>Ne(V(t,r))(q(e,r)))}function xn(e,n,t){if(t.length===0)return;let r;for(let o of n){let i=Oe(V(t,o),"filter")(q(e,o));i!==void 0&&(r===void 0||i<r)&&(r=i)}return r}var X={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},Q="type";var $e=e=>!!e&&typeof e=="object"&&!Array.isArray(e),v=e=>$e(e)&&typeof e.type=="string"&&$e(e.props);var J=e=>Array.isArray(e)&&e.length>0&&e.every(v);function Be(e,n){let t=null;for(let[r,o]of Object.entries(e.props??{})){if(!J(o))continue;let i=n(o,r);i!==o&&((t??={...e.props})[r]=i)}return t?{...e,props:t}:e}var We="FilterBlock";var He="AlloyWheelsListing";function Ln(e){let n=e??{},t=[];Array.isArray(n.content)&&t.push(n.content);for(let r of Object.values(n.zones??{}))Array.isArray(r)&&t.push(r);return t}function Tn(e){let n=[],t=(r,o)=>{let i=[r,...o];for(let a of r)v(a)&&(n.push({node:a,order:n.length,lists:i}),Be(a,p=>(t(p,i),p)))};for(let r of Ln(e))t(r,[]);return n}function Ye(e){return Tn(e).map(n=>n.node)}function Ge(e){return D(e.trim())}var x="/wheels",K="Products";function Ve(e,n){return n>1?`${K} \xB7 ${e}`:K}function ee(...e){for(let n of[He,We])for(let t of e){let r=Ye({content:t?.content}).find(o=>o.type===n);if(r)return r.props??{}}return null}function M(...e){return ee(...e)!==null}function qe(e,n){let t=e.filter(r=>M(...r.docs)).map(r=>P(r.slug));return n.fallback&&!t.includes(x)?[...t,x]:t}var ne=[Q,...Object.entries(X).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function je(e){let n=e.indexOf("#"),t=n===-1?"":e.slice(n),r=n===-1?e:e.slice(0,n),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:t}}function _n(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ze(e){let n=new URLSearchParams(je(e).query);for(let t of ne){let r=n.get(t);if(r)return{param:t,value:r}}return null}function te(e,n){let{path:t,query:r,hash:o}=je(e),i=r.split("&").filter(a=>a&&!ne.includes(_n(a.split("=")[0])));return n?.value&&i.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${i.length?`?${i.join("&")}`:""}${o}`}function Xe(e,n){let t=te(e,null);return n.includes(t)?t:e}function Fn(e,n,t=[]){return C(e,n,{listingPaths:t,targetOf:r=>Xe(r,t)})}function wn(e){return Array.isArray(e)?e.filter(n=>typeof n?.kind=="string"&&typeof n.field_key=="string").map(n=>({kind:n.kind,fieldKey:n.field_key,...typeof n.filter=="boolean"?{filter:n.filter}:{},filterOrder:n.filter_order??null})):[]}var Qe="Product type",An="AUD";function re(e,n){let t=n.listing??{},r=pe(t.kinds),o=e.filter(l=>r.includes(f(l))),i=Ue(t),a=De(o,Me,An,r,n.fieldUsage).filter(l=>!i.includes(l.key)).map(l=>({param:X[l.key],label:l.label,values:l.options.filter(c=>!c.value.includes(",")).map(c=>({value:c.value,label:c.label}))})).filter(l=>l.values.length>0),p=k.filter(l=>r.includes(l)&&o.some(c=>f(c)===l));return p.length>1&&a.unshift({param:Q,label:Qe,values:p.map(l=>({value:l,label:F[l]}))}),a}function Rn(e){return n=>{let t=qe(n,{fallback:e.offersCommerce}),r=n.filter(o=>M(...o.docs)).length;return{listingPaths:t,pageOptions:o=>{let i=o.map(a=>{let p=n.find(l=>P(l.slug)===a.value);return p&&M(...p.docs)?{...a,label:Ve(p.title,r)}:a});return r===0&&e.offersCommerce&&!i.some(a=>a.value===x)&&i.push({value:x,label:K}),i},filtersFor:o=>{if(!t.includes(o))return null;let i=n.find(a=>P(a.slug)===o);return re(e.catalogue,{listing:i?ee(...i.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ze,withFilter:te}}}function En(e){let n=Rn({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Re({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:O(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Ge},filtersFor:t.filtersFor??(()=>null)}}function vr(e,n){return re(e,n)}export{x as BUILT_IN_LISTING_PATH,A as LINK_KINDS,ne as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,Qe as PRODUCT_TYPE_FILTER_LABEL,I as anchorPath,wn as fieldUsageFromAdminRows,Fn as inferLinkKind,M as isProductListingPage,Ge as isSafeLink,R as linkKindsFor,En as linkPickerSetup,vr as listingFilterFields,ee as listingNode,Ve as listingPageLabel,Xe as listingTarget,N as pageAnchors,P as pagePath,E as postPath,qe as productListingPaths,Ze as readListingFilter,O as wheelPath,te as withListingFilter};
|
|
1
|
+
var y={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],pt=[...ue,"surface"];var ft={bold:y.bold.placeholder,italic:y.italic.placeholder,strike:y.strike.placeholder,code:y.code.placeholder,highlight:y.highlight.placeholder,quiet:y.quiet.placeholder,link:"link text",underline:y.underline.placeholder,sup:y.sup.placeholder,sub:y.sub.placeholder,color:"colored text",style:"styled text"};var pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var A=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],fe=["highlight","quiet"],dt=pe.map(e=>e.style).filter(e=>A.some(t=>t.kind===e)).filter(e=>!fe.includes(e)),mt=[...A,{open:"*",close:"*",kind:"accent"}],ht=[...A,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var yt=["http","https","mailto","tel"];function j(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||yt.includes(t[1].toLowerCase())}var de=["width","profile","rim"];var gt=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,bt={width:[100,500],profile:[20,100],rim:[10,30]};function W(e){let t=gt.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return de.every(o=>{let[s,i]=bt[o];return n[o]>=s&&n[o]<=i})?n:null}function _(e){if(e.width==null)return"";if(e.profile==null)return String(e.width);let t=`${e.width}/${e.profile}`;return e.rim==null?t:`${t} R${e.rim}`}function me(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var x=["alloy-wheel","tyre"],he=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Cn=x.map(e=>({value:e,label:F[e]}));function ye(e){return e==null?[...he]:Array.isArray(e)?x.filter(t=>e.includes(t)):[...he]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function H(e){return m(e).brand??""}function ge(e){return m(e).prices??void 0}function be(e){return m(e).inStock!==!1}function Pe(e){let t=m(e),n=d(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function Y(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function Se(e){return Y(e).map(t=>t.family)}function ke(e){if(d(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function xe(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function we(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function Le(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function Te(e){if(d(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>W(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var G=e=>typeof e=="string"&&e?e:void 0;function V(e,t){return Object.hasOwn(e,t)?e[t]:void 0}function Oe(e,t){return Object.hasOwn(e,t)}var Ae=null;function _e(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Oe(t,r)?String(V(t,r)):n):e}function g(e,t){let n=Ae?V(Ae,e):void 0;if(typeof n=="function"){try{let r=G(n(t??{}));if(r)return r}catch{}return _e(e,t)}return _e(G(n)??e,t)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var E=(e,t,n,r)=>({default:e,min:t,max:n,step:r}),jn=E(30,0,100,10),Wn=E(0,0,100,5),Hn=E(100,0,100,5),Yn=E(2,0,4,.5);function Fe(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Ee="homepage";var R=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function I(e){return e.offersCommerce&&e.offersService?R:R.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var Z="#popup:";function Re(e){return`${Z}${e}`}function Ie(e){return e.startsWith(Z)&&e.slice(Z.length).trim()||null}function b(e){return e===Ee?"/":`/${e}`}function N(e){return`/journal/${e}`}function v(e){return`/wheels/${e}`}function C(e,t){return`${b(e)}#${t}`}function M(...e){let t=new Set,n=[];for(let r of e)for(let o of r?.content??[]){let s=Fe(o?.props?.anchor);if(!s)continue;let i=q(s);!i||t.has(i)||(t.add(i),n.push({slug:i,name:s}))}return n}function Ne(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var Pt=()=>({choosePage:g("Choose a page"),chooseSection:g("Choose a section"),noSections:g("No section anchors yet"),sectionHint:g("Jumps to a section on that page."),choosePost:g("Choose a post"),chooseProduct:g("Choose a product"),choosePopup:g("Choose a popup")});function K(e,t,n){if(!e)return"page";if(Ie(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ne(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function ve(e,t){let n=Pt(),r=e.pages.map(c=>({value:b(c.slug),label:c.title})),o=t?.pageOptions?t.pageOptions(r):r,s=o.map(c=>c.value),i=e.pages.map(c=>({label:c.title,options:M(...c.docs).map(u=>({value:C(c.slug,u.slug),label:u.name}))})).filter(c=>c.options.length>0),l=c=>{switch(c){case"page":return{type:"select",options:o,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:i,placeholder:i.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(u=>({value:N(u.slug),label:u.title||u.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(u=>({value:u.href,label:u.name||u.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(u=>({value:Re(u.slug),label:u.title||u.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},a=I(e.offers).map(c=>({value:c.value,label:g(c.label),target:l(c.value),...c.value==="anchor"?{hint:n.sectionHint}:{},...c.value==="blog"||c.value==="product"||c.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:a,rules:{kindOf:c=>K(c,s),targetOf:c=>c,readFilter:()=>null,withFilter:c=>c}};let p=c=>{let u=t.withFilter(c,null);return t.listingPaths.includes(u)?u:c};return{kinds:a,rules:{kindOf:c=>K(c,s,{listingPaths:t.listingPaths,targetOf:p}),targetOf:p,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:c=>t.listingPaths.includes(c)?t.filtersFor(c):null}}var Ce=Object.freeze([]);function X(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function Me(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let o of e){let s=o[n];if(typeof s!="number"||!Number.isFinite(s))continue;let i=r.get(o.fieldKey);(i===void 0||s<i)&&r.set(o.fieldKey,s)}return o=>o?r.get(o):void 0}function Ke(e,t,n,r){let o=new Map;for(let a of n){let p=a[r];typeof p=="number"&&o.set(a.fieldKey,p)}if(o.size===0)return e;let s=[],i=[];e.forEach((a,p)=>{let c=t(a);c&&(s.push(p),i.push({item:a,index:p,order:o.get(c)}))}),i.sort((a,p)=>a.order!==void 0&&p.order!==void 0?a.order-p.order||a.index-p.index:a.order!==void 0?-1:p.order!==void 0?1:a.index-p.index);let l=[...e];return s.forEach((a,p)=>{l[a]=i[p].item}),l.every((a,p)=>a===e[p])?e:l}function ze(e){return kt(e,"filter")}var St="collection";function Q(e,t){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":St},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function kt(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function xt(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function $e(e,t){let n=e?.[t];return xt(n)?n:null}function De(e,t,n,r){if(n==null&&r==null)return!0;let o=$e(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}function Ue(e){let t=e.spec?.lugs;return typeof t=="number"?t:null}var wt={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Rr=Object.keys(wt);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Lt={diameters:"tyreSizes"};function Tt(e){if(e.length===0)return[];let t=J.filter(n=>e.every(r=>ee[n].includes(r)));return t.filter(n=>{let r=Lt[n];return!r||!t.includes(r)})}function Ot(e){let t=new Set;for(let n of e)t.add(d(n));return[...t]}var Be={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function At(e,t,n,r=null,o="fail"){let s=d(e),i=l=>o==="fail"||(l==="lugs"?s==="alloy-wheel":ee[l].includes(s));if(r!=="kind"&&t.kind&&s!==t.kind)return!1;for(let l of J){if(r===l)continue;let a=t[l];if(a.length===0||!i(l))continue;let p=a.map(String);if(!je(e,l).some(c=>p.includes(c)))return!1}if(r!=="lugs"&&t.lugs&&t.lugs.length>0&&i("lugs")){let l=Ue(e);if(l===null||!t.lugs.includes(l))return!1}return!(r!=="price"&&!De(ge(e),n,t.priceMin??null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!be(e))}var _t={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function je(e,t){switch(t){case"tyreSizes":return[...new Set(Te(e).flatMap(me))];case"brands":return H(e)?[H(e)]:[];case"finishes":return Se(e);case"diameters":return Pe(e).map(String);case"collections":return ke(e);case"pcds":return xe(e);case"tyreTypes":return we(e);case"speedRatings":return Le(e)}}function Ft(e){let t=new Map;for(let n of e)for(let r of Y(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function We(e,t,n,r=Ot(e),o=Ce,s="fail"){let i=u=>Rt(u,r,o),l=Ft(e),p=(s==="pass"?J.filter(u=>r.some(S=>ee[u].includes(S))):Tt(r)).filter(u=>u!=="tyreSizes").filter(i).map(u=>{let S=t[u].map(String),ce=new Set,B=new Map,O=new Map;for(let f of e){let P=je(f,u);for(let h of P)ce.add(h);for(let h of new Set(P))O.set(h,(O.get(h)??0)+1);if(At(f,t,n,u,s))for(let h of new Set(P))B.set(h,(B.get(h)??0)+1)}let ut=[...ce].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:B.get(f)??0,checked:S.includes(f),swatch:u==="finishes"?l.get(f)??null:null})).sort((f,P)=>{if(u==="diameters")return Number(f.value)-Number(P.value);let h=(O.get(P.value)??0)-(O.get(f.value)??0);return h!==0?h:f.value.localeCompare(P.value)});return{key:u,label:_t[u],options:ut}}).filter(u=>u.options.length>Et),c=[];for(let u of p){let S=It(u.key,r,o);S!==void 0&&c.push({fieldKey:u.key,filterOrder:S})}return[...Ke(p,u=>u.key,c,"filterOrder")]}var Et=1;function He(e){return e.showCollection===!1?["collections"]:[]}function Rt(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>ze(X(n,r))(Q(e,r)))}function It(e,t,n){if(n.length===0)return;let r;for(let o of t){let s=Me(X(n,o),"filter")(Q(e,o));s!==void 0&&(r===void 0||s<r)&&(r=s)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},ne="type";var w=e=>!!e&&typeof e=="object"&&!Array.isArray(e),L=e=>w(e)&&typeof e.type=="string"&&w(e.props);var z=e=>Array.isArray(e)&&e.length>0&&e.every(L);function Nt(e){let t="";for(let n of e)t+=typeof n=="number"?`[${n}]`:t===""?n:`.${n}`;return t}function Ye(e,t){return t==="root"?e.root:e.components[t]}function Ge(e){return e?.fields??{}}function Ve(e,t){return Ge(Ye(e,t))}function qe(e,t){let n=[];return re(e,t,[],n),n}function re(e,t,n,r){for(let o of Object.keys(t)){let s=t[o];if(!s)continue;let i=[...n,o],l=e[o];if(s.type==="slot"){let a=Array.isArray(l);r.push({slot:Nt(i),segments:i,content:a?l:[],present:a})}else if(s.type==="object"&&s.objectFields&&w(l))re(l,s.objectFields,i,r);else if(s.type==="array"&&s.arrayFields&&Array.isArray(l)){let a=s.arrayFields;l.forEach((p,c)=>{w(p)&&re(p,a,[...i,c],r)})}}}function oe(e,t,n){return Ct(e,t,n).map(({slot:r,content:o})=>({slot:r,content:o}))}function $(e){let t=new TextEncoder,n=new Map(e.map(r=>[r,t.encode(r)]));return[...e].sort((r,o)=>{let s=n.get(r),i=n.get(o);if(s.length!==i.length)return s.length-i.length;for(let l=0;l<s.length;l++)if(s[l]!==i[l])return s[l]-i[l];return 0})}function Ct(e,t,n){let r=qe(e.props,Ve(t,e.type));if(n?.order!=="stored")return r;let o=$(Object.keys(e.props)),s=i=>{let l=i.present?o.indexOf(String(i.segments[0])):-1;return l<0?Number.POSITIVE_INFINITY:l};return r.map((i,l)=>({loc:i,i:l,r:s(i)})).sort((i,l)=>i.r-l.r||i.i-l.i).map(({loc:i})=>i)}var Ze=["Text","ImageBlock","ButtonBlock","Flex"];function k(){return{type:"slot",allow:[...Ze]}}var Mt=Ze.filter(e=>e!=="ButtonBlock");function Xe(){return{type:"slot",allow:[...Mt]}}var Kt="boxes",Qe={CardList:{template:Xe()},Cards:{template:k()},FAQ:{template:k()},Flex:{rowTitle:{type:"slot",allow:["Text"]},content:{type:"slot"}},Footprint:{template:k()},Grid:{content:{type:"slot"}},Hero:{slides:{type:"slot",ownPictures:!0},strip:{type:"slot",allow:["Flex"]}},HeroGroup:{content:{type:"slot"}},HeroSingle:{boxes:{type:"slot",allow:["HeroGroup"]}},HeroSlide:{groups:{type:"slot",allow:["HeroGroup"]}},Logos:{logos:{type:"slot",allow:["LogoBlock"]},template:{type:"slot",allow:["LogoBlock"]}},OrderSummary:{template:k()},ProcessSteps:{[Kt]:{type:"slot"},template:k()}};var zt={},$t=null;function Dt(){let e=Object.fromEntries(Object.entries(Qe).map(([t,n])=>[t,{fields:n}]));return $t??={components:{...e,...zt}}}function Ut(e){let t=e.props??{},n=typeof e.type=="string"?e.type:"",r=Dt(),o=n!==""&&Object.prototype.hasOwnProperty.call(r.components,n)?oe({type:n,props:t},r).map(l=>l.slot).filter(l=>!l.includes(".")):[],s=o.filter(l=>z(t[l])),i=$(Object.keys(t).filter(l=>!o.includes(l)&&z(t[l])));return[...s,...i]}function Je(e,t){let n=null;for(let r of Ut(e)){let o=e.props[r],s=t(o,r);s!==o&&((n??={...e.props})[r]=s)}return n?{...e,props:n}:e}var et="FilterBlock";var tt="AlloyWheelsListing";function Bt(e){let t=e??{},n=[];Array.isArray(t.content)&&n.push(t.content);for(let r of Object.values(t.zones??{}))Array.isArray(r)&&n.push(r);return n}function jt(e){let t=[],n=(r,o)=>{let s=[r,...o];for(let i of r)L(i)&&(t.push({node:i,order:t.length,lists:s}),Je(i,l=>(n(l,s),l)))};for(let r of Bt(e))n(r,[]);return t}function nt(e){return jt(e).map(t=>t.node)}function rt(e){return j(e.trim())}var T="/wheels",D="Products";function ot(e,t){return t>1?`${D} \xB7 ${e}`:D}function se(...e){for(let t of[tt,et])for(let n of e){let r=nt({content:n?.content}).find(o=>o.type===t);if(r)return r.props??{}}return null}function U(...e){return se(...e)!==null}function st(e,t){let n=e.filter(r=>U(...r.docs)).map(r=>b(r.slug));return t.fallback&&!n.includes(T)?[...n,T]:n}var ie=[ne,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function it(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),o=r.indexOf("?");return{path:o===-1?r:r.slice(0,o),query:o===-1?"":r.slice(o+1),hash:n}}function Wt(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function lt(e){let t=new URLSearchParams(it(e).query);for(let n of ie){let r=t.get(n);if(r)return{param:n,value:r}}return null}function le(e,t){let{path:n,query:r,hash:o}=it(e),s=r.split("&").filter(i=>i&&!ie.includes(Wt(i.split("=")[0])));return t?.value&&s.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${s.length?`?${s.join("&")}`:""}${o}`}function at(e,t){let n=le(e,null);return t.includes(n)?n:e}function Ht(e,t,n=[]){return K(e,t,{listingPaths:n,targetOf:r=>at(r,n)})}function Yt(e){return Array.isArray(e)?e.filter(t=>typeof t?.kind=="string"&&typeof t.field_key=="string").map(t=>({kind:t.kind,fieldKey:t.field_key,...typeof t.filter=="boolean"?{filter:t.filter}:{},filterOrder:t.filter_order??null})):[]}var ct="Product type",Gt="AUD";function ae(e,t){let n=t.listing??{},r=ye(n.kinds),o=e.filter(a=>r.includes(d(a))),s=He(n),i=We(o,Be,Gt,r,t.fieldUsage).filter(a=>!s.includes(a.key)).map(a=>({param:te[a.key],label:a.label,values:a.options.filter(p=>!p.value.includes(",")).map(p=>({value:p.value,label:p.label}))})).filter(a=>a.values.length>0),l=x.filter(a=>r.includes(a)&&o.some(p=>d(p)===a));return l.length>1&&i.unshift({param:ne,label:ct,values:l.map(a=>({value:a,label:F[a]}))}),i}function Vt(e){return t=>{let n=st(t,{fallback:e.offersCommerce}),r=t.filter(o=>U(...o.docs)).length;return{listingPaths:n,pageOptions:o=>{let s=o.map(i=>{let l=t.find(a=>b(a.slug)===i.value);return l&&U(...l.docs)?{...i,label:ot(l.title,r)}:i});return r===0&&e.offersCommerce&&!s.some(i=>i.value===T)&&s.push({value:T,label:D}),s},filtersFor:o=>{if(!n.includes(o))return null;let s=t.find(i=>b(i.slug)===o);return ae(e.catalogue,{listing:s?se(...s.docs):null,fieldUsage:e.fieldUsage})},readFilter:lt,withFilter:le}}}function qt(e){let t=Vt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=ve({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:v(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:rt},filtersFor:n.filtersFor??(()=>null)}}function Qo(e,t){return ae(e,t)}export{T as BUILT_IN_LISTING_PATH,R as LINK_KINDS,ie as LISTING_FILTER_PARAMS,D as LISTING_PAGE_LABEL,ct as PRODUCT_TYPE_FILTER_LABEL,C as anchorPath,Yt as fieldUsageFromAdminRows,Ht as inferLinkKind,U as isProductListingPage,rt as isSafeLink,I as linkKindsFor,qt as linkPickerSetup,Qo as listingFilterFields,se as listingNode,ot as listingPageLabel,at as listingTarget,M as pageAnchors,b as pagePath,N as postPath,st as productListingPaths,lt as readListingFilter,v as wheelPath,le as withListingFilter};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as $}from"react/jsx-runtime";import{createContext as q,useCallback as f,useContext as z,useEffect as p,useMemo as B,useRef as x,useState as c}from"react";import{auth as D}from"../lib/auth.js";import{api as F}from"../lib/api/index.js";import{chatSocketUrl as G}from"../lib/chat-socket.js";import{safeLocalStorage as I}from"efficient-web-builder/format/lib/safe-storage";import{getChatThread as Q,postChatMessage as X,startChat as Z}from"../lib/api/chat.js";const ee="sf:aid",A="sf:chat",U=q(null);function te(){const u=I.getItem(A);if(!u)return null;try{return JSON.parse(u)}catch{return null}}function
|
|
1
|
+
"use client";import{jsx as $}from"react/jsx-runtime";import{createContext as q,useCallback as f,useContext as z,useEffect as p,useMemo as B,useRef as x,useState as c}from"react";import{auth as D}from"../lib/auth.js";import{api as F}from"../lib/api/index.js";import{chatSocketUrl as G}from"../lib/chat-socket.js";import{safeLocalStorage as I}from"efficient-web-builder/format/lib/safe-storage";import{getChatThread as Q,postChatMessage as X,startChat as Z}from"../lib/api/chat.js";const ee="sf:aid",A="sf:chat",U=q(null);function te(){const u=I.getItem(A);if(!u)return null;try{return JSON.parse(u)}catch{return null}}function le({children:u,preview:t=!1}){const[m,y]=c(!1),[e,O]=c(null),[b,g]=c([]),[E,T]=c(!1),[v,P]=c(null),[M,C]=c(0),[N,R]=c(!1),[J,H]=c(!1),S=x(m);S.current=m;const h=x(null),_=x(e);_.current=e,p(()=>{t||O(te())},[t]);const l=f(async r=>{try{const o=await Q(r.id,r.token);g(o.messages)}catch{}},[]),i=f(()=>(t||h.current||(h.current=F.restoreSession().then(()=>{R(!0),_.current&&l(_.current)},()=>R(!1))),h.current),[t,l]);p(()=>{t||e&&l(e)},[t,e,l]),p(()=>{if(t||!e)return;const r=D.getAccess()??e.token;let o=!1,s=null,n,a=3e3;const d=()=>{o||(s=new WebSocket(G(e.id,r)),s.onmessage=V=>{try{const k=JSON.parse(V.data);k.type==="chat_event"&&k.event==="message"&&(l(e),!S.current&&k.payload?.sender_role==="employee"&&C(W=>W+1))}catch{}},s.onclose=()=>{o||(n=setTimeout(d,a),a=Math.min(a*2,3e4))},s.onerror=()=>s?.close())};return d(),()=>{o=!0,n&&clearTimeout(n),s?.close()}},[t,e,l]);const K=f(()=>{y(!0),C(0),i()},[i]),Y=f(()=>y(!1),[]),j=f(()=>{S.current||i(),y(r=>(r||C(0),!r))},[i]),w=f(async(r,o)=>{const s=r.trim();if(!s)return!1;if(t)return g(n=>[...n,{id:`preview-${n.length}`,sender_role:"customer",sender_name:o?.name||"You",body:s,image_url:null,created_at:""}]),H(!0),!0;T(!0),P(null),await i();try{if(e){const n=await X(e.id,e.token,s);g(a=>[...a,n])}else{const n=I.getItem(ee)||"",a=await Z({body:s,guestName:o?.name,guestEmail:o?.email,guestKey:n}),d={id:a.id,token:a.guest_token};I.setItem(A,JSON.stringify(d)),O(d),g(a.messages)}return!0}catch{return P("Could not send your message. Please try again shortly."),!1}finally{T(!1)}},[e,t,i]),L=B(()=>({isOpen:m,open:K,close:Y,toggle:j,messages:b,sending:E,error:v,unread:M,hasConversation:t?J:!!e,isSignedIn:N,send:w}),[m,K,Y,j,b,E,v,M,e,N,w,t,J]);return $(U.Provider,{value:L,children:u})}function ie(){const u=z(U);if(!u)throw new Error("useChat must be used within <ChatProvider>");return u}export{le as ChatProvider,ie as useChat};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as W,useRef as z,useState as h}from"react";import{ROW_INPUT_CLASS as D}from"../lib/field-input.js";import{stripMarkup as U}from"efficient-web-builder/format/lib/markup";import{sizedImage as M}from"efficient-web-builder/format/lib/sized-image";import O,{chatLauncherOnLeft as R}from"./ChatLauncher.js";import{useChat as $}from"./ChatContext.js";import{scrollBehavior as F}from"efficient-web-builder/render/components/useReducedMotion";const G="Chat with us",H="We usually reply within a few minutes",K="Hi! Ask us anything — about a wheel, an order, or fitment. Leave your details and we’ll reply.";function Y({m:a}){if(a.sender_role==="system")return e("div",{className:"text-center text-[11px] text-fg/50 py-1",children:a.body});const r=a.sender_role==="bot",s=a.sender_role==="employee"||r;return e("div",{className:`flex ${s?"justify-start":"justify-end"}`,children:n("div",{className:`max-w-[80%] rounded-2xl px-3 py-2 text-sm ${s?"bg-fg/5 text-fg":"bg-accent text-accent-ink"}`,children:[s&&n("div",{className:"mb-0.5 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-fg/50",children:[r&&e("span",{"aria-hidden":"true",children:"✦"}),e("span",{children:r?a.sender_name||"Assistant":a.sender_name||"Support"}),r&&e("span",{className:"font-normal normal-case tracking-normal",children:"· automated"})]}),a.body&&e("p",{className:"whitespace-pre-wrap",children:a.body}),a.image_url&&e("a",{href:a.image_url,target:"_blank",rel:"noopener noreferrer",children:e("img",{...M(a.image_url,{fallbackWidth:640,maxWidth:1280}),sizes:"(max-width: 640px) 80vw, 320px",alt:"Attachment",className:"mt-2 max-h-48 w-auto rounded-lg"})})]})})}function P({title:a,subtitle:r,greeting:s,look:x}={}){const{isOpen:o,toggle:C,close:E,messages:d,sending:c,error:f,unread:g,hasConversation:L,isSignedIn:T,send:S}=$(),b=a?.trim()||G,j=r?.trim()||H,I=s?.trim()||K,[m,y]=h(""),[p,A]=h(""),[i,B]=h(""),v=z(null),l=!T&&!L;W(()=>{o&&v.current?.scrollIntoView({behavior:F(),block:"nearest"})},[d.length,o]);const N=/.+@.+/.test(i),w=m.trim().length>0&&(!l||p.trim()&&N),u=l&&i.trim().length>0&&!N,_=async()=>{if(!w||c)return;const t=m;await S(t,l?{name:p.trim(),email:i.trim()}:void 0)&&y(k=>k===t?"":k)};return o?n("aside",{role:"dialog","aria-label":"Chat with us","data-sf-floating":"",className:`fixed bottom-5 ${R(x)?"left-5":"right-5"} z-[61] flex h-[min(560px,80vh)] w-[min(380px,calc(100vw-2.5rem))] flex-col overflow-hidden rounded-2xl border border-line bg-bg shadow-[0_20px_60px_rgba(0,0,0,.45)]`,style:{color:"var(--fg)"},children:[n("div",{className:"flex items-center justify-between border-b border-line px-4 py-3",children:[n("div",{children:[e("div",{className:"text-sm font-semibold text-fg",children:b}),e("div",{className:"text-[11px] text-fg/50",children:j})]}),e("button",{type:"button",onClick:E,"aria-label":"Close chat",className:"rounded-md p-1 text-fg/60 hover:bg-fg/5",children:e("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n("div",{className:"flex-1 space-y-2 overflow-y-auto px-3 py-3",children:[d.length===0&&e("p",{className:"px-2 py-4 text-center text-sm text-fg/50",children:I}),d.map(t=>e(Y,{m:t},t.id)),e("div",{ref:v})]}),n("div",{className:"border-t border-line p-3",children:[l&&n("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[e("input",{value:p,onChange:t=>A(t.target.value),placeholder:"Your name","aria-label":"Your name",className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"}),e("input",{value:i,onChange:t=>B(t.target.value),type:"email",placeholder:"Email","aria-label":"Email","aria-invalid":u||void 0,"aria-describedby":u?"sf-chat-email-hint":void 0,className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"})]}),u&&e("p",{id:"sf-chat-email-hint",className:"mb-2 text-xs text-fg/60",children:"Enter your full email address to send."}),f&&e("p",{role:"alert",className:"mb-2 text-xs text-alert",children:f}),n("div",{className:"flex items-end gap-2",children:[e("textarea",{value:m,onChange:t=>y(t.target.value),onKeyDown:t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),_())},rows:1,placeholder:"Type a message…","aria-label":"Message",className:`${D} max-h-28 resize-none rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent`}),e("button",{type:"button",onClick:()=>{_()},disabled:!w||c,className:"rounded-lg bg-btn px-3 py-2 text-sm font-semibold text-btn-ink disabled:opacity-40",children:c?"…":"Send"})]})]})]}):e(O,{label:U(b),onOpen:C,zIndex:60,look:x,badge:g>0&&e("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-red-600 px-1 text-[11px] font-bold text-white",children:g})})}export{K as DEFAULT_GREETING,H as DEFAULT_SUBTITLE,G as DEFAULT_TITLE,P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as y}from"react/jsx-runtime";import{useEffect as h,useState as g}from"react";import{products as E}from"../lib/api/index.js";import{FREE_PRICE as R,FROM_PREFIX_START as b}from"../lib/wheels/price-display.js";import j from"./DeliveryOptions.js";import{useCurrency as M}from"./CurrencyContext.js";function S({eyebrow:s,title:c,body:u,highlightBadge:a,contained:d,omitHead:l=!1}){const{currency:n,formatMoney:f}=M(),[p,r]=g(null);h(()=>{let e=!1;return E.listShippingMethods().then(o=>{e||r(o)}).catch(()=>{e||r([])}),()=>{e=!0}},[]);const m=(p??[]).filter(e=>e.prices[n]!=null).map(e=>{const o=e.prices[n],i=o===0?R:f(o,n),t=e.pickupLocation;return{name:t?`${e.name} — ${t.name}`:e.name,eta:t?t.openingHours||void 0:e.description||void 0,price:e.requiresQuote&&o!==0?`${b}${i}`:i,blurb:t&&[[t.address,t.city,t.state].filter(Boolean).join(", "),t.readyIn].filter(Boolean).join(" · ")||void 0}});return y(j,{eyebrow:s,title:c,body:u,options:m,highlightBadge:a,contained:d,omitHead:l})}export{S as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
1
2
|
import { type Form, type FormAck } from "../lib/api/index.js";
|
|
2
3
|
export interface FormBlockProps {
|
|
3
4
|
formSlug?: string;
|
|
@@ -7,16 +8,23 @@ export interface FormBlockProps {
|
|
|
7
8
|
finePrint?: string;
|
|
8
9
|
form?: Form | null;
|
|
9
10
|
editing?: boolean;
|
|
11
|
+
buttonCorners?: unknown;
|
|
12
|
+
buttonCornerSides?: unknown;
|
|
13
|
+
buttonCornersUnit?: unknown;
|
|
10
14
|
}
|
|
11
|
-
export default function FormBlock({ formSlug, heading, intro, submitText, finePrint, form: injected, editing, }?: FormBlockProps): import("react").JSX.Element;
|
|
15
|
+
export default function FormBlock({ formSlug, heading, intro, submitText, finePrint, form: injected, editing, buttonCorners, buttonCornerSides, buttonCornersUnit, }?: FormBlockProps): import("react").JSX.Element;
|
|
12
16
|
export declare function AccountOutcome({ account }: {
|
|
13
17
|
account: FormAck["account"];
|
|
14
18
|
}): import("react").JSX.Element | null;
|
|
15
|
-
export declare function FormBody({ form, formSlug, submitText, finePrint, editing, onSent, }: {
|
|
19
|
+
export declare function FormBody({ form, formSlug, submitText, finePrint, editing, onSent, corners, }: {
|
|
16
20
|
form: Form;
|
|
17
21
|
formSlug?: string;
|
|
18
22
|
submitText?: string;
|
|
19
23
|
finePrint?: string;
|
|
20
24
|
editing?: boolean;
|
|
21
25
|
onSent?: () => void;
|
|
26
|
+
corners?: {
|
|
27
|
+
style: CSSProperties;
|
|
28
|
+
className: string;
|
|
29
|
+
} | null;
|
|
22
30
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import w from"next/link";import{useEffect as z}from"react";import{FormFieldInput as g,FormHoneypot as C,successMessageFor as L,useBoundForm as T,useFormSubmission as j}from"./formSubmission.js";import b from"./SectionNotice.js";import{say as N}from"efficient-web-builder/format/lib/editor-words";import B from"./WebFormField.js";import{usePopupScope as M}from"./PopupHost.js";import{FIELD_INPUT_CLASS as y}from"../lib/field-input.js";import{cornerSidesShorthand as _,normalizeCornerSides as q}from"efficient-web-builder/format/lib/content/section-corners";import{cssLengthOf as I}from"efficient-web-builder/format/lib/content/css-length";function O({field:e,value:r,onChange:s,cornersClass:a=""}){const n={field:e,value:r,onChange:s};return e.type==="checkbox"?l("label",{className:"flex items-start gap-3",children:[t(g,{...n,className:"mt-1 size-4 accent-accent"}),l("span",{className:"font-mono text-[12px] font-semibold uppercase tracking-[0.16em] text-fg",children:[e.label,e.required?t("span",{className:"text-accent",children:" *"}):null]})]}):t(B,{label:e.label,required:e.required,children:t(g,{...n,className:(e.type==="textarea"?y+" resize-y":y)+a})})}function P(e,r,s){if(typeof e!="number"||!Number.isFinite(e))return null;const a=I(Math.max(0,e),s),n=q(r);return{style:{"--form-control-radius":n===null?a:_(a,n)},className:" [border-radius:var(--form-control-radius)]"}}function W({formSlug:e,heading:r,intro:s,submitText:a,finePrint:n,form:u,editing:o=!1,buttonCorners:d,buttonCornerSides:x,buttonCornersUnit:f}={}){const i=T(e,u),m=M();if(i===void 0)return t(b,{size:"short",children:N("Loading form…")});if(i===null)return t(b,{size:"short",children:o?N("Choose a form in the inspector, under Form."):"This form is unavailable."});const c=(r??"").trim()||i.title;return t("section",{className:"relative z-[2] border-t border-line bg-surface",children:l("div",{className:"mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] py-[84px] max-[960px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[c&&t("h2",{className:"mb-4 font-heading2 text-[length:min(var(--size-headingMedium,44px),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.02em] text-fg max-view-wide:text-[length:min(var(--size-headingMedium,32px),var(--sf-heading-max,9999px))]",children:c}),(s??"").trim()&&t("p",{className:"mb-12 max-w-[640px] font-display text-[16px] leading-[1.6] text-fg-dim",children:s}),t(E,{form:i,formSlug:e,submitText:a,finePrint:n,editing:o,onSent:m?.markSent,corners:P(d,x,f)})]})})}function A({account:e}){const r="font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim";switch(e?.status){case"approved":return l("p",{className:r,children:["Your account is ready."," ",t(w,{href:"/account",className:"underline",children:"Sign in"})]});case"pending":return t("p",{className:r,children:"We're reviewing your application and will email you once it's approved."});case"rejected":return t("p",{className:r,children:"We couldn't open an account from this application. Please contact the shop."});default:return null}}function E({form:e,formSlug:r,submitText:s,finePrint:a,editing:n=!1,onSent:u,corners:o=null}){const{valueOf:d,set:x,honeypot:f,setHoneypot:i,submitting:m,done:c,account:v,error:h,handleSubmit:k}=j({form:e,formSlug:r,editing:n});z(()=>{c&&u?.()},[c]);const S=(s??"").trim()||e.submitButtonText?.trim()||"Submit";return c?l("div",{role:"status",className:"flex max-w-[560px] flex-col gap-3",children:[t("p",{className:"font-serif text-[19px] italic leading-[1.6] text-fg-dim",children:L(e)}),t(A,{account:v})]}):l("form",{className:"flex max-w-[720px] flex-col gap-5",style:o?.style,onSubmit:k,children:[e.fields.map(p=>t(O,{field:p,value:d(p.key),onChange:F=>x(p.key,F),cornersClass:o?.className},p.key)),t(C,{value:f,onChange:i}),h&&t("p",{role:"alert",className:"font-mono text-[12px] uppercase tracking-[0.18em] text-alert",children:h}),t("button",{type:n?"button":"submit",disabled:m,className:`cursor-pointer self-start bg-btn px-8 py-4 font-mono text-[14px] uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg hover:text-bg disabled:cursor-wait disabled:opacity-60${o?.className??""}`,children:m?"Sending…":S}),e.consentText?.trim()&&t("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim/70",children:e.consentText}),(a??"").trim()&&t("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim/70",children:a})]})}export{A as AccountOutcome,E as FormBody,W as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as k}from"react";import j from"next/image";import $ from"efficient-web-builder/render/components/Placeholder";import{withRMark as
|
|
1
|
+
"use client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useState as k}from"react";import j from"next/image";import $ from"efficient-web-builder/render/components/Placeholder";import{withRMark as d}from"efficient-web-builder/render/components/RMark";import{galleryCaptionIsBelow as T,galleryCardRatioClass as S}from"efficient-web-builder/format/lib/content/gallery-card-layout";import{partDisplayClass as _}from"efficient-web-builder/format/lib/content/part-display";import{PART_STYLE_KIND_ATTR as R,PART_STYLE_OWNER_ATTR as A}from"efficient-web-builder/render/lib/document/text-parts";import C from"efficient-web-builder/render/components/PartStyledKind";const E=(e,l)=>`${String(e).padStart(2,"0")} / ${String(l).padStart(2,"0")}`;function P({build:e,hiddenMobile:l,alwaysShowOverlay:s,forceHover:c,index:m,total:p,ratio:v,captionPlace:u,display:y,displayPhone:w,styleOwner:g,editing:h=!1}){const a=o=>_(y,w,o),i=o=>h&&g?{[A]:g,[R]:`@${o}`}:{},r=(o,x)=>!h&&g?t(C,{kind:`@${o}`,shared:!0,children:x}):x,[b,N]=k(!1),z=T(u),f=n("div",{className:["sf-card group relative overflow-hidden bg-surface-2",S(v),l?"max-view-wide:hidden":""].join(" "),children:[n("div",{className:["absolute inset-0 z-[1] flex items-center justify-center transition-[transform,filter,opacity] duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",c?"scale-[1.06] opacity-0 [filter:brightness(0.5)]":"group-hover:scale-[1.06] group-hover:opacity-0 group-hover:[filter:brightness(0.5)]"].join(" "),children:[t($,{label:e.imageLabel,src:e.imageSrc}),!s&&t("div",{className:"absolute inset-0",style:{background:"rgba(0,0,0,0.35)"}})]}),t("div",{className:["absolute inset-0 z-[1] flex items-center justify-center transition-[transform,filter,opacity] duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",c?"opacity-100 scale-[1.06] [filter:brightness(0.5)]":"opacity-0 group-hover:scale-[1.06] group-hover:opacity-100 group-hover:[filter:brightness(0.5)]"].join(" "),style:{background:"var(--site-surface)"},children:e.detailSrc&&t(j,{src:e.detailSrc,alt:"",fill:!0,sizes:"(max-width: 800px) 100vw, (max-width: 1500px) 33vw, 25vw",loading:"lazy",className:"absolute inset-0 z-[3] object-cover",style:{display:b?"none":"block"},onError:()=>N(!0)})}),(e.process||m!=null&&p!=null)&&n("div",{className:"pointer-events-none absolute top-3 left-3 right-3 z-[3] flex items-baseline gap-2 max-view-wide:top-2.5 max-view-wide:left-2.5 max-view-wide:right-2.5",children:[e.process&&t("span",{...i("tag"),className:["min-w-0 truncate font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.24em] text-accent",a("tag"),"transition-opacity duration-300 ease-out",s||c?"opacity-100":"opacity-0 group-hover:opacity-100 max-view-wide:opacity-100"].join(" "),children:r("tag",d(e.process))}),m!=null&&p!=null&&t("span",{...i("number"),className:`ml-auto shrink-0 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.24em] ${a("number")}`.trim(),style:{color:"rgba(245,241,232,0.7)"},children:r("number",E(m,p))})]}),t("div",{className:["absolute inset-0 z-[2]","transition-[opacity,transform] duration-300 ease-out",s||c?"opacity-100 translate-y-0":"opacity-0 translate-y-2 group-hover:opacity-100 group-hover:translate-y-0 max-view-wide:opacity-100 max-view-wide:translate-y-0"].join(" "),style:{color:"var(--overlay-fg)",background:s?"linear-gradient(180deg, rgba(10,10,10,.55) 0%, transparent 35%, transparent 55%, rgba(10,10,10,.92) 100%)":"linear-gradient(180deg, transparent 40%, rgba(10,10,10,.85) 100%)"},children:n("div",{className:"absolute inset-x-0 bottom-0 top-9 flex flex-col justify-end gap-1 overflow-hidden p-6 max-view-wide:top-8 max-view-wide:p-3.5",children:[e.car&&t("div",{...i("eyebrow"),className:`truncate font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.2em] text-accent max-view-wide:text-[length:var(--size-label,11px)] max-view-wide:tracking-[0.15em] ${a("eyebrow")}`.trim(),children:r("eyebrow",e.car)}),e.wheel&&t("div",{...i("title"),className:`font-heading3 text-[length:var(--size-headingSmall,22px)] font-medium leading-[1.05] tracking-[-0.02em] max-view-wide:text-[length:var(--size-body,16px)] ${s?"uppercase ":""}${a("title")}`.trim(),children:r("title",e.wheel)}),e.finish&&t("div",{...i("meta"),className:`mt-1.5 flex gap-3.5 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.12em] ${a("meta")}`.trim(),style:{color:"rgba(245,241,232,0.7)"},children:t("span",{children:r("meta",d(e.finish))})})]})})]});return z?n("div",{className:l?"max-view-wide:hidden":"",children:[f,n("div",{className:"bg-surface px-3.5 pt-3 pb-3.5",children:[e.wheel&&t("div",{...i("title"),className:`font-display text-[length:var(--size-body,15px)] font-medium leading-[1.25] tracking-[-0.01em] text-fg ${a("title")}`.trim(),children:r("title",e.wheel)}),(e.finish||e.car)&&t("div",{...i(e.finish?"meta":"eyebrow"),className:`mt-0.5 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] text-fg-dim ${a(e.finish?"meta":"eyebrow")}`.trim(),children:r(e.finish?"meta":"eyebrow",d(e.finish||e.car))})]})]}):f}export{P as default,E as galleryTileNumber};
|
|
@@ -5,6 +5,8 @@ export interface GalleryGridProps {
|
|
|
5
5
|
pads?: Record<string, unknown>;
|
|
6
6
|
editing?: boolean;
|
|
7
7
|
items?: SlotComponent;
|
|
8
|
+
template?: SlotComponent;
|
|
9
|
+
nodeId?: string;
|
|
8
10
|
sourced?: readonly ProductPictureTile[];
|
|
9
11
|
num?: string;
|
|
10
12
|
title?: string;
|
|
@@ -23,4 +25,4 @@ export interface GalleryGridProps {
|
|
|
23
25
|
gap?: number | string;
|
|
24
26
|
gapPhone?: unknown;
|
|
25
27
|
}
|
|
26
|
-
export default function GalleryGrid({ items: Items, sourced, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, layoutPhone, columns, columnsMobile, gap: gapProp, gapPhone, omitHead, pads, editing, }: GalleryGridProps): import("react").JSX.Element;
|
|
28
|
+
export default function GalleryGrid({ items: Items, template, nodeId, sourced, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, layoutPhone, columns, columnsMobile, gap: gapProp, gapPhone, omitHead, pads, editing, }: GalleryGridProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
2
|
-
`),
|
|
3
|
-
`):[]:
|
|
1
|
+
"use client";import{jsx as s,jsxs as ee}from"react/jsx-runtime";import{useCallback as re,useMemo as g,useState as se}from"react";import{usePathname as le}from"next/navigation";import{containerGapProps as te}from"efficient-web-builder/format/lib/content/container-gap";import ne from"efficient-web-builder/render/components/Btn";import oe,{GALLERY_GRID_ATTR as ae,GalleryLinksContext as ie,GalleryTilesContext as de}from"./GalleryItem.js";import{useShopperGallery as ce}from"./catalog/ShopperScope.js";import{galleryShownIds as me,galleryToolbarIdle as pe,WALL_PLACED_CELL as fe,WALL_PLACED_CSS as ye,wallSpanAt as ge}from"../lib/sections/gallery-toolbar.js";import{useSiteSells as ue}from"./SiteRecordContext.js";import{SharedPartKinds as he}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as we}from"efficient-web-builder/render/components/goldPhrases";import Le from"efficient-web-builder/render/components/SectionHeader";import{FRAME_120 as Se,framedBandPad as ve,headIsEmpty as xe,withBandClasses as Ne}from"../lib/sections/band-padding.js";import{galleryFrame as Ge,galleryTemplate as Ce}from"../lib/sections/gallery-frame.js";import{SITE_COLUMN as _e}from"efficient-web-builder/format/lib/content/page-width";import{resolveGridColumns as Pe,resolveGridMobileColumns as be}from"efficient-web-builder/format/lib/content/grid-span";import{galleryLayoutClass as Ae,galleryLayoutCss as Ie,resolveGalleryLayout as Te}from"efficient-web-builder/format/lib/content/gallery-layout";import{HideTaker as ke}from"efficient-web-builder/render/components/ViewHideRoot";function Ee({items:i,template:T,nodeId:k,sourced:o,num:v,title:u,linkText:x,linkHref:E,galleryHref:m="/gallery",submitHref:R="/contact",previewHover:M,display:j,displayPhone:B,styleOwner:$,layout:D,layoutPhone:O,columns:p,columnsMobile:z,gap:F,gapPhone:W,omitHead:h=!1,pads:K,editing:N=!1}){const U=le(),V=ue(),Y=m!==U&&(V||m!=="/gallery"),w={layout:D,layoutPhone:O},d=Te(w),q=!d&&p!=null&&p!=="",a=te("GalleryB",F,"both",W),G=d?{className:`sf-card-grid sf-gallery-zone ${Ae(w)} grid${a.className}`,style:a.style}:q?{className:`sf-card-grid sf-grid-zone grid${a.className}`,style:{...a.style,"--sf-grid-cols":String(Pe(p)),"--sf-grid-cols-phone":String(be(z,p))}}:{className:`sf-card-grid grid grid-cols-4${a.className} max-[1500px]:grid-cols-3 max-view-wide:grid-cols-1`,style:a.style},C=x?{text:x,href:E||"#"}:void 0,H=u?we(u,!1):void 0,[_,J]=se({}),P=re((e,l)=>{J(r=>{const n=r[e.id];if(l){if(!n)return r;const{[e.id]:Re,...Z}=r;return Z}return n&&n.tag===e.tag&&n.name===e.name?r:{...r,[e.id]:e}})},[]),f=o?.map(e=>e.tile.id).join(`
|
|
2
|
+
`),b=g(()=>f!==void 0?f?f.split(`
|
|
3
|
+
`):[]:i?.blockIds,[f,i?.blockIds]),y=g(()=>(b??[]).map(e=>_[e]).filter(e=>!!e),[b,_]),{ref:Q,toolbar:c}=ce(y),A=c!==null&&!pe(c,y),t=g(()=>A&&c?me(y,c):null,[A,c,y]),X=g(()=>{const e=new Map((t??[]).map((l,r)=>[l,r]));return{report:P,positionOf:l=>{const r=t?e.get(l):void 0;return r===void 0?null:{index:r+1,total:t.length}}}},[P,t]),L=t?e=>{const l=t.indexOf(e);if(l<0)return{style:{display:"none"}};if(!d)return{style:{order:l}};const r=ge(d,l,t.length);return{className:fe,style:{order:l,"--sf-wall-c":r.col,"--sf-wall-r":r.row,"--sf-wall-cp":r.colPhone,"--sf-wall-rp":r.rowPhone}}}:void 0,S=ve(K,Se,{noTop:h,nonNegative:!0}),I=Ce(T,!o);return s(ke,{as:"section",ref:Q,...S.attrs,className:Ne(Ge(h,!!I),S),style:S.style,children:ee("div",{className:_e,children:[h||!N&&xe(v,u,C?.text)?null:s(Le,{num:v,title:H,link:C}),d&&s("style",{dangerouslySetInnerHTML:{__html:Ie(w)+(t?ye:"")}}),(i||o)&&s(ie.Provider,{value:{galleryHref:m,submitHref:R,previewHover:M,display:j,displayPhone:B,styleOwner:$,wordsAtRest:!!o,ownerId:k,Template:I},children:s(de.Provider,{value:X,children:s(he,{children:s("div",{[ae]:"",style:{display:"contents"},children:o?s("div",{...G,children:o.map(({tile:e,...l})=>{const r=s(oe,{...l,tile:e,editing:N},e.id),n=L?.(e.id);return n?s("div",{className:n.className,style:n.style,children:r},e.id):r})}):i?s(i,{...G,minEmptyHeight:320,...L?{cell:L}:{}}):null})})})}),Y&&s("div",{className:"mt-12 flex flex-col items-center gap-3",children:s(ne,{href:m,variant:"ghost",children:"See Gallery"})})]})})}export{Ee as default};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { galleryTemplate } from "../lib/sections/gallery-frame.js";
|
|
1
2
|
import { type GalleryShowcaseCard } from "./GalleryShowcase.js";
|
|
2
3
|
import type { GalleryTile } from "../lib/sections/gallery-toolbar.js";
|
|
3
4
|
export declare const GalleryLinksContext: import("react").Context<{
|
|
@@ -9,6 +10,8 @@ export declare const GalleryLinksContext: import("react").Context<{
|
|
|
9
10
|
styleOwner?: string;
|
|
10
11
|
photosOnly?: boolean;
|
|
11
12
|
wordsAtRest?: boolean;
|
|
13
|
+
Template?: ReturnType<typeof galleryTemplate>;
|
|
14
|
+
ownerId?: string;
|
|
12
15
|
}>;
|
|
13
16
|
export declare const GALLERY_TILE_PARTS: readonly [{
|
|
14
17
|
readonly id: "tag";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as n,Fragment as
|
|
1
|
+
"use client";import{jsx as r,jsxs as n,Fragment as f}from"react/jsx-runtime";import{createContext as Y,useCallback as Q,useContext as D,useEffect as ee,useRef as te,useState as _}from"react";import C from"next/link";import{slugify as re}from"efficient-shell/format";import{CardTemplateRows as oe}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ne}from"efficient-web-builder/format/lib/content/page-width";import le,{galleryTileNumber as ae}from"./GalleryCard.js";import se,{LightboxClose as ie,LIGHTBOX_CLOSE_TINT as ce}from"./Lightbox.js";import{useSiteSells as de}from"./SiteRecordContext.js";import{renderGold as p,renderHeadline as W}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as pe}from"efficient-web-builder/format/lib/sized-image";import{useIsoLayoutEffect as me}from"./catalog/ShopperScope.js";import{HideTaker as F}from"efficient-web-builder/render/components/ViewHideRoot";const fe="(max-width: 1100px) 100vw, min(59vw, 1050px)",he=Y({}),Re=[{id:"tag",label:"Tag"},{id:"eyebrow",label:"Eyebrow"},{id:"title",label:"Title"},{id:"meta",label:"Meta"},{id:"number",label:"Card number"}],xe=Y(null),ue="data-gallery-grid",O="data-gallery-tile";function ge(t,o){const[a,i]=_(null);return ee(()=>{const c=t.current,s=c?.closest(`[${ue}]`);if(!c||!s)return;const v=()=>{const w=Array.from(s.querySelectorAll(`[${O}]`)),N=w.indexOf(c),h=N>=0?{index:N+1,total:w.length}:null;i(x=>x?.index===h?.index&&x?.total===h?.total?x:h)};if(v(),!o)return;const y=new MutationObserver(v);return y.observe(s,{childList:!0,subtree:!0}),()=>y.disconnect()},[t,o]),a}const Ae={process:"Category",eyebrow:"Subtitle",name:"Item name",meta:"Detail"},be=()=>({image:"",href:"#",process:"",eyebrow:"",name:"",meta:""}),$e=Array.from({length:6},be);function ve(t){const o=(t.photos??[]).map(s=>s?.src).filter(s=>!!s),a=t.image||o[0]||"",i=[a,...o].filter(s=>!!s),c=re(t.name)||"gallery-item";return{car:t.eyebrow??"",wheel:t.name??"",process:t.process??"",finish:t.meta??"",imageLabel:`${c}.jpg`,detailLabel:`${c}-detail.jpg`,imageSrc:a||void 0,detailSrc:o[0]||a||void 0,photos:i,href:t.href}}function ye({editing:t=!1,previewHover:o,ratio:a,captionPlace:i,tile:c,...s}){const{galleryHref:v="/gallery",submitHref:y="/contact",previewHover:w,display:N,displayPhone:h,styleOwner:x,photosOnly:X=!1,wordsAtRest:q=!1,Template:E,ownerId:Z}=D(he),e=ve(s),u=de()&&!X,I=!u&&!we(e),d=e.photos??(e.imageSrc?[e.imageSrc]:[]),P=te(null),z=Q(l=>{P.current=l},[]),J=ge(P,t),j=D(xe),k=j?.report,m=c?.id,G=c?.tag??"",H=c?.name??"";me(()=>{if(!k||!m)return;const l={id:m,tag:G,name:H};return k(l),()=>k(l,!0)},[k,m,G,H]);const g=(m?j?.positionOf(m):null)??J,R=t&&(!!o||!!w),[K,b]=_(!1),[S,L]=_(0),A=()=>L(l=>(l-1+d.length)%d.length),$=()=>L(l=>(l+1)%d.length),T=d[S]??e.imageSrc??"",B=d.slice(1),M=E?r("div",{className:`block w-full min-w-0 ${ne}`,children:r(oe,{ownerId:Z??"GalleryB",ownerType:"GalleryB",Template:E,rows:[{key:m??e.imageSrc??"tile",image:e.imageSrc??"",tag:e.process,number:g?ae(g.index,g.total):"",eyebrow:e.car,name:e.wheel,meta:e.finish,href:e.href??""}],items:[{hoverMedia:B.length?{photos:[{finish:"",items:B.map(l=>({url:l,kind:"image"}))}]}:null}],previewHover:R,fallback:null,children:l=>l})}):r(le,{build:e,forceHover:R,alwaysShowOverlay:q,index:g?.index,total:g?.total,ratio:a,captionPlace:i,display:N,displayPhone:h,styleOwner:x,editing:t});return n(f,{children:[t?r(F,{as:"div",ref:z,[O]:"",className:"block w-full text-left",children:M}):r(F,{as:"button",ref:z,[O]:"",type:"button","aria-label":u?`Open ${e.car||"build"} on ${e.wheel||"wheel"}`:V(e),onClick:()=>{L(0),b(!0)},className:"block w-full cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:M}),r(se,{open:K,onClose:()=>b(!1),label:u?`${e.car} on ${e.wheel}`:V(e),onPrev:d.length>1?A:void 0,onNext:d.length>1?$:void 0,className:"flex items-center justify-center p-6 max-[700px]:p-3",children:n("div",{onClick:l=>l.stopPropagation(),className:`relative grid w-[min(1800px,100%)] max-h-[calc(100vh-48px)] ${I?"grid-cols-1":"grid-cols-[1.4fr_1fr]"} overflow-hidden border border-line bg-bg max-view-desktop:grid-cols-1 max-view-desktop:overflow-auto`,style:{boxShadow:"0 60px 120px -20px color-mix(in srgb, var(--sf-shadow-color, #141416) 70%, transparent)"},children:[r(ie,{label:"Close popup",className:"absolute right-[24px] top-[24px] z-[5] flex h-[56px] w-[56px] items-center justify-center border border-line font-mono text-[length:var(--size-label,21px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:ce},children:"✕"}),n("div",{className:"relative flex min-h-[690px] items-center justify-center overflow-hidden bg-surface-2 max-view-desktop:min-h-[450px]",children:[T&&r("img",{...pe(T,{fallbackWidth:1280}),sizes:fe,alt:`${(u?e.car:e.wheel||e.car)||"Photo"} — ${S+1} of ${d.length}`,className:"block h-full max-h-[88vh] w-full object-cover"},T),d.length>1&&n(f,{children:[r("button",{type:"button","aria-label":"Previous photo",onClick:A,className:"absolute left-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),r("button",{type:"button","aria-label":"Next photo",onClick:$,className:"absolute right-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"}),n("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[S+1," / ",d.length]})]})]}),u?n("div",{className:"flex flex-col gap-[30px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[e.process&&r("span",{className:"font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.3em] text-accent",children:p(e.process)}),e.wheel&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:W(e.wheel,!1)}),e.car&&n("div",{className:"font-heading3 text-[length:var(--size-headingSmall,27px)] leading-[1.4] text-fg",children:["on ",r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em]",children:p(e.car,!0)})]}),n("dl",{className:"mt-3 grid grid-cols-[auto_1fr] gap-x-7 gap-y-[18px] border-y border-line py-[30px] font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em]",children:[e.wheel&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Wheel"}),r("dd",{className:"text-fg",children:p(e.wheel)})]}),e.process&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Process"}),r("dd",{className:"text-fg",children:p(e.process)})]}),e.finish&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Finish"}),r("dd",{className:"text-fg",children:p(e.finish)})]}),e.car&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Vehicle"}),r("dd",{className:"text-fg",children:p(e.car)})]})]}),n("div",{className:"mt-auto flex flex-col gap-3.5 pt-6",children:[n(C,{href:e.href||"/wheels",onClick:()=>b(!1),className:"group flex items-center justify-between gap-6 border border-btn bg-btn px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",children:[r("span",{children:"View product"}),r("span",{className:"transition-transform group-hover:translate-x-[6px]",children:"→"})]}),n(C,{href:v,onClick:()=>b(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"See more builds"}),r("span",{children:"→"})]}),n(C,{href:y,onClick:()=>b(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"Submit your build"}),r("span",{children:"→"})]})]})]}):!I&&r(Ne,{build:e})]})})]})}function U(t){return[t.process,t.car,t.finish].filter((o,a,i)=>!!o&&o!==t.wheel&&i.indexOf(o)===a)}function we(t){return!!t.wheel||U(t).length>0}function V(t){const o=t.wheel||t.car;return o?`Open photo of ${o}`:"Open photo"}function Ne({build:t}){const o=t.wheel,a=U(t);return n("div",{className:"flex flex-col gap-[24px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[o&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:W(o,!1)}),a.map(i=>r("p",{className:"text-[length:var(--size-body,18px)] leading-[1.5] text-fg",children:p(i)},i))]})}export{ue as GALLERY_GRID_ATTR,Ae as GALLERY_ITEM_HINTS,$e as GALLERY_ITEM_SEEDS,O as GALLERY_TILE_ATTR,Re as GALLERY_TILE_PARTS,he as GalleryLinksContext,xe as GalleryTilesContext,ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as s,jsxs as b}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as s,jsxs as b}from"react/jsx-runtime";import d from"next/link";import{useEffect as L,useId as D,useRef as g,useState as E}from"react";import{isLabelOnlyMenuUrl as x,isMenuPanel as T}from"../lib/menu-link.js";import{useTakeViewHide as A,withViewHide as w}from"efficient-web-builder/render/components/ViewHideRoot";import{DesktopDropdownPanel as M,PhoneDropdownPanel as O}from"./HeaderDropdownPanel.js";const _=120;function R({item:n,mobile:l=!1,onNavigate:j,dropdownAlign:y="start"}){const[o,c]=E(!1),[N,k]=E(!1),r=()=>{c(!1),k(!1)},f=D(),u=g(null),C=g(null),$=n.dropdownItems.length>0,m=$&&T(n.dropdownItems,n.dropdownAside),p=g(null),h=()=>{p.current!==null&&(clearTimeout(p.current),p.current=null)};L(()=>h,[]);const v=!x(n.href),t=A();L(()=>{if(!o)return;const e=u.current?.ownerDocument??document,i=P=>{u.current?.contains(P.target)||r()};return e.addEventListener("pointerdown",i),()=>e.removeEventListener("pointerdown",i)},[o]);const a=()=>{r(),j?.()};if(!$)return v?t.scope(s(d,{href:n.href,onClick:a,className:w(l?"flex min-h-11 items-center font-display text-3xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent":"whitespace-nowrap opacity-80 transition-opacity hover:opacity-100 focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",t.className),...t.attrs,children:n.label})):t.scope(s("span",{className:w(l?"flex min-h-11 items-center font-display text-3xl":"whitespace-nowrap opacity-80",t.className),...t.attrs,children:n.label}));const I=s("button",{ref:C,type:"button","aria-label":`${o&&(l||N)?"Close":"Open"} ${n.plainLabel} menu`,"aria-expanded":o,"aria-controls":f,onClick:()=>{l?c(e=>!e):o&&N?r():(h(),c(!0),k(!0))},className:l?"flex h-11 w-11 shrink-0 items-center justify-center rounded-full focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent":"flex h-8 w-8 shrink-0 items-center justify-center rounded-full opacity-70 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:s("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5","aria-hidden":"true",className:`transition-transform ${o?"rotate-180":""}`,children:s("path",{d:"m3 5 4 4 4-4"})})});return l?t.scope(b("div",{ref:u,className:t.className||void 0,...t.attrs,children:[b("div",{className:"flex min-h-11 items-center justify-between gap-3",children:[v?s(d,{href:n.href,onClick:a,className:"min-w-0 flex-1 font-display text-3xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:n.label}):s("span",{className:"min-w-0 flex-1 font-display text-3xl",children:n.label}),I]}),o&&m?s(O,{id:f,items:n.dropdownItems,aside:n.dropdownAside,onNavigate:a}):o?s("div",{id:f,className:"mt-3 flex flex-col border-l border-line pl-5",children:n.dropdownItems.map((e,i)=>x(e.href)?s("span",{className:"flex min-h-11 items-center text-base opacity-80",children:e.label},`${e.href}-${i}`):s(d,{href:e.href,onClick:a,className:"flex min-h-11 items-center text-base opacity-80 transition-opacity hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:e.label},`${e.href}-${i}`))}):null]})):t.scope(b("div",{ref:u,className:w("relative flex items-center whitespace-nowrap",t.className),...t.attrs,onMouseEnter:()=>{h(),c(!0)},onMouseLeave:()=>{h(),m?p.current=setTimeout(r,_):r()},onBlurCapture:e=>{e.currentTarget.contains(e.relatedTarget)||r()},onKeyDown:e=>{e.key==="Escape"&&(r(),C.current?.focus())},children:[v?s(d,{href:n.href,onClick:a,onFocus:()=>c(!0),className:"opacity-80 transition-opacity hover:opacity-100 focus-visible:rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:n.label}):s("span",{className:"opacity-80",children:n.label}),I,o&&m?s(M,{id:f,items:n.dropdownItems,aside:n.dropdownAside,onNavigate:a,anchor:u}):o?s("div",{id:f,className:`absolute top-full z-[60] w-72 pt-3 text-fg ${y==="end"?"right-0":y==="center"?"left-1/2 -translate-x-1/2":"left-0"}`,children:s("div",{className:"overflow-hidden rounded-lg border border-line bg-bg p-2 shadow-xl",children:n.dropdownItems.map((e,i)=>x(e.href)?s("span",{className:"flex min-h-11 items-center rounded-md px-4 py-2 text-sm opacity-80",children:e.label},`${e.href}-${i}`):s(d,{href:e.href,onClick:a,className:"flex min-h-11 items-center rounded-md px-4 py-2 text-sm opacity-80 transition-[background,opacity] hover:bg-[var(--card-bg)] hover:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent",children:e.label},`${e.href}-${i}`))})}):null]}))}export{R as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as a,Fragment as c}from"react/jsx-runtime";import u from"next/link";import{FIGURE_TO_COME as N,FREE_PRICE as b,UNPRICED_LABEL as k}from"../../lib/wheels/price-display.js";import w from"../CartLineThumbnail.js";import C from"../CouponField.js";import j from"../QuantityStepper.js";import T from"efficient-web-builder/render/components/RMark";import{lineTotal as y,useCart as d}from"../CartContext.js";import{COUPON_DEFERRED_TOTAL as B}from"../../lib/cart/coupon-preview.js";import{shippingWords as F,TAX_PENDING as S}from"../../lib/cart/shipping-status.js";import{useCurrency as g}from"../CurrencyContext.js";import{cartSubtitle as _}from"efficient-web-builder/format/lib/content/cart-drawer";function H({content:e,closeRef:r}){const{close:n,items:s}=d(),l=r;return a("header",{className:"flex flex-shrink-0 flex-col gap-4 border-b border-line px-8 pb-6 pt-8 max-[640px]:px-6 max-[640px]:pt-6 max-[640px]:pb-5",children:[a("div",{className:"flex items-center justify-between",children:[a("span",{className:"flex items-center gap-3 font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[e.kickerBadge?t("span",{className:"border px-2 py-1 text-[10px]",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 50%, transparent)"},children:e.kickerBadge}):null,(e.kickerBadge?"· ":"")+e.kickerText]}),t("button",{ref:l,type:"button",onClick:n,"aria-label":"Close cart",className:"flex h-8 w-8 items-center justify-center border border-line text-[14px] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"✕"})]}),a("h1",{className:"font-display text-[38px] font-medium uppercase leading-[0.95] tracking-[-0.03em] max-[640px]:text-[30px]",children:[e.titleLead+" ",t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.02em] normal-case",children:e.titleAccent})]}),t("p",{className:"font-serif text-[13px] italic leading-[1.5] text-fg-dim",children:_(e,s.length)})]})}function X({content:e}){const{totals:r}=d(),{activeCountry:n}=g(),s=n?.name??e.shipsToFallback,l=1+(e.leadTimeValue?1:0)+(s?1:0);return t(c,{children:a("div",{className:`grid flex-shrink-0 ${$[l-1]} gap-px border-b border-line bg-line`,children:[t(h,{label:"Items",value:a(c,{children:[t("em",{className:"font-serif font-normal italic text-accent",children:r.sets})," set",r.sets===1?"":"s"," · ",r.units," item",r.units===1?"":"s"]})}),e.leadTimeValue?t(h,{label:"Lead time",value:e.leadTimeValue}):null,s?t(h,{label:"Ships to",value:s}):null]})})}function Y({content:e,tyres:r}){const{items:n,remove:s,setQty:l}=d();return t(c,{children:n.length===0?t(I,{content:e}):n.map(o=>t(R,{line:o,tyre:r.get(o.slug),onRemove:()=>s(o.id),onQtyChange:m=>l(o.id,m)},o.id))})}function J(){const{items:e,totals:r,bundles:n}=d(),{formatMoney:s}=g(),l=new Set(e.flatMap(i=>(i.components??[]).map(x=>x.partNumber))),o=new Set(r.appliedBundles.map(i=>i.slug)),m=n.filter(i=>!o.has(i.slug)).filter(i=>i.components.some(x=>l.has(x.partNumber))).slice(0,2);return t(c,{children:m.length>0&&a("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",style:{background:"color-mix(in oklab, var(--site-surface) 60%, transparent)"},children:[a("div",{className:"mb-4 flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[t("span",{children:"You may also need"}),t("span",{className:"font-display text-[11px] normal-case tracking-[0.08em] text-fg-dim",children:"Buy together, save"})]}),t("div",{className:"grid grid-cols-2 gap-2 max-[640px]:grid-cols-1",children:m.map(i=>t(E,{href:`/bundles/${i.slug}`,title:i.name,sub:L(i,r.currency,s)},i.slug))})]})})}function Z(){return t(c,{children:t("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",children:t(C,{})})})}function ee({content:e}){return t(c,{children:e.promises.length>0&&t("div",{className:"flex flex-wrap justify-center gap-5 border-b border-line px-8 pt-6 pb-8 font-mono text-[9px] uppercase tracking-[0.24em] text-fg-dim max-[640px]:px-6",children:e.promises.map(r=>t(U,{children:r},r))})})}function te(){const{totals:e,coupon:r}=d(),{formatMoney:n}=g();return t(c,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-2 border-t border-line px-8 pt-5 max-[640px]:px-6",children:[t(p,{label:`Subtotal · ${e.sets} set${e.sets===1?"":"s"}`,value:n(e.subtotal,e.currency)}),e.appliedBundles.map(s=>t(p,{label:`Bundle · ${s.name}${s.multiples>1?` ×${s.multiples}`:""}`,value:a("span",{style:{color:"var(--green)"},children:["− ",n(s.discount,e.currency)]})},s.slug)),e.discount>0&&r?.valid&&t(p,{label:`Coupon · ${r.code}`,value:a("span",{style:{color:"var(--green)"},children:["− ",n(e.discount,e.currency)]})}),r?.deferred&&t(p,{label:`Coupon · ${r.code}`,value:B}),r?.valid&&r.effects?.gift&&t(p,{label:`Free gift · ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` ×${r.effects.gift.quantity}`:""}`,value:t("span",{style:{color:"var(--green)"},children:b})}),t(p,{label:"Shipping",value:e.shippingStatus==="free"?t("span",{style:{color:"var(--green)"},children:b}):F(e.shippingStatus)??n(e.shipping,e.currency)}),e.tax&&(e.tax.charged?t(p,{label:e.tax.inclusive?`${e.tax.name} included · ${e.tax.rate}%`:e.tax.name,value:n(e.tax.amount,e.currency)}):e.tax.name?t(p,{label:e.tax.name,value:S}):null),a("div",{className:"mt-2 flex items-center justify-between border-t border-line pt-4 text-fg",children:[a("span",{className:"font-display text-[22px] font-medium tracking-[-0.02em] normal-case",children:["Total ",t("em",{className:"font-serif font-normal italic text-accent",children:"due"})]}),t("span",{className:"text-right font-display text-[30px] font-medium tracking-[-0.025em] text-fg",children:e.repricing?N:n(e.grand,e.currency)})]})]})})}function re(){const{items:e,close:r}=d();return t(c,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-3 px-8 pb-6 pt-4 max-[640px]:px-6",children:[a(u,{href:"/checkout",onClick:r,"aria-disabled":e.length===0,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[12px] uppercase tracking-[0.3em] transition-colors",e.length===0?"pointer-events-none cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:["Begin checkout",t("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}),t("div",{className:"flex items-center justify-between px-1 py-2 font-mono text-[10px] uppercase tracking-[0.24em] text-fg-dim",children:t(u,{href:"/wheels",onClick:r,className:"text-fg transition-colors hover:text-accent",children:"← Keep browsing"})})]})})}const $=["grid-cols-1","grid-cols-2","grid-cols-3"];function h({label:e,value:r}){return a("div",{className:"flex flex-col gap-1 bg-bg px-4 py-4",children:[t("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-fg-dim",children:e}),t("span",{className:"font-display text-[14px] font-medium tracking-[-0.005em] text-fg",children:r})]})}function R({line:e,tyre:r,onRemove:n,onQtyChange:s}){const{catalog:l,totals:o}=d(),m=(e.components??[]).reduce((f,v)=>f+(o.freeUnitsByPartNumber[v.partNumber]??0),0),{currency:i,formatMoney:x}=g();return a(c,{children:[a("article",{className:"grid grid-cols-[96px_1fr] gap-5 border-b border-line px-8 py-6 transition-colors hover:bg-[color-mix(in_oklab,var(--site-surface)_60%,transparent)] max-[640px]:grid-cols-[78px_1fr] max-[640px]:px-6 max-[640px]:py-5",children:[t(w,{line:e,catalog:l,tyre:r}),a("div",{className:"flex min-w-0 flex-col gap-2",children:[a("div",{className:"flex items-start justify-between gap-3",children:[a("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-accent",children:["N° ",e.positionNo," · ",e.process==="FusionForge®"?a(c,{children:["FusionForge",t(T,{})]}):e.process]}),t("span",{className:"whitespace-nowrap font-display text-[16px] font-medium tracking-[-0.015em] text-fg",children:y(e,i)===null?k:x(y(e,i),i)})]}),a("h3",{className:"mt-0.5 font-display text-[22px] font-medium uppercase leading-none tracking-[-0.02em]",children:[e.name.lead,t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em] normal-case",children:e.name.accent})]}),e.config.length>0&&a("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.config.map(f=>t("span",{className:["border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em]",f.gold?"border-[color-mix(in_oklab,var(--accent)_45%,var(--site-line))] text-accent":"border-line text-fg-dim"].join(" "),children:f.label},f.label)),m>0&&a("span",{className:"border border-accent bg-accent px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em] text-bg",children:[m,"× free"]})]}),a("div",{className:"mt-3 flex items-center justify-between gap-3",children:[t(j,{value:e.qty,onChange:s,size:"small"}),a("div",{className:"flex gap-4 font-mono text-[10px] uppercase tracking-[0.22em]",children:[t(u,{href:e.href??`/wheels/${e.slug}`,className:"text-fg-dim transition-colors hover:text-accent",children:e.href?"View product":"Edit finish"}),t("button",{type:"button",onClick:n,className:"text-fg-dim transition-colors hover:text-alert",children:"Remove"})]})]})]})]}),e.verifiedFor&&a("div",{className:"mx-8 -mt-px flex items-start gap-3 border-t-0 px-4 py-4 font-display text-[13px] leading-[1.45] text-fg max-[640px]:mx-6",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 35%, var(--site-line))",borderTop:"0"},children:[t("span",{className:"flex-shrink-0 pt-px font-mono text-[10px] uppercase tracking-[0.24em] text-accent",children:"Fits"}),a("span",{children:["Verified for your ",t("strong",{className:"font-medium text-accent",children:e.verifiedFor}),". Final torque values shipped with the wheels."]})]})]})}function E({title:e,sub:r,href:n}){return a(u,{href:n,className:"flex items-center justify-between border border-line bg-bg px-4 py-3 text-left transition-colors hover:border-accent",children:[a("span",{className:"flex min-w-0 flex-col gap-1",children:[t("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-display text-[13px] font-medium tracking-[-0.005em] text-fg",children:e}),t("span",{className:"font-mono text-[9px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),t("span",{className:"ml-2 flex h-6 w-6 flex-shrink-0 items-center justify-center font-mono text-[13px] text-accent",style:{borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))",borderWidth:1,borderStyle:"solid"},children:"+"})]})}function L(e,r,n){const s=e.savings[r];if(s===void 0)return"Buy together";const l=n(s,r);return e.savingIsFrom?`Save from ${l}`:`Save ${l}`}function U({children:e}){return t("span",{className:"inline-flex items-center gap-2 before:text-[6px] before:text-accent before:content-['●']",children:e})}function p({label:e,value:r}){return a("div",{className:"flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:[t("span",{children:e}),t("strong",{className:"font-display text-[14px] font-normal tracking-[-0.005em] normal-case text-fg",children:r})]})}function I({content:e}){return a("div",{className:"flex flex-col items-center justify-center gap-3 px-8 py-20 text-center",children:[t("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:e.emptyKicker}),t("p",{className:"font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:e.emptyBody}),a(u,{href:"/wheels",className:"mt-3 inline-flex items-center gap-3 border border-line px-5 py-3 font-mono text-[11px] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:["Browse the catalog ",t("span",{className:"text-accent",children:"→"})]})]})}export{re as CartActions,Z as CartCouponRow,H as CartDrawerHeader,R as CartLineRow,Y as CartLines,X as CartStatusRail,te as CartTotals,ee as CartTrustMarkers,J as CartUpsell};
|
|
1
|
+
"use client";import{jsx as t,jsxs as a,Fragment as c}from"react/jsx-runtime";import u from"next/link";import{FIGURE_UPDATING as N,FREE_PRICE as b,UNPRICED_LABEL as k}from"../../lib/wheels/price-display.js";import w from"../CartLineThumbnail.js";import C from"../CouponField.js";import j from"../QuantityStepper.js";import T from"efficient-web-builder/render/components/RMark";import{lineTotal as y,useCart as d}from"../CartContext.js";import{COUPON_DEFERRED_TOTAL as B}from"../../lib/cart/coupon-preview.js";import{shippingWords as F,TAX_PENDING as S}from"../../lib/cart/shipping-status.js";import{useCurrency as g}from"../CurrencyContext.js";import{cartSubtitle as $}from"efficient-web-builder/format/lib/content/cart-drawer";function H({content:e,closeRef:r}){const{close:n,items:s}=d(),l=r;return a("header",{className:"flex flex-shrink-0 flex-col gap-4 border-b border-line px-8 pb-6 pt-8 max-[640px]:px-6 max-[640px]:pt-6 max-[640px]:pb-5",children:[a("div",{className:"flex items-center justify-between",children:[a("span",{className:"flex items-center gap-3 font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[e.kickerBadge?t("span",{className:"border px-2 py-1 text-[10px]",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 50%, transparent)"},children:e.kickerBadge}):null,(e.kickerBadge?"· ":"")+e.kickerText]}),t("button",{ref:l,type:"button",onClick:n,"aria-label":"Close cart",className:"flex h-8 w-8 items-center justify-center border border-line text-[14px] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"✕"})]}),a("h1",{className:"font-display text-[38px] font-medium uppercase leading-[0.95] tracking-[-0.03em] max-[640px]:text-[30px]",children:[e.titleLead+" ",t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.02em] normal-case",children:e.titleAccent})]}),t("p",{className:"font-serif text-[13px] italic leading-[1.5] text-fg-dim",children:$(e,s.length)})]})}function X({content:e}){const{totals:r}=d(),{activeCountry:n}=g(),s=n?.name??e.shipsToFallback,l=1+(e.leadTimeValue?1:0)+(s?1:0);return t(c,{children:a("div",{className:`grid flex-shrink-0 ${_[l-1]} gap-px border-b border-line bg-line`,children:[t(h,{label:"Items",value:a(c,{children:[t("em",{className:"font-serif font-normal italic text-accent",children:r.sets})," set",r.sets===1?"":"s"," · ",r.units," item",r.units===1?"":"s"]})}),e.leadTimeValue?t(h,{label:"Lead time",value:e.leadTimeValue}):null,s?t(h,{label:"Ships to",value:s}):null]})})}function Y({content:e,tyres:r}){const{items:n,remove:s,setQty:l}=d();return t(c,{children:n.length===0?t(I,{content:e}):n.map(o=>t(R,{line:o,tyre:r.get(o.slug),onRemove:()=>s(o.id),onQtyChange:m=>l(o.id,m)},o.id))})}function J(){const{items:e,totals:r,bundles:n}=d(),{formatMoney:s}=g(),l=new Set(e.flatMap(i=>(i.components??[]).map(x=>x.partNumber))),o=new Set(r.appliedBundles.map(i=>i.slug)),m=n.filter(i=>!o.has(i.slug)).filter(i=>i.components.some(x=>l.has(x.partNumber))).slice(0,2);return t(c,{children:m.length>0&&a("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",style:{background:"color-mix(in oklab, var(--site-surface) 60%, transparent)"},children:[a("div",{className:"mb-4 flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[t("span",{children:"You may also need"}),t("span",{className:"font-display text-[11px] normal-case tracking-[0.08em] text-fg-dim",children:"Buy together, save"})]}),t("div",{className:"grid grid-cols-2 gap-2 max-[640px]:grid-cols-1",children:m.map(i=>t(E,{href:`/bundles/${i.slug}`,title:i.name,sub:L(i,r.currency,s)},i.slug))})]})})}function Z(){return t(c,{children:t("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",children:t(C,{})})})}function ee({content:e}){return t(c,{children:e.promises.length>0&&t("div",{className:"flex flex-wrap justify-center gap-5 border-b border-line px-8 pt-6 pb-8 font-mono text-[9px] uppercase tracking-[0.24em] text-fg-dim max-[640px]:px-6",children:e.promises.map(r=>t(U,{children:r},r))})})}function te(){const{totals:e,coupon:r}=d(),{formatMoney:n}=g();return t(c,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-2 border-t border-line px-8 pt-5 max-[640px]:px-6",children:[t(p,{label:`Subtotal · ${e.sets} set${e.sets===1?"":"s"}`,value:n(e.subtotal,e.currency)}),e.appliedBundles.map(s=>t(p,{label:`Bundle · ${s.name}${s.multiples>1?` ×${s.multiples}`:""}`,value:a("span",{style:{color:"var(--green)"},children:["− ",n(s.discount,e.currency)]})},s.slug)),e.discount>0&&r?.valid&&t(p,{label:`Coupon · ${r.code}`,value:a("span",{style:{color:"var(--green)"},children:["− ",n(e.discount,e.currency)]})}),r?.deferred&&t(p,{label:`Coupon · ${r.code}`,value:B}),r?.valid&&r.effects?.gift&&t(p,{label:`Free gift · ${r.effects.gift.partNumber}${r.effects.gift.quantity>1?` ×${r.effects.gift.quantity}`:""}`,value:t("span",{style:{color:"var(--green)"},children:b})}),t(p,{label:"Shipping",value:e.shippingStatus==="free"?t("span",{style:{color:"var(--green)"},children:b}):F(e.shippingStatus)??n(e.shipping,e.currency)}),e.tax&&(e.tax.charged?t(p,{label:e.tax.inclusive?`${e.tax.name} included · ${e.tax.rate}%`:e.tax.name,value:n(e.tax.amount,e.currency)}):e.tax.name?t(p,{label:e.tax.name,value:S}):null),a("div",{className:"mt-2 flex items-center justify-between border-t border-line pt-4 text-fg",children:[a("span",{className:"font-display text-[22px] font-medium tracking-[-0.02em] normal-case",children:["Total ",t("em",{className:"font-serif font-normal italic text-accent",children:"due"})]}),t("span",{className:"text-right font-display text-[30px] font-medium tracking-[-0.025em] text-fg",children:e.repricing?N:n(e.grand,e.currency)})]})]})})}function re(){const{items:e,close:r}=d();return t(c,{children:a("div",{className:"flex flex-shrink-0 flex-col gap-3 px-8 pb-6 pt-4 max-[640px]:px-6",children:[a(u,{href:"/checkout",onClick:r,"aria-disabled":e.length===0,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[12px] uppercase tracking-[0.3em] transition-colors",e.length===0?"pointer-events-none cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:["Begin checkout",t("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}),t("div",{className:"flex items-center justify-between px-1 py-2 font-mono text-[10px] uppercase tracking-[0.24em] text-fg-dim",children:t(u,{href:"/wheels",onClick:r,className:"text-fg transition-colors hover:text-accent",children:"← Keep browsing"})})]})})}const _=["grid-cols-1","grid-cols-2","grid-cols-3"];function h({label:e,value:r}){return a("div",{className:"flex flex-col gap-1 bg-bg px-4 py-4",children:[t("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-fg-dim",children:e}),t("span",{className:"font-display text-[14px] font-medium tracking-[-0.005em] text-fg",children:r})]})}function R({line:e,tyre:r,onRemove:n,onQtyChange:s}){const{catalog:l,totals:o}=d(),m=(e.components??[]).reduce((f,v)=>f+(o.freeUnitsByPartNumber[v.partNumber]??0),0),{currency:i,formatMoney:x}=g();return a(c,{children:[a("article",{className:"grid grid-cols-[96px_1fr] gap-5 border-b border-line px-8 py-6 transition-colors hover:bg-[color-mix(in_oklab,var(--site-surface)_60%,transparent)] max-[640px]:grid-cols-[78px_1fr] max-[640px]:px-6 max-[640px]:py-5",children:[t(w,{line:e,catalog:l,tyre:r}),a("div",{className:"flex min-w-0 flex-col gap-2",children:[a("div",{className:"flex items-start justify-between gap-3",children:[a("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-accent",children:["N° ",e.positionNo," · ",e.process==="FusionForge®"?a(c,{children:["FusionForge",t(T,{})]}):e.process]}),t("span",{className:"whitespace-nowrap font-display text-[16px] font-medium tracking-[-0.015em] text-fg",children:y(e,i)===null?k:x(y(e,i),i)})]}),a("h3",{className:"mt-0.5 font-display text-[22px] font-medium uppercase leading-none tracking-[-0.02em]",children:[e.name.lead,t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em] normal-case",children:e.name.accent})]}),e.config.length>0&&a("div",{className:"mt-1 flex flex-wrap gap-2",children:[e.config.map(f=>t("span",{className:["border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em]",f.gold?"border-[color-mix(in_oklab,var(--accent)_45%,var(--site-line))] text-accent":"border-line text-fg-dim"].join(" "),children:f.label},f.label)),m>0&&a("span",{className:"border border-accent bg-accent px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em] text-bg",children:[m,"× free"]})]}),a("div",{className:"mt-3 flex items-center justify-between gap-3",children:[t(j,{value:e.qty,onChange:s,size:"small"}),a("div",{className:"flex gap-4 font-mono text-[10px] uppercase tracking-[0.22em]",children:[t(u,{href:e.href??`/wheels/${e.slug}`,className:"text-fg-dim transition-colors hover:text-accent",children:e.href?"View product":"Edit finish"}),t("button",{type:"button",onClick:n,className:"text-fg-dim transition-colors hover:text-alert",children:"Remove"})]})]})]})]}),e.verifiedFor&&a("div",{className:"mx-8 -mt-px flex items-start gap-3 border-t-0 px-4 py-4 font-display text-[13px] leading-[1.45] text-fg max-[640px]:mx-6",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 35%, var(--site-line))",borderTop:"0"},children:[t("span",{className:"flex-shrink-0 pt-px font-mono text-[10px] uppercase tracking-[0.24em] text-accent",children:"Fits"}),a("span",{children:["Verified for your ",t("strong",{className:"font-medium text-accent",children:e.verifiedFor}),". Final torque values shipped with the wheels."]})]})]})}function E({title:e,sub:r,href:n}){return a(u,{href:n,className:"flex items-center justify-between border border-line bg-bg px-4 py-3 text-left transition-colors hover:border-accent",children:[a("span",{className:"flex min-w-0 flex-col gap-1",children:[t("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-display text-[13px] font-medium tracking-[-0.005em] text-fg",children:e}),t("span",{className:"font-mono text-[9px] uppercase tracking-[0.22em] text-fg-dim",children:r})]}),t("span",{className:"ml-2 flex h-6 w-6 flex-shrink-0 items-center justify-center font-mono text-[13px] text-accent",style:{borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))",borderWidth:1,borderStyle:"solid"},children:"+"})]})}function L(e,r,n){const s=e.savings[r];if(s===void 0)return"Buy together";const l=n(s,r);return e.savingIsFrom?`Save from ${l}`:`Save ${l}`}function U({children:e}){return t("span",{className:"inline-flex items-center gap-2 before:text-[6px] before:text-accent before:content-['●']",children:e})}function p({label:e,value:r}){return a("div",{className:"flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:[t("span",{children:e}),t("strong",{className:"font-display text-[14px] font-normal tracking-[-0.005em] normal-case text-fg",children:r})]})}function I({content:e}){return a("div",{className:"flex flex-col items-center justify-center gap-3 px-8 py-20 text-center",children:[t("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:e.emptyKicker}),t("p",{className:"font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:e.emptyBody}),a(u,{href:"/wheels",className:"mt-3 inline-flex items-center gap-3 border border-line px-5 py-3 font-mono text-[11px] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:["Browse the catalog ",t("span",{className:"text-accent",children:"→"})]})]})}export{re as CartActions,Z as CartCouponRow,H as CartDrawerHeader,R as CartLineRow,Y as CartLines,X as CartStatusRail,te as CartTotals,ee as CartTrustMarkers,J as CartUpsell};
|