@useinsider/guido 3.16.0 → 3.17.0-beta.58179dc

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 (46) hide show
  1. package/dist/composables/useRecommendation.js +20 -19
  2. package/dist/composables/useStripo.js +30 -29
  3. package/dist/config/migrator/index.js +9 -8
  4. package/dist/config/migrator/itemsBlockMigrator.js +1 -1
  5. package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
  6. package/dist/config/migrator/recommendation/extractors.js +29 -24
  7. package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
  8. package/dist/config/migrator/recommendationMigrator.js +18 -15
  9. package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
  10. package/dist/enums/recommendation.js +17 -17
  11. package/dist/extensions/Blocks/Items/enums/productEnums.js +45 -45
  12. package/dist/extensions/Blocks/Recommendation/block.js +49 -20
  13. package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
  14. package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
  15. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +23 -22
  16. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +34 -28
  17. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +306 -238
  18. package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +37 -26
  19. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +29 -28
  20. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
  21. package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
  22. package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
  23. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
  24. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +13 -12
  25. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
  26. package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
  27. package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
  28. package/dist/extensions/Blocks/Recommendation/utils/legacyTitle.js +20 -0
  29. package/dist/extensions/Blocks/Recommendation/utils/productIds.js +6 -0
  30. package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
  31. package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
  32. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +15 -0
  33. package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
  34. package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
  35. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  36. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  37. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
  38. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +10 -0
  39. package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
  41. package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
  42. package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
  43. package/dist/src/extensions/Blocks/Recommendation/utils/legacyTitle.d.ts +20 -0
  44. package/dist/src/extensions/Blocks/Recommendation/utils/productIds.d.ts +6 -0
  45. package/dist/static/styles/customEditorStyle.css.js +3 -1
  46. package/package.json +1 -1
