efficient-storefront-blocks 0.53.0 → 0.54.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 +18 -0
- package/dist/chunks/{EditorPreviewCheckout-2QMRD4FL.js → EditorPreviewCheckout-C4CWRYET.js} +1 -1
- package/dist/chunks/SiteEditorProvider-L7B4Q53B.js +1 -0
- package/dist/chunks/chunk-5KOLSJNO.js +255 -0
- package/dist/chunks/chunk-I4LSXXHE.js +1 -0
- package/dist/chunks/chunk-ICR6VQE4.js +1 -0
- package/dist/chunks/chunk-QTECZCHP.js +1 -0
- package/dist/chunks/{fitment-data-WKS4XEHO.js → fitment-data-6HK4CEKU.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/index.js +45 -45
- package/dist/links.js +1 -1
- package/dist/words.d.ts +1 -9
- package/dist/words.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/SectionEditorShell-Z6EQFY7M.js +0 -1
- package/dist/chunks/SiteEditorProvider-C65YM6ON.js +0 -1
- package/dist/chunks/chunk-RDG2EJPO.js +0 -1
- package/dist/chunks/chunk-SQYA5VYV.js +0 -255
- package/dist/chunks/chunk-VHOOQYWZ.js +0 -1
- package/dist/chunks/chunk-VHVJ74KF.js +0 -1
- /package/dist/chunks/{chunk-HQ2Q5HZE.js → chunk-35HO2I6M.js} +0 -0
- /package/dist/chunks/{chunk-SQYA5VYV.js.LEGAL.txt → chunk-5KOLSJNO.js.LEGAL.txt} +0 -0
package/dist/links.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var h={bold:{open:"**",close:"**",placeholder:"bold text"},italic:{open:"_",close:"_",placeholder:"italic text"},strike:{open:"~~",close:"~~",placeholder:"struck out"},code:{open:"`",close:"`",placeholder:"code"},highlight:{open:"==",close:"==",placeholder:"highlighted text"},quiet:{open:"^^",close:"^^",placeholder:"quiet text"},underline:{open:"[",close:"]{underline}",placeholder:"underlined text"},sup:{open:"[",close:"]{sup}",placeholder:"superscript"},sub:{open:"[",close:"]{sub}",placeholder:"subscript"}};var Oe={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"};var V=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var x=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],Q=["highlight","quiet"],Ne=V.map(e=>e.style).filter(e=>x.some(n=>n.kind===e)).filter(e=>!Q.includes(e)),Me=[...x,{open:"*",close:"*",kind:"accent"}],ve=[...x,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var ze=["http","https","mailto","tel"];function M(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let n=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!n||ze.includes(n[1].toLowerCase())}var X=["width","profile","rim"];var Ue=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,De={width:[100,500],profile:[20,100],rim:[10,30]};function v(e){let n=Ue.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return X.every(i=>{let[a,u]=De[i];return t[i]>=a&&t[i]<=u})?t:null}function L(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 J(e){return[L({width:e.width}),L({width:e.width,profile:e.profile}),L(e)]}var k=["alloy-wheel","tyre"],ee=["alloy-wheel"],w={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Wn=k.map(e=>({value:e,label:w[e]}));function z(e){return e==null?[...ee]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ee]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function U(e){return m(e).brand??""}function ne(e){return m(e).prices??void 0}function te(e){return m(e).inStock!==!1}function re(e){let n=m(e),t=f(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function D(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function ie(e){return D(e).map(n=>n.family)}function oe(e){if(f(e)==="tyre")return[];let n=m(e),t=n.categories;return t&&t.length>0?t:n.process?[n.process]:[]}function le(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function se(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ae(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function ue(e){if(f(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>v(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var ce=null;function pe(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Object.prototype.hasOwnProperty.call(n,r)?String(n[r]):t):e}function P(e,n){let t=ce?ce[e]:void 0;if(typeof t=="function"){try{let r=t(n??{});if(typeof r=="string"&&r)return r}catch{}return pe(e,n)}return pe(typeof t=="string"&&t?t:e,n)}var de="homepage";function fe(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"custom",label:"Custom URL"}];function T(e){return e.offersCommerce&&e.offersService?F:F.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}function y(e){return e===de?"/":`/${e}`}function _(e){return`/journal/${e}`}function A(e){return`/wheels/${e}`}function R(e,n){return`${y(e)}#${n}`}function $(e){return fe(e)}function $e(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}function E(...e){let n=new Set,t=[];for(let r of e)for(let i of r?.content??[]){let a=$e(i?.props?.anchor);if(!a)continue;let u=$(a);!u||n.has(u)||(n.add(u),t.push({slug:u,name:a}))}return t}var Be=()=>({choosePage:P("Choose a page"),chooseSection:P("Choose a section"),noSections:P("No section anchors yet"),sectionHint:P("Jumps to a section on that page."),choosePost:P("Choose a post"),chooseProduct:P("Choose a product")});function I(e,n,t){if(!e)return"page";if(e.startsWith("/journal/"))return"blog";if(e.startsWith("/wheels/"))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 me(e,n){let t=Be(),r=e.pages.map(l=>({value:y(l.slug),label:l.title})),i=n?.pageOptions?n.pageOptions(r):r,a=i.map(l=>l.value),u=e.pages.map(l=>({label:l.title,options:E(...l.docs).map(p=>({value:R(l.slug,p.slug),label:p.name}))})).filter(l=>l.options.length>0),c=l=>{switch(l){case"page":return{type:"select",options:i,placeholder:t.choosePage};case"anchor":return{type:"groups",groups:u,placeholder:u.length?t.chooseSection:t.noSections};case"blog":return{type:"select",options:e.posts.map(p=>({value:_(p.slug),label:p.title||p.slug})),placeholder:t.choosePost};case"product":return{type:"select",options:e.products.map(p=>({value:p.href,label:p.name||p.href})),placeholder:t.chooseProduct};case"custom":return{type:"text"}}},s=T(e.offers).map(l=>({value:l.value,label:P(l.label),target:c(l.value),...l.value==="anchor"?{hint:t.sectionHint}:{},...l.value==="blog"||l.value==="product"?{hideWhenEmpty:!0}:{}}));if(!n)return{kinds:s,rules:{kindOf:l=>I(l,a),targetOf:l=>l,readFilter:()=>null,withFilter:l=>l}};let o=l=>{let p=n.withFilter(l,null);return n.listingPaths.includes(p)?p:l};return{kinds:s,rules:{kindOf:l=>I(l,a,{listingPaths:n.listingPaths,targetOf:o}),targetOf:o,readFilter:n.readFilter,withFilter:n.withFilter},filtersFor:l=>n.listingPaths.includes(l)?n.filtersFor(l):null}}function B(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function ge(e,n){let t=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(let i of e){let a=i[t];if(typeof a!="number"||!Number.isFinite(a))continue;let u=r.get(i.fieldKey);(u===void 0||a<u)&&r.set(i.fieldKey,a)}return i=>i?r.get(i):void 0}function he(e,n,t,r){let i=new Map;for(let s of t){let o=s[r];typeof o=="number"&&i.set(s.fieldKey,o)}if(i.size===0)return e;let a=[],u=[];e.forEach((s,o)=>{let l=n(s);l&&(a.push(o),u.push({item:s,index:o,order:i.get(l)}))}),u.sort((s,o)=>s.order!==void 0&&o.order!==void 0?s.order-o.order||s.index-o.index:s.order!==void 0?-1:o.order!==void 0?1:s.index-o.index);let c=[...e];return a.forEach((s,o)=>{c[s]=u[o].item}),c.every((s,o)=>s===e[o])?e:c}function ye(e){return Ye(e,"filter")}var We="collection";function W(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":We},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function Ye(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}function Ge(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Pe(e,n){let t=e?.[n];return Ge(t)?t:null}function be(e,n,t,r){if(t==null&&r==null)return!0;let i=Pe(e,n);return!(i===null||t!=null&&i<t||r!=null&&i>r)}var qe={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Lt=Object.keys(qe);var ke=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],He={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},je={diameters:"tyreSizes"};function Ze(e){if(e.length===0)return[];let n=ke.filter(t=>e.every(r=>He[t].includes(r)));return n.filter(t=>{let r=je[t];return!r||!n.includes(r)})}function Ve(e){let n=new Set;for(let t of e)n.add(f(t));return[...n]}var Se={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Qe(e,n,t,r=null){if(r!=="kind"&&n.kind&&f(e)!==n.kind)return!1;for(let i of ke){if(r===i)continue;let a=n[i];if(a.length===0)continue;let u=a.map(String);if(!xe(e,i).some(c=>u.includes(c)))return!1}return!(r!=="price"&&!be(ne(e),t,null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!te(e))}var Xe={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function xe(e,n){switch(n){case"tyreSizes":return[...new Set(ue(e).flatMap(J))];case"brands":return U(e)?[U(e)]:[];case"finishes":return ie(e);case"diameters":return re(e).map(String);case"collections":return oe(e);case"pcds":return le(e);case"tyreTypes":return se(e);case"speedRatings":return ae(e)}}function Je(e){let n=new Map;for(let t of e)for(let r of D(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function Le(e,n,t,r=Ve(e),i=[]){let a=o=>nn(o,r,i),u=Je(e),c=Ze(r).filter(o=>o!=="tyreSizes").filter(a).map(o=>{let l=n[o].map(String),p=new Set,N=new Map,S=new Map;for(let d of e){let b=xe(d,o);for(let g of b)p.add(g);for(let g of new Set(b))S.set(g,(S.get(g)??0)+1);if(Qe(d,n,t,o))for(let g of new Set(b))N.set(g,(N.get(g)??0)+1)}let Ke=[...p].map(d=>({value:d,label:o==="diameters"?`${d}\u2033`:d,count:N.get(d)??0,checked:l.includes(d),swatch:o==="finishes"?u.get(d)??null:null})).sort((d,b)=>{if(o==="diameters")return Number(d.value)-Number(b.value);let g=(S.get(b.value)??0)-(S.get(d.value)??0);return g!==0?g:d.value.localeCompare(b.value)});return{key:o,label:Xe[o],options:Ke}}).filter(o=>o.options.length>en),s=[];for(let o of c){let l=tn(o.key,r,i);l!==void 0&&s.push({fieldKey:o.key,filterOrder:l})}return[...he(c,o=>o.key,s,"filterOrder")]}var en=1;function we(e){return e.showCollection===!1?["collections"]:[]}function nn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>ye(B(t,r))(W(e,r)))}function tn(e,n,t){if(t.length===0)return;let r;for(let i of n){let a=ge(B(t,i),"filter")(W(e,i));a!==void 0&&(r===void 0||a<r)&&(r=a)}return r}var Y={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},G="type";var Fe="AlloyWheelsListing";function Te(e){return M(e.trim())}var C="/wheels",K="Products";function _e(e,n){return n>1?`${K} \xB7 ${e}`:K}function q(...e){for(let n of e){let t=(n?.content??[]).find(r=>r?.type===Fe);if(t)return t.props??{}}return null}function O(...e){return q(...e)!==null}function Ae(e,n){let t=e.filter(r=>O(...r.docs)).map(r=>y(r.slug));return t.length===0&&n.fallback?[C]:t}var H=[G,...Object.entries(Y).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Re(e){let n=e.indexOf("#"),t=n===-1?"":e.slice(n),r=n===-1?e:e.slice(0,n),i=r.indexOf("?");return{path:i===-1?r:r.slice(0,i),query:i===-1?"":r.slice(i+1),hash:t}}function rn(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ee(e){let n=new URLSearchParams(Re(e).query);for(let t of H){let r=n.get(t);if(r)return{param:t,value:r}}return null}function j(e,n){let{path:t,query:r,hash:i}=Re(e),a=r.split("&").filter(u=>u&&!H.includes(rn(u.split("=")[0])));return n?.value&&a.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${a.length?`?${a.join("&")}`:""}${i}`}function Ie(e,n){let t=j(e,null);return n.includes(t)?t:e}function on(e,n,t=[]){return I(e,n,{listingPaths:t,targetOf:r=>Ie(r,t)})}function ln(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 Ce="Product type",sn="AUD";function Z(e,n){let t=n.listing??{},r=z(t.kinds),i=e.filter(s=>r.includes(f(s))),a=we(t),u=Le(i,Se,sn,r,n.fieldUsage).filter(s=>!a.includes(s.key)).map(s=>({param:Y[s.key],label:s.label,values:s.options.filter(o=>!o.value.includes(",")).map(o=>({value:o.value,label:o.label}))})).filter(s=>s.values.length>0),c=k.filter(s=>r.includes(s)&&i.some(o=>f(o)===s));return c.length>1&&u.unshift({param:G,label:Ce,values:c.map(s=>({value:s,label:w[s]}))}),u}function an(e){return n=>{let t=Ae(n,{fallback:e.offersCommerce}),r=n.filter(i=>O(...i.docs)).length;return{listingPaths:t,pageOptions:i=>{let a=i.map(u=>{let c=n.find(s=>y(s.slug)===u.value);return c&&O(...c.docs)?{...u,label:_e(c.title,r)}:u});return r===0&&e.offersCommerce&&!a.some(u=>u.value===C)&&a.push({value:C,label:K}),a},filtersFor:i=>{if(!t.includes(i))return null;let a=n.find(u=>y(u.slug)===i);return Z(e.catalogue,{listing:a?q(...a.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ee,withFilter:j}}}function un(e){let n=an({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=me({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:A(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Te},filtersFor:t.filtersFor??(()=>null)}}function Dt(e,n){return Z(e,n)}export{C as BUILT_IN_LISTING_PATH,F as LINK_KINDS,H as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,Ce as PRODUCT_TYPE_FILTER_LABEL,R as anchorPath,ln as fieldUsageFromAdminRows,on as inferLinkKind,O as isProductListingPage,Te as isSafeLink,T as linkKindsFor,un as linkPickerSetup,Dt as listingFilterFields,q as listingNode,_e as listingPageLabel,Ie as listingTarget,E as pageAnchors,y as pagePath,_ as postPath,Ae as productListingPaths,Ee as readListingFilter,$ as slugifyAnchor,A as wheelPath,j 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 Oe={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"};var V=[{style:"bold",label:"B",name:"Strong",title:"Strong \xB7 **words** \xB7 \u2318B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic \xB7 _words_ \xB7 \u2318I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough \xB7 ~~words~~"},{style:"highlight",label:"\u25C6",name:"Emphasis",title:"Emphasis \xB7 ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet \xB7 ^^words^^"},{style:"code",label:"\u2039\u203A",name:"Code",title:"Code"},{style:"link",label:"\u{1F517}",name:"Link",title:"Link \xB7 [words](https://\u2026) \xB7 \u2318K",shortcut:"k"},{style:"bullet",label:"\u2022",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"\u275D",name:"Quote",title:"Quote"},{style:"clear",label:"T\xD7",name:"Clear marks",title:"Clear marks \xB7 \u2318\u21E7X",shortcut:"shift+x"}];var x=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold",wordStart:!0}],Q=["highlight","quiet"],Ne=V.map(e=>e.style).filter(e=>x.some(n=>n.kind===e)).filter(e=>!Q.includes(e)),Me=[...x,{open:"*",close:"*",kind:"accent"}],ve=[...x,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"(",notBeforeBlock:!0}];var ze=["http","https","mailto","tel"];function M(e){if(e===""||/[\s\u0000-\u001f\u007f]/.test(e))return!1;let n=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!n||ze.includes(n[1].toLowerCase())}var X=["width","profile","rim"];var Ue=/^\s*(\d{2,3})\s*\/\s*(\d{2,3})\s*[A-Za-z]*\s*(\d{2}(?:\.\d+)?)\s*$/,De={width:[100,500],profile:[20,100],rim:[10,30]};function v(e){let n=Ue.exec(e??"");if(!n)return null;let t={width:Number(n[1]),profile:Number(n[2]),rim:Number(n[3])};return X.every(i=>{let[a,u]=De[i];return t[i]>=a&&t[i]<=u})?t:null}function L(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 J(e){return[L({width:e.width}),L({width:e.width,profile:e.profile}),L(e)]}var k=["alloy-wheel","tyre"],ee=["alloy-wheel"],w={"alloy-wheel":"Alloy wheels",tyre:"Tyres"};var Wn=k.map(e=>({value:e,label:w[e]}));function z(e){return e==null?[...ee]:Array.isArray(e)?k.filter(n=>e.includes(n)):[...ee]}var m=e=>e;function f(e){return m(e).kind==="tyre"?"tyre":"alloy-wheel"}function U(e){return m(e).brand??""}function ne(e){return m(e).prices??void 0}function te(e){return m(e).inStock!==!1}function re(e){let n=m(e),t=f(e)==="tyre"?n.rimDiameters:n.sizes;return Array.isArray(t)?t.filter(r=>typeof r=="number"&&Number.isFinite(r)):[]}function D(e){return f(e)==="tyre"?[]:(m(e).finishes??[]).filter(n=>typeof n?.family=="string").map(n=>({family:n.family,color:n.color??null}))}function ie(e){return D(e).map(n=>n.family)}function oe(e){if(f(e)==="tyre")return[];let n=m(e),t=n.categories;return t&&t.length>0?t:n.process?[n.process]:[]}function le(e){return f(e)==="tyre"?[]:m(e).spec?.pcds??[]}function se(e){return f(e)!=="tyre"?[]:m(e).tyreTypes??[]}function ae(e){return f(e)!=="tyre"?[]:m(e).speedRatings??[]}function ue(e){if(f(e)!=="tyre")return[];let n=m(e).sizes;return Array.isArray(n)?n.map(t=>v(typeof t=="string"?t:null)).filter(t=>t!==null):[]}var ce=null;function pe(e,n){return n?e.replace(/\{([A-Za-z][A-Za-z0-9_]*)\}/g,(t,r)=>Object.prototype.hasOwnProperty.call(n,r)?String(n[r]):t):e}function P(e,n){let t=ce?ce[e]:void 0;if(typeof t=="function"){try{let r=t(n??{});if(typeof r=="string"&&r)return r}catch{}return pe(e,n)}return pe(typeof t=="string"&&t?t:e,n)}var de="homepage";function fe(e){return(e??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}var F=[{value:"page",label:"Page"},{value:"anchor",label:"Anchor"},{value:"blog",label:"Blog post",needs:"service"},{value:"product",label:"Product",needs:"commerce"},{value:"custom",label:"Custom URL"}];function T(e){return e.offersCommerce&&e.offersService?F:F.filter(n=>!n.needs||(n.needs==="commerce"?e.offersCommerce:e.offersService))}function y(e){return e===de?"/":`/${e}`}function _(e){return`/journal/${e}`}function A(e){return`/wheels/${e}`}function R(e,n){return`${y(e)}#${n}`}function $(e){return fe(e)}function $e(e){return typeof e=="string"?e.trim():e&&typeof e=="object"&&typeof e.text=="string"?e.text.trim():""}function E(...e){let n=new Set,t=[];for(let r of e)for(let i of r?.content??[]){let a=$e(i?.props?.anchor);if(!a)continue;let u=$(a);!u||n.has(u)||(n.add(u),t.push({slug:u,name:a}))}return t}var Be=()=>({choosePage:P("Choose a page"),chooseSection:P("Choose a section"),noSections:P("No section anchors yet"),sectionHint:P("Jumps to a section on that page."),choosePost:P("Choose a post"),chooseProduct:P("Choose a product")});function I(e,n,t){if(!e)return"page";if(e.startsWith("/journal/"))return"blog";if(e.startsWith("/wheels/"))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 me(e,n){let t=Be(),r=e.pages.map(l=>({value:y(l.slug),label:l.title})),i=n?.pageOptions?n.pageOptions(r):r,a=i.map(l=>l.value),u=e.pages.map(l=>({label:l.title,options:E(...l.docs).map(p=>({value:R(l.slug,p.slug),label:p.name}))})).filter(l=>l.options.length>0),c=l=>{switch(l){case"page":return{type:"select",options:i,placeholder:t.choosePage};case"anchor":return{type:"groups",groups:u,placeholder:u.length?t.chooseSection:t.noSections};case"blog":return{type:"select",options:e.posts.map(p=>({value:_(p.slug),label:p.title||p.slug})),placeholder:t.choosePost};case"product":return{type:"select",options:e.products.map(p=>({value:p.href,label:p.name||p.href})),placeholder:t.chooseProduct};case"custom":return{type:"text"}}},s=T(e.offers).map(l=>({value:l.value,label:P(l.label),target:c(l.value),...l.value==="anchor"?{hint:t.sectionHint}:{},...l.value==="blog"||l.value==="product"?{hideWhenEmpty:!0}:{}}));if(!n)return{kinds:s,rules:{kindOf:l=>I(l,a),targetOf:l=>l,readFilter:()=>null,withFilter:l=>l}};let o=l=>{let p=n.withFilter(l,null);return n.listingPaths.includes(p)?p:l};return{kinds:s,rules:{kindOf:l=>I(l,a,{listingPaths:n.listingPaths,targetOf:o}),targetOf:o,readFilter:n.readFilter,withFilter:n.withFilter},filtersFor:l=>n.listingPaths.includes(l)?n.filtersFor(l):null}}function B(e,n){return e.length===0?e:e.filter(t=>t.kind===void 0||t.kind===n)}function ge(e,n){let t=n==="filter"?"filterOrder":"cardOrder",r=new Map;for(let i of e){let a=i[t];if(typeof a!="number"||!Number.isFinite(a))continue;let u=r.get(i.fieldKey);(u===void 0||a<u)&&r.set(i.fieldKey,a)}return i=>i?r.get(i):void 0}function he(e,n,t,r){let i=new Map;for(let s of t){let o=s[r];typeof o=="number"&&i.set(s.fieldKey,o)}if(i.size===0)return e;let a=[],u=[];e.forEach((s,o)=>{let l=n(s);l&&(a.push(o),u.push({item:s,index:o,order:i.get(l)}))}),u.sort((s,o)=>s.order!==void 0&&o.order!==void 0?s.order-o.order||s.index-o.index:s.order!==void 0?-1:o.order!==void 0?1:s.index-o.index);let c=[...e];return a.forEach((s,o)=>{c[s]=u[o].item}),c.every((s,o)=>s===e[o])?e:c}function ye(e){return Ge(e,"filter")}var We="collection";function W(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":We},pcds:{"alloy-wheel":"pcd"},tyreTypes:{tyre:"tire_type"},speedRatings:{tyre:"speed_rating"}}[e]?.[n]}function Ge(e,n){let t=new Set(e.filter(r=>r[n]===!1).map(r=>r.fieldKey));return r=>!r||!t.has(r)}function Ye(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Pe(e,n){let t=e?.[n];return Ye(t)?t:null}function be(e,n,t,r){if(t==null&&r==null)return!0;let i=Pe(e,n);return!(i===null||t!=null&&i<t||r!=null&&i>r)}var qe={recommended:"Recommended","price-asc":"Price \xB7 low to high","price-desc":"Price \xB7 high to low",new:"Newest",name:"Name A\u2013Z"},Lt=Object.keys(qe);var ke=["tyreSizes","brands","finishes","diameters","collections","pcds","tyreTypes","speedRatings"],He={tyreSizes:["tyre"],brands:["alloy-wheel","tyre"],finishes:["alloy-wheel"],diameters:["alloy-wheel","tyre"],collections:["alloy-wheel"],pcds:["alloy-wheel"],tyreTypes:["tyre"],speedRatings:["tyre"]},je={diameters:"tyreSizes"};function Ze(e){if(e.length===0)return[];let n=ke.filter(t=>e.every(r=>He[t].includes(r)));return n.filter(t=>{let r=je[t];return!r||!n.includes(r)})}function Ve(e){let n=new Set;for(let t of e)n.add(f(t));return[...n]}var Se={tyreSizes:[],brands:[],finishes:[],diameters:[],collections:[],pcds:[],tyreTypes:[],speedRatings:[],priceMax:null,inStockOnly:!1,kind:null,sort:"recommended",page:1};function Qe(e,n,t,r=null){if(r!=="kind"&&n.kind&&f(e)!==n.kind)return!1;for(let i of ke){if(r===i)continue;let a=n[i];if(a.length===0)continue;let u=a.map(String);if(!xe(e,i).some(c=>u.includes(c)))return!1}return!(r!=="price"&&!be(ne(e),t,null,n.priceMax)||r!=="inStock"&&n.inStockOnly&&!te(e))}var Xe={tyreSizes:"Size",brands:"Brand",finishes:"Colour",diameters:"Size \xB7 diameter",collections:"Collection",pcds:"PCD \xB7 fitment",tyreTypes:"Tyre type",speedRatings:"Speed rating"};function xe(e,n){switch(n){case"tyreSizes":return[...new Set(ue(e).flatMap(J))];case"brands":return U(e)?[U(e)]:[];case"finishes":return ie(e);case"diameters":return re(e).map(String);case"collections":return oe(e);case"pcds":return le(e);case"tyreTypes":return se(e);case"speedRatings":return ae(e)}}function Je(e){let n=new Map;for(let t of e)for(let r of D(t))r.color&&!n.has(r.family)&&n.set(r.family,r.color);return n}function Le(e,n,t,r=Ve(e),i=[]){let a=o=>nn(o,r,i),u=Je(e),c=Ze(r).filter(o=>o!=="tyreSizes").filter(a).map(o=>{let l=n[o].map(String),p=new Set,N=new Map,S=new Map;for(let d of e){let b=xe(d,o);for(let g of b)p.add(g);for(let g of new Set(b))S.set(g,(S.get(g)??0)+1);if(Qe(d,n,t,o))for(let g of new Set(b))N.set(g,(N.get(g)??0)+1)}let Ke=[...p].map(d=>({value:d,label:o==="diameters"?`${d}\u2033`:d,count:N.get(d)??0,checked:l.includes(d),swatch:o==="finishes"?u.get(d)??null:null})).sort((d,b)=>{if(o==="diameters")return Number(d.value)-Number(b.value);let g=(S.get(b.value)??0)-(S.get(d.value)??0);return g!==0?g:d.value.localeCompare(b.value)});return{key:o,label:Xe[o],options:Ke}}).filter(o=>o.options.length>en),s=[];for(let o of c){let l=tn(o.key,r,i);l!==void 0&&s.push({fieldKey:o.key,filterOrder:l})}return[...he(c,o=>o.key,s,"filterOrder")]}var en=1;function we(e){return e.showCollection===!1?["collections"]:[]}function nn(e,n,t){return n.length===0||t.length===0?!0:n.some(r=>ye(B(t,r))(W(e,r)))}function tn(e,n,t){if(t.length===0)return;let r;for(let i of n){let a=ge(B(t,i),"filter")(W(e,i));a!==void 0&&(r===void 0||a<r)&&(r=a)}return r}var G={tyreSizes:"tyreSize",brands:"brand",finishes:"colour",diameters:"size",collections:"collection",pcds:"pcd",tyreTypes:"tyreType",speedRatings:"speed"},Y="type";var Fe="AlloyWheelsListing";function Te(e){return M(e.trim())}var C="/wheels",K="Products";function _e(e,n){return n>1?`${K} \xB7 ${e}`:K}function q(...e){for(let n of e){let t=(n?.content??[]).find(r=>r?.type===Fe);if(t)return t.props??{}}return null}function O(...e){return q(...e)!==null}function Ae(e,n){let t=e.filter(r=>O(...r.docs)).map(r=>y(r.slug));return t.length===0&&n.fallback?[C]:t}var H=[Y,...Object.entries(G).filter(([e])=>e!=="tyreSizes").map(([,e])=>e)];function Re(e){let n=e.indexOf("#"),t=n===-1?"":e.slice(n),r=n===-1?e:e.slice(0,n),i=r.indexOf("?");return{path:i===-1?r:r.slice(0,i),query:i===-1?"":r.slice(i+1),hash:t}}function rn(e){try{return decodeURIComponent(e.replace(/\+/g," "))}catch{return e}}function Ee(e){let n=new URLSearchParams(Re(e).query);for(let t of H){let r=n.get(t);if(r)return{param:t,value:r}}return null}function j(e,n){let{path:t,query:r,hash:i}=Re(e),a=r.split("&").filter(u=>u&&!H.includes(rn(u.split("=")[0])));return n?.value&&a.push(`${encodeURIComponent(n.param)}=${encodeURIComponent(n.value)}`),`${t}${a.length?`?${a.join("&")}`:""}${i}`}function Ie(e,n){let t=j(e,null);return n.includes(t)?t:e}function on(e,n,t=[]){return I(e,n,{listingPaths:t,targetOf:r=>Ie(r,t)})}function ln(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 Ce="Product type",sn="AUD";function Z(e,n){let t=n.listing??{},r=z(t.kinds),i=e.filter(s=>r.includes(f(s))),a=we(t),u=Le(i,Se,sn,r,n.fieldUsage).filter(s=>!a.includes(s.key)).map(s=>({param:G[s.key],label:s.label,values:s.options.filter(o=>!o.value.includes(",")).map(o=>({value:o.value,label:o.label}))})).filter(s=>s.values.length>0),c=k.filter(s=>r.includes(s)&&i.some(o=>f(o)===s));return c.length>1&&u.unshift({param:Y,label:Ce,values:c.map(s=>({value:s,label:w[s]}))}),u}function an(e){return n=>{let t=Ae(n,{fallback:e.offersCommerce}),r=n.filter(i=>O(...i.docs)).length;return{listingPaths:t,pageOptions:i=>{let a=i.map(u=>{let c=n.find(s=>y(s.slug)===u.value);return c&&O(...c.docs)?{...u,label:_e(c.title,r)}:u});return r===0&&e.offersCommerce&&!a.some(u=>u.value===C)&&a.push({value:C,label:K}),a},filtersFor:i=>{if(!t.includes(i))return null;let a=n.find(u=>y(u.slug)===i);return Z(e.catalogue,{listing:a?q(...a.docs):null,fieldUsage:e.fieldUsage})},readFilter:Ee,withFilter:j}}}function un(e){let n=an({catalogue:e.catalogue,fieldUsage:e.fieldUsage,offersCommerce:e.offers.offersCommerce})(e.pages),t=me({pages:e.pages,posts:e.posts,products:e.products.map(r=>({href:A(r.slug),name:r.name||r.slug})),offers:e.offers},n);return{...t,rules:{...t.rules,isSafe:Te},filtersFor:t.filtersFor??(()=>null)}}function $t(e,n){return Z(e,n)}export{C as BUILT_IN_LISTING_PATH,F as LINK_KINDS,H as LISTING_FILTER_PARAMS,K as LISTING_PAGE_LABEL,Ce as PRODUCT_TYPE_FILTER_LABEL,R as anchorPath,ln as fieldUsageFromAdminRows,on as inferLinkKind,O as isProductListingPage,Te as isSafeLink,T as linkKindsFor,un as linkPickerSetup,$t as listingFilterFields,q as listingNode,_e as listingPageLabel,Ie as listingTarget,E as pageAnchors,y as pagePath,_ as postPath,Ae as productListingPaths,Ee as readListingFilter,$ as slugifyAnchor,A as wheelPath,j as withListingFilter};
|
package/dist/words.d.ts
CHANGED
|
@@ -219,7 +219,6 @@ export type WebBuilderPhrase =
|
|
|
219
219
|
| "Bottom right"
|
|
220
220
|
| "Box"
|
|
221
221
|
| "Box name"
|
|
222
|
-
| "Brand Strip"
|
|
223
222
|
| "Brand Text"
|
|
224
223
|
| "Brand name"
|
|
225
224
|
| "Breadcrumb"
|
|
@@ -1298,7 +1297,6 @@ export type StorefrontBlocksPhrase =
|
|
|
1298
1297
|
| "Authorization expired — try again in a moment."
|
|
1299
1298
|
| "Auto (covers if 4+ groups)"
|
|
1300
1299
|
| "Auto reads what the first section on each page says it is — dark, light or accent — and picks the text that can be read on it. Set Light or Dark to decide it yourself when Auto reads a page wrong."
|
|
1301
|
-
| "Auto-fills this grid each time you open the editor. Set how many appear with “Wheels to display”. The wheels you pick below are ignored while a source is linked."
|
|
1302
1300
|
| "Auto-refreshes from the most-recent visible posts each time you open the editor. Set how many appear with “Posts to display”."
|
|
1303
1301
|
| "Auto-synced from {place} · {n} post"
|
|
1304
1302
|
| "Auto-synced from {place} · {n} posts"
|
|
@@ -1316,7 +1314,6 @@ export type StorefrontBlocksPhrase =
|
|
|
1316
1314
|
| "Both"
|
|
1317
1315
|
| "Brand"
|
|
1318
1316
|
| "Brand, Color, Size and PCD follow the product type. Set them in Product types."
|
|
1319
|
-
| "Brands"
|
|
1320
1317
|
| "Breadcrumb label"
|
|
1321
1318
|
| "Browse all products"
|
|
1322
1319
|
| "Build it out of Boxes and blocks: the logo, menu, search, region and cart become blocks you can move. Your current header is kept."
|
|
@@ -1362,7 +1359,6 @@ export type StorefrontBlocksPhrase =
|
|
|
1362
1359
|
| "Content source"
|
|
1363
1360
|
| "Controls"
|
|
1364
1361
|
| "Could not load header settings."
|
|
1365
|
-
| "Could not read this website’s brands. The list above shows only what is already picked — reopen the panel to try again."
|
|
1366
1362
|
| "Could not save. Please retry."
|
|
1367
1363
|
| "Couldn’t reach the product catalog."
|
|
1368
1364
|
| "Country name"
|
|
@@ -1565,7 +1561,6 @@ export type StorefrontBlocksPhrase =
|
|
|
1565
1561
|
| "Main only"
|
|
1566
1562
|
| "Make"
|
|
1567
1563
|
| "Manage menus →"
|
|
1568
|
-
| "Mark"
|
|
1569
1564
|
| "Marker"
|
|
1570
1565
|
| "Max"
|
|
1571
1566
|
| "Media group"
|
|
@@ -1688,7 +1683,6 @@ export type StorefrontBlocksPhrase =
|
|
|
1688
1683
|
| "Promise row"
|
|
1689
1684
|
| "Questions? Talk to us"
|
|
1690
1685
|
| "Read all posts →"
|
|
1691
|
-
| "Reading this website’s brands…"
|
|
1692
1686
|
| "Ready when *you are.*"
|
|
1693
1687
|
| "Recent issues"
|
|
1694
1688
|
| "Recent posts"
|
|
@@ -1752,7 +1746,6 @@ export type StorefrontBlocksPhrase =
|
|
|
1752
1746
|
| "Ships to"
|
|
1753
1747
|
| "Ships to · fallback"
|
|
1754
1748
|
| "Shop"
|
|
1755
|
-
| "Shop by brand"
|
|
1756
1749
|
| "Short brand tagline"
|
|
1757
1750
|
| "Short description"
|
|
1758
1751
|
| "Show / hide elements"
|
|
@@ -1768,6 +1761,7 @@ export type StorefrontBlocksPhrase =
|
|
|
1768
1761
|
| "Show tab"
|
|
1769
1762
|
| "Show “Other” reason"
|
|
1770
1763
|
| "Shown only while the site serves no countries — otherwise the site's default country is stated"
|
|
1764
|
+
| "Shows this source’s products as they are now, here and on the live page. Set how many appear with “Wheels to display”. The wheels you pick below are ignored while a source is linked."
|
|
1771
1765
|
| "Signup form"
|
|
1772
1766
|
| "Site"
|
|
1773
1767
|
| "Site Footer"
|
|
@@ -1853,11 +1847,9 @@ export type StorefrontBlocksPhrase =
|
|
|
1853
1847
|
| "This section points at “{slug}”, and this website has no form with that name. Pick one from the list above, or leave it — nothing has been changed."
|
|
1854
1848
|
| "This section still points at “{slug}”, and that is unchanged."
|
|
1855
1849
|
| "This visit"
|
|
1856
|
-
| "This website has no brands yet. A brand appears here once it has a product in the catalog."
|
|
1857
1850
|
| "This website has no currency yet. Add one in {place} and these cards will price. Only you can see this line."
|
|
1858
1851
|
| "This website’s forms couldn’t be loaded, so there is nothing to choose from yet."
|
|
1859
1852
|
| "Tick label"
|
|
1860
|
-
| "Tile"
|
|
1861
1853
|
| "Tiled"
|
|
1862
1854
|
| "Title / product"
|
|
1863
1855
|
| "Tools"
|