@useinsider/guido 3.18.2-beta.f42547e → 3.18.2-beta.fc246a7
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/Guido.vue.js +3 -3
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +11 -13
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -70
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +37 -23
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +18 -20
- package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useCustomInterfaceAppearance.js +46 -56
- package/dist/composables/useHtmlValidator.js +79 -84
- package/dist/composables/useHttp.js +22 -24
- package/dist/composables/useRecommendation.js +35 -40
- package/dist/composables/useStripo.js +30 -30
- package/dist/config/migrator/itemsBlockMigrator.js +257 -167
- package/dist/enums/extensions/recommendationBlock.js +31 -38
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
- package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
- package/dist/extensions/Blocks/Items/template.js +219 -204
- package/dist/extensions/Blocks/Recommendation/block.js +39 -43
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +20 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +35 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +52 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +90 -189
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +16 -26
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +12 -21
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +14 -17
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -9
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +2 -7
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -75
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +0 -4
- package/dist/src/stores/onboarding.d.ts +0 -377
- package/dist/src/utils/genericUtil.d.ts +0 -6
- package/dist/static/styles/components/recommendation-strategy.css.js +4 -34
- package/dist/stores/onboarding.js +36 -41
- package/dist/utils/genericUtil.js +39 -45
- package/dist/utils/pairProductVariables.js +71 -71
- package/dist/utils/templatePreparation.js +60 -61
- package/package.json +1 -1
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -47
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +0 -24
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +0 -14
- package/dist/static/styles/components/skeleton.css.js +0 -23
|
@@ -1,75 +1,69 @@
|
|
|
1
|
-
const o = (
|
|
2
|
-
const
|
|
3
|
-
text:
|
|
1
|
+
const o = (t) => {
|
|
2
|
+
const a = t.value.match(/\{\{([^}]+)\}\}/)[1].split("|").map((l) => l.trim()), [s] = a, r = {
|
|
3
|
+
text: t.label,
|
|
4
4
|
value: s || ""
|
|
5
5
|
};
|
|
6
|
-
if (
|
|
7
|
-
const [,
|
|
8
|
-
if (
|
|
9
|
-
let n =
|
|
6
|
+
if (a.length >= 2) {
|
|
7
|
+
const [, l, e] = a;
|
|
8
|
+
if (l.startsWith("default:")) {
|
|
9
|
+
let n = l.slice(8).trim();
|
|
10
10
|
n.startsWith('"') && n.endsWith('"') && (n = n.slice(1, -1)), r.fallback = n;
|
|
11
11
|
} else {
|
|
12
|
-
const n =
|
|
13
|
-
n ? r.format = n :
|
|
12
|
+
const n = l.includes("=") ? { key: l.split("=")[0].trim(), value: l.split("=")[1].trim() } : null;
|
|
13
|
+
n ? r.format = n : e || (r.fallback = l), e && (r.fallback = e);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
return r;
|
|
17
|
-
},
|
|
18
|
-
if (
|
|
17
|
+
}, f = (t, c = !1) => t.map((a) => {
|
|
18
|
+
if (a.format)
|
|
19
19
|
return {
|
|
20
|
-
label: `${
|
|
21
|
-
value: `{{${
|
|
20
|
+
label: `${a.text} | ${a.format.key}=${a.format.value}`,
|
|
21
|
+
value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
|
|
22
22
|
};
|
|
23
23
|
if (c) {
|
|
24
|
-
if (!
|
|
24
|
+
if (!a.fallback)
|
|
25
25
|
return {
|
|
26
|
-
label:
|
|
27
|
-
value: `{{ ${
|
|
26
|
+
label: a.text,
|
|
27
|
+
value: `{{ ${a.value} }}`
|
|
28
28
|
};
|
|
29
|
-
const r = !Number.isNaN(Number(
|
|
29
|
+
const r = !Number.isNaN(Number(a.fallback)) && a.fallback.trim() !== "" ? a.fallback : `"${a.fallback}"`;
|
|
30
30
|
return {
|
|
31
|
-
label: `${
|
|
32
|
-
value: `{{ ${
|
|
31
|
+
label: `${a.text} | ${a.fallback}`,
|
|
32
|
+
value: `{{ ${a.value} | default: ${r} }}`
|
|
33
33
|
};
|
|
34
34
|
}
|
|
35
35
|
return {
|
|
36
|
-
label:
|
|
37
|
-
value:
|
|
36
|
+
label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
|
|
37
|
+
value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
|
|
38
38
|
};
|
|
39
|
-
}), b = (
|
|
40
|
-
const c = [],
|
|
41
|
-
Array.isArray(
|
|
42
|
-
const n = [...
|
|
39
|
+
}), b = (t) => {
|
|
40
|
+
const c = [], a = /* @__PURE__ */ new Set(), s = (l) => {
|
|
41
|
+
Array.isArray(l) && l.forEach((e) => {
|
|
42
|
+
const n = [...e.children ?? [], ...e.select_items ?? []];
|
|
43
43
|
if (n.length > 0) {
|
|
44
44
|
s(n);
|
|
45
45
|
return;
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
47
|
+
const u = e.text || e.tag_text;
|
|
48
|
+
u && e.value && !a.has(e.value) && (a.add(e.value), c.push({ text: u, value: e.value }));
|
|
49
49
|
});
|
|
50
|
-
}, [r] = Object.values(
|
|
50
|
+
}, [r] = Object.values(t ?? {});
|
|
51
51
|
return s(r), c;
|
|
52
|
-
}, i = (
|
|
53
|
-
const s = new Set(
|
|
52
|
+
}, i = (t, c, a = !1) => {
|
|
53
|
+
const s = new Set(t.map((l) => l.value)), r = c.filter((l) => s.has(l.value) ? !1 : (s.add(l.value), !0));
|
|
54
54
|
return [
|
|
55
|
-
...
|
|
56
|
-
...
|
|
55
|
+
...f(t, a),
|
|
56
|
+
...f(r, a)
|
|
57
57
|
];
|
|
58
|
-
},
|
|
59
|
-
var
|
|
60
|
-
return ((
|
|
61
|
-
},
|
|
62
|
-
if (a === null || typeof a != "object" || Array.isArray(a))
|
|
63
|
-
return !1;
|
|
64
|
-
const c = Object.getPrototypeOf(a);
|
|
65
|
-
return c === Object.prototype || c === null;
|
|
66
|
-
};
|
|
58
|
+
}, v = () => {
|
|
59
|
+
var t;
|
|
60
|
+
return ((t = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : t.getAttribute("content")) ?? "";
|
|
61
|
+
}, k = (t) => typeof t == "string" ? t : typeof t == "number" ? String(t) : "";
|
|
67
62
|
export {
|
|
68
|
-
|
|
63
|
+
k as asText,
|
|
69
64
|
i as buildMergeTagEntries,
|
|
70
|
-
|
|
65
|
+
f as dynamicContentToMergeTags,
|
|
71
66
|
b as flattenDynamicContentList,
|
|
72
|
-
|
|
73
|
-
y as isPlainObject,
|
|
67
|
+
v as getCsrfToken,
|
|
74
68
|
o as mergeTagToDynamicContent
|
|
75
69
|
};
|
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import { ITEMS_CURRENCY_ATTR as
|
|
2
|
-
import { productPairs as
|
|
1
|
+
import { ITEMS_CURRENCY_ATTR as x, isCustomCurrencySymbol as Y } from "../extensions/Blocks/Items/constants/currency.js";
|
|
2
|
+
import { productPairs as w } from "../extensions/Blocks/Items/enums/productEnums.js";
|
|
3
3
|
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
4
|
+
import { preserveTextStyles as P } from "./preserveTextStyles.js";
|
|
5
|
+
import { unwrapProductNameLinks as v } from "./unwrapProductNameLink.js";
|
|
6
|
+
const O = {
|
|
7
7
|
CART_ITEMS: "ins_apr",
|
|
8
8
|
BROWSED_ITEMS: "browsed_item",
|
|
9
9
|
PURCHASED_ITEMS: "purchased_item"
|
|
10
|
-
},
|
|
11
|
-
function
|
|
10
|
+
}, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function B(S, y, b) {
|
|
12
12
|
let h = y;
|
|
13
13
|
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
14
14
|
h -= 1;
|
|
15
15
|
return b.some((I) => S.endsWith(I, h));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const y =
|
|
19
|
-
|
|
20
|
-
const h =
|
|
17
|
+
function Z(S) {
|
|
18
|
+
const y = q(S), b = new DOMParser().parseFromString(y, "text/html");
|
|
19
|
+
v(b);
|
|
20
|
+
const h = w.PAIRS_FOR_EXTENSION;
|
|
21
21
|
Object.entries(h).forEach(([n, d]) => {
|
|
22
22
|
b.querySelectorAll(".ins-product-td").forEach((r) => {
|
|
23
23
|
const E = r.getAttribute("data-number") || "1", m = r.getAttribute("data-type") || "CART_ITEMS";
|
|
24
24
|
r.querySelectorAll(`[product-attr="${n}"]`).forEach((t) => {
|
|
25
|
-
var $,
|
|
26
|
-
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E,
|
|
27
|
-
if (
|
|
25
|
+
var $, F, D, N;
|
|
26
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
|
|
27
|
+
if (f)
|
|
28
28
|
switch (n) {
|
|
29
29
|
case "imageSrc": {
|
|
30
|
-
let e = null,
|
|
31
|
-
if (t.tagName === "IMG" ? (e = t,
|
|
30
|
+
let e = null, a = null;
|
|
31
|
+
if (t.tagName === "IMG" ? (e = t, a = e.closest("a")) : (e = t.querySelector("img"), a = t.querySelector("a") || t.closest("a")), !e)
|
|
32
32
|
break;
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
-
return
|
|
39
|
-
}) && (e.src = `{{${
|
|
33
|
+
const l = f.DEFAULT, c = f.ATTR;
|
|
34
|
+
if (l && e.src) {
|
|
35
|
+
const s = e.src;
|
|
36
|
+
l.some((R) => {
|
|
37
|
+
const u = R.split("/").pop() || "", H = s.split("/").pop() || "";
|
|
38
|
+
return s.includes(R) || s.includes(u) || H === u;
|
|
39
|
+
}) && (e.src = `{{${c}_${o}}}`);
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
const
|
|
46
|
-
(
|
|
41
|
+
const i = (F = ($ = h.name) == null ? void 0 : $[g]) == null ? void 0 : F.ATTR;
|
|
42
|
+
if (i && e.setAttribute("alt", `{{${i}_${o}}}`), a) {
|
|
43
|
+
const s = (D = h.itemLink) == null ? void 0 : D[g];
|
|
44
|
+
if (s) {
|
|
45
|
+
const _ = s.HREF, R = s.DEFAULT_HREF || "#!", u = a.href;
|
|
46
|
+
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(R) || u === `${window.location.href}${R}` || !u || u === window.location.href) && (a.href = `{{${_}_${o}}}`);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
break;
|
|
50
50
|
}
|
|
51
51
|
case "name": {
|
|
52
|
-
const e =
|
|
53
|
-
t.textContent && (t.innerHTML =
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
(
|
|
52
|
+
const e = f, a = e.ATTR, l = e.DEFAULT_HREF || "#!", c = e.HREF;
|
|
53
|
+
t.textContent && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
54
|
+
const i = t.closest("a") || (t.tagName === "A" ? t : null);
|
|
55
|
+
if (i && c) {
|
|
56
|
+
const s = i.href, _ = `${window.location.href}${l}`;
|
|
57
|
+
(s === _ || s.endsWith(l)) && (i.href = `{{${c}_${o}}}`);
|
|
58
58
|
}
|
|
59
59
|
break;
|
|
60
60
|
}
|
|
61
61
|
case "price":
|
|
62
62
|
case "originalPrice": {
|
|
63
|
-
const e =
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
const
|
|
67
|
-
let
|
|
68
|
-
const
|
|
63
|
+
const e = f, a = t.getAttribute("data-formated"), l = t.getAttribute("data-single_price"), c = a === "true", i = l === "true", s = t.getAttribute(x.POSITION) || "before";
|
|
64
|
+
let _;
|
|
65
|
+
i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
66
|
+
const R = e.CURRENCY;
|
|
67
|
+
let u = `{{${_}_${o}}}`;
|
|
68
|
+
const H = (t.getAttribute(x.SYMBOL) || "").trim(), G = Y(H);
|
|
69
69
|
let C = "";
|
|
70
|
-
|
|
70
|
+
G ? C = H : R && (C = `{{${R}_${o}}}`), C && (u = s === "after" ? `${u} ${C}` : `${C} ${u}`), t.innerHTML = P(t, u);
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
case "quantity": {
|
|
74
|
-
const e =
|
|
75
|
-
|
|
74
|
+
const e = f, a = e.ATTR, l = [e.DEFAULT, ...e.LEGACY_DEFAULTS], c = (N = t.textContent) == null ? void 0 : N.trim();
|
|
75
|
+
c && l.includes(c) && (t.innerHTML = P(t, `{{${a}_${o}}}`));
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
case "button": {
|
|
79
|
-
const e =
|
|
80
|
-
if (
|
|
81
|
-
const
|
|
82
|
-
(
|
|
79
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t.tagName === "A" ? t : t.querySelector("a");
|
|
80
|
+
if (c) {
|
|
81
|
+
const i = c.href || "", s = `${window.location.href}${l}`;
|
|
82
|
+
(i === "" || i === "#" || i === s || i.endsWith(l) || i.endsWith("#!") || i === window.location.href) && (c.href = `{{${a}_${o}}}`);
|
|
83
83
|
}
|
|
84
84
|
break;
|
|
85
85
|
}
|
|
86
86
|
case "itemLink": {
|
|
87
|
-
const e =
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
(
|
|
87
|
+
const e = f, a = e.HREF, l = e.DEFAULT_HREF || "#!", c = t;
|
|
88
|
+
if (c.href) {
|
|
89
|
+
const i = c.href, s = `${window.location.href}${l}`;
|
|
90
|
+
(i === s || i.endsWith(l)) && (c.href = `{{${a}_${o}}}`);
|
|
91
91
|
}
|
|
92
92
|
break;
|
|
93
93
|
}
|
|
94
94
|
default: {
|
|
95
|
-
if ("ATTR" in
|
|
96
|
-
const e =
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
95
|
+
if ("ATTR" in f) {
|
|
96
|
+
const e = f.ATTR;
|
|
97
|
+
t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
@@ -102,9 +102,9 @@ function K(S) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
const I = y.match(/<!DOCTYPE[^>]*>/i),
|
|
106
|
-
` : "",
|
|
107
|
-
|
|
105
|
+
const I = y.match(/<!DOCTYPE[^>]*>/i), U = I ? `${I[0]}
|
|
106
|
+
` : "", W = b.querySelectorAll(".ins-product-td"), M = [];
|
|
107
|
+
W.forEach((n) => {
|
|
108
108
|
const d = n.getAttribute("data-type") || "CART_ITEMS", p = n.getAttribute("data-number") || "1", r = n.outerHTML;
|
|
109
109
|
M.push({
|
|
110
110
|
element: n,
|
|
@@ -113,38 +113,38 @@ function K(S) {
|
|
|
113
113
|
number: p
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
|
-
let A =
|
|
116
|
+
let A = U + b.documentElement.outerHTML;
|
|
117
117
|
M.reverse().forEach(({ outerHtml: n, type: d, number: p }) => {
|
|
118
|
-
const r =
|
|
118
|
+
const r = O[d], E = r ? `${r}_total_product_kind` : "";
|
|
119
119
|
if (E) {
|
|
120
120
|
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
121
121
|
A = A.replace(n, X(o));
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
const
|
|
125
|
-
return
|
|
124
|
+
const V = b.querySelectorAll('[product-attr="originalPrice"][data-type]'), L = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Set();
|
|
125
|
+
return V.forEach((n) => {
|
|
126
126
|
var t;
|
|
127
127
|
const d = n.getAttribute("data-number"), p = n.getAttribute("data-type");
|
|
128
|
-
if (!d || !
|
|
128
|
+
if (!d || !O[p])
|
|
129
129
|
return;
|
|
130
130
|
const r = n.closest(".product-original-price-class");
|
|
131
131
|
if (!r || k.has(r))
|
|
132
132
|
return;
|
|
133
133
|
k.add(r);
|
|
134
|
-
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T =
|
|
135
|
-
T.wrap.push(m !== "false"),
|
|
136
|
-
}),
|
|
134
|
+
const E = r.outerHTML, m = (t = n.closest(".ins-product-td")) == null ? void 0 : t.getAttribute("data-nodup"), T = L.get(E) ?? { number: d, type: p, wrap: [] };
|
|
135
|
+
T.wrap.push(m !== "false"), L.set(E, T);
|
|
136
|
+
}), L.forEach(({ number: n, type: d, wrap: p }, r) => {
|
|
137
137
|
if (r.includes("{% if") || !p.some(Boolean))
|
|
138
138
|
return;
|
|
139
|
-
const E =
|
|
140
|
-
let g = "", o = 0,
|
|
139
|
+
const E = w.PAIRS_FOR_EXTENSION.price[d].PRICE, m = w.PAIRS_FOR_EXTENSION.originalPrice[d].PRICE, T = `{% if ${E}_${n} != ${m}_${n} %}`, t = [T, q(T)];
|
|
140
|
+
let g = "", o = 0, f = 0, $ = A.indexOf(r);
|
|
141
141
|
for (; $ !== -1; ) {
|
|
142
|
-
const
|
|
143
|
-
g += A.slice(o, $) + (
|
|
142
|
+
const F = p[f] === !0 && !B(A, $, t);
|
|
143
|
+
g += A.slice(o, $) + (F ? `${T}${r}{% endif %}` : r), o = $ + r.length, f += 1, $ = A.indexOf(r, o);
|
|
144
144
|
}
|
|
145
145
|
A = g + A.slice(o);
|
|
146
146
|
}), A.replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
147
147
|
}
|
|
148
148
|
export {
|
|
149
|
-
|
|
149
|
+
Z as pairProductVariables
|
|
150
150
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useConfig as
|
|
3
|
-
import { useHtmlCompiler as
|
|
4
|
-
import {
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { mapLegacyStrategy as
|
|
7
|
-
import { DATA_ATTRIBUTES as
|
|
8
|
-
import { parsePageList as
|
|
9
|
-
import { useDynamicContentStore as
|
|
10
|
-
import { useEditorStore as
|
|
1
|
+
import { useActionsApi as k } from "../composables/useActionsApi.js";
|
|
2
|
+
import { useConfig as U } from "../composables/useConfig.js";
|
|
3
|
+
import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
|
|
4
|
+
import { DEFAULT_CURRENCY as m, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
|
+
import { useRecommendationExtensionStore as T } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
|
+
import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
|
+
import { DATA_ATTRIBUTES as C } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
8
|
+
import { parsePageList as R } from "../extensions/Blocks/Unsubscribe/utils/utils.js";
|
|
9
|
+
import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
|
|
10
|
+
import { useEditorStore as z } from "../stores/editor.js";
|
|
11
11
|
import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
r && t.push(...L(r));
|
|
12
|
+
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
13
|
+
function O(l) {
|
|
14
|
+
const c = new DOMParser().parseFromString(l, "text/html").querySelectorAll(`[${C.PAGE_LIST}]`), t = [];
|
|
15
|
+
return c.forEach((i) => {
|
|
16
|
+
const o = i.getAttribute(C.PAGE_LIST);
|
|
17
|
+
o && t.push(...R(o));
|
|
19
18
|
}), [...new Set(t)];
|
|
20
19
|
}
|
|
21
20
|
async function M(l) {
|
|
22
|
-
const
|
|
23
|
-
if (
|
|
21
|
+
const n = new DOMParser().parseFromString(l, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (n.length === 0)
|
|
24
23
|
return;
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
var d, g, f,
|
|
28
|
-
const
|
|
29
|
-
if (!Number.isFinite(
|
|
24
|
+
const c = T();
|
|
25
|
+
n.forEach((t) => {
|
|
26
|
+
var r, d, g, f, s, y;
|
|
27
|
+
const i = t.getAttribute("recommendation-id"), o = i ? Number(i) : NaN;
|
|
28
|
+
if (!Number.isFinite(o))
|
|
30
29
|
return;
|
|
31
30
|
const p = t.getAttribute("esd-ext-config");
|
|
32
31
|
if (!p)
|
|
@@ -37,32 +36,32 @@ async function M(l) {
|
|
|
37
36
|
} catch {
|
|
38
37
|
return;
|
|
39
38
|
}
|
|
40
|
-
if (!
|
|
39
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
41
40
|
return;
|
|
42
|
-
const
|
|
41
|
+
const b = {
|
|
43
42
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
44
43
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
45
44
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
46
|
-
strategy:
|
|
47
|
-
strategyId: e.strategyId ??
|
|
48
|
-
language: e.language ??
|
|
49
|
-
size: e.size ??
|
|
45
|
+
strategy: L(e.strategy) || a.strategy,
|
|
46
|
+
strategyId: e.strategyId ?? a.strategyId,
|
|
47
|
+
language: e.language ?? a.language,
|
|
48
|
+
size: e.size ?? a.size,
|
|
50
49
|
// Spread the default arrays so each block gets a fresh reference
|
|
51
50
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
52
|
-
productIds: e.productIds ?? [...
|
|
53
|
-
filters: e.filters ?? [...
|
|
54
|
-
shuffleProducts: e.shuffleProducts ??
|
|
55
|
-
currencyCode: ((
|
|
56
|
-
currencySymbol: ((
|
|
57
|
-
currencyAlignment: ((
|
|
58
|
-
currencyDecimalCount: ((
|
|
59
|
-
currencyDecimalSeparator: ((
|
|
60
|
-
currencyThousandSeparator: ((
|
|
51
|
+
productIds: e.productIds ?? [...a.productIds],
|
|
52
|
+
filters: e.filters ?? [...a.filters],
|
|
53
|
+
shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
|
|
54
|
+
currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? m.code,
|
|
55
|
+
currencySymbol: ((d = e.currency) == null ? void 0 : d.symbol) ?? m.symbol,
|
|
56
|
+
currencyAlignment: ((g = e.currency) == null ? void 0 : g.alignment) ?? m.alignment,
|
|
57
|
+
currencyDecimalCount: ((f = e.currency) == null ? void 0 : f.decimalCount) ?? m.decimalCount,
|
|
58
|
+
currencyDecimalSeparator: ((s = e.currency) == null ? void 0 : s.decimalSeparator) ?? m.decimalSeparator,
|
|
59
|
+
currencyThousandSeparator: ((y = e.currency) == null ? void 0 : y.thousandSeparator) ?? m.thousandSeparator
|
|
61
60
|
};
|
|
62
|
-
|
|
61
|
+
c.seedBlockUrlConfig(o, b);
|
|
63
62
|
});
|
|
64
63
|
try {
|
|
65
|
-
await
|
|
64
|
+
await c.fetchRecommendationCreateData();
|
|
66
65
|
} catch (t) {
|
|
67
66
|
console.warn(
|
|
68
67
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -70,34 +69,34 @@ async function M(l) {
|
|
|
70
69
|
);
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
|
-
const
|
|
74
|
-
const l =
|
|
72
|
+
const Z = () => {
|
|
73
|
+
const l = N(), u = z(), n = _(), { getCompiledEmail: c, getTemplateData: t, updateHtmlAndCss: i } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
75
74
|
return {
|
|
76
75
|
prepareTemplateDetails: async () => {
|
|
77
|
-
let { html:
|
|
76
|
+
let { html: r, css: d, syncModulesIds: g = [] } = await t();
|
|
78
77
|
if (e("linkTrackingIds"))
|
|
79
78
|
try {
|
|
80
|
-
const { html:
|
|
81
|
-
u.trackIdSessionFloor = H, F && (
|
|
82
|
-
} catch (
|
|
83
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
79
|
+
const { html: h, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
|
|
80
|
+
u.trackIdSessionFloor = H, F && (r = h, await i(h, d));
|
|
81
|
+
} catch (h) {
|
|
82
|
+
console.error("Tracking-id step failed, saving anyway:", h);
|
|
84
83
|
}
|
|
85
|
-
const { html: f, ampHtml:
|
|
84
|
+
const { html: f, ampHtml: s = "", ampErrors: y = [] } = await c({
|
|
86
85
|
minimize: !0,
|
|
87
86
|
resetDataSavedFlag: !1
|
|
88
87
|
});
|
|
89
|
-
|
|
90
|
-
const { compiledHtml:
|
|
88
|
+
n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
|
|
89
|
+
const { compiledHtml: I, stats: S, appliedRules: w } = o(f), D = s && p(s).compiledHtml, E = l.getSelectedDynamicContentList, P = T(), A = O(r);
|
|
91
90
|
return console.debug("HTML Compilation Stats:", {
|
|
92
|
-
originalSize:
|
|
93
|
-
compiledSize:
|
|
94
|
-
reduction: `${
|
|
91
|
+
originalSize: S.originalSize,
|
|
92
|
+
compiledSize: S.compiledSize,
|
|
93
|
+
reduction: `${S.reductionPercentage.toFixed(2)}%`,
|
|
95
94
|
appliedRules: w,
|
|
96
|
-
executionTime: `${
|
|
95
|
+
executionTime: `${S.executionTime.toFixed(2)}ms`
|
|
97
96
|
}), {
|
|
98
97
|
dynamicContentList: E,
|
|
99
|
-
compiledHtml:
|
|
100
|
-
rawHtml:
|
|
98
|
+
compiledHtml: I,
|
|
99
|
+
rawHtml: r,
|
|
101
100
|
css: d,
|
|
102
101
|
ampHtml: D,
|
|
103
102
|
ampErrors: y,
|
|
@@ -107,14 +106,14 @@ const re = () => {
|
|
|
107
106
|
configs: {}
|
|
108
107
|
},
|
|
109
108
|
unsubscribe: {
|
|
110
|
-
status:
|
|
111
|
-
config:
|
|
109
|
+
status: A.length > 0,
|
|
110
|
+
config: A
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
113
|
}
|
|
115
114
|
};
|
|
116
115
|
};
|
|
117
116
|
export {
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
O as getHtmlReferencedUnsubscribePages,
|
|
118
|
+
Z as useTemplatePreparation
|
|
120
119
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.18.2-beta.
|
|
3
|
+
"version": "3.18.2-beta.fc246a7",
|
|
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",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import d from "./RecommendationStrategyOnboarding.vue2.js";
|
|
2
|
-
/* empty css */
|
|
3
|
-
import g from "../../../_virtual/_plugin-vue2_normalizer.js";
|
|
4
|
-
var m = function() {
|
|
5
|
-
var e, n, r, i, a;
|
|
6
|
-
var t = this, s = t._self._c, o = t._self._setupProxy;
|
|
7
|
-
return o.isVisible ? s(o.InOnboard, { key: "guido__recommendation-strategy-onboard", staticClass: "w-21-s p-a z-11", class: (e = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : e.classes, attrs: { id: "guido__recommendation-strategy-onboard", "is-multiple-page": "", visible: "", "image-source": "", title: "", "left-position": (n = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : n.left, "pages-config": o.onboardingStore.onboardings.recommendationStrategyOnboarding.config, "pointer-position": (r = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : r.position, "right-position": (i = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : i.right, "top-position": (a = o.onboardingStore.getRecommendationStrategyCurrentCard) == null ? void 0 : a.top }, on: { close: function(p) {
|
|
8
|
-
return o.onboardingStore.close(o.ONBOARDING_TYPE);
|
|
9
|
-
}, nextButtonClick: o.handleNext } }) : t._e();
|
|
10
|
-
}, c = [], _ = /* @__PURE__ */ g(
|
|
11
|
-
d,
|
|
12
|
-
m,
|
|
13
|
-
c,
|
|
14
|
-
!1,
|
|
15
|
-
null,
|
|
16
|
-
"ec2027ff"
|
|
17
|
-
);
|
|
18
|
-
const S = _.exports;
|
|
19
|
-
export {
|
|
20
|
-
S as default
|
|
21
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { defineComponent as g, computed as p, watch as b } from "vue";
|
|
2
|
-
import { useRibbonOffset as u } from "../../../composables/useRibbonOffset.js";
|
|
3
|
-
import { useTranslations as l } from "../../../composables/useTranslations.js";
|
|
4
|
-
import { ACADEMY_LINKS as f } from "../../../enums/academy.js";
|
|
5
|
-
import { useRecommendationExtensionStore as O } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
|
-
import { useOnboardingStore as _ } from "../../../stores/onboarding.js";
|
|
7
|
-
import { InOnboard as y } from "@useinsider/design-system-vue";
|
|
8
|
-
const h = /* @__PURE__ */ g({
|
|
9
|
-
__name: "RecommendationStrategyOnboarding",
|
|
10
|
-
setup(C) {
|
|
11
|
-
const n = "recommendationStrategyOnboarding", e = l(), t = _(), i = O(), { getTopPosition: r } = u(), a = `<a href="${f.EMAIL_RECOMMENDATION_BLOCK}" target="_blank" rel="noopener noreferrer">${e("action-builder.visit-academy")}</a>`, m = () => [
|
|
12
|
-
{
|
|
13
|
-
classes: "guido-recommendation-strategy-onboarding",
|
|
14
|
-
// Sits in the gap left of the settings panel and points at the strategy section, which
|
|
15
|
-
// starts 208px down: the panel header and its tab row are fixed chrome above it.
|
|
16
|
-
right: "426px",
|
|
17
|
-
top: r(208),
|
|
18
|
-
position: "Right Top",
|
|
19
|
-
title: e("email-editor.onboarding-recommendation-strategy-title"),
|
|
20
|
-
description: e("email-editor.onboarding-recommendation-strategy-description", {
|
|
21
|
-
academyLink: a
|
|
22
|
-
}),
|
|
23
|
-
imageSource: "",
|
|
24
|
-
backButtonClick: () => {
|
|
25
|
-
},
|
|
26
|
-
nextButtonType: "text",
|
|
27
|
-
nextButtonText: e("action-builder.ok"),
|
|
28
|
-
nextButtonClick: () => {
|
|
29
|
-
t.close(n);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
], c = p(() => i.strategyPanelOpen && t.onboardings.recommendationStrategyOnboarding.config.length > 0 && t.onboardings.recommendationStrategyOnboarding.isActive), d = () => {
|
|
33
|
-
var o, s;
|
|
34
|
-
(s = (o = t.getRecommendationStrategyCurrentCard) == null ? void 0 : o.nextButtonClick) == null || s.call(o);
|
|
35
|
-
};
|
|
36
|
-
return b(
|
|
37
|
-
() => t.isActive(n),
|
|
38
|
-
(o) => {
|
|
39
|
-
o && t.setConfig(n, m());
|
|
40
|
-
},
|
|
41
|
-
{ immediate: !0 }
|
|
42
|
-
), { __sfc: !0, ONBOARDING_TYPE: n, trans: e, onboardingStore: t, recommendationStore: i, getTopPosition: r, academyLink: a, buildOnboardingCards: m, isVisible: c, handleNext: d, InOnboard: y };
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
export {
|
|
46
|
-
h as default
|
|
47
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useRecommendationExtensionStore as s } from "../store/recommendation.js";
|
|
2
|
-
import { commitBlockChangeOutsidePanel as d } from "./nodeConfigWriter.js";
|
|
3
|
-
async function u(e, n) {
|
|
4
|
-
const t = s(), o = t.blockStates[e];
|
|
5
|
-
if (!o)
|
|
6
|
-
return !1;
|
|
7
|
-
const { strategyId: a, strategy: c, size: i } = o.recommendationConfigs;
|
|
8
|
-
if (t.currentRecommendationId === e)
|
|
9
|
-
try {
|
|
10
|
-
await t.fetchRecommendationProducts();
|
|
11
|
-
} catch (m) {
|
|
12
|
-
console.error("[recommendation] product refetch after a strategy change failed", m);
|
|
13
|
-
}
|
|
14
|
-
const r = d(
|
|
15
|
-
e,
|
|
16
|
-
{ strategyId: a, strategy: c, size: i },
|
|
17
|
-
o.recommendationProducts,
|
|
18
|
-
n
|
|
19
|
-
);
|
|
20
|
-
return r || console.error("[recommendation] strategy change did not reach a node", { blockId: e }), r;
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
u as commitStrategyChange
|
|
24
|
-
};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
-
export default _default;
|