@@ -1,8 +1,9 @@
1
- import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as C, ATTR_PRODUCT_OMNIBUS_PRICE as _, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as y, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
1
+ import { ATTR_PRODUCT_PRICE as l, ATTR_PRODUCT_OLD_PRICE as a, ATTR_CUSTOM_PREFIX as T, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as _, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as p, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
2
2
  import { useRecommendationExtensionStore as L } from "../store/recommendation.js";
3
- import { compositionKeyToProductAttr as A, isDefaultProductAttr as b, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as h } from "../utils/compositionKeys.js";
3
+ import { compositionKeyToProductAttr as y, isDefaultProductAttr as f, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as P } from "../utils/compositionKeys.js";
4
4
  import { formatPrice as B } from "../utils/priceFormatter.js";
5
- function k() {
5
+ import { buildTitleRows as k } from "./titleRows.js";
6
+ function x() {
6
7
  const t = L(), { currencySettings: e } = t.recommendationConfigs;
7
8
  return {
8
9
  code: e.value,
@@ -13,17 +14,17 @@ function k() {
13
14
  thousandSeparator: e.thousandSeparator
14
15
  };
15
16
  }
16
- function f(t, e = "price") {
17
- const o = k(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
17
+ function m(t, e = "price") {
18
+ const o = x(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
18
19
  return B({
19
20
  price: c,
20
21
  currency: o
21
22
  });
22
23
  }
23
24
  function q(t) {
24
- return f(t, "price") === f(t, "original_price");
25
+ return m(t, "price") === m(t, "original_price");
25
26
  }
26
- function x(t) {
27
+ function N(t) {
27
28
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
28
29
  }
29
30
  function J(t) {
@@ -34,115 +35,114 @@ function J(t) {
34
35
  skip: n ? l : a
35
36
  };
36
37
  }
37
- function N(t) {
38
+ function F(t) {
38
39
  const e = Array.isArray(t) ? t[t.length - 1] : t;
39
40
  if (typeof e == "string")
40
41
  return e;
41
42
  if (typeof e == "number")
42
43
  return String(e);
43
44
  }
44
- function w(t, e) {
45
+ function v(t, e) {
45
46
  var o;
46
47
  return ((o = $(t, e)) == null ? void 0 : o.type) === "defaultAttribute";
47
48
  }
48
- function F(t, e) {
49
- return w(t, e) ? t : `${I}${t}`;
49
+ function w(t, e) {
50
+ return v(t, e) ? t : `${I}${t}`;
50
51
  }
51
52
  function Q(t) {
52
- return h(t);
53
+ return P(t);
53
54
  }
54
- const v = Symbol("customCellHtml");
55
+ const M = Symbol("customCellHtml");
55
56
  function Z(t, e, o = {}) {
56
- const n = t[v];
57
+ const n = t[M];
57
58
  if (!n)
58
59
  return { ...t };
59
60
  const c = { ...t };
60
- return e.filter((s) => s.startsWith(T) && !c[s]).forEach((s) => {
61
- const i = A(s), r = b(i) ? F(i, o) : i, u = S(r), R = x(u), D = b(r);
62
- c[s] = (d, U) => {
61
+ return e.filter((i) => i.startsWith(T) && !c[i]).forEach((i) => {
62
+ const s = y(i), r = f(s) ? w(s, o) : s, u = S(r), h = N(u), D = f(r);
63
+ c[i] = (d, U) => {
63
64
  var g;
64
- const E = D ? d[u] : (g = d.product_attributes) == null ? void 0 : g[u], O = N(E) ?? R;
65
- return n(r, O, U);
65
+ const O = D ? d[u] : (g = d.product_attributes) == null ? void 0 : g[u], E = F(O) ?? h;
66
+ return n(r, E, U);
66
67
  };
67
68
  }), c;
68
69
  }
69
70
  function tt(t, e, o = []) {
70
- const n = t.startsWith(T) ? h(S(A(t))) : t, s = n !== t && !o.includes(n) ? n : t, i = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[s]);
71
+ const n = t.startsWith(T) ? P(S(y(t))) : t, i = n !== t && !o.includes(n) ? n : t, s = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[i]);
71
72
  return {
72
73
  cellPadding: e.cellPadding,
73
74
  cardBackgroundColor: e.cardBackgroundColor,
74
- cellBackgroundColor: i(e.cellBackgroundColors),
75
- cellAlignment: i(e.cellAlignments),
76
- cellClasses: i(e.cellClasses),
77
- omnibusText: i(e.omnibusTexts),
78
- styleTemplate: i(e.styleTemplates)
75
+ cellBackgroundColor: s(e.cellBackgroundColors),
76
+ cellAlignment: s(e.cellAlignments),
77
+ cellClasses: s(e.cellClasses),
78
+ omnibusText: s(e.omnibusTexts),
79
+ styleTemplate: s(e.styleTemplates)
79
80
  };
80
81
  }
81
82
  const et = {
82
83
  TITLE: "You May Also Like!"
83
84
  }, ot = [
84
- m,
85
- C,
85
+ b,
86
+ _,
86
87
  a,
87
88
  l,
88
- _,
89
- p,
90
- y
89
+ C,
90
+ A,
91
+ p
91
92
  ], nt = {
92
- [m]: !0,
93
- [C]: !0,
93
+ [b]: !0,
94
+ [_]: !0,
94
95
  [l]: !0,
95
96
  [a]: !0,
96
- [_]: !1,
97
- [p]: !1,
98
- [y]: !0
99
- }, M = 10;
100
- function W(t = M) {
97
+ [C]: !1,
98
+ [A]: !1,
99
+ [p]: !0
100
+ }, W = 10;
101
+ function rt(t = W) {
101
102
  return `
102
103
  <tr>
103
104
  <td class="spacer" style="height: ${t}px;"></td>
104
105
  </tr>
105
106
  `;
106
107
  }
107
- const H = W();
108
- function V(t, e) {
108
+ function H(t, e) {
109
109
  return e ? e.pStyle ?? "" : t;
110
110
  }
111
- function rt(t, e, o) {
112
- const n = V(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, s = o ? o.closeTags ?? "" : e.closeTags;
113
- return `<p contenteditable="false" style="${n}">${c}${t}${s}</p>`;
111
+ function it(t, e, o) {
112
+ const n = H(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, i = o ? o.closeTags ?? "" : e.closeTags;
113
+ return `<p contenteditable="false" style="${n}">${c}${t}${i}</p>`;
114
114
  }
115
115
  function st(t, e) {
116
116
  const o = [];
117
117
  return t && o.push(t), e && o.push(`background-color: ${e};`), o.join(" ");
118
118
  }
119
- function Y(t) {
119
+ function V(t) {
120
120
  return t ? ` background-color: ${t};` : "";
121
121
  }
122
- function it(t) {
123
- const e = Y(t);
122
+ function ct(t) {
123
+ const e = V(t);
124
124
  return e ? ` style="${e.trim()}"` : "";
125
125
  }
126
- function ct(t, e = "") {
126
+ function lt(t, e = "") {
127
127
  return {
128
128
  before: (t == null ? void 0 : t.before) ?? e,
129
129
  after: (t == null ? void 0 : t.after) ?? ""
130
130
  };
131
131
  }
132
- function lt(t, e) {
132
+ function at(t, e) {
133
133
  return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
134
134
  }
135
- function at(t) {
135
+ function ut(t) {
136
136
  return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
137
137
  }
138
- const ut = "display: block; max-width: 100%; height: auto;", dt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", gt = "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;", P = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
139
- function bt(t) {
140
- return !t || typeof t != "string" || t.trim() === "" ? P : t.startsWith("http://") ? t.replace("http://", "https://") : t;
138
+ const dt = "display: block; max-width: 100%; height: auto;", gt = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", ft = "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;", R = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
139
+ function mt(t) {
140
+ return !t || typeof t != "string" || t.trim() === "" ? R : t.startsWith("http://") ? t.replace("http://", "https://") : t;
141
141
  }
142
- function G(t) {
142
+ function Y(t) {
143
143
  return {
144
144
  name: "Product Name",
145
- image_url: P,
145
+ image_url: R,
146
146
  price: { USD: 18 },
147
147
  original_price: { USD: 20 },
148
148
  discount: { USD: 2 },
@@ -154,19 +154,20 @@ function G(t) {
154
154
  category: []
155
155
  };
156
156
  }
157
- function ft(t = 6) {
157
+ function Tt(t = 6) {
158
158
  return Array.from(
159
159
  { length: t },
160
- (e, o) => G(String(o + 1))
160
+ (e, o) => Y(String(o + 1))
161
161
  );
162
162
  }
163
- function Tt(t = "grid", e) {
163
+ function bt(t = "grid", e) {
164
164
  const o = t === "list" ? `
165
- data-layout="list"` : "", n = e ? ` ${e}` : "";
165
+ data-layout="list"` : "", n = e ? ` ${e}` : "", i = `recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`, s = t === "list" ? "" : `
166
+ {-{-MOBILE_PRODUCT_ROWS-}-}`, r = t === "list" ? ' style="display: none;"' : "";
166
167
  return `
167
168
  <td
168
169
  align="left"
169
- class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`}"${o}>
170
+ class="${i}"${o}>
170
171
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
171
172
  <tr>
172
173
  <td align="center">
@@ -177,28 +178,7 @@ function Tt(t = "grid", e) {
177
178
  cellspacing="0"
178
179
  border="0">
179
180
  <tbody>
180
- <tr>
181
- <td>
182
- <table
183
- width="100%"
184
- cellpadding="0"
185
- cellspacing="0"
186
- border="0">
187
- <tbody>
188
- <tr>
189
- <td
190
- class="esd-block-text es-p10t es-p10b es-p20l es-p20r"
191
- align="center">
192
- <p style="font-size: 28px; color: #333333;">
193
- <strong>{-{-TITLE-}-}</strong>
194
- </p>
195
- </td>
196
- </tr>
197
- </tbody>
198
- </table>
199
- </td>
200
- </tr>
201
- ${H}
181
+ ${k()}
202
182
  <tr>
203
183
  <td>
204
184
  <table
@@ -213,7 +193,7 @@ function Tt(t = "grid", e) {
213
193
  </table>
214
194
  </td>
215
195
  </tr>
216
- <tr class="ins-recommendation-mobile-row"${t === "list" ? ' style="display: none;"' : ""}>
196
+ <tr class="ins-recommendation-mobile-row"${r}>
217
197
  <td>
218
198
  <table
219
199
  class="ins-recommendation-product-container
@@ -223,8 +203,7 @@ function Tt(t = "grid", e) {
223
203
  cellspacing="0"
224
204
  border="0"
225
205
  style="display: none;"
226
- >${t === "list" ? "" : `
227
- {-{-MOBILE_PRODUCT_ROWS-}-}`}
206
+ >${s}
228
207
  </table>
229
208
  </td>
230
209
  </tr>
@@ -237,37 +216,36 @@ function Tt(t = "grid", e) {
237
216
  `;
238
217
  }
239
218
  export {
240
- v as CUSTOM_CELL_HTML,
219
+ M as CUSTOM_CELL_HTML,
241
220
  et as DEFAULTS,
242
- gt as DEFAULT_BUTTON_ANCHOR_STYLE,
243
- dt as DEFAULT_BUTTON_BORDER_STYLE,
221
+ ft as DEFAULT_BUTTON_ANCHOR_STYLE,
222
+ gt as DEFAULT_BUTTON_BORDER_STYLE,
244
223
  ot as DEFAULT_CARD_COMPOSITION,
245
224
  nt as DEFAULT_CARD_VISIBILITY,
246
- ut as DEFAULT_IMG_STYLE,
247
- M as DEFAULT_ROW_SPACING_PX,
248
- P as PLACEHOLDER_IMAGE,
249
- Y as bgColorFragment,
225
+ dt as DEFAULT_IMG_STYLE,
226
+ W as DEFAULT_ROW_SPACING_PX,
227
+ R as PLACEHOLDER_IMAGE,
228
+ V as bgColorFragment,
250
229
  tt as buildCellOptions,
251
230
  Z as buildElementRenderer,
252
- W as buildSpacer,
253
- it as cellBgStyleAttr,
254
- Tt as createBlockTemplate,
255
- f as formatProductPrice,
256
- k as getCurrentCurrencyConfig,
257
- ft as getDefaultProducts,
258
- w as isDefaultAttribute,
231
+ rt as buildSpacer,
232
+ ct as cellBgStyleAttr,
233
+ bt as createBlockTemplate,
234
+ m as formatProductPrice,
235
+ x as getCurrentCurrencyConfig,
236
+ Tt as getDefaultProducts,
237
+ v as isDefaultAttribute,
259
238
  q as isSamePrice,
260
- lt as renderButtonLabel,
261
- rt as renderStyledParagraph,
262
- at as resolveButtonBorderClass,
239
+ at as renderButtonLabel,
240
+ it as renderStyledParagraph,
241
+ ut as resolveButtonBorderClass,
263
242
  J as resolveInlinePriceOrder,
264
- ct as resolveOmnibusText,
265
- V as resolvePStyle,
266
- F as resolveProductAttrValue,
243
+ lt as resolveOmnibusText,
244
+ H as resolvePStyle,
245
+ w as resolveProductAttrValue,
267
246
  st as resolveSegmentBgStyle,
268
- bt as sanitizeImageUrl,
269
- H as spacer,
247
+ mt as sanitizeImageUrl,
270
248
  Q as toCustomCompositionKey,
271
- x as toDisplayName,
272
- N as toDisplayableAttributeValue
249
+ N as toDisplayName,
250
+ F as toDisplayableAttributeValue
273
251
  };
@@ -0,0 +1,20 @@
1
+ import { CONTAINER_SELECTOR as s, CSS_CLASS_SPACER as c } from "../constants/selectors.js";
2
+ import { getMainContainerTbody as a } from "../controls/main/utils.js";
3
+ const l = "td.esd-block-text";
4
+ function C(n) {
5
+ return "getInnerText" in n && n.getInnerText().trim().length > 0;
6
+ }
7
+ function T(n) {
8
+ return "children" in n && n.children().some((e) => "hasClass" in e && e.hasClass(c));
9
+ }
10
+ function h(n) {
11
+ const e = a(n), i = e && "children" in e ? e.children() : [], [t, o] = i, r = t == null ? void 0 : t.querySelector(l);
12
+ if (!(!r || r.closest(s) || !C(r)))
13
+ return {
14
+ cell: r,
15
+ rows: o && T(o) ? [t, o] : [t]
16
+ };
17
+ }
18
+ export {
19
+ h as findLegacyTitle
20
+ };
@@ -0,0 +1,6 @@
1
+ function n(t) {
2
+ return t.map((i) => String(i ?? "").trim()).filter(Boolean).join(",");
3
+ }
4
+ export {
5
+ n as sanitizeProductIds
6
+ };
@@ -1,4 +1,12 @@
1
1
  export declare function extractTitleText(block: Element): string;
2
+ /**
3
+ * Fallback for legacy configs that carry no `p_recommendation_title` variable:
4
+ * the rendered HTML decides. A missing or `display: none` title container means
5
+ * the user never saw a title, so the migrated block keeps it toggled off.
6
+ * @param block - The legacy recommendation block element
7
+ * @returns True when the legacy block renders a visible title
8
+ */
9
+ export declare function hasVisibleTitle(block: Element): boolean;
2
10
  /**
3
11
  * Card background lives on either the block (`bgcolor`/`style`) or per-card
4
12
  * cells (`.product-card`). Returns empty string when no background is set —
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Only reaches a template Stripo has no stored copy of — an already-saved campaign
3
+ * opens from Stripo storage and is tagged by `RecommendationBlock._healLegacyTitle`.
4
+ */
5
+ export declare function migrateRecommendationTitle(html: string): string;
@@ -48,6 +48,21 @@ export declare class RecommendationBlock extends Block {
48
48
  * @param node - The block node that may need migration
49
49
  */
50
50
  onDocumentChanged(node: ImmutableHtmlNode): void;
51
+ /**
52
+ * Adopts the plain text cell a pre-SD-147795 block used as its title.
53
+ *
54
+ * `recommendationTitleMigrator` tags that cell before the document is handed
55
+ * to Stripo, but Stripo serves a template it already holds in its own storage
56
+ * (`forceRecreate: false`) and drops the HTML we pass, so for an already-saved
57
+ * campaign the tagging only ever lands here. Without it the title is an
58
+ * ordinary text block: Card Composition reads the toggle as off while the
59
+ * title is on screen, switching it on prepends a second title, and the cell
60
+ * keeps the generic delete/duplicate node actions the CSS hides by class.
61
+ *
62
+ * Partner-managed blocks are left alone, the same exclusion the migrator makes.
63
+ * @param node - The block node that may still carry an untagged title
64
+ */
65
+ private _healLegacyTitle;
51
66
  /**
52
67
  * Called when a block is deleted from the template
53
68
  *
@@ -10,5 +10,6 @@ export declare enum RecommendationBlockId {
10
10
  OMNIBUS_PRICE = "recommendation-block-omnibus-price",
11
11
  OMNIBUS_DISCOUNT = "recommendation-block-omnibus-discount",
12
12
  IMAGE = "recommendation-block-image",
13
- CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute"
13
+ CUSTOM_ATTRIBUTE = "recommendation-block-custom-attribute",
14
+ TITLE = "recommendation-block-title"
14
15
  }
@@ -65,5 +65,12 @@ export declare enum RecommendationControlId {
65
65
  CUSTOM_ATTR_SIZE = "recommendation-block-custom-attr-size-control",
66
66
  CUSTOM_ATTR_STYLE = "recommendation-block-custom-attr-style-control",
67
67
  CUSTOM_ATTR_TEXT_TRIM = "recommendation-block-custom-attr-text-trim-control",
68
+ TITLE_ALIGN = "recommendation-block-title-align-control",
69
+ TITLE_BACKGROUND = "recommendation-block-title-background-control",
70
+ TITLE_COLOR = "recommendation-block-title-color-control",
71
+ TITLE_FONT_FAMILY = "recommendation-block-title-font-family-control",
72
+ TITLE_PADDINGS = "recommendation-block-title-paddings-control",
73
+ TITLE_SIZE = "recommendation-block-title-size-control",
74
+ TITLE_STYLE = "recommendation-block-title-style-control",
68
75
  SYNC_INFO_MESSAGE = "recommendation-block-sync-info-message"
69
76
  }
@@ -32,6 +32,7 @@ export declare const DEFAULT_COMPOSITION: string[];
32
32
  /**
33
33
  * Default visibility settings for card elements
34
34
  * Omnibus elements are hidden by default (not all regions require them)
35
+ * The block-level title is visible on a fresh drop.
35
36
  */
36
37
  export declare const DEFAULT_VISIBILITY: Record<string, boolean>;
37
38
  /**
@@ -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, 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_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, 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_RECOMMENDATION_TITLE, SELECTOR_TITLE_CELL, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, CSS_CLASS_ATTRIBUTE_ROW, CSS_CLASS_SPACER, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, ATTR_DATA_VISIBILITY, 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';
@@ -58,6 +58,10 @@ export declare const ATTR_PRODUCT_OLD_PRICE = "productOldPrice";
58
58
  export declare const ATTR_PRODUCT_OMNIBUS_PRICE = "productOmnibusPrice";
59
59
  export declare const ATTR_PRODUCT_OMNIBUS_DISCOUNT = "productOmnibusDiscount";
60
60
  export declare const ATTR_PRODUCT_BUTTON = "productButton";
61
+ export declare const ATTR_RECOMMENDATION_TITLE = "recommendationTitle";
62
+ export declare const CSS_CLASS_TITLE_CELL = "ins-recommendation-title";
63
+ /** Title cell — the only `esd-block-text` living outside the product containers. */
64
+ export declare const SELECTOR_TITLE_CELL = ".ins-recommendation-title";
61
65
  /**
62
66
  * Custom attribute constants
63
67
  * Used for dynamically added product attributes in Card Composition
@@ -70,10 +74,16 @@ export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
70
74
  export declare const ATTR_DATA_CARD_COMPOSITION = "data-card-composition";
71
75
  /** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
72
76
  export declare const ATTR_PRODUCT_ATTR = "product-attr";
77
+ /** Class every composition attribute row carries — the visibility toggle and the compiler both key on it */
78
+ export declare const CSS_CLASS_ATTRIBUTE_ROW = "recommendation-attribute-row";
73
79
  /** Row wrapper of one composition entry inside a product card */
74
80
  export declare const SELECTOR_ATTRIBUTE_ROW = ".recommendation-attribute-row";
75
81
  /** HTML attribute on an attribute row holding its composition key */
76
82
  export declare const ATTR_DATA_ATTRIBUTE_TYPE = "data-attribute-type";
83
+ /** HTML attribute on an attribute row holding its visibility (`1` / `0`) */
84
+ export declare const ATTR_DATA_VISIBILITY = "data-visibility";
85
+ /** Class on the spacer cell of the row that trails a title */
86
+ export declare const CSS_CLASS_SPACER = "spacer";
77
87
  /** Prefix `resolveProductAttrValue` puts on custom (non-default) product attributes in `product-attr` values */
78
88
  export declare const PRODUCT_ATTRIBUTE_PREFIX = "product_attribute.";
79
89
  /**
@@ -33,6 +33,8 @@ export declare class RecommendationCardCompositionControl extends CommonControl
33
33
  private _normalizeComposition;
34
34
  private _readCustomAttributesFromNode;
35
35
  private _readVisibilityFromRows;
36
+ private _withTitlePresence;
37
+ private _hasTitle;
36
38
  private _getDefaultVisibilities;
37
39
  private _extractVisibilityFromRows;
38
40
  private _parseVisibilityValue;
@@ -187,6 +189,14 @@ export declare class RecommendationCardCompositionControl extends CommonControl
187
189
  */
188
190
  private _buildCompositionHtml;
189
191
  private _applyVisibilityToBlock;
192
+ private _applyTitleVisibilityToBlock;
193
+ private _resolveTitleInjection;
194
+ private _findTitleRows;
195
+ private _findTitleRowsByClass;
196
+ private _isSpacerRow;
197
+ private _findTitleContainerBody;
198
+ private _readInnerHtml;
199
+ private _defaultTitleParagraph;
190
200
  /**
191
201
  * Finds the composition array index for the Nth custom attribute (0-based).
192
202
  * Scans left-to-right, counting only entries with the custom prefix.
@@ -11,6 +11,7 @@
11
11
  */
12
12
  export { RecommendationBlockControl, CONTROL_BLOCK_ID, AlgorithmControl, ALGORITHM_CONTROL_ID, LocaleControl, LOCALE_CONTROL_ID, CurrencyControl, CURRENCY_CONTROL_ID, ProductCountControl, PRODUCT_COUNT_CONTROL_ID, ProductLayoutControl, PRODUCT_LAYOUT_CONTROL_ID, FiltersControl, FILTERS_CONTROL_ID, ShuffleControl, SHUFFLE_CONTROL_ID, LayoutOrientationControl, LAYOUT_ORIENTATION_CONTROL_ID, PricePlacementControl, PRICE_PLACEMENT_CONTROL_ID, } from './main';
13
13
  export * from './main/utils';
14
+ export { TitleControls } from './title';
14
15
  export { NameControls } from './name';
15
16
  export { PriceControls } from './price';
16
17
  export { OldPriceControls } from './oldPrice';
@@ -70,6 +70,7 @@ export interface RegenerateProductRowsOptions {
70
70
  /** Optional: pass composition directly to avoid stale DOM reads after setAttribute */
71
71
  composition?: string[];
72
72
  }
73
+ export declare function getMainContainerTbody(currentNode: ImmutableHtmlNode): ImmutableHtmlNode | null;
73
74
  /**
74
75
  * Regenerates only the mobile product container rows and commits in a single apply().
75
76
  * Standalone entry point for callers that change mobile-only settings
@@ -0,0 +1,86 @@
1
+ export declare const TitleControls: {
2
+ readonly align: {
3
+ new (): {
4
+ getId(): string;
5
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
6
+ getParentControlId(): string;
7
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
8
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
9
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
10
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
11
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
12
+ };
13
+ };
14
+ readonly color: {
15
+ new (): {
16
+ getId(): string;
17
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
18
+ getParentControlId(): string;
19
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
20
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
21
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
22
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
23
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
24
+ };
25
+ };
26
+ readonly size: {
27
+ new (): {
28
+ getId(): string;
29
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
30
+ getParentControlId(): string;
31
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
32
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
33
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
34
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
35
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
36
+ };
37
+ };
38
+ readonly style: {
39
+ new (): {
40
+ getId(): string;
41
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
42
+ getParentControlId(): string;
43
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
44
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
45
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
46
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
47
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
48
+ };
49
+ };
50
+ readonly fontFamily: {
51
+ new (): {
52
+ getId(): string;
53
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
54
+ getParentControlId(): string;
55
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
56
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
57
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
58
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
59
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
60
+ };
61
+ };
62
+ readonly background: {
63
+ new (): {
64
+ getId(): string;
65
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
66
+ getAdditionalModifications(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
67
+ getParentControlId(): string;
68
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
69
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
70
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
71
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
72
+ };
73
+ };
74
+ readonly paddings: {
75
+ new (): {
76
+ getId(): string;
77
+ getTargetNodes(root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode[];
78
+ getParentControlId(): string;
79
+ api: import("@stripoinc/ui-editor-extensions").ControlApi;
80
+ getLabels(): import("@stripoinc/ui-editor-extensions").ControlLabels | undefined;
81
+ getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
82
+ getAdditionalModifications(_root: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
83
+ isVisible(_node: import("@stripoinc/ui-editor-extensions").ImmutableHtmlNode): boolean;
84
+ };
85
+ };
86
+ };
@@ -0,0 +1,13 @@
1
+ export declare const DEFAULT_TITLE_TEXT = "You May Also Like!";
2
+ export declare const DEFAULT_TITLE_PARAGRAPH: string;
3
+ /**
4
+ * Builds the two block-level title rows: the title itself and the spacer below it.
5
+ * Both carry the same `recommendation-attribute-row` tagging a card attribute row has,
6
+ * so the Card Composition toggle hides the pair together and the compiler's
7
+ * `[data-visibility="0"]` sweep drops both — no leading gap when the title is off.
8
+ * @param paragraphHtml - Full `<p>` markup rendered inside the title cell
9
+ * @param visible - Whether the title starts visible
10
+ * @param spacerHeightPx - Height of the spacer row below the title
11
+ * @returns HTML string with the title row followed by its spacer row
12
+ */
13
+ export declare function buildTitleRows(paragraphHtml?: string, visible?: boolean, spacerHeightPx?: number): string;
@@ -0,0 +1,20 @@
1
+ import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
2
+ export interface LegacyTitle {
3
+ /** The untagged title cell. */
4
+ cell: ImmutableHtmlNode;
5
+ /** Its wrapper row, plus the spacer row below it when there is one. */
6
+ rows: ImmutableHtmlNode[];
7
+ }
8
+ /**
9
+ * Finds the untagged title a pre-SD-147795 block still carries: a non-empty
10
+ * `esd-block-text` cell that sits outside the product containers and wraps the
11
+ * container's first row.
12
+ *
13
+ * This is `recommendationTitleMigrator`'s rule applied to the live document.
14
+ * The migrator alone cannot reach a saved campaign: Stripo serves a template it
15
+ * already holds in its own storage (`forceRecreate: false`) and drops the HTML
16
+ * the pre-load migration hands it, so the tagging has to be applied here too.
17
+ * @param block - The `.recommendation-block-v2` node
18
+ * @returns The legacy title, or `undefined` when the block has none
19
+ */
20
+ export declare function findLegacyTitle(block: ImmutableHtmlNode): LegacyTitle | undefined;