@useinsider/guido 3.8.1-beta.9bb0c7b → 3.8.1-beta.bc12f34

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 (68) hide show
  1. package/dist/@types/config/schemas.js +70 -66
  2. package/dist/composables/useHtmlValidator.js +180 -133
  3. package/dist/composables/usePreviewMode.js +15 -14
  4. package/dist/composables/useRecommendationPreview.js +100 -0
  5. package/dist/config/compiler/recommendationCompilerRules.js +1 -1
  6. package/dist/config/compiler/utils/recommendationCompilerUtils.js +98 -89
  7. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  8. package/dist/config/migrator/recommendation/extractors.js +44 -22
  9. package/dist/config/migrator/recommendation/htmlBuilder.js +170 -163
  10. package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
  11. package/dist/config/migrator/recommendationMigrator.js +30 -31
  12. package/dist/extensions/Blocks/Items/block.js +29 -48
  13. package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +45 -62
  14. package/dist/extensions/Blocks/Recommendation/block.js +60 -41
  15. package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
  16. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
  17. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +26 -20
  18. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +359 -264
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -83
  20. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +43 -31
  21. package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
  22. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  23. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +55 -45
  24. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +171 -162
  25. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  26. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  27. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
  28. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
  29. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +3 -2
  30. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +6 -3
  31. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +130 -96
  32. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +43 -53
  33. package/dist/extensions/Blocks/Recommendation/templates/index.js +20 -16
  34. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +86 -80
  35. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +31 -40
  36. package/dist/extensions/Blocks/Recommendation/templates/utils.js +155 -102
  37. package/dist/src/@types/config/schemas.d.ts +16 -0
  38. package/dist/src/composables/useConfig.d.ts +4 -0
  39. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  40. package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
  41. package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
  42. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  43. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  44. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  45. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  46. package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
  47. package/dist/src/extensions/Blocks/Items/block.d.ts +0 -8
  48. package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +1 -1
  49. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
  50. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  51. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +21 -0
  52. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +36 -3
  53. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
  54. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
  55. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +5 -0
  56. package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
  57. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  58. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -0
  59. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
  60. package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +13 -1
  61. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  62. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  63. package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +10 -1
  64. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
  65. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +51 -1
  66. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
  67. package/dist/src/stores/config.d.ts +36 -0
  68. package/package.json +1 -1
