efficient-storefront-blocks 0.95.0 → 0.97.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 +39 -0
- package/dist/chunks/{EditorPreviewCheckout-3F3CP5MR.js → EditorPreviewCheckout-O7F36ZXB.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-HN7TFLUJ.js → SiteEditorProvider-VZUU5OPZ.js} +1 -1
- package/dist/chunks/chunk-AOZEO73W.js +401 -0
- package/dist/chunks/{chunk-CYLLSHDF.js → chunk-MXWQOFM6.js} +1 -1
- package/dist/chunks/chunk-NYEB6V2R.js +1 -0
- package/dist/chunks/chunk-SQ62RGWV.js +1 -0
- package/dist/chunks/chunk-UFEEFZ5M.js +1 -0
- package/dist/chunks/{fitment-data-Z62WUQGC.js → fitment-data-MCGKHSA4.js} +1 -1
- package/dist/contract.js +10 -2
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/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 +5 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +57 -62
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +18 -5
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/ContactRouting.d.ts +6 -0
- package/dist/render/components/ContactRouting.js +1 -1
- package/dist/render/components/GridCardTemplate.js +1 -1
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/ProductHeroPanel.d.ts +3 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/WheelCardFrame.d.ts +3 -10
- package/dist/render/components/WheelCardFrame.js +1 -1
- package/dist/render/components/card-pieces/CardSurfaceFrame.d.ts +12 -0
- package/dist/render/components/card-pieces/CardSurfaceFrame.js +1 -0
- package/dist/render/components/card-pieces/card-row.js +1 -1
- package/dist/render/components/catalog/ShopperChips.d.ts +7 -4
- package/dist/render/components/catalog/ShopperChips.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.d.ts +1 -0
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +2 -2
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpFacetRows.d.ts +6 -4
- package/dist/render/components/wheels-plp/PlpFacetRows.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +19 -14
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/PlpTypePicker.d.ts +2 -5
- package/dist/render/lib/api/index.d.ts +3 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +28 -0
- package/dist/render/lib/content/booking-card-seed.d.ts +4 -0
- package/dist/render/lib/content/booking-card-seed.js +1 -1
- package/dist/render/lib/content/contact-card-seed.d.ts +4 -0
- package/dist/render/lib/content/contact-card-seed.js +1 -1
- package/dist/render/lib/content/facet-row-seed.d.ts +14 -0
- package/dist/render/lib/content/facet-row-seed.js +1 -1
- package/dist/render/lib/content/filter-card-seed.js +1 -1
- package/dist/render/lib/content/hero-option-seed.js +1 -1
- package/dist/render/lib/content/square-box.d.ts +4 -0
- package/dist/render/lib/content/square-box.js +1 -0
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +4 -0
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterChipsBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
- package/dist/render/lib/document/blocks/service/ContactRouting/render.js +1 -1
- 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-detail.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-listing.d.ts +2 -0
- package/dist/render/lib/document/section-to-box-rows-listing.js +1 -0
- package/dist/render/lib/document/section-to-box-rows-reviews.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-spec.js +1 -1
- package/dist/words.d.ts +21 -0
- package/dist/words.js +5 -5
- package/package.json +5 -4
- package/dist/chunks/chunk-7SMQDDLZ.js +0 -1
- package/dist/chunks/chunk-GW5M2ATK.js +0 -1
- package/dist/chunks/chunk-SUKEQRMP.js +0 -389
- package/dist/chunks/chunk-WLMM7L6N.js +0 -1
- package/dist/render/components/ProductCardChrome.d.ts +0 -38
- package/dist/render/components/ProductCardChrome.js +0 -1
- /package/dist/chunks/{chunk-SUKEQRMP.js.LEGAL.txt → chunk-AOZEO73W.js.LEGAL.txt} +0 -0
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],en=[...ue,"surface"];var nn={bold:h.bold.placeholder,italic:h.italic.placeholder,strike:h.strike.placeholder,code:h.code.placeholder,highlight:h.highlight.placeholder,quiet:h.quiet.placeholder,link:"link text",underline:h.underline.placeholder,sup:h.sup.placeholder,sub:h.sub.placeholder,color:"colored text",style:"styled text"};var ce=[{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 F=[{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}],pe=["highlight","quiet"],tn=ce.map(e=>e.style).filter(e=>F.some(n=>n.kind===e)).filter(e=>!pe.includes(e)),rn=[...F,{open:"*",close:"*",kind:"accent"}],on=[...F,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var sn=["http","https","mailto","tel"];function $(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 de=["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 B(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 de.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 fe(e){return[_({width:e.width}),_({width:e.width,profile:e.profile}),_(e)]}var k=["alloy-wheel","tyre"],me=["alloy-wheel"],R={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var yt=k.map(e=>({value:e,label:R[e]}));function O(e){return e==null?[...me]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...me]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function W(e){return m(e).brand??""}function ge(e){return m(e).prices??void 0}function he(e){return m(e).inStock!==!1}function ye(e){let n=m(e),t=d(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function G(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function Pe(e){return G(e).map(n=>n.family)}function H(e){if(d(e)==="tyre")return[];let n=m(e);return Array.isArray(n.categories)?n.categories:n.process?[n.process]:[]}function Se(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function be(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ke(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function xe(e){if(d(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>B(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var Y=e=>typeof e=="string"&&e?e:void 0;var we=null;function Te(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=we?we[e]:void 0;if(typeof t=="function"){try{let r=Y(t(n??{}));if(r)return r}catch{}return Te(e,n)}return Te(Y(t)??e,n)}function q(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var E=(e,n,t,r)=>({default:e,min:n,max:t,step:r}),wt=E(30,0,100,10),Tt=E(0,0,100,5),Lt=E(100,0,100,5),Ft=E(2,0,4,.5);function Le(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Fe="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 I(e){return e.offersCommerce&&e.offersService?A:A.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}var j="#popup:";function _e(e){return`${j}${e}`}function Re(e){return e.startsWith(j)&&e.slice(j.length).trim()||null}function P(e){return e===Fe?"/":`/${e}`}function N(e){return`/journal/${e}`}function C(e){return`/wheels/${e}`}function v(e,n){return`${P(e)}#${n}`}function K(...e){let n=new Set,t=[];for(let r of e)for(let o of r?.content??[]){let i=Le(o?.props?.anchor);if(!i)continue;let a=q(i);!a||n.has(a)||(n.add(a),t.push({slug:a,name:i}))}return t}function Oe(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 D(e,n,t){if(!e)return"page";if(Re(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Oe(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 Ee(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:K(...s.docs).map(u=>({value:v(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:N(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:_e(u.slug),label:u.title||u.slug})),placeholder:t.choosePopup};case"custom":return{type:"text"}}},l=I(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=>D(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=>D(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 Ae=Object.freeze([]);function V(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function Ie(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 Ne(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 Ce(e){return pn(e,"filter")}var cn="collection";function Z(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)}var Q={inStock:"In stock",outOfStock:"Out of stock",notInStockHere:"Not in stock here"};function dn(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ve(e,n){let t=e?.[n];return dn(t)?t:null}function Ke(e,n,t,r){if(t==null&&r==null)return!0;let o=ve(e,n);return!(o===null||t!=null&&o<t||r!=null&&o>r)}function De(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"},cr=Object.keys(fn);var X=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],J={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 gn(e){if(e.length===0)return[];let n=X.filter(t=>e.every(r=>J[t].includes(r)));return n.filter(t=>{let r=mn[t];return!r||!n.includes(r)})}function hn(e){let n=new Set;for(let t of e)n.add(d(t));return[...n]}var ee={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Me(e,n,t,r=null,o="fail"){let i=d(e),a=p=>o==="fail"||(p==="lugs"?i==="alloy-wheel":J[p].includes(i));if(r!=="kind"&&n.kind&&i!==n.kind)return!1;for(let p of X){if(r===p)continue;let l=n[p];if(l.length===0||!a(p))continue;let c=l.map(String);if(!Ue(e,p).some(s=>c.includes(s)))return!1}if(r!=="lugs"&&n.lugs&&n.lugs.length>0&&a("lugs")){let p=De(e);if(p===null||!n.lugs.includes(p))return!1}return!(r!=="price"&&!Ke(ge(e),t,n.priceMin??null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!he(e))}var yn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Ue(e,n){switch(n){case"tyreSizes":return[...new Set(xe(e).flatMap(fe))];case"brands":return W(e)?[W(e)]:[];case"finishes":return Pe(e);case"diameters":return ye(e).map(String);case"collections":return H(e);case"pcds":return Se(e);case"tyreTypes":return be(e);case"speedRatings":return ke(e)}}function Pn(e){let n=new Map;for(let t of e)for(let r of G(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function ze(e,n,t,r=hn(e),o=Ae,i="fail"){let a=u=>bn(u,r,o),p=Pn(e),c=(i==="pass"?X.filter(u=>r.some(b=>J[u].includes(b))):gn(r)).filter(u=>u!=="tyreSizes").filter(a).map(u=>{let b=n[u].map(String),ae=new Set,z=new Map,L=new Map;for(let f of e){let S=Ue(f,u);for(let g of S)ae.add(g);for(let g of new Set(S))L.set(g,(L.get(g)??0)+1);if(Me(f,n,t,u,i))for(let g of new Set(S))z.set(g,(z.get(g)??0)+1)}let Je=[...ae].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:z.get(f)??0,checked:b.includes(f),swatch:u==="finishes"?p.get(f)??null:null})).sort((f,S)=>{if(u==="diameters")return Number(f.value)-Number(S.value);let g=(L.get(S.value)??0)-(L.get(f.value)??0);return g!==0?g:f.value.localeCompare(S.value)});return{key:u,label:yn[u],options:Je}}).filter(u=>u.options.length>Sn),s=[];for(let u of c){let b=kn(u.key,r,o);b!==void 0&&s.push({fieldKey:u.key,filterOrder:b})}return[...Ne(c,u=>u.key,s,"filterOrder")]}var Sn=1;function $e(e){return e.showCollection===!1?["collections"]:[]}function bn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>Ce(V(t,r))(Z(e,r)))}function kn(e,n,t){if(t.length===0)return;let r;for(let o of n){let i=Ie(V(t,o),"filter")(Z(e,o));i!==void 0&&(r===void 0||i<r)&&(r=i)}return r}var ne={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},te="type";var x="FilterBlock";function Be(e){let n=e;return!!n&&typeof n=="object"&&typeof n.type=="string"&&!!n.props&&typeof n.props=="object"}function xn(e){return Object.entries(e.props??{}).filter(n=>Array.isArray(n[1])&&n[1].length>0&&n[1].every(Be))}function wn(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 We(e){let n=[],t=(r,o)=>{let i=[r,...o];for(let a of r)if(Be(a)){n.push({node:a,order:n.length,lists:i});for(let[,p]of xn(a))t(p,i)}};for(let r of wn(e))t(r,[]);return n}function w(e){return We(e).map(n=>n.node)}var re={vehicle:"My Car",process:"Process",size:"Size",lugs:"Lugs",finish:"Finish",price:"Price"};var kr=[{value:"inStock",label:Q.inStock},{value:"category",label:"Category"},{value:"lugs",label:re.lugs},{value:"price",label:re.price}];var He="AlloyWheelsListing";function Ye(e){return $(e.trim())}var T="/wheels",M="Products";function qe(e,n){return n>1?`${M} \xB7 ${e}`:M}function oe(...e){for(let n of[He,x])for(let t of e){let r=w({content:t?.content}).find(o=>o.type===n);if(r)return r.props??{}}return null}function U(...e){return oe(...e)!==null}function je(e,n){let t=e.filter(r=>U(...r.docs)).map(r=>P(r.slug));return n.fallback&&!t.includes(T)?[...t,T]:t}var ie=[te,...Object.entries(ne).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Ve(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(Ve(e).query);for(let t of ie){let r=n.get(t);if(r)return{param:t,value:r}}return null}function se(e,n){let{path:t,query:r,hash:o}=Ve(e),i=r.split("&").filter(a=>a&&!ie.includes(_n(a.split("=")[0])));return n?.value&&i.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${i.length?`?${i.join("&")}`:""}${o}`}function Qe(e,n){let t=se(e,null);return n.includes(t)?t:e}function Rn(e,n,t=[]){return D(e,n,{listingPaths:t,targetOf:r=>Qe(r,t)})}function On(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 Xe="Product type",En="AUD";function le(e,n){let t=n.listing??{},r=O(t.kinds),o=e.filter(l=>r.includes(d(l))),i=$e(t),a=ze(o,ee,En,r,n.fieldUsage).filter(l=>!i.includes(l.key)).map(l=>({param:ne[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=>d(c)===l));return p.length>1&&a.unshift({param:te,label:Xe,values:p.map(l=>({value:l,label:R[l]}))}),a}function An(e){return n=>{let t=je(n,{fallback:e.offersCommerce}),r=n.filter(o=>U(...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&&U(...p.docs)?{...a,label:qe(p.title,r)}:a});return r===0&&e.offersCommerce&&!i.some(a=>a.value===T)&&i.push({value:T,label:M}),i},filtersFor:o=>{if(!t.includes(o))return null;let i=n.find(a=>P(a.slug)===o);return le(e.catalogue,{listing:i?oe(...i.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ze,withFilter:se}}}function In(e){let n=An({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Ee({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:C(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Ye},filtersFor:t.filtersFor??(()=>null)}}function fo(e,n){return le(e,n)}export{T as BUILT_IN_LISTING_PATH,A as LINK_KINDS,ie as LISTING_FILTER_PARAMS,M as LISTING_PAGE_LABEL,Xe as PRODUCT_TYPE_FILTER_LABEL,v as anchorPath,On as fieldUsageFromAdminRows,Rn as inferLinkKind,U as isProductListingPage,Ye as isSafeLink,I as linkKindsFor,In as linkPickerSetup,fo as listingFilterFields,oe as listingNode,qe as listingPageLabel,Qe as listingTarget,K as pageAnchors,P as pagePath,N as postPath,je as productListingPaths,Ze as readListingFilter,C as wheelPath,se as withListingFilter};
|
|
1
|
+
var h={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var ue=["main","text","background","muted"],en=[...ue,"surface"];var nn={bold:h.bold.placeholder,italic:h.italic.placeholder,strike:h.strike.placeholder,code:h.code.placeholder,highlight:h.highlight.placeholder,quiet:h.quiet.placeholder,link:"link text",underline:h.underline.placeholder,sup:h.sup.placeholder,sub:h.sub.placeholder,color:"colored text",style:"styled text"};var ce=[{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 _=[{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}],pe=["highlight","quiet"],tn=ce.map(e=>e.style).filter(e=>_.some(n=>n.kind===e)).filter(e=>!pe.includes(e)),rn=[..._,{open:"*",close:"*",kind:"accent"}],on=[..._,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var sn=["http","https","mailto","tel"];function $(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 de=["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 B(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 de.every(o=>{let[i,a]=an[o];return t[o]>=i&&t[o]<=a})?t:null}function R(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 fe(e){return[R({width:e.width}),R({width:e.width,profile:e.profile}),R(e)]}var k=["alloy-wheel","tyre"],me=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var yt=k.map(e=>({value:e,label:F[e]}));function O(e){return e==null?[...me]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...me]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function W(e){return m(e).brand??""}function ge(e){return m(e).prices??void 0}function he(e){return m(e).inStock!==!1}function ye(e){let n=m(e),t=d(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function G(e){return d(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function Pe(e){return G(e).map(n=>n.family)}function H(e){if(d(e)==="tyre")return[];let n=m(e);return Array.isArray(n.categories)?n.categories:n.process?[n.process]:[]}function Se(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function be(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ke(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function xe(e){if(d(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>B(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var Y=e=>typeof e=="string"&&e?e:void 0;var we=null;function Te(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=we?we[e]:void 0;if(typeof t=="function"){try{let r=Y(t(n??{}));if(r)return r}catch{}return Te(e,n)}return Te(Y(t)??e,n)}function V(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var A=(e,n,t,r)=>({default:e,min:n,max:t,step:r}),wt=A(30,0,100,10),Tt=A(0,0,100,5),Lt=A(100,0,100,5),_t=A(2,0,4,.5);function Le(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var _e="homepage";var E=[{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?E:E.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}var q="#popup:";function Re(e){return`${q}${e}`}function Fe(e){return e.startsWith(q)&&e.slice(q.length).trim()||null}function P(e){return e===_e?"/":`/${e}`}function N(e){return`/journal/${e}`}function C(e){return`/wheels/${e}`}function v(e,n){return`${P(e)}#${n}`}function D(...e){let n=new Set,t=[];for(let r of e)for(let o of r?.content??[]){let i=Le(o?.props?.anchor);if(!i)continue;let a=V(i);!a||n.has(a)||(n.add(a),t.push({slug:a,name:i}))}return t}function Oe(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 K(e,n,t){if(!e)return"page";if(Fe(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Oe(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 Ae(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:D(...s.docs).map(u=>({value:v(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:N(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:Re(u.slug),label:u.title||u.slug})),placeholder:t.choosePopup};case"custom":return{type:"text"}}},l=I(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=>K(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=>K(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 j(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function Ie(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 Ne(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 Ce(e){return pn(e,"filter")}var cn="collection";function Z(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)}var Q={inStock:"In stock",outOfStock:"Out of stock",notInStockHere:"Not in stock here"};function dn(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function ve(e,n){let t=e?.[n];return dn(t)?t:null}function De(e,n,t,r){if(t==null&&r==null)return!0;let o=ve(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"},cr=Object.keys(fn);var X=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],J={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 gn(e){if(e.length===0)return[];let n=X.filter(t=>e.every(r=>J[t].includes(r)));return n.filter(t=>{let r=mn[t];return!r||!n.includes(r)})}function hn(e){let n=new Set;for(let t of e)n.add(d(t));return[...n]}var ee={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Me(e,n,t,r=null,o="fail"){let i=d(e),a=p=>o==="fail"||(p==="lugs"?i==="alloy-wheel":J[p].includes(i));if(r!=="kind"&&n.kind&&i!==n.kind)return!1;for(let p of X){if(r===p)continue;let l=n[p];if(l.length===0||!a(p))continue;let c=l.map(String);if(!Ue(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"&&!De(ge(e),t,n.priceMin??null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!he(e))}var yn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function Ue(e,n){switch(n){case"tyreSizes":return[...new Set(xe(e).flatMap(fe))];case"brands":return W(e)?[W(e)]:[];case"finishes":return Pe(e);case"diameters":return ye(e).map(String);case"collections":return H(e);case"pcds":return Se(e);case"tyreTypes":return be(e);case"speedRatings":return ke(e)}}function Pn(e){let n=new Map;for(let t of e)for(let r of G(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function ze(e,n,t,r=hn(e),o=Ee,i="fail"){let a=u=>bn(u,r,o),p=Pn(e),c=(i==="pass"?X.filter(u=>r.some(b=>J[u].includes(b))):gn(r)).filter(u=>u!=="tyreSizes").filter(a).map(u=>{let b=n[u].map(String),ae=new Set,z=new Map,L=new Map;for(let f of e){let S=Ue(f,u);for(let g of S)ae.add(g);for(let g of new Set(S))L.set(g,(L.get(g)??0)+1);if(Me(f,n,t,u,i))for(let g of new Set(S))z.set(g,(z.get(g)??0)+1)}let Je=[...ae].map(f=>({value:f,label:u==="diameters"?`${f}\u2033`:f,count:z.get(f)??0,checked:b.includes(f),swatch:u==="finishes"?p.get(f)??null:null})).sort((f,S)=>{if(u==="diameters")return Number(f.value)-Number(S.value);let g=(L.get(S.value)??0)-(L.get(f.value)??0);return g!==0?g:f.value.localeCompare(S.value)});return{key:u,label:yn[u],options:Je}}).filter(u=>u.options.length>Sn),s=[];for(let u of c){let b=kn(u.key,r,o);b!==void 0&&s.push({fieldKey:u.key,filterOrder:b})}return[...Ne(c,u=>u.key,s,"filterOrder")]}var Sn=1;function $e(e){return e.showCollection===!1?["collections"]:[]}function bn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>Ce(j(t,r))(Z(e,r)))}function kn(e,n,t){if(t.length===0)return;let r;for(let o of n){let i=Ie(j(t,o),"filter")(Z(e,o));i!==void 0&&(r===void 0||i<r)&&(r=i)}return r}var ne={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},te="type";var x="FilterBlock";function Be(e){let n=e;return!!n&&typeof n=="object"&&typeof n.type=="string"&&!!n.props&&typeof n.props=="object"}function xn(e){return Object.entries(e.props??{}).filter(n=>Array.isArray(n[1])&&n[1].length>0&&n[1].every(Be))}function wn(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 We(e){let n=[],t=(r,o)=>{let i=[r,...o];for(let a of r)if(Be(a)){n.push({node:a,order:n.length,lists:i});for(let[,p]of xn(a))t(p,i)}};for(let r of wn(e))t(r,[]);return n}function w(e){return We(e).map(n=>n.node)}var re={vehicle:"My Car",process:"Process",size:"Size",lugs:"Lugs",finish:"Finish",price:"Price"};var kr=[{value:"inStock",label:Q.inStock},{value:"category",label:"Category"},{value:"lugs",label:re.lugs},{value:"price",label:re.price}];var He="AlloyWheelsListing";function Ye(e){return $(e.trim())}var T="/wheels",M="Products";function Ve(e,n){return n>1?`${M} \xB7 ${e}`:M}function oe(...e){for(let n of[He,x])for(let t of e){let r=w({content:t?.content}).find(o=>o.type===n);if(r)return r.props??{}}return null}function U(...e){return oe(...e)!==null}function qe(e,n){let t=e.filter(r=>U(...r.docs)).map(r=>P(r.slug));return n.fallback&&!t.includes(T)?[...t,T]:t}var ie=[te,...Object.entries(ne).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 Rn(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ze(e){let n=new URLSearchParams(je(e).query);for(let t of ie){let r=n.get(t);if(r)return{param:t,value:r}}return null}function se(e,n){let{path:t,query:r,hash:o}=je(e),i=r.split("&").filter(a=>a&&!ie.includes(Rn(a.split("=")[0])));return n?.value&&i.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${i.length?`?${i.join("&")}`:""}${o}`}function Qe(e,n){let t=se(e,null);return n.includes(t)?t:e}function Fn(e,n,t=[]){return K(e,n,{listingPaths:t,targetOf:r=>Qe(r,t)})}function On(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 Xe="Product type",An="AUD";function le(e,n){let t=n.listing??{},r=O(t.kinds),o=e.filter(l=>r.includes(d(l))),i=$e(t),a=ze(o,ee,An,r,n.fieldUsage).filter(l=>!i.includes(l.key)).map(l=>({param:ne[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=>d(c)===l));return p.length>1&&a.unshift({param:te,label:Xe,values:p.map(l=>({value:l,label:F[l]}))}),a}function En(e){return n=>{let t=qe(n,{fallback:e.offersCommerce}),r=n.filter(o=>U(...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&&U(...p.docs)?{...a,label:Ve(p.title,r)}:a});return r===0&&e.offersCommerce&&!i.some(a=>a.value===T)&&i.push({value:T,label:M}),i},filtersFor:o=>{if(!t.includes(o))return null;let i=n.find(a=>P(a.slug)===o);return le(e.catalogue,{listing:i?oe(...i.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ze,withFilter:se}}}function In(e){let n=En({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Ae({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:C(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Ye},filtersFor:t.filtersFor??(()=>null)}}function fo(e,n){return le(e,n)}export{T as BUILT_IN_LISTING_PATH,E as LINK_KINDS,ie as LISTING_FILTER_PARAMS,M as LISTING_PAGE_LABEL,Xe as PRODUCT_TYPE_FILTER_LABEL,v as anchorPath,On as fieldUsageFromAdminRows,Fn as inferLinkKind,U as isProductListingPage,Ye as isSafeLink,I as linkKindsFor,In as linkPickerSetup,fo as listingFilterFields,oe as listingNode,Ve as listingPageLabel,Qe as listingTarget,D as pageAnchors,P as pagePath,N as postPath,qe as productListingPaths,Ze as readListingFilter,C as wheelPath,se as withListingFilter};
|
|
@@ -1553,12 +1553,18 @@ body:has([data-page-width="full"]) footer {
|
|
|
1553
1553
|
and `--motion-pin-length` the same way, from `--sf-pin-on` and
|
|
1554
1554
|
`--sf-pin-length`. No default is written here: an unwritten one makes the
|
|
1555
1555
|
shell's variable invalid, so the shell's own default holds (on, 2 screens).
|
|
1556
|
-
§5.
|
|
1556
|
+
§5. A view that pins with Screens 0 while another view pins for its
|
|
1557
|
+
Screens draws the stick look inside the track: `--motion-pin-stick` and
|
|
1558
|
+
`--motion-pin-track-position` from `--sf-pin-stick` and
|
|
1559
|
+
`--sf-pin-track-position`, the same way, no default (the shell's own is 0,
|
|
1560
|
+
relative). §6. */
|
|
1557
1561
|
[data-motion-pin] {
|
|
1558
1562
|
--motion-pin-top: calc(var(--sf-pin-header, var(--sf-header-h, 88px)) + var(--sf-pin-distance, 0px));
|
|
1559
1563
|
--motion-pin-position: var(--sf-pin-position, sticky);
|
|
1560
1564
|
--motion-pin-on: var(--sf-pin-on);
|
|
1561
1565
|
--motion-pin-length: var(--sf-pin-length);
|
|
1566
|
+
--motion-pin-stick: var(--sf-pin-stick);
|
|
1567
|
+
--motion-pin-track-position: var(--sf-pin-track-position);
|
|
1562
1568
|
}
|
|
1563
1569
|
@media (min-width: 720px) and (max-width: 1099.98px) {
|
|
1564
1570
|
[data-motion-pin] {
|
|
@@ -1566,6 +1572,8 @@ body:has([data-page-width="full"]) footer {
|
|
|
1566
1572
|
--motion-pin-position: var(--sf-pin-position-tablet, var(--sf-pin-position, sticky));
|
|
1567
1573
|
--motion-pin-on: var(--sf-pin-on-tablet, var(--sf-pin-on));
|
|
1568
1574
|
--motion-pin-length: var(--sf-pin-length-tablet, var(--sf-pin-length));
|
|
1575
|
+
--motion-pin-stick: var(--sf-pin-stick-tablet, var(--sf-pin-stick));
|
|
1576
|
+
--motion-pin-track-position: var(--sf-pin-track-position-tablet, var(--sf-pin-track-position));
|
|
1569
1577
|
}
|
|
1570
1578
|
}
|
|
1571
1579
|
@media not all and (min-width: 720px) {
|
|
@@ -1574,6 +1582,8 @@ body:has([data-page-width="full"]) footer {
|
|
|
1574
1582
|
--motion-pin-position: var(--sf-pin-position-phone, var(--sf-pin-position, sticky));
|
|
1575
1583
|
--motion-pin-on: var(--sf-pin-on-phone, var(--sf-pin-on));
|
|
1576
1584
|
--motion-pin-length: var(--sf-pin-length-phone, var(--sf-pin-length));
|
|
1585
|
+
--motion-pin-stick: var(--sf-pin-stick-phone, var(--sf-pin-stick));
|
|
1586
|
+
--motion-pin-track-position: var(--sf-pin-track-position-phone, var(--sf-pin-track-position));
|
|
1577
1587
|
}
|
|
1578
1588
|
}
|
|
1579
1589
|
|
|
@@ -3298,10 +3308,13 @@ em.text-accent {
|
|
|
3298
3308
|
.sf-pad-bottom-phone {
|
|
3299
3309
|
padding-bottom: var(--sf-pad-b-phone) !important;
|
|
3300
3310
|
}
|
|
3301
|
-
/* The sideways pair
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3311
|
+
/* The sideways pair. The builder's `padSideAttrs` (render
|
|
3312
|
+
lib/content/section-padding) gives them to any section or Box with a
|
|
3313
|
+
Left or Right padding for the phone, and a card Box's inner padding is
|
|
3314
|
+
one of them (owner, 2026-09-09). A side may also follow the site Side
|
|
3315
|
+
space ("site", efficient-web-builder 66): the builder then hands a full
|
|
3316
|
+
CSS value, `var(--sf-pad-site, …)`, never a bare var, so these rules read
|
|
3317
|
+
it as they read a number and need no fallback. */
|
|
3305
3318
|
.sf-pad-left-phone {
|
|
3306
3319
|
padding-left: var(--sf-pad-l-phone) !important;
|
|
3307
3320
|
}
|
|
@@ -2,6 +2,7 @@ import { type ReactNode } from "react";
|
|
|
2
2
|
import type { Form } from "../lib/api/index.js";
|
|
3
3
|
import { type ContactChannel, type RoutingGroup } from "efficient-web-builder/format/lib/content/contact";
|
|
4
4
|
import type { SlotComponent } from "efficient-easel/blocks";
|
|
5
|
+
import type { CardPressTitle } from "efficient-web-builder/render/lib/document/card-press-titles";
|
|
5
6
|
export declare const CHANNEL_HINTS: {
|
|
6
7
|
readonly label: "Label";
|
|
7
8
|
readonly value: "Value";
|
|
@@ -46,6 +47,11 @@ export interface ContactRoutingTemplates {
|
|
|
46
47
|
topic?: SlotComponent;
|
|
47
48
|
reason?: SlotComponent;
|
|
48
49
|
channel?: SlotComponent;
|
|
50
|
+
pressTitles?: {
|
|
51
|
+
topic?: readonly CardPressTitle[];
|
|
52
|
+
reason?: readonly CardPressTitle[];
|
|
53
|
+
channel?: readonly CardPressTitle[];
|
|
54
|
+
};
|
|
49
55
|
}
|
|
50
56
|
export declare const fieldClass: string;
|
|
51
57
|
export default function ContactRouting({ routingNumber, routingTagline, groups, formNumber, formHeading, metaLines, showOther, otherLabel, otherNoteTitle, otherNoteBody, buttonText, consent, channels, formSlug, form: injectedForm, editing, initialActiveId, onActiveChange, reasonExtras, omitHead, templates, }: ContactRoutingProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as m,Fragment as ce}from"react/jsx-runtime";import pe from"./SectionBand.js";import{HideTaker as me,usePeekViewHide as ue,useTakeViewHide as fe,withViewHide as be}from"efficient-web-builder/render/components/ViewHideRoot";import{useEffect as L,useState as J}from"react";import{useRootIsDark as xe}from"efficient-shell/theme";import{OTHER_REASON_ID as k}from"efficient-web-builder/format/lib/content/contact";import{FormFieldInput as he,FormHoneypot as ge,successMessageFor as ye,useBoundForm as ve,useFormSubmission as we}from"./formSubmission.js";import ke from"efficient-web-builder/render/components/SectionEyebrow";import{InsideSiteColumn as R,useSectionEdge as Ce}from"efficient-web-builder/render/components/SiteGutterFrame";import{sectionEdgeBandAttrs as Ne}from"efficient-web-builder/render/lib/content/section-edge";import Se,{FieldCaption as Te}from"./WebFormField.js";import{scrollBehavior as Ie}from"efficient-web-builder/render/components/useReducedMotion";import{renderChrome as $e,renderGold as S,renderHeadline as Fe,splitParagraphs as Re}from"efficient-web-builder/render/components/goldPhrases";import{say as T}from"efficient-web-builder/format/lib/editor-words";import{phoneHref as _e}from"efficient-web-builder/format/lib/links/phone-href";import{PART_ROW_ATTR as Oe,encodePartRow as Ee}from"efficient-web-builder/render/lib/document/text-parts";import{CardTemplateRows as _}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as O}from"efficient-web-builder/format/lib/content/card-template";import{CONTACT_CHANNEL_SLOT as K,CONTACT_REASON_SLOT as Ae,CONTACT_TOPIC_SLOT as ze}from"../lib/content/contact-card-seed.js";import{groundCell as He}from"./card-ground-cell.js";const u={bodySmall:"text-[length:var(--size-body,14px)]",body:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,18px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"},j={label:"Label",value:"Value",sub:"Sub line"};function Le(l,o){return l.map((t,r)=>o?{...t,at:r,label:t.label||T(j.label),value:t.value||T(j.value),sub:t.sub||T(j.sub)}:{...t,at:r}).filter(t=>!t.hidden)}function Q(l,o){return o?{[Oe]:Ee("channels",l.at)}:{}}function Y(l){if(l.href)return l.href;const o=(l.value??"").trim();if(o.includes("@"))return`mailto:${o}`;if(/^\+?[\d\s().-]{6,}$/.test(o))return _e(o)}function je(l){const o=[],t=new Map;for(const r of l){if(!r.groupId){o.push(r);continue}const d=r.value.trim().toLowerCase(),f=t.get(d);if(f)f.label=`${f.label} · ${r.label}`;else{const h={...r};t.set(d,h),o.push(h)}}return o}function Me(l,o,t){const r=d=>String(d??"").trim().toLowerCase();for(const d of l?.fields??[]){if(d.type!=="select"||!Array.isArray(d.options))continue;const f=d.options.map(String);if(!o.some(s=>f.some(c=>r(c)===r(s.title))))continue;const h=s=>r(s===k?t:o.find(c=>c.id===s)?.title);return{key:d.key,optionFor:s=>f.find(c=>r(c)===h(s)&&h(s)!==""),idFor:s=>{const c=o.find(N=>r(N.title)===r(s));return c?c.id:t&&r(s)===r(t)?k:void 0}}}return null}const ee=`border-b border-line bg-transparent py-4 font-display ${u.bodyLarge} tracking-[0.01em] text-fg outline-none transition-colors focus:border-accent`;function Pe({routingNumber:l,routingTagline:o,groups:t,formNumber:r,formHeading:d,metaLines:f,showOther:h=!0,otherLabel:s="Other",otherNoteTitle:c,otherNoteBody:N,buttonText:M,consent:P,channels:ne,formSlug:V,form:te,editing:b,initialActiveId:y,onActiveChange:q,reasonExtras:re,omitHead:I=!1,templates:g}){const C=[...t.map(e=>e.id),...h?[k]:[]],oe=y&&C.includes(y)?y:C[0]??k,[v,$]=J(oe);L(()=>{C.includes(v)||$(C[0]??k)},[C.join("|")]),L(()=>{y&&C.includes(y)&&$(y)},[y]);const w=ve(V,te),i=we({form:w,formSlug:V,editing:b}),p=Me(w,t,h?s:void 0),B=e=>{$(e),E(null);const a=p?.optionFor(e);p&&a!==void 0&&i.set(p.key,a),q?.(e)};L(()=>{if(!p||i.valueOf(p.key))return;const e=p.optionFor(v);e!==void 0&&i.set(p.key,e)},[p?.key]);const[X,E]=J(null),x=Le(ne??[],!!b),ae=e=>X!==null?!e.groupId&&e.value===X:e.groupId===v,le=w===void 0,A=!!w||!!b,se=!xe({whenUnset:!0}),D=Ce(),F=I&&D?Ne(D):null,W=F?`${F.className} `:"",G=t.length>0||!!b,ie=e=>{B(e),typeof window<"u"&&window.matchMedia("(max-width: 1100px)").matches&&document.getElementById("contact-form")?.scrollIntoView({behavior:Ie(),block:"start"})},U=n("div",{className:"sf-card grid grid-cols-4 gap-[2px] border border-line bg-line max-view-desktop:grid-cols-2 max-[700px]:grid-cols-1",children:n(R,{children:n(_,{ownerId:g?.ownerId??"",ownerType:"ContactRouting",slot:ze,Template:g?.topic,rows:t.map(O),items:t,states:t.map(e=>({selected:v===e.id})),actions:b?void 0:t.map(e=>({press:()=>ie(e.id)})),fallback:null,wrapCopy:He,children:e=>e})})}),z=[...t.map(e=>({id:e.id,title:e.title})),...h?[{id:k,title:s}]:[]],de=ue(),Z=fe();return m(ce,{children:[G&&(I?n(me,{as:"section",className:`${W}border-b border-line bg-surface pt-6 pb-[60px]`,style:F?.style,children:U}):m(pe,{className:"border-b border-line py-[60px]",style:se?void 0:{background:"var(--section-bg)"},children:[(l||o)&&m("div",{className:"mb-6 flex items-center gap-6 border-b border-line pb-6",children:[l&&n(ke,{text:l}),o&&n("span",{className:`font-display ${u.bodySmall} uppercase tracking-[0.04em] text-fg-dim`,children:S(o)})]}),U]})),(A||x.length>0)&&Z.scope(n("section",{id:"contact-form",className:be(`${W}${I?"bg-bg ":""}scroll-mt-[80px] border-b border-line py-20 max-view-desktop:py-[60px]`,de),style:F?.style,...G?{}:Z.attrs,children:m("div",{className:[I?"grid gap-20 max-view-desktop:grid-cols-1 max-view-desktop:gap-[60px]":"mx-auto grid max-w-[var(--sf-site-width,1600px)] gap-20 px-[var(--sf-site-gutter,40px)] max-view-desktop:grid-cols-1 max-view-desktop:gap-[60px] max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",A&&x.length>0?"grid-cols-[1.3fr_1fr]":"grid-cols-1"].join(" "),children:[A&&m("div",{children:[m("div",{className:"mb-8 flex items-end justify-between gap-6 border-b border-line pb-6",children:[m("div",{children:[r&&n("div",{className:`pb-2 font-mono ${u.labelLarge} uppercase tracking-[0.3em] text-accent`,children:S(r)}),d&&n("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(36px,4vw,56px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.03em]",children:Fe(d,!0)})]}),!!(f&&f.length)&&n("div",{className:`text-right font-mono ${u.labelSmall} uppercase leading-[1.8] tracking-[0.22em] text-fg-dim max-[700px]:text-left`,children:f.map((e,a)=>n("div",{children:e},a))})]}),w?i.done?n("div",{className:`border border-accent bg-accent/[0.08] p-8 font-display ${u.body} leading-[1.6] text-fg-dim`,children:ye(w,"Thanks — we've received your message.")}):m("form",{className:"grid grid-cols-2 gap-5 max-[700px]:grid-cols-1",onSubmit:i.handleSubmit,children:[w.fields.map(e=>n(Se,{label:e.label,required:e.required,className:e.type==="textarea"||e.type==="checkbox"?"col-span-2 max-[700px]:col-span-1":void 0,children:n(he,{field:e,value:i.valueOf(e.key),onChange:a=>{i.set(e.key,a);const H=p&&e.key===p.key?p.idFor(a):void 0;H!==void 0&&($(H),E(null),q?.(H))},className:e.type==="textarea"?`${ee} min-h-[140px] resize-y leading-[1.5]`:e.type==="checkbox"?"size-4 self-start accent-accent":ee})},e.key)),m("div",{className:"col-span-2 flex flex-col gap-2 max-[700px]:col-span-1",children:[n(Te,{required:!0,children:"Reason"}),n("div",{className:"mt-1 flex flex-wrap gap-2",children:n(R,{children:n(_,{ownerId:g?.ownerId??"",ownerType:"ContactRouting",slot:Ae,Template:g?.reason,rows:z.map(e=>O({title:e.title})),states:z.map(e=>({selected:v===e.id})),actions:b?void 0:z.map(e=>({press:()=>B(e.id)})),fallback:null,children:e=>e})})})]}),re?.(v),v===k&&(c||N)&&m("div",{className:"sf-card col-span-2 flex flex-col gap-2 border border-line bg-bg/40 p-5 max-[700px]:col-span-1",children:[c&&n("span",{className:`font-mono ${u.labelSmall} uppercase tracking-[0.24em] text-accent`,children:S(c)}),N&&Re(N).map((e,a)=>n("p",{className:`font-display ${u.body} leading-[1.55] text-fg-dim`,children:S(e)},a))]}),n(ge,{value:i.honeypot,onChange:i.setHoneypot}),i.error&&n("p",{role:"alert",className:`col-span-2 font-mono ${u.labelSmall} uppercase tracking-[0.18em] text-alert max-[700px]:col-span-1`,children:i.error}),m("div",{className:"col-span-2 mt-5 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-6 max-[700px]:col-span-1 max-[700px]:flex-col max-[700px]:items-stretch",children:[P&&n("span",{className:`max-w-[380px] font-mono ${u.labelSmall} uppercase leading-[1.6] tracking-[0.18em] text-fg-dim`,children:S(P)}),n("button",{type:b?"button":"submit",disabled:i.submitting,className:`cursor-pointer bg-btn px-8 py-5 font-mono ${u.labelXl} uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg disabled:cursor-wait disabled:opacity-60 max-[700px]:w-full`,children:i.submitting?"Sending…":M?$e(M):"Send Message →"})]})]}):n("p",{className:`font-mono ${u.labelSmall} uppercase tracking-[0.22em] text-fg-dim`,children:le?T("Loading form…"):T("Choose a form in the inspector, under Message form — until then this column is hidden on the live page and no message can be sent.")})]}),x.length>0&&n("aside",{className:"flex flex-col gap-0 max-view-desktop:hidden",children:n(R,{children:n(_,{ownerId:g?.ownerId??"",ownerType:"ContactRouting",slot:K,Template:g?.channel,rows:x.map(e=>O({label:e.label,value:e.value,sub:e.sub??"",href:Y(e)??""})),items:x,states:x.map(e=>({selected:ae(e)})),copyAttrs:({index:e})=>Q(x[e],b),actions:b?void 0:x.map(e=>e.groupId?{press:()=>{},disabled:!0}:{press:()=>E(e.value)}),fallback:null,children:e=>e})})}),x.length>0&&(()=>{const e=je(x);return n("div",{"data-contact-phone-list":!0,className:"hidden flex-col gap-0 max-view-desktop:flex",children:n(R,{children:n(_,{ownerId:g?.ownerId??"",ownerType:"ContactRouting",slot:K,Template:g?.channel,rows:e.map(a=>O({label:a.label,value:a.value,sub:a.sub??"",href:Y(a)??""})),items:e,copyAttrs:({index:a})=>Q(e[a],b),fallback:null,children:a=>a})})})})()]})}))]})}export{j as CHANNEL_HINTS,Y as channelHref,Pe as default,Le as drawnChannels,ee as fieldClass,je as mergeChannelsForPhone,Me as topicFieldOf};
|
|
1
|
+
"use client";import{jsx as n,jsxs as u,Fragment as ce}from"react/jsx-runtime";import pe from"./SectionBand.js";import{HideTaker as me,usePeekViewHide as ue,useTakeViewHide as fe,withViewHide as be}from"efficient-web-builder/render/components/ViewHideRoot";import{useEffect as L,useState as J}from"react";import{useRootIsDark as xe}from"efficient-shell/theme";import{OTHER_REASON_ID as k}from"efficient-web-builder/format/lib/content/contact";import{FormFieldInput as he,FormHoneypot as ge,successMessageFor as ye,useBoundForm as ve,useFormSubmission as we}from"./formSubmission.js";import ke from"efficient-web-builder/render/components/SectionEyebrow";import{InsideSiteColumn as R,useSectionEdge as Ce}from"efficient-web-builder/render/components/SiteGutterFrame";import{sectionEdgeBandAttrs as Ne}from"efficient-web-builder/render/lib/content/section-edge";import Te,{FieldCaption as Se}from"./WebFormField.js";import{scrollBehavior as Ie}from"efficient-web-builder/render/components/useReducedMotion";import{renderChrome as $e,renderGold as T,renderHeadline as Fe,splitParagraphs as Re}from"efficient-web-builder/render/components/goldPhrases";import{say as S}from"efficient-web-builder/format/lib/editor-words";import{phoneHref as _e}from"efficient-web-builder/format/lib/links/phone-href";import{PART_ROW_ATTR as Oe,encodePartRow as Ee}from"efficient-web-builder/render/lib/document/text-parts";import{CardTemplateRows as _}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as O}from"efficient-web-builder/format/lib/content/card-template";import{CONTACT_CHANNEL_SLOT as K,CONTACT_REASON_SLOT as Ae,CONTACT_TOPIC_SLOT as ze}from"../lib/content/contact-card-seed.js";import{groundCell as He}from"./card-ground-cell.js";const f={bodySmall:"text-[length:var(--size-body,14px)]",body:"text-[length:var(--size-body,15px)]",bodyLarge:"text-[length:var(--size-body,18px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]"},j={label:"Label",value:"Value",sub:"Sub line"};function Le(a,s){return a.map((t,r)=>s?{...t,at:r,label:t.label||S(j.label),value:t.value||S(j.value),sub:t.sub||S(j.sub)}:{...t,at:r}).filter(t=>!t.hidden)}function Q(a,s){return s?{[Oe]:Ee("channels",a.at)}:{}}function Y(a){if(a.href)return a.href;const s=(a.value??"").trim();if(s.includes("@"))return`mailto:${s}`;if(/^\+?[\d\s().-]{6,}$/.test(s))return _e(s)}function je(a){const s=[],t=new Map;for(const r of a){if(!r.groupId){s.push(r);continue}const d=r.value.trim().toLowerCase(),b=t.get(d);if(b)b.label=`${b.label} · ${r.label}`;else{const g={...r};t.set(d,g),s.push(g)}}return s}function Me(a,s,t){const r=d=>String(d??"").trim().toLowerCase();for(const d of a?.fields??[]){if(d.type!=="select"||!Array.isArray(d.options))continue;const b=d.options.map(String);if(!s.some(l=>b.some(c=>r(c)===r(l.title))))continue;const g=l=>r(l===k?t:s.find(c=>c.id===l)?.title);return{key:d.key,optionFor:l=>b.find(c=>r(c)===g(l)&&g(l)!==""),idFor:l=>{const c=s.find(N=>r(N.title)===r(l));return c?c.id:t&&r(l)===r(t)?k:void 0}}}return null}const ee=`border-b border-line bg-transparent py-4 font-display ${f.bodyLarge} tracking-[0.01em] text-fg outline-none transition-colors focus:border-accent`;function Pe({routingNumber:a,routingTagline:s,groups:t,formNumber:r,formHeading:d,metaLines:b,showOther:g=!0,otherLabel:l="Other",otherNoteTitle:c,otherNoteBody:N,buttonText:M,consent:P,channels:ne,formSlug:V,form:te,editing:x,initialActiveId:y,onActiveChange:q,reasonExtras:re,omitHead:I=!1,templates:p}){const C=[...t.map(e=>e.id),...g?[k]:[]],se=y&&C.includes(y)?y:C[0]??k,[v,$]=J(se);L(()=>{C.includes(v)||$(C[0]??k)},[C.join("|")]),L(()=>{y&&C.includes(y)&&$(y)},[y]);const w=ve(V,te),i=we({form:w,formSlug:V,editing:x}),m=Me(w,t,g?l:void 0),B=e=>{$(e),E(null);const o=m?.optionFor(e);m&&o!==void 0&&i.set(m.key,o),q?.(e)};L(()=>{if(!m||i.valueOf(m.key))return;const e=m.optionFor(v);e!==void 0&&i.set(m.key,e)},[m?.key]);const[X,E]=J(null),h=Le(ne??[],!!x),oe=e=>X!==null?!e.groupId&&e.value===X:e.groupId===v,ae=w===void 0,A=!!w||!!x,le=!xe({whenUnset:!0}),D=Ce(),F=I&&D?Ne(D):null,W=F?`${F.className} `:"",G=t.length>0||!!x,ie=e=>{B(e),typeof window<"u"&&window.matchMedia("(max-width: 1100px)").matches&&document.getElementById("contact-form")?.scrollIntoView({behavior:Ie(),block:"start"})},U=n("div",{className:"sf-card grid grid-cols-4 gap-[2px] border border-line bg-line max-view-desktop:grid-cols-2 max-[700px]:grid-cols-1",children:n(R,{children:n(_,{ownerId:p?.ownerId??"",ownerType:"ContactRouting",slot:ze,Template:p?.topic,rows:t.map(O),items:t,states:t.map(e=>({selected:v===e.id})),actions:x?void 0:t.map(e=>({press:()=>ie(e.id)})),pressTitles:p?.pressTitles?.topic,fallback:null,wrapCopy:He,children:e=>e})})}),z=[...t.map(e=>({id:e.id,title:e.title})),...g?[{id:k,title:l}]:[]],de=ue(),Z=fe();return u(ce,{children:[G&&(I?n(me,{as:"section",className:`${W}border-b border-line bg-surface pt-6 pb-[60px]`,style:F?.style,children:U}):u(pe,{className:"border-b border-line py-[60px]",style:le?void 0:{background:"var(--section-bg)"},children:[(a||s)&&u("div",{className:"mb-6 flex items-center gap-6 border-b border-line pb-6",children:[a&&n(ke,{text:a}),s&&n("span",{className:`font-display ${f.bodySmall} uppercase tracking-[0.04em] text-fg-dim`,children:T(s)})]}),U]})),(A||h.length>0)&&Z.scope(n("section",{id:"contact-form",className:be(`${W}${I?"bg-bg ":""}scroll-mt-[80px] border-b border-line py-20 max-view-desktop:py-[60px]`,de),style:F?.style,...G?{}:Z.attrs,children:u("div",{className:[I?"grid gap-20 max-view-desktop:grid-cols-1 max-view-desktop:gap-[60px]":"mx-auto grid max-w-[var(--sf-site-width,1600px)] gap-20 px-[var(--sf-site-gutter,40px)] max-view-desktop:grid-cols-1 max-view-desktop:gap-[60px] max-view-desktop:px-[min(24px,var(--sf-site-gutter,40px))]",A&&h.length>0?"grid-cols-[1.3fr_1fr]":"grid-cols-1"].join(" "),children:[A&&u("div",{children:[u("div",{className:"mb-8 flex items-end justify-between gap-6 border-b border-line pb-6",children:[u("div",{children:[r&&n("div",{className:`pb-2 font-mono ${f.labelLarge} uppercase tracking-[0.3em] text-accent`,children:T(r)}),d&&n("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(36px,4vw,56px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.03em]",children:Fe(d,!0)})]}),!!(b&&b.length)&&n("div",{className:`text-right font-mono ${f.labelSmall} uppercase leading-[1.8] tracking-[0.22em] text-fg-dim max-[700px]:text-left`,children:b.map((e,o)=>n("div",{children:e},o))})]}),w?i.done?n("div",{className:`border border-accent bg-accent/[0.08] p-8 font-display ${f.body} leading-[1.6] text-fg-dim`,children:ye(w,"Thanks — we've received your message.")}):u("form",{className:"grid grid-cols-2 gap-5 max-[700px]:grid-cols-1",onSubmit:i.handleSubmit,children:[w.fields.map(e=>n(Te,{label:e.label,required:e.required,className:e.type==="textarea"||e.type==="checkbox"?"col-span-2 max-[700px]:col-span-1":void 0,children:n(he,{field:e,value:i.valueOf(e.key),onChange:o=>{i.set(e.key,o);const H=m&&e.key===m.key?m.idFor(o):void 0;H!==void 0&&($(H),E(null),q?.(H))},className:e.type==="textarea"?`${ee} min-h-[140px] resize-y leading-[1.5]`:e.type==="checkbox"?"size-4 self-start accent-accent":ee})},e.key)),u("div",{className:"col-span-2 flex flex-col gap-2 max-[700px]:col-span-1",children:[n(Se,{required:!0,children:"Reason"}),n("div",{className:"mt-1 flex flex-wrap gap-2",children:n(R,{children:n(_,{ownerId:p?.ownerId??"",ownerType:"ContactRouting",slot:Ae,Template:p?.reason,rows:z.map(e=>O({title:e.title})),states:z.map(e=>({selected:v===e.id})),actions:x?void 0:z.map(e=>({press:()=>B(e.id)})),pressTitles:p?.pressTitles?.reason,fallback:null,children:e=>e})})})]}),re?.(v),v===k&&(c||N)&&u("div",{className:"sf-card col-span-2 flex flex-col gap-2 border border-line bg-bg/40 p-5 max-[700px]:col-span-1",children:[c&&n("span",{className:`font-mono ${f.labelSmall} uppercase tracking-[0.24em] text-accent`,children:T(c)}),N&&Re(N).map((e,o)=>n("p",{className:`font-display ${f.body} leading-[1.55] text-fg-dim`,children:T(e)},o))]}),n(ge,{value:i.honeypot,onChange:i.setHoneypot}),i.error&&n("p",{role:"alert",className:`col-span-2 font-mono ${f.labelSmall} uppercase tracking-[0.18em] text-alert max-[700px]:col-span-1`,children:i.error}),u("div",{className:"col-span-2 mt-5 flex flex-wrap items-center justify-between gap-6 border-t border-line pt-6 max-[700px]:col-span-1 max-[700px]:flex-col max-[700px]:items-stretch",children:[P&&n("span",{className:`max-w-[380px] font-mono ${f.labelSmall} uppercase leading-[1.6] tracking-[0.18em] text-fg-dim`,children:T(P)}),n("button",{type:x?"button":"submit",disabled:i.submitting,className:`cursor-pointer bg-btn px-8 py-5 font-mono ${f.labelXl} uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg disabled:cursor-wait disabled:opacity-60 max-[700px]:w-full`,children:i.submitting?"Sending…":M?$e(M):"Send Message →"})]})]}):n("p",{className:`font-mono ${f.labelSmall} uppercase tracking-[0.22em] text-fg-dim`,children:ae?S("Loading form…"):S("Choose a form in the inspector, under Message form — until then this column is hidden on the live page and no message can be sent.")})]}),h.length>0&&n("aside",{className:"flex flex-col gap-0 max-view-desktop:hidden",children:n(R,{children:n(_,{ownerId:p?.ownerId??"",ownerType:"ContactRouting",slot:K,Template:p?.channel,rows:h.map(e=>O({label:e.label,value:e.value,sub:e.sub??"",href:Y(e)??""})),items:h,states:h.map(e=>({selected:oe(e)})),copyAttrs:({index:e})=>Q(h[e],x),actions:x?void 0:h.map(e=>e.groupId?{press:()=>{},disabled:!0}:{press:()=>E(e.value)}),pressTitles:p?.pressTitles?.channel,fallback:null,children:e=>e})})}),h.length>0&&(()=>{const e=je(h);return n("div",{"data-contact-phone-list":!0,className:"hidden flex-col gap-0 max-view-desktop:flex",children:n(R,{children:n(_,{ownerId:p?.ownerId??"",ownerType:"ContactRouting",slot:K,Template:p?.channel,rows:e.map(o=>O({label:o.label,value:o.value,sub:o.sub??"",href:Y(o)??""})),items:e,copyAttrs:({index:o})=>Q(e[o],x),fallback:null,children:o=>o})})})})()]})}))]})}export{j as CHANNEL_HINTS,Y as channelHref,Pe as default,Le as drawnChannels,ee as fieldClass,je as mergeChannelsForPhone,Me as topicFieldOf};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,
|
|
1
|
+
"use client";import{jsx as t,Fragment as x,jsxs as E}from"react/jsx-runtime";import{createContext as G,useContext as O,useMemo as g}from"react";import{CardRowContext as A,CardTemplateRows as p,useCardRow as D}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as k}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardHoverOf as L}from"efficient-web-builder/format/lib/animation/hover";import{pickHoverMedia as N}from"efficient-web-builder/format/lib/content/hover-media";import F from"efficient-web-builder/render/components/HoverMediaLayer";import{NO_FIELD_ANSWERS as S}from"../lib/content/field-usage.js";import{CARD_IMAGE_SIZES as U}from"../lib/sections/card-image-sizes.js";import{productTone as j,productToneVaried as W,randomCardColour as b}from"../lib/sections/card-tone.js";import{CardLookContext as C}from"./card-pieces/card-row.js";import{CardBuyDialog as $}from"./card-pieces/CardBuyButton.js";import B from"./card-pieces/CardSurfaceFrame.js";import{BundleCardStateProvider as H,TyreCardStateProvider as M,useProductCardState as v,useWheelCardState as R,WheelCardStateProvider as z,tyreCardProduct as V}from"./card-pieces/ProductCardState.js";import{tyrePagePath as q}from"../lib/tyres/tyre-page-path.js";import{say as Y}from"efficient-web-builder/format/lib/editor-words";import{CARD_INDEX_OPTIONS as K,cardIndexCss as X}from"efficient-web-builder/format/lib/sections/product-card-style";import{SHARED_ROWS_LIST_CLASS as J}from"efficient-web-builder/render/lib/content/box-shared-columns";import{GAP_ZONE_CLASS as Q}from"efficient-web-builder/format/lib/content/container-gap";import{CARD_ROWS_GRID_CLASS as Z,cardRowsGap as ee,cardRowsGridStyle as re}from"./WheelCardFrame.js";function je(e){return K.map(({value:r})=>r==="off"?"":X(e,r).replace(".sf-card-index::before",`.sf-card-index[data-format="${r}"]::before`)).join("")}function We(e){return e.className.includes(Q)?{className:`${e.className} ${Z} ${J}`,style:{...e.style,...re(ee(e))}}:e}const oe={sale:!1,axleSets:!0,setTotal:!1,wasFollowsSize:!1,quoteSets:!0,showSingle:!1,armOnContact:!1},$e={sale:!0,axleSets:!1,setTotal:!0,wasFollowsSize:!0,quoteSets:!1,showSingle:!0,armOnContact:!0},te={kindLabel:null,brand:!1,process:!0,tyreBrand:!0},ne=[],T={ownerId:"",ownerType:"ProductGrid",Template:void 0,hover:L({},"ProductGrid"),imageSizes:U,fieldUsage:S,tyreFieldUsage:S,reserveEyebrow:!1,editing:!1,eyebrow:te,fit:null,colours:ne,rules:oe},_=G(T);function u(){return O(_)}function Be({value:e,children:r}){const o=g(()=>({...T,...ae(e)}),[e]);return t(_.Provider,{value:o,children:r})}const ae=e=>Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0));function w(e,r){const o=e.designCode??e.slug??"";return{name:e.name??"",eyebrow:e.process??"",note:"",href:e.slug?`/wheels/${e.slug}`:"",colour:j(r),colourVaried:W(r,o),colourRandom:b(o)}}function se(e){const r=e.designCode||e.slug||"";return{name:e.name??"",eyebrow:e.brand??"",note:"",href:q(e.slug)??"",colour:"",colourVaried:"",colourRandom:b(r)}}const I=e=>`/bundles/${e.slug}`;function de(e){return{name:e.name,eyebrow:"",note:e.subtitle??"",href:I(e),colour:"",colourVaried:"",colourRandom:""}}const ie="sf-card sf-card-fill group relative flex flex-col bg-[var(--card-bg)] transition-colors duration-200 hover:bg-[var(--card-bg-hover)] [.sf-card-rows>&]:mb-[var(--sf-card-row-gap)]",le="sf-card group relative flex flex-col border border-line bg-bg transition-colors hover:border-accent",ce="col-span-2 max-view-wide:col-span-1 @max-[720px]:col-span-1 [&:has([data-set-picture=one])]:col-span-1",ue="relative flex flex-1 flex-col";function y({copy:e,href:r,label:o,wide:n=!1,kit:a=!1,probes:s,arm:m,layer:l}){const{editing:i}=u();return t(B,{surface:a?le:ie,span:n?ce:void 0,href:r,label:o,linked:!i,probes:s,arm:m,layer:l,children:t("div",{className:ue,children:t(k,{children:e})})})}const me="var(--card-bg)";function fe(e,r=me){const{hover:o}=u(),n=v();if(o.kind!=="nextImage"||o.media?.cover!==e||n.kind!=="wheel")return null;const a=N(n.wheel,o.media,n.sel.finish?.name);return a?t(F,{media:a,name:n.wheel.name,cover:e,ground:r}):null}function pe({children:e}){const r=D(),{wheel:o,sel:n}=R(),a=n.finish?.color,s=g(()=>r?{...r,row:w(o,a)}:null,[r,o,a]);return s?t(A.Provider,{value:s,children:e}):t(x,{children:e})}function Ce({copy:e}){const{wheel:r,sel:o,isSet:n}=R(),{rules:a}=u(),s=fe("card");return E(x,{children:[t(y,{copy:t(pe,{children:e}),href:r.slug?`/wheels/${r.slug}`:"",label:r.name,wide:n,probes:o.probes,arm:a.armOnContact?o.arm:void 0,layer:s}),t($,{})]})}function P(e,r,o,n){const a=r.item;return t(z,{wheel:a,colours:o.colours,defaultFinish:n?.[r.index],editing:o.editing,children:t(C.Provider,{value:"catalog",children:t(Ce,{copy:e})})})}function He({wheels:e,finishes:r,children:o}){const n=u(),{ownerId:a,ownerType:s,Template:m,editing:l}=n;return t(p,{ownerId:a,ownerType:s,Template:m,rows:e.map(i=>w(i)),items:e,fallback:l?t(h,{}):null,wrapCopy:(i,d)=>P(i,d,n,r),children:o})}function Me({items:e,tyreOf:r,tyreFit:o}){const n=u(),{ownerId:a,ownerType:s,Template:m,editing:l}=n,i=e.map(d=>r(d));return t(p,{ownerId:a,ownerType:s,Template:m,rows:e.map((d,f)=>{const c=i[f];return c?se(c):w(d)}),items:e,fallback:l?t(h,{}):null,wrapCopy:(d,f)=>{const c=i[f.index];return c?ye(d,V(c,o?.(c)??null),l):P(d,f,n)},children:d=>d})}function we({copy:e}){const r=v();if(r.kind!=="tyre")throw new Error("A tyre card surface was drawn outside its tyre state.");return t(y,{copy:e,href:r.pagePath??"",label:r.tyre.name,arm:r.arm})}function ye(e,r,o){return t(M,{tyre:r,editing:o,children:t(C.Provider,{value:"catalog",children:t(we,{copy:e})})})}function he(e,r){const o=r.item;return t(H,{bundle:o,children:t(C.Provider,{value:"catalog",children:t(y,{copy:e,href:I(o),label:o.name,kit:!0})})})}function ze({bundles:e,children:r}){const{ownerId:o,ownerType:n,Template:a,editing:s}=u();return t(p,{ownerId:o,ownerType:n,Template:a,rows:e.map(de),items:e,fallback:s?t(h,{}):null,wrapCopy:he,children:r})}function h(){return t("div",{"data-grid-card-empty":"",className:"p-4 text-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.2em] text-fg-dim",children:Y("The card is empty. Add parts to its card template in Layers.")})}export{oe as GRID_CARD_RULES,ze as GridBundleCards,Be as GridCardProvider,He as GridCards,Me as GridMixedCards,$e as LISTING_CARD_RULES,de as bundleCardRow,I as bundlePagePath,We as cardRowsGrid,je as gridIndexCss,w as productCardRow,se as tyreCardRow,fe as useCardHoverLayer,u as useGridCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as o,Fragment as O,jsxs as k}from"react/jsx-runtime";import T from"next/image";import{useState as U}from"react";import{setSecondSrc as $}from"../lib/wheels/set-mode.js";import{CARD_INDEX_BADGE_CLASS as G,CARD_INDEX_CLASS as W,DEFAULT_CARD_INDEX_FORMAT as M,DEFAULT_CARD_OUTLINE as j}from"efficient-web-builder/format/lib/sections/product-card-style";import{THEME_CARD_IMAGE_BG as H}from"efficient-web-builder/format/lib/content/card-image-background";import{cardHoverOf as X}from"efficient-web-builder/format/lib/animation/hover";import{NO_FIELD_ANSWERS as q}from"../lib/content/field-usage.js";import{GRID_CARD_SHOW as V}from"../lib/sections/card-show-defaults.js";import{CARD_IMAGE_SIZES as Z}from"../lib/sections/card-image-sizes.js";import{coverSrcForWheel as J,DEFAULT_COVER_INDEX as K,resolvePaintedSrc as Q}from"../lib/wheels/cover-rendering.js";import{wheelCardEyebrow as Y,withSetChip as ee}from"./ProductCardEyebrow.js";import{withRMark as re}from"efficient-web-builder/render/components/RMark";import oe from"./WheelPlaceholder.js";import se from"./card-pieces/CardFinishSwatches.js";import ie from"./card-pieces/CardPrice.js";import ae from"./card-pieces/CardProductBadge.js";import{useHeldCardPicture as te}from"./card-pieces/useHeldCardPicture.js";import{useWheelCardState as ne,WheelCardStateProvider as de}from"./card-pieces/ProductCardState.js";import{CardSpecFacts as ce}from"./card-pieces/CardSpecs.js";import le from"./WheelCardFrame.js";import{cardSpinOf as me}from"./card-spin.js";const he=X({},"ProductGrid"),fe={imageBackgroundFill:H,hover:he,coverIndex:K,indexBadge:M,outline:j,showBadge:!0,fieldUsage:q,reserveEyebrow:!1,showCardPrice:!0,showCardFinishes:!0,showCardSizes:V.showCardSizes,imageSizes:Z};function pe({wheel:t,variant:n="compact",defaultFinish:e}){return o(de,{wheel:t,defaultFinish:e,children:o(Se,{variant:n})})}function Se({variant:t}){const n=t==="catalog",{wheel:e,sel:r,isSet:d}=ne(),{imageBackgroundFill:g,hover:C,coverIndex:E,indexBadge:l,outline:_,showBadge:F,fieldUsage:m,reserveEyebrow:D,showCardPrice:A,showCardFinishes:b,showCardSizes:R,imageSizes:h}=fe,I=J(e,E,r.finish?.name,r.shownSrc),P="h-full w-full",c=me(C),[f,x]=U(()=>new Set),p=s=>{r.pictureFailed(s),x(a=>a.has(s)?a:new Set(a).add(s))},S=Q({overrideSrc:I,hookSrc:r.shownSrc,failed:f}),u=(s,a)=>o(T,{alt:a,src:s,width:1e3,height:1e3,sizes:h,className:`block object-contain ${c.className} ${P}`,style:c.style,draggable:!1,onError:()=>p(s)},s),B=r.finish?`${e.name} — ${r.finish.name}`:e.name,v=d?$(e.finishes?.find(s=>s.name===r.finish?.name),S):null,i=te({src:S,second:v,alt:B,sizes:h,failed:f,onFailed:p,near:r.nearScreen,holdEmpty:r.awaitingProbe}),y=k(O,{children:[i.src?u(i.src,i.alt):o(oe,{imageLabel:e.name,spin:c}),i.trial]}),N=i.second?u(i.second,`${i.alt} — right`):void 0,w=Y({kindLabel:null,brand:null,process:e.process?re(e.process):null},m),z=d&&!n?ee(w):w,L=l!=="off"?o("span",{"aria-hidden":!0,className:`${W} ${G}`}):null;return o(le,{variant:t,wide:d&&n,href:`/wheels/${e.slug}`,outline:_,imageBackgroundFill:g,probes:r.probes,reserveEyebrow:D,indexBadge:L,badges:o(ae,{show:F,numbered:l!=="off",axleSets:!0}),image:y,imageSecond:N,eyebrow:z,spec:o(ce,{sizes:R,fieldUsage:m}),price:o(ie,{show:A,quoteSets:!0}),swatches:o(se,{show:b})})}export{pe as default};
|
|
@@ -4,11 +4,13 @@ import { type StoreProduct } from "../lib/catalog/store-product.js";
|
|
|
4
4
|
import type { HeroPricePlacement } from "../lib/sections/hero-price-placement.js";
|
|
5
5
|
import { type HeroLayout, type HeroTextAlign } from "../lib/sections/hero-arrangement.js";
|
|
6
6
|
import { type HeroGalleryMode, type HeroImageFit } from "../lib/sections/hero-gallery.js";
|
|
7
|
+
import type { CardPressTitle } from "efficient-web-builder/render/lib/document/card-press-titles";
|
|
7
8
|
import type { SlotComponent } from "efficient-easel/blocks";
|
|
8
9
|
export interface HeroPriceTemplateProps {
|
|
9
10
|
nodeId?: string;
|
|
10
11
|
priceTemplate?: SlotComponent;
|
|
11
12
|
optionTemplate?: SlotComponent;
|
|
13
|
+
optionPressTitles?: readonly CardPressTitle[];
|
|
12
14
|
}
|
|
13
15
|
interface Props extends HeroPriceTemplateProps {
|
|
14
16
|
product: StoreProduct;
|
|
@@ -26,5 +28,5 @@ interface Props extends HeroPriceTemplateProps {
|
|
|
26
28
|
imageFit?: HeroImageFit;
|
|
27
29
|
trustBullets?: ReactNode;
|
|
28
30
|
}
|
|
29
|
-
export default function ProductHeroPanel({ product, selection, onLightbox, editing, pricePlacement, showVehicleFitment, heroLayout, imageRatio, textAlign, showSpecTable, showPriceQuote, galleryMode, imageFit, trustBullets, nodeId, priceTemplate, optionTemplate, }: Props): import("react").JSX.Element;
|
|
31
|
+
export default function ProductHeroPanel({ product, selection, onLightbox, editing, pricePlacement, showVehicleFitment, heroLayout, imageRatio, textAlign, showSpecTable, showPriceQuote, galleryMode, imageFit, trustBullets, nodeId, priceTemplate, optionTemplate, optionPressTitles, }: Props): import("react").JSX.Element;
|
|
30
32
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as a,Fragment as h,jsxs as n}from"react/jsx-runtime";import ee from"next/link";import{BUY_ROW_CLASS as _e}from"./buy-row.js";import{useEffect as te,useRef as Ee,useState as Oe}from"react";import{useCart as Le}from"./CartContext.js";import{useSiteTakesOrders as Ce}from"./SiteRecordContext.js";import Ae from"./EmailCaptureForm.js";import{useEnglish as M}from"./EnglishVariant.js";import Ie from"./QuantityStepper.js";import{MarkedLabel as P,heroView as $e}from"./product-hero/hero-view.js";import Me from"./ProductGallery.js";import{useRootIsDark as Pe}from"efficient-shell/theme";import{useWishlist as ze}from"./WishlistContext.js";import{useStockAlertSignup as He}from"./useStockAlertSignup.js";import{SPARE_WORDS as Fe,productCartLine as je}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as De}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Be}from"../lib/catalog/product-options.js";import{trackViewItem as Ue}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as Ve,DEFAULT_HERO_RATIO as We,DEFAULT_HERO_TEXT_ALIGN as Ge,parseHeroLayout as qe,parseHeroRatio as Ye,parseHeroTextAlign as Ke}from"../lib/sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as Xe,DEFAULT_HERO_IMAGE_FIT as Qe}from"../lib/sections/hero-gallery.js";import{MAX_SPARES as Je,UNITS_PER_SET as ae,formatPrice as ne}from"../lib/commerce.js";import{formatSelectionPrice as Ze,setPriceLabel as et}from"../lib/wheels/price-display.js";import{productIsDually as tt,productIsTwoObjects as at,setSuppressesRow as nt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as le}from"../lib/sections/content-cap-gutter.js";import{CardTemplateRows as re}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as lt}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as rt}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as st}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as it}from"../lib/content/hero-option-seed.js";import ot from"./card-pieces/CardPrice.js";import ct from"./card-pieces/CardBuyButton.js";import{HeroStateProvider as se}from"./card-pieces/ProductCardState.js";const mt=4e3;function pt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const dt=[{}],ft=.72;function ht(e){const l=e.trim().split(/\s+/).filter(Boolean);if(l.length===0)return;const o=l.map((i,s)=>i.length+(l.length>1&&s===l.length-1?1:0));return`calc(100cqi / ${(Math.max(...o)*ft).toFixed(2)})`}function ut({product:e,selection:l,onLightbox:o,editing:i=!1,pricePlacement:s="top",showVehicleFitment:d=!0,heroLayout:r=Ve,imageRatio:T=We,textAlign:oe=Ge,showSpecTable:ce=!0,showPriceQuote:R=!0,galleryMode:me=Xe,imageFit:pe=Qe,trustBullets:de,nodeId:z,priceTemplate:H,optionTemplate:fe}){const he=M(),b=qe(r),F=Ke(oe),S=Ye(T),ue=b==="imageRight"?`${100-S}fr ${S}fr`:`${S}fr ${100-S}fr`,{picked:ge,pick:j,qty:D,setQty:be,choice:v,setChoice:w,angleIdx:xe,setAngleIdx:ve,showValidation:ke,setShowValidation:_,manualMode:B,vehicle:E,rows:U,facts:Ne,part:u,outOfStock:V,offer:m,preOrder:O,canAddToCart:W,currency:x,price:f,set:G,msrpLabel:ye}=l,c=$e(e,l,i),L=tt(e),Se=at(e),C=d?c.vehicle:null,we=d?c.vehicleMemory:null,A=!Pe({whenUnset:!0}),{warmCatalog:q}=Le(),g=Ce();te(()=>{!i&&g&&q(e.kind)},[i,g,e.kind,q]);const Y=U.filter(t=>!O||t.values.length>0),K=Y.filter(t=>t.role==="resolves"),I=Y.filter(t=>t.role==="describes"&&!nt(Se,t.key)),X=I.findIndex(t=>t.chosen===null),Q=(!C||!c.vehicleAnswersSpecs||l.fitmentSet)&&Be(U,O)?X===-1?I:I.slice(0,X+1):[],Te=[...K,...Q];function Re(){return W?(_(!1),i?null:je(e,u,ge,{choice:v,qty:D},{fitmentLabel:B?c.specCaption:E.appliedName?`For ${E.appliedName}`:"",fitmentKey:B?`manual|${c.specCaption}`:`vehicle|${pt(E.applied?.vehicle)}`})):(_(!0),window.setTimeout(()=>_(!1),mt),null)}const J={kind:"hero",msrpLabel:ye||null,amount:L?et(f,x):Ze(f,x),unitLabel:f.priced?c.unitLabel:null,packBadge:f.setTotal!=null?`${m.quantityLabel}: ${ne(G,x)}`:null,buy:{isSet:L,priced:f.priced,outOfStock:V,canAdd:W,totalLabel:f.setTotal!=null?ne(G,x):null,lineToAdd:Re}},$=a(se,{value:J,children:H?a(re,{ownerId:z??"",ownerType:"ProductHero",Template:H,rows:dt,fallback:null,children:t=>t}):a(ot,{})}),k={nodeId:z??"",template:fe,editing:i},Z=Ee(null);return te(()=>{i||Z.current===e.slug||(Z.current=e.slug,Ue({itemId:u?`${e.slug}|${u.id}`:e.slug,itemName:e.name,variant:c.metaValue,pricePerSet:f.setTotal??f.fromSetTotal??0,currency:x}))},[i,e.slug,e.name,c.metaValue,u,f,x]),n(h,{children:[a("nav",{className:`border-b border-line ${le} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,style:A?void 0:{background:"var(--section-bg)"},children:e.crumbs.map((t,p)=>n("span",{children:[p>0&&n(h,{children:[a("span",{className:"mx-3 text-accent",children:"/"}),a("wbr",{})]}),t.href?a(ee,{href:t.href,className:"hover:text-fg",children:a(P,{text:t.label})}):a("span",{className:"text-fg",children:a(P,{text:t.label})})]},`${t.label}-${p}`))}),n("section",{"data-hero-layout":b,"data-hero-align":F,className:[`grid gap-10 ${le} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8`,b==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]"].join(" "),style:{...A?{}:{background:"var(--section-bg)"},...b==="stacked"?{}:{"--hero-cols":ue}},children:[a(Me,{product:e,view:c,angleIdx:xe,onSelect:ve,isLight:A,onLightbox:o,galleryMode:me,imageFit:pe,style:b==="imageRight"?{order:2}:void 0}),n("div",{className:["flex flex-col gap-7",F==="center"?"items-center text-center":""].filter(Boolean).join(" "),style:b==="imageRight"?{order:1}:void 0,children:[n("div",{className:"w-full [container-type:inline-size]",children:[n("div",{className:"mb-2.5 flex items-center gap-2.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-accent",children:[a("span",{children:a(P,{text:e.eyebrow})}),e.badge&&n(h,{children:[a("span",{children:"·"}),a("span",{children:e.badge})]})]}),a("h1",{className:"font-heading2 text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]",style:{"--hero-name-fit":ht(c.heading)},children:(()=>{const t=c.heading.lastIndexOf(" ");if(t===-1)return c.heading;const p=c.heading.slice(0,t),N=c.heading.slice(t+1);return n(h,{children:[p," ",n("em",{className:"font-normal italic text-accent",children:[N,"."]})]})})()})]}),s!=="belowSpecs"&&R&&$,we,K.map(t=>a(ie,{row:t,onPick:j,options:k},t.key)),O&&c.preOrder?n(h,{children:[s==="belowSpecs"&&R&&$,c.preOrder]}):n(h,{children:[C,Q.map(t=>a(ie,{row:t,onPick:j,options:k},t.key)),ce&&a(gt,{facts:Ne}),(m.packs.length>0||g&&(m.extra||m.spareCounts.length>0))&&n("div",{className:"border-b border-line pb-[26px]",children:[m.packs.length>0&&n(h,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:k,values:m.packs,item:t=>({label:t.label}),picked:t=>v.unit===t.value,press:t=>()=>w(p=>({...p,unit:t.value}))})})]}),g&&m.extra&&n("label",{className:`${m.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[a("input",{type:"checkbox",checked:v.spares>0,onChange:t=>w(p=>({...p,spares:t.target.checked?Je:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),m.extra.label]}),g&&m.spareCounts.length>0&&n(h,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:Fe.howMany}),a("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:a(y,{hero:k,values:m.spareCounts,item:t=>({label:`${t.value} · ${t.label}`}),picked:t=>v.spares===t.value-ae,press:t=>()=>w(p=>({...p,spares:t.value-ae}))})})]}),g&&m.spareSide&&n(h,{children:[a("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:m.spareSide.label}),a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:k,values:m.spareSide.options,item:t=>({label:t.label}),picked:t=>v.spareSide===t.value,press:t=>()=>w(p=>({...p,spareSide:t.value}))})})]})]}),s==="belowSpecs"&&R&&$,n("div",{className:_e,children:[g&&!(L&&!f.priced)&&a(Ie,{value:D,onChange:be,size:"large"}),a(se,{value:J,children:a(ct,{})}),a(bt,{slug:e.slug,name:e.name})]}),V&&u&&a(xt,{partNumbers:u.components.map(t=>t.partNumber),productSlug:e.slug},u.id),ke&&(()=>{const t=Te.filter(N=>N.chosen===null).map(N=>he(N.prompt).replace(/^Select\s+/i,""));if(C&&c.vehicleAnswersSpecs&&!l.fitmentSet&&t.push("vehicle fitment"),t.length===0)return null;const p=t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`;return n("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",p," first."]})})()]}),de]})]})]})}function gt({facts:e}){const l=M();return e.length===0?null:a("div",{className:"border-b border-line pb-[26px]",children:a("dl",{className:"flex flex-col gap-2",children:e.map(o=>n("div",{className:"flex flex-wrap items-baseline gap-x-2 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.22em]",children:[n("dt",{className:"text-fg-dim",children:[l(o.label)," ·"]}),a("dd",{className:"font-semibold text-fg",children:o.value.label})]},o.key))})})}function ie({row:e,onPick:l,options:o}){const i=M();if(e.values.length===0&&!e.empty)return null;const s=e.values.find(r=>r.value===e.chosen),d=s&&[s.label,s.note].filter(Boolean).join(" · ");return n("div",{className:"border-b border-line pb-[26px]",[De]:e.key,children:[n("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[i(e.label)," · ",a("span",{className:"text-accent",children:d??i(e.prompt)})]}),e.values.length===0?n("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",a(ee,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?a("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:a(y,{hero:o,values:e.values,item:r=>({swatch:r.swatch??"",name:r.label}),picked:r=>r.value===e.chosen,press:r=>()=>l(e.key,r.value)})}):a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:o,values:e.values,item:r=>({label:r.label,note:r.note??""}),picked:r=>r.value===e.chosen,press:r=>()=>l(e.key,r.value)})})]})}function y({hero:e,values:l,item:o,picked:i,press:s}){const d=st(l,{item:o,selected:i,press:s});return a(lt,{children:a(re,{ownerId:e.nodeId,ownerType:"ProductHero",slot:it,Template:e.template,rows:d.items.map(rt),items:d.items,states:d.states,actions:e.editing?void 0:d.actions,fallback:null,children:r=>r})})}function bt({slug:e,name:l}){const{has:o,toggle:i}=ze(),s=o(e);return a("button",{type:"button",title:s?"Saved":"Save","aria-label":s?`Remove ${l} from wishlist`:`Save ${l} to wishlist`,"aria-pressed":s,onClick:()=>i(e),className:["h-12 w-12 cursor-pointer border-2 bg-transparent transition-colors",s?"border-accent text-accent":"border-fg-dim/50 text-fg hover:border-accent hover:text-accent"].join(" "),children:s?"♥":"♡"})}function xt({partNumbers:e,productSlug:l}){const[o,i]=Oe(""),{status:s,submit:d,reset:r}=He();function T(){d({partNumbers:e,email:o,productSlug:l})}return s==="sent"?a("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):a(Ae,{className:"-mt-1",email:o,onEmailChange:i,status:s,onResetVerdict:r,onSubmit:T,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{ut as default};
|
|
1
|
+
"use client";import{jsx as a,Fragment as h,jsxs as l}from"react/jsx-runtime";import ee from"next/link";import{BUY_ROW_CLASS as Ee}from"./buy-row.js";import{useEffect as te,useRef as Oe,useState as Le}from"react";import{useCart as Ce}from"./CartContext.js";import{useSiteTakesOrders as Ae}from"./SiteRecordContext.js";import Ie from"./EmailCaptureForm.js";import{useEnglish as M}from"./EnglishVariant.js";import $e from"./QuantityStepper.js";import{MarkedLabel as P,heroView as Me}from"./product-hero/hero-view.js";import Pe from"./ProductGallery.js";import{useRootIsDark as ze}from"efficient-shell/theme";import{useWishlist as He}from"./WishlistContext.js";import{useStockAlertSignup as Fe}from"./useStockAlertSignup.js";import{SPARE_WORDS as je,productCartLine as De}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as Be}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Ue}from"../lib/catalog/product-options.js";import{trackViewItem as Ve}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as We,DEFAULT_HERO_RATIO as Ge,DEFAULT_HERO_TEXT_ALIGN as qe,parseHeroLayout as Ye,parseHeroRatio as Ke,parseHeroTextAlign as Xe}from"../lib/sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as Qe,DEFAULT_HERO_IMAGE_FIT as Je}from"../lib/sections/hero-gallery.js";import{MAX_SPARES as Ze,UNITS_PER_SET as ae,formatPrice as le}from"../lib/commerce.js";import{formatSelectionPrice as et,setPriceLabel as tt}from"../lib/wheels/price-display.js";import{productIsDually as at,productIsTwoObjects as lt,setSuppressesRow as nt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ne}from"../lib/sections/content-cap-gutter.js";import{CardTemplateRows as re}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as rt}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as st}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as it}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as ot}from"../lib/content/hero-option-seed.js";import ct from"./card-pieces/CardPrice.js";import mt from"./card-pieces/CardBuyButton.js";import{HeroStateProvider as se}from"./card-pieces/ProductCardState.js";const pt=4e3;function dt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ft=[{}],ht=.72;function ut(e){const n=e.trim().split(/\s+/).filter(Boolean);if(n.length===0)return;const o=n.map((i,s)=>i.length+(n.length>1&&s===n.length-1?1:0));return`calc(100cqi / ${(Math.max(...o)*ht).toFixed(2)})`}function gt({product:e,selection:n,onLightbox:o,editing:i=!1,pricePlacement:s="top",showVehicleFitment:d=!0,heroLayout:r=We,imageRatio:T=Ge,textAlign:oe=qe,showSpecTable:ce=!0,showPriceQuote:R=!0,galleryMode:me=Qe,imageFit:pe=Je,trustBullets:de,nodeId:z,priceTemplate:H,optionTemplate:fe,optionPressTitles:he}){const ue=M(),b=Ye(r),F=Xe(oe),S=Ke(T),ge=b==="imageRight"?`${100-S}fr ${S}fr`:`${S}fr ${100-S}fr`,{picked:be,pick:j,qty:D,setQty:xe,choice:v,setChoice:w,angleIdx:ve,setAngleIdx:ke,showValidation:Ne,setShowValidation:_,manualMode:B,vehicle:E,rows:U,facts:ye,part:u,outOfStock:V,offer:m,preOrder:O,canAddToCart:W,currency:x,price:f,set:G,msrpLabel:Se}=n,c=Me(e,n,i),L=at(e),we=lt(e),C=d?c.vehicle:null,Te=d?c.vehicleMemory:null,A=!ze({whenUnset:!0}),{warmCatalog:q}=Ce(),g=Ae();te(()=>{!i&&g&&q(e.kind)},[i,g,e.kind,q]);const Y=U.filter(t=>!O||t.values.length>0),K=Y.filter(t=>t.role==="resolves"),I=Y.filter(t=>t.role==="describes"&&!nt(we,t.key)),X=I.findIndex(t=>t.chosen===null),Q=(!C||!c.vehicleAnswersSpecs||n.fitmentSet)&&Ue(U,O)?X===-1?I:I.slice(0,X+1):[],Re=[...K,...Q];function _e(){return W?(_(!1),i?null:De(e,u,be,{choice:v,qty:D},{fitmentLabel:B?c.specCaption:E.appliedName?`For ${E.appliedName}`:"",fitmentKey:B?`manual|${c.specCaption}`:`vehicle|${dt(E.applied?.vehicle)}`})):(_(!0),window.setTimeout(()=>_(!1),pt),null)}const J={kind:"hero",msrpLabel:Se||null,amount:L?tt(f,x):et(f,x),unitLabel:f.priced?c.unitLabel:null,packBadge:f.setTotal!=null?`${m.quantityLabel}: ${le(G,x)}`:null,buy:{isSet:L,priced:f.priced,outOfStock:V,canAdd:W,totalLabel:f.setTotal!=null?le(G,x):null,lineToAdd:_e}},$=a(se,{value:J,children:H?a(re,{ownerId:z??"",ownerType:"ProductHero",Template:H,rows:ft,fallback:null,children:t=>t}):a(ct,{})}),k={nodeId:z??"",template:fe,pressTitles:he,editing:i},Z=Oe(null);return te(()=>{i||Z.current===e.slug||(Z.current=e.slug,Ve({itemId:u?`${e.slug}|${u.id}`:e.slug,itemName:e.name,variant:c.metaValue,pricePerSet:f.setTotal??f.fromSetTotal??0,currency:x}))},[i,e.slug,e.name,c.metaValue,u,f,x]),l(h,{children:[a("nav",{className:`border-b border-line ${ne} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,style:A?void 0:{background:"var(--section-bg)"},children:e.crumbs.map((t,p)=>l("span",{children:[p>0&&l(h,{children:[a("span",{className:"mx-3 text-accent",children:"/"}),a("wbr",{})]}),t.href?a(ee,{href:t.href,className:"hover:text-fg",children:a(P,{text:t.label})}):a("span",{className:"text-fg",children:a(P,{text:t.label})})]},`${t.label}-${p}`))}),l("section",{"data-hero-layout":b,"data-hero-align":F,className:[`grid gap-10 ${ne} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8`,b==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]"].join(" "),style:{...A?{}:{background:"var(--section-bg)"},...b==="stacked"?{}:{"--hero-cols":ge}},children:[a(Pe,{product:e,view:c,angleIdx:ve,onSelect:ke,isLight:A,onLightbox:o,galleryMode:me,imageFit:pe,style:b==="imageRight"?{order:2}:void 0}),l("div",{className:["flex flex-col gap-7",F==="center"?"items-center text-center":""].filter(Boolean).join(" "),style:b==="imageRight"?{order:1}:void 0,children:[l("div",{className:"w-full [container-type:inline-size]",children:[l("div",{className:"mb-2.5 flex items-center gap-2.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-accent",children:[a("span",{children:a(P,{text:e.eyebrow})}),e.badge&&l(h,{children:[a("span",{children:"·"}),a("span",{children:e.badge})]})]}),a("h1",{className:"font-heading2 text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]",style:{"--hero-name-fit":ut(c.heading)},children:(()=>{const t=c.heading.lastIndexOf(" ");if(t===-1)return c.heading;const p=c.heading.slice(0,t),N=c.heading.slice(t+1);return l(h,{children:[p," ",l("em",{className:"font-normal italic text-accent",children:[N,"."]})]})})()})]}),s!=="belowSpecs"&&R&&$,Te,K.map(t=>a(ie,{row:t,onPick:j,options:k},t.key)),O&&c.preOrder?l(h,{children:[s==="belowSpecs"&&R&&$,c.preOrder]}):l(h,{children:[C,Q.map(t=>a(ie,{row:t,onPick:j,options:k},t.key)),ce&&a(bt,{facts:ye}),(m.packs.length>0||g&&(m.extra||m.spareCounts.length>0))&&l("div",{className:"border-b border-line pb-[26px]",children:[m.packs.length>0&&l(h,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:k,values:m.packs,item:t=>({label:t.label}),picked:t=>v.unit===t.value,press:t=>()=>w(p=>({...p,unit:t.value}))})})]}),g&&m.extra&&l("label",{className:`${m.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[a("input",{type:"checkbox",checked:v.spares>0,onChange:t=>w(p=>({...p,spares:t.target.checked?Ze:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),m.extra.label]}),g&&m.spareCounts.length>0&&l(h,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:je.howMany}),a("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:a(y,{hero:k,values:m.spareCounts,item:t=>({label:`${t.value} · ${t.label}`}),picked:t=>v.spares===t.value-ae,press:t=>()=>w(p=>({...p,spares:t.value-ae}))})})]}),g&&m.spareSide&&l(h,{children:[a("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:m.spareSide.label}),a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:k,values:m.spareSide.options,item:t=>({label:t.label}),picked:t=>v.spareSide===t.value,press:t=>()=>w(p=>({...p,spareSide:t.value}))})})]})]}),s==="belowSpecs"&&R&&$,l("div",{className:Ee,children:[g&&!(L&&!f.priced)&&a($e,{value:D,onChange:xe,size:"large"}),a(se,{value:J,children:a(mt,{})}),a(xt,{slug:e.slug,name:e.name})]}),V&&u&&a(vt,{partNumbers:u.components.map(t=>t.partNumber),productSlug:e.slug},u.id),Ne&&(()=>{const t=Re.filter(N=>N.chosen===null).map(N=>ue(N.prompt).replace(/^Select\s+/i,""));if(C&&c.vehicleAnswersSpecs&&!n.fitmentSet&&t.push("vehicle fitment"),t.length===0)return null;const p=t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`;return l("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",p," first."]})})()]}),de]})]})]})}function bt({facts:e}){const n=M();return e.length===0?null:a("div",{className:"border-b border-line pb-[26px]",children:a("dl",{className:"flex flex-col gap-2",children:e.map(o=>l("div",{className:"flex flex-wrap items-baseline gap-x-2 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.22em]",children:[l("dt",{className:"text-fg-dim",children:[n(o.label)," ·"]}),a("dd",{className:"font-semibold text-fg",children:o.value.label})]},o.key))})})}function ie({row:e,onPick:n,options:o}){const i=M();if(e.values.length===0&&!e.empty)return null;const s=e.values.find(r=>r.value===e.chosen),d=s&&[s.label,s.note].filter(Boolean).join(" · ");return l("div",{className:"border-b border-line pb-[26px]",[Be]:e.key,children:[l("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[i(e.label)," · ",a("span",{className:"text-accent",children:d??i(e.prompt)})]}),e.values.length===0?l("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",a(ee,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?a("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:a(y,{hero:o,values:e.values,item:r=>({swatch:r.swatch??"",name:r.label}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})}):a("div",{className:"flex flex-wrap gap-1.5",children:a(y,{hero:o,values:e.values,item:r=>({label:r.label,note:r.note??""}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})})]})}function y({hero:e,values:n,item:o,picked:i,press:s}){const d=it(n,{item:o,selected:i,press:s});return a(rt,{children:a(re,{ownerId:e.nodeId,ownerType:"ProductHero",slot:ot,Template:e.template,rows:d.items.map(st),items:d.items,states:d.states,actions:e.editing?void 0:d.actions,pressTitles:e.pressTitles,fallback:null,children:r=>r})})}function xt({slug:e,name:n}){const{has:o,toggle:i}=He(),s=o(e);return a("button",{type:"button",title:s?"Saved":"Save","aria-label":s?`Remove ${n} from wishlist`:`Save ${n} to wishlist`,"aria-pressed":s,onClick:()=>i(e),className:["h-12 w-12 cursor-pointer border-2 bg-transparent transition-colors",s?"border-accent text-accent":"border-fg-dim/50 text-fg hover:border-accent hover:text-accent"].join(" "),children:s?"♥":"♡"})}function vt({partNumbers:e,productSlug:n}){const[o,i]=Le(""),{status:s,submit:d,reset:r}=Fe();function T(){d({partNumbers:e,email:o,productSlug:n})}return s==="sent"?a("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):a(Ie,{className:"-mt-1",email:o,onEmailChange:i,status:s,onResetVerdict:r,onSubmit:T,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{gt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CSSProperties, ReactNode } from "react";
|
|
2
2
|
import { type CardOutline } from "efficient-web-builder/format/lib/sections/product-card-style";
|
|
3
3
|
export declare const CARD_ROWS_GRID_CLASS = "sf-card-rows";
|
|
4
4
|
export declare const cardRowsGridStyle: (rowGap: string) => CSSProperties;
|
|
@@ -7,27 +7,20 @@ export declare const cardRowsGap: (zone: {
|
|
|
7
7
|
}) => string;
|
|
8
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
9
|
export { CARD_SPEC_FIELD_CLASS, cardSpecFields, type CardSpecField } from "./card-pieces/CardSpecs.js";
|
|
10
|
-
export default function WheelCardFrame({ variant, wide, href,
|
|
10
|
+
export default function WheelCardFrame({ variant, wide, href, outline, imageBackgroundFill, probes, indexBadge, badges, image, imageSecond, eyebrow, reserveEyebrow, spec, price, swatches, }: {
|
|
11
11
|
variant?: "compact" | "catalog";
|
|
12
12
|
wide?: boolean;
|
|
13
|
-
href
|
|
14
|
-
identityLink?: boolean;
|
|
13
|
+
href: string;
|
|
15
14
|
outline?: CardOutline;
|
|
16
15
|
imageBackgroundFill?: string;
|
|
17
|
-
containerProps?: Omit<ComponentProps<"article">, "className" | "children">;
|
|
18
16
|
probes?: ReactNode;
|
|
19
17
|
indexBadge?: ReactNode;
|
|
20
18
|
badges?: ReactNode;
|
|
21
19
|
image: ReactNode;
|
|
22
20
|
imageSecond?: ReactNode;
|
|
23
|
-
plate?: ReactNode;
|
|
24
21
|
eyebrow?: ReactNode;
|
|
25
22
|
reserveEyebrow?: boolean;
|
|
26
|
-
name?: ReactNode;
|
|
27
23
|
spec?: ReactNode;
|
|
28
24
|
price?: ReactNode;
|
|
29
25
|
swatches?: ReactNode;
|
|
30
|
-
sizes?: ReactNode;
|
|
31
|
-
buy?: ReactNode;
|
|
32
|
-
wholeCardLink?: boolean;
|
|
33
26
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,Fragment as
|
|
1
|
+
"use client";import{jsx as r,Fragment as s,jsxs as e}from"react/jsx-runtime";import{GAP_LENGTH_VAR as R,GAP_PHONE_LENGTH_VAR as E}from"efficient-web-builder/format/lib/content/container-gap";import{CardLookContext as F,CardRow as o}from"./card-pieces/card-row.js";import D from"./card-pieces/CardSurfaceFrame.js";import L from"./card-pieces/CardEyebrow.js";import T from"./card-pieces/CardName.js";import X from"./card-pieces/CardPicture.js";import{CardSpecLine as j}from"./card-pieces/CardSpecs.js";import{useProductCardStateOrNull as y}from"./card-pieces/ProductCardState.js";import{cardOutlineClass as B}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as N}from"efficient-web-builder/format/lib/content/card-image-background";const U="sf-card-rows",Y=a=>({rowGap:0,"--sf-card-row-gap":a}),Z=a=>E in a.style?"var(--sf-card-row-gap-auto)":`var(${R})`;import{CARD_PAD_X_PX as or,GRID_GAP_PX as er,SET_PLATE_PX as sr,SET_STACK_GAP_PX as tr,SET_STACK_MAX_PX as cr,setBandGapCss as dr,setBandGapPx as ir,setPlateWidthCss as nr}from"./card-pieces/CardPicture.js";import{CARD_SPEC_FIELD_CLASS as fr,cardSpecFields as pr}from"./card-pieces/CardSpecs.js";function O({variant:a="catalog",wide:t=!1,href:d,outline:i="none",imageBackgroundFill:n=N,probes:l,indexBadge:f,badges:p,image:m,imageSecond:_,eyebrow:g,reserveEyebrow:C=!1,spec:w,price:u,swatches:x}){const A=a==="catalog",c=y(),P=c?.kind==="wheel"?c.wheel.name:void 0,h=r(X,{image:m,imageSecond:_,wide:t,imageBackgroundFill:n}),S=[A?"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)]",B(i),t?"col-span-2 max-view-wide:col-span-1 @max-[720px]:col-span-1":""].filter(Boolean).join(" "),b=e(s,{children:[h,r(L,{reserve:C,children:g}),r(T,{})]}),v=e(s,{children:[r(j,{children:w}),u??e(s,{children:[r(o,{}),r(o,{})]}),x??r(o,{}),r(o,{}),r(o,{})]});return(G=>r(F.Provider,{value:a,children:G}))(e(D,{surface:S,href:d,label:P,probes:l,children:[f,p,b,v]}))}export{or as CARD_PAD_X_PX,U as CARD_ROWS_GRID_CLASS,fr as CARD_SPEC_FIELD_CLASS,er as GRID_GAP_PX,sr as SET_PLATE_PX,tr as SET_STACK_GAP_PX,cr as SET_STACK_MAX_PX,Z as cardRowsGap,Y as cardRowsGridStyle,pr as cardSpecFields,O as default,dr as setBandGapCss,ir as setBandGapPx,nr as setPlateWidthCss};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export default function CardSurfaceFrame({ surface, span, href, label, linked, probes, arm, layer, children, }: {
|
|
3
|
+
surface: string;
|
|
4
|
+
span?: string;
|
|
5
|
+
href: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
linked?: boolean;
|
|
8
|
+
probes?: ReactNode;
|
|
9
|
+
arm?: () => void;
|
|
10
|
+
layer?: ReactNode;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as f,jsxs as T}from"react/jsx-runtime";import p from"next/link";import{HideTaker as S}from"efficient-web-builder/render/components/ViewHideRoot";import{PHOTO_HOST_ATTR as L}from"efficient-web-builder/format/lib/content/image-treatment";import{BOX_LINK_ATTR as N,BOX_LINK_CLASS as O,BOX_LINKED_CLASS as j}from"efficient-web-builder/format/lib/content/box-link";function x({surface:s,span:n,href:t,label:a,linked:c=!0,probes:i,arm:o,layer:e,children:l}){const r=c&&!!t,m=[s,r?j:"",n??""].filter(Boolean).join(" "),u=o?{onPointerEnter:o,onTouchStart:o,onFocusCapture:o}:{},_=e?{[L]:""}:{};return T(S,{as:"article",className:m,..._,...u,children:[i,r?f(p,{href:t,"aria-label":a,className:O,[N]:""}):null,l,e]})}export{x as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as o,useContext as i}from"react";import{HideTaker as a}from"efficient-web-builder/render/components/ViewHideRoot";const u={headingSmall1:"text-[length:var(--size-headingSmall,22px)]",headingSmall2:"text-[length:var(--size-headingSmall,30px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},
|
|
1
|
+
"use client";import{jsx as t,Fragment as n}from"react/jsx-runtime";import{createContext as o,useContext as i}from"react";import{HideTaker as a}from"efficient-web-builder/render/components/ViewHideRoot";const u={headingSmall1:"text-[length:var(--size-headingSmall,22px)]",headingSmall2:"text-[length:var(--size-headingSmall,30px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},x=o("catalog");function s(){return i(x)==="catalog"}function l({children:e}){const r=s();return t(n,{children:e??(r?t(a,{"aria-hidden":!0}):null)})}function m({children:e}){return t(l,{children:e?t(a,{children:e}):null})}function p({children:e}){return t(l,{children:e?t(a,{className:"[.sf-card-rows>*>&]:self-end",children:e}):null})}export{u as CARD_TEXT_SIZE,p as CardButtonRow,m as CardControlRow,x as CardLookContext,l as CardRow,s as useCatalogCard};
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { SlotComponent } from "efficient-easel/blocks";
|
|
2
|
+
import type { CardPressTitle } from "efficient-web-builder/render/lib/document/card-press-titles";
|
|
2
3
|
import type { FirstShown } from "../../lib/wheels/shopper-first-paint.js";
|
|
4
|
+
export type ChipsOwner = {
|
|
5
|
+
id: string;
|
|
6
|
+
template?: SlotComponent;
|
|
7
|
+
pressTitles?: readonly CardPressTitle[];
|
|
8
|
+
};
|
|
3
9
|
export default function ShopperChips({ owner, showCount, showClear, showSort, firstShown, editing, }: {
|
|
4
|
-
owner:
|
|
5
|
-
id: string;
|
|
6
|
-
template?: SlotComponent;
|
|
7
|
-
};
|
|
10
|
+
owner: ChipsOwner;
|
|
8
11
|
showCount: boolean;
|
|
9
12
|
showClear: boolean;
|
|
10
13
|
showSort: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as
|
|
1
|
+
"use client";import{jsx as e,Fragment as y,jsxs as L}from"react/jsx-runtime";import{CardTemplateRows as G}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as K}from"efficient-web-builder/format/lib/content/card-template";import{say as O}from"efficient-web-builder/format/lib/editor-words";import{useCurrency as B}from"../CurrencyContext.js";import{formatPrice as I}from"../../lib/commerce.js";import{filterChipItems as Y,filterStateWithoutChip as j,optionCardRows as M}from"../../lib/sections/filter-option-rows.js";import{PlpResultRange as R,PlpToolbar as S}from"../wheels-plp/PlpToolbar.js";import A from"./ClearAllButton.js";import b from"./SortSelect.js";import{hasActivePlpFilters as H,plpSortKeysFor as U,PLP_SORT_LABELS as W}from"../../lib/wheels/plp-filters.js";import{itemKind as X,plpKindNoun as Z}from"../../lib/catalog/plp-item.js";import{CATALOG_TEXT_SIZE as $}from"../../lib/sections/catalog-text-size.js";import{EMPTY_PLP_FILTERS as q}from"../../lib/wheels/plp-filters.js";import{GALLERY_SORT_KEYS as z,GALLERY_SORT_LABELS as D}from"../../lib/sections/gallery-toolbar.js";import{useShopperMember as J}from"./ShopperScope.js";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";const Q="✕";function V({owner:n,showCount:l,showClear:a,showSort:i,firstShown:r,editing:t}){const{ref:s,scope:o,gallery:f}=J("chips",null,{count:l,sort:i}),{currency:c}=B(),m=(!o?.live&&r?{state:o?.state??{...q,sort:r.sort},update:()=>{},clear:()=>{},total:r.total,range:r.range,kinds:r.kinds}:null)??(o?{...o,kinds:[...new Set(o.rows.map(X))]}:null);if(!m&&f)return e(C,{as:"div",ref:s,"data-shopper-chips":"",children:e(ee,{owner:n,gallery:f,showCount:l,showClear:a,showSort:i,editing:t})});if(!m)return e(C,{as:"div",ref:s,"data-shopper-chips":"",children:t&&e("p",{className:`font-mono ${$.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:"Filter chips show the picks of a Filters block, or the Tags of a Gallery, in this Box"})});const{state:d,update:u,clear:T,total:p,range:x,kinds:h}=m,E=Z(h.length?h:["alloy-wheel"]),P=H(d),_=Y(d,c,I).map(g=>({...g,mark:Q,press:()=>u(N=>j(N,g))})),w=L(y,{children:[l&&e("div",{"data-shopper-count":"",className:"contents",children:e(R,{total:p,range:x??{from:p?1:0,to:p},noun:E})}),_.length>0&&e(v,{owner:n,chips:_,editing:t}),a&&P&&e(A,{onClick:T})]}),F=U(h.length?h:["alloy-wheel"]);return e(C,{as:"div",ref:s,"data-shopper-chips":"",children:e(S,{start:w,end:i?e(b,{value:d.sort,keys:F,labels:W,onChange:g=>u({sort:g,page:1})}):void 0})})}function v({owner:n,chips:l,selected:a,editing:i}){const r=M(l,{item:t=>t,selected:(t,s)=>s===a,press:t=>t.press});return e("ul",{className:"flex list-none flex-wrap items-center gap-2",children:e(G,{ownerId:n.id,ownerType:"FilterChipsBlock",Template:n.template,rows:r.items.map(K),items:r.items,states:a===void 0?void 0:r.states,actions:i?void 0:r.actions,pressTitles:n.pressTitles,fallback:null,wrapCopy:t=>e("li",{children:t}),children:t=>t})})}function ee({owner:n,gallery:l,showCount:a,showClear:i,showSort:r,editing:t}){const{tags:s,tag:o,sort:f,shown:c,pick:k,setSort:m,clear:d}=l,u=[{label:O("All"),mark:"",press:()=>k(null)},...s.map(p=>({label:p,mark:"",press:()=>k(p)}))],T=L(y,{children:[a&&e("div",{"data-shopper-count":"",className:"contents",children:e(R,{total:c,range:{from:c?1:0,to:c},noun:te})}),s.length>0&&e(v,{owner:n,chips:u,selected:o===null?0:s.indexOf(o)+1,editing:t}),i&&o!==null&&e(A,{onClick:d})]});return e(S,{start:T,end:r?e(b,{value:f,keys:z,labels:D,onChange:m}):void 0})}const te={many:"items"};export{V as default};
|