@useinsider/guido 3.21.2-beta.4b0fed7 → 3.21.2-beta.5a809f7

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 (24) hide show
  1. package/dist/composables/useSave.js +75 -68
  2. package/dist/composables/validators/useHtmlDocumentCountValidator.js +22 -0
  3. package/dist/config/migrator/recommendation/extractors.js +36 -27
  4. package/dist/config/migrator/recommendation/htmlBuilder.js +99 -105
  5. package/dist/config/migrator/recommendation/settingsMapper.js +13 -15
  6. package/dist/config/migrator/recommendationMigrator.js +62 -59
  7. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +20 -19
  8. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +101 -100
  9. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  10. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  11. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  12. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  13. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +2 -0
  14. package/dist/services/templateLibraryApi.js +36 -31
  15. package/dist/src/composables/validators/useHtmlDocumentCountValidator.d.ts +3 -0
  16. package/dist/src/config/migrator/recommendation/extractors.d.ts +6 -0
  17. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -1
  18. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  19. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  20. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -20
  21. package/dist/src/utils/templatePreparation.d.ts +2 -1
  22. package/dist/utils/pairProductVariables.js +98 -90
  23. package/dist/utils/templatePreparation.js +30 -30
  24. package/package.json +1 -1
@@ -1,9 +1,9 @@
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";
1
+ import { ATTR_CUSTOM_PREFIX as f, ATTR_PRODUCT_IMAGE as m, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as b, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as C, ATTR_PRODUCT_OMNIBUS_DISCOUNT as A, ATTR_PRODUCT_BUTTON as y, PRODUCT_ATTRIBUTE_PREFIX as I } from "../constants/selectors.js";
2
2
  import { useRecommendationExtensionStore as L } from "../store/recommendation.js";
3
- import { compositionKeyToProductAttr as y, isDefaultProductAttr as f, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as P } from "../utils/compositionKeys.js";
3
+ import { compositionKeyToProductAttr as p, isDefaultProductAttr as d, bareAttributeName as S, findFilterByBareName as $, productAttrToCompositionKey as R } from "../utils/compositionKeys.js";
4
4
  import { formatPrice as B } from "../utils/priceFormatter.js";
5
5
  import { buildTitleRows as k } from "./titleRows.js";
