efficient-storefront-blocks 0.98.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/dist/chunks/{EditorPreviewCheckout-2FW4VEOK.js → EditorPreviewCheckout-J76THKIJ.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-LW5QSBKM.js → SiteEditorProvider-YAIB64UV.js} +1 -1
- package/dist/chunks/chunk-EIBYUCDE.js +1 -0
- package/dist/chunks/chunk-GOVYQQA4.js +1 -0
- package/dist/chunks/{chunk-4QN263UJ.js → chunk-KRMWJLBM.js} +2 -2
- package/dist/chunks/{fitment-data-BRGBDG7Y.js → fitment-data-OUHMES66.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/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/SubmitBox/fields.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 +3 -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/CurrencyContext.d.ts +3 -0
- package/dist/render/components/CurrencyContext.js +1 -1
- 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/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/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 +1 -1
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/booking/text-kinds.js +1 -1
- 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/SiteHeader/render.js +1 -1
- package/dist/render/lib/document/footer-page-blocks.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/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 +3 -2
- package/dist/words.js +1 -1
- package/package.json +2 -2
- 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};
|
|
@@ -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};
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,Fragment as T,jsxs as l}from"react/jsx-runtime";import oe from"next/link";import{usePathname as Je}from"next/navigation";import{useCallback as Qe,useEffect as B,useState as p}from"react";import{rootIsDark as Ze,watchRootTheme as et}from"efficient-shell/format";import{useCart as tt}from"./CartContext.js";import{useSearch as nt}from"./SearchContext.js";import ot,{useCountrySelectShows as rt}from"./CountrySelect.js";import{resolveCountryShowAs as lt}from"../lib/content/country-show-as.js";import re from"./HeaderNavItem.js";import at from"efficient-web-builder/render/components/Logo";import{siteLengthCss as st}from"efficient-web-builder/format/lib/content/css-length";import it from"./MenuPlaceholderLabel.js";import{withRMark as le}from"efficient-web-builder/render/components/RMark";import{AccountButton as ct,CartButton as dt,SearchButton as mt}from"./HeaderTools.js";import ut from"./HeaderCallButton.js";import{useHeaderBar as ht}from"./useHeaderBar.js";import{useModalDismiss as ft}from"./useModalDismiss.js";import pt from"./ThemeToggle.js";import{products as gt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as bt}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as xt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as yt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as vt,resolveChromeWidth as wt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as St}from"../lib/content/header-theme.js";import{headerSolidBackground as kt,isProductPage as Nt}from"../lib/content/header-bar.js";import{surfaceIsLight as Pt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as Et,HEADER_MENU_GAP_PX as It,HEADER_SET_HEIGHT_CSS as Tt}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_ATTR as $t,HEADER_INK_OVERRIDE_ATTR as Lt,resolveHeaderInkMode as Ct}from"efficient-web-builder/render/lib/document/header-ink";const ae={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},_t=Array.from({length:xt},()=>({href:"#",label:r(it,{})}));function Ht({previewSettings:g,initialSettings:$,editorPreview:L,showThemeToggle:se,wordmark:ie,hideLogo:ce,hideMenu:de,siteName:C,commerceEnabled:b=!0}={}){const M=Je(),[me,ue]=p(!1);B(()=>{const e=y.current?.ownerDocument??document,o=()=>ue(e.querySelector(`[${$t}="light"]`)!=null);o();const f=requestAnimationFrame(o);return()=>cancelAnimationFrame(f)},[M]);const G=Nt(M),[c,w]=p(!1),{open:he,totals:fe}=tt(),{open:pe}=nt(),[_,ge]=p(!1),[be,xe]=p(null),[ye,ve]=p(null),[t,we]=p($??null),n=g??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),Se=ce?null:n?.logoUrl??null,ke=n?.reverseLogo??!1,Ne=n?.logoReversed??null,Pe=n?.logoInkIsDark??null,i=n?.logoPosition??"center",Ee=n?.logoSize??"medium",Ie=n?.logoSizePx??null,Te=n?.logoSizeUnit??null,F=Math.min(Math.max(n?.menuSplit??3,1),4),$e=(n?.menuPosition??"left")==="center",Le=(n?.menuPosition??"left")==="beside",W=(n?.menuRow??"top")==="inline",H=n?.menuGapPx??null,Ce=H!=null?{gap:st(H,n?.menuGapUnit,"gap",It)??`${H}px`}:void 0,S=W?ae.inline:ae.stacked,_e=n?.searchEnabled??!1,K=n?.searchPosition??"right",He=n?.countrySelectorEnabled??!0,Ae=lt(n?.countrySelectorShowAs),A=n?.accountEnabled??!0,De=n?.cartEnabled??!0,D=(n?.utilStyle??"icon")==="text",a=`mono-eyebrow${(n?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,V=n?.countryUrls??{},Re=wt(n?.width),Ue=vt(Re)??void 0,je=n?.heightPx??Et.default,q=n?.sticky??"always",k=Ct(n?.topTextColor),m=St(n?.theme),N=Object.keys(V),X=rt(N.length?N:void 0),x=He?r(ot,{countries:N.length?N:void 0,urls:g?void 0:V,showAs:Ae}):null,{headerRef:y,scrolled:Y,navHidden:ze}=ht({stickyMode:q,heightPx:je}),Oe=m?JSON.stringify(m.style):null;B(()=>{const e=y.current?.ownerDocument??document,o=e.defaultView??window,f=ne=>ne?Pt(o.getComputedStyle(ne).getPropertyValue("--bg")):null,O=()=>{ge(!Ze({doc:e,whenUnset:!0})),xe(f(e.body)),ve(f(y.current))};O();const Ye=et(O,{doc:e}),te=new MutationObserver(O);return e.body&&te.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Ye(),te.disconnect()}},[y,Oe]);const v=se??yt?r(pt,{}):null;B(()=>{if(!bt({editorPreview:!!L,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return gt.getHeaderSettings().then(o=>!e&&we(o)).catch(o=>{console.warn("[header] settings fetch failed; using built-in defaults",o)}),()=>{e=!0}},[L,g,$]);const P=Y||G,J=kt(_,G),Q=k==="auto"?me:k==="light",Be=P||!Q,Me=P?ye??_:(be??_)&&!Q,Ge=k==="auto"?null:{[Lt]:k},Fe=Qe(()=>w(!1),[]);ft({active:c,onDismiss:Fe});const d=(e,o,f="start")=>r(re,{item:e,dropdownAlign:f},o),We=!de&&(n?.menuItems?.length??0)>0,E=!!L||!!g,s=We?n.menuItems.map(e=>({href:e.url||"",label:le(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(o=>({href:o.url||"",label:le(o.label),plainLabel:o.label}))})):E?_t.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ke=s.length>0||b&&A||!!x&&X||!!v,Ve=i==="center"?s.slice(0,F):i==="right"?s:[],qe=i==="center"?s.slice(F):i==="left"?s:[],I=_e&&b?r(mt,{onClick:E?void 0:pe,asText:D}):null,R=b&&A?r(ct,{asText:D}):null,U=e=>b&&De?r(dt,{onClick:he,count:fe.sets,asText:D,className:e}):null,Xe=n?.callPhone??"",Z=n?.callHref??"",j=e=>n?.callButton&&(Z||E)?r(ut,{href:E?"":Z,label:e?"Call":Xe||"Call"}):null,u=l(T,{children:[K==="left"?I:null,x,v,R,U(),K==="right"?I:null,j(!1)]}),z=(e,o=!1)=>r(oe,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(at,{variant:"header",scrolled:Be,src:Se,reverse:ke,onLightSurface:Me,reversedSrc:Ne,inkIsDark:Pe,size:Ee,sizePx:Ie,sizeUnit:Te,wordmark:ie,siteName:C,fitToContainer:o})}),h=z("inline-flex shrink-0 items-center justify-center"),ee="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return l(T,{children:[r("header",{ref:y,"data-scrolled":Y||void 0,...Ge,className:["sf-site-header",...m?[m.className]:[],q==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",P?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:Tt,...ze?{transform:"translateY(-100%)"}:null,...P?{background:J,color:"var(--fg)","--sf-header-ground":J}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:l("div",{className:"w-full",style:Ue,children:[$e?l("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${a} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${a} flex items-center justify-center gap-8`,children:s.map((e,o)=>d(e,`${e.href}-${o}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):i==="center"?l("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${a} flex items-center gap-8`,children:Ve.map((e,o)=>d(e,`${e.href}-${o}`))}),h,l("nav",{className:`${a} flex items-center justify-end gap-8`,children:[qe.map((e,o)=>d(e,`${e.href}-${o}`,"end")),u]})]}):Le?l("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[l("div",{className:"flex items-center gap-8",style:Ce,children:[h,r("nav",{className:`${a} flex items-center gap-8`,children:s.map((e,o)=>d(e,`${e.href}-${o}`))})]}),r("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?l(T,{children:[l("nav",{className:`${a} flex items-center gap-8`,children:[s.map((e,o)=>d(e,`${e.href}-${o}`)),u]}),h]}):l(T,{children:[h,l("nav",{className:`${a} flex items-center gap-8`,children:[s.map((e,o)=>d(e,`${e.href}-${o}`)),u]})]})}),!W&&l("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[l("div",{className:"flex items-center justify-between",children:[z(ee,!0),l("div",{className:`${a} flex shrink-0 items-center gap-5`,children:[I,x,v,R,U(),j(!1)]})]}),r("nav",{className:`${a} flex items-center gap-6 border-t border-line/60 pt-3`,children:s.map((e,o)=>d(e,`${e.href}-${o}`))})]}),l("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[z(ee,!0),l("div",{className:"flex shrink-0 items-center gap-4",children:[I,R,U(a),j(!0),Ke&&l("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&l("div",{"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[s.map((e,o)=>r(re,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${o}`)),l("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&A&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(oe,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&X&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),v&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{Ht as default};
|
|
1
|
+
"use client";import{jsx as r,Fragment as T,jsxs as l}from"react/jsx-runtime";import re from"next/link";import{usePathname as Qe}from"next/navigation";import{useCallback as Ze,useEffect as B,useRef as et,useState as p}from"react";import{rootIsDark as tt,watchRootTheme as nt}from"efficient-shell/format";import{useCart as ot}from"./CartContext.js";import{useSearch as rt}from"./SearchContext.js";import lt,{useCountrySelectShows as at}from"./CountrySelect.js";import{resolveCountryShowAs as st}from"../lib/content/country-show-as.js";import le from"./HeaderNavItem.js";import it from"efficient-web-builder/render/components/Logo";import{siteLengthCss as ct}from"efficient-web-builder/format/lib/content/css-length";import dt from"./MenuPlaceholderLabel.js";import{withRMark as ae}from"efficient-web-builder/render/components/RMark";import{AccountButton as mt,CartButton as ut,SearchButton as ht}from"./HeaderTools.js";import ft from"./HeaderCallButton.js";import{useHeaderBar as pt}from"./useHeaderBar.js";import{useModalDismiss as gt}from"./useModalDismiss.js";import bt from"./ThemeToggle.js";import{products as xt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as yt}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as vt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as wt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as St,resolveChromeWidth as kt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as Nt}from"../lib/content/header-theme.js";import{headerSolidBackground as Pt,isProductPage as Et}from"../lib/content/header-bar.js";import{surfaceIsLight as It}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as Tt,HEADER_MENU_GAP_PX as $t,HEADER_SET_HEIGHT_CSS as Lt}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_ATTR as Ct,HEADER_INK_OVERRIDE_ATTR as _t,resolveHeaderInkMode as Rt}from"efficient-web-builder/render/lib/document/header-ink";const se={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},Ht=Array.from({length:vt},()=>({href:"#",label:r(dt,{})}));function At({previewSettings:g,initialSettings:$,editorPreview:L,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:C,commerceEnabled:b=!0}={}){const G=Qe(),[ue,he]=p(!1);B(()=>{const e=y.current?.ownerDocument??document,o=()=>he(e.querySelector(`[${Ct}="light"]`)!=null);o();const f=requestAnimationFrame(o);return()=>cancelAnimationFrame(f)},[G]);const F=Et(G),[c,w]=p(!1),{open:fe,totals:pe}=ot(),{open:ge}=rt(),[_,be]=p(!1),[xe,ye]=p(null),[ve,we]=p(null),[t,Se]=p($??null),n=g??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),ke=de?null:n?.logoUrl??null,Ne=n?.reverseLogo??!1,Pe=n?.logoReversed??null,Ee=n?.logoInkIsDark??null,i=n?.logoPosition??"center",Ie=n?.logoSize??"medium",Te=n?.logoSizePx??null,$e=n?.logoSizeUnit??null,W=Math.min(Math.max(n?.menuSplit??3,1),4),Le=(n?.menuPosition??"left")==="center",Ce=(n?.menuPosition??"left")==="beside",K=(n?.menuRow??"top")==="inline",R=n?.menuGapPx??null,_e=R!=null?{gap:ct(R,n?.menuGapUnit,"gap",$t)??`${R}px`}:void 0,S=K?se.inline:se.stacked,Re=n?.searchEnabled??!1,V=n?.searchPosition??"right",He=n?.countrySelectorEnabled??!0,Ae=st(n?.countrySelectorShowAs),H=n?.accountEnabled??!0,De=n?.cartEnabled??!0,A=(n?.utilStyle??"icon")==="text",a=`mono-eyebrow${(n?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,q=n?.countryUrls??{},Ue=kt(n?.width),je=St(Ue)??void 0,ze=n?.heightPx??Tt.default,X=n?.sticky??"always",k=Rt(n?.topTextColor),m=Nt(n?.theme),N=Object.keys(q),Y=at(N.length?N:void 0),x=He?r(lt,{countries:N.length?N:void 0,urls:g?void 0:q,showAs:Ae}):null,{headerRef:y,scrolled:J,navHidden:Oe}=pt({stickyMode:X,heightPx:ze}),Me=m?JSON.stringify(m.style):null;B(()=>{const e=y.current?.ownerDocument??document,o=e.defaultView??window,f=oe=>oe?It(o.getComputedStyle(oe).getPropertyValue("--bg")):null,M=()=>{be(!tt({doc:e,whenUnset:!0})),ye(f(e.body)),we(f(y.current))};M();const Je=nt(M,{doc:e}),ne=new MutationObserver(M);return e.body&&ne.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Je(),ne.disconnect()}},[y,Me]);const v=ie??wt?r(bt,{}):null;B(()=>{if(!yt({editorPreview:!!L,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return xt.getHeaderSettings().then(o=>!e&&Se(o)).catch(o=>{console.warn("[header] settings fetch failed; using built-in defaults",o)}),()=>{e=!0}},[L,g,$]);const P=J||F,Q=Pt(_,F),Z=k==="auto"?ue:k==="light",Be=P||!Z,Ge=P?ve??_:(xe??_)&&!Z,Fe=k==="auto"?null:{[_t]:k},We=Ze(()=>w(!1),[]),D=et(null);gt({active:c,onDismiss:We,focusRef:D,trapRef:D});const d=(e,o,f="start")=>r(le,{item:e,dropdownAlign:f},o),Ke=!me&&(n?.menuItems?.length??0)>0,E=!!L||!!g,s=Ke?n.menuItems.map(e=>({href:e.url||"",label:ae(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(o=>({href:o.url||"",label:ae(o.label),plainLabel:o.label}))})):E?Ht.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ve=s.length>0||b&&H||!!x&&Y||!!v,qe=i==="center"?s.slice(0,W):i==="right"?s:[],Xe=i==="center"?s.slice(W):i==="left"?s:[],I=Re&&b?r(ht,{onClick:E?void 0:ge,asText:A}):null,U=b&&H?r(mt,{asText:A}):null,j=e=>b&&De?r(ut,{onClick:fe,count:pe.sets,asText:A,className:e}):null,Ye=n?.callPhone??"",ee=n?.callHref??"",z=e=>n?.callButton&&(ee||E)?r(ft,{href:E?"":ee,label:e?"Call":Ye||"Call"}):null,u=l(T,{children:[V==="left"?I:null,x,v,U,j(),V==="right"?I:null,z(!1)]}),O=(e,o=!1)=>r(re,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(it,{variant:"header",scrolled:Be,src:ke,reverse:Ne,onLightSurface:Ge,reversedSrc:Pe,inkIsDark:Ee,size:Ie,sizePx:Te,sizeUnit:$e,wordmark:ce,siteName:C,fitToContainer:o})}),h=O("inline-flex shrink-0 items-center justify-center"),te="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return l(T,{children:[r("header",{ref:y,"data-scrolled":J||void 0,...Fe,className:["sf-site-header",...m?[m.className]:[],X==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",P?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:Lt,...Oe?{transform:"translateY(-100%)"}:null,...P?{background:Q,color:"var(--fg)","--sf-header-ground":Q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:l("div",{className:"w-full",style:je,children:[Le?l("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${a} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${a} flex items-center justify-center gap-8`,children:s.map((e,o)=>d(e,`${e.href}-${o}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):i==="center"?l("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${a} flex items-center gap-8`,children:qe.map((e,o)=>d(e,`${e.href}-${o}`))}),h,l("nav",{className:`${a} flex items-center justify-end gap-8`,children:[Xe.map((e,o)=>d(e,`${e.href}-${o}`,"end")),u]})]}):Ce?l("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[l("div",{className:"flex items-center gap-8",style:_e,children:[h,r("nav",{className:`${a} flex items-center gap-8`,children:s.map((e,o)=>d(e,`${e.href}-${o}`))})]}),r("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?l(T,{children:[l("nav",{className:`${a} flex items-center gap-8`,children:[s.map((e,o)=>d(e,`${e.href}-${o}`)),u]}),h]}):l(T,{children:[h,l("nav",{className:`${a} flex items-center gap-8`,children:[s.map((e,o)=>d(e,`${e.href}-${o}`)),u]})]})}),!K&&l("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[l("div",{className:"flex items-center justify-between",children:[O(te,!0),l("div",{className:`${a} flex shrink-0 items-center gap-5`,children:[I,x,v,U,j(),z(!1)]})]}),r("nav",{className:`${a} flex items-center gap-6 border-t border-line/60 pt-3`,children:s.map((e,o)=>d(e,`${e.href}-${o}`))})]}),l("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[O(te,!0),l("div",{className:"flex shrink-0 items-center gap-4",children:[I,U,j(a),z(!0),Ve&&l("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&l("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[s.map((e,o)=>r(le,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${o}`)),l("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[b&&H&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(re,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&Y&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),v&&l("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{At as default};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { CountryShowAs } from "../lib/content/country-show-as.js";
|
|
2
2
|
export type ToolStyle = "icon" | "text";
|
|
3
|
-
export
|
|
4
|
-
|
|
3
|
+
export type SearchStyle = ToolStyle | "icon_text";
|
|
4
|
+
export declare function SearchTool({ style, stylePhone, editing }: {
|
|
5
|
+
style?: SearchStyle;
|
|
6
|
+
stylePhone?: SearchStyle;
|
|
5
7
|
editing?: boolean;
|
|
6
8
|
}): import("react").JSX.Element | null;
|
|
7
9
|
export declare function CartTool({ style, editing }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o}from"react/jsx-runtime";import{useCart as
|
|
1
|
+
"use client";import{jsx as o}from"react/jsx-runtime";import{useCart as m}from"./CartContext.js";import f,{useCountrySelectShows as h}from"./CountrySelect.js";import{AccountButton as p,CartButton as x,SearchButton as a}from"./HeaderTools.js";import d from"./ThemeToggle.js";import{useOfferToPhoneMenu as s}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as T}from"./SearchContext.js";import{useSiteSells as l,useSiteThemeSwitchShown as S}from"./SiteRecordContext.js";import{HideTaker as c}from"efficient-web-builder/render/components/ViewHideRoot";function j({style:t="icon",stylePhone:e,editing:n=!1}){const{open:r}=T(),u=l(),i=e==="icon"||e==="text"||e==="icon_text"?e:void 0;return s(u&&!i?"search":null),u?i?o(c,{as:"span",className:"contents",children:o(a,{onClick:n?void 0:r,asText:t==="text",withWord:t==="icon_text",phoneLook:i})}):o(c,{as:"span","data-phone-menu-tool":"search",className:"contents",children:o(a,{onClick:n?void 0:r,asText:t==="text",withWord:t==="icon_text"})}):null}function L({style:t="icon",editing:e=!1}){const{open:n,totals:r}=m();return l()?o(x,{onClick:e?()=>{}:n,count:r.sets,asText:t==="text",takesViewHide:!0}):null}function V({style:t="icon"}){const e=l();return s(e?"account":null),e?o(p,{asText:t==="text",takesViewHide:!0}):null}function W(){const t=S();return s(t?"theme":null),t?o(c,{as:"span","data-phone-menu-tool":"theme",className:"contents",children:o(d,{})}):null}function M({showAs:t}){const e=h();return s(e?"region":null),e?o(c,{as:"span","data-phone-menu-tool":"region",className:"contents",children:o(f,{showAs:t})}):null}export{V as AccountTool,L as CartTool,M as CountrySwitchTool,j as SearchTool,W as ThemeSwitchTool};
|