@useinsider/guido 3.30.1 → 3.30.2-beta.1e7c743

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/README.md +12 -1
  2. package/dist/components/Guido.vue.js +5 -5
  3. package/dist/components/Guido.vue2.js +115 -109
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +1 -1
  5. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +54 -48
  6. package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.js +17 -0
  7. package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue2.js +30 -0
  8. package/dist/composables/useModuleRepair.js +56 -50
  9. package/dist/composables/useStripo.js +87 -79
  10. package/dist/config/migrator/index.js +14 -13
  11. package/dist/config/migrator/recommendation/cssCascade.js +84 -0
  12. package/dist/config/migrator/recommendation/extractors.js +195 -89
  13. package/dist/config/migrator/recommendation/themeMapper.js +33 -21
  14. package/dist/config/migrator/recommendationMigrator.js +70 -63
  15. package/dist/config/migrator/sfmcUnsubscribeTextMigrator.js +20 -0
  16. package/dist/enums/academy.js +2 -1
  17. package/dist/guido.css +1 -1
  18. package/dist/package.json.js +2 -2
  19. package/dist/src/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.d.ts +2 -0
  20. package/dist/src/composables/useModuleRepair.d.ts +1 -1
  21. package/dist/src/config/migrator/index.d.ts +1 -1
  22. package/dist/src/config/migrator/recommendation/cssCascade.d.ts +24 -0
  23. package/dist/src/config/migrator/recommendation/extractors.d.ts +18 -1
  24. package/dist/src/config/migrator/recommendationMigrator.d.ts +2 -1
  25. package/dist/src/config/migrator/sfmcUnsubscribeTextMigrator.d.ts +1 -0
  26. package/dist/src/enums/academy.d.ts +1 -0
  27. package/dist/src/stores/editor.d.ts +54 -0
  28. package/dist/src/utils/legacyUnsubscribeConversion.d.ts +3 -0
  29. package/dist/stores/editor.js +2 -0
  30. package/dist/utils/legacyUnsubscribeConversion.js +69 -28
  31. package/package.json +1 -1
