efficient-storefront-blocks 0.135.1 → 0.135.2

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.
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as m,Fragment as S}from"react/jsx-runtime";import{partSkus as Ge}from"../lib/catalog/part-skus.js";import pe from"next/link";import{useEffect as z,useRef as de,useState as Qe}from"react";import{useCart as Xe}from"./CartContext.js";import{useSiteTakesOrders as qe}from"./SiteRecordContext.js";import Je from"./EmailCaptureForm.js";import{useEnglish as ue}from"./EnglishVariant.js";import{MarkedLabel as fe,heroView as Ze}from"./product-hero/hero-view.js";import{HeroOptionLooksProvider as et,OptionDropdown as tt,OptionLabel as he,optionWords as lt,useHeroOptionLooks as at}from"./product-hero/OptionLooks.js";import{DEFAULT_HERO_OPTION_LOOKS as nt}from"../lib/sections/hero-option-looks.js";import{useRootIsDark as st}from"efficient-shell/theme";import{useStockAlertSignup as rt}from"./useStockAlertSignup.js";import{SPARE_WORDS as it,productCartLine as ot}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as U}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as mt}from"../lib/catalog/product-options.js";import{trackViewItem as ct}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as pt,DEFAULT_HERO_RATIO as dt,DEFAULT_HERO_TEXT_ALIGN as ut,parseHeroLayout as ft,parseHeroRatio as ht,parseHeroTextAlign as bt}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as gt,UNITS_PER_SET as be,formatPrice as ge,spareAxleOf as xt}from"../lib/commerce.js";import{formatSelectionPrice as xe,formatSparePrice as vt}from"../lib/wheels/price-display.js";import{productIsDually as Tt,productIsTwoObjects as kt,setSuppressesRow as yt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ve}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as St,STICKY_SECTION_ATTR as Ot}from"../lib/sections/hero-sticky.js";import{STAGE_EDGE_ATTR as _t,stageEdgeClass as Nt,stageEdgeCols as Rt}from"../lib/sections/hero-stage-edge.js";import{useStickyColumns as Et}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as Lt}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as j}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as F}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as wt}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as At}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as Ct,HERO_TILE_SLOT as It}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as $t,HERO_QUANTITY_PART as Pt,HERO_SAVE_PART as Ht}from"../lib/content/hero-buy-seed.js";import{HERO_PART as v}from"../lib/content/hero-seed.js";import Dt from"./card-pieces/CardQuantity.js";import Mt from"./card-pieces/CardSave.js";import zt from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as Ut}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as K}from"../lib/document/document-nodes.js";import{withSideOnce as Te}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as jt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as ke}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as Ft}from"./SectionPadScope.js";const Kt=4e3;function Vt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ye=[{}],Bt=(e,s)=>s===Pt?t(Dt,{}):s===Ht?t(Mt,{}):null,Wt="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Yt({product:e,selection:s,onLightbox:i,editing:r=!1,showVehicleFitment:o=!0,heroLayout:p=pt,imageRatio:d=dt,textAlign:l=ut,showSpecTable:n=!0,stickyColumns:f=!1,stageToEdge:Oe=!1,showBreadcrumb:V=!0,nodeId:N,template:_e,optionTemplate:Ne,optionPressTitles:Re,tileTemplate:Ee,buyTemplate:Le,optionLooks:B=nt,spareWords:we,startChosen:R=!1}){const W=jt(),Ae=ue(),h=ft(p),Y=bt(l),y=ht(d),E=f===!0&&h!=="stacked",O=Oe===!0&&h!=="stacked",G=de(null);Et(G,E);const Ce=O?Rt(y,h==="imageRight"):h==="imageRight"?`${100-y}fr ${y}fr`:`${y}fr ${100-y}fr`,L=O?{gap:"",y:"",yTablet:""}:{gap:"gap-10 ",y:"py-14 ",yTablet:"max-view-tablet:py-8 "},{picked:Ie,pick:Q,qty:X,setQty:$e,choice:q,setChoice:Pe,angleIdx:el,setAngleIdx:tl,showValidation:He,setShowValidation:w,manualMode:J,vehicle:A,rows:Z,facts:De,part:b,outOfStock:ee,offer:C,preOrder:I,canAddToCart:te,currency:g,price:c,set:le,msrpLabel:Me}=s,u=Ze(e,s,r),{chooseStart:ze}=s;z(()=>{R&&ze()},[R,e.slug]);const ae=Tt(e),Ue=kt(e),$=o?u.vehicle:null,je=o?u.vehicleMemory:null,ne=!st({whenUnset:!0}),{warmCatalog:se}=Xe(),_=qe();z(()=>{!r&&_&&se(e.kind,e.slug)},[r,_,e.kind,e.slug,se]);const re=Z.filter(a=>!I||a.values.length>0),ie=re.filter(a=>a.role==="resolves"),P=re.filter(a=>a.role==="describes"&&!yt(Ue,a.key)),oe=P.findIndex(a=>a.chosen===null),me=(!$||!u.vehicleAnswersSpecs||s.fitmentSet)&&mt(Z,I)?oe===-1?P:P.slice(0,oe+1):[],Fe=[...ie,...me];function Ke(){return te?(w(!1),r?null:ot(e,b,Ie,{choice:q,qty:X},{fitmentLabel:J?u.specCaption:A.appliedName?`For ${A.appliedName}`:"",fitmentKey:J?`manual|${u.specCaption}`:`vehicle|${Vt(A.applied?.vehicle)}`})):(w(!0),window.setTimeout(()=>w(!1),Kt),null)}const Ve={kind:"hero",msrpLabel:Me||null,amount:xe(c,g),unitLabel:c.priced?u.unitLabel:null,packBadge:c.setTotal!=null?`${C.quantityLabel}: ${ge(le,g)}`:null,buy:{isSet:ae,priced:c.priced,outOfStock:ee,canAdd:te,totalLabel:c.setTotal!=null?ge(le,g):null,lineToAdd:Ke},qty:X,setQty:$e,takesQty:_&&!(ae&&!c.priced),save:{slug:e.slug,name:e.name},facts:n?De:null,title:{eyebrow:e.eyebrow,name:u.heading,badge:e.badge||null},product:e,selection:s,openLightbox:i,sku:Ge(b),designCode:e.kind==="alloy-wheel"&&e.source.designCode||null,setLine:Xt(c,Qt(C.quantityLabel,e.kind),g),startChosen:R},H={nodeId:N??"",template:Ne,tileTemplate:Ee,pressTitles:Re,editing:r},x=!!(I&&u.preOrder),Be={[v.fitmentLine]:je,[v.options]:m(et,{looks:B,children:[ie.map(a=>t(Se,{row:a,onPick:Q,options:H},a.key)),!x&&$,!x&&me.map(a=>t(Se,{row:a,onPick:Q,options:H},a.key))]}),[v.facts]:x?null:t(zt,{}),[v.howMany]:x?null:t(Jt,{offer:C,asksSpares:_&&c.priced,choice:q,setChoice:Pe,options:H,spareLook:B.spare,spareWords:we,spareCost:c.priced?vt(c,g):null}),[v.buy]:x?u.preOrder:t(F,{children:t(j,{ownerId:N??"",ownerType:K,slot:$t,Template:Le,rows:ye,fallback:null,hostParts:Bt,children:a=>a})}),[v.notify]:!x&&ee&&c.priced&&b?t(Zt,{partNumbers:b.components.map(a=>a.partNumber),productSlug:e.slug},b.id):null,[v.reminder]:!x&&He?Ye():null},We=(a,T)=>Be[T]??null;function Ye(){const a=Fe.filter(M=>M.chosen===null).map(M=>Ae(M.prompt).replace(/^Select\s+/i,""));if($&&u.vehicleAnswersSpecs&&!s.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const T=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return m("p",{role:"alert",className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em]",style:{color:"var(--alert)"},children:["Please select ",T," first."]})}const ce=de(null);z(()=>{r||ce.current===e.slug||(ce.current=e.slug,ct({itemId:b?`${e.slug}|${b.id}`:e.slug,itemName:e.name,variant:u.metaValue,pricePerSet:c.setTotal??c.fromSetTotal??0,currency:g}))},[r,e.slug,e.name,u.metaValue,b,c,g]);const D=Ft();return m(S,{children:[V&&t("nav",{...ke(Te(`border-b border-line ${ve} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,W),D?.first?.atTop,ne?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,T)=>m("span",{children:[T>0&&m(S,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(pe,{href:a.href,className:"hover:text-fg",children:t(fe,{text:a.label})}):t("span",{className:"text-fg",children:t(fe,{text:a.label})})]},`${a.label}-${T}`))}),t("section",{ref:G,"data-hero-layout":h,"data-hero-align":Y,...E?{[Ot]:""}:{},...O?{[_t]:""}:{},...ke([Te(`grid ${L.gap}${ve} ${L.y}max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] ${L.yTablet}${Wt}`,W),Y==="center"?Lt.center:"",h==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",E?St:"",O?Nt(h==="imageRight"):""].filter(Boolean).join(" "),V?D?.second?.atTop:D?.secondOnly?.atTop,{...ne?{}:{background:"var(--section-bg)"},...h==="stacked"?{}:{"--hero-cols":Ce}}),children:t(Ut,{value:Ve,children:t(F,{children:t(j,{ownerId:N??"",ownerType:K,Template:_e,rows:ye,fallback:null,hostParts:We,children:a=>a})})})})]})}const Gt="wheels";function Qt(e,s){return s==="alloy-wheel"&&/\d$/.test(e)?`${e} ${Gt}`:e}function Xt(e,s,i){if(!e.priced)return null;const r=e.setTotal==null?e.openSettled?.setTotal??null:null,o=e.setTotal??r??e.fromSetTotal;return o==null?null:{label:s,total:xe({...e,unit:o,isFrom:e.setTotal==null&&r==null},i)}}const qt={caps:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em]",plain:"font-body text-[length:var(--size-body,13px)]"};function Jt({offer:e,asksSpares:s,choice:i,setChoice:r,options:o,spareLook:p,spareWords:d,spareCost:l}){return e.packs.length>0||s&&(e.extra||e.spareCounts.length>0)?m("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&m(S,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:o,values:e.packs,item:n=>({label:n.label}),picked:n=>i.unit===n.value,press:n=>()=>r(f=>({...f,unit:n.value}))})})]}),s&&e.extra&&m("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 ${qt[p]} text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:n=>r(f=>({...f,spares:n.target.checked?gt:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),d?.trim()||e.extra.label,l&&t("span",{className:"ml-auto whitespace-nowrap",children:l})]}),s&&e.spareCounts.length>0&&m(S,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:it.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(k,{hero:o,values:e.spareCounts,item:n=>({label:`${n.value} · ${n.label}`}),picked:n=>i.spares===n.value-be,press:n=>()=>r(f=>({...f,spares:n.value-be}))})})]}),s&&e.spareSide&&m(S,{children:[t("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.spareSide.label}),t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:o,values:e.spareSide.options,item:n=>({label:n.label}),picked:n=>i.spareSide===n.value&&(n.axle===void 0||xt(i)===n.axle),press:n=>()=>r(f=>({...f,spareSide:n.value,...n.axle?{spareAxle:n.axle}:{}}))})})]})]}):null}function Se({row:e,onPick:s,options:i}){const r=ue(),o=at();if(e.values.length===0&&!e.empty)return null;const p=e.values.find(l=>l.value===e.chosen),d=p&&[p.label,p.note].filter(Boolean).join(" · ");return e.values.length>0&&e.display==="swatch"&&o.finish==="tiles"?m("div",{[U]:e.key,children:[t(he,{label:r(e.label),chosen:p?.label}),t("div",{className:"flex flex-wrap gap-2","data-option-tiles":"",children:t(k,{hero:i,tiles:!0,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),label:l=>l.label,picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]}):e.values.length>0&&e.display==="pill"&&e.role==="resolves"&&o.size==="dropdown"?m("div",{[U]:e.key,children:[t(he,{label:r(e.label)}),t(tt,{rowKey:e.key,label:r(e.label),shown:d||r(e.prompt),items:e.values.map(l=>({value:l.value,label:lt(l)})),value:e.chosen??"",onPick:l=>s(e.key,l),editing:i.editing})]}):m("div",{className:"border-b border-line pb-[26px]",[U]:e.key,children:[m("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[r(e.label)," · ",t("span",{className:"text-accent",children:d??r(e.prompt)})]}),e.values.length===0?m("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",t(pe,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?t("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:t(k,{hero:i,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:i,values:e.values,item:l=>({label:l.label,note:l.note??""}),picked:l=>l.value===e.chosen,press:l=>()=>s(e.key,l.value)})})]})}function k({hero:e,values:s,item:i,label:r,picked:o,press:p,tiles:d=!1}){const l=At(s,{item:i,selected:o,press:p,label:r});return t(F,{children:t(j,{ownerId:e.nodeId,ownerType:K,slot:d?It:Ct,Template:d?e.tileTemplate:e.template,rows:l.items.map(wt),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:d?void 0:e.pressTitles,fallback:null,children:n=>n})})}function Zt({partNumbers:e,productSlug:s}){const[i,r]=Qe(""),{status:o,submit:p,reset:d}=rt();function l(){p({partNumbers:e,email:i,productSlug:s})}return o==="sent"?t("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):t(Je,{className:"-mt-1",email:i,onEmailChange:r,status:o,onResetVerdict:d,onSubmit:l,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{Yt as default};
1
+ "use client";import{jsx as t,jsxs as m,Fragment as S}from"react/jsx-runtime";import{partSkus as Qe}from"../lib/catalog/part-skus.js";import pe from"next/link";import{useEffect as U,useRef as de,useState as Xe}from"react";import{useCart as qe}from"./CartContext.js";import{useSiteTakesOrders as Je}from"./SiteRecordContext.js";import Ze from"./EmailCaptureForm.js";import{useEnglish as ue}from"./EnglishVariant.js";import{carStillToPick as et}from"./product-hero/CarPickerRow.js";import{MarkedLabel as fe,heroView as tt}from"./product-hero/hero-view.js";import{HeroOptionLooksProvider as lt,OptionDropdown as at,OptionLabel as he,optionWords as nt,useHeroOptionLooks as st}from"./product-hero/OptionLooks.js";import{DEFAULT_HERO_OPTION_LOOKS as rt}from"../lib/sections/hero-option-looks.js";import{useRootIsDark as it}from"efficient-shell/theme";import{useStockAlertSignup as ot}from"./useStockAlertSignup.js";import{SPARE_WORDS as mt,productCartLine as ct}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as z}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as pt}from"../lib/catalog/product-options.js";import{trackViewItem as dt}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as ut,DEFAULT_HERO_RATIO as ft,DEFAULT_HERO_TEXT_ALIGN as ht,parseHeroLayout as bt,parseHeroRatio as gt,parseHeroTextAlign as xt}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as vt,UNITS_PER_SET as be,formatPrice as ge,spareAxleOf as Tt}from"../lib/commerce.js";import{formatSelectionPrice as xe,formatSparePrice as kt}from"../lib/wheels/price-display.js";import{productIsDually as yt,productIsTwoObjects as St,setSuppressesRow as Ot}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ve}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as _t,STICKY_SECTION_ATTR as Nt}from"../lib/sections/hero-sticky.js";import{STAGE_EDGE_ATTR as Rt,stageEdgeClass as Et,stageEdgeCols as Lt}from"../lib/sections/hero-stage-edge.js";import{useStickyColumns as wt}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as At}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as j}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as F}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as Ct}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as It}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as $t,HERO_TILE_SLOT as Pt}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as Ht,HERO_QUANTITY_PART as Dt,HERO_SAVE_PART as Mt}from"../lib/content/hero-buy-seed.js";import{HERO_PART as v}from"../lib/content/hero-seed.js";import Ut from"./card-pieces/CardQuantity.js";import zt from"./card-pieces/CardSave.js";import jt from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as Ft}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as K}from"../lib/document/document-nodes.js";import{withSideOnce as Te}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as Kt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as ke}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as Vt}from"./SectionPadScope.js";const Bt=4e3;function Wt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ye=[{}],Yt=(e,n)=>n===Dt?t(Ut,{}):n===Mt?t(zt,{}):null,Gt="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Qt({product:e,selection:n,onLightbox:i,editing:r=!1,showVehicleFitment:o=!0,heroLayout:p=ut,imageRatio:d=ft,textAlign:l=ht,showSpecTable:s=!0,stickyColumns:f=!1,stageToEdge:_e=!1,showBreadcrumb:V=!0,nodeId:N,template:Ne,optionTemplate:Re,optionPressTitles:Ee,tileTemplate:Le,buyTemplate:we,optionLooks:B=rt,spareWords:Ae,startChosen:R=!1}){const W=Kt(),Ce=ue(),h=bt(p),Y=xt(l),y=gt(d),E=f===!0&&h!=="stacked",O=_e===!0&&h!=="stacked",G=de(null);wt(G,E);const Ie=O?Lt(y,h==="imageRight"):h==="imageRight"?`${100-y}fr ${y}fr`:`${y}fr ${100-y}fr`,L=O?{gap:"",y:"",yTablet:""}:{gap:"gap-10 ",y:"py-14 ",yTablet:"max-view-tablet:py-8 "},{picked:$e,pick:Q,qty:X,setQty:Pe,choice:q,setChoice:He,angleIdx:tl,setAngleIdx:ll,showValidation:De,setShowValidation:w,manualMode:J,vehicle:A,rows:Z,facts:Me,part:b,outOfStock:ee,offer:C,preOrder:I,canAddToCart:te,currency:g,price:c,set:le,msrpLabel:Ue}=n,u=tt(e,n,r),{chooseStart:ze}=n;U(()=>{R&&ze()},[R,e.slug]);const ae=yt(e),je=St(e),$=o?u.vehicle:null,Fe=o?u.vehicleMemory:null,ne=!it({whenUnset:!0}),{warmCatalog:se}=qe(),_=Je();U(()=>{!r&&_&&se(e.kind,e.slug)},[r,_,e.kind,e.slug,se]);const re=Z.filter(a=>!I||a.values.length>0),ie=re.filter(a=>a.role==="resolves"),P=re.filter(a=>a.role==="describes"&&!Ot(je,a.key)),oe=P.findIndex(a=>a.chosen===null),me=(!$||!u.vehicleAnswersSpecs||n.fitmentSet)&&pt(Z,I)?oe===-1?P:P.slice(0,oe+1):[],Ke=[...ie,...me];function Ve(){return te?(w(!1),r?null:ct(e,b,$e,{choice:q,qty:X},{fitmentLabel:J?u.specCaption:A.appliedName?`For ${A.appliedName}`:"",fitmentKey:J?`manual|${u.specCaption}`:`vehicle|${Wt(A.applied?.vehicle)}`})):(w(!0),window.setTimeout(()=>w(!1),Bt),null)}const Be={kind:"hero",msrpLabel:Ue||null,amount:xe(c,g),unitLabel:c.priced?u.unitLabel:null,packBadge:c.setTotal!=null?`${C.quantityLabel}: ${ge(le,g)}`:null,buy:{isSet:ae,priced:c.priced,outOfStock:ee,canAdd:te,totalLabel:c.setTotal!=null?ge(le,g):null,lineToAdd:Ve},qty:X,setQty:Pe,takesQty:_&&!(ae&&!c.priced),save:{slug:e.slug,name:e.name},facts:s?Me:null,title:{eyebrow:e.eyebrow,name:u.heading,badge:e.badge||null},product:e,selection:n,openLightbox:i,sku:Qe(b),designCode:e.kind==="alloy-wheel"&&e.source.designCode||null,setLine:Jt(c,qt(C.quantityLabel,e.kind),g),startChosen:R},H={nodeId:N??"",template:Re,tileTemplate:Le,pressTitles:Ee,editing:r},x=!!(I&&u.preOrder),We={[v.fitmentLine]:Fe,[v.options]:m(lt,{looks:B,children:[ie.map(a=>t(Oe,{row:a,onPick:Q,options:H},a.key)),!x&&$,!x&&me.map(a=>t(Oe,{row:a,onPick:Q,options:H},a.key))]}),[v.facts]:x?null:t(jt,{}),[v.howMany]:x?null:t(Zt,{offer:C,asksSpares:_&&c.priced,choice:q,setChoice:He,options:H,spareLook:B.spare,spareWords:Ae,spareCost:c.priced?kt(c,g):null}),[v.buy]:x?u.preOrder:t(F,{children:t(j,{ownerId:N??"",ownerType:K,slot:Ht,Template:we,rows:ye,fallback:null,hostParts:Yt,children:a=>a})}),[v.notify]:!x&&ee&&c.priced&&b?t(el,{partNumbers:b.components.map(a=>a.partNumber),productSlug:e.slug},b.id):null,[v.reminder]:!x&&De?Ge():null},Ye=(a,T)=>We[T]??null;function Ge(){const a=Ke.filter(M=>M.chosen===null).map(M=>Ce(M.prompt).replace(/^Select\s+/i,""));if($&&u.vehicleAnswersSpecs&&!n.fitmentSet&&a.push(et(n.vehicle.cascade)),a.length===0)return null;const T=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return m("p",{role:"alert",className:`-mt-1 ${Se.plain}`,style:{color:"var(--alert)"},children:["Select ",T,"."]})}const ce=de(null);U(()=>{r||ce.current===e.slug||(ce.current=e.slug,dt({itemId:b?`${e.slug}|${b.id}`:e.slug,itemName:e.name,variant:u.metaValue,pricePerSet:c.setTotal??c.fromSetTotal??0,currency:g}))},[r,e.slug,e.name,u.metaValue,b,c,g]);const D=Vt();return m(S,{children:[V&&t("nav",{...ke(Te(`border-b border-line ${ve} pt-4 pb-4 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg-dim max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]`,W),D?.first?.atTop,ne?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,T)=>m("span",{children:[T>0&&m(S,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(pe,{href:a.href,className:"hover:text-fg",children:t(fe,{text:a.label})}):t("span",{className:"text-fg",children:t(fe,{text:a.label})})]},`${a.label}-${T}`))}),t("section",{ref:G,"data-hero-layout":h,"data-hero-align":Y,...E?{[Nt]:""}:{},...O?{[Rt]:""}:{},...ke([Te(`grid ${L.gap}${ve} ${L.y}max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] ${L.yTablet}${Gt}`,W),Y==="center"?At.center:"",h==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",E?_t:"",O?Et(h==="imageRight"):""].filter(Boolean).join(" "),V?D?.second?.atTop:D?.secondOnly?.atTop,{...ne?{}:{background:"var(--section-bg)"},...h==="stacked"?{}:{"--hero-cols":Ie}}),children:t(Ft,{value:Be,children:t(F,{children:t(j,{ownerId:N??"",ownerType:K,Template:Ne,rows:ye,fallback:null,hostParts:Ye,children:a=>a})})})})]})}const Xt="wheels";function qt(e,n){return n==="alloy-wheel"&&/\d$/.test(e)?`${e} ${Xt}`:e}function Jt(e,n,i){if(!e.priced)return null;const r=e.setTotal==null?e.openSettled?.setTotal??null:null,o=e.setTotal??r??e.fromSetTotal;return o==null?null:{label:n,total:xe({...e,unit:o,isFrom:e.setTotal==null&&r==null},i)}}const Se={caps:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em]",plain:"font-body text-[length:var(--size-body,13px)]"};function Zt({offer:e,asksSpares:n,choice:i,setChoice:r,options:o,spareLook:p,spareWords:d,spareCost:l}){return e.packs.length>0||n&&(e.extra||e.spareCounts.length>0)?m("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&m(S,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:o,values:e.packs,item:s=>({label:s.label}),picked:s=>i.unit===s.value,press:s=>()=>r(f=>({...f,unit:s.value}))})})]}),n&&e.extra&&m("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 ${Se[p]} text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:s=>r(f=>({...f,spares:s.target.checked?vt:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),d?.trim()||e.extra.label,l&&t("span",{className:"ml-auto whitespace-nowrap",children:l})]}),n&&e.spareCounts.length>0&&m(S,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:mt.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(k,{hero:o,values:e.spareCounts,item:s=>({label:`${s.value} · ${s.label}`}),picked:s=>i.spares===s.value-be,press:s=>()=>r(f=>({...f,spares:s.value-be}))})})]}),n&&e.spareSide&&m(S,{children:[t("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.spareSide.label}),t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:o,values:e.spareSide.options,item:s=>({label:s.label}),picked:s=>i.spareSide===s.value&&(s.axle===void 0||Tt(i)===s.axle),press:s=>()=>r(f=>({...f,spareSide:s.value,...s.axle?{spareAxle:s.axle}:{}}))})})]})]}):null}function Oe({row:e,onPick:n,options:i}){const r=ue(),o=st();if(e.values.length===0&&!e.empty)return null;const p=e.values.find(l=>l.value===e.chosen),d=p&&[p.label,p.note].filter(Boolean).join(" · ");return e.values.length>0&&e.display==="swatch"&&o.finish==="tiles"?m("div",{[z]:e.key,children:[t(he,{label:r(e.label),chosen:p?.label}),t("div",{className:"flex flex-wrap gap-2","data-option-tiles":"",children:t(k,{hero:i,tiles:!0,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),label:l=>l.label,picked:l=>l.value===e.chosen,press:l=>()=>n(e.key,l.value)})})]}):e.values.length>0&&e.display==="pill"&&e.role==="resolves"&&o.size==="dropdown"?m("div",{[z]:e.key,children:[t(he,{label:r(e.label)}),t(at,{rowKey:e.key,label:r(e.label),shown:d||r(e.prompt),items:e.values.map(l=>({value:l.value,label:nt(l)})),value:e.chosen??"",onPick:l=>n(e.key,l),editing:i.editing})]}):m("div",{className:"border-b border-line pb-[26px]",[z]:e.key,children:[m("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[r(e.label)," · ",t("span",{className:"text-accent",children:d??r(e.prompt)})]}),e.values.length===0?m("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",t(pe,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?t("div",{className:"flex flex-wrap gap-2 [&>*]:max-w-full",children:t(k,{hero:i,values:e.values,item:l=>({swatch:l.swatch??"",name:l.label}),picked:l=>l.value===e.chosen,press:l=>()=>n(e.key,l.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(k,{hero:i,values:e.values,item:l=>({label:l.label,note:l.note??""}),picked:l=>l.value===e.chosen,press:l=>()=>n(e.key,l.value)})})]})}function k({hero:e,values:n,item:i,label:r,picked:o,press:p,tiles:d=!1}){const l=It(n,{item:i,selected:o,press:p,label:r});return t(F,{children:t(j,{ownerId:e.nodeId,ownerType:K,slot:d?Pt:$t,Template:d?e.tileTemplate:e.template,rows:l.items.map(Ct),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:d?void 0:e.pressTitles,fallback:null,children:s=>s})})}function el({partNumbers:e,productSlug:n}){const[i,r]=Xe(""),{status:o,submit:p,reset:d}=ot();function l(){p({partNumbers:e,email:i,productSlug:n})}return o==="sent"?t("p",{className:"-mt-1 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-accent",children:"We'll email you when it's back."}):t(Ze,{className:"-mt-1",email:i,onEmailChange:r,status:o,onResetVerdict:d,onSubmit:l,inputAriaLabel:"Email for the back-in-stock alert",submitLabel:"Notify me when back",buttonClassName:"cursor-pointer whitespace-nowrap border-2 border-btn px-4 font-mono text-[length:var(--size-label,11px)] font-bold uppercase tracking-[0.22em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-btn",errorMessage:"Couldn't save that — please try again."})}export{Qt as default};
@@ -3,12 +3,14 @@ import { type SelectItem } from "../ThemedSelect.js";
3
3
  import { type VehicleField } from "../../lib/wheels/vehicle-field-focus.js";
4
4
  export interface CarPickerStep {
5
5
  field: VehicleField;
6
+ sofar: string;
6
7
  shown: string;
7
8
  items: SelectItem[];
8
9
  value: string;
9
10
  pick: (value: string) => void;
10
11
  }
11
12
  export declare function carPickerStep(cascade: FitmentCascade): CarPickerStep;
13
+ export declare function carStillToPick(cascade: FitmentCascade): string;
12
14
  export default function CarPickerRow({ cascade }: {
13
15
  cascade: FitmentCascade;
14
16
  }): import("react").JSX.Element;
@@ -1 +1 @@
1
- "use client";import{jsx as l,jsxs as a}from"react/jsx-runtime";import{useRef as u,useState as m}from"react";import{pickerItems as p}from"../fitment/PickerField.js";import{vehicleLevelNames as d,vehicleLevelOptions as v,vehicleLevelSetters as h,vehicleLevelStates as L,vehicleLevelValues as x,VEHICLE_FIELD_ORDER as I}from"../fitment/vehicle-level-state.js";import{DROPDOWN_BUTTON as R,DropdownChevron as k}from"./OptionLooks.js";import{ThemedSelectList as w,useThemedSelect as E}from"../ThemedSelect.js";import{VEHICLE_FIELD_LABEL as c,firstUnansweredVehicleField as O}from"../../lib/wheels/vehicle-field-focus.js";const _="Select your car";function C(r){const e=O(r.vehicle)??"trim",i=d(r),s=I.map(o=>i[o]).filter(Boolean).join(" ");return{field:e,shown:s||_,items:p(v(r)[e],L(r)[e].placeholder),value:x(r)[e],pick:h(r)[e]}}function D({cascade:r}){const e=C(r),[i,s]=m(!1),o=u(!1),t=E({items:e.items,value:e.value,onPick:n=>{n&&(e.pick(n),o.current=e.field!=="trim")},open:i,onOpen:()=>s(!0),onClose:()=>{if(o.current){o.current=!1,t.setFocusIdx(0);return}s(!1)}}),f=`${c[e.field]}, ${e.shown}`;return a("div",{ref:t.wrapRef,className:"relative","data-car-picker-row":"",children:[a("button",{ref:n=>{t.triggerRef.current=n},type:"button","aria-haspopup":"listbox","aria-expanded":i,"aria-controls":i?t.listId:void 0,"aria-activedescendant":t.activeId,"aria-label":f,onClick:t.toggle,onKeyDown:t.onTriggerKeyDown,className:R,children:[l("span",{className:"truncate",children:e.shown}),l(k,{})]}),i&&l(w,{id:t.listId,tone:"hairline",items:e.items,value:e.value,focusIdx:t.focusIdx,onFocus:t.setFocusIdx,onPick:t.pick,listRef:t.listRef,ariaLabel:c[e.field]})]})}export{C as carPickerStep,D as default};
1
+ "use client";import{jsx as c,jsxs as u}from"react/jsx-runtime";import{useRef as v,useState as h}from"react";import{pickerItems as x}from"../fitment/PickerField.js";import{vehicleLevelNames as L,vehicleLevelOptions as R,vehicleLevelSetters as I,vehicleLevelStates as k,vehicleLevelValues as w,VEHICLE_FIELD_ORDER as C}from"../fitment/vehicle-level-state.js";import{DROPDOWN_BUTTON as E,DropdownChevron as O}from"./OptionLooks.js";import{ThemedSelectList as S,useThemedSelect as _}from"../ThemedSelect.js";import{VEHICLE_FIELD_LABEL as a,firstUnansweredVehicleField as f}from"../../lib/wheels/vehicle-field-focus.js";const m="your car",D=`Select ${m}`;function p(o){const e=f(o.vehicle),r=e??"trim",n=L(o),i=C.map(l=>n[l]).filter(Boolean).join(" "),t=i?e?`${i} · Select ${d(e)}`:i:D;return{field:r,sofar:i,shown:t,items:x(R(o)[r],k(o)[r].placeholder),value:w(o)[r],pick:I(o)[r]}}const d=o=>a[o].toLowerCase();function y(o){const e=f(o.vehicle),{sofar:r}=p(o);return r&&e?`your ${r}'s ${d(e)}`:m}function g({cascade:o}){const e=p(o),[r,n]=h(!1),i=v(!1),t=_({items:e.items,value:e.value,onPick:s=>{s&&(e.pick(s),i.current=e.field!=="trim")},open:r,onOpen:()=>n(!0),onClose:()=>{if(i.current){i.current=!1,t.setFocusIdx(0);return}n(!1)}}),l=`${a[e.field]}, ${e.shown}`;return u("div",{ref:t.wrapRef,className:"relative","data-car-picker-row":"",children:[u("button",{ref:s=>{t.triggerRef.current=s},type:"button","aria-haspopup":"listbox","aria-expanded":r,"aria-controls":r?t.listId:void 0,"aria-activedescendant":t.activeId,"aria-label":l,onClick:t.toggle,onKeyDown:t.onTriggerKeyDown,className:E,children:[c("span",{className:"truncate",children:e.shown}),c(O,{})]}),r&&c(S,{id:t.listId,tone:"hairline",items:e.items,value:e.value,focusIdx:t.focusIdx,onFocus:t.setFocusIdx,onPick:t.pick,listRef:t.listRef,ariaLabel:a[e.field]})]})}export{p as carPickerStep,y as carStillToPick,g as default};