@useinsider/guido 3.24.0-beta.003db4c → 3.24.0-beta.0aa04e8
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/dist/config/migrator/recommendation/extractors.js +87 -212
- package/dist/config/migrator/recommendation/parseLegacyConfig.js +14 -16
- package/dist/config/migrator/recommendationMigrator.js +63 -73
- package/dist/config/migrator/unsubscribeMigrator.js +94 -98
- package/dist/extensions/Blocks/Unsubscribe/block.js +104 -96
- package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +4 -3
- package/dist/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js +5 -0
- package/dist/package.json.js +2 -2
- package/dist/src/config/migrator/recommendation/extractors.d.ts +1 -8
- package/dist/src/config/migrator/recommendation/parseLegacyConfig.d.ts +2 -2
- package/dist/src/config/migrator/recommendationMigrator.d.ts +3 -2
- package/dist/src/extensions/Blocks/Unsubscribe/utils/constants.d.ts +1 -0
- package/dist/src/extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,239 +1,114 @@
|
|
|
1
|
-
import { CURRENCY_ATTR as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
var
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
7
|
-
return
|
|
8
|
-
const
|
|
9
|
-
return
|
|
10
|
-
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
}
|
|
15
|
-
function
|
|
16
|
-
var
|
|
17
|
-
const
|
|
18
|
-
return !!
|
|
19
|
-
}
|
|
20
|
-
function
|
|
21
|
-
const
|
|
22
|
-
return !
|
|
23
|
-
}
|
|
24
|
-
function
|
|
25
|
-
return /(?:^|;)\s*display\s*:\s*table-cell/i.test(
|
|
26
|
-
}
|
|
27
|
-
function
|
|
28
|
-
var
|
|
29
|
-
const
|
|
30
|
-
return !
|
|
31
|
-
}
|
|
32
|
-
const
|
|
33
|
-
function l(t) {
|
|
34
|
-
const e = {};
|
|
35
|
-
return ((t == null ? void 0 : t.getAttribute("style")) ?? "").split(";").forEach((o) => {
|
|
36
|
-
const r = o.indexOf(":"), n = o.slice(0, r).trim().toLowerCase(), i = o.slice(r + 1).replace(/!important/i, "").trim();
|
|
37
|
-
r > 0 && n && i && (e[n] = i);
|
|
38
|
-
}), e;
|
|
39
|
-
}
|
|
40
|
-
function d(t) {
|
|
41
|
-
const e = t == null ? void 0 : t.trim().match(q);
|
|
42
|
-
return e ? Number(e[1]) : void 0;
|
|
43
|
-
}
|
|
44
|
-
function a(t) {
|
|
45
|
-
return t && O.test(t.trim()) ? t.trim() : void 0;
|
|
46
|
-
}
|
|
47
|
-
const w = /* @__PURE__ */ new Map([
|
|
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([
|
|
48
33
|
["p_name", ".ext-product-name p"],
|
|
49
34
|
["p_price", ".ext-product-price p"],
|
|
50
35
|
["p_original_price", ".ext-product-original-price p"]
|
|
51
36
|
]);
|
|
52
|
-
function
|
|
53
|
-
|
|
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;
|
|
54
40
|
}
|
|
55
|
-
const
|
|
56
|
-
function
|
|
57
|
-
return
|
|
41
|
+
const x = "ins-trim-text";
|
|
42
|
+
function h(e, r) {
|
|
43
|
+
return e == null ? void 0 : e.map((t) => {
|
|
58
44
|
var s, u;
|
|
59
|
-
const
|
|
60
|
-
if (!
|
|
61
|
-
return
|
|
62
|
-
const
|
|
63
|
-
return !
|
|
64
|
-
...
|
|
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,
|
|
65
51
|
theme: {
|
|
66
|
-
...
|
|
67
|
-
...
|
|
68
|
-
...
|
|
52
|
+
...t.theme,
|
|
53
|
+
...c ? { textColor: { color: c } } : {},
|
|
54
|
+
...i ? { textTrimming: !0 } : {}
|
|
69
55
|
}
|
|
70
56
|
};
|
|
71
57
|
});
|
|
72
58
|
}
|
|
73
|
-
function
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
...Array.from(
|
|
59
|
+
function R(e) {
|
|
60
|
+
const r = [
|
|
61
|
+
e,
|
|
62
|
+
...Array.from(e.querySelectorAll(".product-card, .ext-recommendation-card"))
|
|
77
63
|
];
|
|
78
|
-
let
|
|
79
|
-
return
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
return
|
|
83
|
-
const
|
|
84
|
-
return
|
|
85
|
-
}),
|
|
86
|
-
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
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);
|
|
89
75
|
return {
|
|
90
|
-
...
|
|
76
|
+
...r ? { value: r } : {},
|
|
91
77
|
// An empty `currency-symbol` is omitted so `mapCurrency` falls back to
|
|
92
78
|
// the currency code as the symbol.
|
|
93
|
-
...
|
|
79
|
+
...t ? { symbol: t } : {},
|
|
94
80
|
alignment: 1,
|
|
95
81
|
decimalCount: "2",
|
|
96
82
|
decimalSeparator: ",",
|
|
97
83
|
thousandSeparator: "."
|
|
98
84
|
};
|
|
99
85
|
}
|
|
100
|
-
const
|
|
101
|
-
function
|
|
102
|
-
const
|
|
103
|
-
if (!
|
|
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)
|
|
104
90
|
return;
|
|
105
|
-
const
|
|
106
|
-
return
|
|
107
|
-
const
|
|
108
|
-
if (!
|
|
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)
|
|
109
95
|
return;
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
}),
|
|
113
|
-
}
|
|
114
|
-
function f(t) {
|
|
115
|
-
const e = (t.padding ?? "").split(/\s+/).filter(Boolean).map(d), o = e.every((u) => u !== void 0) ? e : [], r = o[0] ?? 0, n = o[1] ?? r, i = o[2] ?? r, c = o[3] ?? n, s = {
|
|
116
|
-
top: d(t["padding-top"]) ?? r,
|
|
117
|
-
right: d(t["padding-right"]) ?? n,
|
|
118
|
-
bottom: d(t["padding-bottom"]) ?? i,
|
|
119
|
-
left: d(t["padding-left"]) ?? c
|
|
120
|
-
};
|
|
121
|
-
return Object.values(s).some(Boolean) ? s : void 0;
|
|
122
|
-
}
|
|
123
|
-
function k(t, e) {
|
|
124
|
-
return !t || !e ? t ?? e : {
|
|
125
|
-
top: t.top + e.top,
|
|
126
|
-
right: t.right + e.right,
|
|
127
|
-
bottom: t.bottom + e.bottom,
|
|
128
|
-
left: t.left + e.left
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
function h(t) {
|
|
132
|
-
const e = Object.fromEntries(P.filter((o) => t[o]).map((o) => [o, t[o]]));
|
|
133
|
-
return Object.keys(e).length ? e : void 0;
|
|
134
|
-
}
|
|
135
|
-
function g(t) {
|
|
136
|
-
return t === void 0 ? void 0 : { top: t, right: t, bottom: t, left: t };
|
|
137
|
-
}
|
|
138
|
-
function x(t) {
|
|
139
|
-
const e = Object.entries(t).filter(([, o]) => o !== void 0);
|
|
140
|
-
return e.length ? Object.fromEntries(e) : void 0;
|
|
141
|
-
}
|
|
142
|
-
function p(t) {
|
|
143
|
-
const e = t.querySelector("p"), o = l(t), r = l(e ?? t), n = a(r.color), i = a(o["background-color"]), c = k(f(o), e ? f(r) : void 0), s = t.getAttribute("align");
|
|
144
|
-
return x({
|
|
145
|
-
textStyle: h(r),
|
|
146
|
-
textColor: n ? { color: n } : void 0,
|
|
147
|
-
textBackgroundColor: i ? { color: i } : void 0,
|
|
148
|
-
textPadding: c ? { desktop: c } : void 0,
|
|
149
|
-
textLineSpacing: r["line-height"] ? { lineSpacing: r["line-height"] } : void 0,
|
|
150
|
-
textAlign: s ? { align: s } : void 0
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function M(t) {
|
|
154
|
-
const e = d(t["border-width"]), o = t["border-style"], r = a(t["border-color"]);
|
|
155
|
-
if (!(e === void 0 && !o && !r))
|
|
156
|
-
return { width: g(e), style: g(o), color: g(r) };
|
|
157
|
-
}
|
|
158
|
-
function F(t) {
|
|
159
|
-
var C;
|
|
160
|
-
const e = l(t.querySelector(".es-button-border")), o = t.querySelector("a"), r = l(o), n = (C = o == null ? void 0 : o.textContent) == null ? void 0 : C.trim(), i = a(e["background-color"] ?? e.background ?? r["background-color"] ?? r.background), c = a(r.color), s = d(e["border-radius"] ?? r["border-radius"]), u = f(r), S = f(l(t)), y = t.getAttribute("align"), { display: m } = e;
|
|
161
|
-
return x({
|
|
162
|
-
buttonText: n ? { text: n } : void 0,
|
|
163
|
-
buttonStyle: h(r),
|
|
164
|
-
buttonColor: i ? { color: i } : void 0,
|
|
165
|
-
textButtonColor: c ? { color: c } : void 0,
|
|
166
|
-
buttonBorder: M(e),
|
|
167
|
-
buttonBorderRadius: s === void 0 ? void 0 : { radius: s },
|
|
168
|
-
buttonInternalPadding: u ? { desktop: u } : void 0,
|
|
169
|
-
buttonExternalPadding: S ? { desktop: S } : void 0,
|
|
170
|
-
buttonStretch: m === "block" || m === "inline-block" ? { stretched: m === "block" } : void 0,
|
|
171
|
-
buttonAlign: y ? { align: y } : void 0
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
function Y(t) {
|
|
175
|
-
const e = t.querySelector("img"), o = d(e == null ? void 0 : e.getAttribute("width")), r = d(e == null ? void 0 : e.getAttribute("height"));
|
|
176
|
-
return o === void 0 && r === void 0 ? void 0 : { imageSize: { width: o, height: r } };
|
|
177
|
-
}
|
|
178
|
-
const j = [
|
|
179
|
-
["p_image", ".ext-product-image", !1, Y],
|
|
180
|
-
["p_name", ".ext-product-name", !1, p],
|
|
181
|
-
["p_original_price", ".ext-product-original-price", !1, p],
|
|
182
|
-
["p_price", ".ext-product-price", !1, p],
|
|
183
|
-
["p_omnibus_price", ".ext-product-omnibus-price", !0, p],
|
|
184
|
-
["p_omnibus_discount", ".ext-product-omnibus-discount", !0, p],
|
|
185
|
-
["p_button", ".ext-product-button", !1, F]
|
|
186
|
-
];
|
|
187
|
-
function b(t, e) {
|
|
188
|
-
return e ? { ...t, theme: e } : t;
|
|
189
|
-
}
|
|
190
|
-
function G(t) {
|
|
191
|
-
const e = t.querySelector(".ext-recommendation-title");
|
|
192
|
-
if (!e)
|
|
193
|
-
return [];
|
|
194
|
-
const o = l(e.querySelector("p") ?? e), r = a(o.color), n = x({ textStyle: h(o), textColor: r ? { color: r } : void 0 });
|
|
195
|
-
return [b({ variable: "p_recommendation_title", hidden: !L(t) }, n)];
|
|
196
|
-
}
|
|
197
|
-
function U(t) {
|
|
198
|
-
const e = j.flatMap(([n, i, c, s]) => {
|
|
199
|
-
const u = t.querySelector(i);
|
|
200
|
-
return u ? [b({ variable: n, hidden: c }, s(u))] : [];
|
|
201
|
-
}), o = t.querySelectorAll(".ext-ins-attr p[product-attr]"), r = Array.from(o, (n, i) => b({
|
|
202
|
-
variable: `p_attribute_${i}`,
|
|
203
|
-
variableType: "p_attribute",
|
|
204
|
-
value: n.getAttribute("product-attr") ?? "",
|
|
205
|
-
hidden: !1
|
|
206
|
-
}, p(n.closest(".ext-ins-attr") ?? n)));
|
|
207
|
-
return [...e, ...r];
|
|
208
|
-
}
|
|
209
|
-
const R = "td.product-card", T = (t) => t.querySelectorAll(R).length;
|
|
210
|
-
function V(t, e) {
|
|
211
|
-
let o = e.parentElement;
|
|
212
|
-
for (; o && o !== t && T(o) < 2; )
|
|
213
|
-
o = o.parentElement;
|
|
214
|
-
return !o || o === t ? 0 : o.tagName === "TBODY" || o.tagName === "TABLE" ? 1 : T(o);
|
|
215
|
-
}
|
|
216
|
-
function tt(t) {
|
|
217
|
-
const e = t.querySelectorAll(R), [o] = e, r = o ? V(t, o) : 0, n = o ? U(o) : [];
|
|
218
|
-
return {
|
|
219
|
-
...e.length ? { totalCount: e.length } : {},
|
|
220
|
-
...r ? { rowCount: r } : {},
|
|
221
|
-
composition: { variables: n.length ? [...G(t), ...n] : [] }
|
|
222
|
-
};
|
|
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;
|
|
223
99
|
}
|
|
224
|
-
function
|
|
225
|
-
return
|
|
100
|
+
function I(e) {
|
|
101
|
+
return e.classList.contains(m);
|
|
226
102
|
}
|
|
227
103
|
export {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
J as withRenderedTextTheme
|
|
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
|
|
239
114
|
};
|
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return t.replace(/'/g, "'").replace(///g, "/").replace(/'/g, "'").replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1
|
+
function c(e) {
|
|
2
|
+
return e.replace(/'/g, "'").replace(///g, "/").replace(/'/g, "'").replace(/"/g, '"').replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
4
3
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
if (!
|
|
4
|
+
function s(e) {
|
|
5
|
+
const t = e.getAttribute("esd-dev-product-config");
|
|
6
|
+
if (!t)
|
|
8
7
|
return null;
|
|
9
8
|
try {
|
|
10
|
-
const n =
|
|
9
|
+
const n = c(c(t));
|
|
11
10
|
return JSON.parse(n);
|
|
12
11
|
} catch {
|
|
13
12
|
return null;
|
|
14
13
|
}
|
|
15
14
|
}
|
|
16
|
-
function i(
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
const r = parseInt(
|
|
15
|
+
function i(e) {
|
|
16
|
+
const t = e.getAttribute("ins-recommendation-v3-campaign-id");
|
|
17
|
+
if (t) {
|
|
18
|
+
const r = parseInt(t);
|
|
20
19
|
if (!Number.isNaN(r))
|
|
21
20
|
return r;
|
|
22
21
|
}
|
|
23
|
-
const
|
|
24
|
-
if (
|
|
25
|
-
const r = parseInt(
|
|
22
|
+
const a = (e.getAttribute("class") ?? "").match(/ins-recommendation-v3-block-(\d+)/);
|
|
23
|
+
if (a) {
|
|
24
|
+
const r = parseInt(a[1]);
|
|
26
25
|
if (!Number.isNaN(r))
|
|
27
26
|
return r;
|
|
28
27
|
}
|
|
29
28
|
return null;
|
|
30
29
|
}
|
|
31
30
|
export {
|
|
32
|
-
s as
|
|
33
|
-
o as parseLegacyConfig,
|
|
31
|
+
s as parseLegacyConfig,
|
|
34
32
|
i as parseRecommendationId
|
|
35
33
|
};
|
|
@@ -1,69 +1,59 @@
|
|
|
1
1
|
import { BlockId as b } from "../../enums/block.js";
|
|
2
|
-
import { DEFAULT_NODE_CONFIG as
|
|
3
|
-
import { ATTR_RECOMMENDATION_TITLE as
|
|
4
|
-
import { useTemplateStore as
|
|
5
|
-
import { mapComposition as
|
|
6
|
-
import {
|
|
7
|
-
import { buildBlockHtml as
|
|
8
|
-
import {
|
|
9
|
-
import { mapSettings as
|
|
10
|
-
import { mapBlockPadding as
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var e;
|
|
17
|
-
return !!((e = i.getAttribute(m)) != null && e.trim());
|
|
18
|
-
};
|
|
19
|
-
function q(i, e, s) {
|
|
20
|
-
var g, p, f;
|
|
21
|
-
const o = $(e);
|
|
22
|
-
if (o === null)
|
|
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)
|
|
23
16
|
return console.warn(
|
|
24
17
|
"[RecommendationMigrator] Skipping block — missing/invalid `ins-recommendation-v3-campaign-id`"
|
|
25
18
|
), !1;
|
|
26
|
-
const
|
|
19
|
+
const r = F(e);
|
|
27
20
|
if (!r)
|
|
28
21
|
return console.warn(
|
|
29
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
22
|
+
`[RecommendationMigrator] Aborting block id=${t} — \`esd-dev-product-config\` missing or unable to be parsed`
|
|
30
23
|
), !1;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
isPriceMovedToNextLine: t.isPriceMovedToNextLine ?? B(e)
|
|
38
|
-
}, y = D(c, r, o), n = L(
|
|
39
|
-
w((g = r.composition) == null ? void 0 : g.variables, e),
|
|
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),
|
|
40
30
|
{ oldPriceFirst: S(e) }
|
|
41
|
-
),
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
...
|
|
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,
|
|
45
35
|
strategyId: "",
|
|
46
|
-
composition:
|
|
47
|
-
visibility:
|
|
48
|
-
previousTitleHtml:
|
|
49
|
-
textTrimming:
|
|
50
|
-
},
|
|
36
|
+
composition: i.composition,
|
|
37
|
+
visibility: i.visibility,
|
|
38
|
+
previousTitleHtml: C.previousTitleHtml,
|
|
39
|
+
textTrimming: i.anyTextTrimming
|
|
40
|
+
}, s = A(e), v = `
|
|
51
41
|
<table>
|
|
52
42
|
<tbody>
|
|
53
43
|
<tr>
|
|
54
44
|
<td class="esd-structure" align="left">
|
|
55
45
|
<table width="100%" cellpadding="0" cellspacing="0">
|
|
56
46
|
<tbody>
|
|
57
|
-
<tr>${
|
|
58
|
-
nodeConfig:
|
|
59
|
-
composition:
|
|
60
|
-
cardBg:
|
|
61
|
-
titleText:
|
|
47
|
+
<tr>${N({
|
|
48
|
+
nodeConfig: T,
|
|
49
|
+
composition: i,
|
|
50
|
+
cardBg: y,
|
|
51
|
+
titleText: u,
|
|
62
52
|
legacyId: e.getAttribute("id") ?? void 0,
|
|
63
53
|
legacyBgColor: e.getAttribute("bgcolor") ?? void 0,
|
|
64
|
-
preserveInnerHtml:
|
|
65
|
-
skipCompile:
|
|
66
|
-
blockPadding:
|
|
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))
|
|
67
57
|
})}</tr>
|
|
68
58
|
</tbody>
|
|
69
59
|
</table>
|
|
@@ -71,40 +61,40 @@ function q(i, e, s) {
|
|
|
71
61
|
</tr>
|
|
72
62
|
</tbody>
|
|
73
63
|
</table>
|
|
74
|
-
`,
|
|
75
|
-
return !
|
|
76
|
-
`[RecommendationMigrator] Aborting block id=${
|
|
77
|
-
), !1) : (e.parentNode.replaceChild(
|
|
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);
|
|
78
68
|
}
|
|
79
|
-
function
|
|
80
|
-
const
|
|
81
|
-
let
|
|
69
|
+
function X(c, e = {}) {
|
|
70
|
+
const m = new DOMParser();
|
|
71
|
+
let t;
|
|
82
72
|
try {
|
|
83
|
-
|
|
84
|
-
} catch (
|
|
85
|
-
return console.error("[RecommendationMigrator] Failed to parse template:",
|
|
73
|
+
t = m.parseFromString(c, "text/html");
|
|
74
|
+
} catch (n) {
|
|
75
|
+
return console.error("[RecommendationMigrator] Failed to parse template:", n), c;
|
|
86
76
|
}
|
|
87
|
-
const
|
|
77
|
+
const r = Array.from(t.querySelectorAll(k));
|
|
88
78
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
...
|
|
92
|
-
[b.Recommendation]:
|
|
79
|
+
M().$patch((a) => {
|
|
80
|
+
a.migrations = {
|
|
81
|
+
...a.migrations,
|
|
82
|
+
[b.Recommendation]: r.length
|
|
93
83
|
};
|
|
94
84
|
});
|
|
95
85
|
} catch {
|
|
96
86
|
}
|
|
97
|
-
if (
|
|
98
|
-
return
|
|
99
|
-
let
|
|
100
|
-
return
|
|
87
|
+
if (r.length === 0)
|
|
88
|
+
return c;
|
|
89
|
+
let o = 0;
|
|
90
|
+
return r.forEach((n) => {
|
|
101
91
|
try {
|
|
102
|
-
|
|
103
|
-
} catch (
|
|
104
|
-
console.error("[RecommendationMigrator] Unexpected error migrating block:",
|
|
92
|
+
$(m, n, e) && (o += 1);
|
|
93
|
+
} catch (a) {
|
|
94
|
+
console.error("[RecommendationMigrator] Unexpected error migrating block:", a);
|
|
105
95
|
}
|
|
106
|
-
}),
|
|
96
|
+
}), o > 0 && console.info(`[RecommendationMigrator] Migrated ${o} legacy Recommendation block(s)`), t.documentElement.outerHTML;
|
|
107
97
|
}
|
|
108
98
|
export {
|
|
109
|
-
|
|
99
|
+
X as migrateRecommendation
|
|
110
100
|
};
|
|
@@ -1,146 +1,142 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { MERGE_TAGS as
|
|
5
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
var $ = Object.defineProperty;
|
|
2
|
+
var _ = (f, e, t) => e in f ? $(f, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : f[e] = t;
|
|
3
|
+
var y = (f, e, t) => _(f, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { MERGE_TAGS as l, PAGE_TYPES as p } from "../../enums/unsubscribe.js";
|
|
5
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as A, DATA_ATTRIBUTES as T, UNSUBSCRIBE_MERGE_TAG_REGEX as E } from "../../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
6
|
+
import { swapMergeTagInHref as B } from "../../extensions/Blocks/Unsubscribe/utils/swapMergeTagInHref.js";
|
|
7
|
+
import { useUnsubscribeStore as N } from "../../stores/unsubscribe.js";
|
|
8
|
+
import { escapeHtml as h } from "../../utils/htmlEscape.js";
|
|
9
|
+
const S = "unsubscribe", R = "You can ", M = " from our emails, if you need to.", C = "{-{-UNSUBSCRIBE-LINK-}-}";
|
|
10
|
+
class P {
|
|
8
11
|
constructor() {
|
|
9
|
-
|
|
12
|
+
y(this, "parser");
|
|
10
13
|
this.parser = new DOMParser();
|
|
11
14
|
}
|
|
12
15
|
async migrate(e) {
|
|
13
16
|
try {
|
|
14
|
-
const
|
|
15
|
-
if (
|
|
16
|
-
const s =
|
|
17
|
-
await s.fetchTemplates(), this.migrateLegacyBlocks(
|
|
17
|
+
const t = this.parser.parseFromString(e, "text/html"), r = t.querySelectorAll("td.unsubscribe-block");
|
|
18
|
+
if (r.length) {
|
|
19
|
+
const s = N();
|
|
20
|
+
await s.fetchTemplates(), this.migrateLegacyBlocks(r, s, this.collectBlockTags(t));
|
|
18
21
|
}
|
|
19
|
-
const n = this.repairUnsubscribeLinks(
|
|
20
|
-
return !
|
|
21
|
-
} catch (
|
|
22
|
-
return console.error("UnsubscribeMigrator failed:",
|
|
22
|
+
const n = this.repairUnsubscribeLinks(t);
|
|
23
|
+
return !r.length && !n ? e : t.documentElement.outerHTML;
|
|
24
|
+
} catch (t) {
|
|
25
|
+
return console.error("UnsubscribeMigrator failed:", t), e;
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
|
-
migrateLegacyBlocks(e, r) {
|
|
26
|
-
e.forEach((
|
|
27
|
-
const
|
|
28
|
+
migrateLegacyBlocks(e, t, r) {
|
|
29
|
+
e.forEach((n) => {
|
|
30
|
+
const s = n.getAttribute("id"), i = this.extractPaddingClass(n), c = n.getAttribute("bgcolor") || "", a = this.extractUnsubscribeContent(n, r), b = this.getCollectionTypeFromMergeTag(a.linkHref), u = t.getSelectedUnsubscribePagesByCollection(b);
|
|
28
31
|
console.debug("[UnsubscribeMigrator]", {
|
|
29
32
|
mergeTag: a.linkHref,
|
|
30
|
-
collectionType:
|
|
31
|
-
pageIds:
|
|
32
|
-
paddingClass:
|
|
33
|
-
bgColor:
|
|
33
|
+
collectionType: b,
|
|
34
|
+
pageIds: u,
|
|
35
|
+
paddingClass: i,
|
|
36
|
+
bgColor: c
|
|
34
37
|
});
|
|
35
|
-
const
|
|
38
|
+
const o = this.buildUnsubscribeBlock(
|
|
36
39
|
a,
|
|
37
|
-
o,
|
|
38
40
|
b,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
u,
|
|
42
|
+
i,
|
|
43
|
+
c
|
|
44
|
+
), g = this.parser.parseFromString(
|
|
45
|
+
`<table id="tempDoc"><tbody><tr>${o}</tr></tbody></table>`,
|
|
43
46
|
"text/html"
|
|
44
|
-
).querySelector(
|
|
45
|
-
|
|
47
|
+
).querySelector(A);
|
|
48
|
+
g && n.parentNode && (g.setAttribute("id", s || ""), n.parentNode.replaceChild(g, n));
|
|
46
49
|
});
|
|
47
50
|
}
|
|
51
|
+
collectBlockTags(e) {
|
|
52
|
+
const t = e.querySelectorAll(`td.unsubscribe-block, ${A}`), r = /* @__PURE__ */ new Set();
|
|
53
|
+
return t.forEach((n) => {
|
|
54
|
+
var a, b, u;
|
|
55
|
+
const s = Number(n.getAttribute(T.PAGE_TYPE)), i = l[s], c = (u = (b = (a = this.findLinkCandidates(n).primary) == null ? void 0 : a.getAttribute("href")) == null ? void 0 : b.match(E)) == null ? void 0 : u[0];
|
|
56
|
+
i ? r.add(i) : c && r.add(l[this.getCollectionTypeFromMergeTag(c)]);
|
|
57
|
+
}), r;
|
|
58
|
+
}
|
|
48
59
|
// Re-derives the typed merge tag from data-unsubscribe-page-type for any v2
|
|
49
60
|
// block whose anchor href is missing or the legacy default. Returns true when
|
|
50
61
|
// at least one href was rewritten. Typed tags and custom URLs are left intact.
|
|
51
62
|
repairUnsubscribeLinks(e) {
|
|
52
|
-
const
|
|
53
|
-
let
|
|
54
|
-
return
|
|
63
|
+
const t = e.querySelectorAll(`${A}[${T.PAGE_TYPE}]`);
|
|
64
|
+
let r = !1;
|
|
65
|
+
return t.forEach((n) => {
|
|
55
66
|
const s = n.querySelector('a[data-unsubscribe-link="true"], a.unsubscribe-link');
|
|
56
67
|
if (!s)
|
|
57
68
|
return;
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
69
|
+
const i = s.getAttribute("href") || "";
|
|
70
|
+
if (i && i !== l.default)
|
|
60
71
|
return;
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
}),
|
|
72
|
+
const c = Number(n.getAttribute(T.PAGE_TYPE)), a = l[c];
|
|
73
|
+
a && (s.setAttribute("href", a), r = !0);
|
|
74
|
+
}), r;
|
|
64
75
|
}
|
|
65
76
|
extractPaddingClass(e) {
|
|
66
|
-
const
|
|
67
|
-
return
|
|
77
|
+
const r = (e.getAttribute("class") || "").match(/\bes-p\d+\b/);
|
|
78
|
+
return r ? r[0] : "";
|
|
79
|
+
}
|
|
80
|
+
hasVisibleContent(e) {
|
|
81
|
+
var t;
|
|
82
|
+
return !!((t = e.textContent) != null && t.trim() || e.querySelector("img"));
|
|
68
83
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const n = e.getAttribute("align") || t.getAttribute("align") || "center", s = t.getAttribute("style") || "";
|
|
85
|
-
if (!r)
|
|
86
|
-
return {
|
|
87
|
-
textBefore: "You can ",
|
|
88
|
-
linkText: "unsubscribe",
|
|
89
|
-
linkHref: "{{ins-unsubscribe-link}}",
|
|
90
|
-
linkStyle: "",
|
|
91
|
-
textAfter: " from our emails, if you need to.",
|
|
92
|
-
isBold: !1,
|
|
93
|
-
isItalic: !1,
|
|
94
|
-
align: n,
|
|
95
|
-
paragraphStyle: s
|
|
96
|
-
};
|
|
97
|
-
const l = ((d = r.textContent) == null ? void 0 : d.trim()) || "unsubscribe", a = r.getAttribute("href") || "{{ins-unsubscribe-link}}", o = r.getAttribute("style") || "", b = t.textContent || "", u = b.indexOf(l), g = u >= 0 ? b.substring(0, u).trim() : "You can ", i = u >= 0 ? b.substring(u + l.length).trim() : " from our emails, if you need to.", m = !!t.querySelector("b, strong"), y = !!t.querySelector("i, em");
|
|
98
|
-
return {
|
|
99
|
-
textBefore: g,
|
|
100
|
-
linkText: l,
|
|
101
|
-
linkHref: this.normalizeUnsubscribeHref(a),
|
|
102
|
-
linkStyle: o,
|
|
103
|
-
textAfter: i,
|
|
104
|
-
isBold: m,
|
|
105
|
-
isItalic: y,
|
|
106
|
-
align: n,
|
|
107
|
-
paragraphStyle: s
|
|
84
|
+
findLinkCandidates(e) {
|
|
85
|
+
const t = Array.from(/* @__PURE__ */ new Set([
|
|
86
|
+
...Array.from(e.querySelectorAll("a.unsubscribe-link")),
|
|
87
|
+
...Array.from(e.querySelectorAll('a[href*="unsubscribe"]'))
|
|
88
|
+
])), r = (i) => E.test(i.getAttribute("href") || ""), n = (i) => this.hasVisibleContent(i), s = t.find((i) => n(i) && r(i)) ?? t.find((i) => n(i) && i.classList.contains("unsubscribe-link")) ?? t.find(r) ?? t.find(n) ?? t[0];
|
|
89
|
+
return { candidates: t, primary: s };
|
|
90
|
+
}
|
|
91
|
+
extractUnsubscribeContent(e, t) {
|
|
92
|
+
const r = e.cloneNode(!0), { candidates: n, primary: s } = this.findLinkCandidates(r), i = (s == null ? void 0 : s.closest("p")) ?? null, c = i || r.querySelector("p"), a = {
|
|
93
|
+
footerHtml: "",
|
|
94
|
+
linkText: S,
|
|
95
|
+
linkHref: l.default,
|
|
96
|
+
linkStyle: "",
|
|
97
|
+
align: "center",
|
|
98
|
+
paragraphStyle: ""
|
|
108
99
|
};
|
|
100
|
+
if (!c || (a.align = e.getAttribute("align") || c.getAttribute("align") || "center", i || (a.paragraphStyle = c.getAttribute("style") || ""), !s))
|
|
101
|
+
return a;
|
|
102
|
+
if (a.linkText = this.hasVisibleContent(s) ? s.innerHTML.trim() : S, a.linkHref = this.normalizeUnsubscribeHref(s.getAttribute("href") || l.default), a.linkStyle = s.getAttribute("style") || "", i) {
|
|
103
|
+
const b = this.getCollectionTypeFromMergeTag(a.linkHref), u = l[b];
|
|
104
|
+
r.querySelectorAll("a[href]").forEach((o) => {
|
|
105
|
+
var m;
|
|
106
|
+
const d = o.getAttribute("href") || "", g = (m = d.match(E)) == null ? void 0 : m[0];
|
|
107
|
+
g && o.setAttribute("href", B(d, t.has(g) ? g : u));
|
|
108
|
+
}), n.filter((o) => o !== s && !this.hasVisibleContent(o)).forEach((o) => o.replaceWith(...Array.from(o.childNodes))), s.replaceWith(r.ownerDocument.createTextNode(C)), a.footerHtml = r.innerHTML.trim();
|
|
109
|
+
}
|
|
110
|
+
return a;
|
|
109
111
|
}
|
|
110
|
-
buildUnsubscribeBlock(e,
|
|
111
|
-
const
|
|
112
|
-
e.textBefore && g.push(e.textBefore), g.push(u), e.textAfter && g.push(e.textAfter);
|
|
113
|
-
let i = g.join(" ");
|
|
114
|
-
e.isBold && e.isItalic ? i = `<strong path="1,0"><em path="1,0,0">${i}</em></strong>` : e.isBold ? i = `<strong path="1,0">${i}</strong>` : e.isItalic && (i = `<em path="1,0">${i}</em>`);
|
|
115
|
-
const m = e.align ? ` align="${e.align}"` : "", y = s ? ` bgcolor="${s}"` : "", d = e.paragraphStyle ? ` style="${e.paragraphStyle}"` : "", T = t.length > 0 ? ` ${k.PAGE_LIST}="${t.join(",")}"` : "", E = ` ${k.PAGE_TYPE}="${r}"`, S = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
|
|
112
|
+
buildUnsubscribeBlock(e, t, r, n, s) {
|
|
113
|
+
const i = e.linkStyle ? ` style="${h(e.linkStyle)}"` : "", a = Object.values(l).includes(e.linkHref) ? l[t] : e.linkHref, u = `<a ${`href="${h(a)}" class="unsubscribe-link" target="_blank" data-unsubscribe-link="true"`}${i}>${e.linkText}</a>`, o = e.paragraphStyle ? ` style="${h(e.paragraphStyle)}"` : "", d = e.footerHtml ? e.footerHtml.replace(C, () => u) : `<p path="1"${o}>${R}${u}${M}</p>`, g = e.align ? ` align="${e.align}"` : "", m = s ? ` bgcolor="${s}"` : "", U = r.length > 0 ? ` ${T.PAGE_LIST}="${r.join(",")}"` : "", L = ` ${T.PAGE_TYPE}="${t}"`, k = "esd-block-text unsubscribe-block-v2 esd-block-unsubscribe esd-unsubscribe-block esd-extension-block";
|
|
116
114
|
return `
|
|
117
115
|
<td
|
|
118
116
|
data-migration="true"
|
|
119
117
|
esd-extension-block-id="unsubscribe-block"
|
|
120
|
-
class="${n ? `${
|
|
121
|
-
${
|
|
118
|
+
class="${n ? `${k} ${n}` : k}"
|
|
119
|
+
${g}${m}${L}${U}
|
|
122
120
|
>
|
|
123
|
-
|
|
124
|
-
${i}
|
|
125
|
-
</p>
|
|
121
|
+
${d}
|
|
126
122
|
</td>
|
|
127
123
|
`;
|
|
128
124
|
}
|
|
129
125
|
getCollectionTypeFromMergeTag(e) {
|
|
130
|
-
return e ===
|
|
126
|
+
return e === l[p.SUBSCRIPTION_PREFERENCE_CENTER] ? p.SUBSCRIPTION_PREFERENCE_CENTER : e === l[p.GLOBAL_UNSUBSCRIBE] ? p.GLOBAL_UNSUBSCRIBE : p.GLOBAL_UNSUBSCRIBE;
|
|
131
127
|
}
|
|
132
128
|
normalizeUnsubscribeHref(e) {
|
|
133
|
-
if (Object.values(
|
|
129
|
+
if (Object.values(l).includes(e))
|
|
134
130
|
return e;
|
|
135
|
-
const
|
|
136
|
-
return
|
|
131
|
+
const r = e.match(/{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/);
|
|
132
|
+
return r ? r[0] : e.includes("unsubscribe") || e.includes("unsub") ? (console.warn(
|
|
137
133
|
`[UnsubscribeMigrator] Unrecognized unsubscribe href format: "${e}". Defaulting to {{ins-unsubscribe-link}}`
|
|
138
134
|
), "{{ins-unsubscribe-link}}") : e;
|
|
139
135
|
}
|
|
140
136
|
}
|
|
141
|
-
async function
|
|
142
|
-
return new
|
|
137
|
+
async function q(f) {
|
|
138
|
+
return new P().migrate(f);
|
|
143
139
|
}
|
|
144
140
|
export {
|
|
145
|
-
|
|
141
|
+
q as migrateUnsubscribe
|
|
146
142
|
};
|
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { useToaster as
|
|
5
|
-
import { ToasterTypeOptions as
|
|
6
|
-
import { PAGE_TYPES as
|
|
7
|
-
import { useEditorStore as
|
|
8
|
-
import { useUnsubscribeStore as
|
|
9
|
-
import { Block as
|
|
10
|
-
import { getDefaultTemplate as
|
|
11
|
-
import { UNSUBSCRIBE_BLOCK_SELECTOR as
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
[
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
var R = Object.defineProperty;
|
|
2
|
+
var v = (l, c, e) => c in l ? R(l, c, { enumerable: !0, configurable: !0, writable: !0, value: e }) : l[c] = e;
|
|
3
|
+
var h = (l, c, e) => v(l, typeof c != "symbol" ? c + "" : c, e);
|
|
4
|
+
import { useToaster as D } from "../../../composables/useToaster.js";
|
|
5
|
+
import { ToasterTypeOptions as w } from "../../../enums/toaster.js";
|
|
6
|
+
import { PAGE_TYPES as B } from "../../../enums/unsubscribe.js";
|
|
7
|
+
import { useEditorStore as G } from "../../../stores/editor.js";
|
|
8
|
+
import { useUnsubscribeStore as u } from "../../../stores/unsubscribe.js";
|
|
9
|
+
import { Block as P, BlockCompositionType as x, ContextActionType as y, ModificationDescription as k, BlockType as M } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
10
|
+
import { getDefaultTemplate as O } from "./template.js";
|
|
11
|
+
import { UNSUBSCRIBE_BLOCK_SELECTOR as f, DATA_ATTRIBUTES as o, UNSUBSCRIBE_EVENTS as E, UNSUBSCRIBE_MERGE_TAG_REGEX as I } from "./utils/constants.js";
|
|
12
|
+
import { swapMergeTagInHref as q } from "./utils/swapMergeTagInHref.js";
|
|
13
|
+
import { parsePageList as L } from "./utils/utils.js";
|
|
14
|
+
const F = "unsubscribe-block", _ = 'a[data-unsubscribe-link="true"]', C = "{{ins-unsubscribe-link}}", K = "https://academy.insiderone.com/docs/adding-unsubscribe-pages-into-emails", H = "Removing the unsubscribe text leaves an empty block, but an active unsubscribe link is required. Undo your last action to restore the text, or delete the unsubscribe block entirely.", Y = {
|
|
15
|
+
[B.GLOBAL_UNSUBSCRIBE]: "{{ins-global-unsubscribe-link}}",
|
|
16
|
+
[B.SUBSCRIPTION_PREFERENCE_CENTER]: "{{ins-preferences-unsubscribe-link}}"
|
|
17
|
+
}, V = 3;
|
|
18
|
+
let d = null, b = null;
|
|
19
|
+
const N = () => {
|
|
20
|
+
d && (document.removeEventListener(E.SELECT, d), d = null);
|
|
21
|
+
}, U = () => {
|
|
22
|
+
b && (document.removeEventListener(E.CANCEL, b), b = null);
|
|
23
|
+
}, W = () => {
|
|
24
|
+
N(), U();
|
|
24
25
|
};
|
|
25
|
-
class
|
|
26
|
+
class se extends P {
|
|
26
27
|
constructor() {
|
|
27
28
|
super();
|
|
28
|
-
|
|
29
|
+
h(this, "currentNode");
|
|
29
30
|
// Per-block "did this instance have a link last time we saw it?" tracking.
|
|
30
31
|
// Keyed by the stable `data-unsubscribe-block-id` we assign, because
|
|
31
32
|
// ImmutableHtmlNode instances are recreated on every document mutation and
|
|
32
33
|
// can't be used as Map keys directly. A singleton boolean here would be
|
|
33
34
|
// polluted across blocks since Stripo fires onDocumentChanged per-instance.
|
|
34
|
-
|
|
35
|
+
h(this, "linkStateByBlockId", /* @__PURE__ */ new Map());
|
|
35
36
|
// Per-block prepend retry counter for the leading text guard (SD-143097).
|
|
36
|
-
|
|
37
|
+
h(this, "guardAttemptsByBlockId", /* @__PURE__ */ new Map());
|
|
37
38
|
}
|
|
38
39
|
getId() {
|
|
39
|
-
return
|
|
40
|
+
return F;
|
|
40
41
|
}
|
|
41
42
|
getIcon() {
|
|
42
43
|
return "unsubscribe-icon";
|
|
43
44
|
}
|
|
44
45
|
getBlockCompositionType() {
|
|
45
|
-
return
|
|
46
|
+
return x.BLOCK;
|
|
46
47
|
}
|
|
47
48
|
getName() {
|
|
48
49
|
return this.api.translate("Unsubscribe Block");
|
|
@@ -51,16 +52,16 @@ class J extends U {
|
|
|
51
52
|
return this.api.translate("Unsubscribe Block Description");
|
|
52
53
|
}
|
|
53
54
|
getTemplate() {
|
|
54
|
-
return
|
|
55
|
+
return O();
|
|
55
56
|
}
|
|
56
57
|
getContextActionsIds() {
|
|
57
|
-
return [
|
|
58
|
+
return [y.MOVE, y.REMOVE];
|
|
58
59
|
}
|
|
59
60
|
onSelect(e) {
|
|
60
|
-
if (this.currentNode = e,
|
|
61
|
+
if (this.currentNode = e, G().isPreviewModeOpen)
|
|
61
62
|
return;
|
|
62
63
|
const t = this._getOrAssignBlockId(e);
|
|
63
|
-
t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), this._setupSelectEventListener(), this._setupCancelEventListener(t), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), t && (
|
|
64
|
+
t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), this._setupSelectEventListener(), this._setupCancelEventListener(t), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), t && (u().pendingBlockId = t), this._loadBlockState(e), this._checkExistingBlocks(), this._openDrawer());
|
|
64
65
|
}
|
|
65
66
|
onCreated(e) {
|
|
66
67
|
this._ensureLeadingTextGuard(e);
|
|
@@ -68,7 +69,7 @@ class J extends U {
|
|
|
68
69
|
onDocumentInit() {
|
|
69
70
|
try {
|
|
70
71
|
const e = this.api.getDocumentRoot();
|
|
71
|
-
e && "querySelectorAll" in e && e.querySelectorAll(
|
|
72
|
+
e && "querySelectorAll" in e && e.querySelectorAll(f).forEach((t) => {
|
|
72
73
|
this._ensureLeadingTextGuard(t);
|
|
73
74
|
});
|
|
74
75
|
} catch {
|
|
@@ -79,11 +80,11 @@ class J extends U {
|
|
|
79
80
|
const t = this._getOrAssignBlockId(e);
|
|
80
81
|
if (!t)
|
|
81
82
|
return;
|
|
82
|
-
const
|
|
83
|
-
this.linkStateByBlockId.get(t) === !0 && !
|
|
83
|
+
const i = this._hasUnsubscribeLink(e);
|
|
84
|
+
this.linkStateByBlockId.get(t) === !0 && !i && this._warnLinkRemoved(), this.linkStateByBlockId.set(t, i);
|
|
84
85
|
}
|
|
85
86
|
onDelete(e) {
|
|
86
|
-
|
|
87
|
+
W(), this._removeBlockTemplatesFromStore(e), this._resetStoreState();
|
|
87
88
|
const t = this._readBlockId(e);
|
|
88
89
|
t && (this.linkStateByBlockId.delete(t), this.guardAttemptsByBlockId.delete(t));
|
|
89
90
|
}
|
|
@@ -95,38 +96,38 @@ class J extends U {
|
|
|
95
96
|
_ensureLeadingTextGuard(e) {
|
|
96
97
|
if (!("querySelector" in e))
|
|
97
98
|
return;
|
|
98
|
-
const t = e.querySelector(
|
|
99
|
+
const t = e.querySelector(_);
|
|
99
100
|
if (!t)
|
|
100
101
|
return;
|
|
101
|
-
let
|
|
102
|
+
let i = t, r = i.parent();
|
|
102
103
|
for (; r && "getTagName" in r && r.getTagName().toLowerCase() !== "p"; )
|
|
103
|
-
|
|
104
|
+
i = r, r = r.parent();
|
|
104
105
|
if (!r || !("getTagName" in r) || r.getTagName().toLowerCase() !== "p")
|
|
105
106
|
return;
|
|
106
|
-
const
|
|
107
|
-
if (!!(
|
|
108
|
-
const
|
|
109
|
-
|
|
107
|
+
const s = i.previousSibling();
|
|
108
|
+
if (!!(s && s.getType() === "text" && s.getTextContent())) {
|
|
109
|
+
const a = this._readBlockId(e);
|
|
110
|
+
a && this.guardAttemptsByBlockId.delete(a);
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
113
|
+
const g = this._getOrAssignBlockId(e);
|
|
114
|
+
if (!g)
|
|
114
115
|
return;
|
|
115
|
-
const
|
|
116
|
-
if (!(
|
|
117
|
-
this.guardAttemptsByBlockId.set(
|
|
116
|
+
const p = this.guardAttemptsByBlockId.get(g) ?? 0;
|
|
117
|
+
if (!(p >= V)) {
|
|
118
|
+
this.guardAttemptsByBlockId.set(g, p + 1);
|
|
118
119
|
try {
|
|
119
|
-
this.api.getDocumentModifier().modifyHtml(r).prepend(" ").apply(new
|
|
120
|
-
} catch (
|
|
121
|
-
console.warn("[UnsubscribeBlock] Failed to ensure link text guard:",
|
|
120
|
+
this.api.getDocumentModifier().modifyHtml(r).prepend(" ").apply(new k("Ensure unsubscribe link text guard"));
|
|
121
|
+
} catch (a) {
|
|
122
|
+
console.warn("[UnsubscribeBlock] Failed to ensure link text guard:", a);
|
|
122
123
|
}
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
_hasUnsubscribeLink(e) {
|
|
126
|
-
return "querySelector" in e ? !!e.querySelector(
|
|
127
|
+
return "querySelector" in e ? !!e.querySelector(_) : !1;
|
|
127
128
|
}
|
|
128
129
|
_readBlockId(e) {
|
|
129
|
-
return "getAttribute" in e ? e.getAttribute(
|
|
130
|
+
return "getAttribute" in e ? e.getAttribute(o.BLOCK_ID) : null;
|
|
130
131
|
}
|
|
131
132
|
/**
|
|
132
133
|
* Returns the block's stable id, assigning one via the document modifier if
|
|
@@ -140,13 +141,13 @@ class J extends U {
|
|
|
140
141
|
return t;
|
|
141
142
|
if (!("getAttribute" in e))
|
|
142
143
|
return null;
|
|
143
|
-
const
|
|
144
|
+
const i = this._generateNextBlockId();
|
|
144
145
|
try {
|
|
145
|
-
this.api.getDocumentModifier().modifyHtml(e).setAttribute(
|
|
146
|
+
this.api.getDocumentModifier().modifyHtml(e).setAttribute(o.BLOCK_ID, i).apply(new k(`Assign unsubscribe block id ${i}`));
|
|
146
147
|
} catch (r) {
|
|
147
148
|
return console.warn("[UnsubscribeBlock] Failed to assign block id:", r), null;
|
|
148
149
|
}
|
|
149
|
-
return
|
|
150
|
+
return i;
|
|
150
151
|
}
|
|
151
152
|
/**
|
|
152
153
|
* Generates a unique id by scanning the document for the highest existing
|
|
@@ -157,10 +158,10 @@ class J extends U {
|
|
|
157
158
|
let e = 0;
|
|
158
159
|
try {
|
|
159
160
|
const t = this.api.getDocumentRoot();
|
|
160
|
-
t && "querySelectorAll" in t && t.querySelectorAll(
|
|
161
|
+
t && "querySelectorAll" in t && t.querySelectorAll(f).forEach((r) => {
|
|
161
162
|
if ("getAttribute" in r) {
|
|
162
|
-
const
|
|
163
|
-
|
|
163
|
+
const s = r.getAttribute(o.BLOCK_ID), n = s ? parseInt(s) : 0;
|
|
164
|
+
n > e && (e = n);
|
|
164
165
|
}
|
|
165
166
|
});
|
|
166
167
|
} catch {
|
|
@@ -169,14 +170,14 @@ class J extends U {
|
|
|
169
170
|
}
|
|
170
171
|
_warnLinkRemoved() {
|
|
171
172
|
try {
|
|
172
|
-
const { showToaster: e } =
|
|
173
|
+
const { showToaster: e } = D();
|
|
173
174
|
e({
|
|
174
|
-
type:
|
|
175
|
-
message: this.api.translate(
|
|
175
|
+
type: w.Warning,
|
|
176
|
+
message: this.api.translate(H),
|
|
176
177
|
actionButton: {
|
|
177
178
|
text: this.api.translate("Visit Academy"),
|
|
178
179
|
onClick: () => {
|
|
179
|
-
window.open(
|
|
180
|
+
window.open(K, "_blank", "noopener,noreferrer");
|
|
180
181
|
}
|
|
181
182
|
}
|
|
182
183
|
});
|
|
@@ -185,55 +186,62 @@ class J extends U {
|
|
|
185
186
|
}
|
|
186
187
|
}
|
|
187
188
|
_setupSelectEventListener() {
|
|
188
|
-
|
|
189
|
-
const t = e, { collectionType:
|
|
190
|
-
this._updateBlock(
|
|
191
|
-
}, document.addEventListener(
|
|
189
|
+
N(), d = (e) => {
|
|
190
|
+
const t = e, { collectionType: i, selectedPages: r } = t.detail;
|
|
191
|
+
this._updateBlock(i, r.join(","));
|
|
192
|
+
}, document.addEventListener(E.SELECT, d);
|
|
192
193
|
}
|
|
193
194
|
_setupCancelEventListener(e) {
|
|
194
|
-
|
|
195
|
-
const { detail:
|
|
196
|
-
((
|
|
197
|
-
}, document.addEventListener(
|
|
195
|
+
U(), b = (t) => {
|
|
196
|
+
const { detail: i } = t;
|
|
197
|
+
((i == null ? void 0 : i.blockId) ?? null) === e && this._handleCancel();
|
|
198
|
+
}, document.addEventListener(E.CANCEL, b);
|
|
198
199
|
}
|
|
199
200
|
_handleCancel() {
|
|
200
201
|
try {
|
|
201
202
|
if (!this.currentNode)
|
|
202
203
|
return;
|
|
203
|
-
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${
|
|
204
|
+
this.api.getDocumentModifier().modifyHtml(this.currentNode).replaceWith(`<${M.EMPTY_CONTAINER}/>`).apply(new k("Removed unsubscribe block due to cancel"));
|
|
204
205
|
} catch (e) {
|
|
205
206
|
console.warn("[UnsubscribeBlock] Failed to remove unsubscribe block:", e);
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
209
|
_updateBlock(e, t) {
|
|
210
|
+
var a;
|
|
209
211
|
if (!this.currentNode || !("querySelector" in this.currentNode))
|
|
210
212
|
return;
|
|
211
|
-
const
|
|
212
|
-
if (!
|
|
213
|
+
const i = this.currentNode.querySelector(_);
|
|
214
|
+
if (!i)
|
|
213
215
|
return;
|
|
214
|
-
const r = this._getMergeTag(e);
|
|
215
|
-
|
|
216
|
+
const r = this._getMergeTag(e), s = this.api.getDocumentModifier(), n = "getAttribute" in i ? i.getAttribute("href") : null, p = [(a = n == null ? void 0 : n.match(I)) == null ? void 0 : a[0], C];
|
|
217
|
+
s.modifyHtml(i).setAttribute("href", r), this.currentNode.querySelectorAll("a[href]").forEach((m) => {
|
|
218
|
+
var T;
|
|
219
|
+
if (!("getAttribute" in m) || m.getAttribute("data-unsubscribe-link") === "true")
|
|
220
|
+
return;
|
|
221
|
+
const S = m.getAttribute("href") ?? "", A = (T = S.match(I)) == null ? void 0 : T[0];
|
|
222
|
+
A && p.includes(A) && s.modifyHtml(m).setAttribute("href", q(S, r));
|
|
223
|
+
}), s.modifyHtml(this.currentNode).setAttribute(o.PAGE_TYPE, e.toString()).setAttribute(o.PAGE_LIST, t), s.apply(new k(`Updated unsubscribe link to ${r}`));
|
|
216
224
|
}
|
|
217
225
|
_getMergeTag(e) {
|
|
218
|
-
return
|
|
226
|
+
return Y[e] ?? C;
|
|
219
227
|
}
|
|
220
228
|
_openDrawer() {
|
|
221
229
|
if (!(this.currentNode && this.currentNode.getAttribute("data-unsubscribe-page-type")))
|
|
222
230
|
try {
|
|
223
|
-
const e =
|
|
231
|
+
const e = u();
|
|
224
232
|
e.typeSelectionDrawerStatus = !0;
|
|
225
233
|
} catch (e) {
|
|
226
234
|
console.error("[UnsubscribeBlock] Failed to open drawer:", e);
|
|
227
235
|
}
|
|
228
236
|
}
|
|
229
237
|
_checkExistingBlocks() {
|
|
230
|
-
const e =
|
|
231
|
-
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(
|
|
232
|
-
if ("getAttribute" in
|
|
233
|
-
const r =
|
|
238
|
+
const e = u();
|
|
239
|
+
e.isGlobalUnsubscribeDisabled = !1, e.isSubscriptionPreferencesCenterDisabled = !1, this.api.getDocumentRoot().querySelectorAll(f).forEach((i) => {
|
|
240
|
+
if ("getAttribute" in i) {
|
|
241
|
+
const r = i.getAttribute(o.PAGE_TYPE);
|
|
234
242
|
if (r) {
|
|
235
|
-
const
|
|
236
|
-
|
|
243
|
+
const s = Number(r);
|
|
244
|
+
s === B.GLOBAL_UNSUBSCRIBE ? e.isGlobalUnsubscribeDisabled = !0 : s === B.SUBSCRIPTION_PREFERENCE_CENTER && (e.isSubscriptionPreferencesCenterDisabled = !0);
|
|
237
245
|
}
|
|
238
246
|
}
|
|
239
247
|
});
|
|
@@ -241,27 +249,27 @@ class J extends U {
|
|
|
241
249
|
async _loadBlockState(e) {
|
|
242
250
|
if (!("getAttribute" in e))
|
|
243
251
|
return;
|
|
244
|
-
const t = e.getAttribute(
|
|
245
|
-
if (!t || !
|
|
252
|
+
const t = e.getAttribute(o.PAGE_TYPE), i = e.getAttribute(o.PAGE_LIST);
|
|
253
|
+
if (!t || !i)
|
|
246
254
|
return;
|
|
247
|
-
const r =
|
|
248
|
-
await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(
|
|
255
|
+
const r = u(), s = Number(t), n = L(i);
|
|
256
|
+
await r.fetchTemplates(), r.setCollectionWithoutAutoSelection(s), r.loadSelectedTemplates(n);
|
|
249
257
|
}
|
|
250
258
|
_resetStoreState() {
|
|
251
|
-
|
|
259
|
+
u().$reset();
|
|
252
260
|
}
|
|
253
261
|
_removeBlockTemplatesFromStore(e) {
|
|
254
262
|
if (!("getAttribute" in e))
|
|
255
263
|
return;
|
|
256
|
-
const t = e.getAttribute(
|
|
264
|
+
const t = e.getAttribute(o.PAGE_LIST);
|
|
257
265
|
if (!t)
|
|
258
266
|
return;
|
|
259
|
-
const
|
|
260
|
-
|
|
267
|
+
const i = u(), r = L(t);
|
|
268
|
+
i.removeUnsubscribePages(r);
|
|
261
269
|
}
|
|
262
270
|
}
|
|
263
271
|
export {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
272
|
+
F as UNSUBSCRIBE_BLOCK_ID,
|
|
273
|
+
se as UnsubscribeBlock,
|
|
274
|
+
W as disposeUnsubscribeListeners
|
|
267
275
|
};
|
|
@@ -5,10 +5,11 @@ const s = {
|
|
|
5
5
|
PAGE_TYPE: "data-unsubscribe-page-type",
|
|
6
6
|
PAGE_LIST: "data-unsubscribe-page-list",
|
|
7
7
|
BLOCK_ID: "data-unsubscribe-block-id"
|
|
8
|
-
},
|
|
8
|
+
}, e = ".unsubscribe-block-v2", E = /{{ins-(?:global-)?(?:preferences-)?unsubscribe-link}}/, c = 'a[data-unsubscribe-link="true"], a.unsubscribe-link';
|
|
9
9
|
export {
|
|
10
10
|
b as DATA_ATTRIBUTES,
|
|
11
|
-
|
|
11
|
+
e as UNSUBSCRIBE_BLOCK_SELECTOR,
|
|
12
12
|
s as UNSUBSCRIBE_EVENTS,
|
|
13
|
-
|
|
13
|
+
c as UNSUBSCRIBE_LINK_SELECTOR,
|
|
14
|
+
E as UNSUBSCRIBE_MERGE_TAG_REGEX
|
|
14
15
|
};
|
package/dist/package.json.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const o = "3.24.0-beta.
|
|
1
|
+
const o = "3.24.0-beta.0aa04e8", s = { stripo: { version: "2.83.1" } }, a = {
|
|
2
2
|
version: o,
|
|
3
3
|
guido: s
|
|
4
4
|
};
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default,
|
|
7
7
|
s as guido,
|
|
8
8
|
o as version
|
|
9
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LegacyPaddingViewport,
|
|
1
|
+
import type { LegacyPaddingViewport, LegacyVariable } from './types';
|
|
2
2
|
export declare function extractTitleText(block: Element): string;
|
|
3
3
|
/**
|
|
4
4
|
* Fallback for legacy configs that carry no `p_recommendation_title` variable:
|
|
@@ -50,13 +50,6 @@ export declare function extractCurrencyFromBlock(block: Element): Record<string,
|
|
|
50
50
|
* @returns The row's `es-p{n}{side}` padding, or undefined when the block has no product row
|
|
51
51
|
*/
|
|
52
52
|
export declare function extractRenderedBlockPadding(block: Element): LegacyPaddingViewport | undefined;
|
|
53
|
-
/**
|
|
54
|
-
* Settings and styling as the legacy block renders them, for blocks with no `esd-dev-product-config`.
|
|
55
|
-
* Themes come from the first card's inline CSS, in the shape the config-driven path already maps.
|
|
56
|
-
* @param block - The legacy recommendation block element
|
|
57
|
-
* @returns A product config holding only what the rendered markup shows; absent fields fall back to the mappers' defaults
|
|
58
|
-
*/
|
|
59
|
-
export declare function inferLegacyConfig(block: Element): LegacyProductConfig;
|
|
60
53
|
/**
|
|
61
54
|
* True when a PM has manually opted the legacy block out of content
|
|
62
55
|
* regeneration by adding the `ins-skip-compile` class. Detected before rebuild
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { LegacyProductConfig } from './types';
|
|
2
|
-
export declare const LEGACY_CONFIG_ATTR = "esd-dev-product-config";
|
|
3
2
|
/**
|
|
4
3
|
* `esd-dev-product-config` is double-HTML-encoded JSON: serialization
|
|
5
4
|
* escapes once to embed inside the attribute, and Stripo's templating
|
|
6
5
|
* layer escapes a second time when round-tripping. Returns `null` when
|
|
7
|
-
* the attribute is missing or unable to be parsed
|
|
6
|
+
* the attribute is missing or unable to be parsed — the caller treats
|
|
7
|
+
* either case as an abort.
|
|
8
8
|
*/
|
|
9
9
|
export declare function parseLegacyConfig(block: Element): LegacyProductConfig | null;
|
|
10
10
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Idempotent: the selector matches only blocks that
|
|
3
|
-
*
|
|
2
|
+
* Idempotent: the selector matches only blocks that have
|
|
3
|
+
* `esd-dev-product-config` AND lack `recommendation-block-v2`, so
|
|
4
|
+
* re-running on a migrated template is a no-op.
|
|
4
5
|
*/
|
|
5
6
|
import type { LegacyRecommendationConfig } from '@@/Types/config';
|
|
6
7
|
/**
|
|
@@ -9,4 +9,5 @@ export declare const DATA_ATTRIBUTES: {
|
|
|
9
9
|
readonly BLOCK_ID: "data-unsubscribe-block-id";
|
|
10
10
|
};
|
|
11
11
|
export declare const UNSUBSCRIBE_BLOCK_SELECTOR = ".unsubscribe-block-v2";
|
|
12
|
+
export declare const UNSUBSCRIBE_MERGE_TAG_REGEX: RegExp;
|
|
12
13
|
export declare const UNSUBSCRIBE_LINK_SELECTOR = "a[data-unsubscribe-link=\"true\"], a.unsubscribe-link";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const swapMergeTagInHref: (href: string, mergeTag: string) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.24.0-beta.
|
|
3
|
+
"version": "3.24.0-beta.0aa04e8",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|