efficient-storefront-blocks 0.98.0 → 0.99.1
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 +46 -0
- package/dist/chunks/EditorPreviewCheckout-EBG3NMJI.js +4 -0
- package/dist/chunks/{SiteEditorProvider-LW5QSBKM.js → SiteEditorProvider-YAIB64UV.js} +1 -1
- package/dist/chunks/chunk-5VSNQZU6.js +1 -0
- package/dist/chunks/chunk-DOJJTEJV.js +1 -0
- package/dist/chunks/{chunk-4QN263UJ.js → chunk-KRMWJLBM.js} +2 -2
- package/dist/chunks/{fitment-data-BRGBDG7Y.js → fitment-data-PXY35OVC.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/editor/components/GalleryShowcaseSource.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/SearchBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/BookingBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/DealerFinder/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/DealerFinder/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBox/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/index.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/popup-look-fields.d.ts +1 -0
- package/dist/editor/lib/document/popup-look-fields.js +1 -1
- package/dist/editor/lib/document/text-kind-style-rows.d.ts +5 -0
- package/dist/editor/lib/document/text-kind-style-rows.js +1 -0
- package/dist/editor/lib/storefront-editor-words.d.ts +4 -2
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +31 -31
- package/dist/links.js +1 -1
- package/dist/render/app/globals.css +136 -12
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CatalogFilterBarSection.js +1 -1
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/CouponField.d.ts +2 -1
- package/dist/render/components/CouponField.js +1 -1
- package/dist/render/components/CurrencyContext.d.ts +3 -0
- package/dist/render/components/CurrencyContext.js +1 -1
- package/dist/render/components/DealerFinderSection.d.ts +18 -0
- package/dist/render/components/DealerFinderSection.js +1 -0
- package/dist/render/components/FooterMenu.d.ts +5 -3
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FormBlock.d.ts +4 -1
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/HeaderToolBlocks.d.ts +4 -2
- package/dist/render/components/HeaderToolBlocks.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +7 -2
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/PhoneSheet.d.ts +16 -0
- package/dist/render/components/PhoneSheet.js +1 -0
- package/dist/render/components/PreOrderPanel.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/SectionGroupBody.d.ts +2 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/Subscribe.d.ts +1 -0
- package/dist/render/components/Subscribe.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/useTaxNote.d.ts +1 -0
- package/dist/render/components/card-pieces/useTaxNote.js +1 -0
- package/dist/render/components/catalog/CatalogFilterBar.d.ts +5 -1
- package/dist/render/components/catalog/CatalogFilterBar.js +1 -1
- package/dist/render/components/catalog/CatalogFilterContext.d.ts +2 -0
- package/dist/render/components/catalog/CatalogFilterContext.js +1 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/PriceRange.d.ts +6 -1
- package/dist/render/components/catalog/PriceRange.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +2 -0
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/fitment/PickerField.js +1 -1
- package/dist/render/components/formSubmission.d.ts +4 -2
- package/dist/render/components/formSubmission.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.d.ts +0 -3
- package/dist/render/components/pdp-dynamic/DynamicSpecTable.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicWheelDiagram.js +1 -1
- package/dist/render/components/submit/SubmitRegions.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.d.ts +2 -1
- package/dist/render/components/wheels-plp/PlpActiveChips.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +15 -7
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.d.ts +6 -1
- package/dist/render/components/wheels-plp/useVehicleCatalog.js +1 -1
- package/dist/render/lib/api/index.d.ts +4 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +1 -0
- package/dist/render/lib/booking/text-kinds.js +1 -1
- package/dist/render/lib/catalog/tax-note.d.ts +4 -0
- package/dist/render/lib/catalog/tax-note.js +1 -0
- package/dist/render/lib/content/article-page-seed.js +1 -1
- package/dist/render/lib/content/menu-row.d.ts +16 -0
- package/dist/render/lib/content/menu-row.js +1 -1
- package/dist/render/lib/content/text-kind-vars.d.ts +4 -0
- package/dist/render/lib/content/text-kind-vars.js +1 -0
- package/dist/render/lib/document/blocks/commerce/SearchBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/service/DealerFinder/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/render.d.ts +4 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/render.js +1 -0
- package/dist/render/lib/document/blocks/service/SiteHeader/render.js +1 -1
- package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/metas.js +1 -1
- package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/renders.js +1 -1
- package/dist/render/lib/document/blocks/text-part-shapes.json +10 -0
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-service.js +1 -1
- package/dist/render/lib/popup/text-kind-style.js +1 -1
- package/dist/render/lib/sections/dealer-finder.d.ts +41 -0
- package/dist/render/lib/sections/dealer-finder.js +1 -0
- package/dist/render/lib/submit/text-kinds.js +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.d.ts +1 -1
- package/dist/render/lib/wheels/catalog-filters-to-listing.js +1 -1
- package/dist/render/lib/wheels/plp-filters.d.ts +5 -0
- package/dist/render/lib/wheels/plp-filters.js +1 -1
- package/dist/render/lib/wheels/wheel-sheet.d.ts +3 -0
- package/dist/render/lib/wheels/wheel-sheet.js +1 -0
- package/dist/words.d.ts +4 -2
- package/dist/words.js +1 -1
- package/package.json +2 -2
- package/dist/chunks/EditorPreviewCheckout-2FW4VEOK.js +0 -4
- package/dist/chunks/chunk-PWSMCGXO.js +0 -1
- package/dist/chunks/chunk-SEIKSSUW.js +0 -1
- /package/dist/chunks/{chunk-XEZ7BYVZ.js → chunk-B2IYTOE3.js} +0 -0
- /package/dist/chunks/{chunk-4QN263UJ.js.LEGAL.txt → chunk-KRMWJLBM.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-GOHV3G3C.js → chunk-QP2F42DV.js} +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 ce=["main","text","background","muted"],tn=[...ce,"surface"];var rn={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 pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var _=[{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}],de=["highlight","quiet"],on=pe.map(e=>e.style).filter(e=>_.some(n=>n.kind===e)).filter(e=>!de.includes(e)),sn=[..._,{open:"*",close:"*",kind:"accent"}],ln=[..._,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var an=["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||an.includes(n[1].toLowerCase())}var fe=["width","profile","rim"];var un=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,cn={width:[100,500],profile:[20,100],rim:[10,30]};function B(e){let n=un.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return fe.every(o=>{let[i,a]=cn[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 me(e){return[R({width:e.width}),R({width:e.width,profile:e.profile}),R(e)]}var k=["alloy-wheel","tyre"],ge=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var St=k.map(e=>({value:e,label:F[e]}));function O(e){return e==null?[...ge]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ge]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function W(e){return m(e).brand??""}function he(e){return m(e).prices??void 0}function ye(e){return m(e).inStock!==!1}function Pe(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 Se(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 be(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function ke(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function xe(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function we(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;function V(e,n){return Object.hasOwn(e,n)?e[n]:void 0}function Te(e,n){return Object.hasOwn(e,n)}var Le=null;function _e(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Te(n,r)?String(V(n,r)):t):e}function y(e,n){let t=Le?V(Le,e):void 0;if(typeof t=="function"){try{let r=Y(t(n??{}));if(r)return r}catch{}return _e(e,n)}return _e(Y(t)??e,n)}function q(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}),Rt=A(30,0,100,10),Ft=A(0,0,100,5),Ot=A(100,0,100,5),At=A(2,0,4,.5);function Re(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Fe="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 j="#popup:";function Oe(e){return`${j}${e}`}function Ae(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 D(...e){let n=new Set,t=[];for(let r of e)for(let o of r?.content??[]){let i=Re(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 Ee(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var pn=()=>({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(Ae(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ee(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 Ie(e,n){let t=pn(),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:Oe(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 Ne=Object.freeze([]);function Z(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function Ce(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 ve(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 De(e){return fn(e,"filter")}var dn="collection";function Q(e,n){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":dn},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function fn(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}var X={inStock:"In stock",outOfStock:"Out of stock",notInStockHere:"Not in stock here"};function mn(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ke(e,n){let t=e?.[n];return mn(t)?t:null}function Me(e,n,t,r){if(t==null&&r==null)return!0;let o=Ke(e,n);return!(o===null||t!=null&&o<t||r!=null&&o>r)}function Ue(e){let n=e.spec?.lugs;return typeof n=="number"?n:null}var gn={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},mr=Object.keys(gn);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},hn={diameters:"tyreSizes"};function yn(e){if(e.length===0)return[];let n=J.filter(t=>e.every(r=>ee[t].includes(r)));return n.filter(t=>{let r=hn[t];return!r||!n.includes(r)})}function Pn(e){let n=new Set;for(let t of e)n.add(d(t));return[...n]}var ne={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function ze(e,n,t,r=null,o="fail"){let i=d(e),a=p=>o==="fail"||(p==="lugs"?i==="alloy-wheel":ee[p].includes(i));if(r!=="kind"&&n.kind&&i!==n.kind)return!1;for(let p of J){if(r===p)continue;let l=n[p];if(l.length===0||!a(p))continue;let c=l.map(String);if(!$e(e,p).some(s=>c.includes(s)))return!1}if(r!=="lugs"&&n.lugs&&n.lugs.length>0&&a("lugs")){let p=Ue(e);if(p===null||!n.lugs.includes(p))return!1}return!(r!=="price"&&!Me(he(e),t,n.priceMin??null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!ye(e))}var Sn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function $e(e,n){switch(n){case"tyreSizes":return[...new Set(we(e).flatMap(me))];case"brands":return W(e)?[W(e)]:[];case"finishes":return Se(e);case"diameters":return Pe(e).map(String);case"collections":return H(e);case"pcds":return be(e);case"tyreTypes":return ke(e);case"speedRatings":return xe(e)}}function bn(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 Be(e,n,t,r=Pn(e),o=Ne,i="fail"){let a=u=>xn(u,r,o),p=bn(e),c=(i==="pass"?J.filter(u=>r.some(b=>ee[u].includes(b))):yn(r)).filter(u=>u!=="tyreSizes").filter(a).map(u=>{let b=n[u].map(String),ue=new Set,z=new Map,L=new Map;for(let f of e){let S=$e(f,u);for(let g of S)ue.add(g);for(let g of new Set(S))L.set(g,(L.get(g)??0)+1);if(ze(f,n,t,u,i))for(let g of new Set(S))z.set(g,(z.get(g)??0)+1)}let nn=[...ue].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:Sn[u],options:nn}}).filter(u=>u.options.length>kn),s=[];for(let u of c){let b=wn(u.key,r,o);b!==void 0&&s.push({fieldKey:u.key,filterOrder:b})}return[...ve(c,u=>u.key,s,"filterOrder")]}var kn=1;function We(e){return e.showCollection===!1?["collections"]:[]}function xn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>De(Z(t,r))(Q(e,r)))}function wn(e,n,t){if(t.length===0)return;let r;for(let o of n){let i=Ce(Z(t,o),"filter")(Q(e,o));i!==void 0&&(r===void 0||i<r)&&(r=i)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},re="type";var x="FilterBlock";function Ge(e){let n=e;return!!n&&typeof n=="object"&&typeof n.type=="string"&&!!n.props&&typeof n.props=="object"}function Tn(e){return Object.entries(e.props??{}).filter(n=>Array.isArray(n[1])&&n[1].length>0&&n[1].every(Ge))}function Ln(e){let n=e??{},t=[];Array.isArray(n.content)&&t.push(n.content);for(let r of Object.values(n.zones??{}))Array.isArray(r)&&t.push(r);return t}function He(e){let n=[],t=(r,o)=>{let i=[r,...o];for(let a of r)if(Ge(a)){n.push({node:a,order:n.length,lists:i});for(let[,p]of Tn(a))t(p,i)}};for(let r of Ln(e))t(r,[]);return n}function w(e){return He(e).map(n=>n.node)}var oe={vehicle:"My Car",process:"Process",size:"Size",lugs:"Lugs",finish:"Finish",price:"Price"};var Lr=[{value:"inStock",label:X.inStock},{value:"category",label:"Category"},{value:"lugs",label:oe.lugs},{value:"price",label:oe.price}];var Ve="AlloyWheelsListing";function qe(e){return $(e.trim())}var T="/wheels",M="Products";function je(e,n){return n>1?`${M} \xB7 ${e}`:M}function ie(...e){for(let n of[Ve,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 ie(...e)!==null}function Ze(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 se=[re,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Qe(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 On(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Xe(e){let n=new URLSearchParams(Qe(e).query);for(let t of se){let r=n.get(t);if(r)return{param:t,value:r}}return null}function le(e,n){let{path:t,query:r,hash:o}=Qe(e),i=r.split("&").filter(a=>a&&!se.includes(On(a.split("=")[0])));return n?.value&&i.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${i.length?`?${i.join("&")}`:""}${o}`}function Je(e,n){let t=le(e,null);return n.includes(t)?t:e}function An(e,n,t=[]){return K(e,n,{listingPaths:t,targetOf:r=>Je(r,t)})}function En(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 en="Product type",In="AUD";function ae(e,n){let t=n.listing??{},r=O(t.kinds),o=e.filter(l=>r.includes(d(l))),i=We(t),a=Be(o,ne,In,r,n.fieldUsage).filter(l=>!i.includes(l.key)).map(l=>({param:te[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:re,label:en,values:p.map(l=>({value:l,label:F[l]}))}),a}function Nn(e){return n=>{let t=Ze(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:je(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 ae(e.catalogue,{listing:i?ie(...i.docs):null,fieldUsage:e.fieldUsage})},readFilter:Xe,withFilter:le}}}function Cn(e){let n=Nn({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Ie({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:qe},filtersFor:t.filtersFor??(()=>null)}}function yo(e,n){return ae(e,n)}export{T as BUILT_IN_LISTING_PATH,E as LINK_KINDS,se as LISTING_FILTER_PARAMS,M as LISTING_PAGE_LABEL,en as PRODUCT_TYPE_FILTER_LABEL,v as anchorPath,En as fieldUsageFromAdminRows,An as inferLinkKind,U as isProductListingPage,qe as isSafeLink,I as linkKindsFor,Cn as linkPickerSetup,yo as listingFilterFields,ie as listingNode,je as listingPageLabel,Je as listingTarget,D as pageAnchors,P as pagePath,N as postPath,Ze as productListingPaths,Xe as readListingFilter,C as wheelPath,le 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 ce=["main","text","background","muted"],tn=[...ce,"surface"];var rn={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 pe=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var _=[{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}],de=["highlight","quiet"],on=pe.map(e=>e.style).filter(e=>_.some(n=>n.kind===e)).filter(e=>!de.includes(e)),sn=[..._,{open:"*",close:"*",kind:"accent"}],ln=[..._,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var an=["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||an.includes(n[1].toLowerCase())}var fe=["width","profile","rim"];var un=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,cn={width:[100,500],profile:[20,100],rim:[10,30]};function B(e){let n=un.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return fe.every(o=>{let[i,a]=cn[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 me(e){return[R({width:e.width}),R({width:e.width,profile:e.profile}),R(e)]}var k=["alloy-wheel","tyre"],ge=["alloy-wheel"],F={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var St=k.map(e=>({value:e,label:F[e]}));function O(e){return e==null?[...ge]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ge]}var m=e=>e;function d(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function W(e){return m(e).brand??""}function he(e){return m(e).prices??void 0}function ye(e){return m(e).inStock!==!1}function Pe(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 Se(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 be(e){return d(e)==="tyre"?[]:m(e).spec?.pcds??[]}function ke(e){return d(e)!=="tyre"?[]:m(e).tyreTypes??[]}function xe(e){return d(e)!=="tyre"?[]:m(e).speedRatings??[]}function we(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;function V(e,n){return Object.hasOwn(e,n)?e[n]:void 0}function Te(e,n){return Object.hasOwn(e,n)}var Le=null;function _e(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Te(n,r)?String(V(n,r)):t):e}function y(e,n){let t=Le?V(Le,e):void 0;if(typeof t=="function"){try{let r=Y(t(n??{}));if(r)return r}catch{}return _e(e,n)}return _e(Y(t)??e,n)}function q(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}),Rt=A(30,0,100,10),Ft=A(0,0,100,5),Ot=A(100,0,100,5),At=A(2,0,4,.5);function Re(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}var Fe="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 j="#popup:";function Oe(e){return`${j}${e}`}function Ae(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 D(...e){let n=new Set,t=[];for(let r of e)for(let o of r?.content??[]){let i=Re(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 Ee(e){return/^\/wheels\/[^/?#]+(?:[?#].*)?$/.test(e)}var pn=()=>({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(Ae(e))return"popup";if(e.startsWith("/journal/"))return"blog";if(Ee(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 Ie(e,n){let t=pn(),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:Oe(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 Ne=Object.freeze([]);function Z(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function Ce(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 ve(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 De(e){return fn(e,"filter")}var dn="collection";function Q(e,n){return{tyreSizes:{},brands:{"alloy-wheel":"brand",tyre:"brand"},finishes:{"alloy-wheel":"wheel_finish_ref"},diameters:{"alloy-wheel":"diameter",tyre:"rim_diameter"},collections:{"alloy-wheel":dn},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function fn(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}var X={inStock:"In stock",outOfStock:"Out of stock",notInStockHere:"Not in stock here"};function mn(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Ke(e,n){let t=e?.[n];return mn(t)?t:null}function Me(e,n,t,r){if(t==null&&r==null)return!0;let o=Ke(e,n);return!(o===null||t!=null&&o<t||r!=null&&o>r)}function Ue(e){let n=e.spec?.lugs;return typeof n=="number"?n:null}var gn={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},mr=Object.keys(gn);var J=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],ee={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},hn={diameters:"tyreSizes"};function yn(e){if(e.length===0)return[];let n=J.filter(t=>e.every(r=>ee[t].includes(r)));return n.filter(t=>{let r=hn[t];return!r||!n.includes(r)})}function Pn(e){let n=new Set;for(let t of e)n.add(d(t));return[...n]}var ne={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,priceMin:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function ze(e,n,t,r=null,o="fail"){let i=d(e),a=p=>o==="fail"||(p==="lugs"?i==="alloy-wheel":ee[p].includes(i));if(r!=="kind"&&n.kind&&i!==n.kind)return!1;for(let p of J){if(r===p)continue;let l=n[p];if(l.length===0||!a(p))continue;let c=l.map(String);if(!$e(e,p).some(s=>c.includes(s)))return!1}if(r!=="lugs"&&n.lugs&&n.lugs.length>0&&a("lugs")){let p=Ue(e);if(p===null||!n.lugs.includes(p))return!1}return!(r!=="price"&&!Me(he(e),t,n.priceMin??null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!ye(e))}var Sn={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function $e(e,n){switch(n){case"tyreSizes":return[...new Set(we(e).flatMap(me))];case"brands":return W(e)?[W(e)]:[];case"finishes":return Se(e);case"diameters":return Pe(e).map(String);case"collections":return H(e);case"pcds":return be(e);case"tyreTypes":return ke(e);case"speedRatings":return xe(e)}}function bn(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 Be(e,n,t,r=Pn(e),o=Ne,i="fail"){let a=u=>xn(u,r,o),p=bn(e),c=(i==="pass"?J.filter(u=>r.some(b=>ee[u].includes(b))):yn(r)).filter(u=>u!=="tyreSizes").filter(a).map(u=>{let b=n[u].map(String),ue=new Set,z=new Map,L=new Map;for(let f of e){let S=$e(f,u);for(let g of S)ue.add(g);for(let g of new Set(S))L.set(g,(L.get(g)??0)+1);if(ze(f,n,t,u,i))for(let g of new Set(S))z.set(g,(z.get(g)??0)+1)}let nn=[...ue].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:Sn[u],options:nn}}).filter(u=>u.options.length>kn),s=[];for(let u of c){let b=wn(u.key,r,o);b!==void 0&&s.push({fieldKey:u.key,filterOrder:b})}return[...ve(c,u=>u.key,s,"filterOrder")]}var kn=1;function We(e){return e.showCollection===!1?["collections"]:[]}function xn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>De(Z(t,r))(Q(e,r)))}function wn(e,n,t){if(t.length===0)return;let r;for(let o of n){let i=Ce(Z(t,o),"filter")(Q(e,o));i!==void 0&&(r===void 0||i<r)&&(r=i)}return r}var te={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},re="type";var x="FilterBlock";function Ge(e){let n=e;return!!n&&typeof n=="object"&&typeof n.type=="string"&&!!n.props&&typeof n.props=="object"}function Tn(e){return Object.entries(e.props??{}).filter(n=>Array.isArray(n[1])&&n[1].length>0&&n[1].every(Ge))}function Ln(e){let n=e??{},t=[];Array.isArray(n.content)&&t.push(n.content);for(let r of Object.values(n.zones??{}))Array.isArray(r)&&t.push(r);return t}function He(e){let n=[],t=(r,o)=>{let i=[r,...o];for(let a of r)if(Ge(a)){n.push({node:a,order:n.length,lists:i});for(let[,p]of Tn(a))t(p,i)}};for(let r of Ln(e))t(r,[]);return n}function w(e){return He(e).map(n=>n.node)}var oe={vehicle:"My Car",process:"Process",size:"Size",lugs:"Lugs",finish:"Finish",price:"Price"};var Lr=[{value:"inStock",label:X.inStock},{value:"category",label:"Category"},{value:"lugs",label:oe.lugs},{value:"price",label:oe.price}];var Ve="AlloyWheelsListing";function qe(e){return $(e.trim())}var T="/wheels",M="Products";function je(e,n){return n>1?`${M} \xB7 ${e}`:M}function ie(...e){for(let n of[Ve,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 ie(...e)!==null}function Ze(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 se=[re,...Object.entries(te).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Qe(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 On(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Xe(e){let n=new URLSearchParams(Qe(e).query);for(let t of se){let r=n.get(t);if(r)return{param:t,value:r}}return null}function le(e,n){let{path:t,query:r,hash:o}=Qe(e),i=r.split("&").filter(a=>a&&!se.includes(On(a.split("=")[0])));return n?.value&&i.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${i.length?`?${i.join("&")}`:""}${o}`}function Je(e,n){let t=le(e,null);return n.includes(t)?t:e}function An(e,n,t=[]){return K(e,n,{listingPaths:t,targetOf:r=>Je(r,t)})}function En(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 en="Product type",In="AUD";function ae(e,n){let t=n.listing??{},r=O(t.kinds),o=e.filter(l=>r.includes(d(l))),i=We(t),a=Be(o,ne,In,r,n.fieldUsage).filter(l=>!i.includes(l.key)).map(l=>({param:te[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:re,label:en,values:p.map(l=>({value:l,label:F[l]}))}),a}function Nn(e){return n=>{let t=Ze(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:je(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 ae(e.catalogue,{listing:i?ie(...i.docs):null,fieldUsage:e.fieldUsage})},readFilter:Xe,withFilter:le}}}function Cn(e){let n=Nn({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=Ie({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:qe},filtersFor:t.filtersFor??(()=>null)}}function yo(e,n){return ae(e,n)}export{T as BUILT_IN_LISTING_PATH,E as LINK_KINDS,se as LISTING_FILTER_PARAMS,M as LISTING_PAGE_LABEL,en as PRODUCT_TYPE_FILTER_LABEL,v as anchorPath,En as fieldUsageFromAdminRows,An as inferLinkKind,U as isProductListingPage,qe as isSafeLink,I as linkKindsFor,Cn as linkPickerSetup,yo as listingFilterFields,ie as listingNode,je as listingPageLabel,Je as listingTarget,D as pageAnchors,P as pagePath,N as postPath,Ze as productListingPaths,Xe as readListingFilter,C as wheelPath,le as withListingFilter};
|
|
@@ -1113,19 +1113,19 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1113
1113
|
Header Setting To The Box Header: `Own row` stacks exactly as the old
|
|
1114
1114
|
header did, to 1500px, so a switched site looks the same at every width. */
|
|
1115
1115
|
@media (min-width: 720px) and (max-width: 1500px) {
|
|
1116
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row:has([data-menu-row]) {
|
|
1116
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row:has([data-menu-row]) {
|
|
1117
1117
|
flex-wrap: wrap;
|
|
1118
1118
|
row-gap: 12px;
|
|
1119
1119
|
}
|
|
1120
1120
|
/* The links: their own line, last, under the hairline. */
|
|
1121
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row:has([data-menu-row]) > :is([data-menu-row], :has([data-menu-row])) {
|
|
1121
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row:has([data-menu-row]) > :is([data-menu-row], :has([data-menu-row])) {
|
|
1122
1122
|
order: 99;
|
|
1123
1123
|
flex: 1 0 100%;
|
|
1124
1124
|
border-top: 1px solid color-mix(in oklab, var(--site-line) 60%, transparent);
|
|
1125
1125
|
padding-top: 10px;
|
|
1126
1126
|
}
|
|
1127
1127
|
/* The logo takes the top line's room, so the tools sit at its end. */
|
|
1128
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row:has([data-menu-row]) > :first-child:not([data-menu-row], :has([data-menu-row])) {
|
|
1128
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row:has([data-menu-row]) > :first-child:not([data-menu-row], :has([data-menu-row])) {
|
|
1129
1129
|
flex: 1 1 0;
|
|
1130
1130
|
container-type: inline-size;
|
|
1131
1131
|
overflow-x: clip;
|
|
@@ -1158,6 +1158,77 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1158
1158
|
letter-spacing: normal;
|
|
1159
1159
|
}
|
|
1160
1160
|
|
|
1161
|
+
/* ─── THE MENU BUTTON HEADER ─────────────────────────────────────────
|
|
1162
|
+
A header group whose one-row Menu stores `Menu style` Menu button
|
|
1163
|
+
(`data-menu-show="button"`, components/FooterMenu) is ONE line at every
|
|
1164
|
+
width: the Box holding the Menu at the left, the logo in the middle, the
|
|
1165
|
+
last Box at the right (the design's grid `1fr auto 1fr`). The phone rules
|
|
1166
|
+
that put the menu button last, and the 720-1500 two-row rules (which skip
|
|
1167
|
+
this group, above), step aside. */
|
|
1168
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"], > [data-easel-block] [data-menu-show="button"]) {
|
|
1169
|
+
flex-wrap: nowrap;
|
|
1170
|
+
}
|
|
1171
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :first-child,
|
|
1172
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :last-child {
|
|
1173
|
+
flex: 1 1 0%;
|
|
1174
|
+
min-width: 0;
|
|
1175
|
+
order: 0;
|
|
1176
|
+
}
|
|
1177
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :not(:first-child):not(:last-child) {
|
|
1178
|
+
flex: 0 0 auto;
|
|
1179
|
+
order: 0;
|
|
1180
|
+
container-type: normal;
|
|
1181
|
+
}
|
|
1182
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) .flex-row {
|
|
1183
|
+
flex-wrap: nowrap;
|
|
1184
|
+
}
|
|
1185
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) .flex-row > * {
|
|
1186
|
+
/* A Box's items-per-row below 1100 (`phoneRow`) would give each item a
|
|
1187
|
+
third of the cell: in the bar each is as wide as it draws. */
|
|
1188
|
+
flex: 0 0 auto;
|
|
1189
|
+
width: auto;
|
|
1190
|
+
}
|
|
1191
|
+
/* 720 to 1099: the one line does not hold the logo at its own size, so the
|
|
1192
|
+
logo's cell takes what is left and the Logo fits itself to it. */
|
|
1193
|
+
@media (min-width: 720px) and (max-width: 1099px) {
|
|
1194
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :first-child,
|
|
1195
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :last-child {
|
|
1196
|
+
flex: 0 0 auto;
|
|
1197
|
+
}
|
|
1198
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :not(:first-child):not(:last-child) {
|
|
1199
|
+
flex: 1 1 0%;
|
|
1200
|
+
min-width: 0;
|
|
1201
|
+
container-type: inline-size;
|
|
1202
|
+
overflow-x: clip;
|
|
1203
|
+
display: flex;
|
|
1204
|
+
justify-content: center;
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
@media not all and (min-width: 720px) {
|
|
1208
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has([data-menu-row]) > :is([data-menu-row], :has([data-menu-row])) {
|
|
1209
|
+
order: 0;
|
|
1210
|
+
}
|
|
1211
|
+
/* The logo's cell takes the middle share and is the query container the
|
|
1212
|
+
Logo fits itself to (components/Logo `fitToContainer`). */
|
|
1213
|
+
[data-section-group="header"]:has([data-menu-show="button"]) .flex-row:has(> * [data-menu-show="button"]) > :not(:first-child):not(:last-child) {
|
|
1214
|
+
flex: 2 1 0%;
|
|
1215
|
+
min-width: 0;
|
|
1216
|
+
container-type: inline-size;
|
|
1217
|
+
overflow-x: clip;
|
|
1218
|
+
display: flex;
|
|
1219
|
+
justify-content: center;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
/* The header's tool words (Menu, Search, Contact, US · USD): ONE site text
|
|
1223
|
+
style (the Site Header's `Tool words`). Only a stored style sets the
|
|
1224
|
+
attribute, so an unset header draws exactly today's label type. */
|
|
1225
|
+
[data-section-group="header"][data-header-tool-style] .mono-eyebrow-ctl,
|
|
1226
|
+
[data-section-group="header"][data-header-tool-style] [data-menu-row] > ul,
|
|
1227
|
+
[data-section-group="header"][data-header-tool-style] [data-phone-menu-tool="region"] button {
|
|
1228
|
+
font-family: var(--sf-header-tool-font);
|
|
1229
|
+
font-size: var(--sf-header-tool-size);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1161
1232
|
/* ─── THE BOX HEADER'S MENU ALIGNMENT ─────────────────────────────────
|
|
1162
1233
|
Where the old header put its menu, as the page Menu's `Link alignment` and
|
|
1163
1234
|
`Show links` (lib/content/menu-row; Lewis 2026-10-12).
|
|
@@ -1228,16 +1299,16 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1228
1299
|
}
|
|
1229
1300
|
@media (min-width: 720px) and (max-width: 1500px) {
|
|
1230
1301
|
/* Own row stacks: the links start their own line, as the old second row. */
|
|
1231
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) [data-menu-row][data-menu-align] > ul {
|
|
1302
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) [data-menu-row][data-menu-align] > ul {
|
|
1232
1303
|
justify-content: flex-start;
|
|
1233
1304
|
}
|
|
1234
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) [data-menu-row] li[data-menu-out] {
|
|
1305
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) [data-menu-row] li[data-menu-out] {
|
|
1235
1306
|
display: list-item;
|
|
1236
1307
|
}
|
|
1237
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) {
|
|
1308
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) {
|
|
1238
1309
|
display: none;
|
|
1239
1310
|
}
|
|
1240
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) + * {
|
|
1311
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) + * {
|
|
1241
1312
|
flex: 1 1 0;
|
|
1242
1313
|
container-type: inline-size;
|
|
1243
1314
|
overflow-x: clip;
|
|
@@ -1246,15 +1317,15 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1246
1317
|
Search position (components/Header, the medium band); the position only
|
|
1247
1318
|
ever applied to the one-row bar. The logo stays ahead of it where a
|
|
1248
1319
|
centred logo's Box is opened below. */
|
|
1249
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) [data-phone-menu-tool="search"] > *,
|
|
1250
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) [data-easel-block]:has(> * > [data-phone-menu-tool="search"]) {
|
|
1320
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) [data-phone-menu-tool="search"] > *,
|
|
1321
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) [data-easel-block]:has(> * > [data-phone-menu-tool="search"]) {
|
|
1251
1322
|
order: -1;
|
|
1252
1323
|
}
|
|
1253
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) + * {
|
|
1324
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) + * {
|
|
1254
1325
|
order: -2;
|
|
1255
1326
|
}
|
|
1256
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row:has([data-menu-part="lead"]) > :has([data-menu-row]):not([data-menu-row]):not(:has([data-menu-part="lead"])),
|
|
1257
|
-
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row:has([data-menu-part="lead"]) > :has([data-menu-row]):not([data-menu-row]):not(:has([data-menu-part="lead"])) :has([data-menu-row]):not([data-menu-row]) {
|
|
1327
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row:has([data-menu-part="lead"]) > :has([data-menu-row]):not([data-menu-row]):not(:has([data-menu-part="lead"])),
|
|
1328
|
+
[data-section-group="header"]:not([data-header-menu-row="inline"]):not(:has([data-menu-show="button"])) .flex-row:has([data-menu-part="lead"]) > :has([data-menu-row]):not([data-menu-row]):not(:has([data-menu-part="lead"])) :has([data-menu-row]):not([data-menu-row]) {
|
|
1258
1329
|
display: contents;
|
|
1259
1330
|
}
|
|
1260
1331
|
}
|
|
@@ -3788,3 +3859,56 @@ em.text-accent {
|
|
|
3788
3859
|
[data-sf-repeat$=":optionTemplate"] .sf-section-border-self .sf-section-border-self {
|
|
3789
3860
|
border-color: var(--sf-hero-option-dot);
|
|
3790
3861
|
}
|
|
3862
|
+
|
|
3863
|
+
/* THE PRICE CONTROL'S TWO THUMBS (components/catalog/PriceRange). Two native
|
|
3864
|
+
range inputs lie on one track; the track and its accent fill are drawn by
|
|
3865
|
+
the control, so each input is see-through and takes the pointer on its
|
|
3866
|
+
thumb only (the usual two-range pattern), or the top input would swallow
|
|
3867
|
+
every press meant for the other thumb. A thumb is 16 px; its colours are
|
|
3868
|
+
set by the control (--price-thumb: the accent, --price-thumb-ring: the
|
|
3869
|
+
page ground), so they are theme variables only. */
|
|
3870
|
+
.price-range-thumbs {
|
|
3871
|
+
-webkit-appearance: none;
|
|
3872
|
+
appearance: none;
|
|
3873
|
+
margin: 0;
|
|
3874
|
+
background: transparent;
|
|
3875
|
+
pointer-events: none;
|
|
3876
|
+
}
|
|
3877
|
+
.price-range-thumbs::-webkit-slider-runnable-track {
|
|
3878
|
+
background: transparent;
|
|
3879
|
+
border: 0;
|
|
3880
|
+
}
|
|
3881
|
+
.price-range-thumbs::-moz-range-track {
|
|
3882
|
+
background: transparent;
|
|
3883
|
+
border: 0;
|
|
3884
|
+
}
|
|
3885
|
+
.price-range-thumbs::-webkit-slider-thumb {
|
|
3886
|
+
-webkit-appearance: none;
|
|
3887
|
+
appearance: none;
|
|
3888
|
+
width: 16px;
|
|
3889
|
+
height: 16px;
|
|
3890
|
+
border-radius: 9999px;
|
|
3891
|
+
background: var(--price-thumb);
|
|
3892
|
+
box-shadow: 0 0 0 2px var(--price-thumb-ring);
|
|
3893
|
+
border: 0;
|
|
3894
|
+
cursor: pointer;
|
|
3895
|
+
pointer-events: auto;
|
|
3896
|
+
}
|
|
3897
|
+
.price-range-thumbs::-moz-range-thumb {
|
|
3898
|
+
width: 16px;
|
|
3899
|
+
height: 16px;
|
|
3900
|
+
border-radius: 9999px;
|
|
3901
|
+
background: var(--price-thumb);
|
|
3902
|
+
box-shadow: 0 0 0 2px var(--price-thumb-ring);
|
|
3903
|
+
border: 0;
|
|
3904
|
+
cursor: pointer;
|
|
3905
|
+
pointer-events: auto;
|
|
3906
|
+
}
|
|
3907
|
+
.price-range-thumbs:focus-visible::-webkit-slider-thumb {
|
|
3908
|
+
outline: 2px solid var(--price-thumb);
|
|
3909
|
+
outline-offset: 2px;
|
|
3910
|
+
}
|
|
3911
|
+
.price-range-thumbs:focus-visible::-moz-range-thumb {
|
|
3912
|
+
outline: 2px solid var(--price-thumb);
|
|
3913
|
+
outline-offset: 2px;
|
|
3914
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as $}from"react/jsx-runtime";import{useEffect as c,useMemo as u}from"react";import N from"./catalog/CatalogFilterBar.js";import{useCatalogFilter as _}from"./catalog/CatalogFilterContext.js";import{useVehicleFit as q}from"./fitment/useVehicleFit.js";import{answersForKind as I}from"../lib/content/field-usage.js";import{appendVehicleParams as K,VEHICLE_PARAM as D}from"../lib/wheels/plp-vehicle-params.js";import{plpPriceBoundsOf as G}from"../lib/wheels/plp-filters.js";import{listingLinkFromCatalogFilters as H,unmappableCatalogFacets as J}from"../lib/wheels/catalog-filters-to-listing.js";function Q({show:f,layout:m,processOptions:d,fieldUsage:t,editing:s=!1,resultsHref:l,resultsLabel:h}){const{filters:o,setProcess:w,setSize:g,setLugs:P,setFinish:O,setPriceMin:F,setPriceMax:v,setSort:S,clearAll:y,total:L,scrollProcess:A,publishVehicle:n,lugOptions:C,sizeOptions:M,finishOptions:k,categoryOptions:x,optionsReported:B,priceOptions:a}=_(),V=u(()=>G(a),[a]),b=u(()=>t?I(t,"alloy-wheel"):void 0,[t]),e=q({editing:s,autoApply:!0});c(()=>{n({fit:e.fit,name:e.appliedName,resolving:e.resolving,unresolved:e.unresolved})},[n,e.fit,e.appliedName,e.resolving,e.unresolved]);const r=e.applied?.vehicle??null;c(()=>{if(s||!e.restored||typeof window>"u")return;const i=new URLSearchParams(window.location.search);for(const E of Object.values(D))i.delete(E);K(i,r);const p=i.toString();window.history.replaceState(null,"",`${window.location.pathname}${p?`?${p}`:""}`)},[s,e.restored,r]);const z=J(o),R=(h??"").trim()||"See all results",j=l&&!s&&z.length===0?{href:H(l,o,r),label:R}:void 0;return $(N,{resultsLink:j,filters:o,setProcess:w,setSize:g,setLugs:P,setFinish:O,setPriceMin:F,setPriceMax:v,setSort:S,clearAll:y,total:L,lugOptions:C,sizeOptions:M,finishOptions:k,priceBounds:V,scrollProcess:A,show:f,layout:m,processOptions:d??x,optionsReported:B,fieldUsage:b,picker:e})}export{Q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as n}from"react/jsx-runtime";import{useEffect as S,useRef as A,useState as u}from"react";import{stripMarkup as B}from"efficient-web-builder/format/lib/markup";import{sizedImage as z}from"efficient-web-builder/format/lib/sized-image";import D,{chatLauncherOnLeft as W}from"./ChatLauncher.js";import{useChat as M}from"./ChatContext.js";import{scrollBehavior as U}from"efficient-web-builder/render/components/useReducedMotion";const F="Chat with us",O="We usually reply within a few minutes",R="Hi! Ask us anything — about a wheel, an order, or fitment. Leave your details and we’ll reply.";function $({m:t}){if(t.sender_role==="system")return e("div",{className:"text-center text-[11px] text-fg/50 py-1",children:t.body});const a=t.sender_role==="bot",s=t.sender_role==="employee"||a;return e("div",{className:`flex ${s?"justify-start":"justify-end"}`,children:n("div",{className:`max-w-[80%] rounded-2xl px-3 py-2 text-sm ${s?"bg-fg/5 text-fg":"bg-accent text-accent-ink"}`,children:[s&&n("div",{className:"mb-0.5 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-fg/50",children:[a&&e("span",{"aria-hidden":"true",children:"✦"}),e("span",{children:a?t.sender_name||"Assistant":t.sender_name||"Support"}),a&&e("span",{className:"font-normal normal-case tracking-normal",children:"· automated"})]}),t.body&&e("p",{className:"whitespace-pre-wrap",children:t.body}),t.image_url&&e("a",{href:t.image_url,target:"_blank",rel:"noopener noreferrer",children:e("img",{...z(t.image_url,{fallbackWidth:640,maxWidth:1280}),sizes:"(max-width: 640px) 80vw, 320px",alt:"Attachment",className:"mt-2 max-h-48 w-auto rounded-lg"})})]})})}function G({title:t,subtitle:a,greeting:s,look:x}={}){const{isOpen:l,toggle:N,close:_,messages:o,sending:i,error:h,unread:f,hasConversation:k,isSignedIn:C,send:E}=M(),g=t?.trim()||F,L=a?.trim()||O,T=s?.trim()||R,[d,b]=u(""),[c,j]=u(""),[m,I]=u(""),y=A(null),p=!C&&!k;S(()=>{l&&y.current?.scrollIntoView({behavior:U(),block:"nearest"})},[o.length,l]);const v=d.trim().length>0&&(!p||c.trim()&&/.+@.+/.test(m)),w=()=>{!v||i||(E(d,p?{name:c.trim(),email:m.trim()}:void 0),b(""))};return l?n("aside",{role:"dialog","aria-label":"Chat with us","data-sf-floating":"",className:`fixed bottom-5 ${W(x)?"left-5":"right-5"} z-[61] flex h-[min(560px,80vh)] w-[min(380px,calc(100vw-2.5rem))] flex-col overflow-hidden rounded-2xl border border-line bg-bg shadow-[0_20px_60px_rgba(0,0,0,.45)]`,style:{color:"var(--fg)"},children:[n("div",{className:"flex items-center justify-between border-b border-line px-4 py-3",children:[n("div",{children:[e("div",{className:"text-sm font-semibold text-fg",children:g}),e("div",{className:"text-[11px] text-fg/50",children:L})]}),e("button",{type:"button",onClick:_,"aria-label":"Close chat",className:"rounded-md p-1 text-fg/60 hover:bg-fg/5",children:e("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),n("div",{className:"flex-1 space-y-2 overflow-y-auto px-3 py-3",children:[o.length===0&&e("p",{className:"px-2 py-4 text-center text-sm text-fg/50",children:T}),o.map(r=>e($,{m:r},r.id)),e("div",{ref:y})]}),n("div",{className:"border-t border-line p-3",children:[p&&n("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[e("input",{value:c,onChange:r=>j(r.target.value),placeholder:"Your name","aria-label":"Your name",className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"}),e("input",{value:m,onChange:r=>I(r.target.value),type:"email",placeholder:"Email","aria-label":"Email",className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"})]}),h&&e("p",{className:"mb-2 text-xs text-alert",children:h}),n("div",{className:"flex items-end gap-2",children:[e("textarea",{value:d,onChange:r=>b(r.target.value),onKeyDown:r=>{r.key==="Enter"&&!r.shiftKey&&(r.preventDefault(),w())},rows:1,placeholder:"Type a message…","aria-label":"Message",className:"max-h-28 flex-1 resize-none rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"}),e("button",{type:"button",onClick:w,disabled:!v||i,className:"rounded-lg bg-btn px-3 py-2 text-sm font-semibold text-btn-ink disabled:opacity-40",children:i?"…":"Send"})]})]})]}):e(D,{label:B(g),onOpen:N,zIndex:60,look:x,badge:f>0&&e("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-red-600 px-1 text-[11px] font-bold text-white",children:f})})}export{R as DEFAULT_GREETING,O as DEFAULT_SUBTITLE,F as DEFAULT_TITLE,G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as u}from"react";import{COUPON_DEFERRED_MESSAGE as m}from"../lib/cart/coupon-preview.js";import{useCart as x}from"./CartContext.js";function f({customerEmail:c,disabled:o=!1}){const{coupon:e,applyCoupon:l,removeCoupon:d,couponBusy:n}=x(),[r,s]=u("");async function p(){o||n||!r.trim()||(await l(r,c),s(""))}return i("div",{className:"flex flex-col gap-2",children:[e===null?i("div",{className:"flex border border-line",children:[t("input",{type:"text",value:r,onChange:a=>s(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),p())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:o,className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),t("button",{type:"button",onClick:()=>{p()},disabled:n||o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:n?"…":"Apply"})]}):i("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",e.valid?"border-accent":"border-line"].join(" "),style:e.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[t("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",e.valid?"text-accent":e.deferred||e.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:e.code}),e.unchecked&&t("button",{type:"button",onClick:()=>{l(e.code,c)},disabled:n||o,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:n?"…":"Try again"}),!o&&t("button",{type:"button",onClick:d,"aria-label":`Remove coupon ${e.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"✕"})]}),e?.deferred?t("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:m}):e&&!e.valid&&e.message&&t("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:e.message})]})}export{f as default};
|
|
@@ -22,6 +22,9 @@ interface CurrencyValue {
|
|
|
22
22
|
export declare function createPriceFormatter(currencies: SiteCurrency[]): (amount: number, currency: string) => string;
|
|
23
23
|
export declare function createMoneyFormatter(currencies: SiteCurrency[]): (amount: number, currency: string) => string;
|
|
24
24
|
export declare function CurrencyProvider({ children, currencies, countries, defaultCurrency, defaultCountry, }: CurrencyProviderProps): import("react").JSX.Element;
|
|
25
|
+
export declare function useCurrency(options: {
|
|
26
|
+
optional: true;
|
|
27
|
+
}): CurrencyValue | null;
|
|
25
28
|
export declare function useCurrency(): CurrencyValue;
|
|
26
29
|
export declare function useActiveCountry(): string;
|
|
27
30
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as h}from"react/jsx-runtime";import{createContext as A,useContext as v,useEffect as O,useMemo as
|
|
1
|
+
"use client";import{jsx as h}from"react/jsx-runtime";import{createContext as A,useContext as v,useEffect as O,useMemo as a,useState as E}from"react";import{currencyFormat as T}from"../lib/commerce.js";import{safeLocalStorage as P}from"efficient-web-builder/format/lib/safe-storage";const Y="storefront-country",g=Y,l=A(null);function j(r){return S(r,"catalogue")}function D(r){return S(r,"money")}function S(r,n){const f=new Map(r.map(c=>[c.code,c.decimalPlaces]));return(c,u)=>{if(!u)return"";const t=f.get(u)??0;return T(u,n==="money"?t:0,t).format(c)}}function L({children:r,currencies:n,countries:f,defaultCurrency:c,defaultCountry:u}){const t=a(()=>n??[],[n]),o=a(()=>f??[],[f]),p=a(()=>c||t.find(e=>e.isDefault)?.code||t[0]?.code||"",[c,t]),w=a(()=>u||o.find(e=>e.isDefault)?.code||o[0]?.code||"",[u,o]),[m,C]=E(w),[x,F]=E(!1);O(()=>{const e=P.getItem(g);e&&o.some(i=>i.code===e)&&C(e),F(!0)},[o]);function M(e){C(e),P.setItem(g,e)}const R=a(()=>{const e=o.find(s=>s.code===m)??null,i=e?.currency,d=i&&t.some(s=>s.code===i)?i:p,_=j(t),b=D(t);return{country:m,currency:d,setCountry:M,currencies:t,countries:o,activeCountry:e,formatPrice:(s,y)=>_(s,y??d),formatMoney:(s,y)=>b(s,y??d),ready:x}},[m,t,o,p,x]);return h(l.Provider,{value:R,children:r})}function N(r){const n=v(l);if(!n&&!r?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return n}function U(){return v(l)?.country??""}export{Y as COUNTRY_STORAGE_KEY,L as CurrencyProvider,D as createMoneyFormatter,j as createPriceFormatter,U as useActiveCountry,N as useCurrency};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type FormEvent } from "react";
|
|
2
|
+
import { type DealerList } from "../lib/sections/dealer-finder.js";
|
|
3
|
+
interface DealerFinderProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
contained: boolean;
|
|
6
|
+
sample?: DealerList;
|
|
7
|
+
}
|
|
8
|
+
export default function DealerFinder({ title, contained, sample }: DealerFinderProps): import("react").JSX.Element;
|
|
9
|
+
interface DealerFinderViewProps {
|
|
10
|
+
title?: string;
|
|
11
|
+
query: string;
|
|
12
|
+
list: DealerList | null;
|
|
13
|
+
busy?: boolean;
|
|
14
|
+
onQuery?: (value: string) => void;
|
|
15
|
+
onSearch?: (event: FormEvent<HTMLFormElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function DealerFinderView({ title, query, list, busy, onQuery, onSearch }: DealerFinderViewProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as a,jsxs as s}from"react/jsx-runtime";import{useState as h}from"react";import b from"efficient-web-builder/render/components/BlockFrame";import{renderHeadline as g}from"efficient-web-builder/render/components/goldPhrases";import{phoneHref as y}from"efficient-web-builder/format/lib/links/phone-href";import{fetchDealers as N}from"../lib/api/index.js";import{DEALER_WORDS as r,dealerFinderNotice as v,dealerPins as w,dealerTownLine as k,distanceLabel as _}from"../lib/sections/dealer-finder.js";function j({title:c,contained:d,sample:n}){const[t,m]=h(""),[p,i]=h(n??null),[l,o]=h(!1);return a(b,{contained:d,className:"py-6",children:a(D,{title:c,query:t,list:p,busy:l,onQuery:m,onSearch:async f=>{if(f.preventDefault(),!(n||!t.trim())){o(!0);try{i(await N(t))}catch{i({near:"try_again",dealers:[]})}finally{o(!1)}}}})})}function D({title:c,query:d,list:n,busy:t=!1,onQuery:m,onSearch:p}){const i=n?v(n.near):null,l=n&&n.near!=="not_found"?n.dealers:[],o=w(l);return s("div",{className:"flex flex-col gap-5",children:[c&&a("h2",{className:"font-heading3 text-[length:min(var(--size-headingSmall,28px),var(--sf-heading-max,9999px))] font-medium leading-[1.1] tracking-[-0.02em]",children:g(c,!1)}),s("form",{role:"search",className:"flex max-w-[560px] gap-2",onSubmit:p,children:[a("input",{type:"search",name:"near",value:d,onChange:e=>m?.(e.target.value),placeholder:r.placeholder,"aria-label":r.placeholder,maxLength:120,className:"min-w-0 flex-1 rounded-sm border border-line bg-transparent px-3 py-2 text-[15px]"}),a("button",{type:"submit",disabled:t,className:"rounded-sm bg-btn px-4 py-2 text-[15px] font-medium text-btn-ink disabled:opacity-60",children:t?r.searching:r.search})]}),i&&a("p",{role:"status",className:"text-[15px] opacity-80",children:i}),n&&n.near!=="not_found"&&!l.length&&a("p",{role:"status",className:"text-[15px] opacity-80",children:r.none}),l.length>0&&s("div",{className:"grid gap-5 md:grid-cols-2",children:[a("ol",{className:"flex flex-col text-[15px]",children:l.map((e,f)=>{const u=_(e.distanceKm),x=k(e);return s("li",{className:"flex gap-3 border-b border-line py-3 last:border-b-0",children:[a("span",{"aria-hidden":!0,className:"w-6 shrink-0 font-medium tabular-nums",children:f+1}),s("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[s("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4",children:[a("span",{className:"font-medium",children:e.name}),u&&a("span",{className:"tabular-nums opacity-70",children:u})]}),e.address&&a("span",{children:e.address}),x&&a("span",{children:x}),e.phone&&a("a",{href:y(e.phone),className:"underline-offset-2 hover:underline",children:e.phone}),e.website&&a("a",{href:e.website,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:r.website})]})]},e.id)})}),o.length>0&&a("div",{role:"img","aria-label":r.map,className:"relative min-h-[280px] overflow-hidden rounded-sm border border-line",style:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},children:o.map(e=>a("span",{"data-dealer-pin":e.index+1,className:"absolute flex h-6 w-6 -translate-x-1/2 -translate-y-full items-center justify-center rounded-full bg-accent text-[12px] font-medium text-accent-ink",style:{left:`${e.left}%`,top:`${e.top}%`},children:e.index+1},e.id))})]})]})}export{D as DealerFinderView,j as default};
|
|
@@ -25,7 +25,9 @@ export interface FooterMenuProps {
|
|
|
25
25
|
linkRange?: unknown;
|
|
26
26
|
menuStyle?: unknown;
|
|
27
27
|
currentPage?: unknown;
|
|
28
|
+
menuStylePhone?: unknown;
|
|
29
|
+
menuPanelWidth?: unknown;
|
|
30
|
+
menuPanelTintColor?: unknown;
|
|
31
|
+
menuPanelTintOpacity?: unknown;
|
|
28
32
|
}
|
|
29
|
-
export
|
|
30
|
-
export declare const MENU_STYLE_TABS = "tabs";
|
|
31
|
-
export default function FooterMenu({ owner, menu, served, heading, accordionMobile, showDividers, editing, layout, linkAlign, linkRange, menuStyle, currentPage, }: FooterMenuProps): import("react").JSX.Element | null;
|
|
33
|
+
export default function FooterMenu({ owner, menu, served, heading, accordionMobile, showDividers, editing, layout, linkAlign, linkRange, menuStyle, currentPage, menuStylePhone, menuPanelWidth, menuPanelTintColor, menuPanelTintOpacity, }: FooterMenuProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as F,jsxs as i}from"react/jsx-runtime";import{useCallback as j,useEffect as B,useRef as Y,useState as O}from"react";import W from"next/link";import{REPEAT_ATTRIBUTE as G,REPEAT_INDEX_ATTRIBUTE as z}from"efficient-easel/draw";import q from"./CountrySelect.js";import{MenuPlaceContext as V}from"./MenuLinkBlock.js";import X from"./ThemeToggle.js";import{CardRowContext as Z,CardTemplateRows as J}from"efficient-web-builder/render/components/CardRowContext";import{renderChrome as v}from"efficient-web-builder/render/components/goldPhrases";import{UTIL_WORDS as K}from"./HeaderTools.js";import{usePhoneMenuTools as Q}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as ee}from"./SearchContext.js";import{useModalDismiss as ne}from"./useModalDismiss.js";import le from"efficient-easel/screen/components/UiIcon";import{usePreviewMenus as re}from"./PreviewMenusContext.js";import{FOOTER_MENU_PLACEHOLDER_COUNT as te,FOOTER_MENU_PLACEHOLDER_HEADING as ae,FOOTER_MENU_PLACEHOLDER_HINT as oe}from"../lib/content/menu-placeholder.js";import{say as T}from"efficient-web-builder/format/lib/editor-words";import{UNDER_HEADER_SHEET_CLASS as se}from"../lib/content/header-bar.js";import{isMenuOrphaned as ie}from"../lib/menu-source.js";import{legacyBlockAlignOf as ce}from"efficient-web-builder/format/lib/content/block-align";import{menuLinkInRange as me,resolveMenuLinkRange as ue}from"../lib/content/menu-row.js";import{MENU_ENTRY_SIZE_CLASS as P}from"../lib/content/menu-entry-type.js";import{TAB_CELLS as H,currentLinkIndex as de}from"../lib/content/tab-strip.js";import{useCurrentPagePath as pe}from"efficient-web-builder/render/lib/site-runtime";import{HideTaker as E}from"efficient-web-builder/render/components/ViewHideRoot";const qe="plain",he="tabs",fe=`flex list-none flex-col gap-3 ${P}`,y="mb-4 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",L="text-[12px] italic text-fg-dim/70",U=(n,l)=>n&&l>0?"border-t border-line pt-3":"",xe=n=>({label:n.label??"",url:n.href??"",served:n}),D=n=>n.served?{...n.served,label:n.label??"",href:n.url??""}:{label:n.label??"",href:n.url??""},be=Array.from({length:te},()=>({label:"",href:""}));function M({owner:n,items:l,place:a,wrap:c,markCurrent:h=!1}){const x=l?l.map(D):be,o=pe(),m=l&&h?de(l.map(g=>g.url??""),o):-1,u=m<0?null:{index:m,href:l[m].url??""};return e(V.Provider,{value:l?u?{...a,current:u}:a:{...a,placeholder:!0},children:e(J,{ownerId:n.id,ownerType:n.type,Template:n.template,rows:x,items:l??void 0,fallback:null,wrapCopy:c,children:g=>g})})}const R=n=>(n.template?.blockCount??0)>0,Ne="Nothing to show yet: this menu's entries come from its Menu content.",$="This menu draws no links: its card template is empty. Undo the delete, or delete this Menu and add it again.";function Ee({owner:n,items:l,label:a,editing:c,linkAlign:h,linkRange:x,markCurrent:o}){const m=ce(h),u=ue(x),g=!!u&&l!==null&&u.to!==void 0&&u.to<l.length,[w,C]=O(!1),_=Y(null),b=Q(),{open:S}=ee(),N=a||"Menu",s=j(()=>C(!1),[]);ne({active:w,onDismiss:s,scopeRef:_});const f=e(M,{owner:n,items:l,place:{place:"row"},markCurrent:o,wrap:(r,t)=>{const p=l!==null&&u&&!me(u,t.index+1)?{"data-menu-out":""}:null;return e("li",{className:"",...p,children:r})}}),k=(r,t,p)=>c?{[G]:`${r}:${p<0?"panel":"dropdown"}`,[z]:`${p+1}.${t.index}`}:null,A=e(M,{owner:n,items:l,place:{place:"panel",onNavigate:s},markCurrent:o,wrap:(r,t)=>i(F,{children:[e("li",{className:"flex min-h-14 items-center border-b border-line",...k(n.id,t,-1),children:r}),l===null?null:(t.item?.dropdown_items??[]).map((p,I)=>e(Z.Provider,{value:{...t,row:D(p),item:p},children:e("li",{className:"flex min-h-12 items-center border-b border-line pl-5 text-[14px]",...k(n.id,t,I),children:r})},I))]})}),d=b&&(b.search||b.region||b.account||b.theme)?b:null;return!c&&l!==null&&!R(n)&&!d?null:i(E,{as:"nav",ref:_,"aria-label":N,"data-menu-row":"",...m?{"data-menu-align":m}:null,...g?{"data-menu-part":"lead"}:null,className:"min-w-0",children:[e("ul",{className:`m-0 hidden list-none flex-wrap items-center gap-x-8 gap-y-2 p-0 font-mono ${P} uppercase tracking-[0.18em] view-tablet:flex`,children:f}),e("button",{type:"button",className:"flex h-11 w-11 items-center justify-center view-tablet:hidden","aria-expanded":w,"aria-label":w?"Close the menu":"Open the menu",onClick:()=>C(r=>!r),children:e("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":"true",children:w?e("path",{d:"M6 6l12 12M18 6L6 18"}):e("path",{d:"M4 7h16M4 12h16M4 17h16"})})}),w?i("div",{role:"dialog","aria-label":N,className:`${se} z-[60] flex flex-col overflow-y-auto bg-bg text-fg view-tablet:hidden`,children:[e("ul",{className:"m-0 flex list-none flex-col px-5 py-3 font-mono text-[16px] uppercase tracking-[0.18em]",children:A}),d?i("div",{className:"mt-auto flex flex-col gap-4 border-t border-line bg-surface p-5",children:[d.search?i("button",{type:"button",className:"flex h-12 items-center gap-3 border border-line bg-bg px-4 text-left text-[15px]",onClick:c?void 0:()=>{s(),S()},children:[e(le,{name:"search",size:18,strokeWidth:1.6,rounded:!0}),K.search]}):null,d.account?i("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),e(W,{href:"/account",onClick:s,className:"mono-eyebrow underline",children:"Your account"})]}):null,d.region?i("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),e(q,{})]}):null,d.theme?i("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),e(X,{})]}):null]}):null]}):null]})}function ge({owner:n,items:l,label:a,editing:c,markCurrent:h}){return!c&&(l===null||l.length===0||!R(n))?null:e(E,{as:"nav","aria-label":a||"Menu","data-menu-tabs":"",className:"min-w-0",children:e("ul",{className:H.list,children:e(M,{owner:n,items:l,place:{place:"tab"},markCurrent:h,wrap:(x,o)=>e("li",{className:H.item(o.index===0,c),children:x})})})})}function we({owner:n,menu:l,served:a,heading:c,accordionMobile:h=!1,showDividers:x=!1,editing:o=!1,layout:m="column",linkAlign:u,linkRange:g,menuStyle:w,currentPage:C}){const _=m==="row"&&C===!0,{live:b,ready:S}=re(),N=!a&&ie({id:l?.id,handle:l?.handle,editing:o,ready:S,live:b}),s=a?a.map(xe):N?[]:l?.items??[],f=c||(a?"":l?.name)||"",[k,A]=O(!1);if(B(()=>{if(!h)return;const r=window.matchMedia("(max-width: 800px)"),t=()=>A(r.matches);return t(),r.addEventListener("change",t),()=>r.removeEventListener("change",t)},[h]),a&&s.length===0)return o?e(E,{as:"p",className:L,children:T(Ne)}):null;if(m==="row"&&o&&!N&&s.length>0&&!R(n))return e(E,{as:"p",className:L,children:T($)});if(m==="row"&&w===he)return e(ge,{owner:n,items:N?null:s,label:f,editing:o,markCurrent:_});if(m==="row")return e(Ee,{owner:n,items:N?null:s,label:f,editing:o,linkAlign:u,linkRange:g,markCurrent:_});const d=r=>e("ul",{className:fe,children:e(M,{owner:n,items:r,place:{place:"column"},wrap:(t,p)=>e("li",{className:r?U(x,p.index):`text-fg ${U(x,p.index)}`,children:t})})});return N?i(E,{as:"div",className:"min-w-0",children:[e("h4",{className:y,children:c?v(c):T(ae)}),d(null),e("p",{className:`mt-3 ${L}`,children:T(oe)})]}):s.length===0||!R(n)?i(E,{as:"div",className:"min-w-0",children:[f?e("h4",{className:y,children:v(f)}):null,o?e("p",{className:L,children:s.length===0?T("This menu has no links yet — add them in {place}.",{place:T("Storefront → Menus")}):T($)}):null]}):h&&k?i(E,{as:"details",className:"min-w-0 border-b border-line",children:[i("summary",{className:"flex cursor-pointer list-none items-center justify-between py-3 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",children:[v(f),e("span",{"aria-hidden":!0,children:"+"})]}),e("div",{className:"pb-3",children:d(s)})]}):i(E,{as:"div",className:"min-w-0",children:[f?e("h4",{className:y,children:v(f)}):null,d(s)]})}export{qe as MENU_STYLE_PLAIN,he as MENU_STYLE_TABS,we as default};
|
|
1
|
+
"use client";import{jsx as e,Fragment as D,jsxs as p}from"react/jsx-runtime";import{useCallback as de,useEffect as X,useRef as H,useState as k}from"react";import{createPortal as pe}from"react-dom";import{CloseIcon as he,MenuIcon as fe}from"efficient-shell/icons/efficient-glyphs";import we from"./PopupFrame.js";import{POPUP_LOOK_DEFAULTS as Z}from"efficient-web-builder/format/lib/popup/look";import{REPEAT_ATTRIBUTE as xe,REPEAT_INDEX_ATTRIBUTE as Ne}from"efficient-easel/draw";import{MenuPlaceContext as be}from"./MenuLinkBlock.js";import{CardRowContext as ge,CardTemplateRows as Ee}from"efficient-web-builder/render/components/CardRowContext";import{renderChrome as F}from"efficient-web-builder/render/components/goldPhrases";import{UTIL_WORDS as J}from"./HeaderTools.js";import{usePhoneMenuTools as Te}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as Ce}from"./SearchContext.js";import{useModalDismiss as _e}from"./useModalDismiss.js";import{PhoneSheet as ye}from"./PhoneSheet.js";import{usePreviewMenus as ve}from"./PreviewMenusContext.js";import{FOOTER_MENU_PLACEHOLDER_COUNT as Me,FOOTER_MENU_PLACEHOLDER_HEADING as Le,FOOTER_MENU_PLACEHOLDER_HINT as Oe}from"../lib/content/menu-placeholder.js";import{say as O}from"efficient-web-builder/format/lib/editor-words";import{isMenuOrphaned as Re}from"../lib/menu-source.js";import{legacyBlockAlignOf as Se}from"efficient-web-builder/format/lib/content/block-align";import{MENU_PANEL_TINT_OPACITY_DEFAULT as Ae,MENU_PANEL_WIDTH_DEFAULT as ke,MENU_STYLE_BUTTON as Q,MENU_STYLE_TABS as Pe,menuLinkInRange as Ie,menuShowClasses as ee,resolveMenuLinkRange as Ue}from"../lib/content/menu-row.js";import{MENU_ENTRY_SIZE_CLASS as ne}from"../lib/content/menu-entry-type.js";import{TAB_CELLS as te,currentLinkIndex as De}from"../lib/content/tab-strip.js";import{useCurrentPagePath as He}from"efficient-web-builder/render/lib/site-runtime";import{HideTaker as C}from"efficient-web-builder/render/components/ViewHideRoot";const Fe=`flex list-none flex-col gap-3 ${ne}`,G="mb-4 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",$="text-[12px] italic text-fg-dim/70",le=(n,t)=>n&&t>0?"border-t border-line pt-3":"",$e=n=>({label:n.label??"",url:n.href??"",served:n}),re=n=>n.served?{...n.served,label:n.label??"",href:n.url??""}:{label:n.label??"",href:n.url??""},Be=Array.from({length:Me},()=>({label:"",href:""}));function P({owner:n,items:t,place:m,wrap:h,markCurrent:b=!1}){const g=t?t.map(re):Be,i=He(),u=t&&b?De(t.map(f=>f.url??""),i):-1,_=u<0?null:{index:u,href:t[u].url??""};return e(be.Provider,{value:t?_?{...m,current:_}:m:{...m,placeholder:!0},children:e(Ee,{ownerId:n.id,ownerType:n.type,Template:n.template,rows:g,items:t??void 0,fallback:null,wrapCopy:h,children:f=>f})})}const B=n=>(n.template?.blockCount??0)>0,We="Nothing to show yet: this menu's entries come from its Menu content.",ae="This menu draws no links: its card template is empty. Undo the delete, or delete this Menu and add it again.";function oe({owner:n,items:t,label:m,editing:h,linkAlign:b,linkRange:g,markCurrent:i,menuStyle:u,menuStylePhone:_,panelLook:f}){const y=Se(b),v=Ue(g),R=!!v&&t!==null&&v.to!==void 0&&v.to<t.length,[c,S]=k(!1),M=H(null),x=Te(),{open:W}=Ce(),A=m||"Menu",d=de(()=>S(!1),[]),l=u===Q||_===Q,s=ee(u,_),[I,Y]=k("sheet"),T=H(null),w=H(null),[N,U]=k(void 0),[L,ie]=k(null),V=()=>{if(!c&&l){const o=M.current?.ownerDocument.defaultView;Y(o?.matchMedia("(min-width: 720px)").matches?"side":"sheet");const r=T.current?.querySelector("span");if(r&&o){const a=o.getComputedStyle(r);U({fontFamily:a.fontFamily,fontSize:a.fontSize,letterSpacing:a.letterSpacing,textTransform:a.textTransform});const E=(T.current?.querySelector("svg")??T.current)?.getBoundingClientRect();ie(E?{left:E.left,top:E.top,height:E.height}:null)}}S(o=>!o)};X(()=>{if(!c||!l)return;const r=M.current?.ownerDocument.defaultView?.matchMedia("(min-width: 720px)");if(!r)return;const a=()=>S(!1);return r.addEventListener("change",a),()=>r.removeEventListener("change",a)},[c,l]);const j=H(null);_e({active:c&&!(c&&l&&I==="side"),onDismiss:d,scopeRef:M,focusRef:j,trapRef:j});const se=e(P,{owner:n,items:t,place:{place:"row"},markCurrent:i,wrap:(o,r)=>{const a=t!==null&&v&&!Ie(v,r.index+1)?{"data-menu-out":""}:null;return e("li",{className:"",...a,children:o})}}),q=(o,r,a)=>h?{[xe]:`${o}:${a<0?"panel":"dropdown"}`,[Ne]:`${a+1}.${r.index}`}:null,ce=e(P,{owner:n,items:t,place:{place:"panel",onNavigate:d},markCurrent:i,wrap:(o,r)=>p(D,{children:[e("li",{className:"flex min-h-14 items-center border-b border-line",...q(n.id,r,-1),children:o}),t===null?null:(r.item?.dropdown_items??[]).map((a,E)=>e(ge.Provider,{value:{...r,row:re(a),item:a},children:e("li",{className:"flex min-h-12 items-center border-b border-line pl-5 text-[14px]",...q(n.id,r,E),children:o})},E))]})}),me=x&&(x.search||x.region||x.account||x.theme)?x:null;if(!h&&t!==null&&!B(n)&&!me)return null;const K=e(ye,{role:"dialog",panelRef:j,name:A,entries:ce,tools:x,withAccount:!l,editing:h,onClose:d,onSearch:W,phoneOnly:!l,marker:l?"sheet":void 0,listStyle:l&&L?{paddingLeft:L.left,paddingRight:L.left}:void 0});let z=null;if(l){const o=M.current?.ownerDocument,r={...Z,placement:"left",height:"full",closeButton:"none",width:typeof f?.width=="number"?f.width:ke,tintColor:typeof f?.tintColor=="string"?f.tintColor:Z.tintColor,tintOpacity:typeof f?.tintOpacity=="number"?f.tintOpacity:Ae},a=e(we,{look:r,drawer:{closeRef:w},open:!0,onClose:d,label:A,children:p("div",{"data-menu-panel":"side",className:"flex h-full flex-col overflow-y-auto text-fg",children:[e("div",{className:"flex min-h-[var(--sf-header-h,88px)] shrink-0 items-center px-8",style:L?{paddingLeft:L.left}:void 0,children:p("button",{ref:w,type:"button",onClick:d,className:"inline-flex h-11 items-center gap-2",style:N,children:[e(he,{size:20,"aria-hidden":"true"}),e("span",{className:"whitespace-nowrap",children:J.close})]})}),e("ul",{className:"m-0 flex list-none flex-col px-8 pb-8",style:L?{paddingLeft:L.left}:void 0,children:e(P,{owner:n,items:t,place:{place:"panel",onNavigate:d},markCurrent:i,wrap:(E,ue)=>e("li",{className:"flex min-h-12 items-center",...q(n.id,ue,-1),children:E})})})]})});z=p(D,{children:[p("button",{ref:T,type:"button",className:`mono-eyebrow-ctl ${s.button} h-11 min-w-11 items-center gap-2 opacity-80 transition-opacity hover:opacity-100 max-view-tablet:-mx-3 max-view-tablet:min-w-0 max-view-tablet:px-3`,"aria-expanded":c,"aria-label":c?"Close the menu":"Open the menu",onClick:V,children:[e(fe,{size:20,"aria-hidden":"true"}),e("span",{className:"whitespace-nowrap max-view-tablet:hidden",children:J.menu})]}),c&&o?pe(I==="side"?a:K,o.body):null]})}else s.drawsButton&&(z=p(D,{children:[e("button",{type:"button",className:`${s.buttonHead} h-11 w-11 items-center justify-center${s.buttonTail}`,"aria-expanded":c,"aria-label":c?"Close the menu":"Open the menu",onClick:V,children:e("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":"true",children:c?e("path",{d:"M6 6l12 12M18 6L6 18"}):e("path",{d:"M4 7h16M4 12h16M4 17h16"})})}),c?K:null]}));return p(C,{as:"nav",ref:M,"aria-label":A,"data-menu-row":"",...l?{"data-menu-show":"button"}:null,...!l&&y?{"data-menu-align":y}:null,...!l&&R?{"data-menu-part":"lead"}:null,className:"min-w-0",children:[e("ul",{className:`m-0 ${s.listHead} list-none flex-wrap items-center gap-x-8 gap-y-2 p-0 font-mono ${ne} uppercase tracking-[0.18em]${s.listTail}`,children:se}),z]})}function Ye({owner:n,items:t,label:m,editing:h,markCurrent:b,strip:g=""}){return!h&&(t===null||t.length===0||!B(n))?null:e(C,{as:"nav","aria-label":m||"Menu","data-menu-tabs":"",className:g?`min-w-0 ${g}`:"min-w-0",children:e("ul",{className:te.list,children:e(P,{owner:n,items:t,place:{place:"tab"},markCurrent:b,wrap:(i,u)=>e("li",{className:te.item(u.index===0,h),children:i})})})})}function je({owner:n,menu:t,served:m,heading:h,accordionMobile:b=!1,showDividers:g=!1,editing:i=!1,layout:u="column",linkAlign:_,linkRange:f,menuStyle:y,currentPage:v,menuStylePhone:R,menuPanelWidth:c,menuPanelTintColor:S,menuPanelTintOpacity:M}){const x=u==="row"&&v===!0,{live:W,ready:A}=ve(),d=!m&&Re({id:t?.id,handle:t?.handle,editing:i,ready:A,live:W}),l=m?m.map($e):d?[]:t?.items??[],s=h||(m?"":t?.name)||"",[I,Y]=k(!1);if(X(()=>{if(!b)return;const w=window.matchMedia("(max-width: 800px)"),N=()=>Y(w.matches);return N(),w.addEventListener("change",N),()=>w.removeEventListener("change",N)},[b]),m&&l.length===0)return i?e(C,{as:"p",className:$,children:O(We)}):null;if(u==="row"&&i&&!d&&l.length>0&&!B(n))return e(C,{as:"p",className:$,children:O(ae)});if(u==="row"&&y===Pe){const{strip:w}=ee(y,R),N=e(Ye,{owner:n,items:d?null:l,label:s,editing:i,markCurrent:x,strip:w});return w?p(D,{children:[N,e(oe,{owner:n,items:d?null:l,label:s,editing:i,markCurrent:x,menuStyle:y,menuStylePhone:R})]}):N}if(u==="row")return e(oe,{owner:n,items:d?null:l,label:s,editing:i,linkAlign:_,linkRange:f,markCurrent:x,menuStyle:y,menuStylePhone:R,panelLook:{width:c,tintColor:S,tintOpacity:M}});const T=w=>e("ul",{className:Fe,children:e(P,{owner:n,items:w,place:{place:"column"},wrap:(N,U)=>e("li",{className:w?le(g,U.index):`text-fg ${le(g,U.index)}`,children:N})})});return d?p(C,{as:"div",className:"min-w-0",children:[e("h4",{className:G,children:h?F(h):O(Le)}),T(null),e("p",{className:`mt-3 ${$}`,children:O(Oe)})]}):l.length===0||!B(n)?p(C,{as:"div",className:"min-w-0",children:[s?e("h4",{className:G,children:F(s)}):null,i?e("p",{className:$,children:l.length===0?O("This menu has no links yet — add them in {place}.",{place:O("Storefront → Menus")}):O(ae)}):null]}):b&&I?p(C,{as:"details",className:"min-w-0 border-b border-line",children:[p("summary",{className:"flex cursor-pointer list-none items-center justify-between py-3 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",children:[F(s),e("span",{"aria-hidden":!0,children:"+"})]}),e("div",{className:"pb-3",children:T(l)})]}):p(C,{as:"div",className:"min-w-0",children:[s?e("h4",{className:G,children:F(s)}):null,T(l)]})}export{je as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type Form } from "../lib/api/index.js";
|
|
1
|
+
import { type Form, type FormAck } from "../lib/api/index.js";
|
|
2
2
|
export interface FormBlockProps {
|
|
3
3
|
formSlug?: string;
|
|
4
4
|
heading?: string;
|
|
@@ -9,6 +9,9 @@ export interface FormBlockProps {
|
|
|
9
9
|
editing?: boolean;
|
|
10
10
|
}
|
|
11
11
|
export default function FormBlock({ formSlug, heading, intro, submitText, finePrint, form: injected, editing, }?: FormBlockProps): import("react").JSX.Element;
|
|
12
|
+
export declare function AccountOutcome({ account }: {
|
|
13
|
+
account: FormAck["account"];
|
|
14
|
+
}): import("react").JSX.Element | null;
|
|
12
15
|
export declare function FormBody({ form, formSlug, submitText, finePrint, editing, onSent, }: {
|
|
13
16
|
form: Form;
|
|
14
17
|
formSlug?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,jsxs as o}from"react/jsx-runtime";import S from"next/link";import{useEffect as w}from"react";import{FormFieldInput as h,FormHoneypot as z,successMessageFor as T,useBoundForm as j,useFormSubmission as C}from"./formSubmission.js";import g from"./SectionNotice.js";import{say as b}from"efficient-web-builder/format/lib/editor-words";import L from"./WebFormField.js";import{usePopupScope as B}from"./PopupHost.js";import{FIELD_INPUT_CLASS as N}from"../lib/field-input.js";function _({field:t,value:n,onChange:r}){const a={field:t,value:n,onChange:r};return t.type==="checkbox"?o("label",{className:"flex items-start gap-3",children:[e(h,{...a,className:"mt-1 size-4 accent-accent"}),o("span",{className:"font-mono text-[12px] font-semibold uppercase tracking-[0.16em] text-fg",children:[t.label,t.required?e("span",{className:"text-accent",children:" *"}):null]})]}):e(L,{label:t.label,required:t.required,children:e(h,{...a,className:t.type==="textarea"?N+" resize-y":N})})}function q({formSlug:t,heading:n,intro:r,submitText:a,finePrint:s,form:p,editing:c=!1}={}){const i=j(t,p),u=B();if(i===void 0)return e(g,{size:"short",children:b("Loading form…")});if(i===null)return e(g,{size:"short",children:c?b("Choose a form in the inspector, under Form."):"This form is unavailable."});const m=(n??"").trim()||i.title;return e("section",{className:"relative z-[2] border-t border-line bg-surface",children:o("div",{className:"mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] py-[84px] max-[960px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[m&&e("h2",{className:"mb-4 font-heading2 text-[length:min(var(--size-headingMedium,44px),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.02em] text-fg max-view-wide:text-[length:min(var(--size-headingMedium,32px),var(--sf-heading-max,9999px))]",children:m}),(r??"").trim()&&e("p",{className:"mb-12 max-w-[640px] font-display text-[16px] leading-[1.6] text-fg-dim",children:r}),e(M,{form:i,formSlug:t,submitText:a,finePrint:s,editing:c,onSent:u?.markSent})]})})}function I({account:t}){const n="font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim";switch(t?.status){case"approved":return o("p",{className:n,children:["Your account is ready."," ",e(S,{href:"/account",className:"underline",children:"Sign in"})]});case"pending":return e("p",{className:n,children:"We're reviewing your application and will email you once it's approved."});case"rejected":return e("p",{className:n,children:"We couldn't open an account from this application. Please contact the shop."});default:return null}}function M({form:t,formSlug:n,submitText:r,finePrint:a,editing:s=!1,onSent:p}){const{valueOf:c,set:i,honeypot:u,setHoneypot:m,submitting:x,done:d,account:v,error:f,handleSubmit:y}=C({form:t,formSlug:n,editing:s});w(()=>{d&&p?.()},[d]);const k=(r??"").trim()||t.submitButtonText?.trim()||"Submit";return d?o("div",{role:"status",className:"flex max-w-[560px] flex-col gap-3",children:[e("p",{className:"font-serif text-[19px] italic leading-[1.6] text-fg-dim",children:T(t)}),e(I,{account:v})]}):o("form",{className:"flex max-w-[720px] flex-col gap-5",onSubmit:y,children:[t.fields.map(l=>e(_,{field:l,value:c(l.key),onChange:F=>i(l.key,F)},l.key)),e(z,{value:u,onChange:m}),f&&e("p",{role:"alert",className:"font-mono text-[12px] uppercase tracking-[0.18em] text-alert",children:f}),e("button",{type:s?"button":"submit",disabled:x,className:"cursor-pointer self-start bg-btn px-8 py-4 font-mono text-[14px] uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg hover:text-bg disabled:cursor-wait disabled:opacity-60",children:x?"Sending…":k}),t.consentText?.trim()&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim/70",children:t.consentText}),(a??"").trim()&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim/70",children:a})]})}export{I as AccountOutcome,M as FormBody,q as default};
|