efficient-storefront-blocks 0.82.0 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/chunks/EditorPreviewCheckout-3NVDTH56.js +4 -0
- package/dist/chunks/{SiteEditorProvider-5YHSOW4Y.js → SiteEditorProvider-77K7CGYZ.js} +1 -1
- package/dist/chunks/chunk-5EQD5D3L.js +340 -0
- package/dist/chunks/{chunk-NSBGNY7R.js → chunk-DQFD2BJD.js} +1 -1
- package/dist/chunks/{chunk-47L7KHRW.js → chunk-VJLQXB7I.js} +1 -1
- package/dist/chunks/chunk-VYOK2XBF.js +1 -0
- package/dist/chunks/{fitment-data-SZWTO4WT.js → fitment-data-PWXEDMOA.js} +1 -1
- package/dist/contract.js +22 -2
- package/dist/editor/lib/document/blocks/commerce/ProductHero/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/FooterMenu/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/MenuLinkBlock/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/MenuLinkBlock/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/index.js +1 -1
- package/dist/editor/lib/document/box-header.d.ts +1 -0
- package/dist/editor/lib/document/box-header.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/document/section-text-regions.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +5 -1
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +44 -73
- package/dist/render/app/globals.css +15 -6
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/FinishSwatches.js +2 -1
- package/dist/render/components/FooterMenu.d.ts +9 -9
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/LinkedProductHero.d.ts +2 -2
- package/dist/render/components/MenuLinkBlock.d.ts +7 -0
- package/dist/render/components/MenuLinkBlock.js +1 -0
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/ProductHeroPanel.d.ts +5 -5
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/ProductRef.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.d.ts +9 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/ClippedPictures.d.ts +10 -0
- package/dist/render/components/card-pieces/ClippedPictures.js +1 -0
- package/dist/render/components/card-pieces/HostPart.d.ts +2 -1
- package/dist/render/components/card-pieces/HostPart.js +1 -1
- package/dist/render/components/card-pieces/ProductCardState.d.ts +12 -0
- package/dist/render/components/card-pieces/ProductCardState.js +1 -1
- package/dist/render/components/card-pieces/useHeldCardPicture.d.ts +16 -0
- package/dist/render/components/card-pieces/useHeldCardPicture.js +1 -0
- package/dist/render/components/checkout/CheckoutPageClient.d.ts +2 -1
- package/dist/render/components/checkout/CheckoutPageClient.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +1 -0
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/pdp-dynamic/DynamicProductHero.d.ts +2 -2
- package/dist/render/components/product-hero/stage-photo.d.ts +6 -0
- package/dist/render/components/product-hero/stage-photo.js +3 -3
- package/dist/render/components/useFinishSelection.d.ts +3 -0
- package/dist/render/components/useFinishSelection.js +3 -1
- package/dist/render/components/useProductCatalog.d.ts +2 -0
- package/dist/render/components/wheels-plp/PlpCard.js +1 -1
- package/dist/render/lib/api/types.d.ts +15 -2
- package/dist/render/lib/catalog/relationships.js +1 -1
- package/dist/render/lib/checkout/pay-first.d.ts +19 -0
- package/dist/render/lib/checkout/pay-first.js +1 -1
- package/dist/render/lib/content/hero-price-seed.d.ts +4 -0
- package/dist/render/lib/content/hero-price-seed.js +1 -0
- package/dist/render/lib/content/menu-card-seed.d.ts +6 -0
- package/dist/render/lib/content/menu-card-seed.js +1 -0
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.d.ts +4 -0
- package/dist/render/lib/document/blocks/commerce/ProductHero/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductHero/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterMenu/meta.d.ts +6 -0
- package/dist/render/lib/document/blocks/service/FooterMenu/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/FooterMenu/render.js +1 -1
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/render.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/MenuLinkBlock/render.js +1 -0
- package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/metas.js +1 -1
- package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/renders.js +1 -1
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/footer-page-blocks.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/menu-link.d.ts +8 -0
- package/dist/render/lib/sections/product-price-text-regions.d.ts +4 -0
- package/dist/render/lib/sections/product-price-text-regions.js +1 -0
- package/dist/render/lib/wheels/signed-url.d.ts +3 -0
- package/dist/render/lib/wheels/signed-url.js +1 -0
- package/dist/words.d.ts +26 -10
- package/dist/words.js +4 -4
- package/package.json +3 -3
- package/dist/chunks/EditorPreviewCheckout-XM22X3CX.js +0 -4
- package/dist/chunks/chunk-T2R5CZ2F.js +0 -1
- package/dist/chunks/chunk-VIPMT34C.js +0 -320
- package/dist/render/lib/sections/product-hero-text-regions.d.ts +0 -3
- package/dist/render/lib/sections/product-hero-text-regions.js +0 -1
- /package/dist/chunks/{chunk-VIPMT34C.js.LEGAL.txt → chunk-5EQD5D3L.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-VVWX2P2N.js → chunk-F3MB7QCR.js} +0 -0
|
@@ -2506,7 +2506,8 @@ em.text-accent {
|
|
|
2506
2506
|
· the hero (HeroSingle's section, the slideshow's viewport) is a column
|
|
2507
2507
|
at least as tall as the height that applies at this width: the set
|
|
2508
2508
|
phone height (`--sf-hero-h-m`, which the builder writes on the
|
|
2509
|
-
element), from 720px the
|
|
2509
|
+
element), from 720px the tablet height if one is set (`--sf-hero-h-t`),
|
|
2510
|
+
else the set desktop height (`--sf-hero-h-d`; 720 is
|
|
2510
2511
|
the height control's own line and picks WHICH height, nothing else —
|
|
2511
2512
|
the rule just below this block), or, with no set height,
|
|
2512
2513
|
`max(100vh, 680px)`: the pixels `h-screen min-h-[680px]` drew;
|
|
@@ -2552,14 +2553,15 @@ em.text-accent {
|
|
|
2552
2553
|
width: 100%;
|
|
2553
2554
|
}
|
|
2554
2555
|
}
|
|
2555
|
-
/* …and WHICH height is the minimum between 720 and 800: the
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2556
|
+
/* …and WHICH height is the minimum between 720 and 800: the Tablet view's own
|
|
2557
|
+
(`--sf-hero-h-t`, the builder writes it only when a tablet height is stored),
|
|
2558
|
+
else the desktop one, as the builder's own `view-tablet:h-[var(--sf-hero-h-d)]`
|
|
2559
|
+
says (VIEW_TABLET_MIN, the line the Height control switches on). Only the
|
|
2560
|
+
height is chosen here; the layout above is on the hero's one line, 800. */
|
|
2559
2561
|
@media (min-width: 720px) and (max-width: 800px) {
|
|
2560
2562
|
section:not([data-slide-name]):has(> .sf-hero-group-layer),
|
|
2561
2563
|
div:has(> .hero-track) {
|
|
2562
|
-
min-height: var(--sf-hero-h-d, max(100vh, 680px));
|
|
2564
|
+
min-height: var(--sf-hero-h-t, var(--sf-hero-h-d, max(100vh, 680px)));
|
|
2563
2565
|
}
|
|
2564
2566
|
}
|
|
2565
2567
|
|
|
@@ -3161,6 +3163,13 @@ em.text-accent {
|
|
|
3161
3163
|
.sf-pad-right-tablet {
|
|
3162
3164
|
padding-right: var(--sf-pad-r-tablet) !important;
|
|
3163
3165
|
}
|
|
3166
|
+
/* A picture's TABLET focus: the same split as `.sf-focus-phone`. The desktop
|
|
3167
|
+
point is the picture's INLINE `object-position`, and the builder's
|
|
3168
|
+
lib/content/phone-focus adds this class and its variable only when a tablet
|
|
3169
|
+
point is set, so a picture without one draws the bytes it drew. */
|
|
3170
|
+
.sf-focus-tablet {
|
|
3171
|
+
object-position: var(--sf-focus-tablet) !important;
|
|
3172
|
+
}
|
|
3164
3173
|
}
|
|
3165
3174
|
|
|
3166
3175
|
/* ── A section's phone padding ────────────────────────────────────────────────
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as d}from"react/jsx-runtime";function x({finishes:c,availability:
|
|
1
|
+
"use client";import{jsx as t,jsxs as d}from"react/jsx-runtime";function x({finishes:c,availability:u,selectedIdx:a,hoverIdx:s,activeFinish:i,onSelect:f,onHover:r,showLabel:g=!0,className:m}){return d("div",{className:["mt-4",m].filter(Boolean).join(" "),children:[t("div",{className:"flex flex-wrap items-center gap-2",onMouseLeave:()=>r(null),onClick:e=>e.preventDefault(),children:c.map((e,n)=>{if(!u[n])return null;const l=n===a,p=s===n&&s!==a;return t("button",{type:"button",title:e.name,"aria-label":e.name,"aria-pressed":l,onMouseEnter:()=>r(n),onFocus:()=>r(n),onBlur:()=>r(null),onClick:o=>{o.preventDefault(),o.stopPropagation(),f(n)},className:["h-4 w-4 shrink-0 rounded-full transition-all",l?"ring-2 ring-accent ring-offset-2 ring-offset-surface":p?"ring-1 ring-fg ring-offset-2 ring-offset-surface":"ring-1 ring-fg/30 ring-offset-1 ring-offset-surface"].join(" "),style:{background:e.color,border:"1px solid var(--swatch-border)"}},`${e.name}
|
|
2
|
+
${e.src}`)})}),g&&i&&t("div",{className:"mt-2 truncate font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:i.name})]})}export{x as default};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
url: string;
|
|
4
|
-
dropdown_items?: {
|
|
5
|
-
label: string;
|
|
6
|
-
url: string;
|
|
7
|
-
}[];
|
|
8
|
-
}
|
|
1
|
+
import type { SlotComponent } from "efficient-easel/blocks";
|
|
2
|
+
import type { FooterMenuItem } from "../lib/menu-link.js";
|
|
9
3
|
export interface FooterMenuValue {
|
|
10
4
|
id?: string;
|
|
11
5
|
handle?: string;
|
|
12
6
|
name?: string;
|
|
13
7
|
items?: FooterMenuItem[];
|
|
14
8
|
}
|
|
9
|
+
export interface MenuOwner {
|
|
10
|
+
id: string;
|
|
11
|
+
type: string;
|
|
12
|
+
template?: SlotComponent;
|
|
13
|
+
}
|
|
15
14
|
export interface FooterMenuProps {
|
|
15
|
+
owner: MenuOwner;
|
|
16
16
|
menu?: FooterMenuValue | null;
|
|
17
17
|
heading?: string;
|
|
18
18
|
accordionMobile?: boolean;
|
|
@@ -22,4 +22,4 @@ export interface FooterMenuProps {
|
|
|
22
22
|
linkAlign?: unknown;
|
|
23
23
|
linkRange?: unknown;
|
|
24
24
|
}
|
|
25
|
-
export default function FooterMenu({ menu, heading, accordionMobile, showDividers, editing, layout, linkAlign, linkRange, }: FooterMenuProps): import("react").JSX.Element;
|
|
25
|
+
export default function FooterMenu({ owner, menu, heading, accordionMobile, showDividers, editing, layout, linkAlign, linkRange, }: FooterMenuProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,Fragment as D,jsxs as r}from"react/jsx-runtime";import{useCallback as H,useEffect as U,useRef as F,useState as O}from"react";import j from"next/link";import{REPEAT_ATTRIBUTE as $,REPEAT_INDEX_ATTRIBUTE as B}from"efficient-easel/draw";import W from"./CountrySelect.js";import{MenuPlaceContext as z}from"./MenuLinkBlock.js";import G from"./ThemeToggle.js";import{CardRowContext as Y,CardTemplateRows as q}from"efficient-web-builder/render/components/CardRowContext";import{renderChrome as _}from"efficient-web-builder/render/components/goldPhrases";import{UTIL_WORDS as X}from"./HeaderTools.js";import{usePhoneMenuTools as J}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as K}from"./SearchContext.js";import{useModalDismiss as Q}from"./useModalDismiss.js";import V from"efficient-easel/screen/components/UiIcon";import{usePreviewMenus as Z}from"./PreviewMenusContext.js";import{FOOTER_MENU_PLACEHOLDER_COUNT as ee,FOOTER_MENU_PLACEHOLDER_HEADING as ne,FOOTER_MENU_PLACEHOLDER_HINT as le}from"../lib/content/menu-placeholder.js";import{say as w}from"efficient-web-builder/format/lib/editor-words";import{UNDER_HEADER_SHEET_CLASS as te}from"../lib/content/header-bar.js";import{isMenuOrphaned as re}from"../lib/menu-source.js";import{legacyBlockAlignOf as ae}from"../lib/content/legacy-block-align.js";import{menuLinkInRange as oe,resolveMenuLinkRange as ie}from"../lib/content/menu-row.js";const se="flex list-none flex-col gap-3 text-[13px]",C="mb-4 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",k="text-[12px] italic text-fg-dim/70",S=(n,l)=>n&&l>0?"border-t border-line pt-3":"",I=n=>({label:n.label??"",href:n.url??""}),ce=Array.from({length:ee},()=>({label:"",href:""}));function L({owner:n,items:l,place:s,wrap:a}){const g=l?l.map(I):ce;return e(z.Provider,{value:l?s:{...s,placeholder:!0},children:e(q,{ownerId:n.id,ownerType:n.type,Template:n.template,rows:g,items:l??void 0,fallback:null,wrapCopy:a,children:c=>c})})}const M=n=>(n.template?.blockCount??0)>0,P="This menu draws no links: its card template is empty. Undo the delete, or delete this Menu and add it again.";function me({owner:n,items:l,label:s,editing:a,linkAlign:g,linkRange:c}){const E=ae(g),p=ie(c),y=!!p&&l!==null&&p.to!==void 0&&p.to<l.length,[f,v]=O(!1),h=F(null),t=J(),{open:m}=K(),R=s||"Menu",N=H(()=>v(!1),[]);Q({active:f,onDismiss:N,scopeRef:h});const T=e(L,{owner:n,items:l,place:{place:"row"},wrap:(d,u)=>{const b=l!==null&&p&&!oe(p,u.index+1)?{"data-menu-out":""}:null;return e("li",{className:"",...b,children:d})}}),o=(d,u,b)=>a?{[$]:`${d}:${b<0?"panel":"dropdown"}`,[B]:`${b+1}.${u.index}`}:null,x=e(L,{owner:n,items:l,place:{place:"panel",onNavigate:N},wrap:(d,u)=>r(D,{children:[e("li",{className:"flex min-h-14 items-center border-b border-line",...o(n.id,u,-1),children:d}),l===null?null:(u.item?.dropdown_items??[]).map((b,A)=>e(Y.Provider,{value:{...u,row:I(b),item:b},children:e("li",{className:"flex min-h-12 items-center border-b border-line pl-5 text-[14px]",...o(n.id,u,A),children:d})},A))]})}),i=t&&(t.search||t.region||t.account||t.theme)?t:null;return!a&&l!==null&&!M(n)&&!i?null:r("nav",{ref:h,"aria-label":R,"data-menu-row":"",...E?{"data-menu-align":E}:null,...y?{"data-menu-part":"lead"}:null,className:"min-w-0",children:[e("ul",{className:"m-0 hidden list-none flex-wrap items-center gap-x-8 gap-y-2 p-0 font-mono text-[13px] uppercase tracking-[0.18em] view-tablet:flex",children:T}),e("button",{type:"button",className:"flex h-11 w-11 items-center justify-center view-tablet:hidden","aria-expanded":f,"aria-label":f?"Close the menu":"Open the menu",onClick:()=>v(d=>!d),children:e("svg",{width:"22",height:"22",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round","aria-hidden":"true",children:f?e("path",{d:"M6 6l12 12M18 6L6 18"}):e("path",{d:"M4 7h16M4 12h16M4 17h16"})})}),f?r("div",{role:"dialog","aria-label":R,className:`${te} z-[60] flex flex-col overflow-y-auto bg-bg text-fg view-tablet:hidden`,children:[e("ul",{className:"m-0 flex list-none flex-col px-5 py-3 font-mono text-[16px] uppercase tracking-[0.18em]",children:x}),i?r("div",{className:"mt-auto flex flex-col gap-4 border-t border-line bg-surface p-5",children:[i.search?r("button",{type:"button",className:"flex h-12 items-center gap-3 border border-line bg-bg px-4 text-left text-[15px]",onClick:a?void 0:()=>{N(),m()},children:[e(V,{name:"search",size:18,strokeWidth:1.6,rounded:!0}),X.search]}):null,i.account?r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),e(j,{href:"/account",onClick:N,className:"mono-eyebrow underline",children:"Your account"})]}):null,i.region?r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),e(W,{})]}):null,i.theme?r("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),e(G,{})]}):null]}):null]}):null]})}function de({owner:n,menu:l,heading:s,accordionMobile:a=!1,showDividers:g=!1,editing:c=!1,layout:E="column",linkAlign:p,linkRange:y}){const{live:f,ready:v}=Z(),h=re({id:l?.id,handle:l?.handle,editing:c,ready:v,live:f}),t=h?[]:l?.items??[],m=s||l?.name||"",[R,N]=O(!1);if(U(()=>{if(!a)return;const o=window.matchMedia("(max-width: 800px)"),x=()=>N(o.matches);return x(),o.addEventListener("change",x),()=>o.removeEventListener("change",x)},[a]),E==="row"&&c&&!h&&t.length>0&&!M(n))return e("p",{className:k,children:w(P)});if(E==="row")return e(me,{owner:n,items:h?null:t,label:m,editing:c,linkAlign:p,linkRange:y});const T=o=>e("ul",{className:se,children:e(L,{owner:n,items:o,place:{place:"column"},wrap:(x,i)=>e("li",{className:o?S(g,i.index):`text-fg ${S(g,i.index)}`,children:x})})});return h?r("div",{className:"min-w-0",children:[e("h4",{className:C,children:s?_(s):w(ne)}),T(null),e("p",{className:`mt-3 ${k}`,children:w(le)})]}):t.length===0||!M(n)?r("div",{className:"min-w-0",children:[m?e("h4",{className:C,children:_(m)}):null,c?e("p",{className:k,children:t.length===0?w("This menu has no links yet — add them in {place}.",{place:w("Storefront → Menus")}):w(P)}):null]}):a&&R?r("details",{className:"min-w-0 border-b border-line",children:[r("summary",{className:"flex cursor-pointer list-none items-center justify-between py-3 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",children:[_(m),e("span",{"aria-hidden":!0,children:"+"})]}),e("div",{className:"pb-3",children:T(t)})]}):r("div",{className:"min-w-0",children:[m?e("h4",{className:C,children:_(m)}):null,T(t)]})}export{de as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import { type
|
|
2
|
+
import { type HeroPriceTemplateProps } from "./ProductHeroPanel.js";
|
|
3
3
|
import type { HeroPricePlacement } from "../lib/sections/hero-price-placement.js";
|
|
4
4
|
import type { HeroLayout, HeroTextAlign } from "../lib/sections/hero-arrangement.js";
|
|
5
5
|
import type { HeroGalleryMode, HeroImageFit } from "../lib/sections/hero-gallery.js";
|
|
@@ -11,7 +11,7 @@ export type LinkedHeroRecord = {
|
|
|
11
11
|
kind: "tyre";
|
|
12
12
|
tyre: Tyre;
|
|
13
13
|
};
|
|
14
|
-
interface HeroArrangement extends
|
|
14
|
+
interface HeroArrangement extends HeroPriceTemplateProps {
|
|
15
15
|
heroLayout?: HeroLayout;
|
|
16
16
|
imageRatio?: number;
|
|
17
17
|
textAlign?: HeroTextAlign;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface MenuPlace {
|
|
2
|
+
place: "column" | "row" | "panel";
|
|
3
|
+
placeholder?: boolean;
|
|
4
|
+
onNavigate?: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const MenuPlaceContext: import("react").Context<MenuPlace | null>;
|
|
7
|
+
export default function MenuLinkBlock(): import("react").JSX.Element | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as l}from"react/jsx-runtime";import{createContext as s,useContext as u}from"react";import p from"next/link";import f from"./HeaderNavItem.js";import m from"./MenuPlaceholderLabel.js";import{useCardRow as b}from"efficient-web-builder/render/components/CardRowContext";import{renderGold as o}from"efficient-web-builder/render/components/goldPhrases";import{isLabelOnlyMenuUrl as h}from"../lib/menu-link.js";const d=s(null),x=e=>/^https?:\/\//i.test(e),c="opacity-80 transition-opacity hover:opacity-100";function i({item:e,label:n,link:r,onNavigate:t}){return h(e.url)?l("span",{className:n,children:o(e.label)}):x(e.url)?l("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",className:r,onClick:t,children:o(e.label)}):l(p,{href:e.url,className:r,onClick:t,children:o(e.label)})}function k(){const e=b(),n=u(d);if(!e||!n)return null;if(n.placeholder)return l(m,{});const r={label:e.row.label??"",url:e.row.href??""};if(n.place==="column")return l(i,{item:r,label:"text-fg",link:"text-fg transition-colors hover:text-accent"});if(n.place==="panel")return l(i,{item:r,label:"",link:` ${c}`,onNavigate:n.onNavigate});const t=e.item?.dropdown_items??[];return t.length?l(f,{item:{href:r.url,label:o(r.label),plainLabel:r.label,dropdownItems:t.map(a=>({href:a.url,label:o(a.label),plainLabel:a.label}))}}):l(i,{item:r,label:"",link:` ${c}`})}export{d as MenuPlaceContext,k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as
|
|
1
|
+
"use client";import{jsx as e,Fragment as y,jsxs as F}from"react/jsx-runtime";import X from"next/image";import{useState as q}from"react";import{setSecondSrc as G}from"../lib/wheels/set-mode.js";import{CARD_INDEX_BADGE_CLASS as H,CARD_INDEX_CLASS as M}from"efficient-web-builder/format/lib/sections/product-card-style";import{coverSrcForWheel as O,resolvePaintedSrc as J}from"../lib/wheels/cover-rendering.js";import{wheelCardEyebrow as K,withSetChip as Q}from"./ProductCardEyebrow.js";import{withRMark as T}from"efficient-web-builder/render/components/RMark";import V from"./WheelPlaceholder.js";import{useProductCardChrome as Y}from"./ProductCardChrome.js";import Z,{CardBuyDialog as ee}from"./card-pieces/CardBuyButton.js";import re from"./card-pieces/CardFinishSwatches.js";import oe from"./card-pieces/CardPrice.js";import se from"./card-pieces/CardProductBadge.js";import{useHeldCardPicture as ae}from"./card-pieces/useHeldCardPicture.js";import{useWheelCardState as te,WheelCardStateProvider as ie}from"./card-pieces/ProductCardState.js";import{CardSpecFacts as ne}from"./card-pieces/CardSpecs.js";import de from"./WheelCardFrame.js";import{cardSpinOf as ce}from"./card-spin.js";function le({wheel:n,variant:t="compact",defaultFinish:r}){return e(ie,{wheel:n,defaultFinish:r,children:e(me,{variant:t})})}function me({variant:n}){const t=n==="catalog",{wheel:r,sel:o,isSet:d}=te(),{imageBackgroundFill:B,hover:P,coverIndex:E,indexBadge:m,outline:x,showBadge:k,fieldUsage:h,reserveEyebrow:_,showCardPrice:$,showCardFinishes:v,showCardSizes:z,showCardBuy:f,showCardPage:u,imageSizes:p}=Y(),c=t&&(f||u),A=O(r,E,o.finish?.name,o.shownSrc),D="h-full w-full",l=ce(P),[w,I]=q(()=>new Set),g=s=>{o.pictureFailed(s),I(i=>i.has(s)?i:new Set(i).add(s))},S=J({overrideSrc:A,hookSrc:o.shownSrc,failed:w}),C=(s,i)=>e(X,{alt:i,src:s,width:1e3,height:1e3,sizes:p,className:`block object-contain ${l.className} ${D}`,style:l.style,draggable:!1,onError:()=>g(s)},s),L=o.finish?`${r.name} — ${o.finish.name}`:r.name,j=d?G(r.finishes?.find(s=>s.name===o.finish?.name),S):null,a=ae({src:S,second:j,alt:L,sizes:p,failed:w,onFailed:g,near:o.nearScreen,holdEmpty:o.awaitingProbe}),N=F(y,{children:[a.src?C(a.src,a.alt):e(V,{imageLabel:r.name,spin:l}),a.trial]}),W=a.second?C(a.second,`${a.alt} — right`):void 0,b=K({kindLabel:null,brand:null,process:r.process?T(r.process):null},h),R=d&&!t?Q(b):b,U=m!=="off"?e("span",{"aria-hidden":!0,className:`${M} ${H}`}):null;return F(y,{children:[e(de,{variant:n,wide:d&&t,href:`/wheels/${r.slug}`,outline:x,imageBackgroundFill:B,probes:o.probes,reserveEyebrow:_,indexBadge:U,badges:e(se,{show:k,numbered:m!=="off",axleSets:!0}),image:N,imageSecond:W,eyebrow:R,spec:e(ne,{sizes:z,fieldUsage:h}),price:e(oe,{show:$,quoteSets:!0}),swatches:e(re,{show:v}),identityLink:c,wholeCardLink:!0,buy:e(Z,{buy:c&&f,page:c&&u})}),e(ee,{})]})}export{le as default};
|
|
@@ -4,12 +4,12 @@ import { type StoreProduct } from "../lib/catalog/store-product.js";
|
|
|
4
4
|
import type { HeroPricePlacement } from "../lib/sections/hero-price-placement.js";
|
|
5
5
|
import { type HeroLayout, type HeroTextAlign } from "../lib/sections/hero-arrangement.js";
|
|
6
6
|
import { type HeroGalleryMode, type HeroImageFit } from "../lib/sections/hero-gallery.js";
|
|
7
|
-
import type {
|
|
8
|
-
export interface
|
|
7
|
+
import type { SlotComponent } from "efficient-easel/blocks";
|
|
8
|
+
export interface HeroPriceTemplateProps {
|
|
9
9
|
nodeId?: string;
|
|
10
|
-
|
|
10
|
+
priceTemplate?: SlotComponent;
|
|
11
11
|
}
|
|
12
|
-
interface Props extends
|
|
12
|
+
interface Props extends HeroPriceTemplateProps {
|
|
13
13
|
product: StoreProduct;
|
|
14
14
|
selection: ProductSelection;
|
|
15
15
|
onLightbox: (src: string, alt: string) => void;
|
|
@@ -25,5 +25,5 @@ interface Props extends HeroTextRegionProps {
|
|
|
25
25
|
imageFit?: HeroImageFit;
|
|
26
26
|
trustBullets?: ReactNode;
|
|
27
27
|
}
|
|
28
|
-
export default function ProductHeroPanel({ product, selection, onLightbox, editing, pricePlacement, showVehicleFitment, heroLayout, imageRatio, textAlign, showSpecTable, showPriceQuote, galleryMode, imageFit, trustBullets, nodeId,
|
|
28
|
+
export default function ProductHeroPanel({ product, selection, onLightbox, editing, pricePlacement, showVehicleFitment, heroLayout, imageRatio, textAlign, showSpecTable, showPriceQuote, galleryMode, imageFit, trustBullets, nodeId, priceTemplate, }: Props): import("react").JSX.Element;
|
|
29
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as b,jsx as a,jsxs as n}from"react/jsx-runtime";import Q from"next/link";import{BUY_ROW_CLASS as Ne}from"./buy-row.js";import{useEffect as J,useRef as Se,useState as Te}from"react";import{useCart as we}from"./CartContext.js";import Re from"./QuoteLink.js";import{useSiteTakesOrders as _e}from"./SiteRecordContext.js";import Ee from"./EmailCaptureForm.js";import{useEnglish as I}from"./EnglishVariant.js";import Ae from"./QuantityStepper.js";import{MarkedLabel as $,heroView as Ce}from"./product-hero/hero-view.js";import Oe from"./ProductGallery.js";import{useRootIsDark as Le}from"efficient-shell/theme";import{useWishlist as ze}from"./WishlistContext.js";import{useStockAlertSignup as Ie}from"./useStockAlertSignup.js";import{SPARE_WORDS as $e,productCartLine as je}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as Me}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as De}from"../lib/catalog/product-options.js";import{STOCK_WORDS as Pe}from"../lib/content/stock-words.js";import{trackViewItem as Fe}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as He,DEFAULT_HERO_RATIO as Ue,DEFAULT_HERO_TEXT_ALIGN as Be,parseHeroLayout as Ve,parseHeroRatio as Ge,parseHeroTextAlign as We}from"../lib/sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as Ke,DEFAULT_HERO_IMAGE_FIT as qe}from"../lib/sections/hero-gallery.js";import{ADD_TO_BASKET_ATTR as Xe,MAX_SPARES as Ye,UNITS_PER_SET as Qe,formatPrice as Z}from"../lib/commerce.js";import{UNPRICED_LABEL as Je,formatSelectionPrice as Ze,setPriceLabel as et}from"../lib/wheels/price-display.js";import{productIsDually as tt,productIsTwoObjects as at,setSuppressesRow as nt}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as ee}from"../lib/sections/content-cap-gutter.js";import rt from"efficient-web-builder/render/components/TextRegionRun";import{SectionTextParts as lt}from"efficient-web-builder/render/lib/document/editing-bridges";import{TEXT_REGION_ATTR as it}from"efficient-web-builder/format/lib/sections/text-regions";const ot=4e3;function st(e){return e?[e.year,e.make,e.model,e.modification].join("-"):""}const ct=.72;function dt(e){const r=e.trim().split(/\s+/).filter(Boolean);if(r.length===0)return;const s=r.map((l,d)=>l.length+(r.length>1&&d===r.length-1?1:0));return`calc(100cqi / ${(Math.max(...s)*ct).toFixed(2)})`}function mt(e,r){return e?{[it]:r}:{}}function pt({editing:e,nodeId:r,partStyles:s,children:l}){return!e||!r?a(b,{children:l}):a(lt,{nodeId:r,sectionType:"ProductHero",partStyles:s,children:l})}function ft({product:e,selection:r,onLightbox:s,editing:l=!1,pricePlacement:d="top",showVehicleFitment:i=!0,heroLayout:p=He,imageRatio:T=Ue,textAlign:ae=Be,showSpecTable:ne=!0,showPriceQuote:w=!0,galleryMode:re=Ke,imageFit:le=qe,trustBullets:ie,nodeId:oe,partStyles:j}){const se=I(),v=Ve(p),M=We(ae),y=Ge(T),ce=v==="imageRight"?`${100-y}fr ${y}fr`:`${y}fr ${100-y}fr`,{picked:de,pick:D,qty:P,setQty:me,choice:g,setChoice:N,angleIdx:pe,setAngleIdx:fe,showValidation:ue,setShowValidation:R,manualMode:F,vehicle:_,rows:H,facts:be,part:x,outOfStock:U,offer:m,preOrder:E,canAddToCart:S,currency:k,price:u,set:B,msrpLabel:V}=r,c=Ce(e,r,l),A=tt(e),ge=at(e),C=i?c.vehicle:null,he=i?c.vehicleMemory:null,O=!Le({whenUnset:!0}),{addAndOpen:xe,warmCatalog:G}=we(),h=_e();J(()=>{!l&&h&&G(e.kind)},[l,h,e.kind,G]);const W=H.filter(t=>!E||t.values.length>0),K=W.filter(t=>t.role==="resolves"),L=W.filter(t=>t.role==="describes"&&!nt(ge,t.key)),q=L.findIndex(t=>t.chosen===null),X=(!C||!c.vehicleAnswersSpecs||r.fitmentSet)&&De(H,E)?q===-1?L:L.slice(0,q+1):[],ve=[...K,...X],ke=mt(l,"price"),z=a(pt,{editing:l,nodeId:oe,partStyles:j,children:n("div",{className:"flex items-baseline gap-5 border-t border-line pt-[18px]",children:[V&&a("div",{className:"font-mono text-[length:var(--size-label,15px)] text-fg-dim line-through",children:V}),a("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",...ke,children:a(rt,{region:"price",partStyles:j,children:A?et(u,k):Ze(u,k)})}),u.priced&&a("div",{className:"font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:c.unitLabel}),u.setTotal!=null&&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:[m.quantityLabel,": ",Z(B,k)]})]})}),Y=Se(null);return J(()=>{l||Y.current===e.slug||(Y.current=e.slug,Fe({itemId:x?`${e.slug}|${x.id}`:e.slug,itemName:e.name,variant:c.metaValue,pricePerSet:u.setTotal??u.fromSetTotal??0,currency:k}))},[l,e.slug,e.name,c.metaValue,x,u,k]),n(b,{children:[a("nav",{className:`border-b border-line ${ee} 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))]`,style:O?void 0:{background:"var(--section-bg)"},children:e.crumbs.map((t,o)=>n("span",{children:[o>0&&n(b,{children:[a("span",{className:"mx-3 text-accent",children:"/"}),a("wbr",{})]}),t.href?a(Q,{href:t.href,className:"hover:text-fg",children:a($,{text:t.label})}):a("span",{className:"text-fg",children:a($,{text:t.label})})]},`${t.label}-${o}`))}),n("section",{"data-hero-layout":v,"data-hero-align":M,className:[`grid gap-10 ${ee} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8`,v==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]"].join(" "),style:{...O?{}:{background:"var(--section-bg)"},...v==="stacked"?{}:{"--hero-cols":ce}},children:[a(Oe,{product:e,view:c,angleIdx:pe,onSelect:fe,isLight:O,onLightbox:s,galleryMode:re,imageFit:le,style:v==="imageRight"?{order:2}:void 0}),n("div",{className:["flex flex-col gap-7",M==="center"?"items-center text-center":""].filter(Boolean).join(" "),style:v==="imageRight"?{order:1}:void 0,children:[n("div",{className:"w-full [container-type:inline-size]",children:[n("div",{className:"mb-2.5 flex items-center gap-2.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-accent",children:[a("span",{children:a($,{text:e.eyebrow})}),e.badge&&n(b,{children:[a("span",{children:"·"}),a("span",{children:e.badge})]})]}),a("h1",{className:"font-heading2 text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]",style:{"--hero-name-fit":dt(c.heading)},children:(()=>{const t=c.heading.lastIndexOf(" ");if(t===-1)return c.heading;const o=c.heading.slice(0,t),f=c.heading.slice(t+1);return n(b,{children:[o," ",n("em",{className:"font-normal italic text-accent",children:[f,"."]})]})})()})]}),d!=="belowSpecs"&&w&&z,he,K.map(t=>a(te,{row:t,onPick:D},t.key)),E&&c.preOrder?n(b,{children:[d==="belowSpecs"&&w&&z,c.preOrder]}):n(b,{children:[C,X.map(t=>a(te,{row:t,onPick:D},t.key)),ne&&a(ut,{facts:be}),(m.packs.length>0||h&&(m.extra||m.spareCounts.length>0))&&n("div",{className:"border-b border-line pb-[26px]",children:[m.packs.length>0&&n(b,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),a("div",{className:"flex flex-wrap gap-1.5",children:m.packs.map(t=>n("button",{type:"button",onClick:()=>N(o=>({...o,unit:t.value})),"aria-pressed":g.unit===t.value,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",g.unit===t.value?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:g.unit===t.value?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[g.unit===t.value&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:t.label})]},t.value))})]}),h&&m.extra&&n("label",{className:`${m.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:[a("input",{type:"checkbox",checked:g.spares>0,onChange:t=>N(o=>({...o,spares:t.target.checked?Ye:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),m.extra.label]}),h&&m.spareCounts.length>0&&n(b,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:$e.howMany}),a("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:m.spareCounts.map(t=>{const o=t.value-Qe,f=g.spares===o;return n("button",{type:"button",onClick:()=>N(ye=>({...ye,spares:o})),"aria-pressed":f,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",f?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:f?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[f&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),n("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:[t.value," · ",t.label]})]},t.value)})})]}),h&&m.spareSide&&n(b,{children:[a("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:m.spareSide.label}),a("div",{className:"flex flex-wrap gap-1.5",children:m.spareSide.options.map(t=>{const o=g.spareSide===t.value;return n("button",{type:"button",onClick:()=>N(f=>({...f,spareSide:t.value})),"aria-pressed":o,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",o?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:o?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[o&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:t.label})]},t.value)})})]})]}),d==="belowSpecs"&&w&&z,n("div",{className:Ne,children:[h&&!(A&&!u.priced)&&a(Ae,{value:P,onChange:me,size:"large"}),!h||A&&!u.priced?a(Re,{className:"flex-1 cursor-pointer bg-btn px-6 py-4 text-center font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg"}):u.priced?U?a("button",{type:"button",disabled:!0,"aria-disabled":!0,className:"flex-1 cursor-not-allowed border-2 border-dashed border-fg-dim/20 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-fg-dim/40",children:Pe.outOfStock}):n("button",{type:"button",[Xe]:"",onClick:()=>{if(!S){R(!0),window.setTimeout(()=>R(!1),ot);return}if(R(!1),l)return;const t=je(e,x,de,{choice:g,qty:P},{fitmentLabel:F?c.specCaption:_.appliedName?`For ${_.appliedName}`:"",fitmentKey:F?`manual|${c.specCaption}`:`vehicle|${st(_.applied?.vehicle)}`});t&&xe(t)},"aria-disabled":!S,className:["flex-1 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] transition-colors",S?"cursor-pointer bg-btn text-btn-ink hover:bg-fg hover:text-bg":"cursor-pointer border-2 border-dashed border-accent/50 text-accent/80 hover:border-accent hover:text-accent"].join(" "),style:S?void 0:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},children:["Add to Cart",u.setTotal!=null?` · ${Z(B,k)}`:""]}):a("button",{type:"button",disabled:!0,"aria-disabled":!0,className:"flex-1 cursor-not-allowed border-2 border-dashed border-fg-dim/20 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-fg-dim/40",children:Je}),a(bt,{slug:e.slug,name:e.name})]}),U&&x&&a(gt,{partNumbers:x.components.map(t=>t.partNumber),productSlug:e.slug},x.id),ue&&(()=>{const t=ve.filter(f=>f.chosen===null).map(f=>se(f.prompt).replace(/^Select\s+/i,""));if(C&&c.vehicleAnswersSpecs&&!r.fitmentSet&&t.push("vehicle fitment"),t.length===0)return null;const o=t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t.at(-1)}`;return n("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 ",o," first."]})})()]}),ie]})]})]})}function ut({facts:e}){const r=I();return e.length===0?null:a("div",{className:"border-b border-line pb-[26px]",children:a("dl",{className:"flex flex-col gap-2",children:e.map(s=>n("div",{className:"flex flex-wrap items-baseline gap-x-2 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.22em]",children:[n("dt",{className:"text-fg-dim",children:[r(s.label)," ·"]}),a("dd",{className:"font-semibold text-fg",children:s.value.label})]},s.key))})})}function te({row:e,onPick:r}){const s=I();if(e.values.length===0&&!e.empty)return null;const l=e.values.find(i=>i.value===e.chosen),d=l&&[l.label,l.note].filter(Boolean).join(" · ");return n("div",{className:"border-b border-line pb-[26px]",[Me]:e.key,children:[n("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)," · ",a("span",{className:"text-accent",children:d??s(e.prompt)})]}),e.values.length===0?n("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[e.empty.text," ",a(Q,{href:e.empty.href,className:"text-accent hover:underline",children:e.empty.linkText})]}):e.display==="swatch"?a("div",{className:"flex flex-wrap gap-2",children:e.values.map(i=>{const p=i.value===e.chosen;return n("button",{type:"button",onClick:()=>r(e.key,i.value),"aria-pressed":p,className:["relative flex max-w-full items-center gap-3 border-2 px-3 py-3 text-left transition-colors",p?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"].join(" "),style:p?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[p&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block h-5 w-5 shrink-0 rounded-full border border-fg-dim",style:{background:i.swatch}}),a("span",{className:"block min-w-0 break-words font-mono text-[length:var(--size-label,12px)] font-bold uppercase tracking-[0.18em] text-fg",children:i.label})]},i.value)})}):a("div",{className:"flex flex-wrap gap-1.5",children:e.values.map(i=>{const p=i.value===e.chosen;return n("button",{type:"button",onClick:()=>r(e.key,i.value),"aria-pressed":p,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",p?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:p?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[p&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:i.label}),i.note&&a("span",{className:"mt-1 block text-[length:var(--size-label,11px)] tracking-[0.12em] text-fg-dim",children:i.note})]},i.value)})})]})}function bt({slug:e,name:r}){const{has:s,toggle:l}=ze(),d=s(e);return a("button",{type:"button",title:d?"Saved":"Save","aria-label":d?`Remove ${r} from wishlist`:`Save ${r} to wishlist`,"aria-pressed":d,onClick:()=>l(e),className:["h-12 w-12 cursor-pointer border-2 bg-transparent transition-colors",d?"border-accent text-accent":"border-fg-dim/50 text-fg hover:border-accent hover:text-accent"].join(" "),children:d?"♥":"♡"})}function gt({partNumbers:e,productSlug:r}){const[s,l]=Te(""),{status:d,submit:i,reset:p}=Ie();function T(){i({partNumbers:e,email:s,productSlug:r})}return d==="sent"?a("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."}):a(Ee,{className:"-mt-1",email:s,onEmailChange:l,status:d,onResetVerdict:p,onSubmit:T,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{ft as default};
|
|
1
|
+
"use client";import{jsx as a,Fragment as b,jsxs as n}from"react/jsx-runtime";import Q from"next/link";import{BUY_ROW_CLASS as ye}from"./buy-row.js";import{useEffect as X,useRef as Ne,useState as Se}from"react";import{useCart as we}from"./CartContext.js";import Te from"./QuoteLink.js";import{useSiteTakesOrders as _e}from"./SiteRecordContext.js";import Re from"./EmailCaptureForm.js";import{useEnglish as I}from"./EnglishVariant.js";import Ee from"./QuantityStepper.js";import{MarkedLabel as $,heroView as Ce}from"./product-hero/hero-view.js";import Ae from"./ProductGallery.js";import{useRootIsDark as Le}from"efficient-shell/theme";import{useWishlist as Oe}from"./WishlistContext.js";import{useStockAlertSignup as ze}from"./useStockAlertSignup.js";import{SPARE_WORDS as Ie,productCartLine as $e}from"../lib/catalog/purchase.js";import{OPTION_ROW_ATTR as je}from"../lib/catalog/store-product.js";import{resolvingRowsAnswered as Me}from"../lib/catalog/product-options.js";import{STOCK_WORDS as Pe}from"../lib/content/stock-words.js";import{trackViewItem as De}from"../lib/google-tag.js";import{DEFAULT_HERO_LAYOUT as Fe,DEFAULT_HERO_RATIO as He,DEFAULT_HERO_TEXT_ALIGN as Be,parseHeroLayout as Ue,parseHeroRatio as Ve,parseHeroTextAlign as We}from"../lib/sections/hero-arrangement.js";import{DEFAULT_HERO_GALLERY_MODE as Ge,DEFAULT_HERO_IMAGE_FIT as Ke}from"../lib/sections/hero-gallery.js";import{ADD_TO_BASKET_ATTR as qe,MAX_SPARES as Ye,UNITS_PER_SET as Qe,formatPrice as J}from"../lib/commerce.js";import{UNPRICED_LABEL as Xe,formatSelectionPrice as Je,setPriceLabel as Ze}from"../lib/wheels/price-display.js";import{productIsDually as et,productIsTwoObjects as tt,setSuppressesRow as at}from"../lib/wheels/set-mode.js";import{CONTENT_CAP_GUTTER as Z}from"../lib/sections/content-cap-gutter.js";import{CardTemplateRows as nt}from"efficient-web-builder/render/components/CardRowContext";import rt from"./card-pieces/CardPrice.js";import{HeroPriceStateProvider as lt}from"./card-pieces/ProductCardState.js";const ot=4e3;function it(t){return t?[t.year,t.make,t.model,t.modification].join("-"):""}const st=[{}],ct=.72;function dt(t){const r=t.trim().split(/\s+/).filter(Boolean);if(r.length===0)return;const d=r.map((s,c)=>s.length+(r.length>1&&c===r.length-1?1:0));return`calc(100cqi / ${(Math.max(...d)*ct).toFixed(2)})`}function mt({product:t,selection:r,onLightbox:d,editing:s=!1,pricePlacement:c="top",showVehicleFitment:l=!0,heroLayout:p=Fe,imageRatio:w=He,textAlign:te=Be,showSpecTable:ae=!0,showPriceQuote:T=!0,galleryMode:ne=Ge,imageFit:re=Ke,trustBullets:le,nodeId:oe,priceTemplate:j}){const ie=I(),v=Ue(p),M=We(te),y=Ve(w),se=v==="imageRight"?`${100-y}fr ${y}fr`:`${y}fr ${100-y}fr`,{picked:ce,pick:P,qty:D,setQty:de,choice:h,setChoice:N,angleIdx:me,setAngleIdx:pe,showValidation:ue,setShowValidation:_,manualMode:F,vehicle:R,rows:H,facts:fe,part:x,outOfStock:B,offer:m,preOrder:E,canAddToCart:S,currency:k,price:f,set:U,msrpLabel:be}=r,i=Ce(t,r,s),C=et(t),he=tt(t),A=l?i.vehicle:null,ge=l?i.vehicleMemory:null,L=!Le({whenUnset:!0}),{addAndOpen:xe,warmCatalog:V}=we(),g=_e();X(()=>{!s&&g&&V(t.kind)},[s,g,t.kind,V]);const W=H.filter(e=>!E||e.values.length>0),G=W.filter(e=>e.role==="resolves"),O=W.filter(e=>e.role==="describes"&&!at(he,e.key)),K=O.findIndex(e=>e.chosen===null),q=(!A||!i.vehicleAnswersSpecs||r.fitmentSet)&&Me(H,E)?K===-1?O:O.slice(0,K+1):[],ve=[...G,...q],z=a(lt,{value:{kind:"hero",msrpLabel:be||null,amount:C?Ze(f,k):Je(f,k),unitLabel:f.priced?i.unitLabel:null,packBadge:f.setTotal!=null?`${m.quantityLabel}: ${J(U,k)}`:null},children:j?a(nt,{ownerId:oe??"",ownerType:"ProductHero",Template:j,rows:st,fallback:null,children:e=>e}):a(rt,{})}),Y=Ne(null);return X(()=>{s||Y.current===t.slug||(Y.current=t.slug,De({itemId:x?`${t.slug}|${x.id}`:t.slug,itemName:t.name,variant:i.metaValue,pricePerSet:f.setTotal??f.fromSetTotal??0,currency:k}))},[s,t.slug,t.name,i.metaValue,x,f,k]),n(b,{children:[a("nav",{className:`border-b border-line ${Z} 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))]`,style:L?void 0:{background:"var(--section-bg)"},children:t.crumbs.map((e,o)=>n("span",{children:[o>0&&n(b,{children:[a("span",{className:"mx-3 text-accent",children:"/"}),a("wbr",{})]}),e.href?a(Q,{href:e.href,className:"hover:text-fg",children:a($,{text:e.label})}):a("span",{className:"text-fg",children:a($,{text:e.label})})]},`${e.label}-${o}`))}),n("section",{"data-hero-layout":v,"data-hero-align":M,className:[`grid gap-10 ${Z} py-14 max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))] max-view-tablet:py-8`,v==="stacked"?"grid-cols-1":"[grid-template-columns:var(--hero-cols)] max-view-desktop:[grid-template-columns:minmax(0,1fr)]"].join(" "),style:{...L?{}:{background:"var(--section-bg)"},...v==="stacked"?{}:{"--hero-cols":se}},children:[a(Ae,{product:t,view:i,angleIdx:me,onSelect:pe,isLight:L,onLightbox:d,galleryMode:ne,imageFit:re,style:v==="imageRight"?{order:2}:void 0}),n("div",{className:["flex flex-col gap-7",M==="center"?"items-center text-center":""].filter(Boolean).join(" "),style:v==="imageRight"?{order:1}:void 0,children:[n("div",{className:"w-full [container-type:inline-size]",children:[n("div",{className:"mb-2.5 flex items-center gap-2.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.2em] text-accent",children:[a("span",{children:a($,{text:t.eyebrow})}),t.badge&&n(b,{children:[a("span",{children:"·"}),a("span",{children:t.badge})]})]}),a("h1",{className:"font-heading2 text-[length:min(min(var(--size-headingMedium,clamp(48px,5.5vw,84px)),var(--hero-name-fit,9999px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[0.92] tracking-[-0.035em]",style:{"--hero-name-fit":dt(i.heading)},children:(()=>{const e=i.heading.lastIndexOf(" ");if(e===-1)return i.heading;const o=i.heading.slice(0,e),u=i.heading.slice(e+1);return n(b,{children:[o," ",n("em",{className:"font-normal italic text-accent",children:[u,"."]})]})})()})]}),c!=="belowSpecs"&&T&&z,ge,G.map(e=>a(ee,{row:e,onPick:P},e.key)),E&&i.preOrder?n(b,{children:[c==="belowSpecs"&&T&&z,i.preOrder]}):n(b,{children:[A,q.map(e=>a(ee,{row:e,onPick:P},e.key)),ae&&a(pt,{facts:fe}),(m.packs.length>0||g&&(m.extra||m.spareCounts.length>0))&&n("div",{className:"border-b border-line pb-[26px]",children:[m.packs.length>0&&n(b,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:"How many"}),a("div",{className:"flex flex-wrap gap-1.5",children:m.packs.map(e=>n("button",{type:"button",onClick:()=>N(o=>({...o,unit:e.value})),"aria-pressed":h.unit===e.value,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",h.unit===e.value?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:h.unit===e.value?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[h.unit===e.value&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:e.label})]},e.value))})]}),g&&m.extra&&n("label",{className:`${m.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:[a("input",{type:"checkbox",checked:h.spares>0,onChange:e=>N(o=>({...o,spares:e.target.checked?Ye:0})),className:"h-4 w-4 cursor-pointer accent-[var(--accent)]"}),m.extra.label]}),g&&m.spareCounts.length>0&&n(b,{children:[a("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:Ie.howMany}),a("div",{className:"flex flex-col gap-1.5 sm:flex-row sm:flex-wrap",children:m.spareCounts.map(e=>{const o=e.value-Qe,u=h.spares===o;return n("button",{type:"button",onClick:()=>N(ke=>({...ke,spares:o})),"aria-pressed":u,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",u?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:u?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[u&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),n("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:[e.value," · ",e.label]})]},e.value)})})]}),g&&m.spareSide&&n(b,{children:[a("div",{className:"mb-3.5 mt-[26px] font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:m.spareSide.label}),a("div",{className:"flex flex-wrap gap-1.5",children:m.spareSide.options.map(e=>{const o=h.spareSide===e.value;return n("button",{type:"button",onClick:()=>N(u=>({...u,spareSide:e.value})),"aria-pressed":o,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",o?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:o?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[o&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:e.label})]},e.value)})})]})]}),c==="belowSpecs"&&T&&z,n("div",{className:ye,children:[g&&!(C&&!f.priced)&&a(Ee,{value:D,onChange:de,size:"large"}),!g||C&&!f.priced?a(Te,{className:"flex-1 cursor-pointer bg-btn px-6 py-4 text-center font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg"}):f.priced?B?a("button",{type:"button",disabled:!0,"aria-disabled":!0,className:"flex-1 cursor-not-allowed border-2 border-dashed border-fg-dim/20 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-fg-dim/40",children:Pe.outOfStock}):n("button",{type:"button",[qe]:"",onClick:()=>{if(!S){_(!0),window.setTimeout(()=>_(!1),ot);return}if(_(!1),s)return;const e=$e(t,x,ce,{choice:h,qty:D},{fitmentLabel:F?i.specCaption:R.appliedName?`For ${R.appliedName}`:"",fitmentKey:F?`manual|${i.specCaption}`:`vehicle|${it(R.applied?.vehicle)}`});e&&xe(e)},"aria-disabled":!S,className:["flex-1 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] transition-colors",S?"cursor-pointer bg-btn text-btn-ink hover:bg-fg hover:text-bg":"cursor-pointer border-2 border-dashed border-accent/50 text-accent/80 hover:border-accent hover:text-accent"].join(" "),style:S?void 0:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},children:["Add to Cart",f.setTotal!=null?` · ${J(U,k)}`:""]}):a("button",{type:"button",disabled:!0,"aria-disabled":!0,className:"flex-1 cursor-not-allowed border-2 border-dashed border-fg-dim/20 px-6 py-4 font-mono text-[length:var(--size-label,14px)] font-bold uppercase tracking-[0.32em] text-fg-dim/40",children:Xe}),a(ut,{slug:t.slug,name:t.name})]}),B&&x&&a(ft,{partNumbers:x.components.map(e=>e.partNumber),productSlug:t.slug},x.id),ue&&(()=>{const e=ve.filter(u=>u.chosen===null).map(u=>ie(u.prompt).replace(/^Select\s+/i,""));if(A&&i.vehicleAnswersSpecs&&!r.fitmentSet&&e.push("vehicle fitment"),e.length===0)return null;const o=e.length===1?e[0]:e.length===2?`${e[0]} and ${e[1]}`:`${e.slice(0,-1).join(", ")}, and ${e.at(-1)}`;return n("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 ",o," first."]})})()]}),le]})]})]})}function pt({facts:t}){const r=I();return t.length===0?null:a("div",{className:"border-b border-line pb-[26px]",children:a("dl",{className:"flex flex-col gap-2",children:t.map(d=>n("div",{className:"flex flex-wrap items-baseline gap-x-2 font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.22em]",children:[n("dt",{className:"text-fg-dim",children:[r(d.label)," ·"]}),a("dd",{className:"font-semibold text-fg",children:d.value.label})]},d.key))})})}function ee({row:t,onPick:r}){const d=I();if(t.values.length===0&&!t.empty)return null;const s=t.values.find(l=>l.value===t.chosen),c=s&&[s.label,s.note].filter(Boolean).join(" · ");return n("div",{className:"border-b border-line pb-[26px]",[je]:t.key,children:[n("div",{className:"mb-3.5 font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:[d(t.label)," · ",a("span",{className:"text-accent",children:c??d(t.prompt)})]}),t.values.length===0?n("p",{className:"font-mono text-[length:var(--size-body,12px)] leading-relaxed tracking-[0.1em] text-fg-dim",children:[t.empty.text," ",a(Q,{href:t.empty.href,className:"text-accent hover:underline",children:t.empty.linkText})]}):t.display==="swatch"?a("div",{className:"flex flex-wrap gap-2",children:t.values.map(l=>{const p=l.value===t.chosen;return n("button",{type:"button",onClick:()=>r(t.key,l.value),"aria-pressed":p,className:["relative flex max-w-full items-center gap-3 border-2 px-3 py-3 text-left transition-colors",p?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 hover:border-accent"].join(" "),style:p?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[p&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block h-5 w-5 shrink-0 rounded-full border border-fg-dim",style:{background:l.swatch}}),a("span",{className:"block min-w-0 break-words font-mono text-[length:var(--size-label,12px)] font-bold uppercase tracking-[0.18em] text-fg",children:l.label})]},l.value)})}):a("div",{className:"flex flex-wrap gap-1.5",children:t.values.map(l=>{const p=l.value===t.chosen;return n("button",{type:"button",onClick:()=>r(t.key,l.value),"aria-pressed":p,className:["relative cursor-pointer border-2 px-4 py-3 text-left font-mono uppercase transition-colors",p?"border-accent text-fg outline outline-1 outline-accent -outline-offset-1":"border-fg-dim/50 text-fg hover:border-accent"].join(" "),style:p?{background:"color-mix(in oklab, var(--accent) 14%, transparent)"}:void 0,children:[p&&a("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),a("span",{className:"block text-[length:var(--size-label,14px)] tracking-[0.18em]",children:l.label}),l.note&&a("span",{className:"mt-1 block text-[length:var(--size-label,11px)] tracking-[0.12em] text-fg-dim",children:l.note})]},l.value)})})]})}function ut({slug:t,name:r}){const{has:d,toggle:s}=Oe(),c=d(t);return a("button",{type:"button",title:c?"Saved":"Save","aria-label":c?`Remove ${r} from wishlist`:`Save ${r} to wishlist`,"aria-pressed":c,onClick:()=>s(t),className:["h-12 w-12 cursor-pointer border-2 bg-transparent transition-colors",c?"border-accent text-accent":"border-fg-dim/50 text-fg hover:border-accent hover:text-accent"].join(" "),children:c?"♥":"♡"})}function ft({partNumbers:t,productSlug:r}){const[d,s]=Se(""),{status:c,submit:l,reset:p}=ze();function w(){l({partNumbers:t,email:d,productSlug:r})}return c==="sent"?a("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."}):a(Re,{className:"-mt-1",email:d,onEmailChange:s,status:c,onResetVerdict:p,onSubmit:w,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{mt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as a}from"react/jsx-runtime";import{createContext as c,useContext as d,useEffect as g,useState as u}from"react";import m from"./ProductCard.js";import{loadProductCatalog as h}from"./useProductCatalog.js";import{say as f}from"efficient-web-builder/format/lib/editor-words";const i=c({wheels:[],loading:!1,live:!1});function p(e,t){return e.find(r=>r.designCode===t)??e.find(r=>r.slug===t)}function S({wheels:e,children:t}){return a(i.Provider,{value:{wheels:e??[],loading:!1,live:!0},children:t})}function b({children:e}){const[t,r]=u([]),[s,o]=u(!0);return g(()=>{let n=!1;return h().then(l=>{n||(r(l),o(!1))}).catch(()=>{n||o(!1)}),()=>{n=!0}},[]),a(i.Provider,{value:{wheels:t,loading:s,live:!1},children:e})}function v({code:e,finish:t,wheel:r}){const{wheels:s,loading:o,live:n}=d(i),l=r??(e?p(s,e):void 0);return l?a(m,{wheel:l,variant:"catalog",defaultFinish:t},`${l.slug}:${t??""}`):n?null:a("div",{className:"sf-card flex aspect-square w-full items-center justify-center bg-surface-2 p-4 text-center",children:a("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.2em] text-fg-dim",children:o?f("Loading…"):e||f("Set a design code")})})}export{b as ProductCatalogProvider,S as SectionWheelsProvider,v as default,p as wheelForCode};
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import type { PartStyles } from "efficient-web-builder/render/lib/document/part-styles";
|
|
1
2
|
export interface CardPriceSettings {
|
|
2
3
|
show?: boolean;
|
|
3
4
|
quoteSets?: boolean;
|
|
4
5
|
setTotal?: boolean;
|
|
5
6
|
wasFollowsSize?: boolean;
|
|
6
7
|
}
|
|
7
|
-
export
|
|
8
|
+
export interface CardPriceRegion {
|
|
9
|
+
nodeId?: string;
|
|
10
|
+
partStyles?: PartStyles;
|
|
11
|
+
editing: boolean;
|
|
12
|
+
}
|
|
13
|
+
export default function CardPrice({ show, region, ...settings }: CardPriceSettings & {
|
|
14
|
+
region?: CardPriceRegion;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n,jsxs as c,Fragment as b}from"react/jsx-runtime";import P from"efficient-web-builder/render/components/TextRegionRun";import{SectionTextParts as S}from"efficient-web-builder/render/lib/document/editing-bridges";import{TEXT_REGION_ATTR as T}from"efficient-web-builder/format/lib/sections/text-regions";import{formatPrice as v}from"../../lib/commerce.js";import{setLabel as y}from"../../lib/wheels/variants.js";import{wheelCardPriceLine as d}from"../../lib/wheels/set-mode.js";import{EACH_UNIT as N,formatSelectionPrice as _,formatSelectionWasPrice as w,formatWheelPrice as p,formatWheelWasPrice as L,FROM_PREFIX as u,priceIn as k,resolveWheelPrice as f,SET_QUOTE_LABEL as E}from"../../lib/wheels/price-display.js";import{CARD_TEXT_SIZE as h,CardRow as x}from"./card-row.js";import{useHeroPriceStateOrNull as R,useProductCardState as I}from"./ProductCardState.js";function C(e,t){if(e.kind==="tyre"){const m=f(k(e.tyre.prices,e.currency),null);return{was:null,amount:p(m,e.currency,u),note:m.priced?N:null}}const{wheel:o,currency:r,price:i,sel:l,isSet:g}=e,a=f(o.prices[r],o.msrpPrices?.[r]),s=t.setTotal&&i.priced&&i.setTotal!=null&&l.selectedVariant?`${y(l.selectedVariant)} · ${v(i.setTotal,r)}`:null;return g&&t.quoteSets?{was:null,amount:a.priced?d(p(a,r,u),!0):E,note:s}:{was:t.wasFollowsSize?w(i,r):L(a,r),amount:d(_(i,r),i.priced),note:s}}function W({state:e,region:t}){const o=!!t?.editing,r=c("div",{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",...o?{[T]:"price"}:{},children:n(P,{region:"price",partStyles:t?.partStyles,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.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!o||!t?.nodeId?r:n(S,{nodeId:t.nodeId,sectionType:"ProductPrice",partStyles:t.partStyles,children:r})}function z({show:e=!0,region:t,...o}){const r=R();return r?n(W,{state:r,region:t}):n(F,{show:e,...o})}function F({show:e,...t}){const o=I(),{was:r,amount:i,note:l}=C(o,t);return c(b,{children:[n(x,{children:e?c("div",{className:`mt-2 font-mono ${h.labelLarge}`,children:[r&&n("span",{className:"mr-2 text-fg-dim line-through",children:r}),i]}):null}),n(x,{children:e&&l?n("div",{className:`mt-[2px] font-mono ${h.labelSmall} tracking-[0.08em] text-fg-dim`,children:l}):null})]})}export{z as default};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Ref } from "react";
|
|
2
|
+
export declare function ClippedPictures({ clipRef, pictures, }: {
|
|
3
|
+
clipRef?: Ref<HTMLDivElement>;
|
|
4
|
+
pictures: readonly {
|
|
5
|
+
src: string;
|
|
6
|
+
sizes?: string;
|
|
7
|
+
onLoad: () => void;
|
|
8
|
+
onError: () => void;
|
|
9
|
+
}[];
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as s}from"react/jsx-runtime";import i from"next/image";function t({clipRef:r,pictures:o}){return s("div",{ref:r,className:"pointer-events-none absolute h-px w-px overflow-hidden opacity-0","aria-hidden":!0,children:o.map(e=>s(i,{src:e.src,alt:"",width:e.sizes?1e3:16,height:e.sizes?1e3:16,sizes:e.sizes,className:"absolute inset-0",loading:"lazy",onLoad:e.onLoad,onError:e.onError},e.src))})}export{t as ClippedPictures};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
export default function HostPart({ label, editing, children }: {
|
|
2
|
+
export default function HostPart({ label, editing, onHero, children, }: {
|
|
3
3
|
label: string;
|
|
4
4
|
editing: boolean;
|
|
5
|
+
onHero?: boolean;
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
}): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as l,jsx as r}from"react/jsx-runtime";import{say as i}from"efficient-web-builder/format/lib/editor-words";import{useHeroPriceStateOrNull as n,useProductCardStateOrNull as u}from"./ProductCardState.js";function m({label:t,editing:e,onHero:a=!1,children:o}){const s=n();return u()||a&&s?r(l,{children:o}):e?r("div",{"data-host-part-sample":"",className:"opacity-60",children:i(t)}):null}export{m as default};
|
|
@@ -36,6 +36,18 @@ export interface TyreCardState {
|
|
|
36
36
|
readonly editing: boolean;
|
|
37
37
|
}
|
|
38
38
|
export type ProductCardState = WheelCardState | TyreCardState;
|
|
39
|
+
export interface HeroPriceState {
|
|
40
|
+
readonly kind: "hero";
|
|
41
|
+
readonly msrpLabel: string | null;
|
|
42
|
+
readonly amount: string;
|
|
43
|
+
readonly unitLabel: string | null;
|
|
44
|
+
readonly packBadge: string | null;
|
|
45
|
+
}
|
|
46
|
+
export declare function useHeroPriceStateOrNull(): HeroPriceState | null;
|
|
47
|
+
export declare function HeroPriceStateProvider({ value, children }: {
|
|
48
|
+
value: HeroPriceState;
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
39
51
|
export declare function useProductCardState(): ProductCardState;
|
|
40
52
|
export declare function useProductCardStateOrNull(): ProductCardState | null;
|
|
41
53
|
export declare function useWheelCardState(): WheelCardState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as P}from"react/jsx-runtime";import{createContext as z,useCallback as A,useContext as S,useMemo as N,useState as v}from"react";import{useCurrency as C}from"../CurrencyContext.js";import{useTyreDetail as W}from"../useTyreDetail.js";import{usePlpCardSelection as b}from"../wheels-plp/usePlpCardSelection.js";import{tyrePagePath as B}from"../../lib/tyres/tyre-page-path.js";import{canOrderTyreVariant as T}from"../../lib/tyres/tyre-purchase.js";import{resolveSelectionPrice as j}from"../../lib/wheels/price-display.js";import{setBuildLabel as E,setIsWide as H,summarySetBuild as L}from"../../lib/wheels/set-mode.js";const r=z(null);function K(){const e=S(r);return e?.kind==="hero"?e:null}function Q({value:e,children:n}){return P(r.Provider,{value:e,children:n})}function R(){const e=S(r);if(!e||e.kind==="hero")throw new Error("A product card piece was drawn outside a product card (no ProductCardState).");return e}function X(){const e=S(r);return e?.kind==="hero"?null:e}function Y(){const e=R();if(e.kind!=="wheel")throw new Error("A wheel card piece was drawn on a tyre card.");return e}const V=[];function Z({wheel:e,colours:n=V,defaultFinish:u,editing:l=!1,children:c}){const{currency:t}=C(),o=b(e,n,u),[d,f]=v(!1),i=L(e),a={kind:"wheel",wheel:e,sel:o,currency:t,price:j(e,o.selectedVariant,t,1),isSet:H(i),setWords:E(i),editing:l,notifyOpen:d,setNotifyOpen:f};return P(r.Provider,{value:a,children:c})}function $({tyre:e,currency:n,editing:u=!1,children:l}){const{currency:c}=C(),{slug:t}=e,o=B(t),[d,f]=v(!1),i=A(()=>{t&&f(!0)},[t]),{state:a,tyre:p}=W(t??null,d),s=N(()=>p?.variants??[],[p]),[x,w]=v(null),O=s.length===1?s[0].size:null,y=x??O,m=s.find(g=>g.size===y),h=a==="ready",k={kind:"tyre",tyre:e,currency:n,activeCurrency:c,pagePath:o,arm:i,detailState:a,detail:p,variants:s,chosen:y,setSize:w,variant:m,canAdd:m!=null&&T(m,c),detailReady:h,unsellable:!o||a==="error"||h&&s.length===0,editing:u};return P(r.Provider,{value:k,children:l})}export{Q as HeroPriceStateProvider,$ as TyreCardStateProvider,Z as WheelCardStateProvider,K as useHeroPriceStateOrNull,R as useProductCardState,X as useProductCardStateOrNull,Y as useWheelCardState};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export declare function useHeldCardPicture({ src, second, alt, sizes, failed, onFailed, near, holdEmpty, }: {
|
|
3
|
+
src: string | null;
|
|
4
|
+
second?: string | null;
|
|
5
|
+
alt: string;
|
|
6
|
+
sizes: string;
|
|
7
|
+
failed: ReadonlySet<string>;
|
|
8
|
+
onFailed: (url: string) => void;
|
|
9
|
+
near: boolean;
|
|
10
|
+
holdEmpty?: boolean;
|
|
11
|
+
}): {
|
|
12
|
+
src: string | null;
|
|
13
|
+
alt: string;
|
|
14
|
+
second: string | null;
|
|
15
|
+
trial: ReactNode;
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as R}from"react/jsx-runtime";import{useEffect as U,useRef as i,useState as f}from"react";import{ClippedPictures as q}from"./ClippedPictures.js";import{decodePhotoAt as B,STAGE_HOLD_LIMIT_MS as J,useStagePhotoHold as K}from"../product-hero/stage-photo.js";import{holdSignedUrl as A}from"../../lib/wheels/signed-url.js";function Y({src:e,second:M=null,alt:m,sizes:S,failed:w,onFailed:C,near:o,holdEmpty:I=!1}){A(e),A(M);const[O]=f(e),[p,k]=f(!1);!p&&e!==O&&k(!0);const s=i(e),L=i(new Map),u=i(new Map);e&&(L.current.set(e,m),u.current.set(e,M));const[T,_]=f([]),l=i(new Map),b=t=>{for(const n of l.current.get(t)??[])n();l.current.delete(t),_(n=>n.filter(c=>c!==t))},x=i(null);x.current=o?e:null;const E=t=>B(t,S).catch(n=>{const c=x.current;if(t!==c&&(!c||t!==u.current.get(c)))throw n;return new Promise(G=>{l.current.set(t,[...l.current.get(t)??[],G]),_(P=>P.includes(t)?P:[...P,t])})}),y=async t=>{const n=u.current.get(t);await Promise.all([E(t),n?E(n):void 0])},g=!e&&I&&!!s.current&&!w.has(s.current),[D,H]=f(!1);U(()=>{if(!g){H(!1);return}const t=setTimeout(()=>H(!0),J);return()=>clearTimeout(t)},[g]);const a=e??(g&&!D?s.current:null),j=K(p&&o&&a?[a]:[],o?a??void 0:void 0,y),d=o?j.drawn:a??void 0,F=!s.current&&p&&o&&!!d&&!j.settled,r=d&&!w.has(d)&&!F?d:null;s.current=r;const v=T.length>0?R(q,{pictures:T.map(t=>({src:t,sizes:S,onLoad:()=>b(t),onError:()=>{C(t),b(t)}}))}):null;if(!r)return{src:null,alt:m,second:null,trial:v};const h=u.current.get(r)??null;return{src:r,alt:L.current.get(r)??m,second:h&&!w.has(h)?h:null,trial:v}}export{Y as useHeldCardPicture};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type PayFirstResult } from "../../lib/checkout/pay-first.js";
|
|
2
2
|
import { type CheckoutProps } from "./checkout-state.js";
|
|
3
3
|
export default function CheckoutPageClient(props: CheckoutProps): import("react").JSX.Element;
|
|
4
|
-
export declare function PayFirstResultView({ result }: {
|
|
4
|
+
export declare function PayFirstResultView({ result, lostChangeNote }: {
|
|
5
5
|
result: PayFirstResult;
|
|
6
|
+
lostChangeNote?: string | null;
|
|
6
7
|
}): import("react").JSX.Element;
|