@useinsider/guido 3.9.0 → 3.9.1-beta.1211472
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/composables/useCortexBlueprintBridge.js +34 -30
- package/dist/composables/useEmailTemplateApplier.js +11 -9
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +153 -114
- package/dist/config/migrator/itemsBlockMigrator.js +159 -114
- package/dist/config/migrator/unsubscribeMigrator.js +89 -67
- package/dist/extensions/Blocks/Items/block.js +57 -37
- package/dist/extensions/Blocks/Items/controls/name/trimming.js +17 -18
- package/dist/extensions/Blocks/Items/controls/settingsControl.js +67 -78
- package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +13 -9
- package/dist/extensions/Blocks/Items/layouts/vertical.html.js +26 -14
- package/dist/extensions/Blocks/Items/template.js +245 -247
- package/dist/extensions/Blocks/Items/utils/nodeConfigUtils.js +53 -45
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +15 -15
- package/dist/package.json.js +1 -1
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +5 -2
- package/dist/src/composables/useEmailTemplateApplier.d.ts +8 -3
- package/dist/src/extensions/Blocks/Items/block.d.ts +9 -0
- package/dist/src/extensions/Blocks/Items/template.d.ts +7 -0
- package/dist/src/extensions/Blocks/Items/utils/nodeConfigUtils.d.ts +12 -0
- package/package.json +2 -2
|
@@ -1,55 +1,59 @@
|
|
|
1
|
-
import { useEmailTemplateApplier as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
1
|
+
import { useEmailTemplateApplier as w, resetEmailTemplateApplier as _ } from "./useEmailTemplateApplier.js";
|
|
2
|
+
import { useToaster as I } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as P } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as S } from "../enums/toaster.js";
|
|
5
5
|
import { getActivePinia as v } from "pinia";
|
|
6
6
|
import { watch as B, onUnmounted as D } from "vue";
|
|
7
|
-
const
|
|
7
|
+
const x = "email_template", L = "chat", M = "guido:debug:ai", R = () => {
|
|
8
8
|
if (typeof window > "u")
|
|
9
9
|
return !1;
|
|
10
10
|
try {
|
|
11
|
-
return window.localStorage.getItem(
|
|
11
|
+
return window.localStorage.getItem(M) === "1";
|
|
12
12
|
} catch {
|
|
13
13
|
return !1;
|
|
14
14
|
}
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
if (!
|
|
15
|
+
}, H = () => {
|
|
16
|
+
const c = v();
|
|
17
|
+
if (!c)
|
|
18
18
|
return;
|
|
19
|
-
const l =
|
|
19
|
+
const l = c._s, p = l == null ? void 0 : l.get(L);
|
|
20
20
|
if (!p)
|
|
21
21
|
return;
|
|
22
|
-
const {
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
}, i = /* @__PURE__ */ new Map(),
|
|
26
|
-
u && console.debug(`[guido:cortex] msg=${
|
|
27
|
-
},
|
|
28
|
-
if (
|
|
22
|
+
const { markPending: d, applyTemplate: f, applyTemplateDebounced: T } = w(), { showToaster: h } = I(), y = P(), A = (r, t) => {
|
|
23
|
+
const e = y(r);
|
|
24
|
+
return e === r ? t : e;
|
|
25
|
+
}, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set(), u = R(), E = (r, t) => {
|
|
26
|
+
u && console.debug(`[guido:cortex] msg=${r ?? "?"} type=${(t == null ? void 0 : t.type) ?? "?"}`, t);
|
|
27
|
+
}, b = (r) => {
|
|
28
|
+
if (r.blueprintType !== x)
|
|
29
29
|
return;
|
|
30
|
-
const t =
|
|
31
|
-
if (!t || !(
|
|
30
|
+
const t = r.blueprintId, e = r.blueprintData;
|
|
31
|
+
if (!t || !(e != null && e.html))
|
|
32
32
|
return;
|
|
33
|
+
if (!r.applyRequested) {
|
|
34
|
+
d(t);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
33
37
|
const o = i.get(t);
|
|
34
|
-
o === void 0 ? (i.set(t,
|
|
35
|
-
}, s = (
|
|
38
|
+
o === void 0 ? (i.set(t, e.html), f(t, e)) : o !== e.html && (i.set(t, e.html), T(t, e));
|
|
39
|
+
}, s = (r) => r === void 0 || a.has(r) ? !1 : (a.add(r), h({
|
|
36
40
|
type: S.Alert,
|
|
37
41
|
message: A("newsletter.ai-template-failed", "AI couldn't generate the template. Please try again.")
|
|
38
|
-
}), !0),
|
|
42
|
+
}), !0), m = B(
|
|
39
43
|
() => p.messages,
|
|
40
|
-
(
|
|
41
|
-
Array.isArray(
|
|
42
|
-
const
|
|
43
|
-
(t == null ? void 0 : t.isError) === !0 && s(
|
|
44
|
+
(r) => {
|
|
45
|
+
Array.isArray(r) && r.forEach((t) => {
|
|
46
|
+
const e = t == null ? void 0 : t.id;
|
|
47
|
+
(t == null ? void 0 : t.isError) === !0 && s(e) && u && console.debug(`[guido:cortex] message-level error id=${e}`, t);
|
|
44
48
|
const o = t == null ? void 0 : t.segments;
|
|
45
49
|
Array.isArray(o) && o.forEach((n) => {
|
|
46
50
|
if (n)
|
|
47
|
-
switch (E(
|
|
51
|
+
switch (E(e, n), n.type) {
|
|
48
52
|
case "blueprint":
|
|
49
|
-
|
|
53
|
+
b(n);
|
|
50
54
|
break;
|
|
51
55
|
case "error":
|
|
52
|
-
s(
|
|
56
|
+
s(e);
|
|
53
57
|
break;
|
|
54
58
|
}
|
|
55
59
|
});
|
|
@@ -58,9 +62,9 @@ const P = "email_template", x = "chat", L = "guido:debug:ai", M = () => {
|
|
|
58
62
|
{ deep: !0, immediate: !0 }
|
|
59
63
|
);
|
|
60
64
|
D(() => {
|
|
61
|
-
|
|
65
|
+
m(), i.clear(), a.clear(), _();
|
|
62
66
|
});
|
|
63
67
|
};
|
|
64
68
|
export {
|
|
65
|
-
|
|
69
|
+
H as useCortexBlueprintBridge
|
|
66
70
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { useActionsApi as
|
|
2
|
-
import { useToaster as
|
|
3
|
-
import { useTranslations as
|
|
1
|
+
import { useActionsApi as T } from "./useActionsApi.js";
|
|
2
|
+
import { useToaster as f } from "./useToaster.js";
|
|
3
|
+
import { useTranslations as y } from "./useTranslations.js";
|
|
4
4
|
import { ToasterTypeOptions as n } from "../enums/toaster.js";
|
|
5
|
-
import { ref as
|
|
6
|
-
const h = 250, s =
|
|
7
|
-
const { updateHtmlAndCss: l } =
|
|
5
|
+
import { ref as v } from "vue";
|
|
6
|
+
const h = 250, s = v({}), o = {}, j = () => {
|
|
7
|
+
const { updateHtmlAndCss: l } = T(), { showToaster: r } = f(), i = y(), u = (e) => {
|
|
8
|
+
s.value[e] === void 0 && (s.value = { ...s.value, [e]: "pending" });
|
|
9
|
+
}, c = (e, t, p) => {
|
|
8
10
|
s.value = { ...s.value, [e]: "applying" };
|
|
9
11
|
try {
|
|
10
12
|
l(t, p), s.value = { ...s.value, [e]: "applied" }, r({
|
|
@@ -21,7 +23,7 @@ const h = 250, s = y({}), o = {}, j = () => {
|
|
|
21
23
|
const t = o[e];
|
|
22
24
|
t && (clearTimeout(t), delete o[e]);
|
|
23
25
|
};
|
|
24
|
-
return { applyStatus: s, applyTemplate: (e, t) => {
|
|
26
|
+
return { applyStatus: s, markPending: u, applyTemplate: (e, t) => {
|
|
25
27
|
t.html && (m(e), c(e, t.html, t.css ?? ""));
|
|
26
28
|
}, applyTemplateDebounced: (e, t) => {
|
|
27
29
|
if (!t.html)
|
|
@@ -32,10 +34,10 @@ const h = 250, s = y({}), o = {}, j = () => {
|
|
|
32
34
|
delete o[e], c(e, p, a);
|
|
33
35
|
}, h);
|
|
34
36
|
} };
|
|
35
|
-
},
|
|
37
|
+
}, k = () => {
|
|
36
38
|
Object.values(o).forEach(clearTimeout), Object.keys(o).forEach((l) => delete o[l]), s.value = {};
|
|
37
39
|
};
|
|
38
40
|
export {
|
|
39
|
-
|
|
41
|
+
k as resetEmailTemplateApplier,
|
|
40
42
|
j as useEmailTemplateApplier
|
|
41
43
|
};
|
|
@@ -1,181 +1,220 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { useRecommendation as
|
|
3
|
-
import { CSS_CLASS_RECO_BUTTON as
|
|
4
|
-
import { useRecommendationExtensionStore as
|
|
5
|
-
import { isIgnoredRecommendationBlock as
|
|
6
|
-
function
|
|
7
|
-
const i = `{{${
|
|
8
|
-
return o === "before" ? `${
|
|
9
|
-
}
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
for (;
|
|
13
|
-
[
|
|
14
|
-
return
|
|
15
|
-
}
|
|
16
|
-
function
|
|
17
|
-
switch (
|
|
1
|
+
import { useConfig as q } from "../../../composables/useConfig.js";
|
|
2
|
+
import { useRecommendation as E } from "../../../composables/useRecommendation.js";
|
|
3
|
+
import { CSS_CLASS_RECO_BUTTON as w } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
|
+
import { useRecommendationExtensionStore as R } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
+
import { isIgnoredRecommendationBlock as P } from "./recommendationIgnoreUtils.js";
|
|
6
|
+
function $(t, r, e, o, s = "") {
|
|
7
|
+
const i = `{{${s}${t}_${r}_${e}}}`, n = `{{${s}${t}_${r}_currency}}`;
|
|
8
|
+
return o === "before" ? `${n} ${i}` : `${i} ${n}`;
|
|
9
|
+
}
|
|
10
|
+
function b(t) {
|
|
11
|
+
let r = t;
|
|
12
|
+
for (; r.children.length === 1; )
|
|
13
|
+
[r] = r.children;
|
|
14
|
+
return r;
|
|
15
|
+
}
|
|
16
|
+
function S(t, r, e, o, s, i) {
|
|
17
|
+
switch (r) {
|
|
18
18
|
case "productImage": {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
19
|
+
const n = t.querySelector("img");
|
|
20
|
+
n && (n.setAttribute("src", `{{${i}${e}_${o}_image_url}}`), n.setAttribute("alt", `{{${i}${e}_${o}_name}}`));
|
|
21
|
+
const c = t.querySelector("a");
|
|
22
|
+
c && (c.setAttribute("href", `{{${i}${e}_${o}_url}}`), c.classList.add(w));
|
|
23
23
|
break;
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const n = t.querySelector("p");
|
|
27
|
+
n && (b(n).textContent = `{{${i}${e}_${o}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
case "productPrice": {
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
const n = t.querySelector(".product-price p") ?? t.querySelector("p");
|
|
32
|
+
n && (b(n).textContent = $(
|
|
33
|
+
e,
|
|
34
34
|
o,
|
|
35
35
|
"price",
|
|
36
|
-
|
|
36
|
+
s,
|
|
37
37
|
i
|
|
38
38
|
));
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const c = t.querySelector(".product-old-price p");
|
|
40
|
+
c && (b(c).textContent = $(
|
|
41
|
+
e,
|
|
42
42
|
o,
|
|
43
43
|
"original_price",
|
|
44
|
-
|
|
44
|
+
s,
|
|
45
45
|
i
|
|
46
46
|
));
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
case "productOldPrice": {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const n = t.querySelector("p");
|
|
51
|
+
n && (b(n).textContent = $(
|
|
52
|
+
e,
|
|
53
53
|
o,
|
|
54
54
|
"original_price",
|
|
55
|
-
|
|
55
|
+
s,
|
|
56
56
|
i
|
|
57
57
|
));
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
case "productButton": {
|
|
61
|
-
const
|
|
62
|
-
|
|
61
|
+
const n = t.querySelector("a");
|
|
62
|
+
n && n.setAttribute("href", `{{${i}${e}_${o}_url}}`);
|
|
63
63
|
break;
|
|
64
64
|
}
|
|
65
65
|
case "productOmnibusPrice": {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
66
|
+
const n = t.querySelector(".omnibus-price-value");
|
|
67
|
+
if (n) {
|
|
68
|
+
n.textContent = `{{${i}${e}_${o}_omnibus_price}}`;
|
|
69
|
+
const c = n.closest("p");
|
|
70
|
+
c && (c.setAttribute("product-attr", "omnibus_price"), c.setAttribute("composition", "true"));
|
|
71
71
|
}
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
74
|
case "productOmnibusDiscount": {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
|
|
78
|
-
const
|
|
79
|
-
|
|
75
|
+
const n = t.querySelector(".omnibus-discount-value");
|
|
76
|
+
if (n) {
|
|
77
|
+
n.textContent = `{{${i}${e}_${o}_omnibus_discount}}`;
|
|
78
|
+
const c = n.closest("p");
|
|
79
|
+
c && (c.setAttribute("product-attr", "omnibus_discount"), c.setAttribute("composition", "true"));
|
|
80
80
|
}
|
|
81
81
|
break;
|
|
82
82
|
}
|
|
83
83
|
default: {
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
|
|
84
|
+
const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
|
|
85
|
+
if (n) {
|
|
86
|
+
const c = n.getAttribute("product-attr"), l = n.querySelector("p");
|
|
87
|
+
l && (b(l).textContent = `{{${i}${e}_${o}_${c}}}`);
|
|
88
88
|
}
|
|
89
89
|
break;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
const T = "name";
|
|
94
|
+
function _(t, r, e, o) {
|
|
95
|
+
const s = `${o}${r}_${e}_${T}`;
|
|
96
|
+
return {
|
|
97
|
+
open: t.createComment(`{% if ${s} and ${s} != "" %}`),
|
|
98
|
+
close: t.createComment("{% endif %}")
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function B(t, r, e) {
|
|
102
|
+
return _(t, r, 0, e);
|
|
103
|
+
}
|
|
104
|
+
function L(t, r, e, o) {
|
|
105
|
+
if (!t.innerHTML.includes("{{"))
|
|
106
|
+
return;
|
|
107
|
+
const { open: s, close: i } = _(t.ownerDocument, r, e, o);
|
|
108
|
+
t.insertBefore(s, t.firstChild), t.appendChild(i);
|
|
109
|
+
}
|
|
110
|
+
function N(t, r, e, o) {
|
|
111
|
+
var n, c;
|
|
112
|
+
if (!t.innerHTML.includes("{{"))
|
|
113
|
+
return;
|
|
114
|
+
const { open: s, close: i } = _(t.ownerDocument, r, e, o);
|
|
115
|
+
(n = t.parentNode) == null || n.insertBefore(s, t), (c = t.parentNode) == null || c.insertBefore(i, t.nextSibling);
|
|
116
|
+
}
|
|
117
|
+
function v(t, r, e, o) {
|
|
118
|
+
t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
|
|
119
|
+
i.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
120
|
+
const u = l.getAttribute("data-attribute-type") || "", p = l.querySelectorAll(".attribute-cell");
|
|
121
|
+
p.length > 0 ? p.forEach((a) => {
|
|
122
|
+
S(a, u, r, n, e, o);
|
|
123
|
+
}) : S(l, u, r, n, e, o);
|
|
124
|
+
}), N(i, r, n, o);
|
|
101
125
|
});
|
|
102
126
|
}
|
|
103
|
-
function
|
|
104
|
-
const
|
|
105
|
-
if (!
|
|
127
|
+
function O(t, r, e, o) {
|
|
128
|
+
const s = t.querySelectorAll(".recommendation-product-row");
|
|
129
|
+
if (!s.length)
|
|
106
130
|
return;
|
|
107
|
-
const [i] =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const d =
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
131
|
+
const [i] = s, n = i.querySelector("[data-attribute-type]"), c = n ? n.querySelectorAll(".attribute-cell").length : 1;
|
|
132
|
+
s.forEach((l, u) => {
|
|
133
|
+
l.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
134
|
+
const d = a.getAttribute("data-attribute-type") || "";
|
|
135
|
+
a.querySelectorAll(".attribute-cell").forEach((m, f) => {
|
|
136
|
+
const h = u * c + f;
|
|
137
|
+
S(m, d, r, h, e, o), L(m, r, h, o);
|
|
114
138
|
});
|
|
115
139
|
});
|
|
116
140
|
});
|
|
117
141
|
}
|
|
118
|
-
function
|
|
119
|
-
|
|
120
|
-
|
|
142
|
+
function W(t, r, e, o) {
|
|
143
|
+
t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
144
|
+
O(i, r, e, o);
|
|
121
145
|
});
|
|
122
146
|
}
|
|
123
|
-
function
|
|
124
|
-
const o =
|
|
125
|
-
o === "list" ?
|
|
126
|
-
}
|
|
127
|
-
function
|
|
128
|
-
const o = new RegExp(`${
|
|
129
|
-
return
|
|
130
|
-
}
|
|
131
|
-
function
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
function D(t, r, e) {
|
|
148
|
+
const o = t.getAttribute("data-layout") || "grid", s = t.getAttribute("currency-alignment") || "after";
|
|
149
|
+
o === "list" ? v(t, r, s, e) : W(t, r, s, e);
|
|
150
|
+
}
|
|
151
|
+
function A(t, r, e) {
|
|
152
|
+
const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), s = t.match(o);
|
|
153
|
+
return s ? parseInt(s[1]) : e;
|
|
154
|
+
}
|
|
155
|
+
function C(t) {
|
|
156
|
+
const r = t.trim();
|
|
157
|
+
return r.endsWith("%") ? parseFloat(r) < 100 : /^\d+(?:\.\d+)?(?:px)?$/.test(r) && parseInt(r) > 0;
|
|
158
|
+
}
|
|
159
|
+
function g(t) {
|
|
160
|
+
const r = t.getAttribute("width");
|
|
161
|
+
if (r && C(r))
|
|
162
|
+
return r.trim();
|
|
163
|
+
const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
|
|
164
|
+
return e && C(e[1]) ? e[1] : null;
|
|
165
|
+
}
|
|
166
|
+
function M(t, r) {
|
|
167
|
+
let e = t.parentElement;
|
|
168
|
+
for (; e && e !== r; ) {
|
|
169
|
+
if (e.tagName === "TD" && g(e))
|
|
170
|
+
return e;
|
|
171
|
+
e = e.parentElement;
|
|
140
172
|
}
|
|
141
173
|
return null;
|
|
142
174
|
}
|
|
143
|
-
function
|
|
144
|
-
const
|
|
145
|
-
|
|
175
|
+
function G(t) {
|
|
176
|
+
const r = t.getAttribute("style") || "", e = A(r, "width", 600), o = A(r, "padding", 0) * 2, s = Math.max(0, e - o);
|
|
177
|
+
s !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
146
178
|
if (i.hasAttribute("width"))
|
|
147
179
|
return;
|
|
148
|
-
const
|
|
149
|
-
if (!
|
|
180
|
+
const n = M(i, t);
|
|
181
|
+
if (!n)
|
|
150
182
|
return;
|
|
151
|
-
const
|
|
152
|
-
i.setAttribute("width", String(
|
|
153
|
-
const
|
|
154
|
-
if (!/\bwidth\s*:\s*\d/i.test(
|
|
155
|
-
const
|
|
156
|
-
i.setAttribute("style", `${
|
|
183
|
+
const c = g(n), l = A(n.getAttribute("style") || "", "padding", 0) * 2, u = c.endsWith("%") ? Math.floor(s * parseFloat(c) / 100) : parseInt(c), p = Math.max(1, u - l);
|
|
184
|
+
i.setAttribute("width", String(p));
|
|
185
|
+
const a = i.getAttribute("style") || "";
|
|
186
|
+
if (!/\bwidth\s*:\s*\d/i.test(a)) {
|
|
187
|
+
const d = a && !a.trim().endsWith(";") ? "; " : "";
|
|
188
|
+
i.setAttribute("style", `${a}${d}width: ${p}px`);
|
|
157
189
|
}
|
|
158
190
|
});
|
|
159
191
|
}
|
|
160
|
-
function
|
|
161
|
-
const
|
|
162
|
-
return (
|
|
163
|
-
` : "") +
|
|
192
|
+
function H(t, r) {
|
|
193
|
+
const e = t.match(/<!DOCTYPE[^>]*>/i);
|
|
194
|
+
return (e ? `${e[0]}
|
|
195
|
+
` : "") + r.documentElement.outerHTML;
|
|
164
196
|
}
|
|
165
|
-
function
|
|
166
|
-
const
|
|
197
|
+
function Y(t) {
|
|
198
|
+
const r = t.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), e = new DOMParser().parseFromString(r, "text/html"), o = e.querySelectorAll(".recommendation-block-v2");
|
|
167
199
|
if (!o.length)
|
|
168
|
-
return
|
|
169
|
-
const { buildCampaignUrl:
|
|
200
|
+
return t;
|
|
201
|
+
const { buildCampaignUrl: s } = E(), i = R();
|
|
170
202
|
i.recommendationCampaignUrls = {};
|
|
171
|
-
const { isFeatureEnabled:
|
|
203
|
+
const { isFeatureEnabled: n } = q(), c = n("liquidSyntax") ? "reco_" : "";
|
|
172
204
|
return o.forEach((u) => {
|
|
173
|
-
var
|
|
205
|
+
var a, d, y, m;
|
|
174
206
|
const p = u.getAttribute("recommendation-id");
|
|
175
|
-
|
|
176
|
-
|
|
207
|
+
if (p) {
|
|
208
|
+
if ((a = u.parentNode) == null || a.insertBefore(e.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((f) => f.remove()), s(p), !P(u)) {
|
|
209
|
+
D(u, p, c);
|
|
210
|
+
const { open: f, close: h } = B(e, p, c);
|
|
211
|
+
(y = u.parentNode) == null || y.insertBefore(f, u), (m = u.parentNode) == null || m.insertBefore(h, u.nextSibling);
|
|
212
|
+
}
|
|
213
|
+
G(u);
|
|
214
|
+
}
|
|
215
|
+
}), H(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
177
216
|
}
|
|
178
217
|
export {
|
|
179
|
-
|
|
180
|
-
|
|
218
|
+
$ as formatPriceVariable,
|
|
219
|
+
Y as prepareRecommendationBlocks
|
|
181
220
|
};
|