efficient-storefront-blocks 0.61.0 → 0.63.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 +70 -1
- package/dist/chunks/{EditorPreviewCheckout-55ERZEPV.js → EditorPreviewCheckout-6776GNNO.js} +1 -1
- package/dist/chunks/{SiteEditorProvider-XF374NLZ.js → SiteEditorProvider-GTIZ4RNX.js} +1 -1
- package/dist/chunks/chunk-A3PXLZZP.js +1 -0
- package/dist/chunks/chunk-JBLNH3P5.js +1 -0
- package/dist/chunks/chunk-VDYPGGK3.js +250 -0
- package/dist/chunks/{fitment-data-RORHKBID.js → fitment-data-DGKKOAWL.js} +1 -1
- package/dist/editor/components/EditorPreviewChat.js +4 -4
- package/dist/editor/components/PreviewHeader.d.ts +1 -1
- package/dist/editor/components/PreviewHeader.js +4 -4
- package/dist/editor/lib/efficient-backend.d.ts +1 -0
- package/dist/editor/lib/efficient-backend.js +1 -1
- package/dist/editor/lib/efficient-block-sources.d.ts +2 -0
- package/dist/editor/lib/efficient-block-sources.js +1 -0
- package/dist/editor/lib/puck/blocks/commerce/EuTyreLabelBlock/fields.d.ts +2 -0
- package/dist/editor/lib/puck/blocks/commerce/EuTyreLabelBlock/fields.js +1 -0
- package/dist/editor/lib/puck/blocks/commerce/ProductGallery/fields.d.ts +6 -0
- package/dist/editor/lib/puck/blocks/commerce/ProductGallery/fields.js +1 -0
- package/dist/editor/lib/puck/blocks/commerce/ProductHero/fields.js +1 -1
- package/dist/editor/lib/puck/blocks/commerce/index.d.ts +1 -1
- package/dist/editor/lib/puck/blocks/commerce/index.js +1 -1
- package/dist/editor/lib/puck/blocks/service/RatingBlock/fields.d.ts +2 -0
- package/dist/editor/lib/puck/blocks/service/RatingBlock/fields.js +1 -0
- package/dist/editor/lib/puck/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/puck/blocks/service/index.js +1 -1
- package/dist/editor/lib/puck/config.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +1 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +103 -82
- package/dist/render/app/globals.css +70 -14
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CartContext.d.ts +1 -0
- package/dist/render/components/CartContext.js +1 -1
- package/dist/render/components/CartDrawer.d.ts +0 -8
- package/dist/render/components/CartDrawer.js +2 -2
- package/dist/render/components/ChatWidget.js +1 -1
- package/dist/render/components/EuTyreLabels.d.ts +3 -0
- package/dist/render/components/EuTyreLabels.js +1 -1
- package/dist/render/components/FooterMenu.js +1 -1
- package/dist/render/components/FormBlock.js +1 -1
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/LegalLine.js +1 -1
- package/dist/render/components/PopupFrame.d.ts +2 -1
- package/dist/render/components/PopupFrame.js +1 -1
- package/dist/render/components/PopupHost.d.ts +17 -0
- package/dist/render/components/PopupHost.js +1 -0
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/ProductGallery.d.ts +15 -0
- package/dist/render/components/ProductGallery.js +1 -0
- package/dist/render/components/ProductHeroPanel.js +1 -1
- package/dist/render/components/RatingStars.d.ts +4 -0
- package/dist/render/components/RatingStars.js +1 -0
- package/dist/render/components/Reviews.js +1 -1
- package/dist/render/components/StorefrontProviders.d.ts +1 -3
- package/dist/render/components/StorefrontProviders.js +1 -1
- package/dist/render/components/SubscribePopupContext.d.ts +3 -15
- package/dist/render/components/SubscribePopupContext.js +1 -1
- package/dist/render/components/TyrePlpCard.js +1 -1
- package/dist/render/components/WheelCardFrame.d.ts +3 -27
- package/dist/render/components/WheelCardFrame.js +1 -1
- package/dist/render/components/card-pieces/CardBuyButton.d.ts +7 -0
- package/dist/render/components/card-pieces/CardBuyButton.js +1 -0
- package/dist/render/components/card-pieces/CardFinishSwatches.d.ts +5 -0
- package/dist/render/components/card-pieces/CardFinishSwatches.js +1 -0
- package/dist/render/components/card-pieces/CardPrice.d.ts +7 -0
- package/dist/render/components/card-pieces/CardPrice.js +1 -0
- package/dist/render/components/card-pieces/CardProductBadge.d.ts +7 -0
- package/dist/render/components/card-pieces/CardProductBadge.js +1 -0
- package/dist/render/components/card-pieces/CardSizes.d.ts +9 -0
- package/dist/render/components/card-pieces/CardSizes.js +1 -0
- package/dist/render/components/card-pieces/ProductCardState.d.ts +53 -0
- package/dist/render/components/card-pieces/ProductCardState.js +1 -0
- package/dist/render/components/card-pieces/card-row.d.ts +20 -0
- package/dist/render/components/card-pieces/card-row.js +1 -0
- package/dist/render/components/cart/drawer-parts.d.ts +28 -0
- package/dist/render/components/cart/drawer-parts.js +1 -0
- package/dist/render/components/pdp-dynamic/DynamicEuTyreLabel.d.ts +3 -0
- package/dist/render/components/pdp-dynamic/DynamicEuTyreLabel.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicProductGallery.d.ts +9 -0
- package/dist/render/components/pdp-dynamic/DynamicProductGallery.js +1 -0
- package/dist/render/components/useHeaderBar.js +1 -1
- package/dist/render/components/useIsLightTheme.d.ts +1 -0
- package/dist/render/components/useIsLightTheme.js +1 -0
- package/dist/render/components/wheels-plp/PlpCard.d.ts +3 -2
- package/dist/render/components/wheels-plp/PlpCard.js +1 -1
- package/dist/render/components/wheels-plp/usePlpCardSelection.d.ts +1 -1
- package/dist/render/components/wheels-plp/usePlpCardSelection.js +1 -1
- package/dist/render/lib/api/index.d.ts +4 -2
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +48 -1
- package/dist/render/lib/chrome-load.d.ts +1 -1
- package/dist/render/lib/chrome-load.js +1 -1
- package/dist/render/lib/content/product-hero.d.ts +1 -0
- package/dist/render/lib/content/product-hero.js +1 -1
- package/dist/render/lib/header-fit.d.ts +2 -0
- package/dist/render/lib/header-fit.js +1 -0
- package/dist/render/lib/popup/popup-stores.d.ts +2 -0
- package/dist/render/lib/popup/popup-stores.js +1 -0
- package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/meta.d.ts +2 -0
- package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/meta.js +1 -0
- package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/render.d.ts +2 -0
- package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/render.js +1 -0
- package/dist/render/lib/puck/blocks/commerce/ProductGallery/meta.d.ts +2 -0
- package/dist/render/lib/puck/blocks/commerce/ProductGallery/meta.js +1 -0
- package/dist/render/lib/puck/blocks/commerce/ProductGallery/render.d.ts +2 -0
- package/dist/render/lib/puck/blocks/commerce/ProductGallery/render.js +1 -0
- package/dist/render/lib/puck/blocks/commerce/metas.d.ts +2 -0
- package/dist/render/lib/puck/blocks/commerce/metas.js +1 -1
- package/dist/render/lib/puck/blocks/commerce/renders.d.ts +2 -0
- package/dist/render/lib/puck/blocks/commerce/renders.js +1 -1
- package/dist/render/lib/puck/blocks/service/RatingBlock/meta.d.ts +3 -0
- package/dist/render/lib/puck/blocks/service/RatingBlock/meta.js +1 -0
- package/dist/render/lib/puck/blocks/service/RatingBlock/render.d.ts +2 -0
- package/dist/render/lib/puck/blocks/service/RatingBlock/render.js +1 -0
- package/dist/render/lib/puck/blocks/service/metas.d.ts +1 -0
- package/dist/render/lib/puck/blocks/service/metas.js +1 -1
- package/dist/render/lib/puck/blocks/service/renders.d.ts +1 -0
- package/dist/render/lib/puck/blocks/service/renders.js +1 -1
- package/dist/render/lib/puck/lazy-draws.js +1 -1
- package/dist/render/lib/storefront-page-groups.js +1 -1
- package/dist/render/lib/wheels/plp-fitment-match.d.ts +4 -0
- package/dist/render/lib/wheels/plp-fitment-match.js +1 -1
- package/dist/render/lib/wheels/spec-sheet.js +1 -1
- package/dist/words.d.ts +2 -2
- package/dist/words.js +3 -3
- package/package.json +4 -4
- package/dist/chunks/chunk-FCCEAXMM.js +0 -1
- package/dist/chunks/chunk-VVQ7KFQO.js +0 -1
- package/dist/chunks/chunk-YNI65Q6Z.js +0 -250
- package/dist/render/components/wheels-plp/useWheelCardBottom.d.ts +0 -20
- package/dist/render/components/wheels-plp/useWheelCardBottom.js +0 -1
- package/dist/render/lib/popup/popup-rules.d.ts +0 -25
- package/dist/render/lib/popup/popup-rules.js +0 -1
- /package/dist/chunks/{chunk-I6VNNXUI.js → chunk-IT33OG3G.js} +0 -0
- /package/dist/chunks/{chunk-YNI65Q6Z.js.LEGAL.txt → chunk-VDYPGGK3.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-VT346MLP.js → chunk-XKTD3BPL.js} +0 -0
|
@@ -702,9 +702,10 @@
|
|
|
702
702
|
/* The shadow colour reaches the shadows through `--sf-shadow-color`, whose
|
|
703
703
|
BUILT-IN VALUE LIVES HERE rather than in the carrier: a site that never
|
|
704
704
|
touched the colour then publishes no declaration at all, the way `small`
|
|
705
|
-
corners publish none. Lewis's default, 2026-09-01.
|
|
706
|
-
|
|
707
|
-
[data-sf-card-shadow="
|
|
705
|
+
corners publish none. Lewis's default, 2026-09-01. The values themselves are
|
|
706
|
+
the Shadow steps block below the card look, one list with a Box's Shadow. */
|
|
707
|
+
[data-sf-card-shadow="soft"] { --sf-card-shadow: var(--sf-shadow-step); }
|
|
708
|
+
[data-sf-card-shadow="lifted"] { --sf-card-shadow: var(--sf-shadow-step); }
|
|
708
709
|
|
|
709
710
|
/* The raised state a `lift` hover moves to, and the distance it moves. Both
|
|
710
711
|
read the merchant's shadow colour for the reason the resting shadow does —
|
|
@@ -840,6 +841,16 @@
|
|
|
840
841
|
|
|
841
842
|
/* ─── End card look (card 66332) ─────────────────────────────────────── */
|
|
842
843
|
|
|
844
|
+
/* ─── Shadow steps (cookie banner build, PR 3; design final 2026-10-23) ─────
|
|
845
|
+
ONE LIST OF SHADOW VALUES, for the site's card shadow (the card-look block
|
|
846
|
+
above reads `--sf-shadow-step`) and a Box's own Shadow row alike. A Box names
|
|
847
|
+
its step with `data-sf-box-shadow` (efficient-web-builder
|
|
848
|
+
`lib/content/box-shadow`). Below the card look, so on a picture card, which
|
|
849
|
+
wears the site's card shadow, the Box's own step wins. */
|
|
850
|
+
[data-sf-card-shadow="soft"], [data-sf-box-shadow="soft"] { --sf-shadow-step: 0 1px 2px color-mix(in srgb, var(--sf-shadow-color, #141416) 7%, transparent), 0 4px 12px -4px color-mix(in srgb, var(--sf-shadow-color, #141416) 10%, transparent); }
|
|
851
|
+
[data-sf-card-shadow="lifted"], [data-sf-box-shadow="lifted"] { --sf-shadow-step: 0 2px 4px color-mix(in srgb, var(--sf-shadow-color, #141416) 6%, transparent), 0 14px 30px -10px color-mix(in srgb, var(--sf-shadow-color, #141416) 22%, transparent); }
|
|
852
|
+
[data-sf-box-shadow] { box-shadow: var(--sf-shadow-step); }
|
|
853
|
+
|
|
843
854
|
/* ─── Heading compression ──────────────────────────────────────────────
|
|
844
855
|
The Appearance panel's "Headings" compression rung, applied to real headings
|
|
845
856
|
(h1–h4) under the theme carrier. Delivered as a data attribute rather than a
|
|
@@ -976,8 +987,27 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
976
987
|
--sf-header-overlay-ground: var(--overlay-fg);
|
|
977
988
|
}
|
|
978
989
|
|
|
990
|
+
/* ─── THE HEADER FOLDS WHEN ITS ROW DOES NOT FIT ──────────────────────
|
|
991
|
+
Measured, never a fixed width (lib/header-fit): when a desktop band the
|
|
992
|
+
header shows needs more room than the bar has — the merchant's logo plus the
|
|
993
|
+
merchant's links — the header carries `data-header-fit="phone"`, and here it
|
|
994
|
+
draws its phone bar instead: logo, cart, the menu button, and the menu the
|
|
995
|
+
button opens. hartesmetal.com needed 810px for its row and had 690px at an
|
|
996
|
+
810px screen, so "Contact" ran off the edge (2026-10-24).
|
|
997
|
+
`!important` because the bands and the phone row are switched by Tailwind's
|
|
998
|
+
responsive utilities; the fold must win at every width. The menu is the
|
|
999
|
+
header's sibling (components/Header draws it after the bar). */
|
|
1000
|
+
[data-header-fit="phone"] [data-header-band] {
|
|
1001
|
+
display: none !important;
|
|
1002
|
+
}
|
|
1003
|
+
[data-header-fit="phone"] [data-header-phone],
|
|
1004
|
+
[data-header-fit="phone"] ~ [data-header-phone-menu] {
|
|
1005
|
+
display: flex !important;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
979
1008
|
/* ─── THE BOX HEADER ON A PHONE ───────────────────────────────────────
|
|
980
|
-
Blueprint step H.5, as the approved Box header mockup draws it.
|
|
1009
|
+
Blueprint step H.5, as the approved Box header mockup draws it. Below the
|
|
1010
|
+
tablet tier (720px, easel's VIEW_TABLET_MIN, the old header's phone band)
|
|
981
1011
|
the row holding the site header's one-row Menu shows the logo at the left
|
|
982
1012
|
and the rest together at the right, the menu button last; Search and the
|
|
983
1013
|
region picker move into the menu's panel (components/PhoneMenuTools).
|
|
@@ -989,7 +1019,7 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
989
1019
|
⚠️ UNLAYERED ON PURPOSE. A Box's phone cells are Tailwind utilities
|
|
990
1020
|
(lib/content/box-layout `PHONE_ROW_CLASS`) in `@layer utilities`, and
|
|
991
1021
|
unlayered CSS beats layered whatever the specificity. */
|
|
992
|
-
@media (
|
|
1022
|
+
@media not all and (min-width: 720px) {
|
|
993
1023
|
/* The row, and the rows inside it: one line, each block its own width. A
|
|
994
1024
|
block is the row's own child on the site and sits inside the editor's
|
|
995
1025
|
frame (`[data-puck-component]`) in the editor, so each rule reads both. */
|
|
@@ -1027,8 +1057,9 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1027
1057
|
}
|
|
1028
1058
|
|
|
1029
1059
|
/* ─── THE BOX HEADER AT MID WIDTHS ────────────────────────────────────
|
|
1030
|
-
|
|
1031
|
-
(components/Header, its medium top bar
|
|
1060
|
+
720px to 1500px: TWO ROWS, as the old header draws them from the tablet
|
|
1061
|
+
tier (components/Header, its medium top bar; 801px until 2026-10-23, when
|
|
1062
|
+
the old header's 800/801 pair left 800px with no header at all, D01). The logo and the tools on the top
|
|
1032
1063
|
line, the one-row Menu's links on a second line under a hairline. Ruled by
|
|
1033
1064
|
Victor Mau 2026-10-01: the approved mockup draws only 1440px (one row) and
|
|
1034
1065
|
390px (the phone bar above), and a row that ran out of room folded the
|
|
@@ -1043,7 +1074,7 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1043
1074
|
mockup is one row at 1440px). Lewis, 2026-10-12, card [ADD] Every Old
|
|
1044
1075
|
Header Setting To The Box Header: `Own row` stacks exactly as the old
|
|
1045
1076
|
header did, to 1500px, so a switched site looks the same at every width. */
|
|
1046
|
-
@media (min-width:
|
|
1077
|
+
@media (min-width: 720px) and (max-width: 1500px) {
|
|
1047
1078
|
[data-section-group="header"]:not([data-header-menu-row="inline"]) .flex-row:has([data-menu-row]) {
|
|
1048
1079
|
flex-wrap: wrap;
|
|
1049
1080
|
row-gap: 12px;
|
|
@@ -1110,7 +1141,7 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1110
1141
|
|
|
1111
1142
|
Unlayered, like the rules above, and after them where they meet: the
|
|
1112
1143
|
mid-width rules are more specific and win the cells they place. */
|
|
1113
|
-
@media (min-width:
|
|
1144
|
+
@media (min-width: 720px) {
|
|
1114
1145
|
[data-section-group="header"] .flex-row > :is([data-menu-align], :has([data-menu-align])) {
|
|
1115
1146
|
flex: 1 1 0%;
|
|
1116
1147
|
min-width: 0;
|
|
@@ -1147,7 +1178,7 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1147
1178
|
flex: 0 0 auto;
|
|
1148
1179
|
}
|
|
1149
1180
|
}
|
|
1150
|
-
@media (
|
|
1181
|
+
@media not all and (min-width: 720px) {
|
|
1151
1182
|
[data-section-group="header"] .flex-row > :is([data-menu-part="lead"], :has([data-menu-part="lead"])) {
|
|
1152
1183
|
display: none;
|
|
1153
1184
|
}
|
|
@@ -1157,7 +1188,7 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1157
1188
|
overflow-x: clip;
|
|
1158
1189
|
}
|
|
1159
1190
|
}
|
|
1160
|
-
@media (min-width:
|
|
1191
|
+
@media (min-width: 720px) and (max-width: 1500px) {
|
|
1161
1192
|
/* Own row stacks: the links start their own line, as the old second row. */
|
|
1162
1193
|
[data-section-group="header"]:not([data-header-menu-row="inline"]) [data-menu-row][data-menu-align] > ul {
|
|
1163
1194
|
justify-content: flex-start;
|
|
@@ -1259,6 +1290,20 @@ body:has([data-page-width="full"]) footer {
|
|
|
1259
1290
|
--sf-chrome-cap: none;
|
|
1260
1291
|
}
|
|
1261
1292
|
|
|
1293
|
+
/* THE VIEW TIERS AS TAILWIND BREAKPOINTS — easel's VIEW_TABLET_MIN and
|
|
1294
|
+
VIEW_DESKTOP_MIN (efficient-easel/screen/lib/content/view-tiers), the one
|
|
1295
|
+
phone / tablet / desktop split. A class names the tier, never a number:
|
|
1296
|
+
`view-tablet:flex` is width ≥ 720, `max-view-tablet:flex` is width < 720, so
|
|
1297
|
+
the two halves of a pair always meet. Hand-typed pairs did not: the header's
|
|
1298
|
+
`max-[800px]` / `min-[801px]` left exactly 800px — the editor's Tablet view —
|
|
1299
|
+
with no header at all (duplicate audit 2026-10-23, D01). CSS cannot import
|
|
1300
|
+
the constants, so scripts/test-view-tier-breakpoints.ts fails if these two
|
|
1301
|
+
lines and easel ever disagree. */
|
|
1302
|
+
@theme {
|
|
1303
|
+
--breakpoint-view-tablet: 720px;
|
|
1304
|
+
--breakpoint-view-desktop: 1100px;
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1262
1307
|
@theme inline {
|
|
1263
1308
|
--color-bg: var(--bg);
|
|
1264
1309
|
--color-surface: var(--site-surface);
|
|
@@ -3078,8 +3123,18 @@ em.text-accent {
|
|
|
3078
3123
|
its specificity, which is why this is here and not a class in the markup.
|
|
3079
3124
|
|
|
3080
3125
|
`padding-block`, not `padding`: a block's own SIDE padding is its business and
|
|
3081
|
-
several blocks read the site gutter through it.
|
|
3082
|
-
|
|
3126
|
+
several blocks read the site gutter through it.
|
|
3127
|
+
|
|
3128
|
+
ONE RULE FOR THE PAGE AND THE EDITOR'S CANVAS (GG 2026-10-23, the hartesmetal
|
|
3129
|
+
Home name Box: apart on the canvas, on top of each other live). On the canvas
|
|
3130
|
+
two elements stand between the Box and each block: the editor's item
|
|
3131
|
+
(`[data-puck-component]`) and the builder's part host (`[data-sf-part-host]`,
|
|
3132
|
+
`display: contents`). Each rule names both shapes of "the Box's blocks", so
|
|
3133
|
+
the canvas reads THIS rule from this sheet and no copy of it can lag behind
|
|
3134
|
+
(the builder's canvas copy, efficient-web-builder 37 and later, goes).
|
|
3135
|
+
scripts/test-gap-only-one-rule.tsx draws both. */
|
|
3136
|
+
.sf-box-gap-only > *,
|
|
3137
|
+
.sf-box-gap-only > [data-puck-component] > [data-sf-part-host] > * {
|
|
3083
3138
|
padding-block: 0;
|
|
3084
3139
|
}
|
|
3085
3140
|
|
|
@@ -3091,7 +3146,8 @@ em.text-accent {
|
|
|
3091
3146
|
footer tagline given 20px on its right. This reaches the frame inside it. The
|
|
3092
3147
|
wrapper's own padding is an INLINE style, which this never beats, so what the
|
|
3093
3148
|
merchant typed still draws. Unlayered, like the rule above, for its reason. */
|
|
3094
|
-
.sf-box-gap-only > .sf-section-pad >
|
|
3149
|
+
.sf-box-gap-only > .sf-section-pad > *,
|
|
3150
|
+
.sf-box-gap-only > [data-puck-component] > [data-sf-part-host] > .sf-section-pad > * {
|
|
3095
3151
|
padding-block: 0;
|
|
3096
3152
|
}
|
|
3097
3153
|
|
|
@@ -47,6 +47,7 @@ interface CartCtx {
|
|
|
47
47
|
bundles: Bundle[];
|
|
48
48
|
warmCatalog: (kind?: ProductKind) => void;
|
|
49
49
|
add: (line: CartLine) => void;
|
|
50
|
+
addAndOpen: (line: CartLine) => void;
|
|
50
51
|
remove: (id: string) => void;
|
|
51
52
|
setQty: (id: string, qty: number) => void;
|
|
52
53
|
replaceItems: (lines: CartLine[]) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as Le}from"react/jsx-runtime";import{createContext as We,useCallback as l,useContext as ke,useEffect as g,useMemo as me,useRef as b,useState as f}from"react";import{products as E}from"../lib/api/index.js";import{couponDeferredToCheckout as Qe}from"../lib/cart/coupon-preview.js";import{snapshotCartLines as ve}from"../lib/cart/snapshot-lines.js";import{MAX_QTY_PER_LINE as pe,orderLinesForSets as He,setPrice as Ve}from"../lib/commerce.js";import{UNPRICED_LABEL as je}from"../lib/wheels/price-display.js";import{isValidEmail as Fe}from"../lib/email-shape.js";import{trackAddToCart as ze}from"../lib/google-tag.js";import{shippingStatus as Je}from"../lib/cart/shipping-status.js";import{useCurrency as Xe}from"./CurrencyContext.js";const Ye=400,Ge=400,Ke=1500;function he(c){return(c.components?.length??0)>0}function Ce(c,r){return{code:c,valid:r.valid,deferred:Qe(r,r.askedAsShopper),message:r.message||void 0,effects:r.effects??void 0}}function ye(c,r){return Ve(c.components,r)}function W(c,r){const s=ye(c,r);return s===null?null:s*c.qty}function ge(c){return c!=="tyre"}const Ee=We(null);function at({children:c,preview:r=!1}){const{currency:s,country:A,formatMoney:Ne}=Xe(),[k,P]=f(r),[i,I]=f([]),[Q,Te]=f([]),[v,be]=f([]),[H,Be]=f(!1),[V,Me]=f(!1),[Ie,Se]=f(!1),[qe,xe]=f(!1),[m,j]=f(null),[F,z]=f(void 0),R=b(A),Oe=b("");R.current=R.current||A;const[u,y]=f(null),[J,S]=f(!1),[p,X]=f(null),q=b(void 0),N=l(()=>P(!0),[]),Y=l(()=>P(!1),[]),G=l(()=>P(e=>!e),[]);g(()=>{r||typeof window>"u"||new URLSearchParams(window.location.search).get("cart")==="open"&&N()},[N,r]);const K=l(e=>{xe(!0),ge(e)&&Se(!0)},[]),Z=Ie||i.some(e=>ge(e.kind)),$=qe||i.length>0;g(()=>{if(r||!Z||H)return;let e=!0;return E.listWheels().then(t=>{e&&(Te(t),Be(!0))}),()=>{e=!1}},[r,Z,H]),g(()=>{if(r||!$||V)return;let e=!0;return E.listBundles().then(t=>{e&&(be(t),Me(!0))}),()=>{e=!1}},[r,$,V]);const C=m?.deliveryOptions??[];g(()=>{C.length!==0&&X(e=>e&&C.some(t=>t.id===e)?e:C[0]?.id??null)},[m]);const x=l(()=>i.filter(he).flatMap(e=>He(e.components,e.qty)),[i]),ee=l(async(e,t)=>{const o=e.trim().toUpperCase();if(!o)return;const n=x();if(n.length===0){y({code:o,valid:!1,message:"Add a wheel to the cart first."});return}S(!0),q.current=t;try{const a=await E.validateCoupon({code:o,items:n,currency:s,shippingMethodId:p??void 0,customerEmail:t});y(Ce(o,a))}catch{y({code:o,valid:!1,message:"Could not check that code. Please try again."})}finally{S(!1)}},[x,s,p]),te=l(()=>{y(null),q.current=void 0},[]),ne=l(e=>{if(!u)return;const{code:t}=u;y(o=>o&&o.code===t?{code:t,valid:!1,refused:!0,message:e}:o)},[u]);g(()=>{if(!u||u.refused)return;const e=u.code,t=n=>n!==null&&n.code===e&&!n.refused,o=setTimeout(async()=>{const n=x();if(n.length===0){y(a=>t(a)?{code:e,valid:!1,message:"Add a wheel to the cart first."}:a);return}S(!0);try{const a=await E.validateCoupon({code:e,items:n,currency:s,shippingMethodId:p??void 0,customerEmail:q.current});y(M=>t(M)?Ce(e,a):M)}catch{}finally{S(!1)}},Ye);return()=>clearTimeout(o)},[i,s,p]);const U=u&&!u.refused?u.code:void 0;g(()=>{if(r)return;let e=!0;const t=setTimeout(async()=>{const o=x();if(o.length===0){j(null),z(void 0);return}try{const n=await E.quoteCart({items:o,currency:s,shippingMethodId:p??void 0,couponCode:U,customerEmail:q.current||void 0,country:R.current||void 0,subdivision:Oe.current||void 0});if(!e)return;j(n)}catch{if(!e)return}z(U)},Ge);return()=>{e=!1,clearTimeout(t)}},[i,s,p,U,A]);const O=l(e=>{I(t=>{const o=t.findIndex(n=>n.id===e.id);return o===-1?[...t,e]:t.map((n,a)=>a===o?{...n,qty:Math.min(pe,n.qty+e.qty)}:n)}),ze(e,s)},[s]),oe=l(e=>{I(t=>t.filter(o=>o.id!==e))},[]),re=l((e,t)=>{const o=Math.max(1,Math.min(pe,t));I(n=>n.map(a=>a.id===e?{...a,qty:o}:a))},[]),se=l(e=>{I(e)},[]),[B,_e]=f(null),ue=b(null);ue.current=B;const h=b(null),w=b(""),ce=l((e,t)=>{const o=e.trim().toLowerCase();Fe(o)&&_e(n=>n&&n.email===o&&n.firstName===(t??"")?n:{email:o,firstName:t??""})},[]);g(()=>{if(r||!B)return;const e=ve(i.filter(he),n=>W(n,s)===null?je:Ne(W(n,s),s)),t={email:B.email,firstName:B.firstName,currency:s,items:e},o=JSON.stringify(t);if(o!==w.current)return h.current&&clearTimeout(h.current),h.current=setTimeout(()=>{h.current=null,w.current=o,E.captureCart(t).catch(n=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart capture failed",n)})},Ke),()=>{h.current&&(clearTimeout(h.current),h.current=null)}},[i,B,s,r]);const ie=l(()=>{h.current&&(clearTimeout(h.current),h.current=null);const e=ue.current;e&&(w.current="",E.captureCart({email:e.email,firstName:e.firstName,currency:s,items:[]}).catch(t=>{process.env.NODE_ENV!=="production"&&console.warn("abandoned-cart clear failed",t)}))},[s]),ae=me(()=>{const e=i.reduce((d,T)=>{const _=W(T,s);return _===null?d:d+_},0),t=i.some(d=>ye(d,s)===null),o=i.reduce((d,T)=>d+T.qty,0),n=u?.valid?u.effects:void 0,a=n?Math.min(e,Number(n.discountAmount)):0,M=m?.bundleDiscount??0,Pe=m?.appliedBundles??[],D=!!n?.freeShipping,de=C.find(d=>d.id===p),fe=D?0:m?.shipping??de?.amount??0,Re=Je({quoted:m!==null,optionCount:C.length,chosenAmount:de?.amount,couponWaivesFreight:D}),L={};for(const d of n?.freeUnits??[])L[d.partNumber]=(L[d.partNumber]??0)+d.quantity;const Ue=m?.tax??null,we=m?m.grandTotal:e-a-M+fe;return{sets:o,units:i.reduce((d,T)=>d+(T.components??[]).reduce((_,De)=>_+De.wheels*T.qty,0),0),subtotal:e,hasUnpricedLine:t,discount:a,bundleDiscount:M,appliedBundles:Pe,shipping:fe,freeShipping:D,shippingStatus:Re,freeUnitsByPartNumber:L,tax:Ue,grand:we,repricing:!!u?.refused&&m!==null&&F===u?.code,currency:s}},[i,s,u,C,p,m,F]),le=l(e=>{O(e),N()},[O,N]),Ae=me(()=>({isOpen:k,preview:r,open:N,close:Y,toggle:G,items:i,catalog:Q,bundles:v,warmCatalog:K,add:O,addAndOpen:le,remove:oe,setQty:re,replaceItems:se,identify:ce,clearCapturedCart:ie,coupon:u,applyCoupon:ee,removeCoupon:te,refuseCoupon:ne,couponBusy:J,deliveryOptions:C,shippingMethodId:p,setShippingMethodId:X,totals:ae}),[k,r,N,Y,G,i,Q,v,K,O,le,oe,re,se,ce,ie,u,ee,te,ne,J,C,p,ae]);return Le(Ee.Provider,{value:Ae,children:c})}function lt(){const c=ke(Ee);if(!c)throw new Error("useCart() must be called inside <CartProvider>. Mount the provider in app/layout.tsx.");return c}export{at as CartProvider,he as isOrderable,W as lineTotal,lt as useCart};
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import { type CartLine } from "./CartContext.js";
|
|
2
|
-
import type { TyreSummary } from "../lib/api/index.js";
|
|
3
1
|
import { type CartDrawerContent } from "efficient-web-builder/format/lib/content/cart-drawer";
|
|
4
2
|
export default function CartDrawer({ content, }: {
|
|
5
3
|
content?: CartDrawerContent;
|
|
6
4
|
}): import("react").JSX.Element | null;
|
|
7
|
-
export declare function CartLineRow({ line, tyre, onRemove, onQtyChange, }: {
|
|
8
|
-
line: CartLine;
|
|
9
|
-
tyre?: TyreSummary | null;
|
|
10
|
-
onRemove: () => void;
|
|
11
|
-
onQtyChange: (q: number) => void;
|
|
12
|
-
}): import("react").JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r,jsxs as o,Fragment as m}from"react/jsx-runtime";import{useEffect as f,useRef as p}from"react";import{useCart as d}from"./CartContext.js";import{isTyreLine as u}from"../lib/tyres/tyre-purchase.js";import{useTyreCatalog as x}from"./useTyreCatalog.js";import{useModalDismiss as b}from"./useModalDismiss.js";import{CartActions as y,CartCouponRow as C,CartDrawerHeader as g,CartLines as h,CartStatusRail as w,CartTotals as k,CartTrustMarkers as v,CartUpsell as R}from"./cart/drawer-parts.js";import{CART_DRAWER_DEFAULTS as D}from"efficient-web-builder/format/lib/content/cart-drawer";function T({content:e=D}){const{isOpen:t,preview:i,close:a,items:l}=d(),s=p(null),n=x(l.some(u));return b({active:t,onDismiss:a,lockScroll:!i}),f(()=>{t&&s.current?.focus({preventScroll:!0})},[t]),t?o(m,{children:[r("div",{onClick:a,className:"fixed inset-0 z-[60] backdrop-blur-[4px]",style:{background:"rgba(0,0,0,0.68)",animation:"storefront-cart-fade 350ms ease both"},"aria-hidden":"true"}),o("aside",{role:"dialog","aria-label":"Your cart","aria-modal":"true",className:"fixed inset-y-0 right-0 z-[61] flex w-[520px] max-w-[100vw] flex-col border-l border-line bg-bg max-[640px]:w-screen max-[640px]:border-l-0",style:{animation:"storefront-cart-slide 450ms cubic-bezier(.2,.7,.2,1) both",boxShadow:"-30px 0 80px rgba(0,0,0,.5)"},onClick:c=>c.stopPropagation(),children:[r("style",{children:`
|
|
2
2
|
@keyframes storefront-cart-fade { from { opacity: 0 } to { opacity: 1 } }
|
|
3
3
|
@keyframes storefront-cart-slide { from { transform: translateX(40px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
|
|
4
|
-
`}),r("header",{className:"flex flex-shrink-0 flex-col gap-4 border-b border-line px-8 pb-6 pt-8 max-[640px]:px-6 max-[640px]:pt-6 max-[640px]:pb-5",children:[r("div",{className:"flex items-center justify-between",children:[r("span",{className:"flex items-center gap-3 font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[t.kickerBadge?e("span",{className:"border px-2 py-1 text-[10px]",style:{background:"color-mix(in oklab, var(--accent) 12%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 50%, transparent)"},children:t.kickerBadge}):null,(t.kickerBadge?"· ":"")+t.kickerText]}),e("button",{ref:k,type:"button",onClick:o,"aria-label":"Close cart",className:"flex h-8 w-8 items-center justify-center border border-line text-[14px] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"✕"})]}),r("h1",{className:"font-display text-[38px] font-medium uppercase leading-[0.95] tracking-[-0.03em] max-[640px]:text-[30px]",children:[t.titleLead+" ",e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.02em] normal-case",children:t.titleAccent})]}),e("p",{className:"font-serif text-[13px] italic leading-[1.5] text-fg-dim",children:Q(t,i.length)})]}),r("div",{className:`grid flex-shrink-0 ${X[F-1]} gap-px border-b border-line bg-line`,children:[e(v,{label:"Items",value:r(g,{children:[e("em",{className:"font-serif font-normal italic text-accent",children:a.sets})," set",a.sets===1?"":"s"," · ",a.units," item",a.units===1?"":"s"]})}),t.leadTimeValue?e(v,{label:"Lead time",value:t.leadTimeValue}):null,y?e(v,{label:"Ships to",value:y}):null]}),r("div",{className:"flex-1 overflow-y-auto [scrollbar-color:var(--site-line)_transparent] [scrollbar-width:thin]",children:[i.length===0?e(J,{content:t}):i.map(n=>e(K,{line:n,tyre:_.get(n.slug),onRemove:()=>h(n.id),onQtyChange:x=>u(n.id,x)},n.id)),N.length>0&&r("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",style:{background:"color-mix(in oklab, var(--site-surface) 60%, transparent)"},children:[r("div",{className:"mb-4 flex items-center justify-between font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:[e("span",{children:"You may also need"}),e("span",{className:"font-display text-[11px] normal-case tracking-[0.08em] text-fg-dim",children:"Buy together, save"})]}),e("div",{className:"grid grid-cols-2 gap-2 max-[640px]:grid-cols-1",children:N.map(n=>e(Y,{href:`/bundles/${n.slug}`,title:n.name,sub:G(n,a.currency,d)},n.slug))})]}),e("section",{className:"border-b border-line px-8 py-6 max-[640px]:px-6",children:e(D,{})}),t.promises.length>0&&e("div",{className:"flex flex-wrap justify-center gap-5 border-b border-line px-8 pt-6 pb-8 font-mono text-[9px] uppercase tracking-[0.24em] text-fg-dim max-[640px]:px-6",children:t.promises.map(n=>e(H,{children:n},n))})]}),r("div",{className:"flex flex-shrink-0 flex-col gap-2 border-t border-line px-8 pt-5 max-[640px]:px-6",children:[e(c,{label:`Subtotal · ${a.sets} set${a.sets===1?"":"s"}`,value:d(a.subtotal,a.currency)}),a.appliedBundles.map(n=>e(c,{label:`Bundle · ${n.name}${n.multiples>1?` ×${n.multiples}`:""}`,value:r("span",{style:{color:"var(--green)"},children:["− ",d(n.discount,a.currency)]})},n.slug)),a.discount>0&&l?.valid&&e(c,{label:`Coupon · ${l.code}`,value:r("span",{style:{color:"var(--green)"},children:["− ",d(a.discount,a.currency)]})}),l?.deferred&&e(c,{label:`Coupon · ${l.code}`,value:O}),l?.valid&&l.effects?.gift&&e(c,{label:`Free gift · ${l.effects.gift.partNumber}${l.effects.gift.quantity>1?` ×${l.effects.gift.quantity}`:""}`,value:e("span",{style:{color:"var(--green)"},children:w})}),e(c,{label:"Shipping",value:a.shippingStatus==="free"?e("span",{style:{color:"var(--green)"},children:w}):V(a.shippingStatus)??d(a.shipping,a.currency)}),a.tax&&(a.tax.charged?e(c,{label:a.tax.inclusive?`${a.tax.name} included · ${a.tax.rate}%`:a.tax.name,value:d(a.tax.amount,a.currency)}):a.tax.name?e(c,{label:a.tax.name,value:q}):null),r("div",{className:"mt-2 flex items-center justify-between border-t border-line pt-4 text-fg",children:[r("span",{className:"font-display text-[22px] font-medium tracking-[-0.02em] normal-case",children:["Total ",e("em",{className:"font-serif font-normal italic text-accent",children:"due"})]}),e("span",{className:"text-right font-display text-[30px] font-medium tracking-[-0.025em] text-fg",children:a.repricing?"…":d(a.grand,a.currency)})]})]}),r("div",{className:"flex flex-shrink-0 flex-col gap-3 px-8 pb-6 pt-4 max-[640px]:px-6",children:[r(f,{href:"/checkout",onClick:o,"aria-disabled":i.length===0,className:["group flex items-center justify-between border px-5 py-5 font-mono text-[12px] uppercase tracking-[0.3em] transition-colors",i.length===0?"pointer-events-none cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:["Begin checkout",e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}),e("div",{className:"flex items-center justify-between px-1 py-2 font-mono text-[10px] uppercase tracking-[0.24em] text-fg-dim",children:e(f,{href:"/wheels",onClick:o,className:"text-fg transition-colors hover:text-accent",children:"← Keep browsing"})})]})]})]}):null}const X=["grid-cols-1","grid-cols-2","grid-cols-3"];function v({label:t,value:s}){return r("div",{className:"flex flex-col gap-1 bg-bg px-4 py-4",children:[e("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-fg-dim",children:t}),e("span",{className:"font-display text-[14px] font-medium tracking-[-0.005em] text-fg",children:s})]})}function K({line:t,tyre:s,onRemove:m,onQtyChange:o}){const{catalog:i,totals:h}=S(),u=(t.components??[]).reduce((p,b)=>p+(h.freeUnitsByPartNumber[b.partNumber]??0),0),{currency:a,formatMoney:l}=T();return r(g,{children:[r("article",{className:"grid grid-cols-[96px_1fr] gap-5 border-b border-line px-8 py-6 transition-colors hover:bg-[color-mix(in_oklab,var(--site-surface)_60%,transparent)] max-[640px]:grid-cols-[78px_1fr] max-[640px]:px-6 max-[640px]:py-5",children:[e(L,{line:t,catalog:i,tyre:s}),r("div",{className:"flex min-w-0 flex-col gap-2",children:[r("div",{className:"flex items-start justify-between gap-3",children:[r("span",{className:"font-mono text-[9px] uppercase tracking-[0.26em] text-accent",children:["N° ",t.positionNo," · ",t.process==="FusionForge®"?r(g,{children:["FusionForge",e(P,{})]}):t.process]}),e("span",{className:"whitespace-nowrap font-display text-[16px] font-medium tracking-[-0.015em] text-fg",children:C(t,a)===null?$:l(C(t,a),a)})]}),r("h3",{className:"mt-0.5 font-display text-[22px] font-medium uppercase leading-none tracking-[-0.02em]",children:[t.name.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em] normal-case",children:t.name.accent})]}),t.config.length>0&&r("div",{className:"mt-1 flex flex-wrap gap-2",children:[t.config.map(p=>e("span",{className:["border px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em]",p.gold?"border-[color-mix(in_oklab,var(--accent)_45%,var(--site-line))] text-accent":"border-line text-fg-dim"].join(" "),children:p.label},p.label)),u>0&&r("span",{className:"border border-accent bg-accent px-2 py-1 font-mono text-[9px] uppercase tracking-[0.18em] text-bg",children:[u,"× free"]})]}),r("div",{className:"mt-3 flex items-center justify-between gap-3",children:[e(A,{value:t.qty,onChange:o,size:"small"}),r("div",{className:"flex gap-4 font-mono text-[10px] uppercase tracking-[0.22em]",children:[e(f,{href:t.href??`/wheels/${t.slug}`,className:"text-fg-dim transition-colors hover:text-accent",children:t.href?"View product":"Edit finish"}),e("button",{type:"button",onClick:m,className:"text-fg-dim transition-colors hover:text-alert",children:"Remove"})]})]})]})]}),t.verifiedFor&&r("div",{className:"mx-8 -mt-px flex items-start gap-3 border-t-0 px-4 py-4 font-display text-[13px] leading-[1.45] text-fg max-[640px]:mx-6",style:{background:"color-mix(in oklab, var(--accent) 8%, transparent)",border:"1px solid color-mix(in oklab, var(--accent) 35%, var(--site-line))",borderTop:"0"},children:[e("span",{className:"flex-shrink-0 pt-px font-mono text-[10px] uppercase tracking-[0.24em] text-accent",children:"Fits"}),r("span",{children:["Verified for your ",e("strong",{className:"font-medium text-accent",children:t.verifiedFor}),". Final torque values shipped with the wheels."]})]})]})}function Y({title:t,sub:s,href:m}){return r(f,{href:m,className:"flex items-center justify-between border border-line bg-bg px-4 py-3 text-left transition-colors hover:border-accent",children:[r("span",{className:"flex min-w-0 flex-col gap-1",children:[e("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-display text-[13px] font-medium tracking-[-0.005em] text-fg",children:t}),e("span",{className:"font-mono text-[9px] uppercase tracking-[0.22em] text-fg-dim",children:s})]}),e("span",{className:"ml-2 flex h-6 w-6 flex-shrink-0 items-center justify-center font-mono text-[13px] text-accent",style:{borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))",borderWidth:1,borderStyle:"solid"},children:"+"})]})}function G(t,s,m){const o=t.savings[s];if(o===void 0)return"Buy together";const i=m(o,s);return t.savingIsFrom?`Save from ${i}`:`Save ${i}`}function H({children:t}){return e("span",{className:"inline-flex items-center gap-2 before:text-[6px] before:text-accent before:content-['●']",children:t})}function c({label:t,value:s}){return r("div",{className:"flex items-center justify-between font-mono text-[11px] uppercase tracking-[0.18em] text-fg-dim",children:[e("span",{children:t}),e("strong",{className:"font-display text-[14px] font-normal tracking-[-0.005em] normal-case text-fg",children:s})]})}function J({content:t}){return r("div",{className:"flex flex-col items-center justify-center gap-3 px-8 py-20 text-center",children:[e("span",{className:"font-mono text-[10px] uppercase tracking-[0.3em] text-accent",children:t.emptyKicker}),e("p",{className:"font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:t.emptyBody}),r(f,{href:"/wheels",className:"mt-3 inline-flex items-center gap-3 border border-line px-5 py-3 font-mono text-[11px] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:["Browse the catalog ",e("span",{className:"text-accent",children:"→"})]})]})}export{K as CartLineRow,W as default};
|
|
4
|
+
`}),r(g,{content:e,closeRef:s}),r(w,{content:e}),o("div",{className:"flex-1 overflow-y-auto [scrollbar-color:var(--site-line)_transparent] [scrollbar-width:thin]",children:[r(h,{content:e,tyres:n}),r(R,{}),r(C,{}),r(v,{content:e})]}),r(k,{}),r(y,{})]})]}):null}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as r}from"react/jsx-runtime";import{useEffect as S,useRef as A,useState as u}from"react";import{stripMarkup as B}from"efficient-web-builder/format/lib/markup";import{sizedImage as z}from"efficient-web-builder/format/lib/sized-image";import D,{chatLauncherOnLeft as W}from"./ChatLauncher.js";import{useChat as U}from"./ChatContext.js";import{scrollBehavior as F}from"efficient-web-builder/render/components/useReducedMotion";const M="Chat with us",O="We usually reply within a few minutes",R="Hi! Ask us anything — about a wheel, an order, or fitment. Leave your details and we’ll reply.";function $({m:t}){if(t.sender_role==="system")return e("div",{className:"text-center text-[11px] text-fg/50 py-1",children:t.body});const a=t.sender_role==="bot",s=t.sender_role==="employee"||a;return e("div",{className:`flex ${s?"justify-start":"justify-end"}`,children:r("div",{className:`max-w-[80%] rounded-2xl px-3 py-2 text-sm ${s?"bg-fg/5 text-fg":"bg-accent text-accent-ink"}`,children:[s&&r("div",{className:"mb-0.5 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-fg/50",children:[a&&e("span",{"aria-hidden":"true",children:"✦"}),e("span",{children:a?t.sender_name||"Assistant":t.sender_name||"Support"}),a&&e("span",{className:"font-normal normal-case tracking-normal",children:"· automated"})]}),t.body&&e("p",{className:"whitespace-pre-wrap",children:t.body}),t.image_url&&e("a",{href:t.image_url,target:"_blank",rel:"noopener noreferrer",children:e("img",{...z(t.image_url,{fallbackWidth:640,maxWidth:1280}),sizes:"(max-width: 640px) 80vw, 320px",alt:"Attachment",className:"mt-2 max-h-48 w-auto rounded-lg"})})]})})}function G({title:t,subtitle:a,greeting:s,look:x}={}){const{isOpen:o,toggle:N,close:_,messages:l,sending:i,error:h,unread:f,hasConversation:k,isSignedIn:C,send:L}=U(),g=t?.trim()||M,E=a?.trim()||O,T=s?.trim()||R,[d,b]=u(""),[c,j]=u(""),[m,I]=u(""),y=A(null),p=!C&&!k;S(()=>{o&&y.current?.scrollIntoView({behavior:F(),block:"nearest"})},[l.length,o]);const v=d.trim().length>0&&(!p||c.trim()&&/.+@.+/.test(m)),w=()=>{!v||i||(L(d,p?{name:c.trim(),email:m.trim()}:void 0),b(""))};return o?r("aside",{role:"dialog","aria-label":"Chat with us","data-sf-floating":"",className:`fixed bottom-5 ${W(x)?"left-5":"right-5"} z-[61] flex h-[min(560px,80vh)] w-[min(380px,calc(100vw-2.5rem))] flex-col overflow-hidden rounded-2xl border border-line bg-bg shadow-[0_20px_60px_rgba(0,0,0,.45)]`,style:{color:"var(--fg)"},children:[r("div",{className:"flex items-center justify-between border-b border-line px-4 py-3",children:[r("div",{children:[e("div",{className:"text-sm font-semibold text-fg",children:g}),e("div",{className:"text-[11px] text-fg/50",children:E})]}),e("button",{type:"button",onClick:_,"aria-label":"Close chat",className:"rounded-md p-1 text-fg/60 hover:bg-fg/5",children:e("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.8,children:e("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})})]}),r("div",{className:"flex-1 space-y-2 overflow-y-auto px-3 py-3",children:[l.length===0&&e("p",{className:"px-2 py-4 text-center text-sm text-fg/50",children:T}),l.map(n=>e($,{m:n},n.id)),e("div",{ref:y})]}),r("div",{className:"border-t border-line p-3",children:[p&&r("div",{className:"mb-2 grid grid-cols-2 gap-2",children:[e("input",{value:c,onChange:n=>j(n.target.value),placeholder:"Your name",className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"}),e("input",{value:m,onChange:n=>I(n.target.value),type:"email",placeholder:"Email",className:"rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"})]}),h&&e("p",{className:"mb-2 text-xs text-red-600",children:h}),r("div",{className:"flex items-end gap-2",children:[e("textarea",{value:d,onChange:n=>b(n.target.value),onKeyDown:n=>{n.key==="Enter"&&!n.shiftKey&&(n.preventDefault(),w())},rows:1,placeholder:"Type a message…",className:"max-h-28 flex-1 resize-none rounded-lg border border-line bg-transparent px-3 py-2 text-sm outline-none focus:border-accent"}),e("button",{type:"button",onClick:w,disabled:!v||i,className:"rounded-lg bg-btn px-3 py-2 text-sm font-semibold text-btn-ink disabled:opacity-40",children:i?"…":"Send"})]})]})]}):e(D,{label:B(g),onOpen:N,zIndex:60,look:x,badge:f>0&&e("span",{className:"absolute -top-1 -right-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-red-600 px-1 text-[11px] font-bold text-white",children:f})})}export{R as DEFAULT_GREETING,O as DEFAULT_SUBTITLE,M as DEFAULT_TITLE,G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as r,jsxs as
|
|
1
|
+
import{jsx as r,jsxs as o,Fragment as a}from"react/jsx-runtime";import s from"./EuTyreLabelCard.js";import n from"./SectionBand.js";import d from"efficient-web-builder/render/components/SectionHeader";import l from"./SectionFootnote.js";const c="border-b border-line py-[120px] max-[1100px]:py-20";function m({labels:e,num:t,capped:i=!0}){return e.length===0?null:o(n,{className:c,capped:i,children:[r(d,{num:t,title:"EU tyre *label.*",description:"The registered grades for this tyre, read live from the EU product registry.",accent:!0}),r(p,{labels:e})]})}function p({labels:e}){return o(a,{children:[r("div",{className:"grid grid-cols-3 gap-2 max-[1100px]:grid-cols-2 max-[720px]:grid-cols-1",children:e.map(t=>r(s,{label:t},t.registrationNumber))}),r(l,{text:"Source: *EPREL*, the European Product Registry for Energy Labelling. Grades are shown as registered; the registry is the authority."})]})}export{c as EU_LABEL_BAND,p as EuTyreLabelGrades,m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useCallback as P,useEffect as F,useRef as W,useState as O}from"react";import S from"next/link";import G from"./CountrySelect.js";import z from"./HeaderNavItem.js";import B from"./ThemeToggle.js";import{renderChrome as _,renderGold as v}from"efficient-web-builder/render/components/goldPhrases";import{UTIL_WORDS as q}from"./HeaderTools.js";import A from"./MenuPlaceholderLabel.js";import{usePhoneMenuTools as K}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as Y}from"./SearchContext.js";import{useModalDismiss as J}from"./useModalDismiss.js";import Q from"efficient-easel/screen/components/UiIcon";import{usePreviewMenus as V}from"./PreviewMenusContext.js";import{FOOTER_MENU_PLACEHOLDER_COUNT as T,FOOTER_MENU_PLACEHOLDER_HEADING as X,FOOTER_MENU_PLACEHOLDER_HINT as Z}from"../lib/content/menu-placeholder.js";import{say as M}from"efficient-web-builder/format/lib/editor-words";import{UNDER_HEADER_SHEET_CLASS as ee}from"../lib/content/header-bar.js";import{isLabelOnlyMenuUrl as ne}from"../lib/menu-link.js";import{isMenuOrphaned as le}from"../lib/menu-source.js";import{menuLinkInRange as
|
|
1
|
+
"use client";import{jsx as e,jsxs as a}from"react/jsx-runtime";import{useCallback as P,useEffect as F,useRef as W,useState as O}from"react";import S from"next/link";import G from"./CountrySelect.js";import z from"./HeaderNavItem.js";import B from"./ThemeToggle.js";import{renderChrome as _,renderGold as v}from"efficient-web-builder/render/components/goldPhrases";import{UTIL_WORDS as q}from"./HeaderTools.js";import A from"./MenuPlaceholderLabel.js";import{usePhoneMenuTools as K}from"efficient-web-builder/render/components/PhoneMenuTools";import{useSearch as Y}from"./SearchContext.js";import{useModalDismiss as J}from"./useModalDismiss.js";import Q from"efficient-easel/screen/components/UiIcon";import{usePreviewMenus as V}from"./PreviewMenusContext.js";import{FOOTER_MENU_PLACEHOLDER_COUNT as T,FOOTER_MENU_PLACEHOLDER_HEADING as X,FOOTER_MENU_PLACEHOLDER_HINT as Z}from"../lib/content/menu-placeholder.js";import{say as M}from"efficient-web-builder/format/lib/editor-words";import{UNDER_HEADER_SHEET_CLASS as ee}from"../lib/content/header-bar.js";import{isLabelOnlyMenuUrl as ne}from"../lib/menu-link.js";import{isMenuOrphaned as le}from"../lib/menu-source.js";import{menuLinkInRange as te,resolveMenuLinkAlign as re,resolveMenuLinkRange as ae}from"../lib/content/menu-row.js";const oe=n=>/^https?:\/\//i.test(n),I="flex list-none flex-col gap-3 text-[13px]",R="mb-4 font-mono text-[13px] uppercase tracking-[0.2em] text-fg-dim",D="text-[12px] italic text-fg-dim/70",H=(n,r)=>n&&r>0?"border-t border-line pt-3":"";function ie({showDividers:n}){return e("ul",{className:I,children:Array.from({length:T},(r,t)=>e("li",{className:`text-fg ${H(n,t)}`,children:e(A,{})},t))})}function k({item:n,label:r,link:t,onNavigate:o}){return ne(n.url)?e("span",{className:r,children:v(n.label)}):oe(n.url)?e("a",{href:n.url,target:"_blank",rel:"noopener noreferrer",className:t,onClick:o,children:v(n.label)}):e(S,{href:n.url,className:t,onClick:o,children:v(n.label)})}function j({items:n,showDividers:r}){return e("ul",{className:I,children:n.map((t,o)=>e("li",{className:H(r,o),children:e(k,{item:t,label:"text-fg",link:"text-fg transition-colors hover:text-accent"})},`${t.label}-${o}`))})}const $="opacity-80 transition-opacity hover:opacity-100";function se({items:n,label:r,editing:t,linkAlign:o,linkRange:N}){const y=re(o),u=ae(N),C=!!u&&n!==null&&u.to!==void 0&&u.to<n.length,[h,L]=O(!1),p=W(null),i=K(),{open:c}=Y(),E=r||"Menu",m=P(()=>L(!1),[]);J({active:h,onDismiss:m,scopeRef:p});const b=(l,s,x)=>n===null?Array.from({length:T},(d,f)=>e("li",{className:s,children:e(A,{})},f)):n.map((d,f)=>e("li",{className:s,children:e(k,{item:d,label:l,link:`${l} ${$}`,onNavigate:x})},`${d.label}-${f}`)),g=n===null?b("",""):n.map((l,s)=>{const x=l.dropdown_items??[],d=u&&!te(u,s+1)?{"data-menu-out":""}:null;return x.length?e("li",{className:"",...d,children:e(z,{item:{href:l.url,label:v(l.label),plainLabel:l.label,dropdownItems:x.map(f=>({href:f.url,label:v(f.label),plainLabel:f.label}))}})},`${l.label}-${s}`):e("li",{className:"",...d,children:e(k,{item:l,label:"",link:` ${$}`})},`${l.label}-${s}`)}),U=n===null?b("","flex min-h-14 items-center border-b border-line",m):n.flatMap((l,s)=>[e("li",{className:"flex min-h-14 items-center border-b border-line",children:e(k,{item:l,label:"",link:` ${$}`,onNavigate:m})},`${l.label}-${s}`),...(l.dropdown_items??[]).map((x,d)=>e("li",{className:"flex min-h-12 items-center border-b border-line pl-5 text-[14px]",children:e(k,{item:x,label:"",link:` ${$}`,onNavigate:m})},`${l.label}-${s}-${d}`))]),w=i&&(i.search||i.region||i.account||i.theme)?i:null;return a("nav",{ref:p,"aria-label":E,"data-menu-row":"",...y?{"data-menu-align":y}:null,...C?{"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:g}),e("button",{type:"button",className:"flex h-11 w-11 items-center justify-center view-tablet:hidden","aria-expanded":h,"aria-label":h?"Close the menu":"Open the menu",onClick:()=>L(l=>!l),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:h?e("path",{d:"M6 6l12 12M18 6L6 18"}):e("path",{d:"M4 7h16M4 12h16M4 17h16"})})}),h?a("div",{role:"dialog","aria-label":E,className:`${ee} 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:U}),w?a("div",{className:"mt-auto flex flex-col gap-4 border-t border-line bg-surface p-5",children:[w.search?a("button",{type:"button",className:"flex h-12 items-center gap-3 border border-line bg-bg px-4 text-left text-[15px]",onClick:t?void 0:()=>{m(),c()},children:[e(Q,{name:"search",size:18,strokeWidth:1.6,rounded:!0}),q.search]}):null,w.account?a("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),e(S,{href:"/account",onClick:m,className:"mono-eyebrow underline",children:"Your account"})]}):null,w.region?a("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),e(G,{})]}):null,w.theme?a("div",{className:"flex items-center justify-between",children:[e("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),e(B,{})]}):null]}):null]}):null]})}function ce({menu:n,heading:r,accordionMobile:t=!1,showDividers:o=!1,editing:N=!1,layout:y="column",linkAlign:u,linkRange:C}){const{live:h,ready:L}=V(),p=le({id:n?.id,handle:n?.handle,editing:N,ready:L,live:h}),i=p?[]:n?.items??[],c=r||n?.name||"",[E,m]=O(!1);return F(()=>{if(!t)return;const b=window.matchMedia("(max-width: 800px)"),g=()=>m(b.matches);return g(),b.addEventListener("change",g),()=>b.removeEventListener("change",g)},[t]),y==="row"?e(se,{items:p?null:i,label:c,editing:N,linkAlign:u,linkRange:C}):p?a("div",{className:"min-w-0",children:[e("h4",{className:R,children:r?_(r):M(X)}),e(ie,{showDividers:o}),e("p",{className:`mt-3 ${D}`,children:M(Z)})]}):i.length===0?a("div",{className:"min-w-0",children:[c?e("h4",{className:R,children:_(c)}):null,N?e("p",{className:D,children:M("This menu has no links yet — add them in {place}.",{place:M("Storefront → Menus")})}):null]}):t&&E?a("details",{className:"min-w-0 border-b border-line",children:[a("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:[_(c),e("span",{"aria-hidden":!0,children:"+"})]}),e("div",{className:"pb-3",children:e(j,{items:i,showDividers:o})})]}):a("div",{className:"min-w-0",children:[c?e("h4",{className:R,children:_(c)}):null,e(j,{items:i,showDividers:o})]})}export{ce as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as c}from"react/jsx-runtime";import{useEffect as F}from"react";import{FormFieldInput as
|
|
1
|
+
"use client";import{jsx as t,jsxs as c}from"react/jsx-runtime";import{useEffect as F}from"react";import{FormFieldInput as g,FormHoneypot as S,successMessageFor as w,useBoundForm as z,useFormSubmission as T}from"./formSubmission.js";import h from"./SectionNotice.js";import{say as b}from"efficient-web-builder/format/lib/editor-words";import C from"./WebFormField.js";import{usePopupScope as j}from"./PopupHost.js";const y="w-full border-2 border-line bg-bg px-4 py-4 font-display text-[17px] tracking-[-0.005em] text-fg outline-none transition-colors placeholder:text-fg-dim hover:border-fg-dim focus:border-accent";function B({field:e,value:o,onChange:n}){const r={field:e,value:o,onChange:n};return e.type==="checkbox"?c("label",{className:"flex items-start gap-3",children:[t(g,{...r,className:"mt-1 size-4 accent-accent"}),c("span",{className:"font-mono text-[12px] font-semibold uppercase tracking-[0.16em] text-fg",children:[e.label,e.required?t("span",{className:"text-accent",children:" *"}):null]})]}):t(C,{label:e.label,required:e.required,children:t(g,{...r,className:e.type==="textarea"?y+" resize-y":y})})}function q({formSlug:e,heading:o,intro:n,submitText:r,finePrint:s,form:p,editing:i=!1}={}){const a=z(e,p),x=j();if(a===void 0)return t(h,{size:"short",children:b("Loading form…")});if(a===null)return t(h,{size:"short",children:i?b("Choose a form in the inspector, under Form."):"This form is unavailable."});const m=(o??"").trim()||a.title;return t("section",{className:"relative z-[2] border-t border-line bg-surface",children:c("div",{className:"mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] py-[84px] max-[960px]:px-[min(24px,var(--sf-site-gutter,40px))]",children:[m&&t("h2",{className:"mb-4 font-heading2 text-[length:min(var(--size-headingMedium,44px),var(--sf-heading-max,9999px))] font-medium uppercase leading-none tracking-[-0.02em] text-fg max-[800px]:text-[length:min(var(--size-headingMedium,32px),var(--sf-heading-max,9999px))]",children:m}),(n??"").trim()&&t("p",{className:"mb-12 max-w-[640px] font-display text-[16px] leading-[1.6] text-fg-dim",children:n}),t(L,{form:a,formSlug:e,submitText:r,finePrint:s,editing:i,onSent:x?.markSent})]})})}function L({form:e,formSlug:o,submitText:n,finePrint:r,editing:s=!1,onSent:p}){const{valueOf:i,set:a,honeypot:x,setHoneypot:m,submitting:u,done:d,error:f,handleSubmit:N}=T({form:e,formSlug:o,editing:s});F(()=>{d&&p?.()},[d]);const v=(n??"").trim()||e.submitButtonText?.trim()||"Submit";return d?t("p",{role:"status",className:"max-w-[560px] font-serif text-[19px] italic leading-[1.6] text-fg-dim",children:w(e)}):c("form",{className:"flex max-w-[720px] flex-col gap-5",onSubmit:N,children:[e.fields.map(l=>t(B,{field:l,value:i(l.key),onChange:k=>a(l.key,k)},l.key)),t(S,{value:x,onChange:m}),f&&t("p",{role:"alert",className:"font-mono text-[12px] uppercase tracking-[0.18em] text-alert",children:f}),t("button",{type:s?"button":"submit",disabled:u,className:"cursor-pointer self-start bg-btn px-8 py-4 font-mono text-[14px] uppercase tracking-[0.32em] text-btn-ink transition-colors hover:bg-fg hover:text-bg disabled:cursor-wait disabled:opacity-60",children:u?"Sending…":v}),e.consentText?.trim()&&t("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim/70",children:e.consentText}),(r??"").trim()&&t("span",{className:"font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim/70",children:r})]})}export{L as FormBody,q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as n,Fragment as d}from"react/jsx-runtime";import{createContext as R,useCallback as $,useContext as A,useEffect as I,useRef as G,useState as N}from"react";import k from"next/link";import H from"./GalleryCard.js";import O,{LightboxClose as M}from"./Lightbox.js";import{renderGold as p,renderHeadline as Y}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as D}from"efficient-web-builder/format/lib/sized-image";const F="(max-width: 1100px) 100vw, min(59vw, 1050px)",B=R({}),oe=[{id:"tag",label:"Tag"},{id:"eyebrow",label:"Eyebrow"},{id:"title",label:"Title"},{id:"meta",label:"Meta"},{id:"number",label:"Card number"}],V="data-gallery-grid",L="data-gallery-tile";function W(r,l){const[s,m]=N(null);return I(()=>{const i=r.current,o=i?.closest(`[${V}]`);if(!i||!o)return;const h=()=>{const u=Array.from(o.querySelectorAll(`[${L}]`)),g=u.indexOf(i),x=g>=0?{index:g+1,total:u.length}:null;m(e=>e?.index===x?.index&&e?.total===x?.total?e:x)};if(h(),!l)return;const b=new MutationObserver(h);return b.observe(o,{childList:!0,subtree:!0}),()=>b.disconnect()},[r,l]),s}const le={process:"Category",eyebrow:"Subtitle",name:"Item name",meta:"Detail"},q=()=>({image:"",href:"#",process:"",eyebrow:"",name:"",meta:""}),ae=Array.from({length:6},q);function U(r,l){return(r??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||l}function Z(r){const l=(r.photos??[]).map(o=>o?.src).filter(o=>!!o),s=r.image||l[0]||"",m=[s,...l].filter(o=>!!o),i=U(r.name,"gallery-item");return{car:r.eyebrow??"",wheel:r.name??"",process:r.process??"",finish:r.meta??"",imageLabel:`${i}.jpg`,detailLabel:`${i}-detail.jpg`,imageSrc:s||void 0,detailSrc:l[0]||s||void 0,photos:m,href:r.href}}function J({editing:r=!1,previewHover:l,ratio:s,captionPlace:m,...i}){const{galleryHref:o="/gallery",submitHref:h="/contact",previewHover:b,display:u,displayPhone:g,styleOwner:x}=A(B),e=Z(i),a=e.photos??(e.imageSrc?[e.imageSrc]:[]),C=G(null),S=$(c=>{C.current=c},[]),_=W(C,r),E=r&&(!!l||!!b),[T,f]=N(!1),[v,y]=N(0),j=()=>y(c=>(c-1+a.length)%a.length),z=()=>y(c=>(c+1)%a.length),w=a[v]??e.imageSrc??"",P=t(H,{build:e,forceHover:E,index:_?.index,total:_?.total,ratio:s,captionPlace:m,display:u,displayPhone:g,styleOwner:x,editing:r});return n(d,{children:[r?t("div",{ref:S,[L]:"",className:"block w-full text-left",children:P}):t("button",{ref:S,[L]:"",type:"button","aria-label":`Open ${e.car||"build"} on ${e.wheel||"wheel"}`,onClick:()=>{y(0),f(!0)},className:"block w-full cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:P}),t(O,{open:T,onClose:()=>f(!1),label:`${e.car} on ${e.wheel}`,onPrev:a.length>1?j:void 0,onNext:a.length>1?z:void 0,className:"flex items-center justify-center p-6 backdrop-blur-[8px] max-[700px]:p-3",style:{background:"color-mix(in oklab, var(--bg) 78%, transparent)"},children:n("div",{onClick:c=>c.stopPropagation(),className:"relative grid w-[min(1800px,100%)] max-h-[calc(100vh-48px)] grid-cols-[1.4fr_1fr] overflow-hidden border border-line bg-bg max-[1100px]:grid-cols-1 max-[1100px]:overflow-auto",style:{boxShadow:"0 60px 120px -20px
|
|
1
|
+
"use client";import{jsx as t,jsxs as n,Fragment as d}from"react/jsx-runtime";import{createContext as R,useCallback as $,useContext as A,useEffect as I,useRef as G,useState as N}from"react";import k from"next/link";import H from"./GalleryCard.js";import O,{LightboxClose as M}from"./Lightbox.js";import{renderGold as p,renderHeadline as Y}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as D}from"efficient-web-builder/format/lib/sized-image";const F="(max-width: 1100px) 100vw, min(59vw, 1050px)",B=R({}),oe=[{id:"tag",label:"Tag"},{id:"eyebrow",label:"Eyebrow"},{id:"title",label:"Title"},{id:"meta",label:"Meta"},{id:"number",label:"Card number"}],V="data-gallery-grid",L="data-gallery-tile";function W(r,l){const[s,m]=N(null);return I(()=>{const i=r.current,o=i?.closest(`[${V}]`);if(!i||!o)return;const h=()=>{const u=Array.from(o.querySelectorAll(`[${L}]`)),g=u.indexOf(i),x=g>=0?{index:g+1,total:u.length}:null;m(e=>e?.index===x?.index&&e?.total===x?.total?e:x)};if(h(),!l)return;const b=new MutationObserver(h);return b.observe(o,{childList:!0,subtree:!0}),()=>b.disconnect()},[r,l]),s}const le={process:"Category",eyebrow:"Subtitle",name:"Item name",meta:"Detail"},q=()=>({image:"",href:"#",process:"",eyebrow:"",name:"",meta:""}),ae=Array.from({length:6},q);function U(r,l){return(r??"").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||l}function Z(r){const l=(r.photos??[]).map(o=>o?.src).filter(o=>!!o),s=r.image||l[0]||"",m=[s,...l].filter(o=>!!o),i=U(r.name,"gallery-item");return{car:r.eyebrow??"",wheel:r.name??"",process:r.process??"",finish:r.meta??"",imageLabel:`${i}.jpg`,detailLabel:`${i}-detail.jpg`,imageSrc:s||void 0,detailSrc:l[0]||s||void 0,photos:m,href:r.href}}function J({editing:r=!1,previewHover:l,ratio:s,captionPlace:m,...i}){const{galleryHref:o="/gallery",submitHref:h="/contact",previewHover:b,display:u,displayPhone:g,styleOwner:x}=A(B),e=Z(i),a=e.photos??(e.imageSrc?[e.imageSrc]:[]),C=G(null),S=$(c=>{C.current=c},[]),_=W(C,r),E=r&&(!!l||!!b),[T,f]=N(!1),[v,y]=N(0),j=()=>y(c=>(c-1+a.length)%a.length),z=()=>y(c=>(c+1)%a.length),w=a[v]??e.imageSrc??"",P=t(H,{build:e,forceHover:E,index:_?.index,total:_?.total,ratio:s,captionPlace:m,display:u,displayPhone:g,styleOwner:x,editing:r});return n(d,{children:[r?t("div",{ref:S,[L]:"",className:"block w-full text-left",children:P}):t("button",{ref:S,[L]:"",type:"button","aria-label":`Open ${e.car||"build"} on ${e.wheel||"wheel"}`,onClick:()=>{y(0),f(!0)},className:"block w-full cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:P}),t(O,{open:T,onClose:()=>f(!1),label:`${e.car} on ${e.wheel}`,onPrev:a.length>1?j:void 0,onNext:a.length>1?z:void 0,className:"flex items-center justify-center p-6 backdrop-blur-[8px] max-[700px]:p-3",style:{background:"color-mix(in oklab, var(--bg) 78%, transparent)"},children:n("div",{onClick:c=>c.stopPropagation(),className:"relative grid w-[min(1800px,100%)] max-h-[calc(100vh-48px)] grid-cols-[1.4fr_1fr] overflow-hidden border border-line bg-bg max-[1100px]:grid-cols-1 max-[1100px]:overflow-auto",style:{boxShadow:"0 60px 120px -20px color-mix(in srgb, var(--sf-shadow-color, #141416) 70%, transparent)"},children:[t(M,{label:"Close popup",className:"absolute right-[24px] top-[24px] z-[5] flex h-[56px] w-[56px] items-center justify-center border border-line font-mono text-[length:var(--size-label,21px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:"color-mix(in oklab, var(--bg) 70%, transparent)"},children:"✕"}),n("div",{className:"relative flex min-h-[690px] items-center justify-center overflow-hidden bg-surface-2 max-[1100px]:min-h-[450px]",children:[w&&t("img",{...D(w,{fallbackWidth:1280}),sizes:F,alt:`${e.car} — ${v+1} of ${a.length}`,className:"block h-full max-h-[88vh] w-full object-cover"},w),a.length>1&&n(d,{children:[t("button",{type:"button","aria-label":"Previous photo",onClick:j,className:"absolute left-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),t("button",{type:"button","aria-label":"Next photo",onClick:z,className:"absolute right-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"}),n("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[v+1," / ",a.length]})]})]}),n("div",{className:"flex flex-col gap-[30px] px-[60px] py-[72px] max-[1100px]:px-9 max-[1100px]:py-[54px]",children:[e.process&&t("span",{className:"font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.3em] text-accent",children:p(e.process)}),e.wheel&&t("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:Y(e.wheel,!1)}),e.car&&n("div",{className:"font-heading3 text-[length:var(--size-headingSmall,27px)] leading-[1.4] text-fg",children:["on ",t("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em]",children:p(e.car,!0)})]}),n("dl",{className:"mt-3 grid grid-cols-[auto_1fr] gap-x-7 gap-y-[18px] border-y border-line py-[30px] font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em]",children:[e.wheel&&n(d,{children:[t("dt",{className:"text-fg-dim",children:"Wheel"}),t("dd",{className:"text-fg",children:p(e.wheel)})]}),e.process&&n(d,{children:[t("dt",{className:"text-fg-dim",children:"Process"}),t("dd",{className:"text-fg",children:p(e.process)})]}),e.finish&&n(d,{children:[t("dt",{className:"text-fg-dim",children:"Finish"}),t("dd",{className:"text-fg",children:p(e.finish)})]}),e.car&&n(d,{children:[t("dt",{className:"text-fg-dim",children:"Vehicle"}),t("dd",{className:"text-fg",children:p(e.car)})]})]}),n("div",{className:"mt-auto flex flex-col gap-3.5 pt-6",children:[n(k,{href:e.href||"/wheels",onClick:()=>f(!1),className:"group flex items-center justify-between gap-6 border border-btn bg-btn px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",children:[t("span",{children:"View product"}),t("span",{className:"transition-transform group-hover:translate-x-[6px]",children:"→"})]}),n(k,{href:o,onClick:()=>f(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[t("span",{children:"See more builds"}),t("span",{children:"→"})]}),n(k,{href:h,onClick:()=>f(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[t("span",{children:"Submit your build"}),t("span",{children:"→"})]})]})]})]})})]})}export{V as GALLERY_GRID_ATTR,le as GALLERY_ITEM_HINTS,ae as GALLERY_ITEM_SEEDS,L as GALLERY_TILE_ATTR,oe as GALLERY_TILE_PARTS,B as GalleryLinksContext,J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,Fragment as I,jsxs as s}from"react/jsx-runtime";import te from"next/link";import{usePathname as Ke}from"next/navigation";import{useCallback as Ve,useEffect as O,useState as p}from"react";import{useCart as qe}from"./CartContext.js";import{useSearch as Ye}from"./SearchContext.js";import Je,{useCountrySelectShows as Xe}from"./CountrySelect.js";import{resolveCountryShowAs as Qe}from"../lib/content/country-show-as.js";import ne from"./HeaderNavItem.js";import Ze from"efficient-web-builder/render/components/Logo";import et from"./MenuPlaceholderLabel.js";import{withRMark as oe}from"efficient-web-builder/render/components/RMark";import{AccountButton as tt,CartButton as nt,SearchButton as ot}from"./HeaderTools.js";import{useHeaderBar as rt}from"./useHeaderBar.js";import{useModalDismiss as st}from"./useModalDismiss.js";import lt from"./ThemeToggle.js";import{products as at}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as it}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as ct}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as dt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as mt,resolveChromeWidth as ut}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as ht}from"../lib/content/header-theme.js";import{headerSolidBackground as ft,isProductPage as pt}from"../lib/content/header-bar.js";import{surfaceIsLight as gt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as xt,HEADER_SET_HEIGHT_CSS as bt}from"efficient-web-builder/render/lib/puck/header-clearance";import{HEADER_INK_ATTR as yt,HEADER_INK_OVERRIDE_ATTR as vt,resolveHeaderInkMode as wt}from"efficient-web-builder/render/lib/puck/header-ink";const re={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden min-[801px]:grid",flex:"hidden min-[801px]:flex"}},St=Array.from({length:ct},()=>({href:"#",label:r(et,{})}));function kt({previewSettings:g,initialSettings:$,editorPreview:T,showThemeToggle:se,wordmark:le,hideLogo:ae,hideMenu:ie,siteName:L,commerceEnabled:v=!0}={}){const M=Ke(),[ce,de]=p(!1);O(()=>{const e=b.current?.ownerDocument??document,t=()=>de(e.querySelector(`[${yt}="light"]`)!=null);t();const f=requestAnimationFrame(t);return()=>cancelAnimationFrame(f)},[M]);const z=pt(M),[c,w]=p(!1),{open:me,totals:ue}=qe(),{open:he}=Ye(),[C,fe]=p(!1),[pe,ge]=p(null),[xe,be]=p(null),[n,ye]=p($??null),o=g??(n?{logoUrl:n.logoUrl,reverseLogo:n.reverseLogo,logoReversed:n.logoReversed,logoInkIsDark:n.logoInkIsDark,logoPosition:n.logoPosition,logoSize:n.logoSize,logoSizePx:n.logoSizePx,menuItems:(n.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:n.menuSplit??3,menuPosition:n.menuPosition,menuRow:n.menuRow,menuGapPx:n.menuGapPx??null,searchEnabled:n.searchEnabled,searchPosition:n.searchPosition,searchRow:n.searchRow,countrySelectorEnabled:n.countrySelectorEnabled,countrySelectorShowAs:n.countrySelectorShowAs,countryUrls:n.countryUrls,accountEnabled:n.accountEnabled,cartEnabled:n.cartEnabled,utilStyle:n.utilStyle,navTextCase:n.navTextCase,lightReverseText:n.lightReverseText,topTextColor:n.topTextColor,transparentTop:n.transparentTop,surface:n.surface,theme:n.theme,width:n.width,heightPx:n.heightPx,sticky:n.sticky}:null),ve=ae?null:o?.logoUrl??null,we=o?.reverseLogo??!1,Se=o?.logoReversed??null,ke=o?.logoInkIsDark??null,i=o?.logoPosition??"center",Ne=o?.logoSize??"medium",Ee=o?.logoSizePx??null,B=Math.min(Math.max(o?.menuSplit??3,1),4),Pe=(o?.menuPosition??"left")==="center",Ie=(o?.menuPosition??"left")==="beside",U=(o?.menuRow??"top")==="inline",F=o?.menuGapPx??null,$e=F!=null?{gap:`${F}px`}:void 0,S=U?re.inline:re.stacked,Te=o?.searchEnabled??!1,G=o?.searchPosition??"right",Le=o?.countrySelectorEnabled??!0,Ce=Qe(o?.countrySelectorShowAs),_=o?.accountEnabled??!0,_e=o?.cartEnabled??!0,A=(o?.utilStyle??"icon")==="text",l=`mono-eyebrow${(o?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,W=o?.countryUrls??{},Ae=ut(o?.width),De=mt(Ae)??void 0,Re=o?.heightPx??xt.default,K=o?.sticky??"always",k=wt(o?.topTextColor),m=ht(o?.theme),N=Object.keys(W),V=Xe(N.length?N:void 0),x=Le?r(Je,{countries:N.length?N:void 0,urls:g?void 0:W,showAs:Ce}):null,{headerRef:b,scrolled:q,navHidden:He}=rt({stickyMode:K,heightPx:Re}),je=m?JSON.stringify(m.style):null;O(()=>{const e=b.current?.ownerDocument??document,t=e.defaultView??window,f=ee=>ee?gt(t.getComputedStyle(ee).getPropertyValue("--bg")):null,Z=()=>{fe(e.documentElement.getAttribute("data-theme")==="light"),ge(f(e.body)),be(f(b.current))};Z();const j=new MutationObserver(Z);return j.observe(e.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),e.body&&j.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>j.disconnect()},[b,je]);const y=se??dt?r(lt,{}):null;O(()=>{if(!it({editorPreview:!!T,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return at.getHeaderSettings().then(t=>!e&&ye(t)).catch(t=>{console.warn("[header] settings fetch failed; using built-in defaults",t)}),()=>{e=!0}},[T,g,$]);const E=q||z,Y=ft(C,z),J=k==="auto"?ce:k==="light",Oe=E||!J,Me=E?xe??C:(pe??C)&&!J,ze=k==="auto"?null:{[vt]:k},Be=Ve(()=>w(!1),[]);st({active:c,onDismiss:Be});const d=(e,t,f="start")=>r(ne,{item:e,dropdownAlign:f},t),Ue=!ie&&(o?.menuItems?.length??0)>0,X=!!T||!!g,a=Ue?o.menuItems.map(e=>({href:e.url||"",label:oe(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(t=>({href:t.url||"",label:oe(t.label),plainLabel:t.label}))})):X?St.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Fe=a.length>0||v&&_||!!x&&V||!!y,Ge=i==="center"?a.slice(0,B):i==="right"?a:[],We=i==="center"?a.slice(B):i==="left"?a:[],P=Te?r(ot,{onClick:X?void 0:he,asText:A}):null,D=v&&_?r(tt,{asText:A}):null,R=e=>v&&_e?r(nt,{onClick:me,count:ue.sets,asText:A,className:e}):null,u=s(I,{children:[G==="left"?P:null,x,y,D,R(),G==="right"?P:null]}),H=(e,t=!1)=>r(te,{href:"/","aria-label":L?`${L} home`:"Home",className:e,children:r(Ze,{variant:"header",scrolled:Oe,src:ve,reverse:we,onLightSurface:Me,reversedSrc:Se,inkIsDark:ke,size:Ne,sizePx:Ee,wordmark:le,siteName:L,fitToContainer:t})}),h=H("inline-flex shrink-0 items-center justify-center"),Q="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return s(I,{children:[r("header",{ref:b,"data-scrolled":q||void 0,...ze,className:["sf-site-header",...m?[m.className]:[],K==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-[800px]:px-[min(20px,var(--sf-site-gutter,40px))]",E?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:bt,...He?{transform:"translateY(-100%)"}:null,...E?{background:Y,color:"var(--fg)","--sf-header-ground":Y}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:s("div",{className:"w-full",style:De,children:[Pe?s("div",{className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${l} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${l} flex items-center justify-center gap-8`,children:a.map((e,t)=>d(e,`${e.href}-${t}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):i==="center"?s("div",{className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${l} flex items-center gap-8`,children:Ge.map((e,t)=>d(e,`${e.href}-${t}`))}),h,s("nav",{className:`${l} flex items-center justify-end gap-8`,children:[We.map((e,t)=>d(e,`${e.href}-${t}`,"end")),u]})]}):Ie?s("div",{className:`${S.flex} items-center justify-between gap-8`,children:[s("div",{className:"flex items-center gap-8",style:$e,children:[h,r("nav",{className:`${l} flex items-center gap-8`,children:a.map((e,t)=>d(e,`${e.href}-${t}`))})]}),r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):r("div",{className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?s(I,{children:[s("nav",{className:`${l} flex items-center gap-8`,children:[a.map((e,t)=>d(e,`${e.href}-${t}`)),u]}),h]}):s(I,{children:[h,s("nav",{className:`${l} flex items-center gap-8`,children:[a.map((e,t)=>d(e,`${e.href}-${t}`)),u]})]})}),!U&&s("div",{className:"hidden min-[801px]:max-[1500px]:flex flex-col gap-3",children:[s("div",{className:"flex items-center justify-between",children:[H(Q,!0),s("div",{className:`${l} flex shrink-0 items-center gap-5`,children:[P,x,y,D,R()]})]}),r("nav",{className:`${l} flex items-center gap-6 border-t border-line/60 pt-3`,children:a.map((e,t)=>d(e,`${e.href}-${t}`))})]}),s("div",{className:"hidden max-[800px]:flex items-center justify-between",children:[H(Q,!0),s("div",{className:"flex shrink-0 items-center gap-4",children:[P,D,R(l),Fe&&s("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&s("div",{className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden overflow-y-auto max-[800px]:flex max-[800px]:flex-col max-[800px]:gap-8 max-[800px]:bg-bg max-[800px]:px-6 max-[800px]:pt-24 max-[800px]:pb-10",children:[a.map((e,t)=>r(ne,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${t}`)),s("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[v&&_&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(te,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),x&&V&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),x]}),y&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),y]})]})]})]})}export{kt as default};
|
|
1
|
+
"use client";import{jsx as o,Fragment as I,jsxs as s}from"react/jsx-runtime";import te from"next/link";import{usePathname as Ke}from"next/navigation";import{useCallback as Ve,useEffect as O,useState as p}from"react";import{useCart as qe}from"./CartContext.js";import{useSearch as Ye}from"./SearchContext.js";import Je,{useCountrySelectShows as Xe}from"./CountrySelect.js";import{resolveCountryShowAs as Qe}from"../lib/content/country-show-as.js";import ne from"./HeaderNavItem.js";import Ze from"efficient-web-builder/render/components/Logo";import et from"./MenuPlaceholderLabel.js";import{withRMark as re}from"efficient-web-builder/render/components/RMark";import{AccountButton as tt,CartButton as nt,SearchButton as rt}from"./HeaderTools.js";import{useHeaderBar as ot}from"./useHeaderBar.js";import{useModalDismiss as st}from"./useModalDismiss.js";import at from"./ThemeToggle.js";import{products as lt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as it}from"../lib/header-settings-fetch.js";import{HEADER_MENU_PLACEHOLDER_COUNT as ct}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as dt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as mt,resolveChromeWidth as ut}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as ht}from"../lib/content/header-theme.js";import{headerSolidBackground as ft,isProductPage as pt}from"../lib/content/header-bar.js";import{surfaceIsLight as gt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as bt,HEADER_SET_HEIGHT_CSS as xt}from"efficient-web-builder/render/lib/puck/header-clearance";import{HEADER_INK_ATTR as vt,HEADER_INK_OVERRIDE_ATTR as yt,resolveHeaderInkMode as wt}from"efficient-web-builder/render/lib/puck/header-ink";const oe={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},St=Array.from({length:ct},()=>({href:"#",label:o(et,{})}));function kt({previewSettings:g,initialSettings:$,editorPreview:T,showThemeToggle:se,wordmark:ae,hideLogo:le,hideMenu:ie,siteName:L,commerceEnabled:y=!0}={}){const M=Ke(),[ce,de]=p(!1);O(()=>{const e=x.current?.ownerDocument??document,t=()=>de(e.querySelector(`[${vt}="light"]`)!=null);t();const f=requestAnimationFrame(t);return()=>cancelAnimationFrame(f)},[M]);const z=pt(M),[c,w]=p(!1),{open:me,totals:ue}=qe(),{open:he}=Ye(),[C,fe]=p(!1),[pe,ge]=p(null),[be,xe]=p(null),[n,ve]=p($??null),r=g??(n?{logoUrl:n.logoUrl,reverseLogo:n.reverseLogo,logoReversed:n.logoReversed,logoInkIsDark:n.logoInkIsDark,logoPosition:n.logoPosition,logoSize:n.logoSize,logoSizePx:n.logoSizePx,menuItems:(n.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[]})),menuSplit:n.menuSplit??3,menuPosition:n.menuPosition,menuRow:n.menuRow,menuGapPx:n.menuGapPx??null,searchEnabled:n.searchEnabled,searchPosition:n.searchPosition,searchRow:n.searchRow,countrySelectorEnabled:n.countrySelectorEnabled,countrySelectorShowAs:n.countrySelectorShowAs,countryUrls:n.countryUrls,accountEnabled:n.accountEnabled,cartEnabled:n.cartEnabled,utilStyle:n.utilStyle,navTextCase:n.navTextCase,lightReverseText:n.lightReverseText,topTextColor:n.topTextColor,transparentTop:n.transparentTop,surface:n.surface,theme:n.theme,width:n.width,heightPx:n.heightPx,sticky:n.sticky}:null),ye=le?null:r?.logoUrl??null,we=r?.reverseLogo??!1,Se=r?.logoReversed??null,ke=r?.logoInkIsDark??null,i=r?.logoPosition??"center",Ne=r?.logoSize??"medium",Ee=r?.logoSizePx??null,B=Math.min(Math.max(r?.menuSplit??3,1),4),Pe=(r?.menuPosition??"left")==="center",Ie=(r?.menuPosition??"left")==="beside",U=(r?.menuRow??"top")==="inline",F=r?.menuGapPx??null,$e=F!=null?{gap:`${F}px`}:void 0,S=U?oe.inline:oe.stacked,Te=r?.searchEnabled??!1,G=r?.searchPosition??"right",Le=r?.countrySelectorEnabled??!0,Ce=Qe(r?.countrySelectorShowAs),_=r?.accountEnabled??!0,_e=r?.cartEnabled??!0,A=(r?.utilStyle??"icon")==="text",a=`mono-eyebrow${(r?.navTextCase??"uppercase")==="capitalised"?" mono-eyebrow-plain":""}`,W=r?.countryUrls??{},Ae=ut(r?.width),De=mt(Ae)??void 0,Re=r?.heightPx??bt.default,K=r?.sticky??"always",k=wt(r?.topTextColor),m=ht(r?.theme),N=Object.keys(W),V=Xe(N.length?N:void 0),b=Le?o(Je,{countries:N.length?N:void 0,urls:g?void 0:W,showAs:Ce}):null,{headerRef:x,scrolled:q,navHidden:He}=ot({stickyMode:K,heightPx:Re}),je=m?JSON.stringify(m.style):null;O(()=>{const e=x.current?.ownerDocument??document,t=e.defaultView??window,f=ee=>ee?gt(t.getComputedStyle(ee).getPropertyValue("--bg")):null,Z=()=>{fe(e.documentElement.getAttribute("data-theme")==="light"),ge(f(e.body)),xe(f(x.current))};Z();const j=new MutationObserver(Z);return j.observe(e.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),e.body&&j.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>j.disconnect()},[x,je]);const v=se??dt?o(at,{}):null;O(()=>{if(!it({editorPreview:!!T,hasPreviewSettings:!!g,hasInitialSettings:!!$}))return;let e=!1;return lt.getHeaderSettings().then(t=>!e&&ve(t)).catch(t=>{console.warn("[header] settings fetch failed; using built-in defaults",t)}),()=>{e=!0}},[T,g,$]);const E=q||z,Y=ft(C,z),J=k==="auto"?ce:k==="light",Oe=E||!J,Me=E?be??C:(pe??C)&&!J,ze=k==="auto"?null:{[yt]:k},Be=Ve(()=>w(!1),[]);st({active:c,onDismiss:Be});const d=(e,t,f="start")=>o(ne,{item:e,dropdownAlign:f},t),Ue=!ie&&(r?.menuItems?.length??0)>0,X=!!T||!!g,l=Ue?r.menuItems.map(e=>({href:e.url||"",label:re(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(t=>({href:t.url||"",label:re(t.label),plainLabel:t.label}))})):X?St.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Fe=l.length>0||y&&_||!!b&&V||!!v,Ge=i==="center"?l.slice(0,B):i==="right"?l:[],We=i==="center"?l.slice(B):i==="left"?l:[],P=Te?o(rt,{onClick:X?void 0:he,asText:A}):null,D=y&&_?o(tt,{asText:A}):null,R=e=>y&&_e?o(nt,{onClick:me,count:ue.sets,asText:A,className:e}):null,u=s(I,{children:[G==="left"?P:null,b,v,D,R(),G==="right"?P:null]}),H=(e,t=!1)=>o(te,{href:"/","aria-label":L?`${L} home`:"Home",className:e,children:o(Ze,{variant:"header",scrolled:Oe,src:ye,reverse:we,onLightSurface:Me,reversedSrc:Se,inkIsDark:ke,size:Ne,sizePx:Ee,wordmark:ae,siteName:L,fitToContainer:t})}),h=H("inline-flex shrink-0 items-center justify-center"),Q="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return s(I,{children:[o("header",{ref:x,"data-scrolled":q||void 0,...ze,className:["sf-site-header",...m?[m.className]:[],K==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",E?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:xt,...He?{transform:"translateY(-100%)"}:null,...E?{background:Y,color:"var(--fg)","--sf-header-ground":Y}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:s("div",{className:"w-full",style:De,children:[Pe?s("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?o("nav",{className:`${a} flex items-center gap-8`,children:u}):o("div",{className:"flex items-center",children:h}),o("nav",{className:`${a} flex items-center justify-center gap-8`,children:l.map((e,t)=>d(e,`${e.href}-${t}`,"center"))}),i==="right"?o("div",{className:"flex items-center justify-end",children:h}):o("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):i==="center"?s("div",{"data-header-band":"",className:`${S.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[o("nav",{className:`${a} flex items-center gap-8`,children:Ge.map((e,t)=>d(e,`${e.href}-${t}`))}),h,s("nav",{className:`${a} flex items-center justify-end gap-8`,children:[We.map((e,t)=>d(e,`${e.href}-${t}`,"end")),u]})]}):Ie?s("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:[s("div",{className:"flex items-center gap-8",style:$e,children:[h,o("nav",{className:`${a} flex items-center gap-8`,children:l.map((e,t)=>d(e,`${e.href}-${t}`))})]}),o("nav",{className:`${a} flex items-center justify-end gap-8`,children:u})]}):o("div",{"data-header-band":"",className:`${S.flex} items-center justify-between gap-8`,children:i==="right"?s(I,{children:[s("nav",{className:`${a} flex items-center gap-8`,children:[l.map((e,t)=>d(e,`${e.href}-${t}`)),u]}),h]}):s(I,{children:[h,s("nav",{className:`${a} flex items-center gap-8`,children:[l.map((e,t)=>d(e,`${e.href}-${t}`)),u]})]})}),!U&&s("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[s("div",{className:"flex items-center justify-between",children:[H(Q,!0),s("div",{className:`${a} flex shrink-0 items-center gap-5`,children:[P,b,v,D,R()]})]}),o("nav",{className:`${a} flex items-center gap-6 border-t border-line/60 pt-3`,children:l.map((e,t)=>d(e,`${e.href}-${t}`))})]}),s("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[H(Q,!0),s("div",{className:"flex shrink-0 items-center gap-4",children:[P,D,R(a),Fe&&s("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>w(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),o("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&s("div",{"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[l.map((e,t)=>o(ne,{item:e,mobile:!0,onNavigate:()=>w(!1)},`${e.href}-${t}`)),s("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[y&&_&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),o(te,{href:"/account",onClick:()=>w(!1),className:"mono-eyebrow underline",children:"Your account"})]}),b&&V&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),b]}),v&&s("div",{className:"flex items-center justify-between",children:[o("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),v]})]})]})]})}export{kt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as
|
|
1
|
+
"use client";import{jsx as e,Fragment as l,jsxs as n}from"react/jsx-runtime";import{readHidable as s}from"efficient-easel/screen/lib/puck/hidable";import{useSiteCopyright as p}from"./SiteRecordContext.js";import{useConsentControls as c}from"./ConsentContext.js";import{CONSENT_TEXT_BUTTON as d}from"./ConsentBanner.js";function m({copyright:i}={}){const o=p(),r=s(i),a=r.hidden?null:r.text.trim()||o,t=c();return n("div",{className:"flex flex-wrap justify-between gap-x-6 gap-y-3 border-t border-line pt-6 font-mono text-[13px] uppercase tracking-[0.15em] text-fg-dim max-view-tablet:flex-col max-view-tablet:gap-3",children:[a!==null&&e("span",{children:a}),n("span",{className:"flex flex-wrap items-center gap-3 view-tablet:ml-auto",children:[e("span",{children:"Privacy"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{children:"Terms"}),e("span",{"aria-hidden":!0,children:"·"}),e("span",{children:"Cookies"}),t?.ready&&n(l,{children:[e("span",{"aria-hidden":!0,children:"·"}),e("button",{type:"button",className:`${d} text-left`,onClick:t.openPanel,children:t.rule.footerLink})]})]})]})}export{m as default};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import type { PopupLook } from "efficient-web-builder/format/lib/popup/look";
|
|
3
3
|
export declare function tintOf(hex: string, opacity: number): string;
|
|
4
|
-
export default function PopupFrame({ look, open, inline, onClose, label, children, }: {
|
|
4
|
+
export default function PopupFrame({ look, open, inline, modal, onClose, label, children, }: {
|
|
5
5
|
look: PopupLook;
|
|
6
6
|
open?: boolean;
|
|
7
7
|
inline?: boolean;
|
|
8
|
+
modal?: boolean;
|
|
8
9
|
onClose?: () => void;
|
|
9
10
|
label: string;
|
|
10
11
|
children?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as c,jsxs as g}from"react/jsx-runtime";import{useCallback as m,useRef as h}from"react";import{useModalDismiss as b}from"./useModalDismiss.js";const y={"top-left":{justifyContent:"flex-start",alignItems:"flex-start"},"top-center":{justifyContent:"center",alignItems:"flex-start"},"top-right":{justifyContent:"flex-end",alignItems:"flex-start"},left:{justifyContent:"flex-start",alignItems:"center"},center:{justifyContent:"center",alignItems:"center"},right:{justifyContent:"flex-end",alignItems:"center"},"bottom-left":{justifyContent:"flex-start",alignItems:"flex-end"},"bottom-center":{justifyContent:"center",alignItems:"flex-end"},"bottom-right":{justifyContent:"flex-end",alignItems:"flex-end"}};function C(t,s){const e=Number.parseInt(t.slice(1),16),n=e>>16&255,r=e>>8&255,i=e&255;return`rgba(${n}, ${r}, ${i}, ${Math.round(s)/100})`}function j({look:t,open:s=!0,inline:e=!1,modal:n=!0,onClose:r,label:i,children:d}){const f=h(null),l=m(()=>r?.(),[r]),a=n&&!e;if(b({active:a&&s,onDismiss:l,focusRef:f}),!e&&!s)return null;const p=u=>{!a||!t.outsideClick||u.target===u.currentTarget&&l()},o=t.height==="full",x=g("div",{ref:f,tabIndex:-1,"data-popup-panel":"",className:"relative bg-bg text-fg outline-none",style:{width:t.fullWidth?"100%":`min(${t.width}px, 100%)`,height:o?"100%":void 0,maxHeight:"100%",overflow:"auto",borderRadius:t.fullWidth||o?0:"var(--sf-section-radius, 0px)",...n||e?null:{pointerEvents:"auto"}},children:[t.closeButton!=="none"?c("button",{type:"button","aria-label":"Close",onClick:e?void 0:l,"data-popup-close":t.closeButton,className:"absolute z-[5] flex h-[38px] w-[38px] items-center justify-center border border-line bg-bg font-mono text-[14px] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:t.closeButton==="outside"?{top:-46,right:0}:{top:12,right:12},children:"×"}):null,d]});return c("div",{role:n||e?"dialog":"region","aria-modal":a?!0:void 0,"aria-label":i,"data-popup-frame":e?"inline":"live",onClick:p,className:e?"relative flex min-h-[100vh] w-full":"fixed inset-0 z-[90] flex",style:{...y[t.placement],background:C(t.tintColor,t.tintOpacity),padding:t.fullWidth||o?0:24,...n||e?null:{pointerEvents:"none"}},children:x})}export{j as default,C as tintOf};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import type { PopupLook } from "efficient-web-builder/format/lib/popup/look";
|
|
3
|
+
export interface HostedPopup {
|
|
4
|
+
slug: string;
|
|
5
|
+
title: string;
|
|
6
|
+
settings: Record<string, unknown>;
|
|
7
|
+
look?: PopupLook;
|
|
8
|
+
body?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
interface PopupScope {
|
|
11
|
+
markSent: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function usePopupScope(): PopupScope | null;
|
|
14
|
+
export default function PopupHost({ popups }: {
|
|
15
|
+
popups: readonly HostedPopup[];
|
|
16
|
+
}): import("react").JSX.Element | null;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as b}from"react/jsx-runtime";import{usePathname as D}from"next/navigation";import{createContext as T,useCallback as k,useContext as _,useEffect as O,useMemo as y,useRef as m,useState as B}from"react";import{SUBSCRIBE_POPUP_SLUG as H}from"efficient-web-builder/format/lib/content/subscribe";import{GRID_PHONE_BREAKPOINT as K}from"efficient-web-builder/format/lib/content/grid-span";import{popupSlugOf as A}from"efficient-web-builder/format/lib/links/page-link-rules";import{resolvePopupBehavior as I}from"efficient-web-builder/format/lib/popup/behavior";import{effectiveTrigger as U,localDay as j,markPopupClosed as M,markPopupSent as F,pickAutoPopup as G,popupAllowedOnPath as N,scrolledPercent as Y}from"efficient-web-builder/format/lib/popup/rules";import $ from"./PopupFrame.js";import{useSubscribePopup as q}from"./SubscribePopupContext.js";import{isEditorRoute as z}from"../lib/editor-route.js";import{POPUP_STORES as h}from"../lib/popup/popup-stores.js";const x=T(null);function le(){return _(x)}function J(){try{return window.matchMedia("(hover: hover) and (pointer: fine)").matches}catch{return!1}}function Q(){try{return window.matchMedia(`(max-width: ${K-1}px)`).matches}catch{return!1}}function V({popups:i}){const v=q(),[r,w]=B(null),c=D()??"/",u=z(c),P=m(c);P.current=c;const g=m(!1),f=y(()=>i.map(e=>({...e,id:e.slug,behavior:I(e.settings)})),[i]),S=f.filter(e=>e.behavior.autoOpen&&N(c,e.behavior.showOn,e.behavior.showOnPages)).map(e=>e.slug).join(" "),d=m(v);d.current=v;const E=m(i);E.current=i;const l=k((e,t)=>{if(e===H){t?d.current.openByItself():d.current.open();return}E.current.some(o=>o.slug===e&&o.body!==void 0)&&w(e)},[]);O(()=>{if(u)return;const e=t=>{if(t.defaultPrevented||t.button!==0||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const o=t.target?.closest?.("a[href]"),s=o?A(o.getAttribute("href")??""):null;s&&(t.preventDefault(),l(s,!1))};return document.addEventListener("click",e,!0),()=>document.removeEventListener("click",e,!0)},[u,l]),O(()=>{if(u||g.current||!S)return;const e=G(f,{path:P.current,isPhone:Q(),today:j(new Date),inEditor:u},h,Date.now());if(!e)return;const t=()=>{g.current=!0,l(e.slug,!0)},o=e.behavior,s=U(o.trigger,J());if(s==="scroll"){const n=()=>{Y(window.scrollY,window.innerHeight,document.documentElement.scrollHeight)>=o.scrollPercent&&(window.removeEventListener("scroll",n),t())};return window.addEventListener("scroll",n,{passive:!0}),()=>window.removeEventListener("scroll",n)}if(s==="exit"){const n=p=>{p.relatedTarget===null&&p.clientY<=0&&(document.removeEventListener("mouseout",n),t())};return document.addEventListener("mouseout",n),()=>document.removeEventListener("mouseout",n)}const C=window.setTimeout(t,o.autoOpenDelaySec*1e3);return()=>window.clearTimeout(C)},[u,S,f,l]);const L=k(()=>{r&&M(r,h,Date.now()),w(null)},[r]),R=y(()=>({markSent:()=>{r&&F(r,h,Date.now())}}),[r]),a=r?i.find(e=>e.slug===r):void 0;return a?.look?b(x.Provider,{value:R,children:b($,{look:a.look,label:a.title,open:!0,onClose:L,children:a.body})}):null}export{V as default,le as usePopupScope};
|