efficient-storefront-blocks 0.125.20 → 0.125.22
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 +10 -0
- package/dist/chunks/{EditorPreviewCheckout-WP23XRYO.js → EditorPreviewCheckout-LRPANZRI.js} +1 -1
- package/dist/chunks/chunk-DQ2TQC5H.js +1 -0
- package/dist/editor/lib/document/blocks/service/SiteHeader/fields.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +2 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +25 -25
- package/dist/render/components/CountrySelect.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +7 -0
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/PhoneSheet.js +1 -1
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/SectionGroupBody.d.ts +3 -1
- package/dist/render/components/SectionGroupBody.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/lib/content/header-bar.d.ts +30 -0
- package/dist/render/lib/content/header-bar.js +1 -1
- package/dist/render/lib/document/blocks/service/SiteHeader/render.js +1 -1
- package/dist/render/lib/wheels/price-display.d.ts +0 -1
- package/dist/render/lib/wheels/price-display.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +2 -0
- package/dist/words.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-VUMZSQZ5.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as p,jsxs as d}from"react/jsx-runtime";import{ThemedSelectList as
|
|
1
|
+
"use client";import{jsx as n,Fragment as p,jsxs as d}from"react/jsx-runtime";import{ThemedSelectList as _,useThemedSelect as k}from"./ThemedSelect.js";import{useCurrency as w}from"./CurrencyContext.js";import{countryName as O}from"../lib/countries.js";import{regionSwitchHref as v}from"../lib/menu-link.js";import{FlagAuIcon as T,FlagCaIcon as R,FlagEuIcon as A,FlagGbIcon as E,FlagNzIcon as G,FlagUsIcon as U,GlobeIcon as j}from"efficient-shell/icons/efficient";import{GlobeAltIcon as L}from"efficient-shell/icons/efficient-looks";import{TOOL_ICON_BUTTON_CLASS as z,useHeaderGlyph as H}from"./HeaderTools.js";import{COUNTRY_SHOW_AS_DEFAULT as B,countryShowAsHasFlag as W}from"../lib/content/country-show-as.js";const g={US:U,CA:R,AU:T,NZ:G,GB:E,EU:A};function F({code:r,width:e}){const c=Object.hasOwn(g,r)?g[r]:void 0;return c?n("span",{"aria-hidden":!0,className:"inline-flex shrink-0 border border-line",children:n(c,{size:e})}):null}function D(r,e){const c=n(F,{code:e.code,width:18});switch(r){case"code_currency":return e.currency?d(p,{children:[n("span",{children:e.code}),n("span",{"aria-hidden":!0,className:"opacity-50",children:"·"}),n("span",{children:e.currency})]}):n("span",{children:e.code});case"globe_code":return d(p,{children:[n(j,{size:14,className:"shrink-0"}),n("span",{children:e.code})]});case"currency":return n("span",{children:e.currency??e.code});case"flag_code":return d(p,{children:[c,n("span",{children:e.code})]});case"flag":return Object.hasOwn(g,e.code)?c:n("span",{children:e.code});default:return n("span",{children:e.name})}}function I(r,e,c){const s=new Map(r.map(a=>[a.code,a]));return(e?.length?e:r.map(a=>a.code)).map(a=>{const i=s.get(a);return{code:a,name:i?.name||O(a),currency:i?.currency,url:i?.url||c?.[a]||""}})}const S=2;function X(r){const{countries:e}=w();return I(e,r).length>=S}function K({urls:r,countries:e,showAs:c=B}={}){const{country:s,setCountry:a,countries:i}=w(),l=I(i,e,r),m=l.find(t=>t.code===s)??l[0],h=H();function C(t){const x=r?v(l.find(f=>f.code===t)?.url,window.location.href):null;if(x){window.location.href=x;return}i.some(f=>f.code===t)&&a(t)}const N=W(c),y=l.map(t=>({value:t.code,label:t.name,meta:t.currency,...N?{lead:n(F,{code:t.code,width:21})}:{}})),o=k({items:y,value:s,onPick:C});if(!m||l.length<S)return null;const u=o.open,b=c==="globe";return d("div",{ref:o.wrapRef,className:"relative",children:[n("button",{ref:t=>{o.triggerRef.current=t},type:"button","aria-haspopup":"listbox","aria-expanded":u,"aria-controls":u?o.listId:void 0,"aria-activedescendant":o.activeId,"aria-label":`Region: ${m.name}. Click to change.`,onClick:o.toggle,onKeyDown:o.onTriggerKeyDown,suppressHydrationWarning:!0,...b?{className:z}:{className:"inline-flex items-center gap-2 whitespace-nowrap border border-fg-dim px-3 py-2 font-mono text-[13px] uppercase tracking-[0.18em] transition-colors hover:border-fg",style:{color:"color-mix(in oklab, currentColor 80%, transparent)"}},children:b?n(L,{size:h.size,strokeWidth:String(h.stroke),"aria-hidden":"true"}):d(p,{children:[D(c,m),n("span",{"aria-hidden":!0,className:`text-[11px] opacity-70 transition-transform ${u?"rotate-180":""}`,children:"▾"})]})}),u&&n(_,{id:o.listId,tone:"region",ariaLabel:"Choose region",items:y,value:s,focusIdx:o.focusIdx,onFocus:o.setFocusIdx,onPick:o.pick,listRef:o.listRef})]})}export{K as default,X as useCountrySelectShows};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SearchStyle } from "./HeaderToolBlocks.js";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
+
import { type HeaderToolLook } from "../lib/content/header-bar.js";
|
|
3
4
|
export declare const UTIL_WORDS: {
|
|
4
5
|
readonly search: "Search";
|
|
5
6
|
readonly account: "Account";
|
|
@@ -10,6 +11,12 @@ export declare const UTIL_WORDS: {
|
|
|
10
11
|
export declare const UTIL_WORD_CLASS = "whitespace-nowrap";
|
|
11
12
|
export declare const TOOL_ICON_BUTTON_CLASS = "mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100";
|
|
12
13
|
export declare function cartLabel(count: number): string;
|
|
14
|
+
export declare const HeaderToolLookContext: import("react").Context<HeaderToolLook>;
|
|
15
|
+
export declare function useHeaderGlyph(): {
|
|
16
|
+
size: number;
|
|
17
|
+
stroke: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function CartGlyph(): import("react").JSX.Element;
|
|
13
20
|
export declare function CartButton({ onClick, count, asText, className, takesViewHide, }: {
|
|
14
21
|
onClick: () => void;
|
|
15
22
|
count: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t,jsxs as c,Fragment as k}from"react/jsx-runtime";import S from"next/link";import{createContext as _,useContext as N,useEffect as $,useRef as C}from"react";import{CartAltIcon as L}from"efficient-shell/icons/efficient-looks";import{BagIcon as z}from"efficient-shell/icons/efficient";import{resolveHeaderToolLook as B}from"../lib/content/header-bar.js";import h from"efficient-easel/screen/components/UiIcon";import{prefersReducedMotion as O}from"efficient-web-builder/render/components/useReducedMotion";import{HideTaker as T,NO_HIDE as H,useTakeViewHide as I,withViewHide as j}from"efficient-web-builder/render/components/ViewHideRoot";const l={search:"Search",account:"Account",cart:"Bag",menu:"Menu",close:"Close"},u="whitespace-nowrap",A="mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100";function W(r){return r>99?"99+":String(r)}function R({count:r,ref:e}){return t("span",{ref:e,"data-cart-badge":"","aria-hidden":"true",className:"pointer-events-none absolute -top-[7px] -right-[9px] inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-current px-1 text-[10px] leading-none font-semibold tabular-nums",style:{letterSpacing:0},children:t("span",{style:{color:"var(--sf-header-ground, var(--bg))"},children:W(r)})})}function G(r){return`Open cart, ${r} item${r===1?"":"s"}`}const v=_(B({}));function m(){return N(v).glyph}function U(){const{cart:r}=N(v),{size:e,stroke:o}=m();return t(r==="bag"?z:L,{size:e,strokeWidth:String(o),"aria-hidden":"true"})}function X({onClick:r,count:e,asText:o,className:n,takesViewHide:i=!1}){const a=C(null),s=C(e);return $(()=>{s.current!==e&&(s.current=e,!O()&&a.current?.animate([{transform:"scale(0.6)"},{transform:"scale(1)"}],{duration:180,easing:"ease-out"}))},[e]),t(T,{as:"button",takes:i,type:"button",onClick:r,"aria-label":G(e),className:`mono-eyebrow-ctl inline-flex items-center gap-2 opacity-80 transition-opacity hover:opacity-100 ${n??""}`,children:o?c("span",{className:u,children:[l.cart,e>0?` ${e}`:""]}):c("span",{className:"relative inline-flex",children:[t(U,{}),e>0?t(R,{count:e,ref:a}):null]})})}function Y({asText:r,className:e,takesViewHide:o=!1}){const n=I(),i=o?n:H,a=m();return i.scope(t(S,{href:"/account","aria-label":"Account",className:j(`${A} ${e??""}`,i.className),...i.attrs,children:r?t("span",{className:u,children:l.account}):c("svg",{width:a.size,height:a.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:a.stroke,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t("circle",{cx:"12",cy:"8",r:"3.4"}),t("path",{d:"M5 20a7 7 0 0 1 14 0"})]})}))}function Z({onClick:r,asText:e,withWord:o,phoneLook:n,className:i}){const a=m();let s=!1,d;if(n){const p=e?"text":o?"icon_text":"icon",f=(b,w)=>b&&w?"":b?"max-view-tablet:hidden":w?"view-tablet:hidden":null,x=f(p!=="text",n!=="text"),g=f(p!=="icon",n!=="icon"),y=p==="icon_text"||n==="icon_text";s=!0,d=c(k,{children:[x===null?null:t("span",{className:`inline-flex ${x}`,children:t(h,{name:"search",size:y?20:18,strokeWidth:y?1.5:1.6,rounded:!0})}),g===null?null:t("span",{className:`${u} ${g}`,children:l.search})]})}else o?(s=!0,d=c(k,{children:[t(h,{name:"search",size:20,strokeWidth:1.5,rounded:!0}),t("span",{className:`${u} max-view-tablet:hidden`,children:l.search})]})):d=e?t("span",{className:u,children:l.search}):t(h,{name:"search",size:a.size,strokeWidth:a.stroke,rounded:!0});return t("button",{type:"button",onClick:r,"aria-label":"Search",title:"Search (⌘K)",className:`mono-eyebrow-ctl inline-flex items-center ${s?"gap-2 ":""}opacity-80 transition-opacity hover:opacity-100 ${i??""}`,children:d})}export{Y as AccountButton,X as CartButton,U as CartGlyph,v as HeaderToolLookContext,Z as SearchButton,A as TOOL_ICON_BUTTON_CLASS,l as UTIL_WORDS,u as UTIL_WORD_CLASS,G as cartLabel,m as useHeaderGlyph};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import
|
|
1
|
+
"use client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import g from"next/link";import y from"efficient-easel/screen/components/UiIcon";import N from"./CountrySelect.js";import w from"./ThemeToggle.js";import{useCart as j}from"./CartContext.js";import{CartGlyph as v,cartLabel as C,useHeaderGlyph as T,UTIL_WORDS as f}from"./HeaderTools.js";import{UNDER_HEADER_SHEET_CLASS as _}from"../lib/content/header-bar.js";const h="flex h-12 items-center gap-3 border border-line bg-bg px-4 text-left text-[15px]";function I({role:l,panelRef:a,name:o,entries:c,tools:e,withAccount:s,editing:m,onClose:i,onSearch:p,phoneOnly:x=!1,marker:u,listStyle:b}){const d=T(),r=e&&(e.search||e.cart||e.region||s&&e.account||e.theme)?e:null;return n("div",{ref:a,role:l,"aria-modal":"true","aria-label":o,tabIndex:-1,...u?{"data-menu-panel":u}:null,className:`${_} z-[60] flex flex-col overflow-y-auto bg-bg text-fg${x?" view-tablet:hidden":""}`,children:[t("ul",{className:"m-0 flex list-none flex-col px-5 py-3 font-mono text-[16px] uppercase tracking-[0.18em]",style:b,children:c}),r?n("div",{className:"mt-auto flex flex-col gap-4 border-t border-line bg-surface p-5",children:[r.search?n("button",{type:"button",className:h,onClick:m?void 0:()=>{i(),p()},children:[t(y,{name:"search",size:d.size,strokeWidth:d.stroke,rounded:!0}),f.search]}):null,r.cart?t(k,{editing:m,onClose:i}):null,s&&r.account?n("div",{className:"flex items-center justify-between",children:[t("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),t(g,{href:"/account",onClick:i,className:"mono-eyebrow underline",children:"Your account"})]}):null,r.region?n("div",{className:"flex items-center justify-between",children:[t("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),t(N,{})]}):null,r.theme?n("div",{className:"flex items-center justify-between",children:[t("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),t(w,{})]}):null]}):null]})}function k({editing:l,onClose:a}){const{open:o,totals:c}=j(),e=c.sets;return n("button",{type:"button",className:h,"aria-label":C(e),onClick:l?void 0:()=>{a(),o()},children:[t(v,{}),f.cart,e>0?` ${e}`:""]})}export{I as PhoneSheet};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as g,jsxs as c}from"react/jsx-runtime";import{partSkus as He}from"../lib/catalog/part-skus.js";import ae from"next/link";import{useEffect as le,useRef as re,useState as Me}from"react";import{useCart as Ue}from"./CartContext.js";import{useSiteTakesOrders as je}from"./SiteRecordContext.js";import ze from"./EmailCaptureForm.js";import{useEnglish as ne}from"./EnglishVariant.js";import{MarkedLabel as se,heroView as De}from"./product-hero/hero-view.js";import{useRootIsDark as Be}from"efficient-shell/theme";import{useStockAlertSignup as Ve}from"./useStockAlertSignup.js";import{SPARE_WORDS as Fe,productCartLine as Ye}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as Ke}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Qe}from"../lib/catalog/product-options.js";import{trackViewItem as We}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as Xe,DEFAULT_HERO_RATIO as Ge,DEFAULT_HERO_TEXT_ALIGN as qe,parseHeroLayout as Je,parseHeroRatio as Ze,parseHeroTextAlign as et}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as tt,UNITS_PER_SET as oe,formatPrice as ie}from"../lib/commerce.js";import{formatSelectionPrice as at,setPriceLabel as lt}from"../lib/wheels/price-display.js";import{productIsDually as rt,productIsTwoObjects as nt,setSuppressesRow as st}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ce}from"../lib/sections/content-cap-gutter.js";import{STICKY_COLUMNS_CLASS as ot,STICKY_SECTION_ATTR as it}from"../lib/sections/hero-sticky.js";import{useStickyColumns as ct}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as mt}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as I}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as P}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as pt}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as dt}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as ut}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as ft,HERO_QUANTITY_PART as ht,HERO_SAVE_PART as bt}from"../lib/content/hero-buy-seed.js";import{HERO_PART as f}from"../lib/content/hero-seed.js";import gt from"./card-pieces/CardQuantity.js";import xt from"./card-pieces/CardSave.js";import vt from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as kt}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as $}from"../lib/document/document-nodes.js";import{withSideOnce as me}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as Tt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as pe}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as St}from"./SectionPadScope.js";const yt=4e3;function wt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const de=[{}],_t=(e,n)=>n===ht?t(gt,{}):n===bt?t(xt,{}):null,Nt="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Ot({product:e,selection:n,onLightbox:i,editing:s=!1,showVehicleFitment:o=!0,heroLayout:l=Xe,imageRatio:r=Ge,textAlign:S=qe,showSpecTable:fe=!0,stickyColumns:he=!1,nodeId:y,template:be,optionTemplate:ge,optionPressTitles:xe,buyTemplate:ve}){const H=Tt(),ke=ne(),x=Je(l),M=et(S),k=Ze(r),w=he===!0&&x!=="stacked",U=re(null);ct(U,w);const Te=x==="imageRight"?`${100-k}fr ${k}fr`:`${k}fr ${100-k}fr`,{picked:Se,pick:j,qty:z,setQty:ye,choice:D,setChoice:we,angleIdx:At,setAngleIdx:Et,showValidation:_e,setShowValidation:_,manualMode:B,vehicle:N,rows:V,facts:Ne,part:d,outOfStock:F,offer:Y,preOrder:O,canAddToCart:K,currency:h,price:p,set:Q,msrpLabel:Oe}=n,m=De(e,n,s),R=rt(e),Re=nt(e),C=o?m.vehicle:null,Ce=o?m.vehicleMemory:null,W=!Be({whenUnset:!0}),{warmCatalog:X}=Ue(),T=je();le(()=>{!s&&T&&X(e.kind,e.slug)},[s,T,e.kind,e.slug,X]);const G=V.filter(a=>!O||a.values.length>0),q=G.filter(a=>a.role==="resolves"),A=G.filter(a=>a.role==="describes"&&!st(Re,a.key)),J=A.findIndex(a=>a.chosen===null),Z=(!C||!m.vehicleAnswersSpecs||n.fitmentSet)&&Qe(V,O)?J===-1?A:A.slice(0,J+1):[],Ae=[...q,...Z];function Ee(){return K?(_(!1),s?null:Ye(e,d,Se,{choice:D,qty:z},{fitmentLabel:B?m.specCaption:N.appliedName?`For ${N.appliedName}`:"",fitmentKey:B?`manual|${m.specCaption}`:`vehicle|${wt(N.applied?.vehicle)}`})):(_(!0),window.setTimeout(()=>_(!1),yt),null)}const Le={kind:"hero",msrpLabel:Oe||null,amount:R?lt(p,h):at(p,h),unitLabel:p.priced?m.unitLabel:null,packBadge:p.setTotal!=null?`${Y.quantityLabel}: ${ie(Q,h)}`:null,buy:{isSet:R,priced:p.priced,outOfStock:F,canAdd:K,totalLabel:p.setTotal!=null?ie(Q,h):null,lineToAdd:Ee},qty:z,setQty:ye,takesQty:T&&!(R&&!p.priced),save:{slug:e.slug,name:e.name},facts:fe?Ne:null,title:{eyebrow:e.eyebrow,name:m.heading,badge:e.badge||null},product:e,selection:n,openLightbox:i,sku:He(d)},E={nodeId:y??"",template:ge,pressTitles:xe,editing:s},u=!!(O&&m.preOrder),Ie={[f.fitmentLine]:Ce,[f.options]:c(g,{children:[q.map(a=>t(ue,{row:a,onPick:j,options:E},a.key)),!u&&C,!u&&Z.map(a=>t(ue,{row:a,onPick:j,options:E},a.key))]}),[f.facts]:u?null:t(vt,{}),[f.howMany]:u?null:t(Rt,{offer:Y,takesOrders:T,choice:D,setChoice:we,options:E}),[f.buy]:u?m.preOrder:t(P,{children:t(I,{ownerId:y??"",ownerType:$,slot:ft,Template:ve,rows:de,fallback:null,hostParts:_t,children:a=>a})}),[f.notify]:!u&&F&&d?t(Ct,{partNumbers:d.components.map(a=>a.partNumber),productSlug:e.slug},d.id):null,[f.reminder]:!u&&_e?$e():null},Pe=(a,b)=>Ie[b]??null;function $e(){const a=Ae.filter(L=>L.chosen===null).map(L=>ke(L.prompt).replace(/^Select\s+/i,""));if(C&&m.vehicleAnswersSpecs&&!n.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const b=a.length===1?a[0]:a.length===2?`${a[0]} and ${a[1]}`:`${a.slice(0,-1).join(", ")}, and ${a.at(-1)}`;return c("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 ",b," first."]})}const ee=re(null);le(()=>{s||ee.current===e.slug||(ee.current=e.slug,We({itemId:d?`${e.slug}|${d.id}`:e.slug,itemName:e.name,variant:m.metaValue,pricePerSet:p.setTotal??p.fromSetTotal??0,currency:h}))},[s,e.slug,e.name,m.metaValue,d,p,h]);const te=St();return c(g,{children:[t("nav",{...pe(me(`border-b border-line ${ce} 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))]`,H),te?.first?.atTop,W?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,b)=>c("span",{children:[b>0&&c(g,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(ae,{href:a.href,className:"hover:text-fg",children:t(se,{text:a.label})}):t("span",{className:"text-fg",children:t(se,{text:a.label})})]},`${a.label}-${b}`))}),t("section",{ref:U,"data-hero-layout":x,"data-hero-align":M,...w?{[it]:""}:{},...pe([me(`grid gap-10 ${ce} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8 ${Nt}`,H),M==="center"?mt.center:"",x==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",w?ot:""].filter(Boolean).join(" "),te?.second?.atTop,{...W?{}:{background:"var(--section-bg)"},...x==="stacked"?{}:{"--hero-cols":Te}}),children:t(kt,{value:Le,children:t(P,{children:t(I,{ownerId:y??"",ownerType:$,Template:be,rows:de,fallback:null,hostParts:Pe,children:a=>a})})})})]})}function Rt({offer:e,takesOrders:n,choice:i,setChoice:s,options:o}){return e.packs.length>0||n&&(e.extra||e.spareCounts.length>0)?c("div",{className:"border-b border-line pb-[26px]",children:[e.packs.length>0&&c(g,{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(v,{hero:o,values:e.packs,item:l=>({label:l.label}),picked:l=>i.unit===l.value,press:l=>()=>s(r=>({...r,unit:l.value}))})})]}),n&&e.extra&&c("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:l=>s(r=>({...r,spares:l.target.checked?tt:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),e.extra.label]}),n&&e.spareCounts.length>0&&c(g,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:Fe.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(v,{hero:o,values:e.spareCounts,item:l=>({label:`${l.value} · ${l.label}`}),picked:l=>i.spares===l.value-oe,press:l=>()=>s(r=>({...r,spares:l.value-oe}))})})]}),n&&e.spareSide&&c(g,{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(v,{hero:o,values:e.spareSide.options,item:l=>({label:l.label}),picked:l=>i.spareSide===l.value,press:l=>()=>s(r=>({...r,spareSide:l.value}))})})]})]}):null}function ue({row:e,onPick:n,options:i}){const s=ne();if(e.values.length===0&&!e.empty)return null;const o=e.values.find(r=>r.value===e.chosen),l=o&&[o.label,o.note].filter(Boolean).join(" · ");return c("div",{className:"border-b border-line pb-[26px]",[Ke]:e.key,children:[c("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[s(e.label)," · ",t("span",{className:"text-accent",children:l??s(e.prompt)})]}),e.values.length===0?c("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",t(ae,{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(v,{hero:i,values:e.values,item:r=>({swatch:r.swatch??"",name:r.label}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(v,{hero:i,values:e.values,item:r=>({label:r.label,note:r.note??""}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})})]})}function v({hero:e,values:n,item:i,picked:s,press:o}){const l=dt(n,{item:i,selected:s,press:o});return t(P,{children:t(I,{ownerId:e.nodeId,ownerType:$,slot:ut,Template:e.template,rows:l.items.map(pt),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:e.pressTitles,fallback:null,children:r=>r})})}function Ct({partNumbers:e,productSlug:n}){const[i,s]=Me(""),{status:o,submit:l,reset:r}=Ve();function S(){l({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:s,status:o,onResetVerdict:r,onSubmit:S,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{Ot as default};
|
|
1
|
+
"use client";import{jsx as t,Fragment as b,jsxs as m}from"react/jsx-runtime";import{partSkus as He}from"../lib/catalog/part-skus.js";import ae from"next/link";import{useEffect as le,useRef as re,useState as Me}from"react";import{useCart as Ue}from"./CartContext.js";import{useSiteTakesOrders as je}from"./SiteRecordContext.js";import ze from"./EmailCaptureForm.js";import{useEnglish as ne}from"./EnglishVariant.js";import{MarkedLabel as se,heroView as De}from"./product-hero/hero-view.js";import{useRootIsDark as Be}from"efficient-shell/theme";import{useStockAlertSignup as Ve}from"./useStockAlertSignup.js";import{SPARE_WORDS as Fe,productCartLine as Ye}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as Ke}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Qe}from"../lib/catalog/product-options.js";import{trackViewItem as We}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as Xe,DEFAULT_HERO_RATIO as Ge,DEFAULT_HERO_TEXT_ALIGN as qe,parseHeroLayout as Je,parseHeroRatio as Ze,parseHeroTextAlign as et}from"../lib/sections/hero-arrangement.js";import{MAX_SPARES as tt,UNITS_PER_SET as oe,formatPrice as ie}from"../lib/commerce.js";import{formatSelectionPrice as at}from"../lib/wheels/price-display.js";import{productIsDually as lt,productIsTwoObjects as rt,setSuppressesRow as nt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as me}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{useStickyColumns as it}from"./useStickyColumns.js";import{BLOCK_ALIGN_TEXT as mt}from"efficient-web-builder/format/lib/content/block-align";import{CardTemplateRows as L}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as I}from"efficient-web-builder/render/components/SiteGutterFrame";import{cardRow as ct}from"efficient-web-builder/format/lib/content/card-template";import{optionCardRows as pt}from"../lib/sections/filter-option-rows.js";import{HERO_OPTION_SLOT as dt}from"../lib/content/hero-option-seed.js";import{HERO_BUY_SLOT as ut,HERO_QUANTITY_PART as ft,HERO_SAVE_PART as ht}from"../lib/content/hero-buy-seed.js";import{HERO_PART as f}from"../lib/content/hero-seed.js";import bt from"./card-pieces/CardQuantity.js";import gt from"./card-pieces/CardSave.js";import xt from"./card-pieces/CardStatedFacts.js";import{HeroStateProvider as vt}from"./card-pieces/ProductCardState.js";import{PRODUCT_HERO_TYPE as P}from"../lib/document/document-nodes.js";import{withSideOnce as ce}from"efficient-web-builder/format/lib/content/page-width";import{useSideSpaceOnce as kt}from"efficient-web-builder/render/components/SideSpaceOnce";import{withRootPad as pe}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSplitPads as Tt}from"./SectionPadScope.js";const St=4e3;function yt(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const de=[{}],wt=(e,n)=>n===ft?t(bt,{}):n===ht?t(gt,{}):null,_t="[&>[data-sf-repeat]]:contents [&>[data-sf-repeat]>div]:contents";function Nt({product:e,selection:n,onLightbox:i,editing:s=!1,showVehicleFitment:o=!0,heroLayout:l=Xe,imageRatio:r=Ge,textAlign:S=qe,showSpecTable:fe=!0,stickyColumns:he=!1,nodeId:y,template:be,optionTemplate:ge,optionPressTitles:xe,buyTemplate:ve}){const $=kt(),ke=ne(),g=Je(l),H=et(S),k=Ze(r),w=he===!0&&g!=="stacked",M=re(null);it(M,w);const Te=g==="imageRight"?`${100-k}fr ${k}fr`:`${k}fr ${100-k}fr`,{picked:Se,pick:U,qty:j,setQty:ye,choice:z,setChoice:we,angleIdx:Ct,setAngleIdx:At,showValidation:_e,setShowValidation:_,manualMode:D,vehicle:N,rows:B,facts:Ne,part:d,outOfStock:V,offer:F,preOrder:O,canAddToCart:Y,currency:x,price:p,set:K,msrpLabel:Oe}=n,c=De(e,n,s),Q=lt(e),Re=rt(e),R=o?c.vehicle:null,Ce=o?c.vehicleMemory:null,W=!Be({whenUnset:!0}),{warmCatalog:X}=Ue(),T=je();le(()=>{!s&&T&&X(e.kind,e.slug)},[s,T,e.kind,e.slug,X]);const G=B.filter(a=>!O||a.values.length>0),q=G.filter(a=>a.role==="resolves"),C=G.filter(a=>a.role==="describes"&&!nt(Re,a.key)),J=C.findIndex(a=>a.chosen===null),Z=(!R||!c.vehicleAnswersSpecs||n.fitmentSet)&&Qe(B,O)?J===-1?C:C.slice(0,J+1):[],Ae=[...q,...Z];function Ee(){return Y?(_(!1),s?null:Ye(e,d,Se,{choice:z,qty:j},{fitmentLabel:D?c.specCaption:N.appliedName?`For ${N.appliedName}`:"",fitmentKey:D?`manual|${c.specCaption}`:`vehicle|${yt(N.applied?.vehicle)}`})):(_(!0),window.setTimeout(()=>_(!1),St),null)}const Le={kind:"hero",msrpLabel:Oe||null,amount:at(p,x),unitLabel:p.priced?c.unitLabel:null,packBadge:p.setTotal!=null?`${F.quantityLabel}: ${ie(K,x)}`:null,buy:{isSet:Q,priced:p.priced,outOfStock:V,canAdd:Y,totalLabel:p.setTotal!=null?ie(K,x):null,lineToAdd:Ee},qty:j,setQty:ye,takesQty:T&&!(Q&&!p.priced),save:{slug:e.slug,name:e.name},facts:fe?Ne:null,title:{eyebrow:e.eyebrow,name:c.heading,badge:e.badge||null},product:e,selection:n,openLightbox:i,sku:He(d)},A={nodeId:y??"",template:ge,pressTitles:xe,editing:s},u=!!(O&&c.preOrder),Ie={[f.fitmentLine]:Ce,[f.options]:m(b,{children:[q.map(a=>t(ue,{row:a,onPick:U,options:A},a.key)),!u&&R,!u&&Z.map(a=>t(ue,{row:a,onPick:U,options:A},a.key))]}),[f.facts]:u?null:t(xt,{}),[f.howMany]:u?null:t(Ot,{offer:F,takesOrders:T,choice:z,setChoice:we,options:A}),[f.buy]:u?c.preOrder:t(I,{children:t(L,{ownerId:y??"",ownerType:P,slot:ut,Template:ve,rows:de,fallback:null,hostParts:wt,children:a=>a})}),[f.notify]:!u&&V&&d?t(Rt,{partNumbers:d.components.map(a=>a.partNumber),productSlug:e.slug},d.id):null,[f.reminder]:!u&&_e?$e():null},Pe=(a,h)=>Ie[h]??null;function $e(){const a=Ae.filter(E=>E.chosen===null).map(E=>ke(E.prompt).replace(/^Select\s+/i,""));if(R&&c.vehicleAnswersSpecs&&!n.fitmentSet&&a.push("vehicle fitment"),a.length===0)return null;const h=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 ",h," first."]})}const ee=re(null);le(()=>{s||ee.current===e.slug||(ee.current=e.slug,We({itemId:d?`${e.slug}|${d.id}`:e.slug,itemName:e.name,variant:c.metaValue,pricePerSet:p.setTotal??p.fromSetTotal??0,currency:x}))},[s,e.slug,e.name,c.metaValue,d,p,x]);const te=Tt();return m(b,{children:[t("nav",{...pe(ce(`border-b border-line ${me} 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))]`,$),te?.first?.atTop,W?void 0:{background:"var(--section-bg)"}),children:e.crumbs.map((a,h)=>m("span",{children:[h>0&&m(b,{children:[t("span",{className:"mx-3 text-accent",children:"/"}),t("wbr",{})]}),a.href?t(ae,{href:a.href,className:"hover:text-fg",children:t(se,{text:a.label})}):t("span",{className:"text-fg",children:t(se,{text:a.label})})]},`${a.label}-${h}`))}),t("section",{ref:M,"data-hero-layout":g,"data-hero-align":H,...w?{[ot]:""}:{},...pe([ce(`grid gap-10 ${me} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8 ${_t}`,$),H==="center"?mt.center:"",g==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]",w?st:""].filter(Boolean).join(" "),te?.second?.atTop,{...W?{}:{background:"var(--section-bg)"},...g==="stacked"?{}:{"--hero-cols":Te}}),children:t(vt,{value:Le,children:t(I,{children:t(L,{ownerId:y??"",ownerType:P,Template:be,rows:de,fallback:null,hostParts:Pe,children:a=>a})})})})]})}function Ot({offer:e,takesOrders:n,choice:i,setChoice:s,options:o}){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(b,{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(v,{hero:o,values:e.packs,item:l=>({label:l.label}),picked:l=>i.unit===l.value,press:l=>()=>s(r=>({...r,unit:l.value}))})})]}),n&&e.extra&&m("label",{className:`${e.packs.length>0?"mt-3.5 ":""}flex cursor-pointer items-center gap-3 font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-fg`,children:[t("input",{type:"checkbox",checked:i.spares>0,onChange:l=>s(r=>({...r,spares:l.target.checked?tt:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),e.extra.label]}),n&&e.spareCounts.length>0&&m(b,{children:[t("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:Fe.howMany}),t("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:t(v,{hero:o,values:e.spareCounts,item:l=>({label:`${l.value} · ${l.label}`}),picked:l=>i.spares===l.value-oe,press:l=>()=>s(r=>({...r,spares:l.value-oe}))})})]}),n&&e.spareSide&&m(b,{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(v,{hero:o,values:e.spareSide.options,item:l=>({label:l.label}),picked:l=>i.spareSide===l.value,press:l=>()=>s(r=>({...r,spareSide:l.value}))})})]})]}):null}function ue({row:e,onPick:n,options:i}){const s=ne();if(e.values.length===0&&!e.empty)return null;const o=e.values.find(r=>r.value===e.chosen),l=o&&[o.label,o.note].filter(Boolean).join(" · ");return m("div",{className:"border-b border-line pb-[26px]",[Ke]: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:[s(e.label)," · ",t("span",{className:"text-accent",children:l??s(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(ae,{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(v,{hero:i,values:e.values,item:r=>({swatch:r.swatch??"",name:r.label}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})}):t("div",{className:"flex flex-wrap gap-1.5",children:t(v,{hero:i,values:e.values,item:r=>({label:r.label,note:r.note??""}),picked:r=>r.value===e.chosen,press:r=>()=>n(e.key,r.value)})})]})}function v({hero:e,values:n,item:i,picked:s,press:o}){const l=pt(n,{item:i,selected:s,press:o});return t(I,{children:t(L,{ownerId:e.nodeId,ownerType:P,slot:dt,Template:e.template,rows:l.items.map(ct),items:l.items,states:l.states,actions:e.editing?void 0:l.actions,pressTitles:e.pressTitles,fallback:null,children:r=>r})})}function Rt({partNumbers:e,productSlug:n}){const[i,s]=Me(""),{status:o,submit:l,reset:r}=Ve();function S(){l({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:s,status:o,onResetVerdict:r,onSubmit:S,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{Nt as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SlotComponent } from "efficient-easel/blocks";
|
|
2
|
-
export default function SectionGroupBody({ place, sections: Sections, editing, widths, navTextCase, menuRow, toolTextStyle, }: {
|
|
2
|
+
export default function SectionGroupBody({ place, sections: Sections, editing, widths, navTextCase, menuRow, toolTextStyle, iconSize, cartIcon, }: {
|
|
3
3
|
place: "header" | "footer";
|
|
4
4
|
sections: SlotComponent;
|
|
5
5
|
editing?: boolean;
|
|
@@ -7,4 +7,6 @@ export default function SectionGroupBody({ place, sections: Sections, editing, w
|
|
|
7
7
|
navTextCase?: unknown;
|
|
8
8
|
menuRow?: unknown;
|
|
9
9
|
toolTextStyle?: unknown;
|
|
10
|
+
iconSize?: unknown;
|
|
11
|
+
cartIcon?: unknown;
|
|
10
12
|
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import{PhoneMenuToolsProvider as g}from"efficient-web-builder/render/components/PhoneMenuTools";import{AccountInPhoneMenuProvider as P}from"./PhoneMenuAccount.js";import{SectionGroupWidthsProvider as b}from"efficient-web-builder/render/components/SiteGutterFrame";import{chromeOwnWidth as x}from"efficient-web-builder/format/lib/content/section-width";import{centredCap as k,SITE_WIDTH_CAP as S}from"efficient-web-builder/format/lib/content/page-width";import{resolveHeaderToolLook as y,resolveMenuRow as H,resolveNavTextCase as _}from"../lib/content/header-bar.js";import{HeaderToolLookContext as w}from"./HeaderTools.js";import{HideTaker as A}from"efficient-web-builder/render/components/ViewHideRoot";import{textKindVars as E}from"../lib/content/text-kind-vars.js";import{blockParts as a}from"../lib/block-parts.js";const O=a("SiteHeader")("header-content"),R=a("SiteFooter")("footer"),M={font:"--sf-header-tool-font",size:"--sf-header-tool-size"};function C(o){const n=E(o,M);return Object.keys(n).length?n:null}function L({place:o,sections:n,editing:c=!1,widths:u,navTextCase:f,menuRow:m,toolTextStyle:s,iconSize:h,cartIcon:v}){const p=o==="footer"?"footer":"div",e=x(u),r=e.content==="full"?"100vw":e.contentMax===null?null:`${e.contentMax}px`,d=o==="footer"&&e.background==="content"?k(S):null,l=o==="header"?C(s):null,T=r===null&&d===null&&l===null?void 0:{...d,...r===null?null:{"--sf-site-width":r},...l},i=t(A,{as:p,"data-section-group":o,...o==="header"?{"data-header-nav-case":_(f),"data-header-menu-row":H(m)??"top",...l?{"data-header-tool-style":String(s)}:null}:null,className:c&&o==="footer"?"sf-theme-surfaces bg-bg text-fg":void 0,style:T,...o==="header"?O:R,children:t(b,{value:{background:e.background,content:e.content==="content"?"content":null},children:t(n,{minEmptyHeight:120})})});return o==="header"?t(g,{children:t(P,{children:t(w.Provider,{value:y({cartIcon:v,iconSize:h}),children:i})})}):i}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as a,Fragment as g}from"react/jsx-runtime";import{formatPrice as S}from"../../lib/commerce.js";import{say as w}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as f}from"efficient-web-builder/render/components/ViewHideRoot";import{setLabel as
|
|
1
|
+
"use client";import{jsx as n,jsxs as a,Fragment as g}from"react/jsx-runtime";import{formatPrice as S}from"../../lib/commerce.js";import{say as w}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as f}from"efficient-web-builder/render/components/ViewHideRoot";import{setLabel as R}from"../../lib/wheels/variants.js";import{wheelCardPriceLine as b}from"../../lib/wheels/set-mode.js";import{bundlePrice as y,EACH_UNIT as L,formatSelectionPrice as T,formatSelectionWasPrice as W,formatWheelPrice as P,formatWheelWasPrice as C,FROM_PREFIX as d,FROM_PREFIX_START as _,priceIn as F,resolveWheelPrice as v}from"../../lib/wheels/price-display.js";import{CARD_TEXT_SIZE as u,CardRow as N}from"./card-row.js";import{RegionBridge as z,RegionWords as E,regionAttr as I}from"./card-text-region.js";import{useHeroStateOrNull as $,useProductCardState as j}from"./ProductCardState.js";import{useTaxNote as k}from"./useTaxNote.js";import{blockParts as B}from"../../lib/block-parts.js";const h=B("ProductCard"),te=["from","From"];function O(e,r){return r==="From"&&e.startsWith(d)?_+e.slice(d.length):e}function A(e,r){if(e.kind==="tyre"){const m=v(F(e.tyre.prices,e.currency),null);return{was:null,amount:P(m,e.currency,d),note:m.priced?L:null,priced:m.priced}}const{wheel:t,currency:o,price:i,sel:l,isSet:p}=e,c=v(t.prices[o],t.msrpPrices?.[o]),s=r.setTotal&&i.priced&&i.setTotal!=null&&l.selectedVariant?`${R(l.selectedVariant)} · ${S(i.setTotal,o)}`:null;return p&&r.quoteSets?{was:null,amount:b(P(c,o,d),c.priced),note:s,priced:c.priced}:{was:r.wasFollowsSize?W(i,o):C(c,o),amount:b(T(i,o),i.priced),note:s,priced:i.priced}}function H({state:e,region:r}){const t=k(),o=a(f,{className:"flex items-baseline gap-5 border-t border-line pt-[18px]",children:[e.msrpLabel&&n("div",{className:"font-mono text-[length:var(--size-label,15px)] text-fg-dim line-through",children:e.msrpLabel}),n("div",{className:"font-heading2 text-[length:min(var(--size-headingMedium,36px),var(--sf-heading-max,9999px))] font-bold leading-none tracking-[-0.01em] text-fg",...I(r,"price"),children:n(E,{region:r,at:"price",children:e.amount})}),e.unitLabel&&n("div",{className:"font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.unitLabel}),e.unitLabel&&t&&n("div",{className:"font-mono text-[length:var(--size-label,13px)] text-fg-dim","data-tax-note":"",children:t}),e.packBadge&&n("div",{className:"ml-auto border border-accent px-3 py-2 font-mono text-[length:var(--size-label,13px)] font-bold uppercase tracking-[0.18em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)"},children:e.packBadge})]});return n(z,{region:r,sectionType:"ProductPrice",children:o})}function M({show:e=!0,region:r,...t}){const o=$();return o?n(H,{state:o,region:r}):n(D,{show:e,...t})}function X({state:e,show:r}){if(!r)return null;const t=y(e.bundle,e.currency);return a(g,{children:[t&&a(f,{className:`mt-1 font-mono ${u.labelLarge}`,...h("price"),children:[n("span",{className:"mr-2 text-fg-dim line-through",children:t.was}),t.amount]}),!e.bundle.inStock&&n(f,{className:`mt-1 font-mono ${u.labelSmall} uppercase tracking-[0.24em] text-fg-dim`,children:w("Currently unavailable")})]})}function D({show:e=!0,...r}){const t=j(),o=k();if(t.kind==="bundle")return n(X,{state:t,show:e});const i=A(t,r),{was:l,note:p,priced:c}=i,s=O(i.amount,r.priceWord),x=[p,c?o:null].filter(Boolean).join(" · ")||null;return a(g,{children:[n(N,{children:e?a("div",{className:`mt-2 font-mono ${u.labelLarge}`,...h("price"),children:[l&&n("span",{className:"mr-2 text-fg-dim line-through",children:l}),s]}):null}),n(N,{children:e&&x?n("div",{className:`mt-[2px] font-mono ${u.labelSmall} tracking-[0.08em] text-fg-dim`,...h("price-note"),children:x}):null})]})}export{te as PRICE_WORDS,M as default,O as withPriceWord};
|
|
@@ -40,3 +40,33 @@ export declare const HEADER_LINK_OPACITY_MAX = 100;
|
|
|
40
40
|
export declare const HEADER_LINK_OPACITY_ATTR = "data-header-link-opacity";
|
|
41
41
|
export declare const HEADER_LINK_OPACITY_VAR = "--sf-header-link-opacity";
|
|
42
42
|
export declare function readHeaderLinkOpacity(v: unknown): number | undefined;
|
|
43
|
+
export declare const HEADER_ICON_SIZES: readonly [{
|
|
44
|
+
readonly label: "Medium";
|
|
45
|
+
readonly value: "medium";
|
|
46
|
+
}, {
|
|
47
|
+
readonly label: "Large";
|
|
48
|
+
readonly value: "large";
|
|
49
|
+
}];
|
|
50
|
+
type HeaderIconSize = (typeof HEADER_ICON_SIZES)[number]["value"];
|
|
51
|
+
export declare const HEADER_ICON_SIZE_FALLBACK: HeaderIconSize;
|
|
52
|
+
export declare const HEADER_CART_ICONS: readonly [{
|
|
53
|
+
readonly label: "Cart";
|
|
54
|
+
readonly value: "cart";
|
|
55
|
+
}, {
|
|
56
|
+
readonly label: "Bag";
|
|
57
|
+
readonly value: "bag";
|
|
58
|
+
}];
|
|
59
|
+
type HeaderCartIcon = (typeof HEADER_CART_ICONS)[number]["value"];
|
|
60
|
+
export declare const HEADER_CART_ICON_FALLBACK: HeaderCartIcon;
|
|
61
|
+
export interface HeaderToolLook {
|
|
62
|
+
cart: HeaderCartIcon;
|
|
63
|
+
glyph: {
|
|
64
|
+
size: number;
|
|
65
|
+
stroke: number;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export declare const resolveHeaderToolLook: (p: {
|
|
69
|
+
cartIcon?: unknown;
|
|
70
|
+
iconSize?: unknown;
|
|
71
|
+
}) => HeaderToolLook;
|
|
72
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HEADER_HEIGHT_PX as
|
|
1
|
+
import{HEADER_HEIGHT_PX as r}from"efficient-web-builder/render/lib/document/header-clearance";import{parseOption as o}from"efficient-shell/format";function T(e){return typeof e=="number"&&Number.isInteger(e)&&e>=r.min&&e<=r.max?e:r.default}const L="fixed inset-x-0 bottom-0 top-[var(--sf-header-h,88px)]",d=e=>!!e&&e.startsWith("/wheels/")&&e!=="/wheels",I=(e,t)=>!e&&t?"var(--section-bg)":"var(--bg)",n=[{label:"Uppercase",value:"uppercase"},{label:"Capitalised",value:"capitalised"}],a="uppercase",C=e=>o(n,a,e),l=[{label:"Icon",value:"icon"},{label:"Text",value:"text"}],s="icon",m=e=>o(l,s,e),D=[{label:"Own row",value:"top"},{label:"Same row",value:"inline"}],S="top",b=e=>e==="inline"?"inline":e==="top"||e==="bottom"?"top":null,E="custom";function N(e,t){return e!==E||typeof t!="string"?null:t.trim()||null}const O=80,_=0,i=100,f="data-header-link-opacity",g="--sf-header-link-opacity";function h(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(i,Math.max(_,Math.round(e)))}const p=[{label:"Medium",value:"medium"},{label:"Large",value:"large"}],c="medium",A={medium:{size:18,stroke:1.6},large:{size:20,stroke:1.4}},u=[{label:"Cart",value:"cart"},{label:"Bag",value:"bag"}],x="cart",v=e=>({cart:o(u,x,e.cartIcon),glyph:A[o(p,c,e.iconSize)]});export{u as HEADER_CART_ICONS,x as HEADER_CART_ICON_FALLBACK,p as HEADER_ICON_SIZES,c as HEADER_ICON_SIZE_FALLBACK,f as HEADER_LINK_OPACITY_ATTR,O as HEADER_LINK_OPACITY_DEFAULT,i as HEADER_LINK_OPACITY_MAX,_ as HEADER_LINK_OPACITY_MIN,g as HEADER_LINK_OPACITY_VAR,D as HEADER_MENU_ROWS,S as HEADER_MENU_ROW_FALLBACK,n as HEADER_NAV_TEXT_CASES,a as HEADER_NAV_TEXT_CASE_FALLBACK,E as HEADER_TOP_INK_CUSTOM,l as HEADER_UTIL_STYLES,s as HEADER_UTIL_STYLE_FALLBACK,L as UNDER_HEADER_SHEET_CLASS,I as headerSolidBackground,d as isProductPage,h as readHeaderLinkOpacity,N as readHeaderTopInk,T as resolveHeaderHeightPx,v as resolveHeaderToolLook,b as resolveMenuRow,C as resolveNavTextCase,m as resolveUtilStyle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import f from"../../../../../components/BoxHeaderBar.js";import u from"../../../../../components/SectionGroupBody.js";import{headerBarFromProps as T}from"../../../published-header-bar.js";import{SiteHeaderMeta as g}from"./meta.js";const P={...g,render:({sections:n,navTextCase:a,toolTextStyle:p,iconSize:d,cartIcon:m,menuRow:s,sticky:c,topTextColor:x,topTextCustom:h,linkOpacity:l,heightPx:y,sectionAccent:C,editor:t,...o})=>{const r=i(u,{place:"header",sections:n,widths:o,navTextCase:a,menuRow:s,toolTextStyle:p,iconSize:d,cartIcon:m,editing:t?.isEditing});if(!t?.isEditing)return r;const e=T({sticky:c,topTextColor:x,topTextCustom:h,linkOpacity:l,heightPx:y,sectionAccent:C,...o});return i(f,{sticky:e.sticky,topTextColor:e.topTextColor,topTextCustom:e.topTextCustom,linkOpacity:e.linkOpacity,heightPx:e.heightPx,theme:e.theme,bandCapped:e.bandCapped,children:r})}};export{P as SiteHeaderRender};
|
|
@@ -45,7 +45,6 @@ export declare function resolveSelectionPrice(wheel: {
|
|
|
45
45
|
} | null | undefined, currency: string, sets?: number): SelectionPriceDisplay;
|
|
46
46
|
export declare function formatSelectionPrice(price: SelectionPriceDisplay, currency: Currency): string;
|
|
47
47
|
export declare function formatSelectionWasPrice(price: SelectionPriceDisplay, currency: Currency): string | null;
|
|
48
|
-
export declare function setPriceLabel(price: SelectionPriceDisplay, currency: Currency): string;
|
|
49
48
|
export declare function bundlePrice(bundle: Pick<Bundle, "components" | "savings" | "savingIsFrom">, currency: Currency): {
|
|
50
49
|
was: string;
|
|
51
50
|
amount: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{formatPrice as s,setPrice as P,WHEELS_PER_SET as m}from"../commerce.js";const c="Price on request",
|
|
1
|
+
import{formatPrice as s,setPrice as P,WHEELS_PER_SET as m}from"../commerce.js";const c="Price on request",d="Request a quote",f="from ",R="From ",w="each",h="Free",I="Updating";function i(t){return typeof t=="number"&&Number.isFinite(t)&&t>0}function a(t,e){const n=t?.[e];return i(n)?n:null}function _(t,e,n,l){const r=a(t,n),o=a(e,n);return r===null&&o===null?0:r===null?1:o===null?-1:l==="asc"?r-o:o-r}function U(t,e,n,l){if(n==null&&l==null)return!0;const r=a(t,e);return!(r===null||n!=null&&r<n||l!=null&&r>l)}const E={priced:!1,unit:null,was:null,onSale:!1,setTotal:null};function T(t,e,n){if(!i(t))return E;const l=i(e)&&e>t?e:null;return{priced:!0,unit:t,was:l,onSale:l!==null,setTotal:n!=null?t*n:null}}function g(t,e,n=""){return!t.priced||t.unit==null?c:`${n}${s(t.unit,e)}`}function N(t,e){return t.was==null?null:s(t.was,e)}function x(t,e,n=1){const l=P(t,e);if(l===null)return{priced:!1,unit:null,isFrom:!1,setTotal:null};const r=t.reduce((u,p)=>u+p.wheels,0),o=Math.min(...t.map(u=>u.prices[e]));return{priced:!0,unit:o,isFrom:o*r!==l,setTotal:l*n}}const F={priced:!1,unit:null,isFrom:!1,was:null,onSale:!1,setTotal:null};function C(t,e,n,l=1){const r=T(t.prices[n],t.msrpPrices?.[n],m),o=r.setTotal==null?null:r.setTotal*l;if(!e)return{priced:r.priced,unit:r.unit,isFrom:!0,was:r.was,onSale:r.onSale,setTotal:null,fromSetTotal:o};const u=x(e.components,n,l);return u.priced?{priced:!0,unit:u.unit,isFrom:u.isFrom,was:null,onSale:!1,setTotal:u.setTotal,fromSetTotal:o}:{...F,fromSetTotal:o}}function L(t,e){return!t.priced||t.unit==null?c:`${t.isFrom?f:""}${s(t.unit,e)}`}function W(t,e){return t.was==null?null:s(t.was,e)}function $(t,e){const n=t.savings[e];if(n===void 0||t.components.length===0)return null;let l=0;for(const o of t.components){const u=o.prices?.[e];if(typeof u!="number")return null;l+=u*o.quantity}const r=s(l-n,e);return{was:s(l,e),amount:t.savingIsFrom?`${f}${r}`:r}}export{w as EACH_UNIT,I as FIGURE_UPDATING,h as FREE_PRICE,f as FROM_PREFIX,R as FROM_PREFIX_START,d as SET_QUOTE_LABEL,c as UNPRICED_LABEL,$ as bundlePrice,_ as comparePrice,L as formatSelectionPrice,W as formatSelectionWasPrice,g as formatWheelPrice,N as formatWheelWasPrice,i as isPriced,a as priceIn,C as resolveSelectionPrice,x as resolveSetPrice,T as resolveWheelPrice,U as withinPriceRange};
|