6
- function x() {
6
+ function N() {
7
7
  const t = L(), { currencySettings: e } = t.recommendationConfigs;
8
8
  return {
9
9
  code: e.value,
@@ -14,91 +14,83 @@ function x() {
14
14
  thousandSeparator: e.thousandSeparator
15
15
  };
16
16
  }
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;
17
+ function g(t, e = "price") {
18
+ const o = N(), n = t[e], c = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
19
19
  return B({
20
20
  price: c,
21
21
  currency: o
22
22
  });
23
23
  }
24
24
  function q(t) {
25
- return m(t, "price") === m(t, "original_price");
25
+ return g(t, "price") === g(t, "original_price");
26
26
  }
27
- function N(t) {
27
+ function w(t) {
28
28
  return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
29
29
  }
30
- function J(t) {
31
- const e = t.indexOf(l), o = t.indexOf(a), n = o !== -1 && (e === -1 || o < e);
32
- return {
33
- originalFirst: n,
34
- anchor: n ? a : l,
35
- skip: n ? l : a
36
- };
37
- }
38
- function F(t) {
30
+ function x(t) {
39
31
  const e = Array.isArray(t) ? t[t.length - 1] : t;
40
32
  if (typeof e == "string")
41
33
  return e;
42
34
  if (typeof e == "number")
43
35
  return String(e);
44
36
  }
45
- function v(t, e) {
37
+ function F(t, e) {
46
38
  var o;
47
39
  return ((o = $(t, e)) == null ? void 0 : o.type) === "defaultAttribute";
48
40
  }
49
- function w(t, e) {
50
- return v(t, e) ? t : `${I}${t}`;
41
+ function M(t, e) {
42
+ return F(t, e) ? t : `${I}${t}`;
51
43
  }
52
- function Q(t) {
53
- return P(t);
44
+ function J(t) {
45
+ return R(t);
54
46
  }
55
- const M = Symbol("customCellHtml");
56
- function Z(t, e, o = {}) {
57
- const n = t[M];
47
+ const v = Symbol("customCellHtml");
48
+ function Q(t, e, o = {}) {
49
+ const n = t[v];
58
50
  if (!n)
59
51
  return { ...t };
60
52
  const c = { ...t };
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) => {
64
- var g;
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);
53
+ return e.filter((s) => s.startsWith(f) && !c[s]).forEach((s) => {
54
+ const i = p(s), r = d(i) ? M(i, o) : i, l = S(r), h = w(l), D = d(r);
55
+ c[s] = (a, U) => {
56
+ var u;
57
+ const E = D ? a[l] : (u = a.product_attributes) == null ? void 0 : u[l], O = x(E) ?? h;
58
+ return n(r, O, U);
67
59
  };
68
60
  }), c;
69
61
  }
70
- function tt(t, e, o = []) {
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]);
62
+ function Z(t, e, o = []) {
63
+ const n = t.startsWith(f) ? R(S(p(t))) : t, s = n !== t && !o.includes(n) ? n : t, i = (r) => (r == null ? void 0 : r[t]) ?? (r == null ? void 0 : r[s]);
72
64
  return {
73
65
  cellPadding: e.cellPadding,
74
66
  cardBackgroundColor: e.cardBackgroundColor,
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)
67
+ cellBackgroundColor: i(e.cellBackgroundColors),
68
+ cellAlignment: i(e.cellAlignments),
69
+ cellClasses: i(e.cellClasses),
70
+ omnibusText: i(e.omnibusTexts),
71
+ styleTemplate: i(e.styleTemplates)
80
72
  };
81
73
  }
82
- const et = {
74
+ const tt = {
83
75
  TITLE: "You May Also Like!"
84
- }, ot = [
76
+ }, et = [
77
+ m,
78
+ T,
85
79
  b,
86
80
  _,
87
- a,
88
- l,
89
81
  C,
90
82
  A,
91
- p
92
- ], nt = {
93
- [b]: !0,
83
+ y
84
+ ], ot = {
85
+ [m]: !0,
86
+ [T]: !0,
94
87
  [_]: !0,
95
- [l]: !0,
96
- [a]: !0,
88
+ [b]: !0,
97
89
  [C]: !1,
98
90
  [A]: !1,
99
- [p]: !0
91
+ [y]: !0
100
92
  }, W = 10;
101
- function rt(t = W) {
93
+ function nt(t = W) {
102
94
  return `
103
95
  <tr>
104
96
  <td class="spacer" style="height: ${t}px;"></td>
@@ -108,9 +100,9 @@ function rt(t = W) {
108
100
  function H(t, e) {
109
101
  return e ? e.pStyle ?? "" : t;
110
102
  }
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>`;
103
+ function rt(t, e, o) {
104
+ const n = H(e.pStyle, o), c = o ? o.openTags ?? "" : e.openTags, s = o ? o.closeTags ?? "" : e.closeTags;
105
+ return `<p contenteditable="false" style="${n}">${c}${t}${s}</p>`;
114
106
  }
115
107
  function st(t, e) {
116
108
  const o = [];
@@ -119,30 +111,30 @@ function st(t, e) {
119
111
  function V(t) {
120
112
  return t ? ` background-color: ${t};` : "";
121
113
  }
122
- function ct(t) {
114
+ function it(t) {
123
115
  const e = V(t);
124
116
  return e ? ` style="${e.trim()}"` : "";
125
117
  }
126
- function lt(t, e = "") {
118
+ function ct(t, e = "") {
127
119
  return {
128
120
  before: (t == null ? void 0 : t.before) ?? e,
129
121
  after: (t == null ? void 0 : t.after) ?? ""
130
122
  };
131
123
  }
132
- function at(t, e) {
124
+ function lt(t, e) {
133
125
  return `${(e == null ? void 0 : e.openTags) ?? ""}${t}${(e == null ? void 0 : e.closeTags) ?? ""}`;
134
126
  }
135
- function ut(t) {
127
+ function at(t) {
136
128
  return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
137
129
  }
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;
130
+ 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";
131
+ function ft(t) {
132
+ return !t || typeof t != "string" || t.trim() === "" ? P : t.startsWith("http://") ? t.replace("http://", "https://") : t;
141
133
  }
142
134
  function Y(t) {
143
135
  return {
144
136
  name: "Product Name",
145
- image_url: R,
137
+ image_url: P,
146
138
  price: { USD: 18 },
147
139
  original_price: { USD: 20 },
148
140
  discount: { USD: 2 },
@@ -154,20 +146,20 @@ function Y(t) {
154
146
  category: []
155
147
  };
156
148
  }
157
- function Tt(t = 6) {
149
+ function mt(t = 6) {
158
150
  return Array.from(
159
151
  { length: t },
160
152
  (e, o) => Y(String(o + 1))
161
153
  );
162
154
  }
163
- function bt(t = "grid", e) {
155
+ function Tt(t = "grid", e) {
164
156
  const o = t === "list" ? `
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" ? "" : `
157
+ data-layout="list"` : "", n = e ? ` ${e}` : "", s = `recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${n}`, i = t === "list" ? "" : `
166
158
  {-{-MOBILE_PRODUCT_ROWS-}-}`, r = t === "list" ? ' style="display: none;"' : "";
167
159
  return `
168
160
  <td
169
161
  align="left"
170
- class="${i}"${o}>
162
+ class="${s}"${o}>
171
163
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
172
164
  <tr>
173
165
  <td align="center">
@@ -203,7 +195,7 @@ function bt(t = "grid", e) {
203
195
  cellspacing="0"
204
196
  border="0"
205
197
  style="display: none;"
206
- >${s}
198
+ >${i}
207
199
  </table>
208
200
  </td>
209
201
  </tr>
@@ -216,36 +208,35 @@ function bt(t = "grid", e) {
216
208
  `;
217
209
  }
218
210
  export {
219
- M as CUSTOM_CELL_HTML,
220
- et as DEFAULTS,
221
- ft as DEFAULT_BUTTON_ANCHOR_STYLE,
222
- gt as DEFAULT_BUTTON_BORDER_STYLE,
223
- ot as DEFAULT_CARD_COMPOSITION,
224
- nt as DEFAULT_CARD_VISIBILITY,
225
- dt as DEFAULT_IMG_STYLE,
211
+ v as CUSTOM_CELL_HTML,
212
+ tt as DEFAULTS,
213
+ gt as DEFAULT_BUTTON_ANCHOR_STYLE,
214
+ dt as DEFAULT_BUTTON_BORDER_STYLE,
215
+ et as DEFAULT_CARD_COMPOSITION,
216
+ ot as DEFAULT_CARD_VISIBILITY,
217
+ ut as DEFAULT_IMG_STYLE,
226
218
  W as DEFAULT_ROW_SPACING_PX,
227
- R as PLACEHOLDER_IMAGE,
219
+ P as PLACEHOLDER_IMAGE,
228
220
  V as bgColorFragment,
229
- tt as buildCellOptions,
230
- Z as buildElementRenderer,
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,
221
+ Z as buildCellOptions,
222
+ Q as buildElementRenderer,
223
+ nt as buildSpacer,
224
+ it as cellBgStyleAttr,
225
+ Tt as createBlockTemplate,
226
+ g as formatProductPrice,
227
+ N as getCurrentCurrencyConfig,
228
+ mt as getDefaultProducts,
229
+ F as isDefaultAttribute,
238
230
  q as isSamePrice,
239
- at as renderButtonLabel,
240
- it as renderStyledParagraph,
241
- ut as resolveButtonBorderClass,
242
- J as resolveInlinePriceOrder,
243
- lt as resolveOmnibusText,
231
+ lt as renderButtonLabel,
232
+ rt as renderStyledParagraph,
233
+ at as resolveButtonBorderClass,
234
+ ct as resolveOmnibusText,
244
235
  H as resolvePStyle,
245
- w as resolveProductAttrValue,
236
+ M as resolveProductAttrValue,
246
237
  st as resolveSegmentBgStyle,
247
- mt as sanitizeImageUrl,
248
- Q as toCustomCompositionKey,
249
- N as toDisplayName,
250
- F as toDisplayableAttributeValue
238
+ ft as sanitizeImageUrl,
239
+ J as toCustomCompositionKey,
240
+ w as toDisplayName,
241
+ x as toDisplayableAttributeValue
251
242
  };
@@ -0,0 +1,12 @@
1
+ import { ATTR_PRODUCT_PRICE as n, ATTR_PRODUCT_OLD_PRICE as e } from "../constants/selectors.js";
2
+ function d(i) {
3
+ const o = i.indexOf(n), t = i.indexOf(e), r = t !== -1 && (o === -1 || t < o);
4
+ return {
5
+ originalFirst: r,
6
+ anchor: r ? e : n,
7
+ skip: r ? n : e
8
+ };
9
+ }
10
+ export {
11
+ d as resolveInlinePriceOrder
12
+ };
@@ -4,6 +4,8 @@ function r(e) {
4
4
  switch (e) {
5
5
  case "viewedTogether":
6
6
  case "purchasedTogether":
7
+ case "similarViewed":
8
+ case "similarBought":
7
9
  return "mostPopular";
8
10
  case "trending":
9
11
  return "trendingProducts";
@@ -1,24 +1,26 @@
1
- import { useConfig as w } from "../composables/useConfig.js";
2
- import { useHttp as b } from "../composables/useHttp.js";
3
- import { useToaster as C } from "../composables/useToaster.js";
4
- import { useTranslations as h } from "../composables/useTranslations.js";
5
- import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
6
- import { EditorType as v } from "../enums/defaults.js";
7
- import { ToasterTypeOptions as x } from "../enums/toaster.js";
8
- import { useRecommendationExtensionStore as E } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { useSaveAsTemplateStore as N } from "../stores/save-as-template.js";
1
+ import { useActionsApi as h } from "../composables/useActionsApi.js";
2
+ import { useConfig as S } from "../composables/useConfig.js";
3
+ import { useHttp as v } from "../composables/useHttp.js";
4
+ import { useToaster as x } from "../composables/useToaster.js";
5
+ import { useTranslations as A } from "../composables/useTranslations.js";
6
+ import { useHtmlDocumentCountValidator as E } from "../composables/validators/useHtmlDocumentCountValidator.js";
7
+ import { useLiquidValidator as N } from "../composables/validators/useLiquidValidator.js";
8
+ import { EditorType as H } from "../enums/defaults.js";
9
+ import { ToasterTypeOptions as P } from "../enums/toaster.js";
10
+ import { useRecommendationExtensionStore as D } from "../extensions/Blocks/Recommendation/store/recommendation.js";
11
+ import { useSaveAsTemplateStore as L } from "../stores/save-as-template.js";
10
12
  import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
11
- import { isPlainObject as P } from "../utils/genericUtil.js";
12
- import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
13
- const B = () => {
14
- const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: f } = S(), u = h();
13
+ import { isPlainObject as q } from "../utils/genericUtil.js";
14
+ import { useTemplatePreparation as F } from "../utils/templatePreparation.js";
15
+ const Z = () => {
16
+ const { get: n, post: m } = v(), { handleError: s, showToaster: l } = x(), { config: c, isFeatureEnabled: p } = S(), { validateLiquidSyntax: T } = N(), { validateSingleHtmlDocument: w } = E(), { getTemplateData: b } = h(), u = A();
15
17
  return {
16
18
  getCategories: async () => {
17
19
  try {
18
20
  const { data: e = [] } = await n("/newsletter/template-library/get-template-categories");
19
21
  return e;
20
22
  } catch (e) {
21
- return o(e, "Failed to fetch template categories"), [];
23
+ return s(e, "Failed to fetch template categories"), [];
22
24
  }
23
25
  },
24
26
  checkTemplateNameAvailability: async (e) => {
@@ -35,27 +37,30 @@ const B = () => {
35
37
  );
36
38
  return t.toString();
37
39
  } catch (t) {
38
- return o(t, "Failed to create category"), "";
40
+ return s(t, "Failed to create category"), "";
39
41
  }
40
42
  },
41
43
  createTemplate: async () => {
42
44
  var e, t, d, y;
43
45
  try {
44
- const { prepareTemplateDetails: i } = A(), s = N(), a = await i();
45
- if (p("liquidSyntax") && !await f(a.compiledHtml))
46
+ const { prepareTemplateDetails: i } = F(), o = L(), g = await b();
47
+ if (!w(g.html))
46
48
  return !1;
47
- const T = {
48
- name: s.getTemplateName,
49
- categories: s.getSelectedCategoryIds,
49
+ const a = await i(g);
50
+ if (p("liquidSyntax") && !await T(a.compiledHtml))
51
+ return !1;
52
+ const C = {
53
+ name: o.getTemplateName,
54
+ categories: o.getSelectedCategoryIds,
50
55
  productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
51
- editorType: v,
56
+ editorType: H,
52
57
  messageType: ((y = (d = c.value) == null ? void 0 : d.partner) == null ? void 0 : y.messageType) || 0,
53
58
  content: r(a.compiledHtml),
54
59
  css: r(a.css),
55
60
  unsubscriptionPreferencePageStatus: !1,
56
61
  unsubscriptionPreferencePages: [],
57
62
  recommendationCampaignUrls: r(
58
- E().recommendationCampaignUrls
63
+ D().recommendationCampaignUrls
59
64
  ),
60
65
  recommendationConfigs: r({}),
61
66
  isGuido: !0,
@@ -67,31 +72,31 @@ const B = () => {
67
72
  css: a.css,
68
73
  dynamicContentList: a.dynamicContentList
69
74
  })
70
- }, { data: g } = await m(
75
+ }, { data: f } = await m(
71
76
  "/newsletter/template-library/create-template",
72
- T
77
+ C
73
78
  );
74
- if (!P(g))
79
+ if (!q(f))
75
80
  throw new Error("Unexpected create-template response");
76
- return g.type === "alert" ? (l({
81
+ return f.type === "alert" ? (l({
77
82
  message: u(
78
83
  "newsletter.template-library-save-alert",
79
- { templateName: s.getTemplateName }
84
+ { templateName: o.getTemplateName }
80
85
  ),
81
- type: x.Error
86
+ type: P.Error
82
87
  }), !1) : (l({
83
88
  message: u(
84
89
  "newsletter.template-library-save-success",
85
- { templateName: s.getTemplateName }
90
+ { templateName: o.getTemplateName }
86
91
  ),
87
92
  type: "success"
88
93
  }), !0);
89
94
  } catch (i) {
90
- return o(i, "Failed to create template"), !1;
95
+ return s(i, "Failed to create template"), !1;
91
96
  }
92
97
  }
93
98
  };
94
99
  };
95
100
  export {
96
- B as useTemplateLibraryApi
101
+ Z as useTemplateLibraryApi
97
102
  };
@@ -0,0 +1,3 @@
1
+ export declare const useHtmlDocumentCountValidator: () => {
2
+ validateSingleHtmlDocument: (rawHtml: string, silent?: boolean) => boolean;
3
+ };
@@ -20,6 +20,12 @@ export declare function hasEmptyTitle(block: Element): boolean;
20
20
  * @returns True only when both prices render and the original price comes first
21
21
  */
22
22
  export declare function isOldPriceFirst(block: Element): boolean;
23
+ /**
24
+ * Reads the legacy "Move to next line" state from the rendered card, for blocks whose config does not carry it.
25
+ * @param block - The legacy recommendation block element
26
+ * @returns True only when both prices render in separate rows and neither row is laid out inline (`table-cell`)
27
+ */
28
+ export declare function isPriceOnNextLine(block: Element): boolean;
23
29
  /**
24
30
  * Legacy keeps the text color and the name's trim toggle in the rendered `<p>`, not in the config theme.
25
31
  * @param variables - The legacy composition variables
@@ -122,7 +122,7 @@ export declare class RecommendationBlockControl extends CommonControl {
122
122
  private _isPanelOn;
123
123
  /**
124
124
  * Falls back to the first available option when the block's currency or locale is not offered (a new block on
125
- * the hard-coded default, or a block copied from another account). The algorithm falls back only on new blocks.
125
+ * the hard-coded default, or a block copied from another account). Only the default strategy gets an algorithm.
126
126
  */
127
127
  private _applySmartDefaults;
128
128
  /**
@@ -1,6 +1,7 @@
1
1
  import type { CurrencyConfig } from '../types/nodeConfig';
2
2
  import type { FiltersResponse, RecommendationProduct } from '@@/Types/recommendation';
3
3
  import { ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON } from '../constants';
4
+ export { resolveInlinePriceOrder } from '../utils/inlinePriceOrder';
4
5
  type PriceKey = 'price' | 'original_price' | 'discount';
5
6
  /**
6
7
  * Current currency configuration from the store, in CurrencyConfig shape.
@@ -22,18 +23,6 @@ export declare function isSamePrice(product: RecommendationProduct): boolean;
22
23
  * e.g., "rating_star" → "Rating Star"
23
24
  */
24
25
  export declare function toDisplayName(attrName: string): string;
25
- /**
26
- * Resolves the inline (side-by-side) price layout from the composition order so
27
- * it matches the stacked order. `anchor` is whichever of price / original price
28
- * comes first in the composition (the merged cell renders there); `skip` is the
29
- * other (dropped, since it's merged in); `originalFirst` puts the original price
30
- * on the left when it precedes the sale price (the default composition order).
31
- */
32
- export declare function resolveInlinePriceOrder(composition: string[]): {
33
- originalFirst: boolean;
34
- anchor: string;
35
- skip: string;
36
- };
37
26
  /**
38
27
  * Reduces a raw product-attribute value to a displayable scalar string.
39
28
  * Array-type attributes (filter types `Strings`/`Numbers`) are substituted with
@@ -328,4 +317,3 @@ export declare function getDefaultProducts(count?: number): RecommendationProduc
328
317
  * @returns HTML template string with {-{-TITLE-}-}, {-{-PRODUCT_ROWS-}-}, and {-{-MOBILE_PRODUCT_ROWS-}-} (grid only) placeholders
329
318
  */
330
319
  export declare function createBlockTemplate(layout?: Orientation, instanceClass?: string): string;
331
- export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Resolves the inline price layout from the composition order: `anchor` is whichever price comes first (the merged
3
+ * cell renders there), `skip` is the other; `originalFirst` puts the original price on the left.
4
+ */
5
+ export declare function resolveInlinePriceOrder(composition: string[]): {
6
+ originalFirst: boolean;
7
+ anchor: string;
8
+ skip: string;
9
+ };
@@ -1,23 +1,5 @@
1
1
  /**
2
- * Maps legacy algorithm strategy keys (used by templates authored against the
3
- * old recommendation system) to the new keys used by `RecommendationFeedSourceMaps`.
4
- *
5
- * `viewedTogether` and `purchasedTogether` map to `mostPopular`: their feed sources (ids 11, 12) need a
6
- * product id and are excluded from the algorithm dropdown (`EXCLUDED_ALGORITHM_IDS`).
7
- *
8
- * Renames are matched by feed-source id:
9
- * - `trending` → `trendingProducts` (id 40, path `trending`)
10
- * - `mostValuable` → `mostValuableOfPartner` (id 46, path `most-valuable`)
11
- * - `topSellers` → `mostPurchased` (id 62, path `top-sellers`)
12
- * - `mostViewed` → `mostPopular` (id 61, path `most-popular`)
13
- *
14
- * Used at two boundaries:
15
- * 1. The migrator (`settingsMapper`), so freshly migrated node configs carry
16
- * the new key.
17
- * 2. The algorithm dropdown control, so already-saved blocks that still carry
18
- * a legacy key resolve to a matching dropdown option.
19
- *
20
- * Unknown values pass through untouched so a future-added algorithm doesn't
21
- * silently default.
2
+ * Maps legacy strategy keys to `RecommendationFeedSourceMaps` keys; product-bound ones (ids 11, 12, excluded from the
3
+ * dropdown) become `mostPopular`. Unknown keys pass through so a future algorithm is not silently defaulted.
22
4
  */
23
5
  export declare function mapLegacyStrategy(legacy: string | undefined): string | undefined;
@@ -1,3 +1,4 @@
1
+ import type { TemplateData } from '@@/Types/actions-api';
1
2
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
3
  /**
3
4
  * Collects every unsubscribe page id referenced by the unsubscribe blocks
@@ -44,7 +45,7 @@ export declare function getHtmlReferencedUnsubscribePages(html: string): number[
44
45
  */
45
46
  declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
46
47
  export declare const useTemplatePreparation: () => {
47
- prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
+ prepareTemplateDetails: (prefetched?: TemplateData) => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
49
  hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
49
50
  };
50
51
  export {};