@useinsider/guido 3.30.1 → 3.30.2-beta.140686d
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.
- package/README.md +12 -1
- package/dist/components/Guido.vue.js +5 -5
- package/dist/components/Guido.vue2.js +115 -109
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +1 -1
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +54 -48
- package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.js +17 -0
- package/dist/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue2.js +30 -0
- package/dist/composables/useModuleRepair.js +56 -50
- package/dist/composables/useStripo.js +87 -79
- package/dist/config/migrator/index.js +14 -13
- package/dist/config/migrator/recommendation/cssCascade.js +84 -0
- package/dist/config/migrator/recommendation/extractors.js +195 -89
- package/dist/config/migrator/recommendation/themeMapper.js +33 -21
- package/dist/config/migrator/recommendationMigrator.js +70 -63
- package/dist/config/migrator/sfmcUnsubscribeTextMigrator.js +20 -0
- package/dist/enums/academy.js +2 -1
- package/dist/guido.css +1 -1
- package/dist/package.json.js +2 -2
- package/dist/src/components/organisms/unsubscribe/SfmcUnsubscribeConvertedModal.vue.d.ts +2 -0
- package/dist/src/composables/useModuleRepair.d.ts +1 -1
- package/dist/src/config/migrator/index.d.ts +1 -1
- package/dist/src/config/migrator/recommendation/cssCascade.d.ts +24 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +18 -1
- package/dist/src/config/migrator/recommendationMigrator.d.ts +2 -1
- package/dist/src/config/migrator/sfmcUnsubscribeTextMigrator.d.ts +1 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/stores/editor.d.ts +54 -0
- package/dist/src/utils/legacyUnsubscribeConversion.d.ts +3 -0
- package/dist/stores/editor.js +2 -0
- package/dist/utils/legacyUnsubscribeConversion.js +69 -28
- package/package.json +1 -1
|
@@ -1,114 +1,220 @@
|
|
|
1
|
-
import { CURRENCY_ATTR as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
38
|
-
const
|
|
39
|
-
return (
|
|
40
|
-
}
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
return
|
|
44
|
-
var s,
|
|
45
|
-
const
|
|
46
|
-
if (!
|
|
47
|
-
return
|
|
48
|
-
const
|
|
49
|
-
return !
|
|
50
|
-
...
|
|
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
|
-
...
|
|
53
|
-
...
|
|
54
|
-
...
|
|
53
|
+
...e.theme,
|
|
54
|
+
...i ? { textColor: { color: i } } : {},
|
|
55
|
+
...c ? { textTrimming: !0 } : {}
|
|
55
56
|
}
|
|
56
57
|
};
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
65
|
-
return
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
return
|
|
69
|
-
const
|
|
70
|
-
return
|
|
71
|
-
}),
|
|
72
|
-
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
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
|
-
...
|
|
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
|
-
...
|
|
183
|
+
...e ? { symbol: e } : {},
|
|
80
184
|
alignment: 1,
|
|
81
185
|
decimalCount: "2",
|
|
82
186
|
decimalSeparator: ",",
|
|
83
187
|
thousandSeparator: "."
|
|
84
188
|
};
|
|
85
189
|
}
|
|
86
|
-
const
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
if (!
|
|
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
|
|
92
|
-
return
|
|
93
|
-
const
|
|
94
|
-
if (!
|
|
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
|
|
97
|
-
|
|
98
|
-
}),
|
|
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
|
|
101
|
-
return
|
|
204
|
+
function tt(t) {
|
|
205
|
+
return t.classList.contains(A);
|
|
102
206
|
}
|
|
103
207
|
export {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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
|
|
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,
|
|
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", (
|
|
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,
|
|
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", (
|
|
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 =
|
|
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: ((
|
|
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: (
|
|
75
|
+
text: (T = n == null ? void 0 : n.buttonText) == null ? void 0 : T.text
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
|
-
function
|
|
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]),
|
|
86
|
-
function
|
|
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
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
101
|
-
|
|
112
|
+
F as appendStyle,
|
|
113
|
+
_ as mapBlockPadding,
|
|
102
114
|
E as mapButtonTheme,
|
|
103
|
-
|
|
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
|
|
3
|
-
import { ATTR_RECOMMENDATION_TITLE as
|
|
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
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
20
|
-
if (!
|
|
20
|
+
const o = U(e);
|
|
21
|
+
if (!o)
|
|
21
22
|
return console.warn(
|
|
22
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
23
|
+
`[RecommendationMigrator] Aborting block id=${r} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
23
24
|
), !1;
|
|
24
|
-
const
|
|
25
|
-
...
|
|
26
|
-
currencySettings:
|
|
27
|
-
isPriceMovedToNextLine:
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
{ oldPriceFirst:
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
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:
|
|
37
|
-
visibility:
|
|
38
|
-
previousTitleHtml:
|
|
39
|
-
textTrimming:
|
|
40
|
-
},
|
|
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>${
|
|
48
|
-
nodeConfig:
|
|
49
|
-
composition:
|
|
50
|
-
cardBg:
|
|
51
|
-
titleText:
|
|
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:
|
|
55
|
-
skipCompile:
|
|
56
|
-
blockPadding:
|
|
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
|
-
`,
|
|
65
|
-
return !
|
|
66
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
67
|
-
), !1) : (e.parentNode.replaceChild(
|
|
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
|
|
70
|
-
const
|
|
71
|
-
let
|
|
75
|
+
function ae(a, e = {}, m = "") {
|
|
76
|
+
const c = new DOMParser();
|
|
77
|
+
let r;
|
|
72
78
|
try {
|
|
73
|
-
|
|
79
|
+
r = c.parseFromString(a, "text/html");
|
|
74
80
|
} catch (n) {
|
|
75
|
-
return console.error("[RecommendationMigrator] Failed to parse template:", n),
|
|
81
|
+
return console.error("[RecommendationMigrator] Failed to parse template:", n), a;
|
|
76
82
|
}
|
|
77
|
-
const
|
|
83
|
+
const o = Array.from(r.querySelectorAll(j));
|
|
78
84
|
try {
|
|
79
|
-
M().$patch((
|
|
80
|
-
|
|
81
|
-
...
|
|
82
|
-
[b.Recommendation]:
|
|
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 (
|
|
88
|
-
return
|
|
89
|
-
let
|
|
90
|
-
|
|
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
|
-
|
|
93
|
-
} catch (
|
|
94
|
-
console.error("[RecommendationMigrator] Unexpected error migrating block:",
|
|
99
|
+
K(c, n, e, s) && (i += 1);
|
|
100
|
+
} catch (t) {
|
|
101
|
+
console.error("[RecommendationMigrator] Unexpected error migrating block:", t);
|
|
95
102
|
}
|
|
96
|
-
}),
|
|
103
|
+
}), i > 0 && console.info(`[RecommendationMigrator] Migrated ${i} legacy Recommendation block(s)`), r.documentElement.outerHTML;
|
|
97
104
|
}
|
|
98
105
|
export {
|
|
99
|
-
|
|
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
|
+
};
|
package/dist/enums/academy.js
CHANGED
|
@@ -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
|