efficient-storefront-blocks 0.133.6 → 0.133.8
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/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +1 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +27 -27
- package/dist/render/components/MenuLinkBlock.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 +4 -1
- package/dist/render/components/wheels-plp/PlpFilterButton.js +1 -1
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
- package/dist/render/lib/document/blocks/text-part-shapes.json +7 -0
- package/dist/render/lib/sections/shopper-filters.d.ts +3 -0
- package/dist/render/lib/sections/shopper-filters.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +1 -0
- package/dist/words.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as l,jsxs as f}from"react/jsx-runtime";import{createContext as
|
|
1
|
+
"use client";import{jsx as l,jsxs as f}from"react/jsx-runtime";import{createContext as L,useContext as k,useEffect as w,useRef as N}from"react";import x from"next/link";import C from"./HeaderNavItem.js";import _ from"./MenuPlaceholderLabel.js";import{useCardRow as g}from"efficient-web-builder/render/components/CardRowContext";import{renderGold as i}from"efficient-web-builder/render/components/goldPhrases";import{scrollBehavior as I}from"efficient-web-builder/render/components/useReducedMotion";import{useTakeViewHide as R,withViewHide as u}from"efficient-web-builder/render/components/ViewHideRoot";import{isLabelOnlyMenuUrl as T,menuDropdownAside as E,menuLinkKind as M}from"../lib/menu-link.js";import{CURRENT_LINE as d,TAB_CELLS as p,showCurrentTab as v}from"../lib/content/tab-strip.js";import{blockParts as y}from"../lib/block-parts.js";import{MENU_BLOCK_TYPE as P}from"../lib/document/document-nodes.js";const m=y(P)("menu-link"),j=L(null),b="opacity-80 transition-opacity hover:opacity-100";function s({item:r,label:t,link:n,onNavigate:a,current:c=!1,children:o}){const e=R();return T(r.url)?e.scope(l("span",{className:u(t,e.className),...e.attrs,...m,children:i(r.label)})):e.scope(M(r.url)==="off-site"?f("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:u(n,e.className),onClick:a,...e.attrs,...m,children:[i(r.label),o]}):f(x,{href:r.url,className:u(n,e.className),onClick:a,"aria-current":c?"page":void 0,...e.attrs,...m,children:[i(r.label),o]}))}const A="[data-menu-tabs] > ul, [data-menu-row] > ul";function h({className:r,hidden:t=!1}){const n=N(null);return w(()=>{v(n.current?.closest(A)??null,I())},[]),l("span",{ref:n,"aria-hidden":t?"true":void 0,className:r})}function B(){const r=g(),t=k(j);if(!r||!t)return null;if(t.placeholder)return l(_,{});const n={label:r.row.label??"",url:r.row.href??""},a=!!t.current&&t.current.index===r.index&&t.current.href===n.url;if(t.place==="tab"){const e=p.tab(a);return l(s,{item:n,label:e,link:e,current:a,children:a?l(h,{className:p.underline}):null})}if(t.place==="column")return l(s,{item:n,label:"text-fg",link:"text-fg transition-colors hover:text-accent",current:a});if(t.place==="panel")return l(s,{item:n,label:"",link:` ${b}`,onNavigate:t.onNavigate,current:a});const c=r.item,o=c?.dropdown_items??[];return o.length?l(C,{item:{href:n.url,label:i(n.label),plainLabel:n.label,dropdownItems:o.map(e=>({href:e.url,label:i(e.label),plainLabel:e.label,description:e.description,image:e.image,badge:e.badge})),dropdownAside:E(c?.dropdown_aside)}}):a?l(s,{item:n,label:"",link:d.rowLink,current:!0,children:l(h,{className:d.row,hidden:!0})}):l(s,{item:n,label:"",link:` ${b}`})}export{j as MenuPlaceContext,B as default};
|
|
@@ -8,6 +8,8 @@ import { type GridSource } from "../../lib/wheels/grid-source.js";
|
|
|
8
8
|
export interface AlloyWheelsListingProps {
|
|
9
9
|
filterLook?: unknown;
|
|
10
10
|
filterLookPhone?: unknown;
|
|
11
|
+
filterLabel?: string;
|
|
12
|
+
filterFloat?: string | null;
|
|
11
13
|
cellLook?: unknown;
|
|
12
14
|
titleLevel?: number;
|
|
13
15
|
heading?: string;
|
|
@@ -40,4 +42,4 @@ export declare const PLP_GATE_DEFAULTS: {
|
|
|
40
42
|
readonly heading: "Let's find wheels that fit your car.";
|
|
41
43
|
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.";
|
|
42
44
|
};
|
|
43
|
-
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, source, products, wheels, addressQuery, editing, ownerId, template, facetTemplate, railTemplate, railHeadTemplate, hover, titleLevel, omitHead, cellLook, filterLook, filterLookPhone, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
45
|
+
export default function AlloyWheelsListing({ heading, intro, askForCar, gateHeading, gateIntro, perPage, columns, defaultSort, hiddenFacets, fieldUsage, showPrice, showInStock, kinds, source, products, wheels, addressQuery, editing, ownerId, template, facetTemplate, railTemplate, railHeadTemplate, hover, titleLevel, omitHead, cellLook, filterLook, filterLookPhone, filterLabel, filterFloat, }: AlloyWheelsListingProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as l,Fragment as fe}from"react/jsx-runtime";import{useScopeClass as lt}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as ct,useMemo as s,useRef as at,useState as pt}from"react";import{cardHoverOf as mt}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as dt}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as ut}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as ft,answersForKind as he}from"../../lib/content/field-usage.js";import{useCurrency as ht}from"../CurrencyContext.js";import gt from"../NoCurrencyNote.js";import{usePreviewDevice as yt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as St,renderHeadline as xt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as bt}from"../useProductCatalog.js";import{scrollBehavior as wt}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as Pt,PLP_GRID_GAP_VAR as kt,plpGridVars as vt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as Nt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as Ct,cardRowsGridStyle as Tt}from"../WheelCardFrame.js";import{applyPlpFilters as _t,buildPlpFacets as At,buildPlpTypeOptions as Lt,buildTyreSizeBoxes as Ft,EMPTY_PLP_FILTERS as ge,hasActivePlpFilters as zt,paginatePlp as It,pickTyreSize as Ot,plpTyreSizeBoxesShown as Mt,plpInStockCount as Rt,plpOpeningSort as Vt,plpPriceBounds as Et,plpShownKinds as Gt,plpSortKeysFor as Kt,PLP_SORT_LABELS as jt}from"../../lib/wheels/plp-filters.js";import{itemKind as I,itemSlug as Bt,itemTyreSizes as Dt,plpBrandVaries as Wt,plpProcessVaries as $t,plpItemsOfKinds as Yt,plpKindNoun as ye,resolvePlpKinds as Ht}from"../../lib/catalog/plp-item.js";import{plpGateWords as qt,plpVehicleCopy as Jt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Qt,oemTyreSizes as Ut}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as Xt}from"../../lib/wheels/plp-fitment-match.js";import Zt from"./PlpActiveChips.js";import{GridCardProvider as eo,GridMixedCards as to,gridIndexCss as oo,LISTING_CARD_RULES as ro}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as no}from"../ProductCardEyebrow.js";import io from"./PlpPagination.js";import so from"./PlpSidebar.js";import lo from"./PlpFilterButton.js";import{plpFilterViews as co}from"../../lib/sections/shopper-filters.js";import{PlpResultRange as ao,PlpToolbar as po}from"./PlpToolbar.js";import mo from"../catalog/SortSelect.js";import uo from"./PlpVehicleBar.js";import fo from"./PlpVehicleGate.js";import{useVehicleCatalog as ho}from"./useVehicleCatalog.js";import{useVehicleFit as go}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as yo}from"./usePlpFiltersInUrl.js";import{productContentOf as So,rowsForGridSource as xo}from"../../lib/wheels/grid-source.js";import{say as D}from"efficient-web-builder/format/lib/editor-words";import{ALLOY_WHEELS_LISTING_TYPE as Se}from"../../lib/document/document-nodes.js";import{withRootPad as bo}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSectionPad as wo}from"../SectionPadScope.js";const mr={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 Po({level:k,className:v,children:N}){const O=dt(k);return o(O,{className:v,children:N})}const ko=mt({},Se),xe="px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]";function vo({heading:k="",intro:v="",askForCar:N=!0,gateHeading:O="",gateIntro:be="",perPage:W=24,columns:we,defaultSort:Pe="recommended",hiddenFacets:$=[],fieldUsage:h=ft,showPrice:Y=!0,showInStock:ke=!0,kinds:ve,source:H,products:Ne,wheels:Ce,addressQuery:Te,editing:d=!1,ownerId:q="",template:_e,facetTemplate:Ae,railTemplate:Le,railHeadTemplate:Fe,hover:ze=ko,titleLevel:Ie,omitHead:M=!1,cellLook:J,filterLook:Oe,filterLookPhone:Me}){const{currency:a}=ht(),Q=wo(),u=Ht(ve),U=yt(),X=Pt(we),Re=vt(X,d?U:null),Ve=Nt(X,d?U:null),Z=lt("plp"),Ee=oo(Z),Ge=bt(),ee=Ne??Ce??Ge??[],x=So(H)==="category"?H?.name??"":null,te=s(()=>{const t=Yt(ee,u);return x===null?t:xo({name:x},t)},[ee,u.join(","),x]),r=go({editing:d,enabled:N,autoApply:!0}),[Ke,R]=pt(!1),je=Vt(Pe,u),g=r.applied?.vehicle??null,[_,b]=yo({editing:d,openingSort:je,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:Te}),e=s(()=>x===null||_.collections.length===0?_:{..._,collections:[]},[_,x]),p=Gt(u,e.kind),n=m(t=>b(t),[b]),oe=m((t,f)=>{const c=e[t],it=c.map(String).includes(f)?c.filter(st=>String(st)!==f):[...c,t==="diameters"?Number(f):f];n({...e,[t]:it,page:1})},[e,n]),re=m(t=>n({...e,priceMin:t,page:1}),[e,n]),ne=m(t=>n({...e,priceMax:t,page:1}),[e,n]),ie=m(t=>n({...e,inStockOnly:t,page:1}),[e,n]),se=m(t=>n({...ge,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),Be=m(t=>n({...e,sort:t,page:1}),[e,n]),De=m(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:wt()})},[e,n]),le=m(()=>n({...ge,sort:e.sort}),[e.sort,n]),{clear:A}=r,ce=m(()=>{A(),R(!0),b(t=>({...t,page:1}))},[A]),We=m(()=>{A(),R(!1),b(t=>({...t,page:1}))},[A]),L=g?[g.make,g.model,g.year,g.modification].join("|"):"",F=at(null);ct(()=>{if(r.restored){if(F.current===null){F.current=L;return}F.current!==L&&(F.current=L,b(t=>t.page===1?t:{...t,page:1}))}},[r.restored,L,b]);const{items:z,failed:ae,retry:$e}=ho({catalog:te,shownKinds:u,vehicle:g,editing:d}),i=s(()=>{if(!r.fit)return z;const t=z.filter(c=>I(c)==="alloy-wheel"),f=new Set(Xt(t,r.fit).map(c=>c.slug));return z.filter(c=>I(c)!=="alloy-wheel"||f.has(Bt(c)))},[z,r.fit]),w=(x===null?$:[...$,"collections"]).join(","),Ye=s(()=>{const t=new Set(w?w.split(","):[]);return At(i,e,a,p,h).filter(f=>!t.has(f.key))},[i,e,a,w,p.join(","),h]),y=s(()=>_t(i,e,a),[i,e,a]),He=p.length>1,pe=s(()=>he(h,"alloy-wheel"),[h]),qe=s(()=>he(h,"tyre"),[h]),V=s(()=>Wt(y),[y]),E=s(()=>$t(y),[y]),G=He?ye(["alloy-wheel"]).one:null,Je=s(()=>({kindLabel:G,brand:V,process:E}),[G,V,E]),Qe=no({kind:!!G,brand:V,process:E},pe),Ue=s(()=>Y?Et(i,a):null,[i,a,Y]),Xe=s(()=>Rt(i,e,a),[i,e,a]),Ze=s(()=>Lt(i,u,e,a),[i,u.join(","),e,a]),et=m((t,f)=>{const c=Ot(i.flatMap(Dt),e.tyreSizes[0]??"",t,f);n({...e,tyreSizes:c?[c]:[],page:1})},[i,e,n]),tt=s(()=>{const t=new Set(w?w.split(","):[]);return!Mt(i,p)||t.has("tyreSizes")?null:Ft(i,e,a)},[i,e,a,w,p.join(","),h]),S=s(()=>It(y,e.page,W),[y,e.page,W]),P=ye(p),K=Jt(p),me=qt(O,be,p,u),de=p.length===1&&p[0]==="tyre",ue=r.applied?.stock??null,C=s(()=>Ut(ue),[ue]),ot=s(()=>i.filter(t=>p.includes(I(t))).length,[i,p.join(",")]),j=te.length===0,rt=!j&&i.length===0,nt=N&&!d&&!r.applied&&!Ke;if(u.length===0)return null;const B=o(so,{facets:Ye,filters:e,typeOptions:Ze,sizeBoxes:tt,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:P,priceBounds:Ue,inStockCount:ke?Xe:null,onToggle:oe,onPickType:se,onPickSize:et,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onClearAll:le,owner:{id:q,facetTemplate:Ae,railTemplate:Le,railHeadTemplate:Fe},editing:d}),T=co(Oe,Me);return l("section",{children:[N&&o(uo,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:de&&C.length>0?`Takes ${C.join(" · ")}`:null,resolving:r.resolving,unresolved:de?!!r.applied&&!r.resolving&&C.length===0:r.unresolved,matchCount:ot,copy:K,onAmend:We,onClear:ce,cellLook:J}),nt&&o(fo,{cascade:r.cascade,heading:me.heading,intro:me.intro,ready:r.restored,copy:K,onSkip:()=>R(!0),cellLook:J}),l("div",{...Q?bo(M?"":xe,Q):{className:M?void 0:xe},children:[!M&&(k||v)&&l("header",{className:"mb-6",children:[k&&o(Po,{level:Ie,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:xt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:St(v)})]}),l("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[T.rail===""?B:T.rail!==null&&o("div",{className:T.rail,children:B}),l("div",{className:"min-w-0 flex-1",children:[o(po,{className:"mb-4",start:l(fe,{children:[o(ao,{total:S.total,range:{from:S.from,to:S.to},noun:P}),o(Zt,{filters:e,onToggle:oe,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onPickType:se})]}),end:l(fe,{children:[T.button!==null&&o("div",{className:T.button||void 0,children:o(lo,{filters:e,editing:d,children:B})}),o(mo,{value:e.sort,keys:Kt(u),labels:jt,onChange:Be})]})}),ae&&!j&&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:$e,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"})]}),j?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?P.many==="wheels"?D("No wheels in this website's catalog yet — curate products to see them here."):P.many==="tyres"?D("No tyres in this website's catalog yet — curate products to see them here."):D("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):rt?ae?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:K.nothingFits}),l("button",{type:"button",onClick:ce,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 ",P.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 ",P.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."}),zt(e)&&o("button",{type:"button",onClick:le,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(eo,{value:{ownerId:q,ownerType:Se,Template:_e,hover:ze,imageSizes:Ve,fieldUsage:pe,tyreFieldUsage:qe,reserveEyebrow:Qe,editing:d,eyebrow:Je,fit:r.fit,colours:e.finishes,rules:ro},children:[o("style",{children:Ee}),o("div",{className:`plp-card-grid ${Z} ${Ct} ${ut}`,style:{...Re,...Tt(`var(${kt})`)},children:o(to,{items:S.items,tyreOf:t=>I(t)==="tyre"?t:null,tyreFit:t=>C.length>0?Qt(t.sizes,C):null})})]}),o(io,{page:S.page,pageCount:S.pageCount,onPage:De}),o(gt,{editing:d})]})]})]})]})}export{mr as PLP_GATE_DEFAULTS,vo as default};
|
|
1
|
+
"use client";import{jsx as o,jsxs as l,Fragment as fe}from"react/jsx-runtime";import{useScopeClass as at}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as pt,useMemo as s,useRef as mt,useState as dt}from"react";import{cardHoverOf as ut}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as ft}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as ht}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as gt,answersForKind as he}from"../../lib/content/field-usage.js";import{useCurrency as yt}from"../CurrencyContext.js";import St from"../NoCurrencyNote.js";import{usePreviewDevice as xt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as bt,renderHeadline as wt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as Pt}from"../useProductCatalog.js";import{scrollBehavior as kt}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as vt,PLP_GRID_GAP_VAR as Nt,plpGridVars as Ct}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as Tt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as _t,cardRowsGridStyle as At}from"../WheelCardFrame.js";import{applyPlpFilters as Lt,buildPlpFacets as Ft,buildPlpTypeOptions as zt,buildTyreSizeBoxes as It,EMPTY_PLP_FILTERS as ge,hasActivePlpFilters as Ot,paginatePlp as Mt,pickTyreSize as Rt,plpTyreSizeBoxesShown as Vt,plpInStockCount as Et,plpOpeningSort as Gt,plpPriceBounds as Kt,plpShownKinds as jt,plpSortKeysFor as Bt,PLP_SORT_LABELS as Dt}from"../../lib/wheels/plp-filters.js";import{itemKind as I,itemSlug as Wt,itemTyreSizes as $t,plpBrandVaries as Yt,plpProcessVaries as Ht,plpItemsOfKinds as qt,plpKindNoun as ye,resolvePlpKinds as Jt}from"../../lib/catalog/plp-item.js";import{plpGateWords as Qt,plpVehicleCopy as Ut}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Xt,oemTyreSizes as Zt}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as eo}from"../../lib/wheels/plp-fitment-match.js";import to from"./PlpActiveChips.js";import{GridCardProvider as oo,GridMixedCards as ro,gridIndexCss as no,LISTING_CARD_RULES as io}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as so}from"../ProductCardEyebrow.js";import lo from"./PlpPagination.js";import co from"./PlpSidebar.js";import ao from"./PlpFilterButton.js";import{plpFilterViews as po}from"../../lib/sections/shopper-filters.js";import{PlpResultRange as mo,PlpToolbar as uo}from"./PlpToolbar.js";import fo from"../catalog/SortSelect.js";import ho from"./PlpVehicleBar.js";import go from"./PlpVehicleGate.js";import{useVehicleCatalog as yo}from"./useVehicleCatalog.js";import{useVehicleFit as So}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as xo}from"./usePlpFiltersInUrl.js";import{productContentOf as bo,rowsForGridSource as wo}from"../../lib/wheels/grid-source.js";import{say as D}from"efficient-web-builder/format/lib/editor-words";import{ALLOY_WHEELS_LISTING_TYPE as Se}from"../../lib/document/document-nodes.js";import{withRootPad as Po}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSectionPad as ko}from"../SectionPadScope.js";const ur={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 vo({level:k,className:v,children:N}){const O=ft(k);return o(O,{className:v,children:N})}const No=ut({},Se),xe="px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]";function Co({heading:k="",intro:v="",askForCar:N=!0,gateHeading:O="",gateIntro:be="",perPage:W=24,columns:we,defaultSort:Pe="recommended",hiddenFacets:$=[],fieldUsage:h=gt,showPrice:Y=!0,showInStock:ke=!0,kinds:ve,source:H,products:Ne,wheels:Ce,addressQuery:Te,editing:d=!1,ownerId:q="",template:_e,facetTemplate:Ae,railTemplate:Le,railHeadTemplate:Fe,hover:ze=No,titleLevel:Ie,omitHead:M=!1,cellLook:J,filterLook:Oe,filterLookPhone:Me,filterLabel:Re,filterFloat:Ve=null}){const{currency:a}=yt(),Q=ko(),u=Jt(ve),U=xt(),X=vt(we),Ee=Ct(X,d?U:null),Ge=Tt(X,d?U:null),Z=at("plp"),Ke=no(Z),je=Pt(),ee=Ne??Ce??je??[],x=bo(H)==="category"?H?.name??"":null,te=s(()=>{const t=qt(ee,u);return x===null?t:wo({name:x},t)},[ee,u.join(","),x]),r=So({editing:d,enabled:N,autoApply:!0}),[Be,R]=dt(!1),De=Gt(Pe,u),g=r.applied?.vehicle??null,[_,b]=xo({editing:d,openingSort:De,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:Te}),e=s(()=>x===null||_.collections.length===0?_:{..._,collections:[]},[_,x]),p=jt(u,e.kind),n=m(t=>b(t),[b]),oe=m((t,f)=>{const c=e[t],lt=c.map(String).includes(f)?c.filter(ct=>String(ct)!==f):[...c,t==="diameters"?Number(f):f];n({...e,[t]:lt,page:1})},[e,n]),re=m(t=>n({...e,priceMin:t,page:1}),[e,n]),ne=m(t=>n({...e,priceMax:t,page:1}),[e,n]),ie=m(t=>n({...e,inStockOnly:t,page:1}),[e,n]),se=m(t=>n({...ge,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),We=m(t=>n({...e,sort:t,page:1}),[e,n]),$e=m(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:kt()})},[e,n]),le=m(()=>n({...ge,sort:e.sort}),[e.sort,n]),{clear:A}=r,ce=m(()=>{A(),R(!0),b(t=>({...t,page:1}))},[A]),Ye=m(()=>{A(),R(!1),b(t=>({...t,page:1}))},[A]),L=g?[g.make,g.model,g.year,g.modification].join("|"):"",F=mt(null);pt(()=>{if(r.restored){if(F.current===null){F.current=L;return}F.current!==L&&(F.current=L,b(t=>t.page===1?t:{...t,page:1}))}},[r.restored,L,b]);const{items:z,failed:ae,retry:He}=yo({catalog:te,shownKinds:u,vehicle:g,editing:d}),i=s(()=>{if(!r.fit)return z;const t=z.filter(c=>I(c)==="alloy-wheel"),f=new Set(eo(t,r.fit).map(c=>c.slug));return z.filter(c=>I(c)!=="alloy-wheel"||f.has(Wt(c)))},[z,r.fit]),w=(x===null?$:[...$,"collections"]).join(","),qe=s(()=>{const t=new Set(w?w.split(","):[]);return Ft(i,e,a,p,h).filter(f=>!t.has(f.key))},[i,e,a,w,p.join(","),h]),y=s(()=>Lt(i,e,a),[i,e,a]),Je=p.length>1,pe=s(()=>he(h,"alloy-wheel"),[h]),Qe=s(()=>he(h,"tyre"),[h]),V=s(()=>Yt(y),[y]),E=s(()=>Ht(y),[y]),G=Je?ye(["alloy-wheel"]).one:null,Ue=s(()=>({kindLabel:G,brand:V,process:E}),[G,V,E]),Xe=so({kind:!!G,brand:V,process:E},pe),Ze=s(()=>Y?Kt(i,a):null,[i,a,Y]),et=s(()=>Et(i,e,a),[i,e,a]),tt=s(()=>zt(i,u,e,a),[i,u.join(","),e,a]),ot=m((t,f)=>{const c=Rt(i.flatMap($t),e.tyreSizes[0]??"",t,f);n({...e,tyreSizes:c?[c]:[],page:1})},[i,e,n]),rt=s(()=>{const t=new Set(w?w.split(","):[]);return!Vt(i,p)||t.has("tyreSizes")?null:It(i,e,a)},[i,e,a,w,p.join(","),h]),S=s(()=>Mt(y,e.page,W),[y,e.page,W]),P=ye(p),K=Ut(p),me=Qt(O,be,p,u),de=p.length===1&&p[0]==="tyre",ue=r.applied?.stock??null,C=s(()=>Zt(ue),[ue]),nt=s(()=>i.filter(t=>p.includes(I(t))).length,[i,p.join(",")]),j=te.length===0,it=!j&&i.length===0,st=N&&!d&&!r.applied&&!Be;if(u.length===0)return null;const B=o(co,{facets:qe,filters:e,typeOptions:tt,sizeBoxes:rt,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:P,priceBounds:Ze,inStockCount:ke?et:null,onToggle:oe,onPickType:se,onPickSize:ot,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onClearAll:le,owner:{id:q,facetTemplate:Ae,railTemplate:Le,railHeadTemplate:Fe},editing:d}),T=po(Oe,Me);return l("section",{children:[N&&o(ho,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:de&&C.length>0?`Takes ${C.join(" · ")}`:null,resolving:r.resolving,unresolved:de?!!r.applied&&!r.resolving&&C.length===0:r.unresolved,matchCount:nt,copy:K,onAmend:Ye,onClear:ce,cellLook:J}),st&&o(go,{cascade:r.cascade,heading:me.heading,intro:me.intro,ready:r.restored,copy:K,onSkip:()=>R(!0),cellLook:J}),l("div",{...Q?Po(M?"":xe,Q):{className:M?void 0:xe},children:[!M&&(k||v)&&l("header",{className:"mb-6",children:[k&&o(vo,{level:Ie,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:wt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:bt(v)})]}),l("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[T.rail===""?B:T.rail!==null&&o("div",{className:T.rail,children:B}),l("div",{className:"min-w-0 flex-1",children:[o(uo,{className:"mb-4",start:l(fe,{children:[o(mo,{total:S.total,range:{from:S.from,to:S.to},noun:P}),o(to,{filters:e,onToggle:oe,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onPickType:se})]}),end:l(fe,{children:[T.button!==null&&o("div",{className:T.button||void 0,children:o(ao,{filters:e,editing:d,label:Re,floating:Ve,children:B})}),o(fo,{value:e.sort,keys:Bt(u),labels:Dt,onChange:We})]})}),ae&&!j&&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:He,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"})]}),j?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?P.many==="wheels"?D("No wheels in this website's catalog yet — curate products to see them here."):P.many==="tyres"?D("No tyres in this website's catalog yet — curate products to see them here."):D("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):it?ae?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:K.nothingFits}),l("button",{type:"button",onClick:ce,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 ",P.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 ",P.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."}),Ot(e)&&o("button",{type:"button",onClick:le,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(oo,{value:{ownerId:q,ownerType:Se,Template:_e,hover:ze,imageSizes:Ge,fieldUsage:pe,tyreFieldUsage:Qe,reserveEyebrow:Xe,editing:d,eyebrow:Ue,fit:r.fit,colours:e.finishes,rules:io},children:[o("style",{children:Ke}),o("div",{className:`plp-card-grid ${Z} ${_t} ${ht}`,style:{...Ee,...At(`var(${Nt})`)},children:o(ro,{items:S.items,tyreOf:t=>I(t)==="tyre"?t:null,tyreFit:t=>C.length>0?Xt(t.sizes,C):null})})]}),o(lo,{page:S.page,pageCount:S.pageCount,onPage:$e}),o(St,{editing:d})]})]})]})]})}export{ur as PLP_GATE_DEFAULTS,Co as default};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type PlpFilterState } from "../../lib/wheels/plp-filters.js";
|
|
3
|
-
export
|
|
3
|
+
export declare const FILTERS_WORD = "Filters";
|
|
4
|
+
export default function PlpFilterButton({ filters, editing, label, floating, children }: {
|
|
4
5
|
filters: PlpFilterState;
|
|
5
6
|
editing?: boolean;
|
|
7
|
+
label?: string;
|
|
8
|
+
floating?: string | null;
|
|
6
9
|
children: ReactNode;
|
|
7
10
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as x,Fragment as v}from"react/jsx-runtime";import{useEffect as E,useRef as P,useState as d}from"react";import{createPortal as L}from"react-dom";import{POPUP_LOOK_DEFAULTS as S}from"efficient-web-builder/format/lib/popup/look";import{PillButton as h}from"../catalog/FilterPill.js";import{CATALOG_TEXT_SIZE as f}from"../../lib/sections/catalog-text-size.js";import T from"../PopupFrame.js";import{PLP_RAIL_WIDTH as A}from"./PlpSidebar.js";import{UTIL_WORDS as C}from"../HeaderTools.js";import{useCurrency as k}from"../CurrencyContext.js";import{formatPrice as F}from"../../lib/commerce.js";import{plpActiveChips as R}from"../../lib/wheels/plp-filters.js";const z="Filters";function N(){const e=parseFloat(getComputedStyle(document.documentElement).getPropertyValue("--sf-header-h"));return Number.isFinite(e)?e:0}function I(e,r){const[s,o]=d(!1);return E(()=>{if(!r||!e)return;const a=e.closest("section")??e,t=()=>{const i=(e.firstElementChild??e).getBoundingClientRect(),l=a.getBoundingClientRect().bottom;o(i.bottom<N()&&l>window.innerHeight/2)};return t(),window.addEventListener("scroll",t,{passive:!0}),window.addEventListener("resize",t),()=>{window.removeEventListener("scroll",t),window.removeEventListener("resize",t)}},[e,r]),r&&s}const O=32,j=A+2*O;function B({filters:e,editing:r=!1,label:s,floating:o=null,children:a}){const t=s?.trim()||z,[i,l]=d(!1),[p,y]=d(null),c=I(p,o!==null),{currency:w}=k(),u=P(null),b=()=>l(!1),g=R(e,w,F).length,_={...S,placement:"left",height:"full",closeButton:"none",width:j};return x(v,{children:[o===null?n(h,{labelSize:f.labelSmall,size:"toolbar",label:t,badge:g,open:i,onToggle:()=>l(m=>!m)}):n("span",{ref:y,className:"contents",children:n(h,{labelSize:f.labelSmall,size:"toolbar",label:t,badge:g,open:i,onToggle:()=>l(m=>!m)})}),o!==null&&p&&L(n("button",{type:"button","data-plp-filter-float":"","aria-hidden":!c,tabIndex:c?0:-1,onClick:()=>l(!0),className:["fixed bottom-8 left-1/2 z-40 inline-flex h-12 -translate-x-1/2 items-center sf-button bg-btn px-6 font-display text-sm font-medium tracking-[0.04em] text-btn-ink transition-[opacity,transform] motion-reduce:transition-none",c?"translate-y-0 opacity-100":"pointer-events-none translate-y-6 opacity-0",o].filter(Boolean).join(" "),children:t}),document.body),i&&n(T,{look:_,drawer:{closeRef:u,lockScroll:!r},open:!0,onClose:b,label:t,children:x("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:[n("div",{className:"relative z-10 -mb-4 flex shrink-0 justify-end",children:n("button",{ref:u,type:"button",onClick:b,className:`inline-flex h-11 items-center font-mono ${f.labelSmall} uppercase tracking-[0.2em] text-fg-dim hover:text-fg`,children:C.close})}),a]})})]})}export{z as FILTERS_WORD,B as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as m}from"react/jsx-runtime";import{FITMENT_CELL_LOOK_PROP as f}from"../../../../sections/fitment-cell-look.js";import{LISTING_FILTER_FLOAT_PROP as T,LISTING_FILTER_LABEL_PROP as _,LISTING_FILTER_LOOK_PROP as t,parseListingFilterLook as E,parseListingFilterLookPhone as I,plpFilterFloatViews as P}from"../../../../sections/shopper-filters.js";import{phoneKey as i}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 o}from"efficient-easel/screen/lib/document/hidable";import{asPlpSortKey as c,listingHiddenFacets as O}from"../../../../wheels/plp-filters.js";import{addressQueryOf as s}from"../../../../wheels/selected-ranges.js";import{cardHoverOf as A}from"efficient-web-builder/format/lib/animation/hover";import{phHide as n}from"efficient-web-builder/render/lib/document/blocks/scaffold";import{headInOwnBox as F}from"efficient-web-builder/render/lib/sections/section-to-box";import{FACET_TEMPLATE_SLOT as S}from"../../../../content/facet-row-seed.js";import{RAIL_HEAD_TEMPLATE_SLOT as u,RAIL_TEMPLATE_SLOT as k}from"../../../../content/rail-row-seed.js";import{AlloyWheelsListingMeta as H,ALLOYWHEELSLISTING_PH as d}from"./meta.js";import{ALLOY_WHEELS_LISTING_TYPE as l}from"../../../document-nodes.js";import{padsItself as R}from"../../../pads-itself.js";const D=R(l,{...H,render:e=>{const r=F(e),a=L=>r?void 0:L;return m(h,{titleLevel:e[g],heading:a(n(e.heading,d.heading,e.editor)),intro:a(n(e.intro,d.intro,e.editor)),omitHead:r,askForCar:e.askForCar!==!1,addressQuery:s(e)||void 0,gateHeading:o(e.gateHeading),gateIntro:o(e.gateIntro),perPage:e.perPage,columns:e.columns,defaultSort:c(e.defaultSort),ownerId:typeof e.id=="string"?e.id:"",template:e.template,facetTemplate:e[S],railTemplate:e[k],railHeadTemplate:e[u],hover:A(e,l),cellLook:e[f],filterLook:E(e[t]),filterLookPhone:I(e[i(t)]),filterLabel:o(e[_])||void 0,filterFloat:P(e[i(t)],e[i(T)]),hiddenFacets:O(e),showPrice:e.showPrice,showInStock:e.showInStock!==!1,kinds:e.kinds,source:e.source,products:e.products,wheels:e.wheels,fieldUsage:e.fieldUsage,editing:e.editor?.isEditing})}});export{D as AlloyWheelsListingRender};
|
|
@@ -16,6 +16,13 @@
|
|
|
16
16
|
"placeholder": "Filter by brand, colour, size and fitment to find your set."
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
|
+
"filterLabel": {
|
|
20
|
+
"type": "custom",
|
|
21
|
+
"__text": {
|
|
22
|
+
"control": "plainText",
|
|
23
|
+
"label": "Button"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
19
26
|
"gateHeading": {
|
|
20
27
|
"type": "custom",
|
|
21
28
|
"__text": {
|
|
@@ -80,5 +80,8 @@ export declare function plpFilterViews(look: unknown, lookPhone: unknown): {
|
|
|
80
80
|
rail: string | null;
|
|
81
81
|
button: string | null;
|
|
82
82
|
};
|
|
83
|
+
export declare const LISTING_FILTER_LABEL_PROP = "filterLabel";
|
|
84
|
+
export declare const LISTING_FILTER_FLOAT_PROP = "filterFloat";
|
|
85
|
+
export declare function plpFilterFloatViews(lookPhone: unknown, floatPhone: unknown): string | null;
|
|
83
86
|
export declare function parseShownFilters(value: unknown): ShownFilter[];
|
|
84
87
|
export declare function parseOpeningSort(value: unknown): PlpSortKey;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEFAULT_CATALOG_FILTER_LABELS as a}from"../content/catalog-filter-labels.js";import{STOCK_WORDS as
|
|
1
|
+
import{DEFAULT_CATALOG_FILTER_LABELS as a}from"../content/catalog-filter-labels.js";import{STOCK_WORDS as b}from"../content/stock-words.js";import{parseOption as l}from"efficient-shell/format";import{viewHideClass as p}from"efficient-web-builder/format/lib/content/view-hide-class";import{asPlpSortKey as E}from"../wheels/plp-filters.js";const u=[{value:"bar-pills",label:"Bar · pills"},{value:"bar-columns",label:"Bar · columns"},{value:"rail",label:"Side rail"},{value:"button",label:"Filters button"}],S="bar-pills",L=[{value:"bar",label:"Bar"},{value:"button",label:"Filters button"},{value:"rail",label:"Side rail"}],d="bar",x=[{value:"inStock",label:b.inStock},{value:"category",label:"Category"},{value:"lugs",label:a.lugs},{value:"price",label:a.price}],k=["inStock","category","lugs","price"],v="recommended";function w(e){return l(u.map(o=>o.value),S,typeof e=="string"?e:void 0)}function y(e){return l(L.map(o=>o.value),d,typeof e=="string"?e:void 0)}const i=["rail","button"],K="filterLook",g="rail",c=e=>i.includes(e.value),G=u.filter(c),D=L.filter(c);function O(e){return l(i,g,typeof e=="string"?e:void 0)}const _=O,N="lg:flex-none lg:self-stretch";function H(e,o){const r=O(e),f=_(o),I=t=>t.desk&&t.phone?"":t.desk||t.phone?p({desktop:!t.desk,tablet:!t.desk,mobile:!t.phone}):null,s=t=>I({desk:r===t,phone:f===t}),T=t=>t&&`${t} ${N}`,n={rail:null,button:null};for(const t of i)switch(t){case"rail":n.rail=T(s(t));break;case"button":n.button=s(t);break;default:{const F=t;throw new Error(`no drawing for listing look ${String(F)}`)}}return n}const U="filterLabel",B="filterFloat";function C(e,o){return o!==!0||_(e)!=="button"?null:p({desktop:!0,tablet:!0,mobile:!1})}function W(e){if(!Array.isArray(e))return[...k];const o=new Set(x.map(r=>r.value));return e.filter(r=>typeof r=="string"&&o.has(r))}function V(e){return E(typeof e=="string"?e:void 0)}export{S as DEFAULT_FILTER_LOOK,d as DEFAULT_FILTER_LOOK_PHONE,g as DEFAULT_LISTING_FILTER_LOOK,v as DEFAULT_OPENING_SORT,k as DEFAULT_SHOWN_FILTERS,u as FILTER_LOOK_OPTIONS,L as FILTER_LOOK_PHONE_OPTIONS,B as LISTING_FILTER_FLOAT_PROP,U as LISTING_FILTER_LABEL_PROP,i as LISTING_FILTER_LOOKS,G as LISTING_FILTER_LOOK_OPTIONS,D as LISTING_FILTER_LOOK_PHONE_OPTIONS,K as LISTING_FILTER_LOOK_PROP,x as SHOWN_FILTER_OPTIONS,c as isListingFilterLook,w as parseFilterLook,y as parseFilterLookPhone,O as parseListingFilterLook,_ as parseListingFilterLookPhone,V as parseOpeningSort,W as parseShownFilters,C as plpFilterFloatViews,H as plpFilterViews};
|