efficient-storefront-blocks 0.78.0 → 0.80.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 +26 -0
- package/dist/chunks/EditorPreviewCheckout-PSONSVRR.js +4 -0
- package/dist/chunks/{SiteEditorProvider-YTZPWUDV.js → SiteEditorProvider-PWHW2UA6.js} +1 -1
- package/dist/chunks/{chunk-4O66UMLS.js → chunk-3Q66B5NU.js} +1 -1
- package/dist/chunks/chunk-6MHGEO3D.js +320 -0
- package/dist/chunks/chunk-MCCDGDRW.js +1 -0
- package/dist/chunks/chunk-X5W6GJLI.js +1 -0
- package/dist/chunks/{fitment-data-VU5A7VKV.js → fitment-data-Q2TJ6FBU.js} +1 -1
- package/dist/contract.js +2 -2
- package/dist/editor/lib/document/blocks/commerce/ProductColour/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductColour/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductPrice/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductPrice/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/ProductSize/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/commerce/ProductSize/fields.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/SpecTable/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.js +1 -1
- package/dist/editor/lib/document/blocks/service/ContactCards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterEmailSignup/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMessaging/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/MessagingCards/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/OpeningHours/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/RateTable/fields.js +1 -1
- package/dist/editor/lib/document/box-header.d.ts +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 +0 -1
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +28 -34
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +46 -1
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/EuTyreLabelCard.js +1 -1
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/SpecTable.d.ts +2 -1
- package/dist/render/components/SpecTable.js +1 -1
- package/dist/render/components/WheelCardFrame.d.ts +3 -15
- package/dist/render/components/WheelCardFrame.js +1 -1
- package/dist/render/components/card-pieces/CardEyebrow.d.ts +6 -0
- package/dist/render/components/card-pieces/CardEyebrow.js +1 -0
- package/dist/render/components/card-pieces/CardName.d.ts +4 -0
- package/dist/render/components/card-pieces/CardName.js +1 -0
- package/dist/render/components/card-pieces/CardPicture.d.ts +18 -0
- package/dist/render/components/card-pieces/CardPicture.js +1 -0
- package/dist/render/components/card-pieces/CardSpecs.d.ts +20 -0
- package/dist/render/components/card-pieces/CardSpecs.js +1 -0
- package/dist/render/components/card-pieces/HostPart.d.ts +6 -0
- package/dist/render/components/card-pieces/HostPart.js +1 -0
- package/dist/render/components/card-pieces/ProductCardState.d.ts +1 -0
- package/dist/render/components/card-pieces/ProductCardState.js +1 -1
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +1 -0
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
- package/dist/render/components/wheels-plp/PlpCard.d.ts +1 -1
- package/dist/render/components/wheels-plp/PlpCard.js +1 -1
- package/dist/render/lib/api/index.d.ts +3 -0
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +46 -0
- package/dist/render/lib/checkout/pay-first.d.ts +5 -1
- package/dist/render/lib/checkout/pay-first.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductColour/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductColour/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductColour/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductColour/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductPrice/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductPrice/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductSize/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductSize/meta.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductSize/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/commerce/ProductSize/render.js +1 -0
- package/dist/render/lib/document/blocks/commerce/SpecTable/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/commerce/SpecTable/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/SpecTable/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/metas.d.ts +3 -0
- package/dist/render/lib/document/blocks/commerce/metas.js +1 -1
- package/dist/render/lib/document/blocks/commerce/renders.d.ts +3 -0
- package/dist/render/lib/document/blocks/commerce/renders.js +1 -1
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/lazy-draws.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-spec.d.ts +1 -0
- package/dist/render/lib/document/section-to-box-rows-spec.js +1 -0
- package/dist/render/lib/tyres/spec-sheet.d.ts +0 -2
- package/dist/render/lib/tyres/spec-sheet.js +1 -1
- package/dist/words.d.ts +12 -1
- package/dist/words.js +4 -4
- package/package.json +9 -4
- package/dist/chunks/EditorPreviewCheckout-IEFQC4T3.js +0 -4
- package/dist/chunks/chunk-LZTJCQ4A.js +0 -311
- package/dist/chunks/chunk-MZPZ4B7Y.js +0 -1
- package/dist/chunks/chunk-WC4XIVX3.js +0 -1
- /package/dist/chunks/{chunk-LZTJCQ4A.js.LEGAL.txt → chunk-6MHGEO3D.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-TI4ZGDSG.js → chunk-JUGY3EKR.js} +0 -0
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var g={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var Ue={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 J=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var x=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],ee=["highlight","quiet"],De=J.map(e=>e.style).filter(e=>x.some(t=>t.kind===e)).filter(e=>!ee.includes(e)),ze=[...x,{open:"*",close:"*",kind:"accent"}],$e=[...x,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var Be=["http","https","mailto","tel"];function v(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||Be.includes(t[1].toLowerCase())}var te=["width","profile","rim"];var We=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,Ge={width:[100,500],profile:[20,100],rim:[10,30]};function U(e){let t=We.exec(e??"");if(!t)return null;let n={width:Number(t[1]),profile:Number(t[2]),rim:Number(t[3])};return te.every(i=>{let[a,u]=Ge[i];return n[i]>=a&&n[i]<=u})?n:null}function T(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 ne(e){return[T({width:e.width}),T({width:e.width,profile:e.profile}),T(e)]}var S=["alloy-wheel","tyre"],re=["alloy-wheel"],L={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Qt=S.map(e=>({value:e,label:L[e]}));function w(e){return e==null?[...re]:Array.isArray(e)?S.filter(t=>e.includes(t)):[...re]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function D(e){return m(e).brand??""}function ie(e){return m(e).prices??void 0}function oe(e){return m(e).inStock!==!1}function le(e){let t=m(e),n=f(e)==="tyre"?t.rimDiameters:t.sizes;return Array.isArray(n)?n.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function z(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(t=>typeof t?.family=="string").map(t=>({family:t.family,color:t.color??null}))}function se(e){return z(e).map(t=>t.family)}function $(e){if(f(e)==="tyre")return[];let t=m(e);return Array.isArray(t.categories)?t.categories:t.process?[t.process]:[]}function ae(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function ue(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ce(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function pe(e){if(f(e)!=="tyre")return[];let t=m(e).sizes;return Array.isArray(t)?t.map(n=>U(typeof n=="string"?n:null)).filter(n=>n!==null):[]}var B=e=>typeof e=="string"&&e?e:void 0;var de=null;function fe(e,t){return t?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(n,r)=>Object.prototype.hasOwnProperty.call(t,r)?String(t[r]):n):e}function y(e,t){let n=de?de[e]:void 0;if(typeof n=="function"){try{let r=B(n(t??{}));if(r)return r}catch{}return fe(e,t)}return fe(B(n)??e,t)}var me="homepage";function W(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function _(e){return e.offersCommerce&&e.offersService?F:F.filter(t=>!t.needs||(t.needs==="commerce"?e.offersCommerce:e.offersService))}var G="#popup:";function he(e){return`${G}${e}`}function ge(e){return e.startsWith(G)&&e.slice(G.length).trim()||null}function P(e){return e===me?"/":`/${e}`}function A(e){return`/journal/${e}`}function R(e){return`/wheels/${e}`}function E(e,t){return`${P(e)}#${t}`}function Ye(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}function I(...e){let t=new Set,n=[];for(let r of e)for(let i of r?.content??[]){let a=Ye(i?.props?.anchor);if(!a)continue;let u=W(a);!u||t.has(u)||(t.add(u),n.push({slug:u,name:a}))}return n}function ye(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var He=()=>({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 O(e,t,n){if(!e)return"page";if(ge(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(ye(e))return"product";if(e.includes("#")){let r=e.slice(0,e.indexOf("#"));if(r===""||r==="/"||t.includes(r))return"anchor"}return e==="/"||t.includes(e)||n&&n.listingPaths.includes(n.targetOf(e))?"page":"custom"}function Pe(e,t){let n=He(),r=e.pages.map(l=>({value:P(l.slug),label:l.title})),i=t?.pageOptions?t.pageOptions(r):r,a=i.map(l=>l.value),u=e.pages.map(l=>({label:l.title,options:I(...l.docs).map(c=>({value:E(l.slug,c.slug),label:c.name}))})).filter(l=>l.options.length>0),p=l=>{switch(l){case"page":return{type:"select",options:i,placeholder:n.choosePage};case"anchor":return{type:"groups",groups:u,placeholder:u.length?n.chooseSection:n.noSections};case"blog":return{type:"select",options:e.posts.map(c=>({value:A(c.slug),label:c.title||c.slug})),placeholder:n.choosePost};case"product":return{type:"select",options:e.products.map(c=>({value:c.href,label:c.name||c.href})),placeholder:n.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(c=>({value:he(c.slug),label:c.title||c.slug})),placeholder:n.choosePopup};case"custom":return{type:"text"}}},s=_(e.offers).map(l=>({value:l.value,label:y(l.label),target:p(l.value),...l.value==="anchor"?{hint:n.sectionHint}:{},...l.value==="blog"||l.value==="product"||l.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!t)return{kinds:s,rules:{kindOf:l=>O(l,a),targetOf:l=>l,readFilter:()=>null,withFilter:l=>l}};let o=l=>{let c=t.withFilter(l,null);return t.listingPaths.includes(c)?c:l};return{kinds:s,rules:{kindOf:l=>O(l,a,{listingPaths:t.listingPaths,targetOf:o}),targetOf:o,readFilter:t.readFilter,withFilter:t.withFilter},filtersFor:l=>t.listingPaths.includes(l)?t.filtersFor(l):null}}function Y(e,t){return e.length===0?e:e.filter(n=>n.kind===void 0||n.kind===t)}function be(e,t){let n=t==="filter"?"filterOrder":"cardOrder",r=new Map;for(let i of e){let a=i[n];if(typeof a!="number"||!Number.isFinite(a))continue;let u=r.get(i.fieldKey);(u===void 0||a<u)&&r.set(i.fieldKey,a)}return i=>i?r.get(i):void 0}function Se(e,t,n,r){let i=new Map;for(let s of n){let o=s[r];typeof o=="number"&&i.set(s.fieldKey,o)}if(i.size===0)return e;let a=[],u=[];e.forEach((s,o)=>{let l=t(s);l&&(a.push(o),u.push({item:s,index:o,order:i.get(l)}))}),u.sort((s,o)=>s.order!==void 0&&o.order!==void 0?s.order-o.order||s.index-o.index:s.order!==void 0?-1:o.order!==void 0?1:s.index-o.index);let p=[...e];return a.forEach((s,o)=>{p[s]=u[o].item}),p.every((s,o)=>s===e[o])?e:p}function ke(e){return je(e,"filter")}var qe="collection";function H(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":qe},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[t]}function je(e,t){let n=new Set(e.filter(r=>r[t]===!1).map(r=>r.fieldKey));return r=>!r||!n.has(r)}function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function xe(e,t){let n=e?.[t];return Ze(n)?n:null}function Te(e,t,n,r){if(n==null&&r==null)return!0;let i=xe(e,t);return!(i===null||n!=null&&i<n||r!=null&&i>r)}var Ve={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Mn=Object.keys(Ve);var Le=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Qe={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Xe={diameters:"tyreSizes"};function Je(e){if(e.length===0)return[];let t=Le.filter(n=>e.every(r=>Qe[n].includes(r)));return t.filter(n=>{let r=Xe[n];return!r||!t.includes(r)})}function et(e){let t=new Set;for(let n of e)t.add(f(n));return[...t]}var we={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function tt(e,t,n,r=null){if(r!=="kind"&&t.kind&&f(e)!==t.kind)return!1;for(let i of Le){if(r===i)continue;let a=t[i];if(a.length===0)continue;let u=a.map(String);if(!Fe(e,i).some(p=>u.includes(p)))return!1}return!(r!=="price"&&!Te(ie(e),n,null,t.priceMax)||r!=="inStock"&&t.inStockOnly&&!oe(e))}var nt={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Fe(e,t){switch(t){case"tyreSizes":return[...new Set(pe(e).flatMap(ne))];case"brands":return D(e)?[D(e)]:[];case"finishes":return se(e);case"diameters":return le(e).map(String);case"collections":return $(e);case"pcds":return ae(e);case"tyreTypes":return ue(e);case"speedRatings":return ce(e)}}function rt(e){let t=new Map;for(let n of e)for(let r of z(n))r.color&&!t.has(r.family)&&t.set(r.family,r.color);return t}function _e(e,t,n,r=et(e),i=[]){let a=o=>ot(o,r,i),u=rt(e),p=Je(r).filter(o=>o!=="tyreSizes").filter(a).map(o=>{let l=t[o].map(String),c=new Set,M=new Map,k=new Map;for(let d of e){let b=Fe(d,o);for(let h of b)c.add(h);for(let h of new Set(b))k.set(h,(k.get(h)??0)+1);if(tt(d,t,n,o))for(let h of new Set(b))M.set(h,(M.get(h)??0)+1)}let ve=[...c].map(d=>({value:d,label:o==="diameters"?`${d}\u2033`:d,count:M.get(d)??0,checked:l.includes(d),swatch:o==="finishes"?u.get(d)??null:null})).sort((d,b)=>{if(o==="diameters")return Number(d.value)-Number(b.value);let h=(k.get(b.value)??0)-(k.get(d.value)??0);return h!==0?h:d.value.localeCompare(b.value)});return{key:o,label:nt[o],options:ve}}).filter(o=>o.options.length>it),s=[];for(let o of p){let l=lt(o.key,r,i);l!==void 0&&s.push({fieldKey:o.key,filterOrder:l})}return[...Se(p,o=>o.key,s,"filterOrder")]}var it=1;function Ae(e){return e.showCollection===!1?["collections"]:[]}function ot(e,t,n){return t.length===0||n.length===0?!0:t.some(r=>ke(Y(n,r))(H(e,r)))}function lt(e,t,n){if(n.length===0)return;let r;for(let i of t){let a=be(Y(n,i),"filter")(H(e,i));a!==void 0&&(r===void 0||a<r)&&(r=a)}return r}var q={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},j="type";var Re="AlloyWheelsListing";function Ee(e){return v(e.trim())}var C="/wheels",K="Products";function Ie(e,t){return t>1?`${K} \xB7 ${e}`:K}function Z(...e){for(let t of e){let n=(t?.content??[]).find(r=>r?.type===Re);if(n)return n.props??{}}return null}function N(...e){return Z(...e)!==null}function Oe(e,t){let n=e.filter(r=>N(...r.docs)).map(r=>P(r.slug));return n.length===0&&t.fallback?[C]:n}var V=[j,...Object.entries(q).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Ce(e){let t=e.indexOf("#"),n=t===-1?"":e.slice(t),r=t===-1?e:e.slice(0,t),i=r.indexOf("?");return{path:i===-1?r:r.slice(0,i),query:i===-1?"":r.slice(i+1),hash:n}}function st(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ke(e){let t=new URLSearchParams(Ce(e).query);for(let n of V){let r=t.get(n);if(r)return{param:n,value:r}}return null}function Q(e,t){let{path:n,query:r,hash:i}=Ce(e),a=r.split("&").filter(u=>u&&!V.includes(st(u.split("=")[0])));return t?.value&&a.push(`${encodeURIComponent(t.param)}=${encodeURIComponent(t.value)}`),`${n}${a.length?`?${a.join("&")}`:""}${i}`}function Ne(e,t){let n=Q(e,null);return t.includes(n)?n:e}function at(e,t,n=[]){return O(e,t,{listingPaths:n,targetOf:r=>Ne(r,n)})}function ut(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 Me="Product type",ct="AUD";function X(e,t){let n=t.listing??{},r=w(n.kinds),i=e.filter(s=>r.includes(f(s))),a=Ae(n),u=_e(i,we,ct,r,t.fieldUsage).filter(s=>!a.includes(s.key)).map(s=>({param:q[s.key],label:s.label,values:s.options.filter(o=>!o.value.includes(",")).map(o=>({value:o.value,label:o.label}))})).filter(s=>s.values.length>0),p=S.filter(s=>r.includes(s)&&i.some(o=>f(o)===s));return p.length>1&&u.unshift({param:j,label:Me,values:p.map(s=>({value:s,label:L[s]}))}),u}function pt(e){return t=>{let n=Oe(t,{fallback:e.offersCommerce}),r=t.filter(i=>N(...i.docs)).length;return{listingPaths:n,pageOptions:i=>{let a=i.map(u=>{let p=t.find(s=>P(s.slug)===u.value);return p&&N(...p.docs)?{...u,label:Ie(p.title,r)}:u});return r===0&&e.offersCommerce&&!a.some(u=>u.value===C)&&a.push({value:C,label:K}),a},filtersFor:i=>{if(!n.includes(i))return null;let a=t.find(u=>P(u.slug)===i);return X(e.catalogue,{listing:a?Z(...a.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ke,withFilter:Q}}}function dt(e){let t=pt({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),n=Pe({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:R(r.slug),name:r.name||r.slug})),offers:e.offers},t);return{...n,rules:{...n.rules,isSafe:Ee},filtersFor:n.filtersFor??(()=>null)}}function rr(e,t){return X(e,t)}export{C as BUILT_IN_LISTING_PATH,F as LINK_KINDS,V as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,Me as PRODUCT_TYPE_FILTER_LABEL,E as anchorPath,ut as fieldUsageFromAdminRows,at as inferLinkKind,N as isProductListingPage,Ee as isSafeLink,_ as linkKindsFor,dt as linkPickerSetup,rr as listingFilterFields,Z as listingNode,Ie as listingPageLabel,Ne as listingTarget,I as pageAnchors,P as pagePath,A as postPath,Oe as productListingPaths,Ke as readListingFilter,R as wheelPath,Q as withListingFilter};
|
|
1
|
+
var g={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var De={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 J=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var x=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],ee=["highlight","quiet"],ze=J.map(e=>e.style).filter(e=>x.some(n=>n.kind===e)).filter(e=>!ee.includes(e)),$e=[...x,{open:"*",close:"*",kind:"accent"}],Be=[...x,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var We=["http","https","mailto","tel"];function v(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let n=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!n||We.includes(n[1].toLowerCase())}var ne=["width","profile","rim"];var Ge=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,Ye={width:[100,500],profile:[20,100],rim:[10,30]};function U(e){let n=Ge.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return ne.every(i=>{let[a,u]=Ye[i];return t[i]>=a&&t[i]<=u})?t:null}function T(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 te(e){return[T({width:e.width}),T({width:e.width,profile:e.profile}),T(e)]}var S=["alloy-wheel","tyre"],re=["alloy-wheel"],L={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Xn=S.map(e=>({value:e,label:L[e]}));function w(e){return e==null?[...re]:Array.isArray(e)?S.filter(n=>e.includes(n)):[...re]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function D(e){return m(e).brand??""}function ie(e){return m(e).prices??void 0}function oe(e){return m(e).inStock!==!1}function le(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 z(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function se(e){return z(e).map(n=>n.family)}function $(e){if(f(e)==="tyre")return[];let n=m(e);return Array.isArray(n.categories)?n.categories:n.process?[n.process]:[]}function ae(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function ue(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ce(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function pe(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 B=e=>typeof e=="string"&&e?e:void 0;var de=null;function fe(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Object.prototype.hasOwnProperty.call(n,r)?String(n[r]):t):e}function y(e,n){let t=de?de[e]:void 0;if(typeof t=="function"){try{let r=B(t(n??{}));if(r)return r}catch{}return fe(e,n)}return fe(B(t)??e,n)}function W(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function me(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var he="homepage";var F=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"popup",label:"Popup"},{value:"custom",label:"Custom URL"}];function _(e){return e.offersCommerce&&e.offersService?F:F.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}var G="#popup:";function ge(e){return`${G}${e}`}function ye(e){return e.startsWith(G)&&e.slice(G.length).trim()||null}function P(e){return e===he?"/":`/${e}`}function A(e){return`/journal/${e}`}function R(e){return`/wheels/${e}`}function E(e,n){return`${P(e)}#${n}`}function I(...e){let n=new Set,t=[];for(let r of e)for(let i of r?.content??[]){let a=me(i?.props?.anchor);if(!a)continue;let u=W(a);!u||n.has(u)||(n.add(u),t.push({slug:u,name:a}))}return t}function Pe(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var He=()=>({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 O(e,n,t){if(!e)return"page";if(ye(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Pe(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 be(e,n){let t=He(),r=e.pages.map(l=>({value:P(l.slug),label:l.title})),i=n?.pageOptions?n.pageOptions(r):r,a=i.map(l=>l.value),u=e.pages.map(l=>({label:l.title,options:I(...l.docs).map(c=>({value:E(l.slug,c.slug),label:c.name}))})).filter(l=>l.options.length>0),p=l=>{switch(l){case"page":return{type:"select",options:i,placeholder:t.choosePage};case"anchor":return{type:"groups",groups:u,placeholder:u.length?t.chooseSection:t.noSections};case"blog":return{type:"select",options:e.posts.map(c=>({value:A(c.slug),label:c.title||c.slug})),placeholder:t.choosePost};case"product":return{type:"select",options:e.products.map(c=>({value:c.href,label:c.name||c.href})),placeholder:t.chooseProduct};case"popup":return{type:"select",options:(e.popups??[]).map(c=>({value:ge(c.slug),label:c.title||c.slug})),placeholder:t.choosePopup};case"custom":return{type:"text"}}},s=_(e.offers).map(l=>({value:l.value,label:y(l.label),target:p(l.value),...l.value==="anchor"?{hint:t.sectionHint}:{},...l.value==="blog"||l.value==="product"||l.value==="popup"?{hideWhenEmpty:!0}:{}}));if(!n)return{kinds:s,rules:{kindOf:l=>O(l,a),targetOf:l=>l,readFilter:()=>null,withFilter:l=>l}};let o=l=>{let c=n.withFilter(l,null);return n.listingPaths.includes(c)?c:l};return{kinds:s,rules:{kindOf:l=>O(l,a,{listingPaths:n.listingPaths,targetOf:o}),targetOf:o,readFilter:n.readFilter,withFilter:n.withFilter},filtersFor:l=>n.listingPaths.includes(l)?n.filtersFor(l):null}}function Y(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function Se(e,n){let t=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(let i of e){let a=i[t];if(typeof a!="number"||!Number.isFinite(a))continue;let u=r.get(i.fieldKey);(u===void 0||a<u)&&r.set(i.fieldKey,a)}return i=>i?r.get(i):void 0}function ke(e,n,t,r){let i=new Map;for(let s of t){let o=s[r];typeof o=="number"&&i.set(s.fieldKey,o)}if(i.size===0)return e;let a=[],u=[];e.forEach((s,o)=>{let l=n(s);l&&(a.push(o),u.push({item:s,index:o,order:i.get(l)}))}),u.sort((s,o)=>s.order!==void 0&&o.order!==void 0?s.order-o.order||s.index-o.index:s.order!==void 0?-1:o.order!==void 0?1:s.index-o.index);let p=[...e];return a.forEach((s,o)=>{p[s]=u[o].item}),p.every((s,o)=>s===e[o])?e:p}function xe(e){return je(e,"filter")}var qe="collection";function H(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":qe},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function je(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Te(e,n){let t=e?.[n];return Ze(t)?t:null}function Le(e,n,t,r){if(t==null&&r==null)return!0;let i=Te(e,n);return!(i===null||t!=null&&i<t||r!=null&&i>r)}var Ve={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Ut=Object.keys(Ve);var we=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],Qe={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},Xe={diameters:"tyreSizes"};function Je(e){if(e.length===0)return[];let n=we.filter(t=>e.every(r=>Qe[t].includes(r)));return n.filter(t=>{let r=Xe[t];return!r||!n.includes(r)})}function en(e){let n=new Set;for(let t of e)n.add(f(t));return[...n]}var Fe={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function nn(e,n,t,r=null){if(r!=="kind"&&n.kind&&f(e)!==n.kind)return!1;for(let i of we){if(r===i)continue;let a=n[i];if(a.length===0)continue;let u=a.map(String);if(!_e(e,i).some(p=>u.includes(p)))return!1}return!(r!=="price"&&!Le(ie(e),t,null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!oe(e))}var tn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function _e(e,n){switch(n){case"tyreSizes":return[...new Set(pe(e).flatMap(te))];case"brands":return D(e)?[D(e)]:[];case"finishes":return se(e);case"diameters":return le(e).map(String);case"collections":return $(e);case"pcds":return ae(e);case"tyreTypes":return ue(e);case"speedRatings":return ce(e)}}function rn(e){let n=new Map;for(let t of e)for(let r of z(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function Ae(e,n,t,r=en(e),i=[]){let a=o=>ln(o,r,i),u=rn(e),p=Je(r).filter(o=>o!=="tyreSizes").filter(a).map(o=>{let l=n[o].map(String),c=new Set,M=new Map,k=new Map;for(let d of e){let b=_e(d,o);for(let h of b)c.add(h);for(let h of new Set(b))k.set(h,(k.get(h)??0)+1);if(nn(d,n,t,o))for(let h of new Set(b))M.set(h,(M.get(h)??0)+1)}let Ue=[...c].map(d=>({value:d,label:o==="diameters"?`${d}\u2033`:d,count:M.get(d)??0,checked:l.includes(d),swatch:o==="finishes"?u.get(d)??null:null})).sort((d,b)=>{if(o==="diameters")return Number(d.value)-Number(b.value);let h=(k.get(b.value)??0)-(k.get(d.value)??0);return h!==0?h:d.value.localeCompare(b.value)});return{key:o,label:tn[o],options:Ue}}).filter(o=>o.options.length>on),s=[];for(let o of p){let l=sn(o.key,r,i);l!==void 0&&s.push({fieldKey:o.key,filterOrder:l})}return[...ke(p,o=>o.key,s,"filterOrder")]}var on=1;function Re(e){return e.showCollection===!1?["collections"]:[]}function ln(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>xe(Y(t,r))(H(e,r)))}function sn(e,n,t){if(t.length===0)return;let r;for(let i of n){let a=Se(Y(t,i),"filter")(H(e,i));a!==void 0&&(r===void 0||a<r)&&(r=a)}return r}var q={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},j="type";var Ee="AlloyWheelsListing";function Ie(e){return v(e.trim())}var C="/wheels",K="Products";function Oe(e,n){return n>1?`${K} \xB7 ${e}`:K}function Z(...e){for(let n of e){let t=(n?.content??[]).find(r=>r?.type===Ee);if(t)return t.props??{}}return null}function N(...e){return Z(...e)!==null}function Ce(e,n){let t=e.filter(r=>N(...r.docs)).map(r=>P(r.slug));return t.length===0&&n.fallback?[C]:t}var V=[j,...Object.entries(q).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Ke(e){let n=e.indexOf("#"),t=n===-1?"":e.slice(n),r=n===-1?e:e.slice(0,n),i=r.indexOf("?");return{path:i===-1?r:r.slice(0,i),query:i===-1?"":r.slice(i+1),hash:t}}function an(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ne(e){let n=new URLSearchParams(Ke(e).query);for(let t of V){let r=n.get(t);if(r)return{param:t,value:r}}return null}function Q(e,n){let{path:t,query:r,hash:i}=Ke(e),a=r.split("&").filter(u=>u&&!V.includes(an(u.split("=")[0])));return n?.value&&a.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${a.length?`?${a.join("&")}`:""}${i}`}function Me(e,n){let t=Q(e,null);return n.includes(t)?t:e}function un(e,n,t=[]){return O(e,n,{listingPaths:t,targetOf:r=>Me(r,t)})}function cn(e){return Array.isArray(e)?e.filter(n=>typeof n?.kind=="string"&&typeof n.field_key=="string").map(n=>({kind:n.kind,fieldKey:n.field_key,...typeof n.filter=="boolean"?{filter:n.filter}:{},filterOrder:n.filter_order??null})):[]}var ve="Product type",pn="AUD";function X(e,n){let t=n.listing??{},r=w(t.kinds),i=e.filter(s=>r.includes(f(s))),a=Re(t),u=Ae(i,Fe,pn,r,n.fieldUsage).filter(s=>!a.includes(s.key)).map(s=>({param:q[s.key],label:s.label,values:s.options.filter(o=>!o.value.includes(",")).map(o=>({value:o.value,label:o.label}))})).filter(s=>s.values.length>0),p=S.filter(s=>r.includes(s)&&i.some(o=>f(o)===s));return p.length>1&&u.unshift({param:j,label:ve,values:p.map(s=>({value:s,label:L[s]}))}),u}function dn(e){return n=>{let t=Ce(n,{fallback:e.offersCommerce}),r=n.filter(i=>N(...i.docs)).length;return{listingPaths:t,pageOptions:i=>{let a=i.map(u=>{let p=n.find(s=>P(s.slug)===u.value);return p&&N(...p.docs)?{...u,label:Oe(p.title,r)}:u});return r===0&&e.offersCommerce&&!a.some(u=>u.value===C)&&a.push({value:C,label:K}),a},filtersFor:i=>{if(!t.includes(i))return null;let a=n.find(u=>P(u.slug)===i);return X(e.catalogue,{listing:a?Z(...a.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ne,withFilter:Q}}}function fn(e){let n=dn({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=be({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:R(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Ie},filtersFor:t.filtersFor??(()=>null)}}function or(e,n){return X(e,n)}export{C as BUILT_IN_LISTING_PATH,F as LINK_KINDS,V as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,ve as PRODUCT_TYPE_FILTER_LABEL,E as anchorPath,cn as fieldUsageFromAdminRows,un as inferLinkKind,N as isProductListingPage,Ie as isSafeLink,_ as linkKindsFor,fn as linkPickerSetup,or as listingFilterFields,Z as listingNode,Oe as listingPageLabel,Me as listingTarget,I as pageAnchors,P as pagePath,A as postPath,Ce as productListingPaths,Ne as readListingFilter,R as wheelPath,Q as withListingFilter};
|
|
@@ -1311,6 +1311,13 @@ body:has([data-page-width="full"]) footer {
|
|
|
1311
1311
|
@theme {
|
|
1312
1312
|
--breakpoint-view-tablet: 720px;
|
|
1313
1313
|
--breakpoint-view-desktop: 1100px;
|
|
1314
|
+
/* THE WIDE LINE: below it a page draws its phone layout (`max-view-wide:`),
|
|
1315
|
+
from it the wide one (`view-wide:`). Under the v1 rules it is 800, the line
|
|
1316
|
+
every hand-typed `max-[800px]:` / `min-[800px]:` drew, and it compiles to
|
|
1317
|
+
the same `width < 800px` / `width >= 800px`. The switch to the v2 rules
|
|
1318
|
+
(three-views plan PR 11) moves it to 720, the Tablet view's edge, in this
|
|
1319
|
+
one line; the same guard holds it to the rules in force. */
|
|
1320
|
+
--breakpoint-view-wide: 800px;
|
|
1314
1321
|
}
|
|
1315
1322
|
|
|
1316
1323
|
@theme inline {
|
|
@@ -2591,16 +2598,42 @@ em.text-accent {
|
|
|
2591
2598
|
take its parent's. Every zone resets it here; a container's own value is
|
|
2592
2599
|
inline and beats this rule, and its blocks still inherit that value. */
|
|
2593
2600
|
--sf-gap-len-phone: initial;
|
|
2601
|
+
--sf-gap-len-tablet: initial;
|
|
2594
2602
|
}
|
|
2595
2603
|
/* Below 800px: the container's own phone Gap when it stores one (C25 row 2,
|
|
2596
2604
|
Lewis 2026-10-29: `--sf-gap-len-phone`, written by efficient-web-builder's
|
|
2597
2605
|
`containerGapProps`), else half the desktop length (the 2026-09-03 ruling).
|
|
2598
|
-
|
|
2606
|
+
A container that follows the site names the site's phone gap instead
|
|
2607
|
+
(`var(--sf-block-gap-on-phone)`, efficient-web-builder 47.2.0, #436), which
|
|
2608
|
+
is defined only below 720px on a site that stores one. With no phone value
|
|
2609
|
+
the declaration is invalid and the fallback is the old one, so no page moves. */
|
|
2599
2610
|
@media (max-width: 800px) {
|
|
2600
2611
|
.sf-gap-zone {
|
|
2601
2612
|
gap: var(--sf-gap-len-phone, calc(var(--sf-gap-len) / 2));
|
|
2602
2613
|
}
|
|
2603
2614
|
}
|
|
2615
|
+
/* The Tablet view's own Gap (three-views plan PR 5b; GG 2026-11-03), on
|
|
2616
|
+
`--sf-gap-len-tablet`, which efficient-web-builder's `containerGapProps`
|
|
2617
|
+
writes only when a tablet value is drawn, as it does the phone's. The widths
|
|
2618
|
+
are the Tablet view's: efficient-easel's VIEW_TABLET_MIN (720) up to, not
|
|
2619
|
+
including, VIEW_DESKTOP_MIN (1100), the builder's lib/content/view-values
|
|
2620
|
+
`TABLET_MEDIA`, the same string. The fallback is TODAY'S answer at each
|
|
2621
|
+
width, so a zone with no tablet value draws what it drew before: the desktop
|
|
2622
|
+
length from 800 up, and from 720 to 800 the phone rule above (its own phone
|
|
2623
|
+
length, else half). The second block restates that part, after the first.
|
|
2624
|
+
An empty PHONE value keeps the phone rule: it does not follow the tablet
|
|
2625
|
+
(GG 2026-11-03, the named exception in plan row 5b).
|
|
2626
|
+
scripts/test-gap-tablet-css.ts holds all of it. */
|
|
2627
|
+
@media (min-width: 720px) and (max-width: 1099.98px) {
|
|
2628
|
+
.sf-gap-zone {
|
|
2629
|
+
gap: var(--sf-gap-len-tablet, var(--sf-gap-len));
|
|
2630
|
+
}
|
|
2631
|
+
}
|
|
2632
|
+
@media (min-width: 720px) and (max-width: 800px) {
|
|
2633
|
+
.sf-gap-zone {
|
|
2634
|
+
gap: var(--sf-gap-len-tablet, var(--sf-gap-len-phone, calc(var(--sf-gap-len) / 2)));
|
|
2635
|
+
}
|
|
2636
|
+
}
|
|
2604
2637
|
/* A shared-rows card grid (`.sf-card-rows`, components/WheelCardFrame) moves
|
|
2605
2638
|
its row gap onto the cards as a margin, so `gap` above does not reach it.
|
|
2606
2639
|
Its phone answer is this property, named by the grid ONLY when it stores a
|
|
@@ -2614,6 +2647,18 @@ em.text-accent {
|
|
|
2614
2647
|
--sf-card-row-gap-auto: var(--sf-gap-len-phone, var(--sf-gap-len));
|
|
2615
2648
|
}
|
|
2616
2649
|
}
|
|
2650
|
+
/* …and in the Tablet view, its tablet length, with the same fallbacks as the
|
|
2651
|
+
zone's above. */
|
|
2652
|
+
@media (min-width: 720px) and (max-width: 1099.98px) {
|
|
2653
|
+
.sf-card-rows {
|
|
2654
|
+
--sf-card-row-gap-auto: var(--sf-gap-len-tablet, var(--sf-gap-len));
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
@media (min-width: 720px) and (max-width: 800px) {
|
|
2658
|
+
.sf-card-rows {
|
|
2659
|
+
--sf-card-row-gap-auto: var(--sf-gap-len-tablet, var(--sf-gap-len-phone, var(--sf-gap-len)));
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2617
2662
|
|
|
2618
2663
|
/* The overlap below zero halves on the same screen, for the same reason and by
|
|
2619
2664
|
the same ruling. It needs its OWN derived property rather than redefining
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a,jsxs as
|
|
1
|
+
import{jsx as a,jsxs as i}from"react/jsx-runtime";import{noiseLabel as l}from"../lib/tyres/eu-tyre-label.js";const n={headingSmall:"text-[length:var(--size-headingSmall,22px)]",labelSmall:"text-[length:var(--size-label,11px)]",labelLarge:"text-[length:var(--size-label,12px)]"};function o(e){const r=[];e.fuelClass&&r.push({key:"Fuel efficiency",value:e.fuelClass}),e.wetGripClass&&r.push({key:"Wet grip",value:e.wetGripClass});const t=l(e);return t&&r.push({key:"Rolling noise",value:t}),e.loadIndicator&&r.push({key:"Reinforced",value:e.loadIndicator}),r}function c(e){const r=[];return e.severeSnow&&r.push("3PMSF severe snow"),e.iceGrip&&r.push("Ice grip"),r}function m({label:e}){const r=o(e),t=c(e);return i("div",{className:"flex flex-col bg-[var(--card-bg)] p-5",children:[a("h3",{className:`font-heading3 ${n.headingSmall} font-medium leading-tight`,children:e.size}),a("dl",{className:`mt-3 flex flex-col gap-2 font-mono ${n.labelLarge}`,children:r.map(s=>i("div",{className:"flex items-baseline justify-between gap-3",children:[a("dt",{className:"uppercase tracking-[0.14em] text-fg-dim",children:s.key}),a("dd",{className:"text-right text-fg",children:s.value})]},s.key))}),t.length>0?a("ul",{className:"mt-3 flex flex-wrap gap-2",children:t.map(s=>a("li",{className:`border border-line px-2 py-1 font-mono ${n.labelSmall} uppercase tracking-[0.14em] text-fg-dim`,children:s},s))}):null,i("a",{href:e.eprelUrl,target:"_blank",rel:"noopener noreferrer",className:`group mt-4 inline-flex items-center gap-2 border-t border-line pt-3 font-mono ${n.labelLarge} uppercase tracking-[0.2em] text-accent transition-colors hover:text-fg`,children:[`EPREL ${e.registrationNumber}`,a("span",{"aria-hidden":!0,className:"transition-transform group-hover:translate-x-1",children:"→"})]})]})}export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,Fragment as N,jsxs as R}from"react/jsx-runtime";import U from"next/image";import{useState as X}from"react";import{setSecondSrc as q}from"../lib/wheels/set-mode.js";import{CARD_INDEX_BADGE_CLASS as G,CARD_INDEX_CLASS as H}from"efficient-web-builder/format/lib/sections/product-card-style";import{coverSrcForWheel as M,resolvePaintedSrc as O}from"../lib/wheels/cover-rendering.js";import{wheelCardEyebrow as J,withSetChip as K}from"./ProductCardEyebrow.js";import{withRMark as Q}from"efficient-web-builder/render/components/RMark";import T from"./WheelPlaceholder.js";import{useProductCardChrome as V}from"./ProductCardChrome.js";import Y,{CardBuyDialog as Z}from"./card-pieces/CardBuyButton.js";import ee from"./card-pieces/CardFinishSwatches.js";import re from"./card-pieces/CardPrice.js";import oe from"./card-pieces/CardProductBadge.js";import{useWheelCardState as te,WheelCardStateProvider as se}from"./card-pieces/ProductCardState.js";import{CardSpecFacts as ie}from"./card-pieces/CardSpecs.js";import ae from"./WheelCardFrame.js";function ne({wheel:a,variant:s="compact",defaultFinish:r}){return e(se,{wheel:a,defaultFinish:r,children:e(de,{variant:s})})}function de({variant:a}){const s=a==="catalog",{wheel:r,sel:t,isSet:n}=te(),{imageBackgroundFill:S,spinOnHover:b,coverIndex:B,indexBadge:m,outline:y,showBadge:F,fieldUsage:h,reserveEyebrow:x,showCardPrice:E,showCardFinishes:P,showCardSizes:k,showCardBuy:u,showCardPage:f,imageSizes:v}=V(),d=s&&(u||f),$=M(r,B,t.finish?.name,t.shownSrc),_="h-full w-full",z=b?`transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)] ${s?"group-hover:rotate-[72deg]":"group-hover:rotate-[60deg]"}`:"",[g,A]=X(()=>new Set),D=o=>A(i=>i.has(o)?i:new Set(i).add(o)),c=O({overrideSrc:$,hookSrc:t.shownSrc,failed:g}),p=(o,i)=>e(U,{src:o,alt:i,width:1e3,height:1e3,sizes:v,className:`block object-contain ${z} ${_}`,draggable:!1,onError:()=>D(o)},o),w=t.finish?`${r.name} — ${t.finish.name}`:r.name,I=c?p(c,w):e(T,{imageLabel:r.name}),l=n?q(r.finishes?.find(o=>o.name===t.finish?.name),c):null,L=l&&!g.has(l)?p(l,`${w} — right`):void 0,C=J({kindLabel:null,brand:null,process:r.process?Q(r.process):null},h),j=n&&!s?K(C):C,W=m!=="off"?e("span",{"aria-hidden":!0,className:`${H} ${G}`}):null;return R(N,{children:[e(ae,{variant:a,wide:n&&s,href:`/wheels/${r.slug}`,outline:y,imageBackgroundFill:S,probes:t.probes,reserveEyebrow:x,indexBadge:W,badges:e(oe,{show:F,numbered:m!=="off",axleSets:!0}),image:I,imageSecond:L,eyebrow:j,spec:e(ie,{sizes:k,fieldUsage:h}),price:e(re,{show:E,quoteSets:!0}),swatches:e(ee,{show:P}),identityLink:d,wholeCardLink:!0,buy:e(Y,{buy:d&&u,page:d&&f})}),e(Z,{})]})}export{ne as default};
|
|
@@ -14,6 +14,7 @@ export interface SpecTableProps {
|
|
|
14
14
|
editing?: boolean;
|
|
15
15
|
nodeId?: string;
|
|
16
16
|
omitHead?: boolean;
|
|
17
|
+
template?: unknown;
|
|
17
18
|
capped?: boolean;
|
|
18
19
|
}
|
|
19
|
-
export default function SpecTable({ num, title, description, rows, builtInLabels, diagram, editing, omitHead, nodeId, capped, }: SpecTableProps): import("react").JSX.Element;
|
|
20
|
+
export default function SpecTable({ num, title, description, rows, builtInLabels, diagram, editing, omitHead, nodeId, capped, template, }: SpecTableProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as E,jsx as e,jsxs as l}from"react/jsx-runtime";import z from"./SectionBand.js";import{useScopeClass as I}from"../lib/use-scope-class.js";import{useState as C}from"react";import R from"efficient-web-builder/render/components/SectionHeader";import{CardTemplateRows as D}from"efficient-web-builder/render/components/CardRowContext";import j from"./WheelSvg.js";import{renderGold as w,renderHeadline as V}from"efficient-web-builder/render/components/goldPhrases";import{inchLabel as y}from"../lib/wheels/spec-format.js";import W from"./DimensionArrowMarkers.js";import B from"./SpecTablePartBridge.js";import{SPEC_REGION_ATTR as A}from"efficient-web-builder/format/lib/sections/spec-table-regions";import{say as _}from"efficient-web-builder/format/lib/editor-words";import{applyShopMark as M}from"efficient-web-builder/format/lib/markup";import{useEnglish as P}from"./EnglishVariant.js";import{sizedImage as G}from"efficient-web-builder/format/lib/sized-image";const $={between:"[&>*+*]:border-t [&>*+*]:border-line",every:"[&>*]:border-t [&>*]:border-line"},T="[&_sup.text-accent.tracking-normal]:static [&_sup.text-accent.tracking-normal]:align-baseline [&_sup.text-accent.tracking-normal]:[font-size:inherit] [&_sup.text-accent.tracking-normal]:text-current [&_sup.text-accent.tracking-normal]:tracking-[inherit]",H="(max-width: 1100px) 80vw, 290px",d={labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,14px)]"};function r(i,a){return i?{[A]:a}:{}}function O({editing:i,nodeId:a,children:n}){return!i||!a?e(E,{children:n}):e(B,{nodeId:a,children:n})}function L({row:i,topBorder:a,editing:n}){return l("div",{className:`flex items-baseline justify-between gap-6 py-4 font-mono ${d.labelLarge} tracking-[0.05em] ${a?"border-t border-line":""}`,children:[e("span",{...r(n,"rowLabel"),className:"uppercase text-fg-dim",children:i.label}),e("span",{...r(n,"rowValue"),className:`text-right ${i.accent?"text-accent":"text-fg"}`,children:i.value})]})}function F({diagram:i,editing:a}){const[n,b]=C(!1),o=I("spec"),{wheelName:p,imageSrc:s,diameter:f,width:x,offset:h,holes:v,pcd:S,spokes:m,mesh:c,bore:N}=i,g=!!s&&!n;return l("div",{className:"sf-card bg-surface p-6 max-[1100px]:mt-8",children:[e("div",{...r(a,"diagramTitle"),className:`mb-3 font-mono ${d.label} uppercase tracking-[0.25em] text-fg-dim`,children:"Wheel Dimension Diagram"}),l("div",{className:"relative flex aspect-square items-center justify-center",children:[l("svg",{viewBox:"0 0 320 320",className:"absolute inset-0 h-full w-full text-fg-dim",fill:"none",stroke:"currentColor",children:[e("line",{x1:40,y1:20,x2:280,y2:20,strokeWidth:1,markerStart:`url(#${o}-L)`,markerEnd:`url(#${o}-R)`}),e("line",{x1:40,y1:15,x2:40,y2:25,strokeWidth:1}),e("line",{x1:280,y1:15,x2:280,y2:25,strokeWidth:1}),e(W,{id:o})]}),g?e("img",{...G(s,{fallbackWidth:960}),sizes:H,alt:`${p} — face`,onError:()=>b(!0),loading:"lazy",className:"relative z-[1] block h-[80%] w-[80%] object-contain"}):e(j,{spokes:m,mesh:c,className:"relative z-[1] block h-[72%] w-[72%] text-accent"}),l("span",{...r(a,"diagramCallout"),className:`absolute top-1.5 left-1/2 z-20 -translate-x-1/2 bg-surface px-2 font-mono ${d.label} tracking-[0.2em] text-accent`,children:["⌀ ",y(f)]}),l("span",{...r(a,"diagramCallout"),className:`absolute bottom-1.5 left-1/2 z-20 -translate-x-1/2 bg-surface px-2 font-mono ${d.label} tracking-[0.2em] text-fg`,children:["WIDTH ",y(x)]})]}),l("div",{className:`mt-4 grid grid-cols-5 gap-3 font-mono ${d.labelSmall} uppercase tracking-[0.2em] text-fg-dim max-[480px]:grid-cols-3`,children:[l("div",{children:[e("div",{...r(a,"diagramStatLabel"),className:"text-fg-dim/60",children:"Holes"}),e("div",{...r(a,"diagramStatValue"),className:"mt-1 text-fg",children:v})]}),l("div",{children:[e("div",{...r(a,"diagramStatLabel"),className:"text-fg-dim/60",children:"PCD"}),e("div",{...r(a,"diagramStatValue"),className:"mt-1 text-fg",children:S})]}),l("div",{children:[e("div",{...r(a,"diagramStatLabel"),className:"text-fg-dim/60",children:"Spokes"}),l("div",{...r(a,"diagramStatValue"),className:"mt-1 text-fg",children:[m,c?" + Mesh":""]})]}),l("div",{children:[e("div",{...r(a,"diagramStatLabel"),className:"text-fg-dim/60",children:"Bore"}),e("div",{...r(a,"diagramStatValue"),className:"mt-1 text-fg",children:N})]}),l("div",{children:[e("div",{...r(a,"diagramStatLabel"),className:"text-fg-dim/60",children:"ET"}),e("div",{...r(a,"diagramStatValue"),className:"mt-1 text-accent",children:h})]})]})]})}function Y({num:i,title:a,description:n,rows:b,builtInLabels:o=!1,diagram:p,editing:s=!1,omitHead:f=!1,nodeId:x,capped:h=!0,template:v}){const S=P(),m=(b??[]).filter(t=>(t?.label??"").trim()||(t?.value??"").trim()).map(t=>o&&t.label?{...t,label:S(t.label)}:t),c=m.length>0?m:s?[{label:_("Label"),value:_("Value")}]:[],N=c.map(t=>({label:t.label??"",value:t.accent&&t.value?M(t.value,0,t.value.length,"highlight").text:t.value??""})),g=t=>p?l("div",{className:"grid grid-cols-[1fr_400px] gap-12 max-[1100px]:grid-cols-1",children:[e("div",{className:t?`${$.between} ${T}`:void 0,children:t??c.map((k,u)=>e(L,{row:k,topBorder:u>0,editing:s},u))}),e(F,{diagram:p,editing:s})]}):e("div",{className:`grid grid-cols-2 gap-x-16 max-[900px]:grid-cols-1${t?` ${$.every} ${T}`:""}`,children:t??c.map((k,u)=>e(L,{row:k,topBorder:!0,editing:s},u))});return e(z,{className:f?"border-b border-line pt-0 pb-[120px] max-[1100px]:pt-0 max-[1100px]:pb-20":"border-b border-line py-[120px] max-[1100px]:py-20",capped:h,children:l(O,{editing:s,nodeId:x,children:[f?null:e(R,{num:i?w(i):void 0,title:a?V(a,!1):void 0,description:n?w(n):void 0,accent:!0}),e(D,{ownerId:x??"",ownerType:"SpecTable",Template:v,rows:N,fallback:g(),children:t=>g(t)})]})})}export{Y as default};
|
|
@@ -5,20 +5,8 @@ export declare const cardRowsGridStyle: (rowGap: string) => CSSProperties;
|
|
|
5
5
|
export declare const cardRowsGap: (zone: {
|
|
6
6
|
style: CSSProperties;
|
|
7
7
|
}) => string;
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export declare const CARD_PAD_X_PX = 32;
|
|
11
|
-
export declare const setBandGapPx: (showImageBackground: boolean) => number;
|
|
12
|
-
export declare const setBandGapCss: (showImageBackground: boolean, gridGap?: string) => string;
|
|
13
|
-
export declare const SET_PLATE_PX = 252;
|
|
14
|
-
export declare const SET_STACK_GAP_PX = 16;
|
|
15
|
-
export declare const SET_STACK_MAX_PX = 800;
|
|
16
|
-
export declare const CARD_SPEC_FIELD_CLASS = "whitespace-nowrap";
|
|
17
|
-
export type CardSpecField = string | {
|
|
18
|
-
readonly text: string;
|
|
19
|
-
readonly accent: boolean;
|
|
20
|
-
};
|
|
21
|
-
export declare function cardSpecFields(fields: readonly CardSpecField[], separator?: string): ReactNode;
|
|
8
|
+
export { CARD_PAD_X_PX, GRID_GAP_PX, SET_PLATE_PX, SET_STACK_GAP_PX, SET_STACK_MAX_PX, setBandGapCss, setBandGapPx, setPlateWidthCss, } from "./card-pieces/CardPicture.js";
|
|
9
|
+
export { CARD_SPEC_FIELD_CLASS, cardSpecFields, type CardSpecField } from "./card-pieces/CardSpecs.js";
|
|
22
10
|
export default function WheelCardFrame({ variant, wide, setGridGap, href, identityLink, outline, imageBackgroundFill, containerProps, probes, indexBadge, badges, image, imageSecond, plate, eyebrow, reserveEyebrow, name, spec, price, swatches, sizes, buy, wholeCardLink, }: {
|
|
23
11
|
variant?: "compact" | "catalog";
|
|
24
12
|
wide?: boolean;
|
|
@@ -36,7 +24,7 @@ export default function WheelCardFrame({ variant, wide, setGridGap, href, identi
|
|
|
36
24
|
plate?: ReactNode;
|
|
37
25
|
eyebrow?: ReactNode;
|
|
38
26
|
reserveEyebrow?: boolean;
|
|
39
|
-
name
|
|
27
|
+
name?: ReactNode;
|
|
40
28
|
spec?: ReactNode;
|
|
41
29
|
price?: ReactNode;
|
|
42
30
|
swatches?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r,Fragment as p,jsxs as o}from"react/jsx-runtime";import{GAP_LENGTH_VAR as y,GAP_PHONE_LENGTH_VAR as j}from"efficient-web-builder/format/lib/content/container-gap";import g from"next/link";import{CardLookContext as k,CardRow as s}from"./card-pieces/card-row.js";import I from"./card-pieces/CardEyebrow.js";import O from"./card-pieces/CardName.js";import W from"./card-pieces/CardPicture.js";import{CardSpecLine as B}from"./card-pieces/CardSpecs.js";import{cardOutlineClass as H}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as K}from"efficient-web-builder/format/lib/content/card-image-background";const ar="sf-card-rows",or=a=>({rowGap:0,"--sf-card-row-gap":a}),sr=a=>j in a.style?"var(--sf-card-row-gap-auto)":`var(${y})`;import{CARD_PAD_X_PX as cr,GRID_GAP_PX as ir,SET_PLATE_PX as lr,SET_STACK_GAP_PX as dr,SET_STACK_MAX_PX as nr,setBandGapCss as fr,setBandGapPx as pr,setPlateWidthCss as mr}from"./card-pieces/CardPicture.js";import{CARD_SPEC_FIELD_CLASS as gr,cardSpecFields as wr}from"./card-pieces/CardSpecs.js";function M({variant:a="catalog",wide:m=!1,setGridGap:w,href:e,identityLink:C=!1,outline:x="none",imageBackgroundFill:u=K,containerProps:_,probes:t,indexBadge:c,badges:i,image:h,imageSecond:A,plate:G,eyebrow:P,reserveEyebrow:v=!1,name:S,spec:R,price:b,swatches:E,sizes:L,buy:D,wholeCardLink:F=!1}){const N=a==="catalog",T=r(W,{image:h,imageSecond:A,plate:G,wide:m,imageBackgroundFill:u,setGridGap:w}),l=[N?"sf-card sf-card-fill group relative flex min-h-[460px] flex-col bg-[var(--card-bg)] px-8 pt-8 pb-8 transition-colors duration-200 hover:bg-[var(--card-bg-hover)] [.sf-card-rows>&]:row-span-9 [.sf-card-rows>&]:mb-[var(--sf-card-row-gap)] [.sf-card-rows>&]:grid [.sf-card-rows>&]:grid-rows-subgrid [.sf-card-rows>&]:gap-y-0":"sf-card sf-card-fill group relative block bg-[var(--card-bg)] p-5 transition-colors duration-300 hover:bg-[var(--card-bg-hover)]",H(x),m?"col-span-2 max-[800px]:col-span-1 @max-[720px]:col-span-1":""].filter(Boolean).join(" "),d=o(p,{children:[T,r(I,{reserve:v,children:P}),r(O,{children:S})]}),n=o(p,{children:[r(B,{children:R}),b??o(p,{children:[r(s,{}),r(s,{})]}),E??r(s,{}),L??r(s,{}),D??r(s,{})]}),f=X=>r(k.Provider,{value:a,children:X});return f(e?C?o("article",{..._,className:l,children:[t,c,i,r(g,{href:e,className:`flex flex-col ${F?"after:absolute after:inset-0 after:content-['']":""} [.sf-card-rows>*>&]:row-span-3 [.sf-card-rows>*>&]:grid [.sf-card-rows>*>&]:grid-rows-subgrid [.sf-card-rows>*>&]:gap-y-0`,children:d}),n]}):o(g,{href:e,className:l,children:[t,c,i,d,n]}):o("article",{..._,className:l,children:[t,c,i,d,n]}))}export{cr as CARD_PAD_X_PX,ar as CARD_ROWS_GRID_CLASS,gr as CARD_SPEC_FIELD_CLASS,ir as GRID_GAP_PX,lr as SET_PLATE_PX,dr as SET_STACK_GAP_PX,nr as SET_STACK_MAX_PX,sr as cardRowsGap,or as cardRowsGridStyle,wr as cardSpecFields,M as default,fr as setBandGapCss,pr as setBandGapPx,mr as setPlateWidthCss};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{CARD_TEXT_SIZE as o,CardRow as s,useCatalogCard as c}from"./card-row.js";function i({children:a,reserve:n=!1}){const r=c(),t=`font-mono ${o.label} uppercase text-accent ${r?"tracking-[0.3em]":"tracking-[0.25em]"}`,l=a?e("div",{className:t,children:a}):r&&n?e("div",{"aria-hidden":!0,className:t,children:" "}):null;return e(s,{children:l})}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{withRMark as t}from"efficient-web-builder/render/components/RMark";import{CARD_TEXT_SIZE as n,useCatalogCard as d}from"./card-row.js";import{useProductCardStateOrNull as i}from"./ProductCardState.js";function m({children:a}){const o=d(),e=i();return a===void 0&&e?.kind!=="wheel"&&process.env.NODE_ENV!=="production"&&console.warn("[CardName] no name given and no wheel card state: the name block is empty"),r("div",{className:o?`mt-2 h-[60px] overflow-hidden break-words [.sf-card-rows_&]:h-auto [.sf-card-rows_&]:max-h-[60px] font-heading3 ${n.headingSmall2} font-medium uppercase leading-none tracking-[-0.02em]`:`mt-2 font-heading3 ${n.headingSmall1} font-medium tracking-[-0.02em]`,children:a??(e?.kind==="wheel"?t(e.wheel.name):null)})}export{m as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export declare const setPlateWidthCss: (gap: number | string) => string;
|
|
3
|
+
export declare const GRID_GAP_PX = 2;
|
|
4
|
+
export declare const CARD_PAD_X_PX = 32;
|
|
5
|
+
export declare const setBandGapPx: (showImageBackground: boolean) => number;
|
|
6
|
+
export declare const setBandGapCss: (showImageBackground: boolean, gridGap?: string) => string;
|
|
7
|
+
export declare const SET_PLATE_PX = 252;
|
|
8
|
+
export declare const SET_STACK_GAP_PX = 16;
|
|
9
|
+
export declare const SET_STACK_MAX_PX = 800;
|
|
10
|
+
export interface CardPictureSettings {
|
|
11
|
+
image: ReactNode;
|
|
12
|
+
imageSecond?: ReactNode;
|
|
13
|
+
plate?: ReactNode;
|
|
14
|
+
wide?: boolean;
|
|
15
|
+
imageBackgroundFill?: string;
|
|
16
|
+
setGridGap?: string;
|
|
17
|
+
}
|
|
18
|
+
export default function CardPicture({ image, imageSecond, plate, wide, imageBackgroundFill, setGridGap, }: CardPictureSettings): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as b,Fragment as P,jsxs as o}from"react/jsx-runtime";import{CARD_IMAGE_BG_OFF as C,cardImageBackgroundPaints as A,THEME_CARD_IMAGE_BG as v}from"efficient-web-builder/format/lib/content/card-image-background";import{useCatalogCard as g}from"./card-row.js";const h=e=>`calc((100% - ${typeof e=="number"?`${e}px`:e}) / 2)`,x=2,j=32,_=e=>x+2*j+(e?16:0),d=(e,s)=>s===void 0?`${_(e)}px`:`calc(${s} + ${_(e)-x}px)`,S=252,w=16,X=800;function E({image:e,imageSecond:s,plate:l,wide:a=!1,imageBackgroundFill:r=C,setGridGap:c}){const f=g(),t=A(r),n=t&&r===v,p=n?"bg-[var(--wheel-stage)] p-2":t?"p-2":"",i=t&&!n?{backgroundColor:r}:{},m=u=>b("figure",{className:"m-0 aspect-square [flex:0_0_auto] max-w-full w-[var(--sf-set-plate-w)] max-[800px]:w-full",style:{"--sf-set-plate-w":h(d(t,c))},children:u});return f?o("div",{className:a?`relative mt-2 mb-5 flex items-center justify-center [&_img]:object-top max-[800px]:flex-col ${p}`:`relative mt-2 mb-5 flex aspect-square items-center justify-center overflow-hidden [&_img]:object-top ${p}`,style:a?{...i,borderRadius:10,columnGap:d(t,c),rowGap:w}:{...i,borderRadius:"var(--sf-card-image-radius, 10px)"},children:[a?o(P,{children:[m(e),m(s??e)]}):e,l]}):o("div",{className:"relative mb-5 aspect-square overflow-hidden bg-bg p-8 [&_img]:object-top",style:{borderRadius:"var(--sf-card-image-radius, 10px)"},children:[e,l]})}export{j as CARD_PAD_X_PX,x as GRID_GAP_PX,S as SET_PLATE_PX,w as SET_STACK_GAP_PX,X as SET_STACK_MAX_PX,E as default,d as setBandGapCss,_ as setBandGapPx,h as setPlateWidthCss};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type FieldUsageAnswer } from "../../lib/content/field-usage.js";
|
|
3
|
+
import { type VehicleFitment } from "../../lib/wheels/plp-fitment-match.js";
|
|
4
|
+
export declare const CARD_SPEC_FIELD_CLASS = "whitespace-nowrap";
|
|
5
|
+
export type CardSpecField = string | {
|
|
6
|
+
readonly text: string;
|
|
7
|
+
readonly accent: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function cardSpecFields(fields: readonly CardSpecField[], separator?: string): ReactNode;
|
|
10
|
+
export declare function CardSpecLine({ children }: {
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export interface CardSpecsSettings {
|
|
14
|
+
sizes?: boolean;
|
|
15
|
+
car?: VehicleFitment | null;
|
|
16
|
+
separator?: string;
|
|
17
|
+
fieldUsage?: readonly FieldUsageAnswer[];
|
|
18
|
+
}
|
|
19
|
+
export declare function CardSpecFacts({ sizes, car, separator, fieldUsage }: CardSpecsSettings): import("react").JSX.Element | null;
|
|
20
|
+
export default function CardSpecs(settings: CardSpecsSettings): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as a,jsxs as m,Fragment as l}from"react/jsx-runtime";import{Fragment as i}from"react";import{applyCardAnswers as d}from"../../lib/content/field-usage.js";import{wheelCardSpecFacts as x}from"../../lib/wheels/plp-fitment-match.js";import{CARD_TEXT_SIZE as s,useCatalogCard as u}from"./card-row.js";import{useProductCardState as f}from"./ProductCardState.js";const g="whitespace-nowrap",h=t=>typeof t=="string"?t:t.text;function C(t,r="·"){return t.map((n,o)=>{const e=h(n),c=typeof n!="string"&&n.accent;return m(i,{children:[a("span",{className:`${g}${c?" text-accent":""}`,children:o<t.length-1?`${e} ${r}`:e}),o<t.length-1?" ":null]},e)})}function S({children:t}){const r=u();return a("div",{className:r?`mt-2 h-[38px] overflow-hidden [.sf-card-rows_&]:h-auto [.sf-card-rows_&]:max-h-[76px] font-mono ${s.labelLarge} leading-[19px] tracking-[0.14em] text-fg-dim`:`mt-[4px] font-mono ${s.labelLarge} tracking-[0.1em] text-fg-dim`,children:t})}function _({sizes:t=!1,car:r=null,separator:n,fieldUsage:o=[]}){const e=f();if(e.kind!=="wheel")return null;const c=d(x(e.wheel,r,{sizes:t}),o).map(p=>p.text);return a(l,{children:C(c,n)})}function w(t){return a(S,{children:a(_,{...t})})}export{g as CARD_SPEC_FIELD_CLASS,_ as CardSpecFacts,S as CardSpecLine,C as cardSpecFields,w as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{Fragment as o,jsx as r}from"react/jsx-runtime";import{say as s}from"efficient-web-builder/format/lib/editor-words";import{useProductCardStateOrNull as i}from"./ProductCardState.js";function n({label:t,editing:a,children:e}){return i()?r(o,{children:e}):a?r("div",{"data-host-part-sample":"",className:"opacity-60",children:s(t)}):null}export{n as default};
|
|
@@ -37,6 +37,7 @@ export interface TyreCardState {
|
|
|
37
37
|
}
|
|
38
38
|
export type ProductCardState = WheelCardState | TyreCardState;
|
|
39
39
|
export declare function useProductCardState(): ProductCardState;
|
|
40
|
+
export declare function useProductCardStateOrNull(): ProductCardState | null;
|
|
40
41
|
export declare function useWheelCardState(): WheelCardState;
|
|
41
42
|
export declare function WheelCardStateProvider({ wheel, colours, defaultFinish, editing, children, }: {
|
|
42
43
|
wheel: WheelSummary;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as v}from"react/jsx-runtime";import{createContext as
|
|
1
|
+
"use client";import{jsx as v}from"react/jsx-runtime";import{createContext as z,useCallback as A,useContext as P,useMemo as W,useState as y}from"react";import{useCurrency as h}from"../CurrencyContext.js";import{useTyreDetail as b}from"../useTyreDetail.js";import{usePlpCardSelection as B}from"../wheels-plp/usePlpCardSelection.js";import{tyrePagePath as N}from"../../lib/tyres/tyre-page-path.js";import{canOrderTyreVariant as T}from"../../lib/tyres/tyre-purchase.js";import{resolveSelectionPrice as j}from"../../lib/wheels/price-display.js";import{setBuildLabel as E,setIsWide as L,summarySetBuild as R}from"../../lib/wheels/set-mode.js";const c=z(null);function V(){const e=P(c);if(!e)throw new Error("A product card piece was drawn outside a product card (no ProductCardState).");return e}function K(){return P(c)}function Q(){const e=V();if(e.kind!=="wheel")throw new Error("A wheel card piece was drawn on a tyre card.");return e}const _=[];function X({wheel:e,colours:i=_,defaultFinish:u,editing:l=!1,children:a}){const{currency:t}=h(),r=B(e,i,u),[d,f]=y(!1),s=R(e),n={kind:"wheel",wheel:e,sel:r,currency:t,price:j(e,r.selectedVariant,t,1),isSet:L(s),setWords:E(s),editing:l,notifyOpen:d,setNotifyOpen:f};return v(c.Provider,{value:n,children:a})}function Y({tyre:e,currency:i,editing:u=!1,children:l}){const{currency:a}=h(),{slug:t}=e,r=N(t),[d,f]=y(!1),s=A(()=>{t&&f(!0)},[t]),{state:n,tyre:m}=b(t??null,d),o=W(()=>m?.variants??[],[m]),[x,w]=y(null),O=o.length===1?o[0].size:null,C=x??O,p=o.find(k=>k.size===C),S=n==="ready",g={kind:"tyre",tyre:e,currency:i,activeCurrency:a,pagePath:r,arm:s,detailState:n,detail:m,variants:o,chosen:C,setSize:w,variant:p,canAdd:p!=null&&T(p,a),detailReady:S,unsellable:!r||n==="error"||S&&o.length===0,editing:u};return v(c.Provider,{value:g,children:l})}export{Y as TyreCardStateProvider,X as WheelCardStateProvider,V as useProductCardState,K as useProductCardStateOrNull,Q as useWheelCardState};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
2
|
-
`);return
|
|
3
|
-
${
|
|
1
|
+
"use client";import{jsx as S}from"react/jsx-runtime";import{createContext as wn,useContext as gn,useEffect as m,useMemo as At,useRef as f,useState as c}from"react";import{isOrderable as vt,useCart as kn}from"../CartContext.js";import{useCurrency as Cn}from"../CurrencyContext.js";import{getClickIds as bn}from"../../lib/click-ids.js";import{adConsentForOrder as Nn}from"../../lib/consent/choice.js";import{trackBeginCheckout as Pn,trackPurchase as Sn}from"../../lib/google-tag.js";import{trackMetaPurchase as An}from"../../lib/meta-pixel.js";import{ApiError as ke,api as j,products as y}from"../../lib/api/index.js";import{uuid as Ce}from"../../lib/uuid.js";import{orderLinesForSets as vn}from"../../lib/commerce.js";import{canPersist as xn,safeSessionStorage as C}from"efficient-web-builder/format/lib/safe-storage";import{AFTERPAY_CONTEXT_KEY as Kn,AFTERPAY_RETURN as En,GOCARDLESS_CONTEXT_KEY as Le,KLARNA_CONTEXT_KEY as $e,ZIP_CONTEXT_KEY as In,ZIP_RETURN as On,runWalletReturn as xt}from"../../lib/checkout/wallet-return.js";import{matchSubdivision as Tn}from"../../lib/checkout/match-subdivision.js";import{checkoutGone as Ye,checkoutWaiting as _n,BANK_WAITING as Rn,DROPPABLE_INTENT as Mn,NOT_CHECKED as Fe,PAY_FIRST_FLOW as Kt,paysFirst as Ln,readIntentStatus as $n,releaseHeldCheckout as Et,settlePayFirst as Yn}from"../../lib/checkout/pay-first.js";import{couponCodeForOrder as It,couponRefusedByOrder as Fn}from"../../lib/cart/coupon-preview.js";function Ot(a){const p=a.indexOf(`
|
|
2
|
+
`);return p===-1?[a,""]:[a.slice(0,p),a.slice(p+1)]}function Tt(a,{canParkContext:p}={canParkContext:!0}){const d=a.paymentMethods,i=[];return d.includes("card")&&i.push({key:"card",title:"Card",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("paypal")&&a.paypalClientId&&i.push({key:"paypal",title:"PayPal",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAYPAL · CARDS"})}),d.includes("afterpay")&&i.push({key:"afterpay",title:"Afterpay",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"4 × INTEREST-FREE"})}),d.includes("square")&&a.squareApplicationId&&a.squareLocationId&&i.push({key:"square",title:"Card (Square)",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"VISA · MC · AMEX"})}),d.includes("gocardless")&&p&&i.push({key:"gocardless",title:"Bank Direct Debit",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY BY BANK"})}),d.includes("zip")&&i.push({key:"zip",title:"Zip",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY IN 4"})}),d.includes("klarna")&&p&&i.push({key:"klarna",title:"Klarna",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-accent",children:"PAY LATER"})}),d.includes("bank")&&i.push({key:"bank",title:"Bank transfer",body:null,price:S("span",{className:"font-mono text-[12px] uppercase tracking-[0.2em] text-fg-dim",children:"Invoiced"})}),i}const cr="This shop does not take payment online yet. Please contact the shop to order.";class _t extends Error{}function Un(a,p){if(!a.orderNumber&&Ye(p))return p.message;const d=p instanceof ke?` (${p.message})`:"";return a.orderNumber?`Your order ${a.orderNumber} is saved, but the payment did not start${d}. Try the payment again — your order will not be placed twice.`:`Your items are held under ${a.checkoutNumber}, but the payment did not start${d}. Try the payment again — you will not be charged twice.`}const ar="Shipping cannot be calculated right now. Please try again.";function Bn({site:a,logo:p,preview:d=!1}){const{items:i,totals:A,coupon:M,refuseCoupon:Mt,deliveryOptions:Ue,shippingMethodId:Q,setShippingMethodId:Lt,setQuoteDestination:V,courier:$t,requote:Yt,identify:Be,clearCapturedCart:L,replaceItems:ze,removeCoupon:He}=kn(),Ft=Ue.find(e=>e.id===Q)?.pickupLocation??null,{country:qe,countries:q,activeCountry:De,formatMoney:Ut}=Cn(),[h,be]=c(()=>Tt(a)[0]?.key??null),[Je,Bt]=c(!0);m(()=>{Bt(xn(C))},[]);const[ee,b]=c(!1),[D,Ne]=c(""),[O,Pe]=c(""),[J,Se]=c(""),[te,ne]=c(""),[Ae,re]=c(""),[$,oe]=c(""),[T,ce]=c(""),[G,ae]=c(""),[u,se]=c(()=>qe||q[0]?.code||""),[v,ie]=c(""),[W,Ge]=c([]),[ve,xe]=c(null),[ue,X]=c(null),We=At(()=>q.find(e=>e.code===u)??De,[q,u,De]),zt=We?.postalLabel||"Postal Code",Ht=W[0]?.divisionType||"State / Province";m(()=>{if(!u){Ge([]),xe(u);return}xe(null);let e=!1;return y.listCountrySubdivisions(u).then(t=>{e||(Ge(t),xe(u),ie(""))}),()=>{e=!0}},[u]);const Xe=te.trim()!==""&&$.trim()!==""&&T.trim()!==""&&ve===u&&(W.length===0||v!=="")?T.trim():"";m(()=>{V(u?{country:u,subdivision:v,postcode:Xe}:null)},[u,v,Xe,V]),m(()=>()=>V(null),[V]);const qt=$t?.status==="unavailable",Dt=Yt,[le,Ze]=c(null),[Jt,je]=c([]),[Qe,Ke]=c("new"),[Ve,et]=c(!1),[Ee,Gt]=c("Home"),[Wt,tt]=c(null),[Y,Ie]=c(()=>Ce()),nt=f(null),[rt,k]=c(null),[Xt,w]=c(null),[ot,de]=c(null),[ct,Zt]=c(!1),[at,jt]=c(!1),[x,F]=c(null),[Qt,U]=c(!1),[g,K]=c(null),[Vt,N]=c(null),[en,tn]=c(!1),[nn,st]=c(!1),[rn,on]=c(!1),[cn,it]=c(!1),[ut,an]=c(!1),[sn,Oe]=c(!1),[Te,lt]=c(null),B=f(null),pe=f(i),_e=f(null),Re=f(null),dt=!!(rt||Te&&Te.kind!=="processing"||ut||ct||at||ot&&x?.orderNumber);m(()=>{dt&&(ze([]),He())},[dt,ze,He]);const pt=f(!1);m(()=>{d||pt.current||!i.some(vt)||(pt.current=!0,Pn({lines:i,currency:A.currency,value:A.subtotal-A.discount,coupon:M?.valid?M.code:void 0}))},[i,A,M,d]),m(()=>{Be(D,O.trim()||void 0)},[D,O,Be]);const mt=f(null),[me,un]=c(null);m(()=>{const e=mt.current;if(!me||!e)return;const t=()=>e.style.setProperty("--sf-checkout-header-h",`${me.offsetHeight}px`);t();const n=new ResizeObserver(t);return n.observe(me),()=>n.disconnect()},[me]),m(()=>{const e=n=>({setConfirming:n,land:k,markPaid:()=>U(!0),note:N,fail:w,clearCart:L}),t={search:window.location.search,storage:C,scrubQuery:()=>window.history.replaceState(null,"",window.location.pathname)};xt(En,{...t,capture:y.captureAfterpayPayment,page:e(tn)}),xt(On,{...t,capture:y.captureZipPayment,page:e(on)})},[]),m(()=>{const t=new URLSearchParams(window.location.search).get("gocardless");if(t!=="confirm"&&t!=="cancel")return;const n=C.getItem(Le);if(C.removeItem(Le),window.history.replaceState(null,"",window.location.pathname),!n)return;let r;try{r=JSON.parse(n)}catch{return}if(L(),t==="cancel"){N("The direct debit was not set up — our team will follow up on payment."),k(r.confirmation);return}st(!0),y.completeGocardlessPayment({idempotencyKey:r.idempotencyKey}).then(o=>{o.status==="paid"?U(!0):o.status==="declined"?N("The direct debit was declined — our team will follow up on payment."):N("Your direct debit is set up — the payment is collecting and will clear in a few days.")}).catch(()=>{N("We could not confirm the direct debit — our team will follow up on payment.")}).finally(()=>{k(r.confirmation),st(!1)})},[]),m(()=>{const e=new URLSearchParams(window.location.search),t=e.get("klarna");if(t!=="confirm"&&t!=="cancel")return;const n=C.getItem($e);C.removeItem($e);const r=e.get("authorization_token");if(window.history.replaceState(null,"",window.location.pathname),!n)return;let o;try{o=JSON.parse(n)}catch{return}if(L(),t==="cancel"||!r){N("The Klarna payment was not completed — our team will follow up on payment."),k(o.confirmation);return}it(!0),y.captureKlarnaPayment({idempotencyKey:o.idempotencyKey,authorizationToken:r}).then(s=>{s.status==="paid"?U(!0):s.status==="declined"?N("Klarna declined the payment — our team will follow up on payment."):N("Your Klarna payment is being reviewed — we'll confirm the outcome shortly.")}).catch(()=>{N("We could not confirm the Klarna payment — our team will follow up on payment.")}).finally(()=>{k(o.confirmation),it(!1)})},[]);function ft(e){const[t,n]=Ot(e.address);ne(t),re(n),oe(e.city),ce(e.zip_code),e.country&&se(e.country),e.phone&&ae(e.phone),X({country:e.country||null,state:e.state??""})}m(()=>{if(ue){if((ue.country||u)!==u){X(null);return}ve===u&&(ie(Tn(u,ue.state,W)),X(null))}},[ue,u,ve,W]),m(()=>{let e=!1;return(async()=>{try{const[t,n,r]=await Promise.all([j.me(),j.myProfile().catch(()=>null),j.myAddresses().catch(()=>[])]);if(e)return;Ze(t);const o=r.filter(Z=>Z.is_active);je(o),Ne(t.email);const s=(n?.contact_name??"").split(/\s+/);Pe(t.first_name||s[0]||""),Se(t.last_name||s.slice(1).join(" "));const l=t.phone||n?.phone;l&&ae(l);const R=o.find(Z=>Z.id===t.default_delivery_location)??o[0];if(R)Ke(R.id),ft(R);else if(n){const[Z,hn]=Ot(n.address??"");ne(Z),re(hn),oe(n.city??""),ce(n.zip_code??""),n.country&&se(n.country),X({country:n.country||null,state:n.state??""})}}catch{}})(),()=>{e=!0}},[]);function ln(){j.logout(),Ze(null),je([]),Ke("new"),et(!1),Ne(""),Pe(""),Se(""),ne(""),re(""),oe(""),ce(""),ae(""),se(qe||q[0]?.code||""),ie(""),X(null)}const z=At(()=>Tt(a,{canParkContext:Je}),[a,Je]);m(()=>{z.some(e=>e.key===h)||be(z[0]?.key??null)},[z,h]);const dn=z.length===0,fe=Ae.trim()?`${te}
|
|
3
|
+
${Ae.trim()}`:te,E=JSON.stringify([D,O,J,G,fe,$,v,T,u,i.map(e=>[e.id,e.qty]),Q,It(M),h,A.currency,le?.id??null]),ye=f(null),P=f(!1),H=f(null),he=f(!1),we=f(E);we.current=E;const yt=f(ee);yt.current=ee;const ht=()=>P.current&&we.current!==ye.current,_=f(null);m(()=>{yt.current||(E!==_.current&&(_.current=null),!(!P.current||!g||g.orderNumber)&&(E===ye.current||E===_.current||ge(g)))},[E,g]);async function ge(e){if(!he.current){he.current=!0,b(!0);try{const t=H.current?await $n(H.current):"none";if(t==="succeeded"||t==="processing"){P.current=!1,K(null),t==="succeeded"?await I(void 0,e):bt(e);return}if(t===void 0||!Mn.has(t)){_.current=we.current,K(e),w(t==="requires_action"?Rn:Fe);return}const n=await Et(Y);if(n==="committed"){P.current=!1,K(null),await I(void 0,e);return}if(n!=="released"){_.current=we.current,K(e),w(Fe);return}P.current=!1,H.current=null,_.current=null,w(null),K(null),Ie(Ce())}finally{he.current=!1,b(!1)}}}async function pn(){if(d||ee||he.current)return;if(g){if(P.current&&!g.orderNumber&&E!==ye.current){await ge(g);return}b(!0),w(null),await Me();const r=g.orderNumber?h:"card";r!==h&&be(r),await Nt(g,r,!g.orderNumber);return}if(i.length===0||A.repricing||!h||!z.some(r=>r.key===h))return;const e=i.filter(vt).flatMap(r=>vn(r.components,r.qty));if(e.length===0){w("Pick a size on each wheel's product page before checking out.");return}b(!0),w(null);let t,n=Y;try{const r=le?y.createOrderAuthed:y.createOrder,o=Nn(),s={customer:{email:D,name:`${O} ${J}`.trim(),phone:G.trim()||void 0,address:fe,city:$,state:v||void 0,zipCode:T,country:u},items:e,currency:A.currency,idempotencyKey:Y,shippingMethodId:Q??void 0,couponCode:It(M),...o==="denied"?{}:bn(),...o?{adConsent:o}:{},...Ln(h)?{checkoutFlow:Kt}:{}};B.current=()=>r(s),H.current=null,P.current=!1,_.current=null,ye.current=E,pe.current=i,kt(s,r);const l=await(!s.checkoutFlow&&Re.current===s.idempotencyKey?wt(s,r):r(s).then(R=>({answer:R,request:s})).catch(R=>mn(R,s,r)));if(!l)return;t=l.answer,n=l.request.idempotencyKey,t.orderNumber&&(Ct(t),L()),await Me()}catch(r){const o=Fn(r);o?(Mt(o),w(`${o} Your order has not been placed. Place it again to continue without the code.`)):r instanceof _t?w(Fe):w(r instanceof ke?r.message:"Could not place the order. Please try again."),b(!1);return}await Nt(t,h,!1,n)}async function mn(e,t,n){if(Ye(e))return gt(t,n);if(!_n(e))throw e;return Re.current=t.idempotencyKey,wt(t,n)}async function wt(e,t){const n=await Et(e.idempotencyKey);if(n==="released")return gt(e,t);if(n!=="committed")throw new _t;const r=_e.current?.key===e.idempotencyKey?_e.current:null;pe.current=r?.lines??i;const o=r?.send??(()=>t({...e,checkoutFlow:Kt}));B.current=o;const s=await o();return b(!1),await I(s,{...s,orderNumber:""}),await Me(),null}async function gt(e,t){const n={...e,idempotencyKey:Ce()};return Re.current=null,Ie(n.idempotencyKey),B.current=()=>t(n),kt(n,t),{answer:await t(n),request:n}}function kt(e,t){e.checkoutFlow&&(_e.current={key:e.idempotencyKey,send:()=>t(e),lines:i})}function Ct(e){Sn({confirmation:e,lines:pe.current,adsSendTo:a.googleAdsId&&a.googleAdsConversionLabel?`${a.googleAdsId}/${a.googleAdsConversionLabel}`:null}),An({confirmation:e,lines:pe.current})}async function I(e,t=x){if(!t)return;const n=e?async()=>e:B.current;if(t.orderNumber||!n){U(!0),k(t);return}L(),await Yn({checkoutNumber:t.checkoutNumber,resend:n,page:{setConfirming:an,land:k,markPaid:()=>U(!0),track:Ct,unplaced:lt}})}function bt(e=x){if(e){if(e.orderNumber){k(e);return}L(),lt({kind:"processing",checkoutNumber:e.checkoutNumber})}}async function Me(){const e=JSON.stringify([Ee.trim(),O,J,G.trim(),fe,$,v,T,u]);if(!(!le||!Ve||Qe!=="new"||nt.current===e))try{await j.createAddress({label:Ee.trim()||"Home",contact_name:`${O} ${J}`.trim(),phone:G.trim(),address:fe,city:$,zip_code:T,state:v,country:u}),nt.current=e,tt("Address saved to your account.")}catch{tt("We couldn't save the address to your account — you can add it under Account → Addresses.")}}async function Nt(e,t=h,n=!1,r=Y){K(null);try{if(t==="card"&&a.paymentMethods.includes("card")){const o=await y.createPaymentIntent({idempotencyKey:r});if(H.current=o,n&&ht()){await ge(e);return}let s=e;if(n){const l=await B.current?.().catch(()=>null);if(l?.orderNumber){await I(l,e);return}if(s=Pt(e,l)??{...e,expiresAt:null},ht()){await ge(e);return}}F(s),Oe(!1),de(o)}else if(t==="paypal"&&a.paymentMethods.includes("paypal"))F(e),Zt(!0);else if(t==="afterpay"&&a.paymentMethods.includes("afterpay")){const o=window.location.origin,s=await y.createAfterpayCheckout({idempotencyKey:r,confirmUrl:`${o}/checkout?afterpay=confirm`,cancelUrl:`${o}/checkout?afterpay=cancel`}),l={idempotencyKey:r,confirmation:e};C.setItem(Kn,JSON.stringify(l)),window.location.assign(s.redirectCheckoutUrl);return}else if(t==="square"&&a.paymentMethods.includes("square"))F(e),jt(!0);else if(t==="gocardless"&&a.paymentMethods.includes("gocardless")){const o=window.location.origin,s=await y.createGocardlessBillingRequest({idempotencyKey:r,confirmUrl:`${o}/checkout?gocardless=confirm`,cancelUrl:`${o}/checkout?gocardless=cancel`}),l={idempotencyKey:r,confirmation:e};C.setItem(Le,JSON.stringify(l)),window.location.assign(s.authorisationUrl);return}else if(t==="zip"&&a.paymentMethods.includes("zip")){const o=window.location.origin,s=await y.createZipCheckout({idempotencyKey:r,redirectUrl:`${o}/checkout?zip=return`}),l={idempotencyKey:r,confirmation:e};C.setItem(In,JSON.stringify(l)),window.location.assign(s.redirectUrl);return}else if(t==="klarna"&&a.paymentMethods.includes("klarna")){const o=window.location.origin,s=await y.createKlarnaCheckout({idempotencyKey:r,confirmUrl:`${o}/checkout?klarna=confirm`,cancelUrl:`${o}/checkout?klarna=cancel`}),l={idempotencyKey:r,confirmation:e};C.setItem($e,JSON.stringify(l)),window.location.assign(s.redirectUrl);return}else k(e)}catch(o){if((n||t==="card")&&o instanceof ke&&o.status===409){await I(void 0,e);return}St(e,o),b(!1)}}function Pt(e,t){return t&&!t.orderNumber&&t.status==="open"&&t.checkoutNumber===e.checkoutNumber?t:null}function St(e,t){w(Un(e,t)),!e.orderNumber&&Ye(t)?(P.current=!1,Ie(Ce())):K(e)}async function fn(e){if(!x)return;const t=x;try{const n=await y.createPaymentIntent({idempotencyKey:Y}),r=await B.current?.().catch(()=>null);if(r?.orderNumber){await I(r);return}const o=Pt(t,r);F(o??{...t,expiresAt:null}),Oe(e&&o!==null),H.current=n,de(n)}catch(n){if(n instanceof ke&&n.status===409){await I();return}de(null),F(null),St(t,n),b(!1)}}function yn(){x&&(P.current=!0,K(x),de(null),F(null),Oe(!1),b(!1))}return{site:a,logo:p,items:i,totals:A,coupon:M,deliveryOptions:Ue,courierUnavailable:qt,retryCourier:Dt,shippingMethodId:Q,setShippingMethodId:Lt,pickupLocation:Ft,servedCountries:q,formatMoney:Ut,payChoice:h,setPayChoice:be,placing:ee,email:D,setEmail:Ne,firstName:O,setFirstName:Pe,lastName:J,setLastName:Se,address1:te,setAddress1:ne,address2:Ae,setAddress2:re,city:$,setCity:oe,postcode:T,setPostcode:ce,phone:G,setPhone:ae,country:u,setCountry:se,subdivision:v,setSubdivision:ie,subdivisions:W,destination:We,postcodeLabel:zt,subdivisionLabel:Ht,me:le,savedAddresses:Jt,selectedAddressId:Qe,setSelectedAddressId:Ke,saveAddress:Ve,setSaveAddress:et,saveLabel:Ee,setSaveLabel:Gt,addressSaveNote:Wt,idemKey:Y,confirmation:rt,setConfirmation:k,orderError:Xt,payment:ot,paypalStep:ct,squareStep:at,pendingConf:x,paid:Qt,setPaid:U,unpaidOrder:g,payNote:Vt,afterpayConfirming:en,gocardlessConfirming:nn,zipConfirming:rn,klarnaConfirming:cn,cardConfirming:ut,checkoutResult:Te,confirmCardPayment:I,cardStillProcessing:bt,renewCardPayment:fn,holdRenewed:sn,leaveCardPayment:yn,checkoutRootRef:mt,setCheckoutHeaderEl:un,fillFromAddress:ft,checkoutSignOut:ln,payOptions:z,noPaymentMethod:dn,placeOrder:pn}}const Rt=wn(null);function sr({children:a,...p}){const d=Bn(p);return S(Rt.Provider,{value:d,children:a})}function ir(){const a=gn(Rt);if(!a)throw new Error("useCheckout must be used inside CheckoutStateProvider");return a}export{sr as CheckoutStateProvider,cr as NO_PAYMENT_METHOD_NOTE,ar as SHIPPING_RETRY_NOTE,Tt as buildPayOptions,Un as paymentNotStartedMessage,ir as useCheckout};
|