efficient-storefront-blocks 0.60.0 → 0.62.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.
Files changed (154) hide show
  1. package/CHANGELOG.md +79 -1
  2. package/README.md +2 -1
  3. package/dist/chunks/{EditorPreviewCheckout-XY2PLPBD.js → EditorPreviewCheckout-BQFPYYBS.js} +1 -1
  4. package/dist/chunks/{SiteEditorProvider-XF374NLZ.js → SiteEditorProvider-3E6XWZIS.js} +1 -1
  5. package/dist/chunks/chunk-4BQ44OLC.js +250 -0
  6. package/dist/chunks/chunk-MT5KWSYX.js +1 -0
  7. package/dist/chunks/chunk-OJ4OD3N6.js +1 -0
  8. package/dist/chunks/{fitment-data-RORHKBID.js → fitment-data-PWZAAUFK.js} +1 -1
  9. package/dist/editor/components/EditorPreviewChat.js +4 -4
  10. package/dist/editor/components/PreviewHeader.d.ts +1 -1
  11. package/dist/editor/components/PreviewHeader.js +4 -4
  12. package/dist/editor/lib/efficient-backend.d.ts +1 -0
  13. package/dist/editor/lib/efficient-backend.js +1 -1
  14. package/dist/editor/lib/efficient-block-sources.d.ts +2 -0
  15. package/dist/editor/lib/efficient-block-sources.js +1 -0
  16. package/dist/editor/lib/puck/blocks/commerce/EuTyreLabelBlock/fields.d.ts +2 -0
  17. package/dist/editor/lib/puck/blocks/commerce/EuTyreLabelBlock/fields.js +1 -0
  18. package/dist/editor/lib/puck/blocks/commerce/ProductGallery/fields.d.ts +6 -0
  19. package/dist/editor/lib/puck/blocks/commerce/ProductGallery/fields.js +1 -0
  20. package/dist/editor/lib/puck/blocks/commerce/ProductHero/fields.js +1 -1
  21. package/dist/editor/lib/puck/blocks/commerce/index.d.ts +1 -1
  22. package/dist/editor/lib/puck/blocks/commerce/index.js +1 -1
  23. package/dist/editor/lib/puck/blocks/service/RatingBlock/fields.d.ts +2 -0
  24. package/dist/editor/lib/puck/blocks/service/RatingBlock/fields.js +1 -0
  25. package/dist/editor/lib/puck/blocks/service/index.d.ts +1 -1
  26. package/dist/editor/lib/puck/blocks/service/index.js +1 -1
  27. package/dist/editor/lib/puck/config.js +1 -1
  28. package/dist/editor/lib/storefront-editor-words.d.ts +1 -0
  29. package/dist/editor/lib/storefront-editor-words.js +1 -1
  30. package/dist/editor.css +1 -1
  31. package/dist/fitment.d.ts +56 -0
  32. package/dist/fitment.js +1 -0
  33. package/dist/index.d.ts +36 -6
  34. package/dist/index.js +101 -81
  35. package/dist/links.js +1 -1
  36. package/dist/render/app/globals.css +70 -14
  37. package/dist/render/built-with.json +1 -1
  38. package/dist/render/components/CartContext.d.ts +1 -0
  39. package/dist/render/components/CartContext.js +1 -1
  40. package/dist/render/components/CartDrawer.d.ts +0 -8
  41. package/dist/render/components/CartDrawer.js +2 -2
  42. package/dist/render/components/ChatWidget.js +1 -1
  43. package/dist/render/components/EuTyreLabels.d.ts +3 -0
  44. package/dist/render/components/EuTyreLabels.js +1 -1
  45. package/dist/render/components/FitmentTable.js +1 -1
  46. package/dist/render/components/FooterMenu.js +1 -1
  47. package/dist/render/components/FormBlock.js +1 -1
  48. package/dist/render/components/GalleryItem.js +1 -1
  49. package/dist/render/components/Header.js +1 -1
  50. package/dist/render/components/LegalLine.js +1 -1
  51. package/dist/render/components/PopupFrame.d.ts +2 -1
  52. package/dist/render/components/PopupFrame.js +1 -1
  53. package/dist/render/components/PopupHost.d.ts +17 -0
  54. package/dist/render/components/PopupHost.js +1 -0
  55. package/dist/render/components/ProductCard.js +1 -1
  56. package/dist/render/components/ProductGallery.d.ts +15 -0
  57. package/dist/render/components/ProductGallery.js +1 -0
  58. package/dist/render/components/ProductHeroPanel.js +1 -1
  59. package/dist/render/components/RatingStars.d.ts +4 -0
  60. package/dist/render/components/RatingStars.js +1 -0
  61. package/dist/render/components/Reviews.js +1 -1
  62. package/dist/render/components/StorefrontProviders.d.ts +1 -3
  63. package/dist/render/components/StorefrontProviders.js +1 -1
  64. package/dist/render/components/SubscribePopupContext.d.ts +3 -15
  65. package/dist/render/components/SubscribePopupContext.js +1 -1
  66. package/dist/render/components/TyrePlpCard.js +1 -1
  67. package/dist/render/components/WheelCardFrame.d.ts +3 -27
  68. package/dist/render/components/WheelCardFrame.js +1 -1
  69. package/dist/render/components/card-pieces/CardBuyButton.d.ts +7 -0
  70. package/dist/render/components/card-pieces/CardBuyButton.js +1 -0
  71. package/dist/render/components/card-pieces/CardFinishSwatches.d.ts +5 -0
  72. package/dist/render/components/card-pieces/CardFinishSwatches.js +1 -0
  73. package/dist/render/components/card-pieces/CardPrice.d.ts +7 -0
  74. package/dist/render/components/card-pieces/CardPrice.js +1 -0
  75. package/dist/render/components/card-pieces/CardProductBadge.d.ts +7 -0
  76. package/dist/render/components/card-pieces/CardProductBadge.js +1 -0
  77. package/dist/render/components/card-pieces/CardSizes.d.ts +9 -0
  78. package/dist/render/components/card-pieces/CardSizes.js +1 -0
  79. package/dist/render/components/card-pieces/ProductCardState.d.ts +53 -0
  80. package/dist/render/components/card-pieces/ProductCardState.js +1 -0
  81. package/dist/render/components/card-pieces/card-row.d.ts +20 -0
  82. package/dist/render/components/card-pieces/card-row.js +1 -0
  83. package/dist/render/components/cart/drawer-parts.d.ts +28 -0
  84. package/dist/render/components/cart/drawer-parts.js +1 -0
  85. package/dist/render/components/pdp-dynamic/DynamicEuTyreLabel.d.ts +3 -0
  86. package/dist/render/components/pdp-dynamic/DynamicEuTyreLabel.js +1 -1
  87. package/dist/render/components/pdp-dynamic/DynamicProductGallery.d.ts +9 -0
  88. package/dist/render/components/pdp-dynamic/DynamicProductGallery.js +1 -0
  89. package/dist/render/components/useHeaderBar.js +1 -1
  90. package/dist/render/components/useIsLightTheme.d.ts +1 -0
  91. package/dist/render/components/useIsLightTheme.js +1 -0
  92. package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +2 -1
  93. package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
  94. package/dist/render/components/wheels-plp/PlpCard.d.ts +3 -2
  95. package/dist/render/components/wheels-plp/PlpCard.js +1 -1
  96. package/dist/render/components/wheels-plp/usePlpCardSelection.d.ts +1 -1
  97. package/dist/render/components/wheels-plp/usePlpCardSelection.js +1 -1
  98. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.d.ts +2 -1
  99. package/dist/render/components/wheels-plp/usePlpFiltersInUrl.js +1 -1
  100. package/dist/render/lib/api/index.d.ts +4 -2
  101. package/dist/render/lib/api/index.js +1 -1
  102. package/dist/render/lib/api/types.d.ts +48 -1
  103. package/dist/render/lib/chrome-load.d.ts +1 -1
  104. package/dist/render/lib/chrome-load.js +1 -1
  105. package/dist/render/lib/content/field-usage.d.ts +0 -1
  106. package/dist/render/lib/content/field-usage.js +1 -1
  107. package/dist/render/lib/content/product-hero.d.ts +1 -0
  108. package/dist/render/lib/content/product-hero.js +1 -1
  109. package/dist/render/lib/header-fit.d.ts +2 -0
  110. package/dist/render/lib/header-fit.js +1 -0
  111. package/dist/render/lib/popup/popup-stores.d.ts +2 -0
  112. package/dist/render/lib/popup/popup-stores.js +1 -0
  113. package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/meta.d.ts +2 -0
  114. package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/meta.js +1 -0
  115. package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/render.d.ts +2 -0
  116. package/dist/render/lib/puck/blocks/commerce/EuTyreLabelBlock/render.js +1 -0
  117. package/dist/render/lib/puck/blocks/commerce/ProductGallery/meta.d.ts +2 -0
  118. package/dist/render/lib/puck/blocks/commerce/ProductGallery/meta.js +1 -0
  119. package/dist/render/lib/puck/blocks/commerce/ProductGallery/render.d.ts +2 -0
  120. package/dist/render/lib/puck/blocks/commerce/ProductGallery/render.js +1 -0
  121. package/dist/render/lib/puck/blocks/commerce/metas.d.ts +2 -0
  122. package/dist/render/lib/puck/blocks/commerce/metas.js +1 -1
  123. package/dist/render/lib/puck/blocks/commerce/renders.d.ts +2 -0
  124. package/dist/render/lib/puck/blocks/commerce/renders.js +1 -1
  125. package/dist/render/lib/puck/blocks/service/RatingBlock/meta.d.ts +3 -0
  126. package/dist/render/lib/puck/blocks/service/RatingBlock/meta.js +1 -0
  127. package/dist/render/lib/puck/blocks/service/RatingBlock/render.d.ts +2 -0
  128. package/dist/render/lib/puck/blocks/service/RatingBlock/render.js +1 -0
  129. package/dist/render/lib/puck/blocks/service/metas.d.ts +1 -0
  130. package/dist/render/lib/puck/blocks/service/metas.js +1 -1
  131. package/dist/render/lib/puck/blocks/service/renders.d.ts +1 -0
  132. package/dist/render/lib/puck/blocks/service/renders.js +1 -1
  133. package/dist/render/lib/puck/lazy-draws.js +1 -1
  134. package/dist/render/lib/storefront-page-groups.js +1 -1
  135. package/dist/render/lib/wheels/fitment-columns.d.ts +6 -1
  136. package/dist/render/lib/wheels/fitment-columns.js +1 -1
  137. package/dist/render/lib/wheels/plp-fitment-match.d.ts +4 -0
  138. package/dist/render/lib/wheels/plp-fitment-match.js +1 -1
  139. package/dist/render/lib/wheels/plp-hydrate.d.ts +2 -0
  140. package/dist/render/lib/wheels/plp-hydrate.js +1 -1
  141. package/dist/render/lib/wheels/spec-sheet.js +1 -1
  142. package/dist/words.d.ts +2 -2
  143. package/dist/words.js +3 -3
  144. package/package.json +11 -4
  145. package/dist/chunks/chunk-EZQTUHPN.js +0 -1
  146. package/dist/chunks/chunk-FCCEAXMM.js +0 -1
  147. package/dist/chunks/chunk-YNI65Q6Z.js +0 -250
  148. package/dist/render/components/wheels-plp/useWheelCardBottom.d.ts +0 -20
  149. package/dist/render/components/wheels-plp/useWheelCardBottom.js +0 -1
  150. package/dist/render/lib/popup/popup-rules.d.ts +0 -25
  151. package/dist/render/lib/popup/popup-rules.js +0 -1
  152. /package/dist/chunks/{chunk-YNI65Q6Z.js.LEGAL.txt → chunk-4BQ44OLC.js.LEGAL.txt} +0 -0
  153. /package/dist/chunks/{chunk-VT346MLP.js → chunk-FZFBLN7K.js} +0 -0
  154. /package/dist/chunks/{chunk-I6VNNXUI.js → chunk-TRUOK5AD.js} +0 -0
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The public types of `efficient-storefront-blocks/fitment` (published as
3
+ * dist/fitment.d.ts).
4
+ *
5
+ * Written out, like `consent.public.d.ts`, and kept honest the same way:
6
+ * `types.check.ts` pairs each declaration with the code it describes.
7
+ *
8
+ * Plain data and pure functions. It imports nothing.
9
+ */
10
+
11
+ /** The unit a load is printed in. */
12
+ export type LoadUnit = "kg" | "lbs";
13
+
14
+ /** One size a wheel ships in, as a size table draws it. */
15
+ export interface FitmentRow {
16
+ diameter: number;
17
+ width: number;
18
+ holes: number;
19
+ /** PCD in mm — usually a single value ("112") but can be a range ("112-114.3"). */
20
+ pcd: string;
21
+ /** ET (offset) in mm. */
22
+ et: number;
23
+ /** Centre bore in mm. */
24
+ cb: number;
25
+ cap: string;
26
+ boltPattern: string;
27
+ loadRating: string;
28
+ }
29
+
30
+ /** One column of the size table. */
31
+ export interface FitmentColumn {
32
+ /** The catalogue field key an answer names. */
33
+ fieldKey: string;
34
+ header: string;
35
+ /** Drawn when no merchant has answered. A column OFF by default shows only
36
+ * on an explicit `fitment: true`; one ON by default hides only on `false`. */
37
+ shownByDefault: boolean;
38
+ cell: (row: FitmentRow, unit: LoadUnit) => string | number;
39
+ }
40
+
41
+ /** Every column, in the default order: Size, Bolt pattern, Offset, Centre
42
+ * bore, Cap, Load. */
43
+ export const FITMENT_COLUMNS: readonly FitmentColumn[];
44
+
45
+ /** Whether one column is drawn, given a site's answers. */
46
+ export function fitmentColumnShown(
47
+ column: FitmentColumn,
48
+ answers: readonly { fieldKey: string; fitment?: boolean }[],
49
+ ): boolean;
50
+
51
+ /** A free-text load rating ("880kg / 1,940 lbs") in ONE unit: "880 kg". */
52
+ export function formatLoad(text: string, unit: LoadUnit): string;
53
+
54
+ /** The market a page is drawn for (alpha-2, "" for none) → its load unit:
55
+ * "lbs" for "US", "kg" for every other. */
56
+ export function loadUnitFor(country: string): LoadUnit;
@@ -0,0 +1 @@
1
+ function p(e){return e.toUpperCase()==="US"?"lbs":"kg"}var d=.45359237,l=/\d[\d,]*(?:\.\d+)?/g,g=/(\d[\d,]*(?:\.\d+)?(?:\s*[–-]\s*\d[\d,]*(?:\.\d+)?)?)\s*(kgs?|lbs?)\b/gi,s=e=>Number(e.replace(/,/g,"")),a=e=>Math.round(e).toLocaleString("en-US");function f(e,n){let r={};for(let[,t,c]of e.matchAll(g)){let y=c.toLowerCase().startsWith("kg")?"kg":"lbs";r[y]??=t}let o=r[n];if(o!==void 0)return`${o.replace(l,t=>a(s(t))).replace(/\s*([–-])\s*/,"$1")} ${n}`;let i=r[n==="kg"?"lbs":"kg"];if(i===void 0)return e.trim();let u=n==="kg"?d:1/d;return`${i.replace(l,t=>a(s(t)*u)).replace(/\s*([–-])\s*/,"$1")} ${n}`}var m=e=>e>0?`+${e}`:e<0?`\u2212${-e}`:"0",h=e=>{let n=/^(\d+)\s*[×x]\s*\d/.exec(e.boltPattern)?.[1];return n!==void 0&&Number(n)===e.holes?e.boltPattern:e.holes>0&&e.pcd?`${e.holes}\xD7${e.pcd}`:e.boltPattern},b=[{fieldKey:"diameter",header:"Size",shownByDefault:!0,cell:e=>`${e.diameter} \xD7 ${e.width}`},{fieldKey:"bolt_pattern",header:"Bolt pattern",shownByDefault:!0,cell:h},{fieldKey:"et",header:"Offset",shownByDefault:!0,cell:e=>m(e.et)},{fieldKey:"center_bore",header:"Centre bore",shownByDefault:!1,cell:e=>e.cb},{fieldKey:"cap_code",header:"Cap",shownByDefault:!1,cell:e=>e.cap},{fieldKey:"load_rating",header:"Load",shownByDefault:!0,cell:(e,n)=>f(e.loadRating,n)}];function w(e,n){let r=n.find(o=>o.fieldKey===e.fieldKey)?.fitment;return e.shownByDefault?r!==!1:r===!0}export{b as FITMENT_COLUMNS,w as fitmentColumnShown,f as formatLoad,p as loadUnitFor};
package/dist/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export type EditorTarget =
23
23
  import type {
24
24
  EaselHost as EditorHost,
25
25
  EaselHostAddress as EditorHostAddress,
26
+ EaselHostPanels as EditorHostPanels,
26
27
  EaselToHostMessage as EditorToHostMessage,
27
28
  HostPickedMedia,
28
29
  HostToEaselMessage as HostToEditorMessage,
@@ -30,6 +31,7 @@ import type {
30
31
  export type {
31
32
  EaselHost as EditorHost,
32
33
  EaselHostAddress as EditorHostAddress,
34
+ EaselHostPanels as EditorHostPanels,
33
35
  EaselMessageType as EditorMessageType,
34
36
  EaselToHostMessage as EditorToHostMessage,
35
37
  HostPickedMedia,
@@ -56,7 +58,8 @@ export interface MediaPickRequest {
56
58
  options?: Record<string, unknown>;
57
59
  }
58
60
 
59
- /** The props the host's media panel is drawn with. */
61
+ /** The props the host's media popup is drawn with. It is drawn always; it is
62
+ * OPEN while `pick` or `browsing` is set. */
60
63
  export interface MediaPanelProps {
61
64
  /** The field choosing right now, or null. Wins over `browsing`. */
62
65
  pick: MediaPickRequest | null;
@@ -73,10 +76,28 @@ export interface MediaPanelProps {
73
76
  * 19). The names still say "panel": hosts import them. */
74
77
  export type MediaPanelComponent = ComponentType<MediaPanelProps>;
75
78
 
79
+ /** A file dragged out of the host's popup onto the canvas. */
80
+ export interface MediaPlacedFile {
81
+ id: string;
82
+ url: string;
83
+ kind: "image" | "video";
84
+ name: string;
85
+ }
86
+
87
+ /** What a file dropped on the canvas becomes on this host before the editor
88
+ * places it (its pick path). Null: it cannot be used here, nothing is placed. */
89
+ export type MediaPlace = (file: MediaPlacedFile) => Promise<HostPickedMedia | null>;
90
+
76
91
  /** A host for an editor mounted in the embedder's own page. One per editor. */
77
92
  export function createEditorHost(options: {
78
93
  onMessage: (message: EditorToHostMessage) => void;
79
94
  address: EditorHostAddress;
95
+ /** How the editor takes Escape before the embedder's window does. */
96
+ claimEscape?: (handler: (e: KeyboardEvent) => boolean) => () => void;
97
+ /** What the host puts in the editor's chrome (0.62.0): a button first in the
98
+ * top bar's right cluster, and a panel that stands in the inspector's place
99
+ * while `useRight` returns something (the admin portal's JARVIS). */
100
+ panels?: EditorHostPanels;
80
101
  }): { host: EditorHost; deliver: (message: HostToEditorMessage) => void };
81
102
 
82
103
  // ── The backend (0.4.0) ──────────────────────────────────────────────────────
@@ -266,18 +287,22 @@ export interface SiteRecord {
266
287
  name: string;
267
288
  /** Its public slug, where it has one. */
268
289
  slug?: string | null;
269
- /** The site-wide Google Maps browser key the canvas's map blocks draw with. */
290
+ /** The site-wide Google Maps browser key the canvas's map blocks drew with.
291
+ * @deprecated Every website map is efficient-shell's since efficient-web-builder 34 and needs no Google key, so nothing reads or writes it (Victor Mau, 2026-10-23: remove them). Removed in the next major. */
270
292
  mapsApiKey?: string | null;
271
- /** The site-wide Google Maps cloud style. */
293
+ /** The site-wide Google Maps cloud style.
294
+ * @deprecated Every website map is efficient-shell's since efficient-web-builder 34 and needs no Google key, so nothing reads or writes it (Victor Mau, 2026-10-23: remove them). Removed in the next major. */
272
295
  mapsMapId?: string | null;
273
296
  }
274
297
 
275
- /** The part of the site record the editor writes. */
298
+ /** The part of the site record the editor writes.
299
+ * @deprecated Only the Maps key, which nothing writes any more. Every website map is efficient-shell's since efficient-web-builder 34 and needs no Google key, so nothing reads or writes it (Victor Mau, 2026-10-23: remove them). Removed in the next major. */
276
300
  export type SiteRecordPatch = { mapsApiKey?: string };
277
301
 
278
302
  export interface WebsiteSite {
279
303
  get(scope?: SiteScope): Promise<SiteRecord>;
280
- /** Save the site-wide Maps key. Without it that field is read-only. */
304
+ /** Save the site-wide Maps key. Without it that field is read-only.
305
+ * @deprecated Every website map is efficient-shell's since efficient-web-builder 34 and needs no Google key, so nothing reads or writes it (Victor Mau, 2026-10-23: remove them). Removed in the next major. */
281
306
  update?(patch: SiteRecordPatch, scope?: SiteScope): Promise<SiteRecord>;
282
307
  /** RESERVED for the multilingual overlay: the languages the website is
283
308
  * written in. 0.4.0 does not call it. */
@@ -738,9 +763,12 @@ export function WebsiteEditor(props: {
738
763
  host: EditorHost;
739
764
  target: EditorTarget;
740
765
  site: WebsiteEditorSite | null;
741
- /** The host's media library, drawn in the editor's left panel. Without one,
766
+ /** The host's media library, drawn as the editor's one popup. Without one,
742
767
  * fields ask the host to open its picker window (`open-media-picker`). */
743
768
  mediaPanel?: MediaPanelComponent | null;
769
+ /** What a picture dropped from that popup becomes on this host first (its
770
+ * pick path). Without one, the file as it came. */
771
+ mediaPlace?: MediaPlace | null;
744
772
  /** The server the editor talks to. Without one it is EFFICIENT's
745
773
  * (`createEfficientBackend`). Read once, when the editor mounts. */
746
774
  backend?: WebsiteBackend | null;
@@ -765,6 +793,8 @@ export function WebsiteSectionEditor(props: {
765
793
  site: WebsiteEditorSite | null;
766
794
  /** The host's media library — see `WebsiteEditor`. */
767
795
  mediaPanel?: MediaPanelComponent | null;
796
+ /** A dropped picture's pick path — see `WebsiteEditor`. */
797
+ mediaPlace?: MediaPlace | null;
768
798
  /** The server the editor talks to — see `WebsiteEditor`. Needs
769
799
  * `sectionTemplates`. */
770
800
  backend?: WebsiteBackend | null;