@useinsider/guido 3.22.0-beta.d4e1d48 → 3.22.0-beta.e1b5da2

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 (31) hide show
  1. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +11 -11
  2. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  3. package/dist/config/compiler/utils/recommendationCompilerUtils.js +22 -22
  4. package/dist/config/migrator/recommendation/compositionMapper.js +56 -49
  5. package/dist/config/migrator/recommendation/extractors.js +100 -40
  6. package/dist/config/migrator/recommendation/htmlBuilder.js +285 -207
  7. package/dist/config/migrator/recommendation/settingsMapper.js +37 -36
  8. package/dist/config/migrator/recommendation/themeMapper.js +53 -41
  9. package/dist/config/migrator/recommendationMigrator.js +68 -61
  10. package/dist/extensions/Blocks/Recommendation/block.js +33 -24
  11. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +20 -19
  12. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +148 -163
  13. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +23 -22
  14. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +19 -18
  15. package/dist/extensions/Blocks/Recommendation/templates/utils.js +82 -91
  16. package/dist/extensions/Blocks/Recommendation/utils/inlinePriceOrder.js +12 -0
  17. package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMap.js +3 -2
  18. package/dist/guido.css +1 -1
  19. package/dist/src/config/migrator/recommendation/compositionMapper.d.ts +3 -1
  20. package/dist/src/config/migrator/recommendation/extractors.d.ts +35 -6
  21. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +3 -1
  22. package/dist/src/config/migrator/recommendation/themeMapper.d.ts +3 -1
  23. package/dist/src/config/migrator/recommendation/types.d.ts +11 -1
  24. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
  25. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -8
  26. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -13
  27. package/dist/src/extensions/Blocks/Recommendation/utils/inlinePriceOrder.d.ts +9 -0
  28. package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMap.d.ts +2 -19
  29. package/dist/src/stores/unsubscribe.d.ts +0 -10
  30. package/dist/stores/unsubscribe.js +29 -33
  31. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- import { PRE_RRS_CONFIG_VERSION as s, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
- import { DEFAULT_CARDS_IN_ROW as m, DEFAULT_MOBILE_ROW_SPACING as p, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as S, DEFAULT_COLUMN_SPACING as f, DEFAULT_MOBILE_CARDS_IN_ROW as a } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
- import { mapLegacyStrategy as l } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
- function c(t) {
1
+ import { PRE_RRS_CONFIG_VERSION as p, DEFAULT_CURRENCY as i } from "../../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
2
+ import { DEFAULT_CARDS_IN_ROW as d, DEFAULT_MOBILE_ROW_SPACING as S, DEFAULT_MOBILE_COLUMN_SPACING as c, DEFAULT_ROW_SPACING as f, DEFAULT_COLUMN_SPACING as l, DEFAULT_MOBILE_CARDS_IN_ROW as s } from "../../../extensions/Blocks/Recommendation/constants/layout.js";
3
+ import { mapLegacyStrategy as _ } from "../../../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
4
+ function I(t) {
5
5
  return t === "0" || t === 0 ? "before" : "after";
6
6
  }
7
- function _(t) {
7
+ function A(t) {
8
8
  if (typeof t == "number" && Number.isFinite(t))
9
9
  return t;
10
10
  if (typeof t == "string") {
@@ -14,51 +14,52 @@ function _(t) {
14
14
  }
15
15
  return i.decimalCount;
16
16
  }
17
- function I(t) {
17
+ function L(t) {
18
18
  return t === "." || t === "," || t === " " || t === "" ? t : ",";
19
19
  }
20
- function A(t) {
20
+ function N(t) {
21
21
  return t === "." || t === "," || t === " " ? t : ".";
22
22
  }
23
- function L(t) {
23
+ function R(t) {
24
24
  if (!t || typeof t != "object")
25
25
  return { ...i };
26
- const o = t, n = o.value ?? o.name ?? i.code, r = o.symbol ?? n;
26
+ const o = t, n = o.value ?? o.name ?? i.code, e = o.symbol ?? n;
27
27
  return {
28
28
  code: n,
29
- symbol: r,
30
- alignment: c(o.alignment),
31
- decimalCount: _(o.decimalCount),
32
- decimalSeparator: A(o.decimalSeparator),
33
- thousandSeparator: I(o.thousandSeparator)
29
+ symbol: e,
30
+ alignment: I(o.alignment),
31
+ decimalCount: A(o.decimalCount),
32
+ decimalSeparator: N(o.decimalSeparator),
33
+ thousandSeparator: L(o.thousandSeparator)
34
34
  };
35
35
  }
36
- function N(t) {
36
+ function b(t) {
37
37
  return t === "horizontal" || t === "list" ? "list" : "grid";
38
38
  }
39
- function R(t) {
40
- return l(t) || "mostPopular";
39
+ function D(t) {
40
+ return _(t) || "mostPopular";
41
41
  }
42
- function O(t, o, n) {
43
- const r = o.rowCount ?? t.cardsInRow ?? m, u = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
42
+ function U(t, o, n) {
43
+ var a, u;
44
+ const e = o.rowCount ?? t.cardsInRow ?? d, m = o.totalCount ?? (typeof t.size == "string" ? parseInt(t.size) : t.size) ?? 6;
44
45
  return {
45
46
  recommendationId: n,
46
- strategy: R(t.strategy),
47
- productIds: (t.productIds ?? []).map((e) => String(e)),
48
- size: String(u),
47
+ strategy: D(t.strategy),
48
+ productIds: (t.productIds ?? []).map((r) => String(r)),
49
+ size: String(m),
49
50
  shuffleProducts: !!t.shuffleProducts,
50
51
  language: t.language ?? "en_US",
51
- currency: L(t.currencySettings),
52
- filters: (t.filters ?? []).map((e) => ({ ...e })),
53
- layout: N(t.orientation ?? o.orientation),
54
- cardsInRow: r,
55
- mobileCardsInRow: a,
56
- mobileLayoutEnabled: !1,
57
- previousMobileCardsInRow: a,
58
- columnSpacing: f,
59
- rowSpacing: S,
60
- mobileColumnSpacing: d,
61
- mobileRowSpacing: p,
52
+ currency: R(t.currencySettings),
53
+ filters: (t.filters ?? []).map((r) => ({ ...r })),
54
+ layout: b(t.orientation ?? o.orientation),
55
+ cardsInRow: e,
56
+ mobileCardsInRow: s,
57
+ mobileLayoutEnabled: ((u = (a = o.theme) == null ? void 0 : a.blockAdapt) == null ? void 0 : u.adapt) === !0,
58
+ previousMobileCardsInRow: s,
59
+ columnSpacing: l,
60
+ rowSpacing: f,
61
+ mobileColumnSpacing: c,
62
+ mobileRowSpacing: S,
62
63
  omnibusPrice: { textBefore: "", textAfter: "" },
63
64
  omnibusDiscount: { textBefore: "", textAfter: "" },
64
65
  // Preserve the legacy price-placement toggles. Absent legacy keys map to
@@ -66,10 +67,10 @@ function O(t, o, n) {
66
67
  // gated). New Guido blocks default differently (see DEFAULT_NODE_CONFIG).
67
68
  priceMovedToNextLine: !!t.isPriceMovedToNextLine,
68
69
  priceHideIfSameAsDiscounted: !!t.isPriceDeletedForZeroSale,
69
- configVersion: s
70
+ configVersion: p
70
71
  };
71
72
  }
72
73
  export {
73
- L as mapCurrency,
74
- O as mapSettings
74
+ R as mapCurrency,
75
+ U as mapSettings
75
76
  };
@@ -1,34 +1,44 @@
1
1
  function r(n, t, o) {
2
2
  o != null && o !== "" && n.push(`${t}: ${o}`);
3
3
  }
4
- function $(n) {
4
+ function x(n) {
5
+ if (typeof n == "number" && Number.isFinite(n) && n >= 0)
6
+ return Math.trunc(n);
7
+ if (typeof n == "string" && /^\d+$/.test(n.trim())) {
8
+ const t = Number(n.trim());
9
+ if (Number.isFinite(t) && t >= 0)
10
+ return t;
11
+ }
12
+ }
13
+ function P(n) {
5
14
  if (!n)
6
15
  return null;
7
16
  const t = n.top ?? n.all ?? 0, o = n.right ?? n.all ?? 0, i = n.bottom ?? n.all ?? 0, l = n.left ?? n.all ?? 0;
8
17
  return t === 0 && o === 0 && i === 0 && l === 0 ? null : `${t}px ${o}px ${i}px ${l}px`;
9
18
  }
10
- function j(n) {
19
+ function z(n) {
11
20
  if (!n)
12
21
  return null;
13
22
  const { top: t, right: o, bottom: i, left: l } = n;
14
23
  return t === void 0 ? null : t === o && t === i && t === l ? t : null;
15
24
  }
16
- function S(n, t, o, i) {
17
- const l = j(o);
25
+ function $(n, t, o, i) {
26
+ const l = z(o);
18
27
  if (l !== null) {
19
28
  r(n, `border-${t}`, i(l));
20
29
  return;
21
30
  }
22
31
  o && (r(n, `border-top-${t}`, o.top !== void 0 ? i(o.top) : null), r(n, `border-right-${t}`, o.right !== void 0 ? i(o.right) : null), r(n, `border-bottom-${t}`, o.bottom !== void 0 ? i(o.bottom) : null), r(n, `border-left-${t}`, o.left !== void 0 ? i(o.left) : null));
23
32
  }
24
- function C(n) {
33
+ function D(n) {
25
34
  if (!n)
26
35
  return null;
27
- if (typeof n.radius == "number")
28
- return `${n.radius}px`;
36
+ const t = x(n.radius ?? n.borderRadius);
37
+ if (t !== void 0)
38
+ return `${t}px`;
29
39
  if (typeof n.lt == "number" || typeof n.rt == "number" || typeof n.rb == "number" || typeof n.lb == "number") {
30
- const t = n.lt ?? 0, o = n.rt ?? 0, i = n.rb ?? 0, l = n.lb ?? 0;
31
- return `${t}px ${o}px ${i}px ${l}px`;
40
+ const o = n.lt ?? 0, i = n.rt ?? 0, l = n.rb ?? 0, f = n.lb ?? 0;
41
+ return `${o}px ${i}px ${l}px ${f}px`;
32
42
  }
33
43
  return null;
34
44
  }
@@ -36,58 +46,60 @@ function I(n) {
36
46
  var t, o;
37
47
  return ((t = n.textLineSpacing) == null ? void 0 : t.lineSpacing) ?? ((o = n.textLineSpacing) == null ? void 0 : o["font-lineSpacing"]);
38
48
  }
39
- function L(n) {
40
- var f, u, a, g, d, b, p, s;
41
- const t = [], o = [], i = (f = n == null ? void 0 : n.textAlign) == null ? void 0 : f.align, l = $((u = n == null ? void 0 : n.textPadding) == null ? void 0 : u.desktop), x = (a = n == null ? void 0 : n.textStyle) == null ? void 0 : a["font-weight"], c = (g = n == null ? void 0 : n.textStyle) == null ? void 0 : g["font-style"];
42
- return r(t, "background-color", (d = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : d.color), r(t, "padding", l), r(o, "font-family", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-family"]), r(o, "font-size", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-size"]), r(o, "font-weight", x), r(o, "font-style", c), r(o, "color", (s = n == null ? void 0 : n.textColor) == null ? void 0 : s.color), r(o, "line-height", I(n ?? {})), r(o, "text-align", i), {
49
+ function N(n) {
50
+ var u, s, a, d, g, b, p, y;
51
+ const t = [], o = [], i = (u = n == null ? void 0 : n.textAlign) == null ? void 0 : u.align, l = P((s = n == null ? void 0 : n.textPadding) == null ? void 0 : s.desktop), f = (a = n == null ? void 0 : n.textStyle) == null ? void 0 : a["font-weight"], c = (d = n == null ? void 0 : n.textStyle) == null ? void 0 : d["font-style"];
52
+ return r(t, "background-color", (g = n == null ? void 0 : n.textBackgroundColor) == null ? void 0 : g.color), r(t, "padding", l), r(o, "font-family", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["font-family"]), r(o, "font-size", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-size"]), r(o, "font-weight", f), r(o, "font-style", c), r(o, "color", (y = n == null ? void 0 : n.textColor) == null ? void 0 : y.color), r(o, "line-height", I(n ?? {})), r(o, "text-align", i), {
43
53
  tdStyle: t.join("; "),
44
54
  pStyle: o.join("; "),
45
55
  align: i || void 0,
46
- wrapBold: x === "bold",
56
+ wrapBold: f === "bold",
47
57
  wrapItalic: c === "italic",
48
58
  textTrimming: (n == null ? void 0 : n.textTrimming) === !0
49
59
  };
50
60
  }
51
- function N(n) {
52
- var u, a, g, d, b, p, s, k, w, P, B, z;
61
+ function E(n) {
62
+ var s, a, d, g, b, p, y, k, w, B, T, j;
53
63
  const t = [], o = [], i = [];
54
- r(t, "padding", $((u = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : u.desktop)), r(i, "padding", $((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-family"]), r(i, "font-size", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-size"]), r(i, "font-weight", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-weight"]), r(i, "font-style", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-style"]);
55
- const l = (s = n == null ? void 0 : n.buttonColor) == null ? void 0 : s.color, x = (k = n == null ? void 0 : n.textButtonColor) == null ? void 0 : k.color;
56
- r(o, "background", l), r(i, "background", l), r(i, "color", x);
64
+ r(t, "padding", P((s = n == null ? void 0 : n.buttonExternalPadding) == null ? void 0 : s.desktop)), r(i, "padding", P((a = n == null ? void 0 : n.buttonInternalPadding) == null ? void 0 : a.desktop)), r(i, "font-family", (d = n == null ? void 0 : n.buttonStyle) == null ? void 0 : d["font-family"]), r(i, "font-size", (g = n == null ? void 0 : n.buttonStyle) == null ? void 0 : g["font-size"]), r(i, "font-weight", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-weight"]), r(i, "font-style", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-style"]);
65
+ const l = (y = n == null ? void 0 : n.buttonColor) == null ? void 0 : y.color, f = (k = n == null ? void 0 : n.textButtonColor) == null ? void 0 : k.color;
66
+ r(o, "background", l), r(i, "background", l), r(i, "color", f);
57
67
  const c = n == null ? void 0 : n.buttonBorder;
58
- S(o, "width", c == null ? void 0 : c.width, (y) => `${y}px`), S(o, "style", c == null ? void 0 : c.style, (y) => y), S(o, "color", c == null ? void 0 : c.color, (y) => y);
59
- const f = C(n == null ? void 0 : n.buttonBorderRadius);
60
- return f && (r(o, "border-radius", f), r(i, "border-radius", f)), ((w = n == null ? void 0 : n.buttonStretch) == null ? void 0 : w.stretched) === !1 ? (r(o, "display", "inline-block"), r(i, "display", "inline-block")) : ((P = n == null ? void 0 : n.buttonStretch) == null ? void 0 : P.stretched) === !0 && (r(o, "display", "block"), r(i, "display", "block")), {
68
+ $(o, "width", c == null ? void 0 : c.width, (S) => `${S}px`), $(o, "style", c == null ? void 0 : c.style, (S) => S), $(o, "color", c == null ? void 0 : c.color, (S) => S);
69
+ const u = D((n == null ? void 0 : n.buttonBorderRadius) ?? (n == null ? void 0 : n.borderRadius));
70
+ return u && (r(o, "border-radius", u), r(i, "border-radius", u)), ((w = n == null ? void 0 : n.buttonStretch) == null ? void 0 : w.stretched) === !1 ? (r(o, "display", "inline-block"), r(i, "display", "inline-block")) : ((B = n == null ? void 0 : n.buttonStretch) == null ? void 0 : B.stretched) === !0 && (r(o, "display", "block"), r(i, "display", "block")), {
61
71
  tdStyle: t.join("; "),
62
- align: ((B = n == null ? void 0 : n.buttonAlign) == null ? void 0 : B.align) || void 0,
72
+ align: ((T = n == null ? void 0 : n.buttonAlign) == null ? void 0 : T.align) || void 0,
63
73
  spanStyle: o.join("; "),
64
74
  aStyle: i.join("; "),
65
- text: (z = n == null ? void 0 : n.buttonText) == null ? void 0 : z.text
75
+ text: (j = n == null ? void 0 : n.buttonText) == null ? void 0 : j.text
66
76
  };
67
77
  }
68
- function T(n) {
69
- if (typeof n == "number" && Number.isFinite(n) && n >= 0)
70
- return Math.trunc(n);
71
- if (typeof n == "string" && /^\d+$/.test(n.trim())) {
72
- const t = Number(n.trim());
73
- if (Number.isFinite(t) && t >= 0)
74
- return t;
75
- }
76
- }
77
- function A(n) {
78
+ function L(n) {
78
79
  var t, o;
79
80
  return {
80
- width: T((t = n == null ? void 0 : n.imageSize) == null ? void 0 : t.width),
81
- height: T((o = n == null ? void 0 : n.imageSize) == null ? void 0 : o.height)
81
+ width: x((t = n == null ? void 0 : n.imageSize) == null ? void 0 : t.width),
82
+ height: x((o = n == null ? void 0 : n.imageSize) == null ? void 0 : o.height)
82
83
  };
83
84
  }
84
- function F(n, t) {
85
+ const A = /* @__PURE__ */ new Set([5, 10, 15, 20, 25, 30, 35, 40]), C = [["t", "top"], ["r", "right"], ["b", "bottom"], ["l", "left"]];
86
+ function R(n) {
87
+ if (!n)
88
+ return;
89
+ const t = [], o = [];
90
+ return C.forEach(([i, l]) => {
91
+ const f = x(n[l] ?? n.all) ?? 0;
92
+ A.has(f) ? t.push(`es-p${f}${i}`) : f > 0 && o.push(`padding-${l}: ${f}px`);
93
+ }), { classes: t.join(" "), style: o.join("; ") };
94
+ }
95
+ function v(n, t) {
85
96
  const o = (n ?? "").trim().replace(/;$/, "").trim(), i = (t ?? "").trim().replace(/;$/, "").trim();
86
97
  return o ? i ? `${o}; ${i}` : o : i;
87
98
  }
88
99
  export {
89
- F as appendStyle,
90
- N as mapButtonTheme,
91
- A as mapImageTheme,
92
- L as mapTextTheme
100
+ v as appendStyle,
101
+ R as mapBlockPadding,
102
+ E as mapButtonTheme,
103
+ L as mapImageTheme,
104
+ N as mapTextTheme
93
105
  };
@@ -1,52 +1,59 @@
1
- import { BlockId as f } from "../../enums/block.js";
2
- import { DEFAULT_NODE_CONFIG as y } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
- import { ATTR_RECOMMENDATION_TITLE as b } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
- import { useTemplateStore as T } from "../../stores/template.js";
5
- import { mapComposition as v } from "./recommendation/compositionMapper.js";
6
- import { extractCurrencyFromBlock as C, extractTitleText as M, hasVisibleTitle as R, extractCardBgColor as S, isPartnerManagedBlock as h } from "./recommendation/extractors.js";
7
- import { buildBlockHtml as w } from "./recommendation/htmlBuilder.js";
8
- import { parseRecommendationId as x, parseLegacyConfig as E } from "./recommendation/parseLegacyConfig.js";
9
- import { mapSettings as A } from "./recommendation/settingsMapper.js";
10
- const H = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
11
- function B(n, t, c) {
12
- var l;
13
- const r = x(t);
14
- if (r === null)
1
+ import { BlockId as b } from "../../enums/block.js";
2
+ import { DEFAULT_NODE_CONFIG as C } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_RECOMMENDATION_TITLE as f } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
+ import { useTemplateStore as M } from "../../stores/template.js";
5
+ import { mapComposition as x } from "./recommendation/compositionMapper.js";
6
+ import { isPriceOnNextLine as R, extractCurrencyFromBlock as h, isOldPriceFirst as S, withRenderedTextTheme as w, extractTitleText as E, hasEmptyTitle as L, hasVisibleTitle as B, extractCardBgColor as P, isPartnerManagedBlock as A, extractRenderedBlockPadding as H } from "./recommendation/extractors.js";
7
+ import { buildBlockHtml as N } from "./recommendation/htmlBuilder.js";
8
+ import { parseRecommendationId as O, parseLegacyConfig as F } from "./recommendation/parseLegacyConfig.js";
9
+ import { mapSettings as I } from "./recommendation/settingsMapper.js";
10
+ import { mapBlockPadding as _ } from "./recommendation/themeMapper.js";
11
+ const k = 'td[esd-dev-product-config][class*="ins-recommendation-v3-block-"]:not(.recommendation-block-v2), td.product-block[esd-handler-name*="EmailRecommendationV3"][esd-dev-product-config]:not(.recommendation-block-v2)';
12
+ function $(c, e, m) {
13
+ var l, g, p;
14
+ const t = O(e);
15
+ if (t === null)
15
16
  return console.warn(
16
17
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
17
18
  ), !1;
18
- const o = E(t);
19
- if (!o)
19
+ const r = F(e);
20
+ if (!r)
20
21
  return console.warn(
21
- `[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
22
+ `[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
22
23
  ), !1;
23
- const a = c[String(r)] ?? {
24
- currencySettings: C(t)
25
- }, i = A(a, o, r), e = v((l = o.composition) == null ? void 0 : l.variables), d = M(t);
26
- e.titleVariable || (e.visibility[b] = R(t));
27
- const p = S(t), g = {
28
- ...i,
24
+ const o = m[String(t)] ?? {}, n = {
25
+ ...o,
26
+ currencySettings: o.currencySettings ?? h(e),
27
+ isPriceMovedToNextLine: o.isPriceMovedToNextLine ?? R(e)
28
+ }, a = I(n, r, t), i = x(
29
+ w((l = r.composition) == null ? void 0 : l.variables, e),
30
+ { oldPriceFirst: S(e) }
31
+ ), u = E(e);
32
+ L(e) ? i.visibility[f] = !1 : i.titleVariable || (i.visibility[f] = B(e));
33
+ const y = P(e), T = {
34
+ ...a,
29
35
  strategyId: "",
30
- composition: e.composition,
31
- visibility: e.visibility,
32
- previousTitleHtml: y.previousTitleHtml,
33
- textTrimming: e.anyTextTrimming
34
- }, m = h(t), u = `
36
+ composition: i.composition,
37
+ visibility: i.visibility,
38
+ previousTitleHtml: C.previousTitleHtml,
39
+ textTrimming: i.anyTextTrimming
40
+ }, s = A(e), v = `
35
41
  <table>
36
42
  <tbody>
37
43
  <tr>
38
44
  <td class="esd-structure" align="left">
39
45
  <table width="100%" cellpadding="0" cellspacing="0">
40
46
  <tbody>
41
- <tr>${w({
42
- nodeConfig: g,
43
- composition: e,
44
- cardBg: p,
45
- titleText: d,
46
- legacyId: t.getAttribute("id") ?? void 0,
47
- legacyBgColor: t.getAttribute("bgcolor") ?? void 0,
48
- preserveInnerHtml: m ? t.innerHTML : void 0,
49
- skipCompile: m
47
+ <tr>${N({
48
+ nodeConfig: T,
49
+ composition: i,
50
+ cardBg: y,
51
+ titleText: u,
52
+ legacyId: e.getAttribute("id") ?? void 0,
53
+ legacyBgColor: e.getAttribute("bgcolor") ?? void 0,
54
+ preserveInnerHtml: s ? e.innerHTML : void 0,
55
+ skipCompile: s,
56
+ blockPadding: _(((p = (g = r.theme) == null ? void 0 : g.blockPadding) == null ? void 0 : p.desktop) ?? H(e))
50
57
  })}</tr>
51
58
  </tbody>
52
59
  </table>
@@ -54,40 +61,40 @@ function B(n, t, c) {
54
61
  </tr>
55
62
  </tbody>
56
63
  </table>
57
- `, s = n.parseFromString(u, "text/html").querySelector("td.esd-structure");
58
- return !s || !t.parentNode ? (console.warn(
59
- `[RecommendationMigrator] Aborting block id=${r} — failed to construct new HTML element`
60
- ), !1) : (t.parentNode.replaceChild(s, t), !0);
64
+ `, d = c.parseFromString(v, "text/html").querySelector("td.esd-structure");
65
+ return !d || !e.parentNode ? (console.warn(
66
+ `[RecommendationMigrator] Aborting block id=${t} — failed to construct new HTML element`
67
+ ), !1) : (e.parentNode.replaceChild(d, e), !0);
61
68
  }
62
- function G(n, t = {}) {
63
- const c = new DOMParser();
64
- let r;
69
+ function X(c, e = {}) {
70
+ const m = new DOMParser();
71
+ let t;
65
72
  try {
66
- r = c.parseFromString(n, "text/html");
67
- } catch (i) {
68
- return console.error("[RecommendationMigrator] Failed to parse template:", i), n;
73
+ t = m.parseFromString(c, "text/html");
74
+ } catch (n) {
75
+ return console.error("[RecommendationMigrator] Failed to parse template:", n), c;
69
76
  }
70
- const o = Array.from(r.querySelectorAll(H));
77
+ const r = Array.from(t.querySelectorAll(k));
71
78
  try {
72
- T().$patch((e) => {
73
- e.migrations = {
74
- ...e.migrations,
75
- [f.Recommendation]: o.length
79
+ M().$patch((a) => {
80
+ a.migrations = {
81
+ ...a.migrations,
82
+ [b.Recommendation]: r.length
76
83
  };
77
84
  });
78
85
  } catch {
79
86
  }
80
- if (o.length === 0)
81
- return n;
82
- let a = 0;
83
- return o.forEach((i) => {
87
+ if (r.length === 0)
88
+ return c;
89
+ let o = 0;
90
+ return r.forEach((n) => {
84
91
  try {
85
- B(c, i, t) && (a += 1);
86
- } catch (e) {
87
- console.error("[RecommendationMigrator] Unexpected error migrating block:", e);
92
+ $(m, n, e) && (o += 1);
93
+ } catch (a) {
94
+ console.error("[RecommendationMigrator] Unexpected error migrating block:", a);
88
95
  }
89
- }), a > 0 && console.info(`[RecommendationMigrator] Migrated ${a} legacy Recommendation block(s)`), r.documentElement.outerHTML;
96
+ }), o > 0 && console.info(`[RecommendationMigrator] Migrated ${o} legacy Recommendation block(s)`), t.documentElement.outerHTML;
90
97
  }
91
98
  export {
92
- G as migrateRecommendation
99
+ X as migrateRecommendation
93
100
  };
@@ -2,23 +2,24 @@ var b = Object.defineProperty;
2
2
  var A = (m, c, e) => c in m ? b(m, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : m[c] = e;
3
3
  var u = (m, c, e) => A(m, typeof c != "symbol" ? c + "" : c, e);
4
4
  import { useConfig as g } from "../../../composables/useConfig.js";
5
- import { BlockId as D } from "../../../enums/block.js";
6
- import { getMigrationBannerHtml as E } from "../../../utils/migrationBannerHtml.js";
5
+ import { BlockId as E } from "../../../enums/block.js";
6
+ import { getMigrationBannerHtml as D } from "../../../utils/migrationBannerHtml.js";
7
7
  import { Block as S, BlockCompositionType as v, ModificationDescription as _ } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
8
- import { CURRENT_CONFIG_VERSION as N, PRE_RRS_CONFIG_VERSION as M } from "./constants/defaultConfig.js";
8
+ import { CURRENT_CONFIG_VERSION as M, PRE_RRS_CONFIG_VERSION as N } from "./constants/defaultConfig.js";
9
9
  import { RECOMMENDATION_ID_ATTR as f } from "./constants/selectors.js";
10
- import { ensureMobileFitRule as w, syncHeightBound as O } from "./controls/image/index.js";
11
- import { regenerateMobileProductRows as H } from "./controls/main/utils.js";
12
- import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as T } from "./controls/mobileLayout/cssRules.js";
10
+ import { ensureMobileFitRule as T, syncHeightBound as w } from "./controls/image/index.js";
11
+ import { regenerateMobileProductRows as O } from "./controls/main/utils.js";
12
+ import { ensureMobileCssRulesExist as I, setMobileLayoutOptOut as R, hasMobileLayoutOptOut as x } from "./controls/mobileLayout/cssRules.js";
13
+ import { CSS_CLASS_TEXT_TRIM as H, ensureTextTrimCssRulesExist as $ } from "./controls/shared/textTrimCssRules.js";
13
14
  import { RecommendationConfigService as a } from "./services/configService.js";
14
15
  import { useRecommendationExtensionStore as p } from "./store/recommendation.js";
15
- import { getDefaultTemplate as x } from "./templates/grid/template.js";
16
+ import { getDefaultTemplate as q } from "./templates/grid/template.js";
16
17
  import { useRecommendationBlockWarning as F } from "./useRecommendationBlockWarning.js";
17
- import { registerNodeConfigWriter as y, readBlockNodeConfigs as $ } from "./utils/nodeConfigWriter.js";
18
- import { refreshArrivedStrategyBlocks as q, resolveSourceConfig as L, refreshDuplicatedStrategyBlocks as P } from "./utils/strategyCommit.js";
19
- const k = D.Recommendation, h = "recommendation-block-v2", C = "hide-price";
18
+ import { registerNodeConfigWriter as y, readBlockNodeConfigs as L } from "./utils/nodeConfigWriter.js";
19
+ import { refreshArrivedStrategyBlocks as P, resolveSourceConfig as V, refreshDuplicatedStrategyBlocks as W } from "./utils/strategyCommit.js";
20
+ const k = E.Recommendation, h = "recommendation-block-v2", C = "hide-price";
20
21
  let B = !1;
21
- class se extends S {
22
+ class ae extends S {
22
23
  constructor() {
23
24
  super();
24
25
  /**
@@ -52,7 +53,7 @@ class se extends S {
52
53
  );
53
54
  }
54
55
  getSettingsPanelTitleHtml() {
55
- return E(
56
+ return D(
56
57
  k,
57
58
  this.api.translate("Recommendation Block"),
58
59
  this.api.translate("This block is switched from the Old Version to the New Version. We recommend you check the Recommendation block and test your message to ensure it works properly.")
@@ -76,7 +77,7 @@ class se extends S {
76
77
  */
77
78
  getTemplate() {
78
79
  const e = this._generateNextId();
79
- return this._pendingBlockId = e, x(e);
80
+ return this._pendingBlockId = e, q(e);
80
81
  }
81
82
  /**
82
83
  * Called when a new block is dropped into the template
@@ -110,7 +111,7 @@ class se extends S {
110
111
  e,
111
112
  {
112
113
  recommendationId: i,
113
- configVersion: r ? N : M,
114
+ configVersion: r ? M : N,
114
115
  ...s ? { partnerName: g().partnerName.value } : {},
115
116
  // An RRS block picks a strategy, not an algorithm, and its algorithm control is
116
117
  // hidden. Keeping the `mostPopular` default would bake a most-popular feed URL
@@ -121,7 +122,7 @@ class se extends S {
121
122
  if (l.setCurrentBlock(i), this._stampHidePrice(e, n.priceHideIfSameAsDiscounted), o) {
122
123
  I(this.api);
123
124
  const d = this._getBlockElement(e);
124
- d && (R(this.api, d, !0), H({
125
+ d && (R(this.api, d, !0), O({
125
126
  currentNode: e,
126
127
  documentModifier: this.api.getDocumentModifier()
127
128
  }));
@@ -155,13 +156,13 @@ class se extends S {
155
156
  "Assign recommendation ID to legacy block"
156
157
  );
157
158
  }
158
- this._healLingeringDuplicate(e), a.needsMigration(e) && this._migrateFromLegacy(e), this._healHidePriceAttr(e), this._ensureMobileFitRule(e), this._syncHeightBound(e);
159
+ this._healLingeringDuplicate(e), a.needsMigration(e) && this._migrateFromLegacy(e), this._healHidePriceAttr(e), this._ensureMobileFitRule(e), this._syncHeightBound(e), this._ensureTextTrimCss(e);
159
160
  try {
160
161
  B || (I(this.api), B = !0);
161
162
  const t = a.getConfig(e), i = this._getBlockElement(e);
162
163
  if (i) {
163
164
  const r = !t.mobileLayoutEnabled;
164
- T(i) !== r && R(this.api, i, r);
165
+ x(i) !== r && R(this.api, i, r);
165
166
  }
166
167
  } catch {
167
168
  }
@@ -179,7 +180,15 @@ class se extends S {
179
180
  }
180
181
  _ensureMobileFitRule(e) {
181
182
  try {
182
- w(this.api, e);
183
+ T(this.api, e);
184
+ } catch {
185
+ }
186
+ }
187
+ // A migrated block arrives with trimmed cells but without the stylesheet rules the toggle would have added.
188
+ _ensureTextTrimCss(e) {
189
+ var t;
190
+ try {
191
+ (t = this._getBlockElement(e)) != null && t.querySelector(`.${H}`) && $(this.api);
183
192
  } catch {
184
193
  }
185
194
  }
@@ -187,7 +196,7 @@ class se extends S {
187
196
  const t = this._getBlockElement(e);
188
197
  if (t)
189
198
  try {
190
- O(this.api, t);
199
+ w(this.api, t);
191
200
  } catch {
192
201
  }
193
202
  }
@@ -270,7 +279,7 @@ class se extends S {
270
279
  const d = { strategyId: l.strategyId };
271
280
  return t.add(n), this._refreshClaims.set(n, d), [{ id: n, config: l, claim: d }];
272
281
  });
273
- i.length && q(i.map(({ id: r, config: s }) => ({ id: r, config: s }))).catch((r) => console.error("[recommendation] refreshing an arrived strategy failed", r)).finally(() => i.forEach(({ id: r, claim: s }) => this._releaseRefreshClaim(r, s)));
282
+ i.length && P(i.map(({ id: r, config: s }) => ({ id: r, config: s }))).catch((r) => console.error("[recommendation] refreshing an arrived strategy failed", r)).finally(() => i.forEach(({ id: r, claim: s }) => this._releaseRefreshClaim(r, s)));
274
283
  }
275
284
  /**
276
285
  * A new document reports each block to onCreated and onDocumentInit, not always in one batch, so a
@@ -282,7 +291,7 @@ class se extends S {
282
291
  return !0;
283
292
  if (i.strategyId === t)
284
293
  return !1;
285
- const r = $(e);
294
+ const r = L(e);
286
295
  return r.length > 0 && r.every((s) => s.strategyId === t);
287
296
  }
288
297
  _releaseRefreshClaim(e, t) {
@@ -344,10 +353,10 @@ class se extends S {
344
353
  if (r.cloneBlockState(t, i), r.setCurrentBlock(i), g().isFeatureEnabled("reusableRecommendationStrategy")) {
345
354
  this._resetSourceIds.add(t), y(this.api);
346
355
  const s = a.getConfig(e), n = [
347
- { id: t, claim: { strategyId: L(t, s).strategyId } },
356
+ { id: t, claim: { strategyId: V(t, s).strategyId } },
348
357
  { id: i, claim: { strategyId: s.strategyId } }
349
358
  ].filter(({ id: o }) => !this._refreshClaims.has(o));
350
- n.forEach(({ id: o, claim: l }) => this._refreshClaims.set(o, l)), P(t, i, s).catch((o) => console.error("[recommendation] refreshing a duplicated strategy failed", o)).finally(() => n.forEach(({ id: o, claim: l }) => this._releaseRefreshClaim(o, l)));
359
+ n.forEach(({ id: o, claim: l }) => this._refreshClaims.set(o, l)), W(t, i, s).catch((o) => console.error("[recommendation] refreshing a duplicated strategy failed", o)).finally(() => n.forEach(({ id: o, claim: l }) => this._releaseRefreshClaim(o, l)));
351
360
  }
352
361
  this._warnIfMultipleBlocks();
353
362
  }
@@ -451,5 +460,5 @@ class se extends S {
451
460
  }
452
461
  export {
453
462
  k as BLOCK_ID,
454
- se as RecommendationBlock
463
+ ae as RecommendationBlock
455
464
  };