@useinsider/guido 3.17.0 → 3.18.0-beta.a0b94e0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -5
- package/dist/@types/config/schemas.js +7 -6
- package/dist/components/Guido.vue.js +10 -10
- package/dist/components/Guido.vue2.js +82 -76
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +21 -0
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +106 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.js +17 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +57 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +19 -0
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +63 -0
- package/dist/composables/useCustomInterfaceAppearance.js +52 -38
- package/dist/composables/useModuleRepair.js +33 -0
- package/dist/composables/useRecommendation.js +41 -34
- package/dist/composables/useSave.js +30 -29
- package/dist/composables/useStripo.js +15 -15
- package/dist/composables/useSyncModuleExtractor.js +15 -13
- package/dist/composables/validators/useSyncModuleBlockValidator.js +24 -0
- package/dist/config/i18n/en/labels.json.js +1 -1
- package/dist/config/migrator/index.js +9 -8
- package/dist/config/migrator/itemsBlockMigrator.js +197 -137
- package/dist/config/migrator/recommendation/compositionMapper.js +20 -20
- package/dist/config/migrator/recommendation/extractors.js +29 -24
- package/dist/config/migrator/recommendation/htmlBuilder.js +116 -130
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +31 -25
- package/dist/config/migrator/recommendationTitleMigrator.js +119 -0
- package/dist/enums/academy.js +2 -1
- package/dist/enums/date.js +5 -3
- package/dist/enums/extensions/recommendationBlock.js +3 -1
- package/dist/extensions/Blocks/Items/block.js +118 -49
- package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
- package/dist/extensions/Blocks/Items/constants/currency.js +25 -0
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
- package/dist/extensions/Blocks/Items/controls/price/currencyLocation.js +25 -24
- package/dist/extensions/Blocks/Items/controls/price/currencySymbol.js +12 -11
- 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 +189 -179
- package/dist/extensions/Blocks/Items/utils/constants.js +4 -0
- package/dist/extensions/Blocks/Recommendation/block.js +35 -29
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +29 -27
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +35 -28
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +309 -236
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +241 -180
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +124 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -0
- package/dist/extensions/Blocks/Recommendation/controls/title/index.js +44 -0
- package/dist/extensions/Blocks/Recommendation/extension.js +31 -29
- package/dist/extensions/Blocks/Recommendation/services/configService.js +54 -36
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +23 -4
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +175 -79
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +3 -3
- package/dist/extensions/Blocks/Recommendation/templates/titleRows.js +33 -0
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +85 -107
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +22 -0
- package/dist/extensions/Blocks/Recommendation/utils/recommendationBlockCount.js +10 -6
- package/dist/extensions/Blocks/common-control.js +22 -19
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +69 -30
- package/dist/src/@types/config/schemas.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +3 -0
- package/dist/src/components/organisms/extensions/recommendation/RemoveStrategyModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +15 -0
- package/dist/src/composables/useConfig.d.ts +2 -0
- package/dist/src/composables/useModuleRepair.d.ts +18 -0
- package/dist/src/composables/useRecommendation.d.ts +1 -0
- package/dist/src/composables/useSyncModuleExtractor.d.ts +2 -0
- package/dist/src/composables/validators/useSyncModuleBlockValidator.d.ts +3 -0
- package/dist/src/config/migrator/recommendation/extractors.d.ts +8 -0
- package/dist/src/config/migrator/recommendationTitleMigrator.d.ts +5 -0
- package/dist/src/enums/academy.d.ts +1 -0
- package/dist/src/enums/date.d.ts +1 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Items/block.d.ts +35 -0
- package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
- package/dist/src/extensions/Blocks/Items/constants/currency.d.ts +43 -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/Items/utils/constants.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +3 -6
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +12 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +11 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +44 -8
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/title/index.d.ts +86 -0
- package/dist/src/extensions/Blocks/Recommendation/services/configService.d.ts +12 -1
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +176 -10
- package/dist/src/extensions/Blocks/Recommendation/templates/titleRows.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +7 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +31 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/recommendationBlockCount.d.ts +6 -2
- package/dist/src/extensions/Blocks/common-control.d.ts +4 -1
- package/dist/src/mock/api/recommendation-strategies.d.ts +2 -0
- package/dist/src/services/recommendationApi.d.ts +4 -1
- package/dist/src/stores/config.d.ts +18 -0
- package/dist/src/stores/save-as-template.d.ts +4 -3
- package/dist/src/utils/genericUtil.d.ts +5 -0
- package/dist/src/utils/itemsCurrencyRepair.d.ts +17 -0
- package/dist/static/assets/icons/line-change.svg.js +5 -0
- package/dist/static/assets/icons/line-delete.svg.js +5 -0
- package/dist/static/assets/icons/line-plus.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +155 -0
- package/dist/static/styles/customEditorStyle.css.js +3 -1
- package/dist/utils/dateUtil.js +23 -10
- package/dist/utils/genericUtil.js +28 -27
- package/dist/utils/itemsCurrencyRepair.js +39 -0
- package/dist/utils/pairProductVariables.js +77 -77
- package/dist/utils/templatePreparation.js +35 -34
- package/package.json +3 -2
- package/dist/composables/useModuleDynamicContentRepair.js +0 -37
- package/dist/src/composables/useModuleDynamicContentRepair.d.ts +0 -13
|
@@ -1,100 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { escapeReplacement as
|
|
4
|
-
import { preserveTextStyles as
|
|
5
|
-
import { unwrapProductNameLinks as
|
|
6
|
-
const
|
|
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
|
+
import { escapeReplacement as X } from "../extensions/Blocks/Items/utils/nodeConfigUtils.js";
|
|
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
|
|
12
|
-
let
|
|
13
|
-
for (;
|
|
14
|
-
|
|
15
|
-
return
|
|
10
|
+
}, q = (S) => S.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->");
|
|
11
|
+
function B(S, y, b) {
|
|
12
|
+
let h = y;
|
|
13
|
+
for (; h > 0 && /\s/.test(S[h - 1]); )
|
|
14
|
+
h -= 1;
|
|
15
|
+
return b.some((I) => S.endsWith(I, h));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
Object.entries(
|
|
22
|
-
|
|
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
|
+
Object.entries(h).forEach(([n, d]) => {
|
|
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
|
|
25
|
+
var $, F, D, N;
|
|
26
|
+
const g = t.getAttribute("data-type") || m, o = t.getAttribute("data-number") || E, f = d[g];
|
|
27
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 u =
|
|
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
|
-
(u === "#" || u === "" || u.endsWith("#!") || u.endsWith(
|
|
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 = f,
|
|
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 = f,
|
|
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
64
|
let _;
|
|
65
|
-
|
|
66
|
-
const
|
|
65
|
+
i ? _ = c ? e.SINGLE_PRICE_FORMATTED : e.SINGLE_PRICE : _ = c ? e.PRICE_FORMATTED : e.PRICE;
|
|
66
|
+
const R = e.CURRENCY;
|
|
67
67
|
let u = `{{${_}_${o}}}`;
|
|
68
|
-
const
|
|
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 = f,
|
|
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 = f,
|
|
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 = f,
|
|
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
95
|
if ("ATTR" in f) {
|
|
96
96
|
const e = f.ATTR;
|
|
97
|
-
t.textContent && (t.innerHTML =
|
|
97
|
+
t.textContent && (t.innerHTML = P(t, `{{${e}_${o}}}`));
|
|
98
98
|
}
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
@@ -102,9 +102,9 @@ function J(S) {
|
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
|
-
const 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 J(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
|
-
const
|
|
121
|
-
A = A.replace(n,
|
|
120
|
+
const T = parseInt(p) - 1, o = `${`{% if ${E} > ${T} %}`}${n}{% endif %}`;
|
|
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"),
|
|
135
|
-
|
|
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
|
|
141
|
-
for (;
|
|
142
|
-
const
|
|
143
|
-
|
|
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
|
+
for (; $ !== -1; ) {
|
|
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
|
-
A =
|
|
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,7 +1,7 @@
|
|
|
1
1
|
import { useActionsApi as k } from "../composables/useActionsApi.js";
|
|
2
2
|
import { useConfig as U } from "../composables/useConfig.js";
|
|
3
3
|
import { useHtmlCompiler as x } from "../composables/useHtmlCompiler.js";
|
|
4
|
-
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as
|
|
4
|
+
import { DEFAULT_CURRENCY as d, DEFAULT_NODE_CONFIG as a } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
6
6
|
import { mapLegacyStrategy as L } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMap.js";
|
|
7
7
|
import { DATA_ATTRIBUTES as A } from "../extensions/Blocks/Unsubscribe/utils/constants.js";
|
|
@@ -11,20 +11,20 @@ import { useEditorStore as z } from "../stores/editor.js";
|
|
|
11
11
|
import { useUnsubscribeStore as _ } from "../stores/unsubscribe.js";
|
|
12
12
|
import { assignTrackingIds as v } from "./linkTrackingIds.js";
|
|
13
13
|
function O(m) {
|
|
14
|
-
const
|
|
15
|
-
return
|
|
16
|
-
const o =
|
|
14
|
+
const i = new DOMParser().parseFromString(m, "text/html").querySelectorAll(`[${A.PAGE_LIST}]`), t = [];
|
|
15
|
+
return i.forEach((s) => {
|
|
16
|
+
const o = s.getAttribute(A.PAGE_LIST);
|
|
17
17
|
o && t.push(...R(o));
|
|
18
18
|
}), [...new Set(t)];
|
|
19
19
|
}
|
|
20
20
|
async function M(m) {
|
|
21
|
-
const
|
|
22
|
-
if (
|
|
21
|
+
const n = new DOMParser().parseFromString(m, "text/html").querySelectorAll(".recommendation-block-v2");
|
|
22
|
+
if (n.length === 0)
|
|
23
23
|
return;
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
const i = C();
|
|
25
|
+
n.forEach((t) => {
|
|
26
26
|
var r, l, g, f, c;
|
|
27
|
-
const
|
|
27
|
+
const s = t.getAttribute("recommendation-id"), o = s ? Number(s) : NaN;
|
|
28
28
|
if (!Number.isFinite(o))
|
|
29
29
|
return;
|
|
30
30
|
const p = t.getAttribute("esd-ext-config");
|
|
@@ -42,24 +42,25 @@ async function M(m) {
|
|
|
42
42
|
// Normalize legacy strategy keys (e.g. `mostViewed` → `mostPopular`) so
|
|
43
43
|
// already-saved blocks that never re-run the migrator don't emit a
|
|
44
44
|
// strategy-less campaign URL. `||` also catches '' / undefined (SD-144882).
|
|
45
|
-
strategy: L(e.strategy) ||
|
|
46
|
-
|
|
47
|
-
|
|
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,
|
|
48
49
|
// Spread the default arrays so each block gets a fresh reference
|
|
49
50
|
// instead of sharing the singleton in DEFAULT_NODE_CONFIG.
|
|
50
|
-
productIds: e.productIds ?? [...
|
|
51
|
-
filters: e.filters ?? [...
|
|
52
|
-
shuffleProducts: e.shuffleProducts ??
|
|
51
|
+
productIds: e.productIds ?? [...a.productIds],
|
|
52
|
+
filters: e.filters ?? [...a.filters],
|
|
53
|
+
shuffleProducts: e.shuffleProducts ?? a.shuffleProducts,
|
|
53
54
|
currencyCode: ((r = e.currency) == null ? void 0 : r.code) ?? d.code,
|
|
54
55
|
currencyAlignment: ((l = e.currency) == null ? void 0 : l.alignment) ?? d.alignment,
|
|
55
56
|
currencyDecimalCount: ((g = e.currency) == null ? void 0 : g.decimalCount) ?? d.decimalCount,
|
|
56
57
|
currencyDecimalSeparator: ((f = e.currency) == null ? void 0 : f.decimalSeparator) ?? d.decimalSeparator,
|
|
57
58
|
currencyThousandSeparator: ((c = e.currency) == null ? void 0 : c.thousandSeparator) ?? d.thousandSeparator
|
|
58
59
|
};
|
|
59
|
-
|
|
60
|
+
i.seedBlockUrlConfig(o, h);
|
|
60
61
|
});
|
|
61
62
|
try {
|
|
62
|
-
await
|
|
63
|
+
await i.fetchRecommendationCreateData();
|
|
63
64
|
} catch (t) {
|
|
64
65
|
console.warn(
|
|
65
66
|
"Recommendation reference data pre-load failed; validator will skip the availability check.",
|
|
@@ -68,39 +69,39 @@ async function M(m) {
|
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
71
|
const Z = () => {
|
|
71
|
-
const m = N(), u = z(),
|
|
72
|
+
const m = N(), u = z(), n = _(), { getCompiledEmail: i, getTemplateData: t, updateHtmlAndCss: s } = k(), { compileHtml: o, compileAmpHtml: p } = x(), { isFeatureEnabled: e } = U();
|
|
72
73
|
return {
|
|
73
74
|
prepareTemplateDetails: async () => {
|
|
74
75
|
let { html: r, css: l, syncModulesIds: g = [] } = await t();
|
|
75
76
|
if (e("linkTrackingIds"))
|
|
76
77
|
try {
|
|
77
|
-
const { html:
|
|
78
|
-
u.trackIdSessionFloor =
|
|
79
|
-
} catch (
|
|
80
|
-
console.error("Tracking-id step failed, saving anyway:",
|
|
78
|
+
const { html: S, changed: F, nextSeq: H } = v(r, u.trackIdSessionFloor);
|
|
79
|
+
u.trackIdSessionFloor = H, F && (r = S, await s(S, l));
|
|
80
|
+
} catch (S) {
|
|
81
|
+
console.error("Tracking-id step failed, saving anyway:", S);
|
|
81
82
|
}
|
|
82
|
-
const { html: f, ampHtml: c = "", ampErrors: T = [] } = await
|
|
83
|
+
const { html: f, ampHtml: c = "", ampErrors: T = [] } = await i({
|
|
83
84
|
minimize: !0,
|
|
84
85
|
resetDataSavedFlag: !1
|
|
85
86
|
});
|
|
86
|
-
|
|
87
|
-
const { compiledHtml:
|
|
87
|
+
n.selectedUnsubscribePages.length && await n.fetchTemplates(), await M(r);
|
|
88
|
+
const { compiledHtml: I, stats: y, appliedRules: w } = o(f), D = c && p(c).compiledHtml, E = m.getSelectedDynamicContentList, P = C(), b = O(r);
|
|
88
89
|
return console.debug("HTML Compilation Stats:", {
|
|
89
|
-
originalSize:
|
|
90
|
-
compiledSize:
|
|
91
|
-
reduction: `${
|
|
92
|
-
appliedRules:
|
|
93
|
-
executionTime: `${
|
|
90
|
+
originalSize: y.originalSize,
|
|
91
|
+
compiledSize: y.compiledSize,
|
|
92
|
+
reduction: `${y.reductionPercentage.toFixed(2)}%`,
|
|
93
|
+
appliedRules: w,
|
|
94
|
+
executionTime: `${y.executionTime.toFixed(2)}ms`
|
|
94
95
|
}), {
|
|
95
|
-
dynamicContentList:
|
|
96
|
-
compiledHtml:
|
|
96
|
+
dynamicContentList: E,
|
|
97
|
+
compiledHtml: I,
|
|
97
98
|
rawHtml: r,
|
|
98
99
|
css: l,
|
|
99
|
-
ampHtml:
|
|
100
|
+
ampHtml: D,
|
|
100
101
|
ampErrors: T,
|
|
101
102
|
modules: g.map(Number),
|
|
102
103
|
recommendation: {
|
|
103
|
-
campaignUrls:
|
|
104
|
+
campaignUrls: P.recommendationCampaignUrls,
|
|
104
105
|
configs: {}
|
|
105
106
|
},
|
|
106
107
|
unsubscribe: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.18.0-beta.a0b94e0",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"start": "vite",
|
|
26
26
|
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.app.json",
|
|
27
27
|
"preview": "vite preview",
|
|
28
|
-
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ &&
|
|
28
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=2048 eslint ./ && npm run type-check",
|
|
29
29
|
"lint:fix": "NODE_OPTIONS=--max-old-space-size=2048 eslint --fix ./",
|
|
30
30
|
"lint:e2e-quality": "node scripts/lint-e2e-quality.mjs",
|
|
31
31
|
"lint:e2e-quality:ci": "node scripts/lint-e2e-quality.mjs --ci",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"license": "ISC",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@stripoinc/ui-editor-extensions": "3.9.0",
|
|
51
|
+
"@useinsider/design-system-organisms": "0.0.3-beta.d816f06",
|
|
51
52
|
"@useinsider/design-system-vue": "1.5.0",
|
|
52
53
|
"@vueuse/core": "11.3.0",
|
|
53
54
|
"lodash-es": "4.17.21",
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useConfig as C } from "./useConfig.js";
|
|
2
|
-
import { useToaster as D } from "./useToaster.js";
|
|
3
|
-
import { useTranslations as T } from "./useTranslations.js";
|
|
4
|
-
import { ToasterTypeOptions as g } from "../enums/toaster.js";
|
|
5
|
-
import { buildDynamicContentLookup as h, convertModuleDynamicContent as O } from "../utils/dynamicContentConverter.js";
|
|
6
|
-
import { flattenDynamicContentList as f } from "../utils/genericUtil.js";
|
|
7
|
-
const M = "dynamic-content.unresolved-attributes-on-drop", b = () => {
|
|
8
|
-
const { template: i, isFeatureEnabled: p } = C(), { showToaster: m } = D(), a = T();
|
|
9
|
-
return { handleModuleAdd: (n, o) => {
|
|
10
|
-
var s, c, l;
|
|
11
|
-
try {
|
|
12
|
-
if ((n == null ? void 0 : n.action) !== "ADD" && (n == null ? void 0 : n.action) !== "COPY")
|
|
13
|
-
return;
|
|
14
|
-
const e = h(f((s = i.value) == null ? void 0 : s.dynamicContentList));
|
|
15
|
-
if (e.size === 0)
|
|
16
|
-
return;
|
|
17
|
-
const t = (c = o == null ? void 0 : o.getTargetNode) == null ? void 0 : c.call(o), r = (l = t == null ? void 0 : t.getOuterHTML) == null ? void 0 : l.call(t);
|
|
18
|
-
if (!t || typeof r != "string")
|
|
19
|
-
return;
|
|
20
|
-
const { html: u, unresolved: y } = O(
|
|
21
|
-
r,
|
|
22
|
-
e,
|
|
23
|
-
p("liquidSyntax")
|
|
24
|
-
);
|
|
25
|
-
u !== r && o.modifyHtml(t).replaceWith(u), y.length > 0 && m({
|
|
26
|
-
type: g.Warning,
|
|
27
|
-
message: a(M)
|
|
28
|
-
});
|
|
29
|
-
} catch (e) {
|
|
30
|
-
console.error("Failed to repair dynamic content on module add:", e);
|
|
31
|
-
}
|
|
32
|
-
} };
|
|
33
|
-
};
|
|
34
|
-
export {
|
|
35
|
-
M as UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY,
|
|
36
|
-
b as useModuleDynamicContentRepair
|
|
37
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ModuleAddData, ModuleModifier } from '@@/Types/stripo';
|
|
2
|
-
export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
|
|
3
|
-
/**
|
|
4
|
-
* Repairs label-form dynamic-content tokens in saved modules as they are dropped
|
|
5
|
-
* or copied into the editor. Saved modules serialize merge-tag chips by their
|
|
6
|
-
* display label (`{{ Phone Number }}`); this maps them back to their canonical
|
|
7
|
-
* token (`{{phone_number}}`) using the account's dynamic-content list.
|
|
8
|
-
*
|
|
9
|
-
* Wired into Stripo via the `onModuleAdd` init callback (see `useStripo`).
|
|
10
|
-
*/
|
|
11
|
-
export declare const useModuleDynamicContentRepair: () => {
|
|
12
|
-
handleModuleAdd: (data: ModuleAddData, modifier: ModuleModifier) => void;
|
|
13
|
-
};
|