@useinsider/guido 3.8.0-beta.eb4074b → 3.8.1-beta.110be29
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/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +8 -8
- package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +15 -12
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +5 -5
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +16 -15
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
- package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +42 -37
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +3 -3
- package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +40 -37
- package/dist/composables/useHtmlValidator.js +133 -180
- package/dist/composables/usePreviewInteractionGuard.js +17 -0
- package/dist/composables/useSave.js +14 -14
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +26 -17
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +57 -58
- package/dist/config/migrator/recommendation/extractors.js +22 -44
- package/dist/config/migrator/recommendation/htmlBuilder.js +169 -175
- package/dist/config/migrator/recommendationMigrator.js +31 -30
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +20 -26
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +41 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +57 -58
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +31 -43
- package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +2 -3
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +45 -55
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +56 -63
- package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +6 -7
- package/dist/extensions/Blocks/Recommendation/extension.js +2 -3
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +2 -3
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +12 -13
- package/dist/extensions/Blocks/Recommendation/templates/index.js +6 -7
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +1 -1
- package/dist/extensions/Blocks/Unsubscribe/block.js +40 -37
- package/dist/extensions/Blocks/Unsubscribe/control.js +19 -16
- package/dist/guido.css +1 -1
- package/dist/src/composables/useHtmlValidator.d.ts +0 -27
- package/dist/src/composables/usePreviewInteractionGuard.d.ts +3 -0
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +1 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +0 -15
- package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +0 -8
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -21
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +0 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -9
- package/dist/src/stores/unsubscribe.d.ts +11 -1
- package/dist/stores/unsubscribe.js +8 -7
- package/package.json +1 -1
- package/dist/config/compiler/utils/recommendationIgnoreUtils.js +0 -15
- package/dist/src/composables/useHtmlValidator.test.d.ts +0 -1
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +0 -17
- package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +0 -1
|
@@ -2,62 +2,61 @@ import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
|
2
2
|
import { useRecommendation as g } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return o === "before" ? `${t} ${i}` : `${i} ${t}`;
|
|
5
|
+
function h(r, n, e, o, i = "") {
|
|
6
|
+
const c = `{{${i}${r}_${n}_${e}}}`, t = `{{${i}${r}_${n}_currency}}`;
|
|
7
|
+
return o === "before" ? `${t} ${c}` : `${c} ${t}`;
|
|
9
8
|
}
|
|
10
|
-
function
|
|
9
|
+
function b(r) {
|
|
11
10
|
let n = r;
|
|
12
11
|
for (; n.children.length === 1; )
|
|
13
12
|
[n] = n.children;
|
|
14
13
|
return n;
|
|
15
14
|
}
|
|
16
|
-
function A(r, n, e, o,
|
|
15
|
+
function A(r, n, e, o, i, c) {
|
|
17
16
|
switch (n) {
|
|
18
17
|
case "productImage": {
|
|
19
18
|
const t = r.querySelector("img");
|
|
20
|
-
t && (t.setAttribute("src", `{{${
|
|
19
|
+
t && (t.setAttribute("src", `{{${c}${e}_${o}_image_url}}`), t.setAttribute("alt", `{{${c}${e}_${o}_name}}`));
|
|
21
20
|
const s = r.querySelector("a");
|
|
22
|
-
s && (s.setAttribute("href", `{{${
|
|
21
|
+
s && (s.setAttribute("href", `{{${c}${e}_${o}_url}}`), s.classList.add(q));
|
|
23
22
|
break;
|
|
24
23
|
}
|
|
25
24
|
case "productName": {
|
|
26
25
|
const t = r.querySelector("p");
|
|
27
|
-
t && (
|
|
26
|
+
t && (b(t).textContent = `{{${c}${e}_${o}_name}}`);
|
|
28
27
|
break;
|
|
29
28
|
}
|
|
30
29
|
case "productPrice": {
|
|
31
30
|
const t = r.querySelector("p");
|
|
32
|
-
t && (
|
|
31
|
+
t && (b(t).textContent = h(
|
|
33
32
|
e,
|
|
34
33
|
o,
|
|
35
34
|
"price",
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
i,
|
|
36
|
+
c
|
|
38
37
|
));
|
|
39
38
|
break;
|
|
40
39
|
}
|
|
41
40
|
case "productOldPrice": {
|
|
42
41
|
const t = r.querySelector("p");
|
|
43
|
-
t && (
|
|
42
|
+
t && (b(t).textContent = h(
|
|
44
43
|
e,
|
|
45
44
|
o,
|
|
46
45
|
"original_price",
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
i,
|
|
47
|
+
c
|
|
49
48
|
), t.setAttribute("product-attr", "discount"));
|
|
50
49
|
break;
|
|
51
50
|
}
|
|
52
51
|
case "productButton": {
|
|
53
52
|
const t = r.querySelector("a");
|
|
54
|
-
t && t.setAttribute("href", `{{${
|
|
53
|
+
t && t.setAttribute("href", `{{${c}${e}_${o}_url}}`);
|
|
55
54
|
break;
|
|
56
55
|
}
|
|
57
56
|
case "productOmnibusPrice": {
|
|
58
57
|
const t = r.querySelector(".omnibus-price-value");
|
|
59
58
|
if (t) {
|
|
60
|
-
t.textContent = `{{${
|
|
59
|
+
t.textContent = `{{${c}${e}_${o}_omnibus_price}}`;
|
|
61
60
|
const s = t.closest("p");
|
|
62
61
|
s && (s.setAttribute("product-attr", "omnibus_price"), s.setAttribute("composition", "true"));
|
|
63
62
|
}
|
|
@@ -66,7 +65,7 @@ function A(r, n, e, o, c, i) {
|
|
|
66
65
|
case "productOmnibusDiscount": {
|
|
67
66
|
const t = r.querySelector(".omnibus-discount-value");
|
|
68
67
|
if (t) {
|
|
69
|
-
t.textContent = `{{${
|
|
68
|
+
t.textContent = `{{${c}${e}_${o}_omnibus_discount}}`;
|
|
70
69
|
const s = t.closest("p");
|
|
71
70
|
s && (s.setAttribute("product-attr", "omnibus_discount"), s.setAttribute("composition", "true"));
|
|
72
71
|
}
|
|
@@ -76,15 +75,15 @@ function A(r, n, e, o, c, i) {
|
|
|
76
75
|
const t = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
|
|
77
76
|
if (t) {
|
|
78
77
|
const s = t.getAttribute("product-attr"), a = t.querySelector("p");
|
|
79
|
-
a && (
|
|
78
|
+
a && (b(a).textContent = `{{${c}${e}_${o}_${s}}}`);
|
|
80
79
|
}
|
|
81
80
|
break;
|
|
82
81
|
}
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
|
-
function
|
|
86
|
-
r.querySelectorAll(".recommendation-product-row").forEach((
|
|
87
|
-
|
|
84
|
+
function w(r, n, e, o) {
|
|
85
|
+
r.querySelectorAll(".recommendation-product-row").forEach((c, t) => {
|
|
86
|
+
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
88
87
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
89
88
|
p.length > 0 ? p.forEach((l) => {
|
|
90
89
|
A(l, u, n, t, e, o);
|
|
@@ -92,35 +91,35 @@ function E(r, n, e, o) {
|
|
|
92
91
|
});
|
|
93
92
|
});
|
|
94
93
|
}
|
|
95
|
-
function
|
|
96
|
-
const
|
|
97
|
-
if (!
|
|
94
|
+
function E(r, n, e, o) {
|
|
95
|
+
const i = r.querySelectorAll(".recommendation-product-row");
|
|
96
|
+
if (!i.length)
|
|
98
97
|
return;
|
|
99
|
-
const [
|
|
100
|
-
|
|
98
|
+
const [c] = i, t = c.querySelector("[data-attribute-type]"), s = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
99
|
+
i.forEach((a, u) => {
|
|
101
100
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
102
|
-
const
|
|
101
|
+
const d = l.getAttribute("data-attribute-type") || "";
|
|
103
102
|
l.querySelectorAll(".attribute-cell").forEach((y, $) => {
|
|
104
103
|
const S = u * s + $;
|
|
105
|
-
A(y,
|
|
104
|
+
A(y, d, n, S, e, o);
|
|
106
105
|
});
|
|
107
106
|
});
|
|
108
107
|
});
|
|
109
108
|
}
|
|
110
|
-
function
|
|
111
|
-
r.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
112
|
-
|
|
109
|
+
function R(r, n, e, o) {
|
|
110
|
+
r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
|
|
111
|
+
E(c, n, e, o);
|
|
113
112
|
});
|
|
114
113
|
}
|
|
115
|
-
function
|
|
116
|
-
const o = r.getAttribute("data-layout") || "grid",
|
|
117
|
-
o === "list" ?
|
|
114
|
+
function P(r, n, e) {
|
|
115
|
+
const o = r.getAttribute("data-layout") || "grid", i = r.getAttribute("currency-alignment") || "after";
|
|
116
|
+
o === "list" ? w(r, n, i, e) : R(r, n, i, e);
|
|
118
117
|
}
|
|
119
|
-
function
|
|
120
|
-
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"),
|
|
121
|
-
return
|
|
118
|
+
function f(r, n, e) {
|
|
119
|
+
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), i = r.match(o);
|
|
120
|
+
return i ? parseInt(i[1]) : e;
|
|
122
121
|
}
|
|
123
|
-
function
|
|
122
|
+
function T(r, n) {
|
|
124
123
|
let e = r.parentElement;
|
|
125
124
|
for (; e && e !== n; ) {
|
|
126
125
|
if (e.tagName === "TD") {
|
|
@@ -132,42 +131,42 @@ function v(r, n) {
|
|
|
132
131
|
}
|
|
133
132
|
return null;
|
|
134
133
|
}
|
|
135
|
-
function
|
|
136
|
-
const n = r.getAttribute("style") || "", e =
|
|
137
|
-
|
|
138
|
-
if (
|
|
134
|
+
function v(r) {
|
|
135
|
+
const n = r.getAttribute("style") || "", e = f(n, "width", 600), o = f(n, "padding", 0) * 2, i = Math.max(0, e - o);
|
|
136
|
+
i !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
137
|
+
if (c.hasAttribute("width"))
|
|
139
138
|
return;
|
|
140
|
-
const t =
|
|
139
|
+
const t = T(c, r);
|
|
141
140
|
if (!t)
|
|
142
141
|
return;
|
|
143
|
-
const s = t.getAttribute("width"), a = parseFloat(s), u =
|
|
144
|
-
|
|
145
|
-
const
|
|
146
|
-
if (!/\bwidth\s*:\s*\d/i.test(
|
|
147
|
-
const
|
|
148
|
-
|
|
142
|
+
const s = t.getAttribute("width"), a = parseFloat(s), u = f(t.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(i * a / 100), l = Math.max(1, p - u);
|
|
143
|
+
c.setAttribute("width", String(l));
|
|
144
|
+
const d = c.getAttribute("style") || "";
|
|
145
|
+
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
146
|
+
const m = d && !d.trim().endsWith(";") ? "; " : "";
|
|
147
|
+
c.setAttribute("style", `${d}${m}width: ${l}px`);
|
|
149
148
|
}
|
|
150
149
|
});
|
|
151
150
|
}
|
|
152
|
-
function
|
|
151
|
+
function O(r, n) {
|
|
153
152
|
const e = r.match(/<!DOCTYPE[^>]*>/i);
|
|
154
153
|
return (e ? `${e[0]}
|
|
155
154
|
` : "") + n.documentElement.outerHTML;
|
|
156
155
|
}
|
|
157
|
-
function
|
|
156
|
+
function N(r) {
|
|
158
157
|
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(n, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
159
158
|
if (!o.length)
|
|
160
159
|
return r;
|
|
161
|
-
const { buildCampaignUrl:
|
|
162
|
-
|
|
160
|
+
const { buildCampaignUrl: i } = g(), c = C();
|
|
161
|
+
c.recommendationCampaignUrls = {};
|
|
163
162
|
const { isFeatureEnabled: t } = _(), s = t("liquidSyntax") ? "reco_" : "";
|
|
164
163
|
return o.forEach((u) => {
|
|
165
|
-
var l,
|
|
164
|
+
var l, d;
|
|
166
165
|
const p = u.getAttribute("recommendation-id");
|
|
167
|
-
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (
|
|
168
|
-
}),
|
|
166
|
+
p && ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), i(p), P(u, p, s), v(u));
|
|
167
|
+
}), O(n, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
169
168
|
}
|
|
170
169
|
export {
|
|
171
170
|
h as formatPriceVariable,
|
|
172
|
-
|
|
171
|
+
N as prepareRecommendationBlocks
|
|
173
172
|
};
|
|
@@ -1,49 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return e && e.length > 0 ? e : a;
|
|
1
|
+
const i = "You May Also Like!";
|
|
2
|
+
function s(r) {
|
|
3
|
+
var e;
|
|
4
|
+
const o = r.querySelector(".ext-recommendation-title");
|
|
5
|
+
if (!o)
|
|
6
|
+
return i;
|
|
7
|
+
const t = (e = o.textContent) == null ? void 0 : e.trim();
|
|
8
|
+
return t && t.length > 0 ? t : i;
|
|
10
9
|
}
|
|
11
|
-
function
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
...Array.from(
|
|
10
|
+
function u(r) {
|
|
11
|
+
const o = [
|
|
12
|
+
r,
|
|
13
|
+
...Array.from(r.querySelectorAll(".product-card, .ext-recommendation-card"))
|
|
15
14
|
];
|
|
16
|
-
let
|
|
17
|
-
return
|
|
18
|
-
const
|
|
19
|
-
if (
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
return
|
|
23
|
-
}),
|
|
24
|
-
}
|
|
25
|
-
function C(t) {
|
|
26
|
-
const r = t.getAttribute(n.CURRENCY);
|
|
27
|
-
if (!r)
|
|
28
|
-
return;
|
|
29
|
-
const e = t.getAttribute(n.SYMBOL);
|
|
30
|
-
return {
|
|
31
|
-
value: r,
|
|
32
|
-
// An empty `currency-symbol` is omitted so `mapCurrency` falls back to
|
|
33
|
-
// the currency code as the symbol.
|
|
34
|
-
...e ? { symbol: e } : {},
|
|
35
|
-
alignment: t.getAttribute(n.ALIGNMENT) ?? "",
|
|
36
|
-
decimalCount: t.getAttribute(n.DECIMAL_COUNT) ?? "",
|
|
37
|
-
decimalSeparator: t.getAttribute(n.DECIMAL_SEPARATOR) ?? "",
|
|
38
|
-
thousandSeparator: t.getAttribute(n.THOUSAND_SEPARATOR) ?? ""
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
function d(t) {
|
|
42
|
-
return t.classList.contains(c);
|
|
15
|
+
let t = "";
|
|
16
|
+
return o.some((e) => {
|
|
17
|
+
const n = e.getAttribute("bgcolor");
|
|
18
|
+
if (n && n.trim())
|
|
19
|
+
return t = n.trim(), !0;
|
|
20
|
+
const c = (e.getAttribute("style") ?? "").match(/background-color\s*:\s*([^;]+)/i);
|
|
21
|
+
return c && c[1] ? (t = c[1].trim(), !0) : !1;
|
|
22
|
+
}), t;
|
|
43
23
|
}
|
|
44
24
|
export {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
l as extractTitleText,
|
|
48
|
-
d as isPartnerManagedBlock
|
|
25
|
+
u as extractCardBgColor,
|
|
26
|
+
s as extractTitleText
|
|
49
27
|
};
|