@@ -1,114 +1,220 @@
1
- import { CURRENCY_ATTR as l, CSS_CLASS_SKIP_COMPILE as m } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
- const a = "You May Also Like!";
3
- function C(e) {
4
- var n;
5
- const r = e.querySelector(".ext-recommendation-title");
6
- if (!r)
7
- return a;
8
- const t = (n = r.textContent) == null ? void 0 : n.trim();
9
- return t && t.length > 0 ? t : a;
10
- }
11
- function A(e) {
12
- const r = e.querySelector(".ext-recommendation-title");
13
- return r ? !/display\s*:\s*none/i.test(r.getAttribute("style") ?? "") : !1;
14
- }
15
- function _(e) {
16
- var t;
17
- const r = e.querySelector(".ext-recommendation-title");
18
- return !!r && !((t = r == null ? void 0 : r.textContent) != null && t.trim());
19
- }
20
- function E(e) {
21
- const r = e.querySelector(".ext-product-price"), t = e.querySelector(".ext-product-original-price");
22
- return !r || !t ? !1 : r.compareDocumentPosition(t) === Node.DOCUMENT_POSITION_PRECEDING;
23
- }
24
- function d(e) {
25
- return /(?:^|;)\s*display\s*:\s*table-cell/i.test(e.getAttribute("style") ?? "");
26
- }
27
- function T(e) {
28
- var n, o;
29
- const r = (n = e.querySelector(".ext-product-price")) == null ? void 0 : n.closest("tr"), t = (o = e.querySelector(".ext-product-original-price")) == null ? void 0 : o.closest("tr");
30
- return !r || !t || r === t ? !1 : !d(r) && !d(t);
31
- }
32
- const p = /* @__PURE__ */ new Map([
1
+ import { CURRENCY_ATTR as h, CSS_CLASS_SKIP_COMPILE as A } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
2
+ import { resolveDeclaredStyle as S } from "./cssCascade.js";
3
+ const C = "You May Also Like!";
4
+ function $(t) {
5
+ var r;
6
+ const o = t.querySelector(".ext-recommendation-title");
7
+ if (!o)
8
+ return C;
9
+ const e = (r = o.textContent) == null ? void 0 : r.trim();
10
+ return e && e.length > 0 ? e : C;
11
+ }
12
+ function j(t) {
13
+ const o = t.querySelector(".ext-recommendation-title");
14
+ return o ? !/display\s*:\s*none/i.test(o.getAttribute("style") ?? "") : !1;
15
+ }
16
+ function H(t) {
17
+ var e;
18
+ const o = t.querySelector(".ext-recommendation-title");
19
+ return !!o && !((e = o == null ? void 0 : o.textContent) != null && e.trim());
20
+ }
21
+ function W(t) {
22
+ const o = t.querySelector(".ext-product-price"), e = t.querySelector(".ext-product-original-price");
23
+ return !o || !e ? !1 : o.compareDocumentPosition(e) === Node.DOCUMENT_POSITION_PRECEDING;
24
+ }
25
+ function x(t) {
26
+ return /(?:^|;)\s*display\s*:\s*table-cell/i.test(t.getAttribute("style") ?? "");
27
+ }
28
+ function X(t) {
29
+ var r, n;
30
+ const o = (r = t.querySelector(".ext-product-price")) == null ? void 0 : r.closest("tr"), e = (n = t.querySelector(".ext-product-original-price")) == null ? void 0 : n.closest("tr");
31
+ return !o || !e || o === e ? !1 : !x(o) && !x(e);
32
+ }
33
+ const L = /* @__PURE__ */ new Map([
33
34
  ["p_name", ".ext-product-name p"],
34
35
  ["p_price", ".ext-product-price p"],
35
36
  ["p_original_price", ".ext-product-original-price p"]
36
37
  ]);
37
- function f(e) {
38
- const r = ((e == null ? void 0 : e.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
39
- return (r == null ? void 0 : r[1].trim()) || void 0;
40
- }
41
- const x = "ins-trim-text";
42
- function h(e, r) {
43
- return e == null ? void 0 : e.map((t) => {
44
- var s, u;
45
- const n = p.get(t.variable ?? "");
46
- if (!n)
47
- return t;
48
- const o = r.querySelector(n), c = (u = (s = t.theme) == null ? void 0 : s.textColor) != null && u.color ? void 0 : f(o), i = t.variable === "p_name" && (o == null ? void 0 : o.classList.contains(x));
49
- return !c && !i ? t : {
50
- ...t,
38
+ function R(t) {
39
+ const o = ((t == null ? void 0 : t.getAttribute("style")) ?? "").match(/(?:^|;)\s*color\s*:\s*([^;]+)/i);
40
+ return (o == null ? void 0 : o[1].trim()) || void 0;
41
+ }
42
+ const O = "ins-trim-text";
43
+ function z(t, o) {
44
+ return t == null ? void 0 : t.map((e) => {
45
+ var s, d;
46
+ const r = L.get(e.variable ?? "");
47
+ if (!r)
48
+ return e;
49
+ const n = o.querySelector(r), i = (d = (s = e.theme) == null ? void 0 : s.textColor) != null && d.color ? void 0 : R(n), c = e.variable === "p_name" && (n == null ? void 0 : n.classList.contains(O));
50
+ return !i && !c ? e : {
51
+ ...e,
51
52
  theme: {
52
- ...t.theme,
53
- ...c ? { textColor: { color: c } } : {},
54
- ...i ? { textTrimming: !0 } : {}
53
+ ...e.theme,
54
+ ...i ? { textColor: { color: i } } : {},
55
+ ...c ? { textTrimming: !0 } : {}
55
56
  }
56
57
  };
57
58
  });
58
59
  }
59
- function R(e) {
60
- const r = [
61
- e,
62
- ...Array.from(e.querySelectorAll(".product-card, .ext-recommendation-card"))
60
+ const w = /^(?:#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([\d.,\s%]+\)|[a-z]+)$/i, B = new Set(
61
+ ["none", "transparent", "inherit", "initial", "unset", "revert", "currentColor"].map((t) => t.toLowerCase())
62
+ ), P = /^(\d+(?:\.\d+)?)(?:px)?$/i, I = /* @__PURE__ */ new Set([
63
+ "none",
64
+ "hidden",
65
+ "dotted",
66
+ "dashed",
67
+ "solid",
68
+ "double",
69
+ "groove",
70
+ "ridge",
71
+ "inset",
72
+ "outset"
73
+ ]), N = /\s/, D = ["padding-top", "padding-right", "padding-bottom", "padding-left"];
74
+ function p(t, o) {
75
+ var e;
76
+ return (e = t.get(o)) == null ? void 0 : e.value;
77
+ }
78
+ function m(t) {
79
+ return t && w.test(t) && !B.has(t.toLowerCase()) ? t : void 0;
80
+ }
81
+ function T(t) {
82
+ return (t == null ? void 0 : t.toLowerCase()) === "transparent" ? "transparent" : m(t);
83
+ }
84
+ function f(t) {
85
+ const o = t == null ? void 0 : t.match(P);
86
+ return (o == null ? void 0 : o[1]) !== void 0 ? Number(o[1]) : void 0;
87
+ }
88
+ function y(t) {
89
+ const o = t == null ? void 0 : t.toLowerCase();
90
+ return o && I.has(o) ? o : void 0;
91
+ }
92
+ function _(t) {
93
+ let o = 0;
94
+ return Array.from(t).reduce((r, n) => (n === "(" ? o += 1 : n === ")" && o > 0 && (o -= 1), o === 0 && N.test(n) ? r.push("") : r[r.length - 1] += n, r), [""]).filter(Boolean);
95
+ }
96
+ function E(t, o) {
97
+ const e = _(t ?? "").map(o);
98
+ if (e.length === 0 || e.length > 4 || e.some((s) => s === void 0))
99
+ return;
100
+ const [r, n = r, i = r, c = n] = e;
101
+ return { top: r, right: n, bottom: i, left: c };
102
+ }
103
+ function k(t) {
104
+ const o = t.get("padding"), e = o ? E(o.value, f) : void 0, r = ["top", "right", "bottom", "left"], [n, i, c, s] = D.map((d, l) => {
105
+ const u = t.get(d);
106
+ return u && u.position > ((o == null ? void 0 : o.position) ?? -1) ? f(u.value) : e == null ? void 0 : e[r[l]];
107
+ });
108
+ if (!(n === void 0 || i === void 0 || c === void 0 || s === void 0))
109
+ return { top: n, right: i, bottom: c, left: s };
110
+ }
111
+ function q(t) {
112
+ return t === void 0 ? void 0 : { top: t, right: t, bottom: t, left: t };
113
+ }
114
+ function Y(t) {
115
+ return _(t ?? "").reduce((e, r) => {
116
+ const n = f(r), i = y(r), c = T(r);
117
+ if (e) {
118
+ if (n !== void 0 && e.width === void 0)
119
+ return { ...e, width: n };
120
+ if (i && !e.style)
121
+ return { ...e, style: i };
122
+ if (c && !e.color)
123
+ return { ...e, color: c };
124
+ }
125
+ }, {}) ?? {};
126
+ }
127
+ function g(t, o, e, r) {
128
+ var s, d;
129
+ const n = E(p(t, o), e), i = q(r);
130
+ return (((s = t.get(o)) == null ? void 0 : s.position) ?? -1) > (((d = t.get("border")) == null ? void 0 : d.position) ?? -1) ? n ?? i : i ?? n;
131
+ }
132
+ function M(t) {
133
+ const o = Y(p(t, "border")), e = g(t, "border-width", f, o.width);
134
+ if (!e)
135
+ return;
136
+ const r = g(t, "border-style", y, o.style), n = g(t, "border-color", T, o.color);
137
+ return {
138
+ width: e,
139
+ ...r ? { style: r } : {},
140
+ ...n ? { color: n } : {}
141
+ };
142
+ }
143
+ function b(t) {
144
+ const [o] = ["background", "background-color"].filter((e) => t.has(e)).sort((e, r) => {
145
+ var n, i;
146
+ return (((n = t.get(r)) == null ? void 0 : n.position) ?? -1) - (((i = t.get(e)) == null ? void 0 : i.position) ?? -1);
147
+ });
148
+ return o ? m(p(t, o)) : void 0;
149
+ }
150
+ function G(t, o = {}, e = []) {
151
+ var u, a;
152
+ const r = S(t.querySelector(".ext-product-button a.es-button"), e), n = S(t.querySelector(".ext-product-button .es-button-border"), e), i = {}, c = (u = o.buttonColor) != null && u.color ? void 0 : b(n) ?? b(r), s = (a = o.textButtonColor) != null && a.color ? void 0 : m(p(r, "color")), d = o.buttonBorder === void 0 ? M(n) : void 0, l = k(r);
153
+ return c && (i.buttonColor = { color: c }), s && (i.textButtonColor = { color: s }), d && (i.buttonBorder = d), l && (i.buttonInternalPadding = { desktop: l }), i;
154
+ }
155
+ function v(t, o, e = []) {
156
+ return t == null ? void 0 : t.map((r) => {
157
+ if (r.variable !== "p_button")
158
+ return r;
159
+ const n = G(o, r.theme ?? {}, e);
160
+ return Object.keys(n).length === 0 ? r : { ...r, theme: { ...r.theme, ...n } };
161
+ });
162
+ }
163
+ function J(t) {
164
+ const o = [
165
+ t,
166
+ ...Array.from(t.querySelectorAll(".product-card, .ext-recommendation-card"))
63
167
  ];
64
- let t = "";
65
- return r.some((n) => {
66
- const o = n.getAttribute("bgcolor");
67
- if (o && o.trim())
68
- return t = o.trim(), !0;
69
- const i = (n.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
70
- return i && i[1] ? (t = i[1].trim(), !0) : !1;
71
- }), t;
72
- }
73
- function L(e) {
74
- const r = e.getAttribute(l.CURRENCY), t = e.getAttribute(l.SYMBOL);
168
+ let e = "";
169
+ return o.some((r) => {
170
+ const n = r.getAttribute("bgcolor");
171
+ if (n && n.trim())
172
+ return e = n.trim(), !0;
173
+ const c = (r.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
174
+ return c && c[1] ? (e = c[1].trim(), !0) : !1;
175
+ }), e;
176
+ }
177
+ function Q(t) {
178
+ const o = t.getAttribute(h.CURRENCY), e = t.getAttribute(h.SYMBOL);
75
179
  return {
76
- ...r ? { value: r } : {},
180
+ ...o ? { value: o } : {},
77
181
  // An empty `currency-symbol` is omitted so `mapCurrency` falls back to
78
182
  // the currency code as the symbol.
79
- ...t ? { symbol: t } : {},
183
+ ...e ? { symbol: e } : {},
80
184
  alignment: 1,
81
185
  decimalCount: "2",
82
186
  decimalSeparator: ",",
83
187
  thousandSeparator: "."
84
188
  };
85
189
  }
86
- const S = /^es-p(\d+)([trbl]?)$/, g = { t: "top", r: "right", b: "bottom", l: "left" };
87
- function P(e) {
88
- const r = e.querySelector("td.esd-structure.esd-extension-internal-block");
89
- if (!r)
190
+ const F = /^es-p(\d+)([trbl]?)$/, K = { t: "top", r: "right", b: "bottom", l: "left" };
191
+ function Z(t) {
192
+ const o = t.querySelector("td.esd-structure.esd-extension-internal-block");
193
+ if (!o)
90
194
  return;
91
- const t = { top: 0, right: 0, bottom: 0, left: 0 };
92
- return r.classList.forEach((n) => {
93
- const o = n.match(S);
94
- if (!o)
195
+ const e = { top: 0, right: 0, bottom: 0, left: 0 };
196
+ return o.classList.forEach((r) => {
197
+ const n = r.match(F);
198
+ if (!n)
95
199
  return;
96
- const c = Number(o[1]), i = o[2];
97
- i ? t[g[i]] = c : Object.assign(t, { top: c, right: c, bottom: c, left: c });
98
- }), t;
200
+ const i = Number(n[1]), c = n[2];
201
+ c ? e[K[c]] = i : Object.assign(e, { top: i, right: i, bottom: i, left: i });
202
+ }), e;
99
203
  }
100
- function I(e) {
101
- return e.classList.contains(m);
204
+ function tt(t) {
205
+ return t.classList.contains(A);
102
206
  }
103
207
  export {
104
- R as extractCardBgColor,
105
- L as extractCurrencyFromBlock,
106
- P as extractRenderedBlockPadding,
107
- C as extractTitleText,
108
- _ as hasEmptyTitle,
109
- A as hasVisibleTitle,
110
- E as isOldPriceFirst,
111
- I as isPartnerManagedBlock,
112
- T as isPriceOnNextLine,
113
- h as withRenderedTextTheme
208
+ J as extractCardBgColor,
209
+ Q as extractCurrencyFromBlock,
210
+ Z as extractRenderedBlockPadding,
211
+ G as extractRenderedButtonTheme,
212
+ $ as extractTitleText,
213
+ H as hasEmptyTitle,
214
+ j as hasVisibleTitle,
215
+ W as isOldPriceFirst,
216
+ tt as isPartnerManagedBlock,
217
+ X as isPriceOnNextLine,
218
+ v as withRenderedButtonTheme,
219
+ z as withRenderedTextTheme
114
220
  };
@@ -16,21 +16,21 @@ function P(n) {
16
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;
17
17
  return t === 0 && o === 0 && i === 0 && l === 0 ? null : `${t}px ${o}px ${i}px ${l}px`;
18
18
  }
19
- function z(n) {
19
+ function C(n) {
20
20
  if (!n)
21
21
  return null;
22
22
  const { top: t, right: o, bottom: i, left: l } = n;
23
23
  return t === void 0 ? null : t === o && t === i && t === l ? t : null;
24
24
  }
25
25
  function $(n, t, o, i) {
26
- const l = z(o);
26
+ const l = C(o);
27
27
  if (l !== null) {
28
28
  r(n, `border-${t}`, i(l));
29
29
  return;
30
30
  }
31
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));
32
32
  }
33
- function D(n) {
33
+ function I(n) {
34
34
  if (!n)
35
35
  return null;
36
36
  const t = x(n.radius ?? n.borderRadius);
@@ -42,14 +42,14 @@ function D(n) {
42
42
  }
43
43
  return null;
44
44
  }
45
- function I(n) {
45
+ function v(n) {
46
46
  var t, o;
47
47
  return ((t = n.textLineSpacing) == null ? void 0 : t.lineSpacing) ?? ((o = n.textLineSpacing) == null ? void 0 : o["font-lineSpacing"]);
48
48
  }
49
49
  function N(n) {
50
- var u, s, a, d, g, b, p, y;
50
+ var u, s, a, d, g, p, b, y;
51
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), {
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", (p = n == null ? void 0 : n.textStyle) == null ? void 0 : p["font-family"]), r(o, "font-size", (b = n == null ? void 0 : n.textStyle) == null ? void 0 : b["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", v(n ?? {})), r(o, "text-align", i), {
53
53
  tdStyle: t.join("; "),
54
54
  pStyle: o.join("; "),
55
55
  align: i || void 0,
@@ -59,47 +59,59 @@ function N(n) {
59
59
  };
60
60
  }
61
61
  function E(n) {
62
- var s, a, d, g, b, p, y, k, w, B, T, j;
62
+ var s, a, d, g, p, b, y, k, w, B, j, T;
63
63
  const t = [], o = [], i = [];
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"]);
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", (p = n == null ? void 0 : n.buttonStyle) == null ? void 0 : p["font-weight"]), r(i, "font-style", (b = n == null ? void 0 : n.buttonStyle) == null ? void 0 : b["font-style"]);
65
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);
66
+ r(o, "background", l), r(i, "background", l), r(i, "color", f), r(i, "mso-border-alt", l ? `10px solid ${l}` : void 0);
67
67
  const c = n == null ? void 0 : n.buttonBorder;
68
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));
69
+ const u = I((n == null ? void 0 : n.buttonBorderRadius) ?? (n == null ? void 0 : n.borderRadius));
70
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")), {
71
71
  tdStyle: t.join("; "),
72
- align: ((T = n == null ? void 0 : n.buttonAlign) == null ? void 0 : T.align) || void 0,
72
+ align: ((j = n == null ? void 0 : n.buttonAlign) == null ? void 0 : j.align) || void 0,
73
73
  spanStyle: o.join("; "),
74
74
  aStyle: i.join("; "),
75
- text: (j = n == null ? void 0 : n.buttonText) == null ? void 0 : j.text
75
+ text: (T = n == null ? void 0 : n.buttonText) == null ? void 0 : T.text
76
76
  };
77
77
  }
78
- function L(n) {
78
+ function R(n) {
79
79
  var t, o;
80
80
  return {
81
81
  width: x((t = n == null ? void 0 : n.imageSize) == null ? void 0 : t.width),
82
82
  height: x((o = n == null ? void 0 : n.imageSize) == null ? void 0 : o.height)
83
83
  };
84
84
  }
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) {
85
+ const A = /* @__PURE__ */ new Set([5, 10, 15, 20, 25, 30, 35, 40]), L = [["t", "top"], ["r", "right"], ["b", "bottom"], ["l", "left"]];
86
+ function _(n) {
87
87
  if (!n)
88
88
  return;
89
89
  const t = [], o = [];
90
- return C.forEach(([i, l]) => {
90
+ return L.forEach(([i, l]) => {
91
91
  const f = x(n[l] ?? n.all) ?? 0;
92
92
  A.has(f) ? t.push(`es-p${f}${i}`) : f > 0 && o.push(`padding-${l}: ${f}px`);
93
93
  }), { classes: t.join(" "), style: o.join("; ") };
94
94
  }
95
- function v(n, t) {
95
+ function z(n) {
96
+ return n.split(";").map((t) => t.trim()).filter(Boolean);
97
+ }
98
+ function D(n) {
99
+ const t = n.indexOf(":");
100
+ return (t === -1 ? n : n.slice(0, t)).trim().toLowerCase();
101
+ }
102
+ function F(n, t) {
96
103
  const o = (n ?? "").trim().replace(/;$/, "").trim(), i = (t ?? "").trim().replace(/;$/, "").trim();
97
- return o ? i ? `${o}; ${i}` : o : i;
104
+ if (!o)
105
+ return i;
106
+ if (!i)
107
+ return o;
108
+ const l = new Set(z(i).map(D)), f = z(o), c = f.filter((u) => !l.has(D(u)));
109
+ return c.length === f.length ? `${o}; ${i}` : c.length ? `${c.join("; ")}; ${i}` : i;
98
110
  }
99
111
  export {
100
- v as appendStyle,
101
- R as mapBlockPadding,
112
+ F as appendStyle,
113
+ _ as mapBlockPadding,
102
114
  E as mapButtonTheme,
103
- L as mapImageTheme,
115
+ R as mapImageTheme,
104
116
  N as mapTextTheme
105
117
  };
@@ -1,59 +1,65 @@
1
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";
2
+ import { DEFAULT_NODE_CONFIG as x } from "../../extensions/Blocks/Recommendation/constants/defaultConfig.js";
3
+ import { ATTR_PRODUCT_BUTTON as T, ATTR_RECOMMENDATION_TITLE as y } from "../../extensions/Blocks/Recommendation/constants/selectors.js";
4
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)
5
+ import { mapComposition as B } from "./recommendation/compositionMapper.js";
6
+ import { parseCssRules as S } from "./recommendation/cssCascade.js";
7
+ import { isPriceOnNextLine as E, extractCurrencyFromBlock as w, isOldPriceFirst as L, withRenderedButtonTheme as O, withRenderedTextTheme as P, extractRenderedButtonTheme as A, extractTitleText as H, hasEmptyTitle as N, hasVisibleTitle as F, extractCardBgColor as I, isPartnerManagedBlock as _, extractRenderedBlockPadding as D } from "./recommendation/extractors.js";
8
+ import { buildBlockHtml as $ } from "./recommendation/htmlBuilder.js";
9
+ import { parseRecommendationId as k, parseLegacyConfig as U } from "./recommendation/parseLegacyConfig.js";
10
+ import { mapSettings as V } from "./recommendation/settingsMapper.js";
11
+ import { mapButtonTheme as q, mapBlockPadding as G } from "./recommendation/themeMapper.js";
12
+ const j = '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)';
13
+ function K(a, e, m, c) {
14
+ var p, g, u;
15
+ const r = k(e);
16
+ if (r === null)
16
17
  return console.warn(
17
18
  "[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
18
19
  ), !1;
19
- const r = F(e);
20
- if (!r)
20
+ const o = U(e);
21
+ if (!o)
21
22
  return console.warn(
22
- `[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
23
+ `[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
23
24
  ), !1;
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,
25
+ const i = m[String(r)] ?? {}, s = {
26
+ ...i,
27
+ currencySettings: i.currencySettings ?? w(e),
28
+ isPriceMovedToNextLine: i.isPriceMovedToNextLine ?? E(e)
29
+ }, n = V(s, o, r), t = B(
30
+ O(P((p = o.composition) == null ? void 0 : p.variables, e), e, c),
31
+ { oldPriceFirst: L(e) }
32
+ );
33
+ if (t.perElementStyles[T] === void 0) {
34
+ const f = A(e, {}, c);
35
+ Object.keys(f).length > 0 && (t.perElementStyles[T] = q(f));
36
+ }
37
+ const v = H(e);
38
+ N(e) ? t.visibility[y] = !1 : t.titleVariable || (t.visibility[y] = F(e));
39
+ const R = I(e), h = {
40
+ ...n,
35
41
  strategyId: "",
36
- composition: i.composition,
37
- visibility: i.visibility,
38
- previousTitleHtml: C.previousTitleHtml,
39
- textTrimming: i.anyTextTrimming
40
- }, s = A(e), v = `
42
+ composition: t.composition,
43
+ visibility: t.visibility,
44
+ previousTitleHtml: x.previousTitleHtml,
45
+ textTrimming: t.anyTextTrimming
46
+ }, d = _(e), C = `
41
47
  <table>
42
48
  <tbody>
43
49
  <tr>
44
50
  <td class="esd-structure" align="left">
45
51
  <table width="100%" cellpadding="0" cellspacing="0">
46
52
  <tbody>
47
- <tr>${N({
48
- nodeConfig: T,
49
- composition: i,
50
- cardBg: y,
51
- titleText: u,
53
+ <tr>${$({
54
+ nodeConfig: h,
55
+ composition: t,
56
+ cardBg: R,
57
+ titleText: v,
52
58
  legacyId: e.getAttribute("id") ?? void 0,
53
59
  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))
60
+ preserveInnerHtml: d ? e.innerHTML : void 0,
61
+ skipCompile: d,
62
+ blockPadding: G(((u = (g = o.theme) == null ? void 0 : g.blockPadding) == null ? void 0 : u.desktop) ?? D(e))
57
63
  })}</tr>
58
64
  </tbody>
59
65
  </table>
@@ -61,40 +67,41 @@ function $(c, e, m) {
61
67
  </tr>
62
68
  </tbody>
63
69
  </table>
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);
70
+ `, l = a.parseFromString(C, "text/html").querySelector("td.esd-structure");
71
+ return !l || !e.parentNode ? (console.warn(
72
+ `[RecommendationMigrator] Aborting block id=${r} — failed to construct new HTML element`
73
+ ), !1) : (e.parentNode.replaceChild(l, e), !0);
68
74
  }
69
- function X(c, e = {}) {
70
- const m = new DOMParser();
71
- let t;
75
+ function ae(a, e = {}, m = "") {
76
+ const c = new DOMParser();
77
+ let r;
72
78
  try {
73
- t = m.parseFromString(c, "text/html");
79
+ r = c.parseFromString(a, "text/html");
74
80
  } catch (n) {
75
- return console.error("[RecommendationMigrator] Failed to parse template:", n), c;
81
+ return console.error("[RecommendationMigrator] Failed to parse template:", n), a;
76
82
  }
77
- const r = Array.from(t.querySelectorAll(k));
83
+ const o = Array.from(r.querySelectorAll(j));
78
84
  try {
79
- M().$patch((a) => {
80
- a.migrations = {
81
- ...a.migrations,
82
- [b.Recommendation]: r.length
85
+ M().$patch((t) => {
86
+ t.migrations = {
87
+ ...t.migrations,
88
+ [b.Recommendation]: o.length
83
89
  };
84
90
  });
85
91
  } catch {
86
92
  }
87
- if (r.length === 0)
88
- return c;
89
- let o = 0;
90
- return r.forEach((n) => {
93
+ if (o.length === 0)
94
+ return a;
95
+ let i = 0;
96
+ const s = S(m);
97
+ return o.forEach((n) => {
91
98
  try {
92
- $(m, n, e) && (o += 1);
93
- } catch (a) {
94
- console.error("[RecommendationMigrator] Unexpected error migrating block:", a);
99
+ K(c, n, e, s) && (i += 1);
100
+ } catch (t) {
101
+ console.error("[RecommendationMigrator] Unexpected error migrating block:", t);
95
102
  }
96
- }), o > 0 && console.info(`[RecommendationMigrator] Migrated ${o} legacy Recommendation block(s)`), t.documentElement.outerHTML;
103
+ }), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), r.documentElement.outerHTML;
97
104
  }
98
105
  export {
99
- X as migrateRecommendation
106
+ ae as migrateRecommendation
100
107
  };
@@ -0,0 +1,20 @@
1
+ import { useConfigStore as s } from "../../stores/config.js";
2
+ import { useEditorStore as n } from "../../stores/editor.js";
3
+ import { hasAnyUnsubscribeClass as i, convertAllUnsubscribeInDocumentHtml as c } from "../../utils/legacyUnsubscribeConversion.js";
4
+ const a = (r) => {
5
+ try {
6
+ if (!i(r) || !s().isFeatureEnabled("blockUnsubscribeLinks"))
7
+ return r;
8
+ const { html: e, converted: o } = c(r);
9
+ if (o) {
10
+ const t = n();
11
+ t.isSfmcUnsubscribeModalRequested = !0, t.isUnsubscribeConvertedOnLoad = !0;
12
+ }
13
+ return e;
14
+ } catch (e) {
15
+ return console.error("SfmcUnsubscribeTextMigrator failed:", e), r;
16
+ }
17
+ };
18
+ export {
19
+ a as migrateSfmcUnsubscribeText
20
+ };
@@ -4,7 +4,8 @@ const e = "https://academy.insiderone.com", o = {
4
4
  AMP_FOR_EMAILS: `${e}/docs/amp-for-emails`,
5
5
  EMAIL_DISPLAY_CONDITIONS: `${e}/docs/new-editor-add-display-conditions-to-an-email`,
6
6
  EMAIL_RECOMMENDATION_BLOCK: `${e}/docs/new-editor-email-recommendation-block`,
7
- LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`
7
+ LEGACY_UNSUBSCRIBE_MODULE: `${e}/docs/new-editor-add-unsubscribe-pages-into-emails`,
8
+ SFMC_RELAY: `${e}/docs/sfmc-relay`
8
9
  };
9
10
  export {
10
11
  o as ACADEMY_LINKS