efficient-storefront-blocks 0.120.1 → 0.120.3
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 +30 -0
- package/dist/chunks/{EditorPreviewCheckout-BJXYQD6G.js → EditorPreviewCheckout-4OBHQ7YG.js} +1 -1
- package/dist/chunks/chunk-IRDJZJOH.js +1 -0
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/FilterBlock/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/filter-look-fields.d.ts +14 -0
- package/dist/editor/lib/document/blocks/commerce/filter-look-fields.js +1 -0
- package/dist/index.js +30 -30
- package/dist/render/components/CouponField.js +1 -1
- package/dist/render/components/catalog/FilterPill.d.ts +7 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/catalog/SortSelect.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +3 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpFilterButton.d.ts +7 -0
- package/dist/render/components/wheels-plp/PlpFilterButton.js +1 -0
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +1 -0
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
- package/dist/render/lib/sections/catalog-text-size.d.ts +2 -0
- package/dist/render/lib/sections/catalog-text-size.js +1 -1
- package/dist/render/lib/sections/shopper-filters.d.ts +39 -0
- package/dist/render/lib/sections/shopper-filters.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-3K5ORZAD.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as
|
|
1
|
+
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useEffect as x,useRef as f,useState as b}from"react";import{ROW_INPUT_CLASS as g}from"../lib/field-input.js";import{COUPON_DEFERRED_MESSAGE as h}from"../lib/cart/coupon-preview.js";import{useCart as v}from"./CartContext.js";function y({customerEmail:l,disabled:o=!1}){const{coupon:e,applyCoupon:s,removeCoupon:m,couponBusy:n}=v(),[a,p]=b(""),c=f(!1),u=f(null);x(()=>{!c.current||e===null||(c.current=!1,u.current?.focus())},[e]);async function d(){o||n||!a.trim()||(c.current=!0,await s(a,l),p(""))}return i("div",{className:"flex flex-col gap-2",children:[e===null?i("div",{className:"flex border border-line",children:[t("input",{type:"text",value:a,onChange:r=>p(r.target.value),onKeyDown:r=>{r.key==="Enter"&&(r.preventDefault(),d())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:o,className:`${g} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),t("button",{type:"button",onClick:()=>{d()},disabled:n||o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:n?"…":"Apply"})]}):i("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",e.valid?"border-accent":"border-line"].join(" "),style:e.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[t("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",e.valid?"text-accent":e.deferred||e.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:e.code}),e.unchecked&&t("button",{type:"button",onClick:()=>{s(e.code,l)},disabled:n||o,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:n?"…":"Try again"}),!o&&t("button",{ref:u,type:"button",onClick:m,"aria-label":`Remove coupon ${e.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"✕"})]}),e?.deferred?t("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:h}):e&&!e.valid&&e.message&&t("p",{role:"alert",className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:e.message})]})}export{y as default};
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
|
-
|
|
2
|
+
declare const PILL_PAD: {
|
|
3
|
+
readonly bar: "px-4 py-3";
|
|
4
|
+
readonly toolbar: "px-4 h-10 sf-button";
|
|
5
|
+
};
|
|
6
|
+
export declare function PillButton({ labelSize, size, label, badge, open, onToggle, controls, buttonRef, }: {
|
|
3
7
|
labelSize?: string;
|
|
8
|
+
size?: keyof typeof PILL_PAD;
|
|
4
9
|
label: React.ReactNode;
|
|
5
10
|
badge: number;
|
|
6
11
|
open: boolean;
|
|
@@ -27,3 +32,4 @@ export declare function OptButton({ active, onClick, children, role, ariaChecked
|
|
|
27
32
|
role?: "radio";
|
|
28
33
|
ariaChecked?: boolean;
|
|
29
34
|
}): React.JSX.Element;
|
|
35
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a,jsxs as E}from"react/jsx-runtime";import{useEffect as v,useId as k,useRef as x,useState as y}from"react";import{CATALOG_TEXT_SIZE as p,TOOLBAR_CONTROL_CORNER as L,TOOLBAR_CONTROL_HEIGHT as _}from"../../lib/sections/catalog-text-size.js";import{useBrowserLayoutEffect as R}from"efficient-shell/hooks";const C={bar:"px-4 py-3",toolbar:`px-4 ${_} ${L}`};function O({labelSize:r=p.labelLarge,size:i="bar",label:c,badge:e,open:n,onToggle:f,controls:m,buttonRef:o}){const s=e>0;return E("button",{ref:o,type:"button","aria-haspopup":"dialog","aria-expanded":n,"aria-controls":m,onClick:f,className:[`inline-flex items-center gap-2 whitespace-nowrap border ${C[i]} font-mono ${r} uppercase tracking-[0.2em] transition-colors`,s?"border-accent text-accent":"border-line hover:border-fg-dim"].join(" "),style:s?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"},children:[c,e>0&&a("span",{className:`px-2 ${p.badge} tracking-[0.1em] text-bg`,style:{background:"var(--accent)"},children:e}),a("span",{className:`${p.badge} opacity-65 transition-transform ${n?"rotate-180":""}`,children:"▾"})]})}function j({labelSize:r,label:i,badge:c,open:e,onToggle:n,children:f}){const m=k(),o=x(null),s=x(null),b=x(null),[h,g]=y(!1);return R(()=>{if(!e){g(!1);return}const t=b.current,l=o.current,u=t?.ownerDocument.defaultView;if(!t||!l||!u||u.getComputedStyle(l).position==="static")return;const d=t.ownerDocument.documentElement.clientWidth,w=t.getBoundingClientRect();w.width>0&&w.right>d-N&&g(!0)},[e]),v(()=>{if(!e)return;const t=o.current?.ownerDocument??document,l=d=>{d.key==="Escape"&&(n(),s.current?.focus())},u=d=>{o.current?.contains(d.target)||n()};return t.addEventListener("keydown",l),t.addEventListener("pointerdown",u),()=>{t.removeEventListener("keydown",l),t.removeEventListener("pointerdown",u)}},[e,n]),E("div",{ref:o,className:e?"relative @max-[720px]:static":"relative",children:[a(O,{labelSize:r,label:i,badge:c,open:e,onToggle:n,controls:e?m:void 0,buttonRef:s}),e&&a("div",{ref:b,id:m,className:`absolute ${h?"right-0":"left-0"} top-[calc(100%+6px)] z-[60] min-w-[280px] max-w-[calc(100vw-32px)] border border-line bg-surface p-5 shadow-[0_24px_60px_rgba(0,0,0,0.4)] @max-[720px]:inset-x-0 @max-[720px]:top-auto @max-[720px]:mt-2 @max-[720px]:min-w-0`,onClick:t=>t.stopPropagation(),children:f})]})}const N=16;function A({children:r}){return a("div",{className:`mb-3 font-mono ${p.labelSmall} uppercase tracking-[0.32em] text-fg-dim`,children:r})}function I({active:r,onClick:i,children:c,role:e,ariaChecked:n}){return a("button",{type:"button",role:e,"aria-checked":e==="radio"?n:void 0,onClick:i,className:[`border px-3 py-2 font-mono ${p.labelLarge} uppercase tracking-[0.18em] transition-colors`,r?"border-accent bg-accent text-bg":"border-line hover:border-fg-dim"].join(" "),style:r?void 0:{color:"color-mix(in oklab, currentColor 75%, transparent)"},children:c})}export{j as FilterPill,I as OptButton,A as PanelTitle,O as PillButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as x,Fragment as Y}from"react/jsx-runtime";import{useCallback as z,useMemo as I,useState as re}from"react";import{CardTemplateRows as le}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as ie}from"efficient-web-builder/format/lib/content/card-template";import{useCurrency as oe}from"../CurrencyContext.js";import{useEnglish as se}from"../EnglishVariant.js";import U from"./PriceRange.js";import ce from"./SortSelect.js";import{DEFAULT_CATALOG_FILTER_LABELS as A}from"../../lib/content/catalog-filter-labels.js";import{itemKind as X,plpKindNoun as ae}from"../../lib/catalog/plp-item.js";import{itemLugs as pe,lugFilterLabel as ue}from"../../lib/wheels/lug-count.js";import{CATALOG_TEXT_SIZE as D}from"../../lib/sections/catalog-text-size.js";import{buildPlpFacets as me,itemMatchesPlp as de,plpInStockCount as fe,plpPriceBounds as ge,plpSortKeysFor as he,PLP_ONE_VALUE_MAX as be,PLP_SORT_LABELS as Se}from"../../lib/wheels/plp-filters.js";import{FILTER_IN_STOCK_KEY as xe,FILTER_PRICE_KEY as O,filterGroupItems as ye}from"../../lib/sections/filter-option-rows.js";import we from"../wheels-plp/PlpSidebar.js";import Te from"../wheels-plp/PlpFilterButton.js";import{FILTER_BLOCK_TYPE as V}from"../../lib/document/document-nodes.js";import{FilterPill as Me}from"./FilterPill.js";import{useShopperFilter as _e}from"./ShopperScope.js";import{HideTaker as ke}from"efficient-web-builder/render/components/ViewHideRoot";const Z="lugs";function Le({owner:i,look:e,lookPhone:s,shown:o,showSort:m,openingSort:c,filtersBelow:t,fieldUsage:u,firstRows:L,editing:a}){const{currency:h}=oe(),y=se(),{ref:E,scope:f}=_e({filtersBelow:t,openingSort:c}),{state:p}=f,g=f.live?f.rows:L??f.rows,b=I(()=>[...new Set(g.map(X))],[g]),C=I(()=>{const l=me(g,p,h,b,u??[],"pass").filter(r=>r.key!=="collections"||o.includes("category"));if(o.includes("lugs")){const r=Ee(g,p,h);r&&l.push(r)}return l.map(r=>({...r,label:y(r.label)}))},[g,p,h,b,u,o,y]),w=o.includes("price")?ge(g,h):null,F=o.includes("inStock")&&g.length>0?fe(g,p,h):null,J=he(b.length?b:["alloy-wheel"]),M=f.update,S=z(l=>M({...l,page:1}),[M]),N=z((l,r)=>M(d=>{if(l===Z){const T=Number(r),te=(d.lugs??[]).includes(T);return{...d,page:1,lugs:te?(d.lugs??[]).filter(ne=>ne!==T):[...d.lugs??[],T]}}const v=d[l].map(String),H=v.includes(r)?v.filter(T=>T!==r):[...v,r];return{...d,page:1,[l]:l==="diameters"?H.map(Number):H}}),[M]),P=m&&!f.sortInChips,Q=I(()=>{const l=ye(C,p,F).map(r=>({...r,options:r.options.map(d=>({...d,press:r.key===xe?()=>S({inStockOnly:!p.inStockOnly}):()=>N(r.key,d.value)}))}));return w?[...l,{key:O,label:A.price,options:[]}]:l},[C,p,F,w,S,N]),_={owner:i,items:Q,state:p,sorts:J,showSort:P,set:S,bounds:w},W=l=>S({priceMin:l}),ee=l=>S({priceMax:l}),R=l=>n(we,{facets:C,filters:p,noun:ae(b.length?b:["alloy-wheel"]),inStockCount:F,onToggle:N,onInStockOnly:r=>S({inStockOnly:r}),onClearAll:f.clear,price:w?{label:A.price,control:n(U,{bounds:w,min:p.priceMin,max:p.priceMax,onMin:W,onMax:ee})}:void 0,foot:l,owner:{id:i.id,facetTemplate:i.facetTemplate,railTemplate:i.railTemplate,railHeadTemplate:i.railHeadTemplate,type:V},editing:a}),B=R(P?n(k,{..._}):void 0),G=x("div",{className:"flex items-center justify-between gap-4",children:[n(Te,{filters:p,editing:a,children:R(void 0)}),P&&n(k,{..._})]}),K=e==="rail"?B:e==="button"?G:n(q,{..._,columns:e==="bar-columns"}),j=s===e||s==="bar"&&(e==="bar-pills"||e==="bar-columns")?null:s==="button"?G:s==="rail"?B:n(q,{..._,columns:!1});return x(ke,{as:"div",ref:E,"data-shopper-filters":"",className:"w-full",children:[j?x(Y,{children:[n("div",{className:"max-view-wide:hidden",children:K}),n("div",{className:"view-wide:hidden",children:j})]}):K,a&&f.grids===0&&n("p",{className:`mt-2 font-mono ${D.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:"Filters a Product Grid in this Box"})]})}function Ee(i,e,s){const o=new Map,m=new Set;for(const t of i){const u=X(t)==="alloy-wheel"?pe(t):null;u!==null&&(m.add(u),de(t,e,s,"lugs","pass")&&o.set(u,(o.get(u)??0)+1))}if(m.size<=be)return null;const c=e.lugs??[];return{key:Z,label:A.lugs,options:[...m].sort((t,u)=>t-u).map(t=>({value:String(t),label:ue(t),count:o.get(t)??0,checked:c.includes(t),swatch:null}))}}function k({state:i,sorts:e,set:s}){return n(ce,{value:i.sort,keys:e,labels:Se,onChange:o=>s({sort:o})})}function Ce(i,e){return i.key===O?(e.priceMin!=null?1:0)+(e.priceMax!=null?1:0):i.options.filter(s=>s.state.selected).length}function $({owner:i,items:e,state:s,set:o,bounds:m,wrap:c}){const t=a=>o({priceMin:a}),u=a=>o({priceMax:a}),L=(a,h)=>{const y=e[h.index],E=y.key===O?x(Y,{children:[a,n(U,{bounds:m,min:s.priceMin,max:s.priceMax,onMin:t,onMax:u})]}):a;return c(E,y)};return n(le,{ownerId:i.id,ownerType:V,Template:i.template,rows:e.map(ie),items:e,fallback:null,wrapCopy:L,children:a=>a})}function q({columns:i,...e}){const[s,o]=re(null),m=c=>()=>o(t=>t===c?null:c);return i?x("div",{className:"flex flex-col gap-4",children:[n("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-6 border-y border-line py-4",children:n($,{...e,wrap:(c,t)=>n("div",{children:c},t.key)})}),e.showSort&&n("div",{className:"flex flex-wrap items-center justify-end gap-4",children:n(k,{...e})})]}):x("div",{className:"relative flex flex-wrap items-center gap-2 @container",children:[n($,{...e,wrap:(c,t)=>n(Me,{labelSize:D.labelSmall,name:t.key,label:t.label,badge:Ce(t,e.state),open:s===t.key,onToggle:m(t.key),children:c},t.key)}),e.showSort&&n("div",{className:"ml-auto",children:n(k,{...e})})]})}export{Le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as c}from"react/jsx-runtime";import i from"../ThemedSelect.js";import{CATALOG_TEXT_SIZE as n}from"../../lib/sections/catalog-text-size.js";const
|
|
1
|
+
"use client";import{jsx as r,jsxs as c}from"react/jsx-runtime";import i from"../ThemedSelect.js";import{CATALOG_TEXT_SIZE as n,TOOLBAR_CONTROL_CORNER as m,TOOLBAR_CONTROL_HEIGHT as b}from"../../lib/sections/catalog-text-size.js";const g={toolbar:`cursor-pointer border border-line bg-transparent px-2 ${b} ${m} font-mono text-[12px] normal-case tracking-normal text-fg`,line:`border-b border-line bg-transparent pb-2 font-mono ${n.labelLarge} uppercase tracking-[0.2em] text-fg`,box:`border border-line bg-transparent px-4 py-3 font-mono ${n.labelLarge} uppercase tracking-[0.2em] text-fg`};function x({value:o,keys:l,labels:s,onChange:p,look:t="toolbar"}){const a=r(i,{"aria-label":"Sort results",align:"end",value:o,onChange:e=>p(e.target.value),className:g[t],children:l.map(e=>r("option",{value:e,children:s[e]},e))});return t!=="toolbar"?a:c("label",{className:"flex items-center gap-2 font-mono text-[11px] uppercase tracking-[0.16em] text-fg-dim",children:[r("span",{className:"whitespace-nowrap",children:"Sort by"}),a]})}export{x as default};
|
|
@@ -5,6 +5,8 @@ import type { ProductSummary, WheelSummary } from "../../lib/api/index.js";
|
|
|
5
5
|
import { type PlpColumns } from "../../lib/wheels/plp-grid.js";
|
|
6
6
|
import { type PlpFacetKey, type PlpSortKey } from "../../lib/wheels/plp-filters.js";
|
|
7
7
|
export interface AlloyWheelsListingProps {
|
|
8
|
+
filterLook?: unknown;
|
|
9
|
+
filterLookPhone?: unknown;
|
|
8
10
|
cellLook?: unknown;
|
|
9
11
|
titleLevel?: number;
|
|
10
12
|
heading?: string;
|
|
@@ -36,4 +38,4 @@ export declare const PLP_GATE_DEFAULTS: {
|
|
|
36
38
|
readonly heading: "Let's find wheels that fit your car.";
|
|
37
39
|
readonly intro: "Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you.";
|
|
38
40
|
};
|
|
39
|
-
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, addressQuery, editing, ownerId, template, facetTemplate, railTemplate, railHeadTemplate, hover, titleLevel, omitHead, cellLook, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
41
|
+
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, products, wheels, addressQuery, editing, ownerId, template, facetTemplate, railTemplate, railHeadTemplate, hover, titleLevel, omitHead, cellLook, filterLook, filterLookPhone, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as c,Fragment as Xe}from"react/jsx-runtime";import{useScopeClass as Ze}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as et,useMemo as i,useRef as tt,useState as ot}from"react";import{cardHoverOf as rt}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as nt}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as st}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as it,answersForKind as le}from"../../lib/content/field-usage.js";import{useCurrency as lt}from"../CurrencyContext.js";import ct from"../NoCurrencyNote.js";import{usePreviewDevice as at}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as pt,renderHeadline as mt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as dt}from"../useProductCatalog.js";import{scrollBehavior as ut}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as ht,PLP_GRID_GAP_VAR as ce,plpGridVars as ft}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as gt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as yt,cardRowsGridStyle as St}from"../WheelCardFrame.js";import{applyPlpFilters as xt,buildPlpFacets as bt,buildPlpTypeOptions as wt,buildTyreSizeBoxes as kt,EMPTY_PLP_FILTERS as ae,hasActivePlpFilters as vt,paginatePlp as Pt,pickTyreSize as Nt,plpTyreSizeBoxesShown as Ct,plpInStockCount as Tt,plpOpeningSort as _t,plpPriceBounds as At,plpShownKinds as Lt,plpSortKeysFor as zt,PLP_SORT_LABELS as Ot}from"../../lib/wheels/plp-filters.js";import{itemKind as L,itemSlug as It,itemTyreSizes as Mt,plpBrandVaries as Ft,plpProcessVaries as Gt,plpItemsOfKinds as Rt,plpKindNoun as pe,resolvePlpKinds as Vt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Et,plpVehicleCopy as jt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Kt,oemTyreSizes as Bt}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as Dt}from"../../lib/wheels/plp-fitment-match.js";import Wt from"./PlpActiveChips.js";import{GridCardProvider as $t,GridMixedCards as Ht,gridIndexCss as Yt,LISTING_CARD_RULES as qt}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as Jt}from"../ProductCardEyebrow.js";import Qt from"./PlpPagination.js";import Ut from"./PlpSidebar.js";import{PlpResultRange as Xt,PlpToolbar as Zt}from"./PlpToolbar.js";import eo from"../catalog/SortSelect.js";import to from"./PlpVehicleBar.js";import oo from"./PlpVehicleGate.js";import{useVehicleCatalog as ro}from"./useVehicleCatalog.js";import{useVehicleFit as no}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as so}from"./usePlpFiltersInUrl.js";import{say as V}from"efficient-web-builder/format/lib/editor-words";import{ALLOY_WHEELS_LISTING_TYPE as me}from"../../lib/document/document-nodes.js";const $o={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function io({level:k,className:v,children:P}){const z=nt(k);return o(z,{className:v,children:P})}const lo=rt({},me);function co({heading:k="",intro:v="",askForCar:P=!0,gateHeading:z="",gateIntro:de="",perPage:E=24,columns:ue,defaultSort:he="recommended",hiddenFacets:fe=[],fieldUsage:f=it,showPrice:j=!0,showInStock:ge=!0,kinds:ye,products:Se,wheels:xe,addressQuery:be,editing:d=!1,ownerId:K="",template:we,facetTemplate:ke,railTemplate:ve,railHeadTemplate:Pe,hover:Ne=lo,titleLevel:Ce,omitHead:B=!1,cellLook:D}){const{currency:a}=lt(),u=Vt(ye),W=at(),$=ht(ue),Te=ft($,d?W:null),_e=gt($,d?W:null),H=Ze("plp"),Ae=Yt(H),Le=dt(),Y=Se??xe??Le??[],q=i(()=>Rt(Y,u),[Y,u.join(",")]),r=no({editing:d,enabled:P,autoApply:!0}),[ze,O]=ot(!1),Oe=_t(he,u),g=r.applied?.vehicle??null,[e,x]=so({editing:d,openingSort:Oe,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:be}),p=Lt(u,e.kind),n=m(t=>x(t),[x]),J=m((t,h)=>{const l=e[t],Qe=l.map(String).includes(h)?l.filter(Ue=>String(Ue)!==h):[...l,t==="diameters"?Number(h):h];n({...e,[t]:Qe,page:1})},[e,n]),Q=m(t=>n({...e,priceMin:t,page:1}),[e,n]),U=m(t=>n({...e,priceMax:t,page:1}),[e,n]),X=m(t=>n({...e,inStockOnly:t,page:1}),[e,n]),Z=m(t=>n({...ae,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),Ie=m(t=>n({...e,sort:t,page:1}),[e,n]),Me=m(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:ut()})},[e,n]),ee=m(()=>n({...ae,sort:e.sort}),[e.sort,n]),{clear:C}=r,te=m(()=>{C(),O(!0),x(t=>({...t,page:1}))},[C]),Fe=m(()=>{C(),O(!1),x(t=>({...t,page:1}))},[C]),T=g?[g.make,g.model,g.year,g.modification].join("|"):"",_=tt(null);et(()=>{if(r.restored){if(_.current===null){_.current=T;return}_.current!==T&&(_.current=T,x(t=>t.page===1?t:{...t,page:1}))}},[r.restored,T,x]);const{items:A,failed:oe,retry:Ge}=ro({catalog:q,shownKinds:u,vehicle:g,editing:d}),s=i(()=>{if(!r.fit)return A;const t=A.filter(l=>L(l)==="alloy-wheel"),h=new Set(Dt(t,r.fit).map(l=>l.slug));return A.filter(l=>L(l)!=="alloy-wheel"||h.has(It(l)))},[A,r.fit]),b=fe.join(","),Re=i(()=>{const t=new Set(b?b.split(","):[]);return bt(s,e,a,p,f).filter(h=>!t.has(h.key))},[s,e,a,b,p.join(","),f]),y=i(()=>xt(s,e,a),[s,e,a]),Ve=p.length>1,re=i(()=>le(f,"alloy-wheel"),[f]),Ee=i(()=>le(f,"tyre"),[f]),I=i(()=>Ft(y),[y]),M=i(()=>Gt(y),[y]),F=Ve?pe(["alloy-wheel"]).one:null,je=i(()=>({kindLabel:F,brand:I,process:M}),[F,I,M]),Ke=Jt({kind:!!F,brand:I,process:M},re),Be=i(()=>j?At(s,a):null,[s,a,j]),De=i(()=>Tt(s,e,a),[s,e,a]),We=i(()=>wt(s,u,e,a),[s,u.join(","),e,a]),$e=m((t,h)=>{const l=Nt(s.flatMap(Mt),e.tyreSizes[0]??"",t,h);n({...e,tyreSizes:l?[l]:[],page:1})},[s,e,n]),He=i(()=>{const t=new Set(b?b.split(","):[]);return!Ct(s,p)||t.has("tyreSizes")?null:kt(s,e,a)},[s,e,a,b,p.join(","),f]),S=i(()=>Pt(y,e.page,E),[y,e.page,E]),w=pe(p),G=jt(p),ne=Et(z,de,p,u),se=p.length===1&&p[0]==="tyre",ie=r.applied?.stock??null,N=i(()=>Bt(ie),[ie]),Ye=i(()=>s.filter(t=>p.includes(L(t))).length,[s,p.join(",")]),R=q.length===0,qe=!R&&s.length===0,Je=P&&!d&&!r.applied&&!ze;return u.length===0?null:c("section",{children:[P&&o(to,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:se&&N.length>0?`Takes ${N.join(" · ")}`:null,resolving:r.resolving,unresolved:se?!!r.applied&&!r.resolving&&N.length===0:r.unresolved,matchCount:Ye,copy:G,onAmend:Fe,onClear:te,cellLook:D}),Je&&o(oo,{cascade:r.cascade,heading:ne.heading,intro:ne.intro,ready:r.restored,copy:G,onSkip:()=>O(!0),cellLook:D}),c("div",{className:B?void 0:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[!B&&(k||v)&&c("header",{className:"mb-6",children:[k&&o(io,{level:Ce,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:mt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:pt(v)})]}),c("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[o(Ut,{facets:Re,filters:e,typeOptions:We,sizeBoxes:He,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:w,priceBounds:Be,inStockCount:ge?De:null,onToggle:J,onPickType:Z,onPickSize:$e,onPriceMin:Q,onPriceMax:U,onInStockOnly:X,onClearAll:ee,owner:{id:K,facetTemplate:ke,railTemplate:ve,railHeadTemplate:Pe},editing:d}),c("div",{className:"min-w-0 flex-1",children:[o(Zt,{className:"mb-4",start:c(Xe,{children:[o(Xt,{total:S.total,range:{from:S.from,to:S.to},noun:w}),o(Wt,{filters:e,onToggle:J,onPriceMin:Q,onPriceMax:U,onInStockOnly:X,onPickType:Z})]}),end:o(eo,{value:e.sort,keys:zt(u),labels:Ot,onChange:Ie})}),oe&&!R&&c("div",{role:"status",className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 border border-line px-4 py-3",children:[o("p",{className:"text-[14px] text-fg-dim",children:"We couldn't check your car just now — try again."}),o("button",{type:"button",onClick:Ge,className:"cursor-pointer bg-btn px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Try again"})]}),R?o("div",{className:"border border-dashed border-line p-10",children:o("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:d?w.many==="wheels"?V("No wheels in this website's catalog yet — curate products to see them here."):w.many==="tyres"?V("No tyres in this website's catalog yet — curate products to see them here."):V("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):qe?oe?null:c("div",{className:"border border-line p-10",children:[c("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",r.appliedName]}),o("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:G.nothingFits}),c("button",{type:"button",onClick:te,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",w.many]})]}):S.total===0?c("div",{className:"border border-line p-10",children:[c("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",w.many," match those filters"]}),o("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),vt(e)&&o("button",{type:"button",onClick:ee,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):c($t,{value:{ownerId:K,ownerType:me,Template:we,hover:Ne,imageSizes:_e,fieldUsage:re,tyreFieldUsage:Ee,reserveEyebrow:Ke,editing:d,eyebrow:je,fit:r.fit,colours:e.finishes,setGridGap:`var(${ce})`,rules:qt},children:[o("style",{children:Ae}),o("div",{className:`plp-card-grid ${H} ${yt} ${st}`,style:{...Te,...St(`var(${ce})`)},children:o(Ht,{items:S.items,tyreOf:t=>L(t)==="tyre"?t:null,tyreFit:t=>N.length>0?Kt(t.sizes,N):null})})]}),o(Qt,{page:S.page,pageCount:S.pageCount,onPage:Me}),o(ct,{editing:d})]})]})]})]})}export{$o as PLP_GATE_DEFAULTS,co as default};
|
|
1
|
+
"use client";import{jsx as o,jsxs as l,Fragment as ae}from"react/jsx-runtime";import{useScopeClass as rt}from"../../lib/use-scope-class.js";import{useCallback as d,useEffect as nt,useMemo as s,useRef as it,useState as st}from"react";import{cardHoverOf as lt}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as ct}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as at}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as pt,answersForKind as pe}from"../../lib/content/field-usage.js";import{useCurrency as dt}from"../CurrencyContext.js";import mt from"../NoCurrencyNote.js";import{usePreviewDevice as ut}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as ht,renderHeadline as ft}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as gt}from"../useProductCatalog.js";import{scrollBehavior as yt}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as St,PLP_GRID_GAP_VAR as de,plpGridVars as xt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as bt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as wt,cardRowsGridStyle as vt}from"../WheelCardFrame.js";import{applyPlpFilters as kt,buildPlpFacets as Pt,buildPlpTypeOptions as Nt,buildTyreSizeBoxes as Ct,EMPTY_PLP_FILTERS as me,hasActivePlpFilters as Tt,paginatePlp as _t,pickTyreSize as At,plpTyreSizeBoxesShown as Lt,plpInStockCount as zt,plpOpeningSort as Ft,plpPriceBounds as Ot,plpShownKinds as Vt,plpSortKeysFor as It,PLP_SORT_LABELS as Mt}from"../../lib/wheels/plp-filters.js";import{itemKind as z,itemSlug as Gt,itemTyreSizes as Rt,plpBrandVaries as Et,plpProcessVaries as jt,plpItemsOfKinds as Bt,plpKindNoun as ue,resolvePlpKinds as Kt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Dt,plpVehicleCopy as Wt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as $t,oemTyreSizes as Ht}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as Yt}from"../../lib/wheels/plp-fitment-match.js";import qt from"./PlpActiveChips.js";import{GridCardProvider as Jt,GridMixedCards as Qt,gridIndexCss as Ut,LISTING_CARD_RULES as Xt}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as Zt}from"../ProductCardEyebrow.js";import eo from"./PlpPagination.js";import to from"./PlpSidebar.js";import oo from"./PlpFilterButton.js";import{plpFilterViews as ro}from"../../lib/sections/shopper-filters.js";import{PlpResultRange as no,PlpToolbar as io}from"./PlpToolbar.js";import so from"../catalog/SortSelect.js";import lo from"./PlpVehicleBar.js";import co from"./PlpVehicleGate.js";import{useVehicleCatalog as ao}from"./useVehicleCatalog.js";import{useVehicleFit as po}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as mo}from"./usePlpFiltersInUrl.js";import{say as j}from"efficient-web-builder/format/lib/editor-words";import{ALLOY_WHEELS_LISTING_TYPE as he}from"../../lib/document/document-nodes.js";const Zo={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function uo({level:v,className:k,children:P}){const F=ct(v);return o(F,{className:k,children:P})}const ho=lt({},he);function fo({heading:v="",intro:k="",askForCar:P=!0,gateHeading:F="",gateIntro:fe="",perPage:B=24,columns:ge,defaultSort:ye="recommended",hiddenFacets:Se=[],fieldUsage:f=pt,showPrice:K=!0,showInStock:xe=!0,kinds:be,products:we,wheels:ve,addressQuery:ke,editing:m=!1,ownerId:D="",template:Pe,facetTemplate:Ne,railTemplate:Ce,railHeadTemplate:Te,hover:_e=ho,titleLevel:Ae,omitHead:W=!1,cellLook:$,filterLook:Le,filterLookPhone:ze}){const{currency:a}=dt(),u=Kt(be),H=ut(),Y=St(ge),Fe=xt(Y,m?H:null),Oe=bt(Y,m?H:null),q=rt("plp"),Ve=Ut(q),Ie=gt(),J=we??ve??Ie??[],Q=s(()=>Bt(J,u),[J,u.join(",")]),r=po({editing:m,enabled:P,autoApply:!0}),[Me,O]=st(!1),Ge=Ft(ye,u),g=r.applied?.vehicle??null,[e,x]=mo({editing:m,openingSort:Ge,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:ke}),p=Vt(u,e.kind),n=d(t=>x(t),[x]),U=d((t,h)=>{const c=e[t],tt=c.map(String).includes(h)?c.filter(ot=>String(ot)!==h):[...c,t==="diameters"?Number(h):h];n({...e,[t]:tt,page:1})},[e,n]),X=d(t=>n({...e,priceMin:t,page:1}),[e,n]),Z=d(t=>n({...e,priceMax:t,page:1}),[e,n]),ee=d(t=>n({...e,inStockOnly:t,page:1}),[e,n]),te=d(t=>n({...me,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),Re=d(t=>n({...e,sort:t,page:1}),[e,n]),Ee=d(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:yt()})},[e,n]),oe=d(()=>n({...me,sort:e.sort}),[e.sort,n]),{clear:T}=r,re=d(()=>{T(),O(!0),x(t=>({...t,page:1}))},[T]),je=d(()=>{T(),O(!1),x(t=>({...t,page:1}))},[T]),_=g?[g.make,g.model,g.year,g.modification].join("|"):"",A=it(null);nt(()=>{if(r.restored){if(A.current===null){A.current=_;return}A.current!==_&&(A.current=_,x(t=>t.page===1?t:{...t,page:1}))}},[r.restored,_,x]);const{items:L,failed:ne,retry:Be}=ao({catalog:Q,shownKinds:u,vehicle:g,editing:m}),i=s(()=>{if(!r.fit)return L;const t=L.filter(c=>z(c)==="alloy-wheel"),h=new Set(Yt(t,r.fit).map(c=>c.slug));return L.filter(c=>z(c)!=="alloy-wheel"||h.has(Gt(c)))},[L,r.fit]),b=Se.join(","),Ke=s(()=>{const t=new Set(b?b.split(","):[]);return Pt(i,e,a,p,f).filter(h=>!t.has(h.key))},[i,e,a,b,p.join(","),f]),y=s(()=>kt(i,e,a),[i,e,a]),De=p.length>1,ie=s(()=>pe(f,"alloy-wheel"),[f]),We=s(()=>pe(f,"tyre"),[f]),V=s(()=>Et(y),[y]),I=s(()=>jt(y),[y]),M=De?ue(["alloy-wheel"]).one:null,$e=s(()=>({kindLabel:M,brand:V,process:I}),[M,V,I]),He=Zt({kind:!!M,brand:V,process:I},ie),Ye=s(()=>K?Ot(i,a):null,[i,a,K]),qe=s(()=>zt(i,e,a),[i,e,a]),Je=s(()=>Nt(i,u,e,a),[i,u.join(","),e,a]),Qe=d((t,h)=>{const c=At(i.flatMap(Rt),e.tyreSizes[0]??"",t,h);n({...e,tyreSizes:c?[c]:[],page:1})},[i,e,n]),Ue=s(()=>{const t=new Set(b?b.split(","):[]);return!Lt(i,p)||t.has("tyreSizes")?null:Ct(i,e,a)},[i,e,a,b,p.join(","),f]),S=s(()=>_t(y,e.page,B),[y,e.page,B]),w=ue(p),G=Wt(p),se=Dt(F,fe,p,u),le=p.length===1&&p[0]==="tyre",ce=r.applied?.stock??null,N=s(()=>Ht(ce),[ce]),Xe=s(()=>i.filter(t=>p.includes(z(t))).length,[i,p.join(",")]),R=Q.length===0,Ze=!R&&i.length===0,et=P&&!m&&!r.applied&&!Me;if(u.length===0)return null;const E=o(to,{facets:Ke,filters:e,typeOptions:Je,sizeBoxes:Ue,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:w,priceBounds:Ye,inStockCount:xe?qe:null,onToggle:U,onPickType:te,onPickSize:Qe,onPriceMin:X,onPriceMax:Z,onInStockOnly:ee,onClearAll:oe,owner:{id:D,facetTemplate:Ne,railTemplate:Ce,railHeadTemplate:Te},editing:m}),C=ro(Le,ze);return l("section",{children:[P&&o(lo,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:le&&N.length>0?`Takes ${N.join(" · ")}`:null,resolving:r.resolving,unresolved:le?!!r.applied&&!r.resolving&&N.length===0:r.unresolved,matchCount:Xe,copy:G,onAmend:je,onClear:re,cellLook:$}),et&&o(co,{cascade:r.cascade,heading:se.heading,intro:se.intro,ready:r.restored,copy:G,onSkip:()=>O(!0),cellLook:$}),l("div",{className:W?void 0:"px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]",children:[!W&&(v||k)&&l("header",{className:"mb-6",children:[v&&o(uo,{level:Ae,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:ft(v,!1)}),k&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:ht(k)})]}),l("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[C.rail===""?E:C.rail!==null&&o("div",{className:C.rail,children:E}),l("div",{className:"min-w-0 flex-1",children:[o(io,{className:"mb-4",start:l(ae,{children:[o(no,{total:S.total,range:{from:S.from,to:S.to},noun:w}),o(qt,{filters:e,onToggle:U,onPriceMin:X,onPriceMax:Z,onInStockOnly:ee,onPickType:te})]}),end:l(ae,{children:[C.button!==null&&o("div",{className:C.button||void 0,children:o(oo,{filters:e,editing:m,children:E})}),o(so,{value:e.sort,keys:It(u),labels:Mt,onChange:Re})]})}),ne&&!R&&l("div",{role:"status",className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 border border-line px-4 py-3",children:[o("p",{className:"text-[14px] text-fg-dim",children:"We couldn't check your car just now — try again."}),o("button",{type:"button",onClick:Be,className:"cursor-pointer bg-btn px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Try again"})]}),R?o("div",{className:"border border-dashed border-line p-10",children:o("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:m?w.many==="wheels"?j("No wheels in this website's catalog yet — curate products to see them here."):w.many==="tyres"?j("No tyres in this website's catalog yet — curate products to see them here."):j("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):Ze?ne?null:l("div",{className:"border border-line p-10",children:[l("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",r.appliedName]}),o("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:G.nothingFits}),l("button",{type:"button",onClick:re,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",w.many]})]}):S.total===0?l("div",{className:"border border-line p-10",children:[l("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",w.many," match those filters"]}),o("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),Tt(e)&&o("button",{type:"button",onClick:oe,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):l(Jt,{value:{ownerId:D,ownerType:he,Template:Pe,hover:_e,imageSizes:Oe,fieldUsage:ie,tyreFieldUsage:We,reserveEyebrow:He,editing:m,eyebrow:$e,fit:r.fit,colours:e.finishes,setGridGap:`var(${de})`,rules:Xt},children:[o("style",{children:Ve}),o("div",{className:`plp-card-grid ${q} ${wt} ${at}`,style:{...Fe,...vt(`var(${de})`)},children:o(Qt,{items:S.items,tyreOf:t=>z(t)==="tyre"?t:null,tyreFit:t=>N.length>0?$t(t.sizes,N):null})})]}),o(eo,{page:S.page,pageCount:S.pageCount,onPage:Ee}),o(mt,{editing:m})]})]})]})]})}export{Zo as PLP_GATE_DEFAULTS,fo as default};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type PlpFilterState } from "../../lib/wheels/plp-filters.js";
|
|
3
|
+
export default function PlpFilterButton({ filters, editing, children }: {
|
|
4
|
+
filters: PlpFilterState;
|
|
5
|
+
editing?: boolean;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as e,jsxs as n,Fragment as g}from"react/jsx-runtime";import{useRef as h,useState as _}from"react";import{POPUP_LOOK_DEFAULTS as b}from"efficient-web-builder/format/lib/popup/look";import{PillButton as x}from"../catalog/FilterPill.js";import{CATALOG_TEXT_SIZE as s}from"../../lib/sections/catalog-text-size.js";import P from"../PopupFrame.js";import{PLP_RAIL_WIDTH as T}from"./PlpSidebar.js";import{UTIL_WORDS as L}from"../HeaderTools.js";import{useCurrency as S}from"../CurrencyContext.js";import{formatPrice as A}from"../../lib/commerce.js";import{plpActiveChips as E}from"../../lib/wheels/plp-filters.js";const i="Filters",F=32,O=T+2*F;function R({filters:a,editing:m=!1,children:c}){const[o,t]=_(!1),{currency:f}=S(),l=h(null),r=()=>t(!1),p=E(a,f,A).length,u={...b,placement:"left",height:"full",closeButton:"none",width:O};return n(g,{children:[e(x,{labelSize:s.labelSmall,size:"toolbar",label:i,badge:p,open:o,onToggle:()=>t(d=>!d)}),o&&e(P,{look:u,drawer:{closeRef:l,lockScroll:!m},open:!0,onClose:r,label:i,children:n("div",{"data-plp-filter-panel":"",className:"flex h-full flex-col overflow-y-auto bg-bg px-8 pb-8 text-fg lg:[&_aside]:static lg:[&_aside]:max-h-none",children:[e("div",{className:"relative z-10 -mb-4 flex shrink-0 justify-end",children:e("button",{ref:l,type:"button",onClick:r,className:`inline-flex h-11 items-center font-mono ${s.labelSmall} uppercase tracking-[0.2em] text-fg-dim hover:text-fg`,children:L.close})}),c]})})]})}export{R as default};
|
|
@@ -3,6 +3,7 @@ import type { ProductKind } from "../../lib/api/index.js";
|
|
|
3
3
|
import type { TyreSizePart } from "../../lib/tyres/tyre-size.js";
|
|
4
4
|
import { type PlpFacetGroup, type PlpFacetKey, type PlpFilterState, type PlpTypeOption, type PlpTyreSizeBox } from "../../lib/wheels/plp-filters.js";
|
|
5
5
|
import { type RailOwner } from "./PlpFacetRows.js";
|
|
6
|
+
export declare const PLP_RAIL_WIDTH = 292;
|
|
6
7
|
export default function PlpSidebar<K extends string = PlpFacetKey>({ facets, filters, typeOptions, sizeBoxes, sizeMatches, noun, priceBounds, inStockCount, onToggle, onPickType, onPickSize, onPriceMin, onPriceMax, onInStockOnly, onClearAll, price, foot, owner, editing, }: {
|
|
7
8
|
facets: (Omit<PlpFacetGroup, "key"> & {
|
|
8
9
|
key: K;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as p}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as r,jsxs as p}from"react/jsx-runtime";import S from"../catalog/ClearAllButton.js";import{Fragment as k}from"react";import{AccordionRowStyleContext as C,BoxTabPaneContext as O}from"efficient-web-builder/render/components/BoxTabPaneContext";import{CardTemplateRows as u}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as _}from"efficient-web-builder/render/components/SiteGutterFrame";import D from"../catalog/PriceRange.js";import{useEnglish as M}from"../EnglishVariant.js";import{facetRow as H}from"../../lib/content/facet-row-seed.js";import{RAIL_END_PART as $,RAIL_HEAD_TEMPLATE_SLOT as j,RAIL_OPTIONS_PART as F,RAIL_TEMPLATE_SLOT as W,railRow as B}from"../../lib/content/rail-row-seed.js";import{optionCardRows as z}from"../../lib/sections/filter-option-rows.js";import{hasActivePlpFilters as G,isDeadPlpOption as v,PLP_FACET_LABELS as Y}from"../../lib/wheels/plp-filters.js";import{ALLOY_WHEELS_LISTING_TYPE as V}from"../../lib/document/document-nodes.js";import q,{RAIL_OWNER_TEMPLATES as J}from"./PlpFacetRows.js";import K from"./PlpInStockToggle.js";import Q from"./PlpTypePicker.js";import U from"./PlpTyreSizeBoxes.js";const ge=292;function X({facets:w,filters:i,typeOptions:c,sizeBoxes:m,sizeMatches:A=null,noun:n,priceBounds:h,inStockCount:f,onToggle:E,onPickType:b,onPickSize:P,onPriceMin:L,onPriceMax:R,onInStockOnly:N,onClearAll:I,price:d,foot:g,owner:o,editing:x=!1}){const s=M(),T=o.type??V;if(process.env.NODE_ENV!=="production"){for(const e of J)if(!o[e])throw new Error(`PlpSidebar: the rail owner "${o.id}" has no ${e}. A page seeds it on read; a host that draws the rail alone hands it.`)}const t=[];m&&P&&t.push({word:s(Y.tyreSizes),body:r(U,{boxes:m,composed:i.tyreSizes[0]??"",matches:A,noun:n.many,onPick:P})});for(const e of w){if(e.options.length===0)continue;const a=z(e.options,{item:l=>H(l,l.checked),selected:l=>l.checked,press:l=>()=>E(e.key,l.value),label:l=>`${s(e.label)}: ${l.label} (${l.count} ${n.many})`,disabled:v});t.push({word:s(e.label),body:r(q,{owner:o,rows:a,dead:e.options.map(v),label:s(e.label),editing:x})})}return p("aside",{className:"-mx-3 w-[calc(100%+1.5rem)] flex-none px-3 lg:sticky lg:[--sf-plp-rail-gap:16px] lg:[--sf-plp-rail-top:calc(var(--sf-header-h,88px)+var(--sf-plp-rail-gap))] lg:top-[var(--sf-plp-rail-top)] lg:max-h-[calc(100svh-var(--sf-plp-rail-top)-var(--sf-plp-rail-gap))] lg:w-[292px] lg:overflow-y-auto lg:overscroll-contain lg:pr-[22px]",children:[r(_,{children:r(u,{ownerId:o.id,ownerType:T,slot:j,Template:o.railHeadTemplate,rows:Z,fallback:null,hostParts:(e,a)=>a===$&&G(i)?r(S,{onClick:I,size:"text-[11px]"}):null,children:e=>e})}),c&&c.length>0&&b&&r("div",{className:"pb-1 pt-1",children:r(Q,{options:c,noun:n.many,onPick:b,owner:o,editing:x})}),f!==null&&r("div",{className:"border-t border-line py-2",children:r(K,{checked:i.inStockOnly,count:f,noun:n.many,onChange:N})}),r(_,{children:r(u,{ownerId:o.id,ownerType:T,slot:W,Template:o.railTemplate,rows:t.map(e=>B(e.word)),fallback:null,hostParts:(e,a)=>a===F?t[e.index]?.body:null,wrapCopy:(e,a)=>r(k,{children:e},t[a.index]?.word),children:e=>r(O.Provider,{value:"accordion",children:r(C.Provider,{value:"chevron",children:e})})})}),d?p("div",{className:"border-t border-line py-3",children:[r("span",{className:y,children:d.label}),r("div",{className:"mt-3",children:d.control})]}):h&&p("div",{className:"border-t border-line py-3",children:[p("span",{className:y,children:["Price · per ",n.one]}),r("div",{className:"mt-3",children:r(D,{bounds:h,min:i.priceMin,max:i.priceMax,onMin:L,onMax:R})})]}),g&&r("div",{className:"border-t border-line py-3",children:g})]})}const y="block font-mono text-[11px] uppercase leading-4 tracking-[0.2em]",Z=[{}];export{ge as PLP_RAIL_WIDTH,X as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{FITMENT_CELL_LOOK_PROP as l}from"../../../../sections/fitment-cell-look.js";import{LISTING_FILTER_LOOK_PROP as o,parseListingFilterLook as L,parseListingFilterLookPhone as f}from"../../../../sections/shopper-filters.js";import{phoneKey as T}from"efficient-easel/draw";import{PAGE_TITLE_LEVEL_PROP as g}from"efficient-web-builder/format/lib/document/one-h1";import h from"../../../../../components/wheels-plp/AlloyWheelsListing.js";import{hidableText as r}from"efficient-easel/screen/lib/document/hidable";import{asPlpSortKey as E,listingHiddenFacets as _}from"../../../../wheels/plp-filters.js";import{addressQueryOf as P}from"../../../../wheels/selected-ranges.js";import{cardHoverOf as I}from"efficient-web-builder/format/lib/animation/hover";import{phHide as a}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{headInOwnBox as c}from"efficient-web-builder/render/lib/sections/section-to-box";import{FACET_TEMPLATE_SLOT as O}from"../../../../content/facet-row-seed.js";import{RAIL_HEAD_TEMPLATE_SLOT as s,RAIL_TEMPLATE_SLOT as A}from"../../../../content/rail-row-seed.js";import{AlloyWheelsListingMeta as S,ALLOYWHEELSLISTING_PH as n}from"./meta.js";import{ALLOY_WHEELS_LISTING_TYPE as k}from"../../../document-nodes.js";const B={...S,render:e=>{const t=c(e),i=d=>t?void 0:d;return m(h,{titleLevel:e[g],heading:i(a(e.heading,n.heading,e.editor)),intro:i(a(e.intro,n.intro,e.editor)),omitHead:t,askForCar:e.askForCar!==!1,addressQuery:P(e)||void 0,gateHeading:r(e.gateHeading),gateIntro:r(e.gateIntro),perPage:e.perPage,columns:e.columns,defaultSort:E(e.defaultSort),ownerId:typeof e.id=="string"?e.id:"",template:e.template,facetTemplate:e[O],railTemplate:e[A],railHeadTemplate:e[s],hover:I(e,k),cellLook:e[l],filterLook:L(e[o]),filterLookPhone:f(e[T(o)]),hiddenFacets:_(e),showPrice:e.showPrice,showInStock:e.showInStock!==!1,kinds:e.kinds,products:e.products,wheels:e.wheels,fieldUsage:e.fieldUsage,editing:e.editor?.isEditing})}};export{B as AlloyWheelsListingRender};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={body:"text-[length:var(--size-body,14px)]",badge:"text-[length:var(--size-body,11px)]",labelXs:"text-[length:var(--size-label,10px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]",pager:"text-[13px]"};export{e as CATALOG_TEXT_SIZE};
|
|
1
|
+
const e={body:"text-[length:var(--size-body,14px)]",badge:"text-[length:var(--size-body,11px)]",labelXs:"text-[length:var(--size-label,10px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]",labelXl:"text-[length:var(--size-label,14px)]",pager:"text-[13px]"},t="h-10",l="sf-button";export{e as CATALOG_TEXT_SIZE,l as TOOLBAR_CONTROL_CORNER,t as TOOLBAR_CONTROL_HEIGHT};
|
|
@@ -8,6 +8,9 @@ export declare const FILTER_LOOK_OPTIONS: readonly [{
|
|
|
8
8
|
}, {
|
|
9
9
|
readonly value: "rail";
|
|
10
10
|
readonly label: "Side rail";
|
|
11
|
+
}, {
|
|
12
|
+
readonly value: "button";
|
|
13
|
+
readonly label: "Filters button";
|
|
11
14
|
}];
|
|
12
15
|
export type FilterLook = (typeof FILTER_LOOK_OPTIONS)[number]["value"];
|
|
13
16
|
export declare const DEFAULT_FILTER_LOOK: FilterLook;
|
|
@@ -41,5 +44,41 @@ export declare const DEFAULT_SHOWN_FILTERS: readonly ShownFilter[];
|
|
|
41
44
|
export declare const DEFAULT_OPENING_SORT: PlpSortKey;
|
|
42
45
|
export declare function parseFilterLook(value: unknown): FilterLook;
|
|
43
46
|
export declare function parseFilterLookPhone(value: unknown): FilterLookPhone;
|
|
47
|
+
export declare const LISTING_FILTER_LOOKS: readonly ["rail", "button"];
|
|
48
|
+
export type ListingFilterLook = (typeof LISTING_FILTER_LOOKS)[number];
|
|
49
|
+
export declare const LISTING_FILTER_LOOK_PROP = "filterLook";
|
|
50
|
+
export declare const DEFAULT_LISTING_FILTER_LOOK: ListingFilterLook;
|
|
51
|
+
export declare const isListingFilterLook: (o: {
|
|
52
|
+
value: string;
|
|
53
|
+
}) => boolean;
|
|
54
|
+
export declare const LISTING_FILTER_LOOK_OPTIONS: ({
|
|
55
|
+
readonly value: "bar-pills";
|
|
56
|
+
readonly label: "Bar · pills";
|
|
57
|
+
} | {
|
|
58
|
+
readonly value: "bar-columns";
|
|
59
|
+
readonly label: "Bar · columns";
|
|
60
|
+
} | {
|
|
61
|
+
readonly value: "rail";
|
|
62
|
+
readonly label: "Side rail";
|
|
63
|
+
} | {
|
|
64
|
+
readonly value: "button";
|
|
65
|
+
readonly label: "Filters button";
|
|
66
|
+
})[];
|
|
67
|
+
export declare const LISTING_FILTER_LOOK_PHONE_OPTIONS: ({
|
|
68
|
+
readonly value: "bar";
|
|
69
|
+
readonly label: "Bar";
|
|
70
|
+
} | {
|
|
71
|
+
readonly value: "button";
|
|
72
|
+
readonly label: "Filters button";
|
|
73
|
+
} | {
|
|
74
|
+
readonly value: "rail";
|
|
75
|
+
readonly label: "Side rail";
|
|
76
|
+
})[];
|
|
77
|
+
export declare function parseListingFilterLook(value: unknown): ListingFilterLook;
|
|
78
|
+
export declare const parseListingFilterLookPhone: typeof parseListingFilterLook;
|
|
79
|
+
export declare function plpFilterViews(look: unknown, lookPhone: unknown): {
|
|
80
|
+
rail: string | null;
|
|
81
|
+
button: string | null;
|
|
82
|
+
};
|
|
44
83
|
export declare function parseShownFilters(value: unknown): ShownFilter[];
|
|
45
84
|
export declare function parseOpeningSort(value: unknown): PlpSortKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_CATALOG_FILTER_LABELS as
|
|
1
|
+
import{DEFAULT_CATALOG_FILTER_LABELS as a}from"../content/catalog-filter-labels.js";import{STOCK_WORDS as I}from"../content/stock-words.js";import{parseOption as l}from"efficient-web-builder/format/lib/parse-option";import{viewHideClass as b}from"efficient-web-builder/format/lib/content/view-hide-class";import{asPlpSortKey as S}from"../wheels/plp-filters.js";const p=[{value:"bar-pills",label:"Bar · pills"},{value:"bar-columns",label:"Bar · columns"},{value:"rail",label:"Side rail"},{value:"button",label:"Filters button"}],E="bar-pills",u=[{value:"bar",label:"Bar"},{value:"button",label:"Filters button"},{value:"rail",label:"Side rail"}],F="bar",d=[{value:"inStock",label:I.inStock},{value:"category",label:"Category"},{value:"lugs",label:a.lugs},{value:"price",label:a.price}],x=["inStock","category","lugs","price"],v="recommended";function y(t){return l(p.map(o=>o.value),E,typeof t=="string"?t:void 0)}function K(t){return l(u.map(o=>o.value),F,typeof t=="string"?t:void 0)}const i=["rail","button"],w="filterLook",g="rail",L=t=>i.includes(t.value),D=p.filter(L),G=u.filter(L);function c(t){return l(i,g,typeof t=="string"?t:void 0)}const k=c,m="lg:flex-none lg:self-stretch";function H(t,o){const r=c(t),O=k(o),_=e=>e.desk&&e.phone?"":e.desk||e.phone?b({desktop:!e.desk,tablet:!e.desk,mobile:!e.phone}):null,s=e=>_({desk:r===e,phone:O===e}),f=e=>e&&`${e} ${m}`,n={rail:null,button:null};for(const e of i)switch(e){case"rail":n.rail=f(s(e));break;case"button":n.button=s(e);break;default:{const T=e;throw new Error(`no drawing for listing look ${String(T)}`)}}return n}function U(t){if(!Array.isArray(t))return[...x];const o=new Set(d.map(r=>r.value));return t.filter(r=>typeof r=="string"&&o.has(r))}function C(t){return S(typeof t=="string"?t:void 0)}export{E as DEFAULT_FILTER_LOOK,F as DEFAULT_FILTER_LOOK_PHONE,g as DEFAULT_LISTING_FILTER_LOOK,v as DEFAULT_OPENING_SORT,x as DEFAULT_SHOWN_FILTERS,p as FILTER_LOOK_OPTIONS,u as FILTER_LOOK_PHONE_OPTIONS,i as LISTING_FILTER_LOOKS,D as LISTING_FILTER_LOOK_OPTIONS,G as LISTING_FILTER_LOOK_PHONE_OPTIONS,w as LISTING_FILTER_LOOK_PROP,d as SHOWN_FILTER_OPTIONS,L as isListingFilterLook,y as parseFilterLook,K as parseFilterLookPhone,c as parseListingFilterLook,k as parseListingFilterLookPhone,C as parseOpeningSort,U as parseShownFilters,H as plpFilterViews};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-storefront-blocks",
|
|
3
|
-
"version": "0.120.
|
|
3
|
+
"version": "0.120.3",
|
|
4
4
|
"description": "The EFFICIENT storefront's website editor — the website builder assembled with the storefront's own sections — for an app that edits a storefront website inside its own page. Built from the efficient-storefront-blocks repository.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as xe,_ as _t,aa as Rt,ba as Nt,da as G,g as wt}from"./chunk-3E2YAOJH.js";import{Ai as Ve,Ci as St,Pi as Ce,Qi as Et,Ti as Xe,Ui as Pt,We as Ct,xi as xt,zi as ze}from"./chunk-ITCY3GG4.js";import{c as vt,o as de}from"./chunk-MR37ISPW.js";import{createContext as In,useContext as Ot,useEffect as Ln,useMemo as Se,useState as At}from"react";function It(e,t){return e.map(n=>({partNumber:n.partNumber,quantity:n.wheels*t}))}function fe(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 Ye=4,Vr=1,Xr={unit:"set",spares:0,spareSide:"left"};function Lt(e){return e.unit==="single"?1:Ye+e.spares}function Yr(e,t){return[{partNumber:e.partNumber,wheels:Lt(t),prices:e.prices}]}function Qr(e,t){let n=Lt(t)-Ye;if(n<=0||e.length===0)return e;let r=Rn(e),o=r?r[t.spareSide]:0;return e.map((i,a)=>a===o?{...i,wheels:i.wheels+n}:i)}function Rn(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 Nn(e,t){return t.spares>0?`${e} + spare`:e}function jr(e){return e.unit==="single"?"Single":Nn(`Set of ${Ye}`,e)}var Zr="data-add-to-basket",Qe=9,kn="en",kt=new Map;function Te(e,t,n){let r=`${e}|${t??""}|${n??""}`,o=kt.get(r);return o||(o=new Intl.NumberFormat(kn,{style:"currency",currency:e,...t===void 0?{}:{minimumFractionDigits:t},...n===void 0?{}:{maximumFractionDigits:n}}),kt.set(r,o)),o}function Y(e,t,n=0){return Te(t,0,n).format(e)}function Jr(e,t){return Te(t).format(e)}function eo(e,t){let n=e.savings[t];if(n===void 0)return null;let r=Y(n,t);return e.savingIsFrom?`Save from ${r}`:`Save ${r}`}import{jsx as Mn}from"react/jsx-runtime";var An="storefront-country",Tt=An,je=In(null);function Tn(e){return Mt(e,"catalogue")}function On(e){return Mt(e,"money")}function Mt(e,t){let n=new Map(e.map(r=>[r.code,r.decimalPlaces]));return(r,o)=>{if(!o)return"";let i=n.get(o)??0;return Te(o,t==="money"?i:0,i).format(r)}}function io({children:e,currencies:t,countries:n,defaultCurrency:r,defaultCountry:o}){let i=Se(()=>t??[],[t]),a=Se(()=>n??[],[n]),l=Se(()=>r||i.find(m=>m.isDefault)?.code||i[0]?.code||"",[r,i]),c=Se(()=>o||a.find(m=>m.isDefault)?.code||a[0]?.code||"",[o,a]),[u,g]=At(c),[x,d]=At(!1);Ln(()=>{let m=de.getItem(Tt);m&&a.some(L=>L.code===m)&&g(m),d(!0)},[a]);function P(m){g(m),de.setItem(Tt,m)}let k=Se(()=>{let m=a.find(y=>y.code===u)??null,L=m?.currency,I=L&&i.some(y=>y.code===L)?L:l,A=Tn(i),_=On(i);return{country:u,currency:I,setCountry:P,currencies:i,countries:a,activeCountry:m,formatPrice:(y,U)=>A(y,U??I),formatMoney:(y,U)=>_(y,U??I),ready:x}},[u,i,a,l,x]);return Mn(je.Provider,{value:k,children:e})}function Dt(e){let t=Ot(je);if(!t&&!e?.optional)throw new Error("useCurrency must be used within a CurrencyProvider");return t}function ao(){return Ot(je)?.country??""}import{createContext as Yn,useCallback as E,useContext as Qn,useEffect as z,useMemo as jt,useRef as Q,useState as w}from"react";function Ft(){return"/edit"}function $t(e,t){return e.valid?!1:e.reason==="firstOrderOnly"?!0:e.reason==="notEligible"&&!t}var Ht="We'll confirm this discount when you place your order.",fo="Confirmed at checkout";function po(e){return e&&(e.valid||e.deferred)?e.code:void 0}var Ut="coupon_code: ";function mo(e){return!(e instanceof xe)||e.status!==400||!e.message.startsWith(Ut)?null:e.message.slice(Ut.length)}function Bt(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 Oe="Price on request",Fn="Request a quote",qt="from ",bo="From ",Co="each",Wt="Free",xo="Updating";function Ze(e){return typeof e=="number"&&Number.isFinite(e)&&e>0}function Je(e,t){let n=e?.[t];return Ze(n)?n:null}function So(e,t,n,r){let o=Je(e,n),i=Je(t,n);return o===null&&i===null?0:o===null?1:i===null?-1:r==="asc"?o-i:i-o}function vo(e,t,n,r){if(n==null&&r==null)return!0;let o=Je(e,t);return!(o===null||n!=null&&o<n||r!=null&&o>r)}var Un={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function $n(e,t,n){if(!Ze(e))return Un;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 Eo(e,t,n=""){return!e.priced||e.unit==null?Oe:`${n}${Y(e.unit,t)}`}function Po(e,t){return e.was==null?null:Y(e.was,t)}function Hn(e,t,n=1){let r=fe(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 Bn={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function wo(e,t,n,r=1){let o=$n(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=Hn(t.components,n,r);return a.priced?{priced:!0,unit:a.unit,isFrom:a.isFrom,was:null,onSale:!1,setTotal:a.setTotal,fromSetTotal:i}:{...Bn,fromSetTotal:i}}function qn(e,t){return!e.priced||e.unit==null?Oe:`${e.isFrom?qt:""}${Y(e.unit,t)}`}function _o(e,t){return e.was==null?null:Y(e.was,t)}function Ro(e,t){return!e.priced||e.unit==null?Fn:qn(e,t)}function No(e,t){let n=e.savings[t];if(n===void 0||e.components.length===0)return null;let r=0;for(let i of e.components){let a=i.prices?.[t];if(typeof a!="number")return null;r+=a*i.quantity}let o=Y(r-n,t);return{was:Y(r,t),amount:e.savingIsFrom?`${qt}${o}`:o}}var Wn=/^[^@\s]+@[^@\s]+\.[^@\s]+$/;function Gt(e){return Wn.test(e.trim())}var Kt="sf:ga-purchases",Gn=20;function Vt(){return typeof window>"u"||window.parent!==window}function ve(...e){try{if(Vt()||typeof window.gtag!="function")return;window.gtag(...e)}catch{}}function Kn(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:fe(e.components,t)??0,quantity:e.qty}}function et(e,t){return e.filter(Me).map(n=>Kn(n,t))}function Oo(e){ve("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 Xt(e,t){let n=et([e],t);n.length!==0&&ve("event","add_to_cart",{currency:t,value:n[0].price*n[0].quantity,items:n})}function Mo(e){let t=et(e.lines,e.currency);t.length!==0&&ve("event","begin_checkout",{currency:e.currency,value:e.value,...e.coupon?{coupon:e.coupon}:{},items:t})}var zt=new Set;function zn(e){if(zt.has(e))return!1;zt.add(e);try{let t=JSON.parse(de.getItem(Kt)??"[]");if(t.includes(e))return!1;de.setItem(Kt,JSON.stringify([...t,e].slice(-Gn)))}catch{}return!0}function Do(e){let t=e.confirmation;if(Vt()||!zn(t.orderNumber))return;let n=t.currency,r=Number(t.grandTotal);ve("event","purchase",{transaction_id:t.orderNumber,currency:n,value:r,shipping:Number(t.freightCharge),...t.couponCode?{coupon:t.couponCode}:{},items:et(e.lines,n)}),e.adsSendTo&&ve("event","conversion",{send_to:e.adsSendTo,transaction_id:t.orderNumber,currency:n,value:r})}var Vn="Arranged after review",Yt="Calculated at checkout",Xn=Yt,$o=Yt;function Qt({quoted:e,optionCount:t,chosenAmount:n,couponWaivesFreight:r}){return e&&t===0?"arranged":r?"free":n===void 0?"pending":n===0?"free":"charged"}function Ho(e){switch(e){case"arranged":return Vn;case"pending":return Xn;case"free":return Wt;case"charged":return null}}import{jsx as er}from"react/jsx-runtime";var jn=400,Zn=400,Jn=1500;function Me(e){return(e.components?.length??0)>0}function Zt(e,t){return{code:e,valid:t.valid,deferred:$t(t,t.askedAsShopper),message:t.message||void 0,effects:t.effects??void 0}}function en(e,t){return fe(e.components,t)}function tt(e,t){let n=en(e,t);return n===null?null:n*e.qty}function Jt(e){return e!=="tyre"}var tn=Yn(null);function Jo({children:e,preview:t=!1}){let{currency:n,country:r,formatMoney:o}=Dt(),[i,a]=w(t),[l,c]=w([]),[u,g]=w([]),[x,d]=w([]),[P,k]=w(!1),m=Q(new Set),[L,I]=w([]),[A,_]=w(!1),[y,U]=w(null),[V,J]=w(null),[T,b]=w(null),[R,C]=w(0),ee=E(()=>C(s=>s+1),[]),[pe,me]=w(void 0),[K,qe]=w(null),[v,O]=w(null),[ge,ie]=w(!1),[M,he]=w(null),te=Q(void 0),H=E(()=>a(!0),[]),ae=E(()=>a(!1),[]),X=E(()=>a(s=>!s),[]);z(()=>{t||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&H()},[H,t]);let $=Ft(),Re=Q($);z(()=>{Re.current!==$&&(Re.current=$,t||ae())},[$,t,ae]);let F=E(s=>{qe(p=>p?.country===s?.country&&p?.subdivision===s?.subdivision&&p?.postcode===s?.postcode?p:s)},[]),Ne=E((s,p)=>{_(!0),!(!p||!Jt(s))&&I(f=>f.includes(p)?f:[...f,p])},[]),se=A||l.length>0,le=Q(!0);z(()=>(le.current=!0,()=>{le.current=!1}),[]),z(()=>{if(t)return;let s=[...L,...l.filter(f=>Jt(f.kind)).map(f=>f.slug)],p=[...new Set(s)].filter(f=>f&&!m.current.has(f));if(p.length!==0){for(let f of p)m.current.add(f);G.listWheelsBySlug(p).then(f=>{if(!le.current||f.length===0)return;let h=new Set(f.map(S=>S.slug));g(S=>[...S.filter(re=>!h.has(re.slug)),...f])})}},[t,L,l]),z(()=>{if(t||!se||P)return;let s=!0;return G.listBundles().then(p=>{s&&(d(p),k(!0))}),()=>{s=!1}},[t,se,P]);let B=y?.deliveryOptions??[],ye=y?.courier??null;z(()=>{y&&he(s=>s&&B.some(p=>p.id===s)?s:B[0]?.id??null)},[y]);let ne=E(()=>l.filter(Me).flatMap(s=>It(s.components,s.qty)),[l]),ue=E(async(s,p)=>{let f=s.trim().toUpperCase();if(!f)return;let h=ne();if(h.length===0){O({code:f,valid:!1,message:"Add a wheel to the cart first."});return}ie(!0),te.current=p;try{let S=await G.validateCoupon({code:f,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:p});O(Zt(f,S))}catch{O({code:f,valid:!1,unchecked:!0,message:"Could not check that code. Please try again."})}finally{ie(!1)}},[ne,n,M]),ke=E(()=>{O(null),te.current=void 0},[]),Ie=E(s=>{if(!v)return;let{code:p}=v;O(f=>f&&f.code===p?{code:p,valid:!1,refused:!0,message:s}:f)},[v]);z(()=>{if(!v||v.refused)return;let s=v.code,p=h=>h!==null&&h.code===s&&!h.refused,f=setTimeout(async()=>{let h=ne();if(h.length===0){O(S=>p(S)?{code:s,valid:!1,message:"Add a wheel to the cart first."}:S);return}ie(!0);try{let S=await G.validateCoupon({code:s,items:h,currency:n,shippingMethodId:M??void 0,customerEmail:te.current});O(re=>p(re)?Zt(s,S):re)}catch{}finally{ie(!1)}},jn);return()=>clearTimeout(f)},[l,n,M]);let N=v&&!v.refused?v.code:void 0;z(()=>{if(t)return;let s=!0,p=l,f=setTimeout(async()=>{let h=ne();if(h.length===0){U(null),J(null),me(void 0);return}try{let S=await G.quoteCart({items:h,currency:n,shippingMethodId:M??void 0,couponCode:N,customerEmail:te.current||void 0,country:K?.country||r||void 0,subdivision:K?.country&&K.subdivision||void 0,postcode:K?.country&&K.postcode||void 0});if(!s)return;U(S),J(p),b(null)}catch{if(!s)return;b(p)}me(N)},Zn);return()=>{s=!1,clearTimeout(f)}},[l,n,M,N,r,K,R]);let q=E(s=>{c(p=>{let f=p.findIndex(h=>h.id===s.id);return f===-1?[...p,s]:p.map((h,S)=>S===f?{...h,qty:Math.min(Qe,h.qty+s.qty)}:h)}),Xt(s,n)},[n]),Le=E(s=>{c(p=>p.filter(f=>f.id!==s))},[]),lt=E((s,p)=>{let f=Math.max(1,Math.min(Qe,p));c(h=>h.map(S=>S.id===s?{...S,qty:f}:S))},[]),ut=E(s=>{c(s)},[]),[be,xn]=w(null),ct=Q(null);ct.current=be;let W=Q(null),We=Q(""),dt=E((s,p)=>{let f=s.trim().toLowerCase();Gt(f)&&xn(h=>h&&h.email===f&&h.firstName===(p??"")?h:{email:f,firstName:p??""})},[]);z(()=>{if(t||!be)return;let s=Bt(l.filter(Me),h=>tt(h,n)===null?Oe:o(tt(h,n),n)),p={email:be.email,firstName:be.firstName,currency:n,items:s},f=JSON.stringify(p);if(f!==We.current)return W.current&&clearTimeout(W.current),W.current=setTimeout(()=>{W.current=null,We.current=f,G.captureCart(p).catch(h=>{})},Jn),()=>{W.current&&(clearTimeout(W.current),W.current=null)}},[l,be,n,t]);let ft=E(()=>{W.current&&(clearTimeout(W.current),W.current=null);let s=ct.current;s&&(We.current="",G.captureCart({email:s.email,firstName:s.firstName,currency:n,items:[]}).catch(p=>{}))},[n]),pt=jt(()=>{let s=l.reduce((D,ce)=>{let Ae=tt(ce,n);return Ae===null?D:D+Ae},0),p=l.some(D=>en(D,n)===null),f=l.reduce((D,ce)=>D+ce.qty,0),h=v?.valid?v.effects:void 0,S=h?Math.min(s,Number(h.discountAmount)):0,re=y?.bundleDiscount??0,vn=y?.appliedBundles??[],Ge=!!h?.freeShipping,yt=B.find(D=>D.id===M),bt=Ge?0:y?.shipping??yt?.amount??0,En=Qt({quoted:y!==null,optionCount:B.length,chosenAmount:yt?.amount,couponWaivesFreight:Ge}),Ke={};for(let D of h?.freeUnits??[])Ke[D.partNumber]=(Ke[D.partNumber]??0)+D.quantity;let Pn=y?.tax??null,wn=y?y.grandTotal:s-S-re+bt;return{sets:f,units:l.reduce((D,ce)=>D+(ce.components??[]).reduce((Ae,_n)=>Ae+_n.wheels*ce.qty,0),0),subtotal:s,hasUnpricedLine:p,discount:S,bundleDiscount:re,appliedBundles:vn,shipping:bt,freeShipping:Ge,shippingStatus:En,freeUnitsByPartNumber:Ke,tax:Pn,grand:wn,repricing:!!v?.refused&&y!==null&&pe===v?.code,quoted:y!==null&&V===l,serverSubtotal:y?.subtotal??null,quoteFailed:T===l,currency:n}},[l,n,v,B,M,y,pe,V,T]),mt=Q(!0),gt=E(s=>{mt.current=s},[]),ht=E(s=>{q(s),mt.current&&H()},[q,H]),Sn=jt(()=>({isOpen:i,preview:t,open:H,close:ae,toggle:X,items:l,catalog:u,bundles:x,warmCatalog:Ne,add:q,addAndOpen:ht,setAutoOpen:gt,remove:Le,setQty:lt,replaceItems:ut,identify:dt,clearCapturedCart:ft,coupon:v,applyCoupon:ue,removeCoupon:ke,refuseCoupon:Ie,couponBusy:ge,deliveryOptions:B,setQuoteDestination:F,courier:ye,requote:ee,shippingMethodId:M,setShippingMethodId:he,totals:pt}),[i,t,H,ae,X,l,u,x,Ne,q,ht,gt,Le,lt,ut,dt,ft,v,ue,ke,Ie,ge,B,F,ye,ee,M,pt]);return er(tn.Provider,{value:Sn,children:e})}function nn(){let e=Qn(tn);if(!e)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return e}import{cache as cr}from"react";function rn(e){return/(?:^|\|)(?:slug|xhost):/.test(e)}function on(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 tr=6e4,nr=5e3,rr=500,De=new Map;async function or(e){let{host:t,matchesRequestHost:n}=await _t();if(!t)return"";let r=await Rt();return r?`${e}|slug:${encodeURIComponent(t)}/${encodeURIComponent(r)}`:n?`${e}|host:${t}`:`${e}|xhost:${t}`}async function an(e,t){if(await Nt()!==null)return t();let n=await or(e);if(!n)return t();let r=Date.now(),o=De.get(n);if(o&&o.expiresAt>r)return o.load;let i=await t(),a=i.outcome.state==="failed",l=a?nr:tr,c=De.get(n)?.lastGood,u=i.outcome.state==="ok"?i:a?c:void 0,g=a&&u?u:i;return on(De,rr,rn,r),De.set(n,{load:g,expiresAt:r+l,lastGood:u}),g}var ir=404;function ar(e){if(e instanceof xe&&e.status===ir)return{state:"absent"};let t=e instanceof xe?e.status:-1,n=e instanceof Error?e.message:String(e);return{state:"failed",status:t,detail:n}}var sr="[storefront:chrome-load-failed]";function lr(e,t){console.error(`${sr} ${e} status=${t.status} \u2014 serving fallback chrome`,t.detail)}async function sn(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=ar(o);return i.state==="failed"&&lr(e,i),{value:n,outcome:i}}}function ur(e){return e==="production"?"silent":"banner"}var si=ur("production");function dr(e,t){return e?.trim()||t}function gi({legalName:e,foundedYear:t,siteName:n},r=new Date().getFullYear()){let o=dr(e,n);return`\xA9 ${t&&t<r?`${t}\u2013${r}`:`${r}`} ${o}`}var fr={name:Ce,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,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:Xe},hi=cr(async()=>an("site",()=>sn("site",async()=>{let e=await G.getSite();return{name:Et(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,privacyPage:e.privacyPage??null,termsPage:e.termsPage??null,footerCookieSettings:e.footerCookieSettings??!0,footerSitemap:e.footerSitemap??!0,socialLinks:Pt(e.socialLinks)}},fr)));var yi={name:Ce,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,privacyPage:null,termsPage:null,footerCookieSettings:!0,footerSitemap:!0,socialLinks:Xe};import{jsx as pr}from"react/jsx-runtime";function Ci({tone:e="bad",role:t,children:n}){return pr("div",{role:t,className:["border bg-surface px-4 py-3 text-[14px] leading-relaxed text-fg",e==="good"?"border-accent":e==="bad"?"border-alert":"border-line"].join(" "),children:n})}import{jsx as Pe,jsxs as nt}from"react/jsx-runtime";import{useEffect as Fe,useId as yr,useRef as un,useState as Ue}from"react";import{useRootIsDark as br}from"efficient-shell/theme";import{efficientClientOpen as mr}from"efficient-easel/screen/lib/session";var Ee=new Map,gr=64;async function hr(e){if(!mr())return null;try{let t=await fetch(`${vt()}/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 ln(e){let t=Ee.get(e);if(t)return t;let n=hr(e);if(Ee.set(e,n),Ee.size>gr){let r=Ee.keys().next();r.done||Ee.delete(r.value)}return n}var Cr=202/22,xr=.88,Ui=16,Sr="invert(1)";function $i({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,sizeUnit:g,wordmark:x,siteName:d=Ce,fitToContainer:P=!1,fitWordmarkToContainer:k=!1,fitFloorPx:m,hideClass:L,hideAttrs:I}){let A=x&&x.trim()?x.trim():d,[_,y]=Ue(null),U=un(null),V=N=>{U.current=N};Fe(()=>{y(U.current?.ownerDocument??null)},[]);let J=!br({doc:_,whenUnset:!0}),T=n&&n.trim()?n.trim():null,b=!!T&&wt(T),R=i??(J&&t),C=o&&o.trim()?o.trim():null,ee=r&&!C,pe=`logo-color-${yr().replace(/[^A-Za-z0-9_-]/g,"")}`,me=ee&&b&&T&&a!=null?{reversed:a,inkIsDark:l??null}:null,K=me!==null,[qe,v]=Ue(null);Fe(()=>{if(!ee||!T||!b||K){v(null);return}let N=!1;return v(null),ln(T).then(q=>{N||v(q)}),()=>{N=!0}},[ee,T,b,K]);let O=me??qe,ge=!!O&&O.inkIsDark!==null&&(R?!O.inkIsDark:O.inkIsDark),ie=ee&&!!T&&!b&&!R,M=ge&&O?O.reversed:T,he=M?[M]:[],[te,H]=Ue(0);Fe(()=>{H(0)},[T,ge]);let ae=e==="footer"?Ve:ze[c],X=u&&u>0?u:ae,$=(u&&u>0?Ct(u,g,"size",St):null)??`${X}px`,Re=Math.round(X*Cr),F=te<he.length?he[te]:null,[Ne,se]=Ue(M),le=F!==null&&F===Ne,B=un(null);Fe(()=>{let N=B.current;if(!N||!N.complete)return;if(N.naturalWidth>0||N.naturalHeight>0){se(F);return}let q=!1;return N.decode().then(()=>!q&&se(F),()=>!q&&H(Le=>Le+1)),()=>{q=!0}},[F]);let ye=P||k,ne=`calc(100cqi / ${((A.length+1)*xr).toFixed(2)})`,ue=ye&&m&&m>0?$===`${X}px`?`${Math.min(m,X)}px`:`min(${m}px, ${$})`:null,ke=ye?ue===null?`min(${$}, ${ne})`:`clamp(${ue}, ${ne}, ${$})`:$,Ie=nt("span",{className:`font-display font-bold tracking-[0.18em] ${ue===null?"whitespace-nowrap":"whitespace-normal"}`,style:{fontSize:ke,lineHeight:1,...C?{color:C}:{}},"aria-label":A,children:[A,Pe("span",{className:"text-accent",style:C?{color:C}:void 0,children:"."})]});return nt("span",{ref:V,className:xt("inline-flex items-center",L??""),...I,children:[!le&&Ie,C&&F&&Pe("svg",{"aria-hidden":"true",focusable:"false",width:"0",height:"0",style:{position:"absolute"},children:nt("filter",{id:pe,colorInterpolationFilters:"sRGB",children:[Pe("feFlood",{style:{floodColor:C}}),Pe("feComposite",{in2:"SourceAlpha",operator:"in"})]})}),F&&Pe("img",{ref:B,src:F,alt:A,width:Re,height:X,className:"shrink-0 object-contain",style:{...le?{height:$,width:"auto",...P?{maxWidth:"100cqi"}:{}}:{display:"none"},...ie?{filter:Sr}:{},...C?{filter:`url(#${pe})`}:{}},onLoad:()=>se(F),onError:()=>H(N=>N+1)},F)]})}var Bi="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent",cn="w-0 min-w-0 flex-1",qi="w-0 min-w-[7rem] flex-1";import{jsx as we,jsxs as Er}from"react/jsx-runtime";function vr({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 g=u+Math.PI/e;l.push({x1:a(100+Math.cos(g)*22*1.4),y1:a(100+Math.sin(g)*22*1.4),x2:a(100+Math.cos(g)*78),y2:a(100+Math.sin(g)*78),main:!1})}}return Er("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:[we("circle",{cx:100,cy:100,r:92,strokeWidth:2}),we("circle",{cx:100,cy:100,r:84,strokeWidth:1,opacity:.4}),we("circle",{cx:100,cy:100,r:22,strokeWidth:2}),we("circle",{cx:100,cy:100,r:6,fill:"currentColor"}),l.map((c,u)=>we("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 zi="#c9a461",dn=[{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"}],Vi={name:"",color:"var(--fg)",family:"silver",src:""};function Pr(e,t){let n=r=>{let o=dn.findIndex(i=>i.f===r);return o===-1?dn.length:o};return n(e)-n(t)||e.localeCompare(t)}function Xi(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(Pr)}import{useState as wr}from"react";import{jsx as oe,jsxs as rt}from"react/jsx-runtime";function _r({customerEmail:e,disabled:t=!1}){let{coupon:n,applyCoupon:r,removeCoupon:o,couponBusy:i}=nn(),[a,l]=wr("");async function c(){t||i||!a.trim()||(await r(a,e),l(""))}return rt("div",{className:"flex flex-col gap-2",children:[n===null?rt("div",{className:"flex border border-line",children:[oe("input",{type:"text",value:a,onChange:u=>l(u.target.value),onKeyDown:u=>{u.key==="Enter"&&(u.preventDefault(),c())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:t,className:`${cn} bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim`}),oe("button",{type:"button",onClick:()=>{c()},disabled:i||t,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:i?"\u2026":"Apply"})]}):rt("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",n.valid?"border-accent":"border-line"].join(" "),style:n.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[oe("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",n.valid?"text-accent":n.deferred||n.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:n.code}),n.unchecked&&oe("button",{type:"button",onClick:()=>{r(n.code,e)},disabled:i||t,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:i?"\u2026":"Try again"}),!t&&oe("button",{type:"button",onClick:o,"aria-label":`Remove coupon ${n.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"\u2715"})]}),n?.deferred?oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:Ht}):n&&!n.valid&&n.message&&oe("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:n.message})]})}var ot="Ads on. Shopper can opt out.",$e="Ads and analytics off until Accept",Rr={us:{region:"us",name:"United States",model:"opt-out",law:"California CCPA / CPRA, other state laws",beforeChoice:ot,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:$e,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},au:{region:"au",name:"Australia",model:"opt-out",law:"Privacy Act 1988 (APPs)",beforeChoice:ot,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},nz:{region:"nz",name:"New Zealand",model:"opt-out",law:"Privacy Act 2020",beforeChoice:ot,footerLink:"Privacy choices",panelEyebrow:"Privacy choices",adsRowName:"Advertising"},uk:{region:"uk",name:"United Kingdom",model:"opt-in",law:"PECR, UK GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},eu:{region:"eu",name:"European Union",model:"opt-in",law:"ePrivacy Directive, GDPR",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"},other:{region:"other",name:"All other countries",model:"opt-in",law:"Safe default",beforeChoice:$e,footerLink:"Cookie settings",panelEyebrow:"Cookie settings",adsRowName:"Advertising"}};function Nr(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 na(e,t,n){let r=Nr(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 ra={accept:"Accept all",reject:"Reject all",choose:"Choose",save:"Save",ok:"OK",privacyChoices:"Privacy choices",privacyPolicy:"Privacy Policy",alwaysOn:"Always on",close:"Close",cookieSettings:"Cookie settings"};var kr={asked:!1,region:"other",model:"opt-in",analytics:!0,ads:!0,chosen:!0,gpc:!1};var Ir=kr;function sa(e=Ir){if(e.asked)return e.ads?"granted":"denied"}function ua(){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 Ar,isValidElement as Tr,useEffect as pn,useId as Or,useLayoutEffect as hn,useRef as j,useState as mn}from"react";var He=(e,t)=>!!e[t]&&!e[t].disabled;function it(e,t,n){let r=e.length;for(let o=1;o<=r;o++){let i=((t+n*o)%r+r)%r;if(He(e,i))return i}return t}function at(e,t){return it(e,t===1?-1:e.length,t)}function st(e,t){return He(e,t)?t:Math.max(at(e,1),0)}function fn(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)=>He(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:it(n,o,1)}),handled:!0};case"ArrowUp":return{state:i({focus:it(n,o,-1)}),handled:!0};case"Home":return{state:i({focus:at(n,1)}),handled:!0};case"End":return{state:i({focus:at(n,-1)}),handled:!0};case"Enter":case" ":return He(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 Mr}from"efficient-shell/ui";import{Fragment as qr,jsx as Z,jsxs as yn}from"react/jsx-runtime";var gn={body:"text-[length:var(--size-body,14px)]",label:"text-[length:var(--size-label,13px)]"};function Dr({items:e,value:t,onPick:n,open:r,onOpen:o,onClose:i}){let[a,l]=mn(!1),c=r!==void 0,u=c?r:a,[g,x]=mn(0),d=j({text:"",timer:0}),P=j(null),k=j(null),m=j(null),L=Or(),I=j(null),A=e.findIndex(b=>b.value===t),_=b=>{b!==u&&(c||l(b),b?o?.():i?.())},y=b=>{let R=e[b];!R||R.disabled||(n(R.value),_(!1),k.current?.focus())},U=b=>{let R={open:u,focus:u?g:st(e,A),typed:d.current.text},C=fn(R,b,e);return!C.handled&&C.state.open===u?!1:(C.state.typed!==R.typed&&(d.current.text=C.state.typed,window.clearTimeout(d.current.timer),d.current.timer=window.setTimeout(()=>{d.current.text=""},500)),x(C.state.focus),C.commit!==void 0?y(C.commit):_(C.state.open),C.refocus&&k.current?.focus(),C.handled)},V=j(U);V.current=U;let J=j(()=>_(!1));J.current=()=>_(!1);let T=b=>{u||(I.current=b.nativeEvent,V.current(b.key)&&b.preventDefault())};return pn(()=>{if(!u)return;let b=C=>{P.current?.contains(C.target)||J.current()},R=C=>{C!==I.current&&V.current(C.key)&&C.preventDefault()};return document.addEventListener("mousedown",b),document.addEventListener("keydown",R),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",R)}},[u]),pn(()=>{u&&(d.current.text||x(st(e,A)))},[u]),hn(()=>{if(!u||!m.current)return;m.current.children.item(g)?.scrollIntoView({block:"nearest"})},[g,u]),{open:u,toggle:()=>_(!u),close:()=>_(!1),focusIdx:g,setFocusIdx:x,pick:b=>y(e.findIndex(R=>R.value===b)),wrapRef:P,triggerRef:k,listRef:m,listId:L,onTriggerKeyDown:T,activeId:u?`${L}-${g}`:void 0}}var Fr={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 ${gn.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 ${gn.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 Ur(e,t){hn(()=>{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",g=Mr({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(g.side==="top"){i.top="auto",i.bottom="100%",i.marginTop="0px";let d=g.top+Math.min(c.height,g.maxHeight);i.marginBottom=`${Math.max(0,l.top-d)}px`}g.maxHeight<c.height&&(i.maxHeight=`${g.maxHeight}px`,i.overflowY="auto");let x=g.left-c.left;x&&(i.translate=`${x}px`)};return o(),r.addEventListener("resize",o),r.addEventListener("scroll",o,!0),()=>{r.removeEventListener("resize",o),r.removeEventListener("scroll",o,!0)}},[e,t])}function $r(e){return e.split(" ").map(t=>t==="left-0"?"right-0":t).join(" ")}function Hr({id:e,tone:t,items:n,value:r,focusIdx:o,onFocus:i,onPick:a,listRef:l,ariaLabel:c,align:u="start"}){let g=Fr[t],x=j(null);return Ur(x,n.length),Z("ul",{ref:d=>{x.current=d,l&&(l.current=d)},id:e,role:"listbox","aria-label":c,...g.pickerMarker?{"data-picker-menu":""}:{},className:u==="end"?$r(g.list):g.list,children:n.map((d,P)=>{let k=d.value===r;return Z("li",{id:`${e}-${P}`,role:"option","aria-selected":k,"aria-disabled":d.disabled||void 0,onMouseEnter:()=>!d.disabled&&i(P),onMouseDown:m=>{m.preventDefault(),d.disabled||a(d.value)},className:g.item(P===o,k&&d.value!=="",!!d.disabled,P===n.length-1),style:g.itemStyle?.(k),children:d.meta===void 0?d.label:yn(qr,{children:[d.lead,Z("span",{className:"flex-1 whitespace-nowrap",children:d.label}),Z("span",{className:"ml-auto text-[12px] opacity-50",children:d.meta})]})},`${d.value}_${P}`)})})}function Br({value:e,onChange:t,disabled:n,children:r,className:o,style:i,name:a,id:l,"aria-label":c,align:u}){let g=Ar.toArray(r).flatMap(m=>{if(!Tr(m))return[];if(m.type!=="option")return[];let I=m.props,A=I.value!==void 0?String(I.value):"",_=I.children,y=typeof _=="string"||typeof _=="number"?String(_):A;return[{value:A,label:y,disabled:!!I.disabled}]}),x=e??"",d=Dr({items:g,value:x,onPick:m=>t?.({target:{value:m}})}),k=g.find(m=>m.value===x)?.label??g[0]?.label??"";return yn("div",{ref:d.wrapRef,className:"relative",children:[a&&Z("input",{type:"hidden",name:a,value:x}),Z("button",{ref:m=>{d.triggerRef.current=m},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:m=>!n&&d.onTriggerKeyDown(m),className:`block w-full ${o??""}`,style:i,children:Z("span",{className:"block w-full truncate text-left",children:k})}),d.open&&Z(Hr,{id:d.listId,tone:"select",items:g,value:x,focusIdx:d.focusIdx,onFocus:d.setFocusIdx,onPick:d.pick,listRef:d.listRef,align:u})]})}import{jsx as _e,jsxs as Be}from"react/jsx-runtime";var Wr="font-mono text-[length:var(--size-label,12px)]",Gr="font-semibold uppercase tracking-[0.22em] text-fg";function bn(e){return`${e??Wr} ${Gr}`}function Cn(){return _e("span",{className:"text-accent",children:" *"})}function Kr({children:e,required:t,labelFace:n}){return Be("span",{className:bn(n),children:[e,t?_e(Cn,{}):null]})}function zr({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?_e("span",{className:"font-mono text-[11px] uppercase tracking-[0.22em] text-fg-dim",children:n}):null;return r||n?Be("div",{className:c,children:[Be("label",{htmlFor:o,className:bn(i),children:[e,t?_e(Cn,{}):null]}),l,u]}):Be("label",{htmlFor:o,className:c,children:[_e(Kr,{required:t,labelFace:i,children:e}),l]})}export{Ft as a,fo as b,po as c,mo as d,It as e,Ye as f,Vr as g,Xr as h,Yr as i,Qr as j,Rn as k,Nn as l,jr as m,Zr as n,Qe as o,Te as p,Y as q,Jr as r,eo as s,Oe as t,Fn as u,qt as v,bo as w,Co as x,Wt as y,xo as z,Je as A,So as B,vo as C,$n as D,Eo as E,Po as F,Hn as G,wo as H,qn as I,_o as J,Ro as K,No as L,Gt as M,Oo as N,Mo as O,Do as P,$o as Q,Ho as R,io as S,Dt as T,ao as U,Me as V,tt as W,Jo as X,nn as Y,gi as Z,fr as _,yi as $,Bi as aa,cn as ba,qi as ca,vr as da,zi as ea,dn as fa,Vi as ga,Pr as ha,Xi as ia,_r as ja,Ci as ka,Ui as la,$i as ma,Rr as na,na as oa,ra as pa,kr as qa,sa as ra,ua as sa,Dr as ta,Hr as ua,Br as va,Kr as wa,zr as xa};
|