efficient-storefront-blocks 0.74.0 → 0.75.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 +19 -0
- package/dist/chunks/EditorPreviewCheckout-27GNLSNR.js +4 -0
- package/dist/chunks/{SiteEditorProvider-Z33JB5BA.js → SiteEditorProvider-N4T55FAV.js} +1 -1
- package/dist/chunks/chunk-4V6BLJSG.js +1 -0
- package/dist/chunks/{chunk-QJDTP7K6.js → chunk-K26JUDGZ.js} +1 -1
- package/dist/chunks/{chunk-5OFEWRWI.js → chunk-SJODSVWU.js} +1 -1
- package/dist/chunks/{chunk-UGXNUQRA.js → chunk-WPHE7RI4.js} +1 -1
- package/dist/chunks/{fitment-data-DHKRLKNI.js → fitment-data-5ZSHENM3.js} +1 -1
- package/dist/editor/components/CategorySource.js +1 -1
- package/dist/editor/lib/efficient-backend.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +2 -3
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +232 -33
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CartContext.d.ts +3 -0
- package/dist/render/components/CartContext.js +1 -1
- package/dist/render/components/HeaderToolBlocks.d.ts +1 -2
- package/dist/render/components/HeaderToolBlocks.js +1 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +7 -2
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/lib/api/index.d.ts +0 -8
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +7 -3
- package/dist/render/lib/content/site.d.ts +1 -1
- package/dist/render/lib/document/blocks/commerce/CountrySwitchBlock/render.js +1 -1
- package/dist/words.d.ts +2 -3
- package/dist/words.js +1 -1
- package/package.json +4 -1
- package/dist/chunks/EditorPreviewCheckout-YQ3F5MSG.js +0 -4
- package/dist/chunks/chunk-BZDVZUF4.js +0 -1
- /package/dist/chunks/{chunk-UJW4B64R.js → chunk-3TBLX25X.js} +0 -0
- /package/dist/chunks/{chunk-UGXNUQRA.js.LEGAL.txt → chunk-WPHE7RI4.js.LEGAL.txt} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as ft,i as pe,q as pt,s as mt,t as gt,v as B}from"./chunk-QJDTP7K6.js";import{Ba as fe,Ca as ct,Fa as $e,Ga as dt,Ja as Be,Ka as We}from"./chunk-UJW4B64R.js";import{j as ut,l as oe}from"./chunk-5OFEWRWI.js";import{createContext as cn,useContext as xt,useEffect as dn,useMemo as ge,useState as bt}from"react";function ht(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function ie(e,t){if(e.length===0)return null;let n=0;for(let r of e){let o=r.prices?.[t];if(typeof o!="number"||!Number.isFinite(o)||o<=0)return null;n+=o*r.wheels}return n}var Ge=4,_r=1,Nr={unit:"set",spares:0,spareSide:"left"};function yt(e){return e.unit==="single"?1:Ge+e.spares}function Rr(e,t){return[{partNumber:e.partNumber,wheels:yt(t),prices:e.prices}]}function Lr(e,t){let n=yt(t)-Ge;if(n<=0||e.length===0)return e;let r=ln(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function ln(e){let t,n;for(let r=0;r<e.length;r+=1){let o=e[r].hand;if(o!=="left"&&o!=="right")continue;if((o==="left"?t:n)!==void 0)return null;o==="left"?t=r:n=r}return t!==void 0&&n!==void 0?{left:t,right:n}:null}function un(e,t){return t.spares>0?`${e} + spare`:e}function Ir(e){return e.unit==="single"?"Single":un(`Set of ${Ge}`,e)}var Ar="data-add-to-basket",qe=9,Ne="en";function me(e,t,n=0){return new Intl.NumberFormat(Ne,{style:"currency",currency:t,minimumFractionDigits:0,maximumFractionDigits:n}).format(e)}function kr(e,t){return new Intl.NumberFormat(Ne,{style:"currency",currency:t}).format(e)}import{jsx as gn}from"react/jsx-runtime";var fn="storefront-country",Ct=fn,Ke=cn(null);function pn(e){return St(e,"catalogue")}function mn(e){return St(e,"money")}function St(e,t){let n=new Map(e.map(o=>[o.code,o.decimalPlaces])),r=new Map;return(o,i)=>{if(!i)return"";let a=r.get(i);if(!a){let l=n.get(i)??0;a=new Intl.NumberFormat(Ne,{style:"currency",currency:i,minimumFractionDigits:t==="money"?l:0,maximumFractionDigits:l}),r.set(i,a)}return a.format(o)}}function Fr({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=ge(()=>t??[],[t]),a=ge(()=>n??[],[n]),l=ge(()=>r||i.find(b=>b.isDefault)?.code||i[0]?.code||"",[r,i]),c=ge(()=>o||a.find(b=>b.isDefault)?.code||a[0]?.code||"",[o,a]),[u,f]=bt(c),[d,S]=bt(!1);dn(()=>{let b=oe.getItem(Ct);b&&a.some(P=>P.code===b)&&f(b),S(!0)},[a]);function N(b){f(b),oe.setItem(Ct,b)}let C=ge(()=>{let b=a.find(v=>v.code===u)??null,P=b?.currency,O=P&&i.some(v=>v.code===P)?P:l,M=pn(i),I=mn(i);return{country:u,currency:O,setCountry:N,currencies:i,countries:a,activeCountry:b,formatPrice:(v,x)=>M(v,x??O),formatMoney:(v,x)=>I(v,x??O),ready:d}},[u,i,a,l,d]);return gn(Ke.Provider,{value:C,children:e})}function vt(){let e=xt(Ke);if(!e)throw new Error("useCurrency must be used within a CurrencyProvider");return e}function Ur(){return xt(Ke)?.country??""}import{createContext as In,useCallback as _,useContext as An,useEffect as Z,useMemo as Mt,useRef as Ie,useState as L}from"react";function Pt(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var wt="We'll confirm this discount when you place your order.",Wr="Confirmed at checkout";function Gr(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Et="coupon_code: ";function qr(e){return!(e instanceof pe)||e.status!==400||!e.message.startsWith(Et)?null:e.message.slice(Et.length)}function _t(e,t){return e.map(n=>({qty:n.qty,slug:n.slug,name:`${n.name.lead}${n.name.accent}`.trim(),finish:n.finishName,size:n.size,kind:n.kind,sku:n.sku,pack:n.pack,priceLabel:t(n)}))}var Re="Price on request",yn="Request a quote",bn="from ",Vr="From ",Yr="each",Nt="Free";function ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Xe(e,t){let n=e?.[t];return ze(n)?n:null}function Qr(e,t,n,r){let o=Xe(e,n),i=Xe(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function jr(e,t,n,r){if(n==null&&r==null)return!0;let o=Xe(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Cn={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function xn(e,t,n){if(!ze(e))return Cn;let r=ze(t)&&t>e?t:null;return{priced:!0,unit:e,was:r,onSale:r!==null,setTotal:n!=null?e*n:null}}function Zr(e,t,n=""){return!e.priced||e.unit==null?Re:`${n}${me(e.unit,t)}`}function Jr(e,t){return e.was==null?null:me(e.was,t)}function Sn(e,t,n=1){let r=ie(e,t);if(r===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};let o=e.reduce((a,l)=>a+l.wheels,0),i=Math.min(...e.map(a=>a.prices[t]));return{priced:!0,unit:i,isFrom:i*o!==r,setTotal:r*n}}var vn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function eo(e,t,n,r=1){let o=xn(e.prices[n],e.msrpPrices?.[n],4),i=o.setTotal==null?null:o.setTotal*r;if(!t)return{priced:o.priced,unit:o.unit,isFrom:!0,was:o.was,onSale:o.onSale,setTotal:null,fromSetTotal:i};let a=Sn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...vn,fromSetTotal:i}}function En(e,t){return!e.priced||e.unit==null?Re:`${e.isFrom?bn:""}${me(e.unit,t)}`}function to(e,t){return e.was==null?null:me(e.was,t)}function no(e,t){return!e.priced||e.unit==null?yn:En(e,t)}var Pn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Rt(e){return Pn.test(e.trim())}var Lt="sf:ga-purchases",wn=20;function At(){return typeof window>"u"||window.parent!==window}function he(...e){try{if(At()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function _n(e,t){let n=e.config.find(r=>r.gold)?.label;return{item_id:`${e.slug}|${e.finishName}|${e.size}`,item_name:`${e.name.lead}${e.name.accent}`.trim(),...n?{item_variant:n}:{},price:ie(e.components,t)??0,quantity:e.qty}}function Ve(e,t){return e.filter(Le).map(n=>_n(n,t))}function lo(e){he("event","view_item",{currency:e.currency,value:e.pricePerSet,items:[{item_id:e.itemId,item_name:e.itemName,...e.variant?{item_variant:e.variant}:{},price:e.pricePerSet,quantity:1}]})}function kt(e,t){let n=Ve([e],t);n.length!==0&&he("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function uo(e){let t=Ve(e.lines,e.currency);t.length!==0&&he("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var It=new Set;function Nn(e){if(It.has(e))return!1;It.add(e);try{let t=JSON.parse(oe.getItem(Lt)??"[]");if(t.includes(e))return!1;oe.setItem(Lt,JSON.stringify([...t,e].slice(-wn)))}catch{}return!0}function co(e){let t=e.confirmation;if(At()||!Nn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);he("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:Ve(e.lines,n)}),e.adsSendTo&&he("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Rn="Arranged after review",Tt="Calculated at checkout",Ln=Tt,mo=Tt;function Ot({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function go(e){switch(e){case"arranged":return Rn;case"pending":return Ln;case"free":return Nt;case"charged":return null}}import{jsx as Mn}from"react/jsx-runtime";var kn=400,Tn=400,On=1500;function Le(e){return(e.components?.length??0)>0}function Dt(e,t){return{code:e,valid:t.valid,deferred:Pt(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function Ut(e,t){return ie(e.components,t)}function Ye(e,t){let n=Ut(e,t);return n===null?null:n*e.qty}function Ft(e){return e!=="tyre"}var Ht=In(null);function No({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=vt(),[i,a]=L(t),[l,c]=L([]),[u,f]=L([]),[d,S]=L([]),[N,C]=L(!1),[b,P]=L(!1),[O,M]=L(!1),[I,v]=L(!1),[x,W]=L(null),[A,G]=L(void 0),[y,w]=L(null),[m,q]=L(null),[J,U]=L(!1),[D,Se]=L(null),X=Ie(void 0),K=_(()=>a(!0),[]),se=_(()=>a(!1),[]),ee=_(()=>a(s=>!s),[]);Z(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&K()},[K,t]);let ve=_(s=>{w(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision?p:s)},[]),H=_(s=>{v(!0),Ft(s)&&M(!0)},[]),Ee=O||l.some(s=>Ft(s.kind)),F=I||l.length>0;Z(()=>{if(t||!Ee||N)return;let s=!0;return B.listWheels().then(p=>{s&&(f(p),C(!0))}),()=>{s=!1}},[t,Ee,N]),Z(()=>{if(t||!F||b)return;let s=!0;return B.listBundles().then(p=>{s&&(S(p),P(!0))}),()=>{s=!1}},[t,F,b]);let z=x?.deliveryOptions??[];Z(()=>{x&&Se(s=>s&&z.some(p=>p.id===s)?s:z[0]?.id??null)},[x]);let V=_(()=>l.filter(Le).flatMap(s=>ht(s.components,s.qty)),[l]),le=_(async(s,p)=>{let h=s.trim().toUpperCase();if(!h)return;let g=V();if(g.length===0){q({code:h,valid:!1,message:"Add a wheel to the cart first."});return}U(!0),X.current=p;try{let R=await B.validateCoupon({code:h,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:p});q(Dt(h,R))}catch{q({code:h,valid:!1,message:"Could not check that code. Please try again."})}finally{U(!1)}},[V,n,D]),ue=_(()=>{q(null),X.current=void 0},[]),ce=_(s=>{if(!m)return;let{code:p}=m;q(h=>h&&h.code===p?{code:p,valid:!1,refused:!0,message:s}:h)},[m]);Z(()=>{if(!m||m.refused)return;let s=m.code,p=g=>g!==null&&g.code===s&&!g.refused,h=setTimeout(async()=>{let g=V();if(g.length===0){q(R=>p(R)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:R);return}U(!0);try{let R=await B.validateCoupon({code:s,items:g,currency:n,shippingMethodId:D??void 0,customerEmail:X.current});q(de=>p(de)?Dt(s,R):de)}catch{}finally{U(!1)}},kn);return()=>clearTimeout(h)},[l,n,D]);let te=m&&!m.refused?m.code:void 0;Z(()=>{if(t)return;let s=!0,p=setTimeout(async()=>{let h=V();if(h.length===0){W(null),G(void 0);return}try{let g=await B.quoteCart({items:h,currency:n,shippingMethodId:D??void 0,couponCode:te,customerEmail:X.current||void 0,country:y?.country||r||void 0,subdivision:y?.country&&y.subdivision||void 0});if(!s)return;W(g)}catch{if(!s)return}G(te)},Tn);return()=>{s=!1,clearTimeout(p)}},[l,n,D,te,r,y]);let Y=_(s=>{c(p=>{let h=p.findIndex(g=>g.id===s.id);return h===-1?[...p,s]:p.map((g,R)=>R===h?{...g,qty:Math.min(qe,g.qty+s.qty)}:g)}),kt(s,n)},[n]),Pe=_(s=>{c(p=>p.filter(h=>h.id!==s))},[]),we=_((s,p)=>{let h=Math.max(1,Math.min(qe,p));c(g=>g.map(R=>R.id===s?{...R,qty:h}:R))},[]),E=_(s=>{c(s)},[]),[k,ne]=L(null),nt=Ie(null);nt.current=k;let $=Ie(null),Fe=Ie(""),rt=_((s,p)=>{let h=s.trim().toLowerCase();Rt(h)&&ne(g=>g&&g.email===h&&g.firstName===(p??"")?g:{email:h,firstName:p??""})},[]);Z(()=>{if(t||!k)return;let s=_t(l.filter(Le),g=>Ye(g,n)===null?Re:o(Ye(g,n),n)),p={email:k.email,firstName:k.firstName,currency:n,items:s},h=JSON.stringify(p);if(h!==Fe.current)return $.current&&clearTimeout($.current),$.current=setTimeout(()=>{$.current=null,Fe.current=h,B.captureCart(p).catch(g=>{})},On),()=>{$.current&&(clearTimeout($.current),$.current=null)}},[l,k,n,t]);let ot=_(()=>{$.current&&(clearTimeout($.current),$.current=null);let s=nt.current;s&&(Fe.current="",B.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),it=Mt(()=>{let s=l.reduce((T,re)=>{let _e=Ye(re,n);return _e===null?T:T+_e},0),p=l.some(T=>Ut(T,n)===null),h=l.reduce((T,re)=>T+re.qty,0),g=m?.valid?m.effects:void 0,R=g?Math.min(s,Number(g.discountAmount)):0,de=x?.bundleDiscount??0,nn=x?.appliedBundles??[],Ue=!!g?.freeShipping,st=z.find(T=>T.id===D),lt=Ue?0:x?.shipping??st?.amount??0,rn=Ot({quoted:x!==null,optionCount:z.length,chosenAmount:st?.amount,couponWaivesFreight:Ue}),He={};for(let T of g?.freeUnits??[])He[T.partNumber]=(He[T.partNumber]??0)+T.quantity;let on=x?.tax??null,an=x?x.grandTotal:s-R-de+lt;return{sets:h,units:l.reduce((T,re)=>T+(re.components??[]).reduce((_e,sn)=>_e+sn.wheels*re.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:R,bundleDiscount:de,appliedBundles:nn,shipping:lt,freeShipping:Ue,shippingStatus:rn,freeUnitsByPartNumber:He,tax:on,grand:an,repricing:!!m?.refused&&x!==null&&A===m?.code,currency:n}},[l,n,m,z,D,x,A]),at=_(s=>{Y(s),K()},[Y,K]),tn=Mt(()=>({isOpen:i,preview:t,open:K,close:se,toggle:ee,items:l,catalog:u,bundles:d,warmCatalog:H,add:Y,addAndOpen:at,remove:Pe,setQty:we,replaceItems:E,identify:rt,clearCapturedCart:ot,coupon:m,applyCoupon:le,removeCoupon:ue,refuseCoupon:ce,couponBusy:J,deliveryOptions:z,setQuoteDestination:ve,shippingMethodId:D,setShippingMethodId:Se,totals:it}),[i,t,K,se,ee,l,u,d,H,Y,at,Pe,we,E,rt,ot,m,le,ue,ce,J,z,ve,D,it]);return Mn(Ht.Provider,{value:tn,children:e})}function $t(){let e=An(Ht);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as zn}from"react";function Bt(e,t,n,r){for(;e.size>=t;){let o,i;for(let[l,c]of e){if(c.expiresAt<=r){o=l;break}i===void 0&&n(l)&&(i=l)}let a=o??i??e.keys().next().value;if(a===void 0)return;e.delete(a)}}var Dn=6e4,Fn=5e3,Un=500,Ae=new Map;async function Hn(e){let{host:t,matchesRequestHost:n}=await pt();if(!t)return"";let r=await mt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}var $n=e=>e.includes("|slug:")||e.includes("|xhost:");async function Wt(e,t){if(await gt()!==null)return t();let n=await Hn(e);if(!n)return t();let r=Date.now(),o=Ae.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?Fn:Dn,c=Ae.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,f=a&&u?u:i;return Bt(Ae,Un,$n,r),Ae.set(n,{load:f,expiresAt:r+l,lastGood:u}),f}var Bn=404;function Wn(e){if(e instanceof pe&&e.status===Bn)return{state:"absent"};let t=e instanceof pe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var Gn="[storefront:chrome-load-failed]";function qn(e,t){console.error(`${Gn} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function Gt(e,t,n,r){try{let o=await t();return r?.(o)?{value:o,outcome:{state:"absent"}}:{value:o,outcome:{state:"ok"}}}catch(o){let i=Wn(o);return i.state==="failed"&&qn(e,i),{value:n,outcome:i}}}function Kn(e){return e==="production"?"silent":"banner"}var Mo=Kn("production");function Xn(e,t){return e?.trim()||t}function Go({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=Xn(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var Vn={name:fe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[],defaultCurrency:null,countries:[],defaultCountry:null,commerceEnabled:!0,cardPayments:!1,paymentMethods:[],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e},qo=zn(async()=>Wt("site",()=>Gt("site",async()=>{let e=await B.getSite();return{name:ct(e.name),legalName:e.legalName?.trim()||null,foundedYear:e.foundedYear??null,faviconUrl:e.faviconUrl??null,currencies:e.currencies??[],defaultCurrency:e.defaultCurrency??null,countries:e.countries??[],defaultCountry:e.defaultCountry??null,commerceEnabled:e.commerceEnabled??!0,cardPayments:e.cardPayments??!1,paymentMethods:e.paymentMethods??(e.cardPayments?["card"]:[]),paypalClientId:e.paypalClientId??null,paypalEnvironment:e.paypalEnvironment??null,squareApplicationId:e.squareApplicationId??null,squareLocationId:e.squareLocationId??null,squareEnvironment:e.squareEnvironment??null,ga4MeasurementId:e.ga4MeasurementId??null,googleAdsId:e.googleAdsId??null,googleAdsConversionLabel:(e.googleAdsId?e.googleAdsConversionLabel:null)??null,metaPixelId:e.metaPixelId??null,consentEnabled:e.consentEnabled??!1,consentPrivacyPage:e.consentPrivacyPage??null,consentNoticeOptOut:e.consentNoticeOptOut??!1,socialLinks:dt(e.socialLinks)}},Vn)));var Ko={name:fe,legalName:null,foundedYear:null,faviconUrl:null,currencies:[{code:"USD",symbol:"$",decimalPlaces:2,isDefault:!0}],defaultCurrency:"USD",countries:[{code:"US",name:"United States",currency:"USD",url:"",isDefault:!0,chargeTax:!1,taxDisplay:"none",taxName:"",taxRate:null,postalLabel:"Zip Code"}],defaultCountry:"US",commerceEnabled:!0,cardPayments:!0,paymentMethods:["card"],paypalClientId:null,paypalEnvironment:null,squareApplicationId:null,squareLocationId:null,squareEnvironment:null,ga4MeasurementId:null,googleAdsId:null,googleAdsConversionLabel:null,metaPixelId:null,consentEnabled:!1,consentPrivacyPage:null,consentNoticeOptOut:!1,socialLinks:$e};import{jsx as be,jsxs as Qe}from"react/jsx-runtime";import{useEffect as ke,useId as Zn,useRef as Kt,useState as Te}from"react";import{efficientClientOpen as Yn}from"efficient-easel/screen/lib/session";var ye=new Map,Qn=64;async function jn(e){if(!Yn())return null;try{let t=await fetch(`${ut()}/logo-analysis.json?url=${encodeURIComponent(e)}`);if(!t.ok)return null;let n=await t.json();if(!n||typeof n!="object")return null;let{reversed:r,inkIsDark:o}=n;return typeof r!="string"?null:{reversed:r,inkIsDark:typeof o=="boolean"?o:null}}catch{return null}}function qt(e){let t=ye.get(e);if(t)return t;let n=jn(e);if(ye.set(e,n),ye.size>Qn){let r=ye.keys().next();r.done||ye.delete(r.value)}return n}var Jn=202/22,er=.88,ai=16,tr="invert(1)";function si({variant:e="header",scrolled:t=!0,src:n,reverse:r=!1,color:o=null,onLightSurface:i,reversedSrc:a,inkIsDark:l,size:c="medium",sizePx:u,wordmark:f,siteName:d=fe,fitToContainer:S=!1,fitWordmarkToContainer:N=!1,fitFloorPx:C}){let b=f&&f.trim()?f.trim():d,[P,O]=Te(!1),M=Kt(null),I=E=>{M.current=E};ke(()=>{let E=M.current?.ownerDocument??document,k=()=>{O(E.documentElement.getAttribute("data-theme")==="light")};k();let ne=new MutationObserver(k);return ne.observe(E.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>ne.disconnect()},[]);let v=n&&n.trim()?n.trim():null,x=!!v&&ft(v),W=i??(P&&t),A=o&&o.trim()?o.trim():null,G=r&&!A,y=`logo-color-${Zn().replace(/[^A-Za-z0-9_-]/g,"")}`,w=G&&x&&v&&a!=null?{reversed:a,inkIsDark:l??null}:null,m=w!==null,[q,J]=Te(null);ke(()=>{if(!G||!v||!x||m){J(null);return}let E=!1;return J(null),qt(v).then(k=>{E||J(k)}),()=>{E=!0}},[G,v,x,m]);let U=w??q,D=!!U&&U.inkIsDark!==null&&(W?!U.inkIsDark:U.inkIsDark),Se=G&&!!v&&!x&&!W,X=D&&U?U.reversed:v,K=X?[X]:[],[se,ee]=Te(0);ke(()=>{ee(0)},[v,D]);let ve=e==="footer"?We:Be[c],H=u&&u>0?u:ve,Ee=Math.round(H*Jn),F=se<K.length?K[se]:null,[z,V]=Te(X),le=F!==null&&F===z,ue=Kt(null);ke(()=>{let E=ue.current;if(!E||!E.complete)return;if(E.naturalWidth>0||E.naturalHeight>0){V(F);return}let k=!1;return E.decode().then(()=>!k&&V(F),()=>!k&&ee(ne=>ne+1)),()=>{k=!0}},[F]);let ce=S||N,te=`calc(100cqi / ${((b.length+1)*er).toFixed(2)})`,Y=ce&&C&&C>0?Math.min(C,H):null,Pe=ce?Y===null?`min(${H}px, ${te})`:`clamp(${Y}px, ${te}, ${H}px)`:`${H}px`,we=Qe("span",{className:`font-display font-bold tracking-[0.18em] ${Y===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:Pe,lineHeight:1,...A?{color:A}:{}},"aria-label":b,children:[b,be("span",{className:"text-accent",style:A?{color:A}:void 0,children:"."})]});return Qe("span",{ref:I,className:"inline-flex items-center",children:[!le&&we,A&&F&&be("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:Qe("filter",{id:y,colorInterpolationFilters:"sRGB",children:[be("feFlood",{style:{floodColor:A}}),be("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&be("img",{ref:ue,src:F,alt:b,width:Ee,height:H,className:"shrink-0 object-contain",style:{...le?{height:`${H}px`,width:"auto",...S?{maxWidth:"100cqi"}:{}}:{display:"none"},...Se?{filter:tr}:{},...A?{filter:`url(#${y})`}:{}},onLoad:()=>V(F),onError:()=>ee(E=>E+1)},F)]})}import{jsx as Ce,jsxs as rr}from"react/jsx-runtime";function nr({spokes:e,mesh:t=!1,className:n}){let a=c=>Math.round(c*1e3)/1e3,l=[];for(let c=0;c<e;c++){let u=c/e*Math.PI*2-Math.PI/2;if(l.push({x1:a(100+Math.cos(u)*22),y1:a(100+Math.sin(u)*22),x2:a(100+Math.cos(u)*86),y2:a(100+Math.sin(u)*86),main:!0}),t){let f=u+Math.PI/e;l.push({x1:a(100+Math.cos(f)*22*1.4),y1:a(100+Math.sin(f)*22*1.4),x2:a(100+Math.cos(f)*78),y2:a(100+Math.sin(f)*78),main:!1})}}return rr("svg",{viewBox:"0 0 200 200",fill:"none",stroke:"currentColor",className:n??"block h-[70%] w-[70%] transition-transform duration-700 [transition-timing-function:cubic-bezier(.2,.6,.2,1)]",children:[Ce("circle",{cx:100,cy:100,r:92,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),Ce("circle",{cx:100,cy:100,r:22,strokeWidth:2}),Ce("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>Ce("line",{x1:c.x1,y1:c.y1,x2:c.x2,y2:c.y2,stroke:"currentColor",strokeWidth:c.main?6:3,strokeLinecap:"round",opacity:c.main?1:.5},u))]})}var di="#c9a461",zt=[{f:"black",label:"Black",hex:"#171717"},{f:"silver",label:"Silver",hex:"#cccccc"},{f:"bronze",label:"Bronze",hex:"#8a6438"},{f:"graphite",label:"Graphite",hex:"#3a3c3f"},{f:"red",label:"Candy Red",hex:"#7a0f14"}],fi={name:"",color:"var(--fg)",family:"silver",src:""};function or(e,t){let n=r=>{let o=zt.findIndex(i=>i.f===r);return o===-1?zt.length:o};return n(e)-n(t)||e.localeCompare(t)}function pi(e){let t=new Set;for(let n of e)for(let r of n.finishes??[])r?.family&&t.add(r.family);return[...t].sort(or)}import{useState as ir}from"react";import{jsx as ae,jsxs as je}from"react/jsx-runtime";function ar({customerEmail:e}){let{coupon:t,applyCoupon:n,removeCoupon:r,couponBusy:o}=$t(),[i,a]=ir("");async function l(){o||!i.trim()||(await n(i,e),a(""))}return je("div",{className:"flex flex-col gap-2",children:[t===null?je("div",{className:"flex border border-line",children:[ae("input",{type:"text",value:i,onChange:c=>a(c.target.value),onKeyDown:c=>{c.key==="Enter"&&(c.preventDefault(),l())},placeholder:"Coupon code","aria-label":"Coupon code",className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),ae("button",{type:"button",onClick:()=>{l()},disabled:o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:o?"\u2026":"Apply"})]}):je("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",t.valid?"border-accent":"border-line"].join(" "),style:t.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[ae("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",t.valid?"text-accent":t.deferred?"text-fg":"text-fg-dim line-through"].join(" "),children:t.code}),ae("button",{type:"button",onClick:r,"aria-label":`Remove coupon ${t.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),t?.deferred?ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:wt}):t&&!t.valid&&t.message&&ae("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:t.message})]})}var Ze="Ads on. Shopper can opt out.",Oe="Ads and analytics off until Accept",sr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:Ze,footerLink:"Do Not Sell or Share My Personal Information",panelEyebrow:"Do not sell or share",adsRowName:"Sale or sharing for ads"},ca:{region:"ca",name:"Canada",model:"opt-in",law:"PIPEDA, Quebec Law 25",beforeChoice:Oe,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:Ze,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:Ze,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:Oe,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function lr(e){let t=[...e.googleAds?["Google"]:[],...e.meta?["Facebook","Instagram"]:[]];return t.length<=1?t.join(""):`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xi(e,t,n){let r=lr(n),o=r?`We use cookies to count visits and to show you ${t} ads on ${r}.`:"We use cookies to count visits.";return e.model==="opt-in"?{heading:r?"Cookies and ads":"Cookies",before:`${o} Nothing loads until you choose. You can change this at any time with `,link:e.footerLink,after:" at the bottom of every page."}:{heading:r?"Cookies and ads":"Cookies",before:`${o} You can say no at any time: choose Privacy choices, or use `,link:e.footerLink,after:" at the bottom of every page."}}var Si={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on"};var ur={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var cr=ur;function wi(e=cr){if(e.asked)return e.ads?"granted":"denied"}function Ni(){let e=typeof crypto<"u"?crypto:void 0;if(typeof e?.randomUUID=="function")return e.randomUUID();let t=new Uint8Array(16);if(typeof e?.getRandomValues=="function")e.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}import{Children as fr,isValidElement as pr,useEffect as Vt,useId as mr,useLayoutEffect as jt,useRef as Q,useState as Yt}from"react";var Me=(e,t)=>!!e[t]&&!e[t].disabled;function Je(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(Me(e,i))return i}return t}function et(e,t){return Je(e,t===1?-1:e.length,t)}function tt(e,t){return Me(e,t)?t:Math.max(et(e,1),0)}function Xt(e,t,n){let{open:r,focus:o}=e,i=a=>({...e,...a});if(t.length===1&&/\S/.test(t)){let a=e.typed+t.toLowerCase(),l=n.findIndex((c,u)=>Me(n,u)&&c.label.toLowerCase().startsWith(a));return{state:i({open:!0,typed:a,focus:l>=0?l:o}),handled:!0}}if(!r)return t==="ArrowDown"||t==="ArrowUp"||t==="Enter"||t===" "?{state:i({open:!0,typed:""}),handled:!0}:{state:e,handled:!1};switch(t){case"ArrowDown":return{state:i({focus:Je(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:Je(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:et(n,1)}),handled:!0};case"End":return{state:i({focus:et(n,-1)}),handled:!0};case"Enter":case" ":return Me(n,o)?{state:i({open:!1,typed:""}),commit:o,refocus:!0,handled:!0}:{state:e,handled:!0};case"Escape":return{state:i({open:!1,typed:""}),refocus:!0,handled:!0};case"Tab":return{state:i({open:!1,typed:""}),handled:!1};default:return{state:e,handled:!1}}}import{placeMenu as gr}from"efficient-shell/ui";import{Fragment as Sr,jsx as j,jsxs as Zt}from"react/jsx-runtime";var Qt={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function hr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=Yt(!1),c=r!==void 0,u=c?r:a,[f,d]=Yt(0),S=Q({text:"",timer:0}),N=Q(null),C=Q(null),b=Q(null),P=mr(),O=Q(null),M=e.findIndex(y=>y.value===t),I=y=>{y!==u&&(c||l(y),y?o?.():i?.())},v=y=>{let w=e[y];!w||w.disabled||(n(w.value),I(!1),C.current?.focus())},x=y=>{let w={open:u,focus:u?f:tt(e,M),typed:S.current.text},m=Xt(w,y,e);return!m.handled&&m.state.open===u?!1:(m.state.typed!==w.typed&&(S.current.text=m.state.typed,window.clearTimeout(S.current.timer),S.current.timer=window.setTimeout(()=>{S.current.text=""},500)),d(m.state.focus),m.commit!==void 0?v(m.commit):I(m.state.open),m.refocus&&C.current?.focus(),m.handled)},W=Q(x);W.current=x;let A=Q(()=>I(!1));A.current=()=>I(!1);let G=y=>{u||(O.current=y.nativeEvent,W.current(y.key)&&y.preventDefault())};return Vt(()=>{if(!u)return;let y=m=>{N.current?.contains(m.target)||A.current()},w=m=>{m!==O.current&&W.current(m.key)&&m.preventDefault()};return document.addEventListener("mousedown",y),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",y),document.removeEventListener("keydown",w)}},[u]),Vt(()=>{u&&(S.current.text||d(tt(e,M)))},[u]),jt(()=>{if(!u||!b.current)return;b.current.children.item(f)?.scrollIntoView({block:"nearest"})},[f,u]),{open:u,toggle:()=>I(!u),close:()=>I(!1),focusIdx:f,setFocusIdx:d,pick:y=>v(e.findIndex(w=>w.value===y)),wrapRef:N,triggerRef:C,listRef:b,listId:P,onTriggerKeyDown:G,activeId:u?`${P}-${f}`:void 0}}var yr={select:{list:"absolute left-0 top-full z-50 mt-1 max-h-[280px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:(e,t,n)=>["px-3 py-3 font-mono text-[13px] font-semibold uppercase tracking-[0.1em] transition-colors whitespace-nowrap",n?"cursor-not-allowed opacity-40":"cursor-pointer",e&&!n?"bg-accent text-bg":"bg-bg text-fg"].join(" ")},cell:{list:"absolute left-0 top-full z-50 mt-1 max-h-[320px] w-max min-w-full overflow-y-auto border-2 border-accent bg-bg shadow-xl",item:e=>[`cursor-pointer whitespace-nowrap px-6 py-3 font-mono ${Qt.label} font-semibold uppercase tracking-[0.1em] transition-colors`,e?"bg-accent text-bg":"bg-bg text-fg"].join(" "),pickerMarker:!0},hairline:{list:"absolute left-0 top-full z-50 max-h-[320px] w-full overflow-y-auto border border-line bg-bg shadow-[0_6px_20px_rgba(0,0,0,0.10)]",item:(e,t)=>[`flex cursor-pointer items-center justify-between gap-4 border-b border-line px-4 py-3 text-left ${Qt.body} transition-colors last:border-b-0`,t?"border-fg font-medium text-fg":e?"border-fg text-fg":"text-fg-dim"].join(" "),pickerMarker:!0},region:{list:"absolute right-0 top-full z-[200] mt-2 flex min-w-[240px] flex-col border border-line bg-surface text-fg",item:(e,t,n,r)=>["flex w-full cursor-pointer items-center gap-3 px-4 py-3 text-left transition-colors","font-mono text-[13px] uppercase tracking-[0.18em]",e?"bg-surface-2 text-fg":"",r?"":"border-b border-line",t?"text-accent":""].join(" "),itemStyle:e=>e?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"}}};function br(e,t){jt(()=>{let n=e.current,r=n?.ownerDocument.defaultView;if(!n||!r)return;let o=()=>{let i=n.style;i.top=i.bottom=i.marginTop=i.marginBottom=i.maxHeight=i.overflowY=i.translate="";let a=n.offsetParent??n.parentElement;if(!a)return;let l=a.getBoundingClientRect(),c=n.getBoundingClientRect(),u=Math.abs(c.right-l.right)<Math.abs(c.left-l.left)?"end":"start",f=gr({trigger:{left:l.left,right:l.right,top:l.top,bottom:l.bottom},menu:{width:c.width,height:c.height},bounds:{left:0,top:0,right:r.innerWidth,bottom:r.innerHeight},align:u,side:"bottom"});if(f.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let S=f.top+Math.min(c.height,f.maxHeight);i.marginBottom=`${Math.max(0,l.top-S)}px`}f.maxHeight<c.height&&(i.maxHeight=`${f.maxHeight}px`,i.overflowY="auto");let d=f.left-c.left;d&&(i.translate=`${d}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function Cr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c}){let u=yr[t],f=Q(null);return br(f,n.length),j("ul",{ref:d=>{f.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...u.pickerMarker?{"data-picker-menu":""}:{},className:u.list,children:n.map((d,S)=>{let N=d.value===r;return j("li",{id:`${e}-${S}`,role:"option","aria-selected":N,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(S),onMouseDown:C=>{C.preventDefault(),d.disabled||a(d.value)},className:u.item(S===o,N&&d.value!=="",!!d.disabled,S===n.length-1),style:u.itemStyle?.(N),children:d.meta===void 0?d.label:Zt(Sr,{children:[d.lead,j("span",{className:"flex-1 whitespace-nowrap",children:d.label}),j("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${S}`)})})}function xr({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c}){let u=fr.toArray(r).flatMap(C=>{if(!pr(C))return[];if(C.type!=="option")return[];let P=C.props,O=P.value!==void 0?String(P.value):"",M=P.children,I=typeof M=="string"||typeof M=="number"?String(M):O;return[{value:O,label:I,disabled:!!P.disabled}]}),f=e??"",d=hr({items:u,value:f,onPick:C=>t?.({target:{value:C}})}),N=u.find(C=>C.value===f)?.label??u[0]?.label??"";return Zt("div",{ref:d.wrapRef,className:"relative",children:[a&&j("input",{type:"hidden",name:a,value:f}),j("button",{ref:C=>{d.triggerRef.current=C},type:"button",disabled:n,"aria-haspopup":"listbox","aria-expanded":d.open,"aria-controls":d.open?d.listId:void 0,"aria-activedescendant":d.activeId,"aria-label":c,id:l,onClick:()=>!n&&d.toggle(),onKeyDown:C=>!n&&d.onTriggerKeyDown(C),className:`block w-full ${o??""}`,style:i,children:j("span",{className:"block w-full truncate text-left",children:N})}),d.open&&j(Cr,{id:d.listId,tone:"select",items:u,value:f,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef})]})}import{jsx as xe,jsxs as De}from"react/jsx-runtime";var vr="font-mono text-[length:var(--size-label,12px)]",Er="font-semibold uppercase tracking-[0.22em] text-fg";function Jt(e){return`${e??vr} ${Er}`}function en(){return xe("span",{className:"text-accent",children:" *"})}function Pr({children:e,required:t,labelFace:n}){return De("span",{className:Jt(n),children:[e,t?xe(en,{}):null]})}function wr({label:e,required:t,hint:n,separate:r,htmlFor:o,labelFace:i,className:a,children:l}){let c=a?`flex flex-col gap-2 ${a}`:"flex flex-col gap-2",u=n?xe("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?De("div",{className:c,children:[De("label",{htmlFor:o,className:Jt(i),children:[e,t?xe(en,{}):null]}),l,u]}):De("label",{htmlFor:o,className:c,children:[xe(Pr,{required:t,labelFace:i,children:e}),l]})}export{Wr as a,Gr as b,qr as c,ht as d,Ge as e,_r as f,Nr as g,Rr as h,Lr as i,ln as j,un as k,Ir as l,Ar as m,qe as n,Ne as o,me as p,kr as q,Re as r,yn as s,bn as t,Vr as u,Yr as v,Nt as w,Xe as x,Qr as y,jr as z,xn as A,Zr as B,Jr as C,Sn as D,eo as E,En as F,to as G,no as H,Rt as I,lo as J,uo as K,co as L,mo as M,go as N,Fr as O,vt as P,Ur as Q,Le as R,Ye as S,No as T,$t as U,Go as V,Vn as W,Ko as X,ai as Y,si as Z,nr as _,di as $,zt as aa,fi as ba,or as ca,pi as da,ar as ea,sr as fa,xi as ga,Si as ha,ur as ia,wi as ja,Ni as ka,hr as la,Cr as ma,xr as na,Pr as oa,wr as pa};
|
|
File without changes
|
|
File without changes
|