@@ -1,101 +1,148 @@
1
- import { ATTR_CUSTOM_PREFIX as c, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as m, PRODUCT_ATTRIBUTE_PREFIX as l } from "../constants/selectors.js";
2
- function U(t) {
3
- return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
4
- }
5
- function S(t) {
6
- const n = Array.isArray(t) ? t[t.length - 1] : t;
7
- if (typeof n == "string")
8
- return n;
9
- if (typeof n == "number")
10
- return String(n);
11
- }
12
- function C(t, n) {
13
- const e = Object.values(n).find((o) => o.attributeName === t);
14
- return (e == null ? void 0 : e.type) === "defaultAttribute";
15
- }
16
- function E(t, n) {
17
- return C(t, n) ? t : `${l}${t}`;
18
- }
19
- function M(t) {
20
- const n = t.startsWith(l) ? t.substring(l.length) : t;
21
- return `${c}${n}`;
22
- }
23
- const P = Symbol("customCellHtml");
24
- function k(t, n, e = {}) {
25
- const o = t[P];
1
+ import { ATTR_PRODUCT_PRICE as c, ATTR_PRODUCT_OLD_PRICE as l, ATTR_CUSTOM_PREFIX as a, PRODUCT_ATTRIBUTE_PREFIX as u, ATTR_PRODUCT_IMAGE as f, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as _ } from "../constants/selectors.js";
2
+ import { useRecommendationExtensionStore as D } from "../store/recommendation.js";
3
+ import { formatPrice as O } from "../utils/priceFormatter.js";
4
+ function E() {
5
+ const t = D(), { currencySettings: e } = t.recommendationConfigs;
6
+ return {
7
+ code: e.value,
8
+ symbol: e.symbol,
9
+ alignment: e.alignment === "0" ? "before" : "after",
10
+ decimalCount: parseInt(e.decimalCount) || 2,
11
+ decimalSeparator: e.decimalSeparator,
12
+ thousandSeparator: e.thousandSeparator
13
+ };
14
+ }
15
+ function m(t, e = "price") {
16
+ const n = E(), o = t[e], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
17
+ return O({
18
+ price: r,
19
+ currency: n
20
+ });
21
+ }
22
+ function Y(t) {
23
+ return m(t, "price") === m(t, "original_price");
24
+ }
25
+ function I(t) {
26
+ return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
27
+ }
28
+ function G(t) {
29
+ const e = t.indexOf(c), n = t.indexOf(l), o = n !== -1 && (e === -1 || n < e);
30
+ return {
31
+ originalFirst: o,
32
+ anchor: o ? l : c,
33
+ skip: o ? c : l
34
+ };
35
+ }
36
+ function $(t) {
37
+ const e = Array.isArray(t) ? t[t.length - 1] : t;
38
+ if (typeof e == "string")
39
+ return e;
40
+ if (typeof e == "number")
41
+ return String(e);
42
+ }
43
+ function h(t, e) {
44
+ const n = Object.values(e).find((o) => o.attributeName === t);
45
+ return (n == null ? void 0 : n.type) === "defaultAttribute";
46
+ }
47
+ function L(t, e) {
48
+ return h(t, e) ? t : `${u}${t}`;
49
+ }
50
+ function j(t) {
51
+ const e = t.startsWith(u) ? t.substring(u.length) : t;
52
+ return `${a}${e}`;
53
+ }
54
+ const x = Symbol("customCellHtml");
55
+ function z(t, e, n = {}) {
56
+ const o = t[x];
26
57
  if (!o)
27
58
  return { ...t };
28
- const s = { ...t };
29
- return n.filter((r) => r.startsWith(c) && !s[r]).forEach((r) => {
30
- const i = r.substring(c.length), a = U(i), y = E(i, e), R = C(i, e);
31
- s[r] = (d, A) => {
32
- var u;
33
- const D = R ? d[i] : (u = d.product_attributes) == null ? void 0 : u[i], O = S(D) ?? a;
34
- return o(y, O, A);
59
+ const r = { ...t };
60
+ return e.filter((s) => s.startsWith(a) && !r[s]).forEach((s) => {
61
+ const i = s.substring(a.length), d = I(i), S = L(i, n), A = h(i, n);
62
+ r[s] = (g, R) => {
63
+ var b;
64
+ const P = A ? g[i] : (b = g.product_attributes) == null ? void 0 : b[i], U = $(P) ?? d;
65
+ return o(S, U, R);
35
66
  };
36
- }), s;
67
+ }), r;
68
+ }
69
+ function V(t, e) {
70
+ var n, o, r, s, i;
71
+ return {
72
+ cellPadding: e.cellPadding,
73
+ cardBackgroundColor: e.cardBackgroundColor,
74
+ cellBackgroundColor: (n = e.cellBackgroundColors) == null ? void 0 : n[t],
75
+ cellAlignment: (o = e.cellAlignments) == null ? void 0 : o[t],
76
+ cellClasses: (r = e.cellClasses) == null ? void 0 : r[t],
77
+ omnibusText: (s = e.omnibusTexts) == null ? void 0 : s[t],
78
+ styleTemplate: (i = e.styleTemplates) == null ? void 0 : i[t]
79
+ };
37
80
  }
38
- const x = {
81
+ const X = {
39
82
  TITLE: "You May Also Like!"
40
- }, v = [
41
- b,
42
- T,
43
- g,
44
- _,
83
+ }, K = [
45
84
  f,
85
+ T,
86
+ l,
87
+ c,
88
+ C,
46
89
  p,
47
- m
48
- ], F = {
49
- [b]: !0,
90
+ _
91
+ ], q = {
92
+ [f]: !0,
50
93
  [T]: !0,
51
- [_]: !0,
52
- [g]: !0,
53
- [f]: !1,
94
+ [c]: !0,
95
+ [l]: !0,
96
+ [C]: !1,
54
97
  [p]: !1,
55
- [m]: !0
56
- }, I = 10;
57
- function $(t = I) {
98
+ [_]: !0
99
+ }, B = 10;
100
+ function k(t = B) {
58
101
  return `
59
102
  <tr>
60
103
  <td class="spacer" style="height: ${t}px;"></td>
61
104
  </tr>
62
105
  `;
63
106
  }
64
- const L = $();
65
- function w(t, n) {
66
- return n ? n.pStyle ?? "" : t;
107
+ const v = k();
108
+ function w(t, e) {
109
+ return e ? e.pStyle ?? "" : t;
67
110
  }
68
- function W(t, n, e) {
69
- const o = w(n.pStyle, e), s = e ? e.openTags ?? "" : n.openTags, r = e ? e.closeTags ?? "" : n.closeTags;
70
- return `<p contenteditable="false" style="${o}">${s}${t}${r}</p>`;
111
+ function J(t, e, n) {
112
+ const o = w(e.pStyle, n), r = n ? n.openTags ?? "" : e.openTags, s = n ? n.closeTags ?? "" : e.closeTags;
113
+ return `<p contenteditable="false" style="${o}">${r}${t}${s}</p>`;
71
114
  }
72
- function H(t, n) {
73
- const e = [];
74
- return t && e.push(t), n && e.push(`background-color: ${n};`), e.join(" ");
115
+ function Q(t, e) {
116
+ const n = [];
117
+ return t && n.push(t), e && n.push(`background-color: ${e};`), n.join(" ");
75
118
  }
76
- function Y(t) {
77
- return t ? ` style="background-color: ${t};"` : "";
119
+ function N(t) {
120
+ return t ? ` background-color: ${t};` : "";
121
+ }
122
+ function Z(t) {
123
+ const e = N(t);
124
+ return e ? ` style="${e.trim()}"` : "";
78
125
  }
79
- function G(t, n = "") {
126
+ function tt(t, e = "") {
80
127
  return {
81
- before: (t == null ? void 0 : t.before) ?? n,
128
+ before: (t == null ? void 0 : t.before) ?? e,
82
129
  after: (t == null ? void 0 : t.after) ?? ""
83
130
  };
84
131
  }
85
- function z(t, n) {
86
- return `${(n == null ? void 0 : n.openTags) ?? ""}${t}${(n == null ? void 0 : n.closeTags) ?? ""}`;
132
+ function et(t, e) {
133
+ return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
87
134
  }
88
- function X(t) {
135
+ function nt(t) {
89
136
  return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
90
137
  }
91
- const j = "display: block; max-width: 100%; height: auto;", V = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", K = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", h = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
92
- function q(t) {
93
- return !t || typeof t != "string" || t.trim() === "" ? h : t.startsWith("http://") ? t.replace("http://", "https://") : t;
138
+ const ot = "display: block; max-width: 100%; height: auto;", rt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", st = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", y = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
139
+ function it(t) {
140
+ return !t || typeof t != "string" || t.trim() === "" ? y : t.startsWith("http://") ? t.replace("http://", "https://") : t;
94
141
  }
95
- function B(t) {
142
+ function F(t) {
96
143
  return {
97
144
  name: "Product Name",
98
- image_url: h,
145
+ image_url: y,
99
146
  price: { USD: 18 },
100
147
  original_price: { USD: 20 },
101
148
  discount: { USD: 2 },
@@ -107,19 +154,19 @@ function B(t) {
107
154
  category: []
108
155
  };
109
156
  }
110
- function J(t = 6) {
157
+ function ct(t = 6) {
111
158
  return Array.from(
112
159
  { length: t },
113
- (n, e) => B(String(e + 1))
160
+ (e, n) => F(String(n + 1))
114
161
  );
115
162
  }
116
- function Q(t = "grid", n) {
117
- const e = t === "list" ? `
118
- data-layout="list"` : "", o = n ? ` ${n}` : "";
163
+ function lt(t = "grid", e) {
164
+ const n = t === "list" ? `
165
+ data-layout="list"` : "", o = e ? ` ${e}` : "";
119
166
  return `
120
167
  <td
121
168
  align="left"
122
- class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${e}>
169
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${n}>
123
170
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
124
171
  <tr>
125
172
  <td align="center">
@@ -151,7 +198,7 @@ function Q(t = "grid", n) {
151
198
  </table>
152
199
  </td>
153
200
  </tr>
154
- ${L}
201
+ ${v}
155
202
  <tr>
156
203
  <td>
157
204
  <table
@@ -190,31 +237,37 @@ function Q(t = "grid", n) {
190
237
  `;
191
238
  }
192
239
  export {
193
- P as CUSTOM_CELL_HTML,
194
- x as DEFAULTS,
195
- K as DEFAULT_BUTTON_ANCHOR_STYLE,
196
- V as DEFAULT_BUTTON_BORDER_STYLE,
197
- v as DEFAULT_CARD_COMPOSITION,
198
- F as DEFAULT_CARD_VISIBILITY,
199
- j as DEFAULT_IMG_STYLE,
200
- I as DEFAULT_ROW_SPACING_PX,
201
- h as PLACEHOLDER_IMAGE,
202
- k as buildElementRenderer,
203
- $ as buildSpacer,
204
- Y as cellBgStyleAttr,
205
- Q as createBlockTemplate,
206
- J as getDefaultProducts,
207
- C as isDefaultAttribute,
208
- z as renderButtonLabel,
209
- W as renderStyledParagraph,
210
- X as resolveButtonBorderClass,
211
- G as resolveOmnibusText,
240
+ x as CUSTOM_CELL_HTML,
241
+ X as DEFAULTS,
242
+ st as DEFAULT_BUTTON_ANCHOR_STYLE,
243
+ rt as DEFAULT_BUTTON_BORDER_STYLE,
244
+ K as DEFAULT_CARD_COMPOSITION,
245
+ q as DEFAULT_CARD_VISIBILITY,
246
+ ot as DEFAULT_IMG_STYLE,
247
+ B as DEFAULT_ROW_SPACING_PX,
248
+ y as PLACEHOLDER_IMAGE,
249
+ N as bgColorFragment,
250
+ V as buildCellOptions,
251
+ z as buildElementRenderer,
252
+ k as buildSpacer,
253
+ Z as cellBgStyleAttr,
254
+ lt as createBlockTemplate,
255
+ m as formatProductPrice,
256
+ E as getCurrentCurrencyConfig,
257
+ ct as getDefaultProducts,
258
+ h as isDefaultAttribute,
259
+ Y as isSamePrice,
260
+ et as renderButtonLabel,
261
+ J as renderStyledParagraph,
262
+ nt as resolveButtonBorderClass,
263
+ G as resolveInlinePriceOrder,
264
+ tt as resolveOmnibusText,
212
265
  w as resolvePStyle,
213
- E as resolveProductAttrValue,
214
- H as resolveSegmentBgStyle,
215
- q as sanitizeImageUrl,
216
- L as spacer,
217
- M as toCustomCompositionKey,
218
- U as toDisplayName,
219
- S as toDisplayableAttributeValue
266
+ L as resolveProductAttrValue,
267
+ Q as resolveSegmentBgStyle,
268
+ it as sanitizeImageUrl,
269
+ v as spacer,
270
+ j as toCustomCompositionKey,
271
+ I as toDisplayName,
272
+ $ as toDisplayableAttributeValue
220
273
  };
@@ -139,6 +139,10 @@ export declare const LegacyRecommendationConfigSchema: v.LooseObjectSchema<{
139
139
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
140
140
  /** Vertical responsiveness flag (legacy size=1 variants) */
141
141
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
142
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
143
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
144
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
145
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
142
146
  }, undefined>;
143
147
  /**
144
148
  * Migration-only inputs scoped to this template.
@@ -195,6 +199,10 @@ export declare const TemplateMigrationSchema: v.ObjectSchema<{
195
199
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
196
200
  /** Vertical responsiveness flag (legacy size=1 variants) */
197
201
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
202
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
203
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
204
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
205
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
198
206
  }, undefined>, undefined>, {}>;
199
207
  }, undefined>;
200
208
  /**
@@ -274,6 +282,10 @@ export declare const TemplateSchema: v.ObjectSchema<{
274
282
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
275
283
  /** Vertical responsiveness flag (legacy size=1 variants) */
276
284
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
285
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
286
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
287
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
288
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
277
289
  }, undefined>, undefined>, {}>;
278
290
  }, undefined>, {}>;
279
291
  }, undefined>;
@@ -665,6 +677,10 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
665
677
  readonly size: v.OptionalSchema<v.UnionSchema<[v.StringSchema<undefined>, v.NumberSchema<undefined>], undefined>, undefined>;
666
678
  /** Vertical responsiveness flag (legacy size=1 variants) */
667
679
  readonly verticalResponsiveness: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
680
+ /** Legacy "Move to next line" price placement toggle (cardPricePlacement.js) */
681
+ readonly isPriceMovedToNextLine: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
682
+ /** Legacy "Hide if same as discounted" / delete-price-for-zero-sale toggle */
683
+ readonly isPriceDeletedForZeroSale: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
668
684
  }, undefined>, undefined>, {}>;
669
685
  }, undefined>, {}>;
670
686
  }, undefined>, {}>;
@@ -60,6 +60,8 @@ export declare const useConfig: () => {
60
60
  blockType?: string | undefined;
61
61
  size?: string | number | undefined;
62
62
  verticalResponsiveness?: boolean | undefined;
63
+ isPriceMovedToNextLine?: boolean | undefined;
64
+ isPriceDeletedForZeroSale?: boolean | undefined;
63
65
  } & {
64
66
  [key: string]: unknown;
65
67
  };
@@ -186,6 +188,8 @@ export declare const useConfig: () => {
186
188
  blockType?: string | undefined;
187
189
  size?: string | number | undefined;
188
190
  verticalResponsiveness?: boolean | undefined;
191
+ isPriceMovedToNextLine?: boolean | undefined;
192
+ isPriceDeletedForZeroSale?: boolean | undefined;
189
193
  } & {
190
194
  [key: string]: unknown;
191
195
  };
@@ -1,4 +1,31 @@
1
1
  import type { DynamicContent } from '@@/Types/generic';
2
+ import type { FiltersResponse } from '@@/Types/recommendation';
3
+ /**
4
+ * Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
5
+ * braces/whitespace) into its recommendation id and attribute name. Returns
6
+ * null for anything that isn't a well-formed recommendation variable.
7
+ */
8
+ export declare function parseRecommendationVariable(field: string): {
9
+ recoId: string;
10
+ attribute: string;
11
+ } | null;
12
+ /**
13
+ * Builds the set of attribute forms valid inside partner-authored
14
+ * `{{recoId_index_attribute}}` variables: the built-in compiler attributes plus
15
+ * each account attribute in its canonical token form — bare for
16
+ * `defaultAttribute`, `product_attribute.<name>` for `productAttribute`. Using
17
+ * `resolveProductAttrValue` (the same producer the block builder uses) keeps the
18
+ * validator's notion of "valid form" identical to what is actually emitted.
19
+ */
20
+ export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse): Set<string>;
21
+ /**
22
+ * Returns the `{{...}}` custom fields in the HTML that are invalid. Partner
23
+ * attributes in `ins-skip-compile` blocks (recoId ∈ ignoredIds) are checked
24
+ * against `ignoredAttributeNames`; Guido-generated reco variables and known merge
25
+ * tags pass. An unrecognized dotted token is ignored: it was never captured
26
+ * before, so flagging it would false-positive on merge tags like `{{user.name}}`.
27
+ */
28
+ export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
2
29
  export declare const useHtmlValidator: () => {
3
30
  validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
4
31
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Substitutes recommendation product variables in compiled preview HTML with the
3
+ * blocks' fetched sample products, then simulates the email-service hide rule by
4
+ * emptying the original-price cell (DOM kept) for slots with no real discount.
5
+ * Returns the input unchanged when there are no reco blocks or no products.
6
+ */
7
+ export declare function substituteRecommendationPreview(html: string): string;
8
+ export declare const useRecommendationPreview: () => {
9
+ substituteRecommendationPreview: typeof substituteRecommendationPreview;
10
+ };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Returns true when a recommendation block has opted out of Guido's
3
+ * product-data → template-variable substitution. Partners signal opt-out by
4
+ * adding the `ins-skip-compile` class on the `.recommendation-block-v2`
5
+ * element. Only the variable substitution is skipped — campaign URL building,
6
+ * hidden-row removal, Outlook image widths, discount conditions, text-trim CSS
7
+ * and general HTML optimizations still apply. See `CSS_CLASS_SKIP_COMPILE` for
8
+ * the full scope.
9
+ */
10
+ export declare function isIgnoredRecommendationBlock(block: Element): boolean;
11
+ /**
12
+ * DOM-parses the HTML once and returns the set of `recommendation-id`
13
+ * values that belong to ignored blocks. Use this in regex/string-based
14
+ * compiler rules where the rule processes flat matches and only has the
15
+ * extracted block ID rather than a DOM Element reference.
16
+ */
17
+ export declare function getIgnoredRecommendationBlockIds(html: string): Set<string>;
@@ -5,3 +5,18 @@ export declare function extractTitleText(block: Element): string;
5
5
  * the caller treats that as "no segment background".
6
6
  */
7
7
  export declare function extractCardBgColor(block: Element): string;
8
+ /**
9
+ * Reads the legacy block's own `currency-*` attributes into a
10
+ * `currencySettings`-shaped object that `mapCurrency` understands. Used as a
11
+ * fallback when the external recommendationConfigs map has no entry for this
12
+ * block, so the migrated block keeps its real currency instead of defaulting.
13
+ * Returns undefined when the block carries no `currency` attribute.
14
+ */
15
+ export declare function extractCurrencyFromBlock(block: Element): Record<string, string> | undefined;
16
+ /**
17
+ * True when a PM has manually opted the legacy block out of content
18
+ * regeneration by adding the `ins-skip-compile` class. Detected before rebuild
19
+ * so the migrator preserves the partner's markup verbatim (keeping their
20
+ * hand-authored variables) instead of regenerating the block.
21
+ */
22
+ export declare function isPartnerManagedBlock(block: Element): boolean;
@@ -8,4 +8,12 @@ export declare function buildBlockHtml(params: {
8
8
  extraClasses?: string;
9
9
  legacyId?: string;
10
10
  legacyBgColor?: string;
11
+ /**
12
+ * When set, the block's existing inner HTML is preserved verbatim instead
13
+ * of regenerating product rows — used for partner-customized blocks so
14
+ * their hand-authored `{{...}}` variables survive migration.
15
+ */
16
+ preserveInnerHtml?: string;
17
+ /** Adds the `ins-skip-compile` opt-out class to the migrated block. */
18
+ skipCompile?: boolean;
11
19
  }): string;
@@ -3,5 +3,5 @@ import type { CurrencyConfig, RecommendationNodeConfig } from '@@/Extensions/Blo
3
3
  import type { LegacyRecommendationConfig } from '@@/Types/config';
4
4
  /** Defensive against missing/malformed legacy `currencySettings` — defaults are per-field, not whole-object. */
5
5
  export declare function mapCurrency(legacy: unknown): CurrencyConfig;
6
- export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'configVersion'>;
6
+ export type SettingsPartial = Pick<RecommendationNodeConfig, 'recommendationId' | 'strategy' | 'productIds' | 'size' | 'shuffleProducts' | 'language' | 'currency' | 'filters' | 'layout' | 'cardsInRow' | 'mobileCardsInRow' | 'mobileLayoutEnabled' | 'previousMobileCardsInRow' | 'columnSpacing' | 'rowSpacing' | 'mobileColumnSpacing' | 'mobileRowSpacing' | 'omnibusPrice' | 'omnibusDiscount' | 'priceMovedToNextLine' | 'priceHideIfSameAsDiscounted' | 'configVersion'>;
7
7
  export declare function mapSettings(recCfg: LegacyRecommendationConfig, parsed: LegacyProductConfig, id: number): SettingsPartial;
@@ -24,13 +24,5 @@ export declare class ItemsBlock extends Block {
24
24
  getSettingsPanelTitleHtml(): string;
25
25
  getTemplate(): string;
26
26
  allowInnerBlocksDND(): boolean;
27
- canBeSavedAsModule(): boolean;
28
27
  onCreated(node: ImmutableHtmlNode): void;
29
- /**
30
- * Re-seeds nodeConfig from the persisted esd-ext-config when a saved module
31
- * surfaces via document load. Stripo strips esd-ext-config and never restores it
32
- * into nodeConfig, so without this a reused module would reset to defaults.
33
- * Guarded to the nodeConfig-empty case so it runs once and never loops.
34
- */
35
- onDocumentChanged(node: ImmutableHtmlNode): void;
36
28
  }
@@ -55,7 +55,7 @@ export declare function getItemsBlockContainer(currentNode: ImmutableHtmlNode |
55
55
  /**
56
56
  * Gets the node configuration from the Items block.
57
57
  * Uses Stripo V2's getNodeConfig() API.
58
- * Falls back to the persisted esd-ext-config (saved modules), then legacy config block.
58
+ * Falls back to migrating from legacy config block if nodeConfig is empty.
59
59
  * @param currentNode - The current node from the control
60
60
  * @returns The ItemsBlockConfig object or null if not found
61
61
  */
@@ -117,6 +117,16 @@ export declare class RecommendationBlock extends Block {
117
117
  * added classes via setAttribute.
118
118
  */
119
119
  private _assignRecommendationId;
120
+ /**
121
+ * Stamps the `hide-price` attribute (read by email-service at send time) on
122
+ * the block element from the config flag.
123
+ */
124
+ private _stampHidePrice;
125
+ /**
126
+ * Stamps `hide-price` from config only when the block lacks the attribute —
127
+ * heals templates saved before this feature without dirtying current ones.
128
+ */
129
+ private _healHidePriceAttr;
120
130
  /**
121
131
  * Gets the recommendation-id from a block node
122
132
  */
@@ -8,6 +8,6 @@
8
8
  */
9
9
  export { RecommendationBlockId } from './blockIds';
10
10
  export { RecommendationControlId } from './controlIds';
11
- export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
11
+ export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_CUSTOM_PREFIX, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
12
12
  export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
13
13
  export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
@@ -23,6 +23,18 @@ export declare const MOBILE_ROW_SELECTOR = ".ins-recommendation-mobile-row";
23
23
  * `{{cId_pIdx_url}}` template variable.
24
24
  */
25
25
  export declare const CSS_CLASS_RECO_BUTTON = "reco-v3-button";
26
+ /**
27
+ * Opt-out class for partners who want to inject their own template variables
28
+ * into a recommendation block. When present on `.recommendation-block-v2`,
29
+ * Guido skips ONLY its product-data → template-variable substitution
30
+ * (`replaceProductAttributes`) for that block — partners author their own
31
+ * `{{recoId_index_attribute}}` variables. Everything else (campaign URL
32
+ * building, hidden-row removal, Outlook image widths, text-trim CSS, discount
33
+ * conditions, store hydration, store-level config validation, and general HTML
34
+ * optimizations) still applies. The class is preserved in the final compiled
35
+ * output so partners may use it for their own styling.
36
+ */
37
+ export declare const CSS_CLASS_SKIP_COMPILE = "ins-skip-compile";
26
38
  /**
27
39
  * Currency HTML attributes set on the block element
28
40
  * These are read by the HTML compiler at runtime to format prices
@@ -63,3 +75,12 @@ export declare const PRODUCT_ATTRIBUTE_PREFIX = "product_attribute.";
63
75
  * Used to exclude these from the custom attribute dropdown to prevent duplication with toggles.
64
76
  */
65
77
  export declare const BUILT_IN_DEFAULT_ATTRIBUTES: Set<string>;
78
+ /**
79
+ * Attribute names valid inside a `{{recoId_index_attributeName}}` template
80
+ * variable regardless of the account's custom attribute list. Every built-in
81
+ * composition attribute is valid, plus `currency` and `discount` which the
82
+ * compiler emits but are not composition toggles. Custom attributes are
83
+ * validated separately against the account's fetched attribute list
84
+ * (`stripo/email-recommendation-attributes`).
85
+ */
86
+ export declare const RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES: Set<string>;