@useinsider/guido 3.1.1-beta.f1817f3 → 3.1.1-beta.f9482a3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/compiler/recommendationCompilerRules.js +152 -44
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +59 -58
- package/dist/extensions/Blocks/Recommendation/block.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +1 -1
- package/dist/extensions/Blocks/Recommendation/controls/spacing/index.js +79 -81
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +6 -6
- package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +17 -16
- package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +218 -324
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +3 -3
- package/dist/static/styles/components/button.css.js +7 -13
- package/dist/static/styles/components/narrow-panel.css.js +0 -52
- package/package.json +3 -3
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
import { DUMMY_IMAGE_MAPPINGS as
|
|
3
|
-
import { prepareRecommendationBlocks as
|
|
4
|
-
const
|
|
1
|
+
import { useRecommendation as N } from "../../composables/useRecommendation.js";
|
|
2
|
+
import { DUMMY_IMAGE_MAPPINGS as M, REGEX as _, VerticalOrientation as h, CSS as d, ATTRIBUTES as R, CONDITIONS as y, HTML as C } from "../../enums/recommendation.js";
|
|
3
|
+
import { prepareRecommendationBlocks as x } from "./utils/recommendationCompilerUtils.js";
|
|
4
|
+
const w = [
|
|
5
5
|
{
|
|
6
6
|
id: "replace-images-with-variable-names",
|
|
7
7
|
description: "Replacing dummy images with variable names in recommendation module",
|
|
8
8
|
type: "custom",
|
|
9
|
-
processor: (
|
|
10
|
-
let
|
|
11
|
-
return Object.entries(
|
|
12
|
-
Object.entries(l).forEach(([
|
|
13
|
-
|
|
9
|
+
processor: (n) => {
|
|
10
|
+
let e = n;
|
|
11
|
+
return Object.entries(M).forEach(([, l]) => {
|
|
12
|
+
Object.entries(l).forEach(([s, r]) => {
|
|
13
|
+
e = e.replaceAll(r, `{{${s}}}`);
|
|
14
14
|
});
|
|
15
|
-
}),
|
|
15
|
+
}), e;
|
|
16
16
|
},
|
|
17
17
|
priority: 50
|
|
18
18
|
},
|
|
@@ -29,21 +29,21 @@ const G = [
|
|
|
29
29
|
id: "add-recommendation-unresponsive-css",
|
|
30
30
|
description: "Adding recommendation unresponsive css",
|
|
31
31
|
type: "custom",
|
|
32
|
-
processor: (
|
|
33
|
-
const { calculateCardWidth:
|
|
34
|
-
let
|
|
35
|
-
const
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
if (
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
}),
|
|
42
|
-
const
|
|
43
|
-
|
|
32
|
+
processor: (n) => {
|
|
33
|
+
const { calculateCardWidth: e, getRecommendationCampaignData: l } = N();
|
|
34
|
+
let s = n;
|
|
35
|
+
const r = s.match(_.ID);
|
|
36
|
+
if (r) {
|
|
37
|
+
const i = [];
|
|
38
|
+
if (r.forEach((p) => {
|
|
39
|
+
const u = /recommendation-id="(.*?)"/i.exec(p), I = u ? u[1].trim() : "", E = l(I);
|
|
40
|
+
E.textTrimming && E.orientation === h && i.push(e(E));
|
|
41
|
+
}), i.length) {
|
|
42
|
+
const p = `width:${Math.min(...i)}px!important;`;
|
|
43
|
+
s = s.replace(d.REGULAR_NAME_HEIGHT, `${d.TRIMMED_NAME_HEIGHT} ${p} ${d.ELLIPSIS}`).replace(d.REGULAR_NAME_CONTAINER_HEIGHT, d.TRIMMED_NAME_CONTAINER_CSS).replace(d.RESPONSIVE_NAME_SIZE, `${d.RESPONSIVE_NAME_HEIGHT} ${p} ${d.ELLIPSIS}`).replace(d.RESPONSIVE_NAME_CONTAINER_HEIGHT, d.TRIMMED_RESPONSIVE_NAME_CONTAINER_CSS);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
return
|
|
46
|
+
return s;
|
|
47
47
|
},
|
|
48
48
|
priority: 52
|
|
49
49
|
},
|
|
@@ -51,39 +51,147 @@ const G = [
|
|
|
51
51
|
id: "prepare-recommendations",
|
|
52
52
|
description: "Replacing product data with template variables in recommendation blocks",
|
|
53
53
|
type: "custom",
|
|
54
|
-
processor: (
|
|
54
|
+
processor: (n) => x(n),
|
|
55
55
|
priority: 48
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
58
|
id: "add-discount-conditions",
|
|
59
59
|
description: "Adding discount conditions to the recommendation block",
|
|
60
60
|
type: "custom",
|
|
61
|
-
processor: (
|
|
62
|
-
let
|
|
63
|
-
const l =
|
|
64
|
-
return l !== null && l.forEach((
|
|
65
|
-
const
|
|
66
|
-
if (!
|
|
61
|
+
processor: (n) => {
|
|
62
|
+
let e = n;
|
|
63
|
+
const l = e.match(_.ATTRIBUTE_PARAGRAPH), { getRecommendationCampaignData: s } = N();
|
|
64
|
+
return l !== null && l.forEach((r) => {
|
|
65
|
+
const i = r.match(_.CUSTOM_FIELD);
|
|
66
|
+
if (!i)
|
|
67
67
|
return;
|
|
68
|
-
const [
|
|
69
|
-
if (!
|
|
68
|
+
const [p] = i, u = p.match(_.CUSTOM_FIELD_INDEXES_PART), I = p.match(_.CUSTOM_FIELD_NAME_PART), E = r.match(_.ATTRIBUTE_PARAGRAPH_START_TAG);
|
|
69
|
+
if (!u || !I || !E)
|
|
70
70
|
return;
|
|
71
|
-
const [
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
74
|
-
const
|
|
75
|
-
|
|
71
|
+
const [S] = u, [m] = I, [t] = E, o = m.substring(1, m.length - 2), c = t.match(_.COMPOSITION) !== null;
|
|
72
|
+
let a = p;
|
|
73
|
+
if (c) {
|
|
74
|
+
const b = S.substring(2, S.length - 3), A = s(b);
|
|
75
|
+
o === R.OMNIBUS_PRICE && (A.priceBeforeTextValue && (a = `${A.priceBeforeTextValue}${a}`), A.priceAfterTextValue && (a = `${a}${A.priceAfterTextValue}`)), o === R.OMNIBUS_DISCOUNT && (A.discountBeforeTextValue && (a = `${A.discountBeforeTextValue}${a}`), A.discountAfterTextValue && (a = `${a}${A.discountAfterTextValue}`));
|
|
76
76
|
}
|
|
77
|
-
const
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
}),
|
|
77
|
+
const f = S.substring(2);
|
|
78
|
+
let T = "";
|
|
79
|
+
o in y.IF && (T = y.IF[o].replaceAll(`{${R.DISCOUNT}}`, `${f}${R.DISCOUNT}`).replaceAll(`{${R.OMNIBUS_DISCOUNT}}`, `${f}${R.OMNIBUS_DISCOUNT}`).replaceAll(`{${R.OMNIBUS_PRICE}}`, `${f}${R.OMNIBUS_PRICE}`));
|
|
80
|
+
const $ = `${t}${a}${C.PARAGRAPH_END_TAG}`, g = `${T}${c ? $ : r}${y.ELSE}${t}${C.PARAGRAPH_END_TAG}${y.END_IF}`;
|
|
81
|
+
e = e.replace(r, g);
|
|
82
|
+
}), e;
|
|
83
83
|
},
|
|
84
84
|
priority: 53
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: "strip-empty-omnibus-spans",
|
|
88
|
+
description: "Remove empty omnibus text-before and text-after span elements",
|
|
89
|
+
type: "regex",
|
|
90
|
+
pattern: '<span class="omnibus-text-(?:before|after)">\\s*</span>',
|
|
91
|
+
replacement: "",
|
|
92
|
+
flags: "g",
|
|
93
|
+
priority: 54
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "strip-recommendation-editor-attributes",
|
|
97
|
+
description: "Strip editor-only attributes from compiled recommendation output",
|
|
98
|
+
type: "regex",
|
|
99
|
+
// eslint-disable-next-line @stylistic/max-len
|
|
100
|
+
pattern: '\\s+(?:esd-extension-block-id|data-attribute-type|data-visibility|data-text-before|data-text-after|product-attr|composition)="[^"]*"',
|
|
101
|
+
replacement: "",
|
|
102
|
+
flags: "g",
|
|
103
|
+
priority: 55
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: "strip-unused-recommendation-classes",
|
|
107
|
+
description: "Remove CSS classes not referenced by any style rule from recommendation elements",
|
|
108
|
+
type: "custom",
|
|
109
|
+
processor: (n) => {
|
|
110
|
+
let e = n.replace(
|
|
111
|
+
/ class="(?:product-card-segment|attribute-cell|recommendation-attribute-row|product-image|product-name|product-price|product-old-price|product-omnibus-price|product-omnibus-discount|product-button|recommendation-product-row|product-card-wrapper)"/g,
|
|
112
|
+
""
|
|
113
|
+
);
|
|
114
|
+
return e = e.replaceAll("es-button buy-button", "es-button"), e = e.replaceAll("ins-recommendation-product-container ", ""), e;
|
|
115
|
+
},
|
|
116
|
+
priority: 56
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "remove-empty-mobile-layout-artifacts",
|
|
120
|
+
description: "Remove empty mobile container rows and unused mobile layout CSS",
|
|
121
|
+
type: "custom",
|
|
122
|
+
processor: (n) => {
|
|
123
|
+
let e = n;
|
|
124
|
+
return e = e.replace(
|
|
125
|
+
/<tr[^>]*class="ins-recommendation-mobile-row"[^>]*><\/tr>/g,
|
|
126
|
+
""
|
|
127
|
+
), /class="[^"]*ins-recommendation-mobile-container/.test(e) || (e = e.replace(
|
|
128
|
+
/\.ins-recommendation-mobile-container\s*\{\s*display\s*:\s*none\s*;?\s*\}/g,
|
|
129
|
+
""
|
|
130
|
+
), e = e.replace(
|
|
131
|
+
/@media[^{]*max-width\s*:\s*480px[^{]*\{((?:[^{}]*\{[^{}]*\})*[^{}]*)\}/g,
|
|
132
|
+
(l, s) => {
|
|
133
|
+
const r = s.match(/[^{}]+\{[^{}]*\}/g) || [], i = /ins-recommendation|product-image-cell|button-cell|product-info-cell/;
|
|
134
|
+
return r.every((u) => i.test(u)) ? "" : l;
|
|
135
|
+
}
|
|
136
|
+
)), e;
|
|
137
|
+
},
|
|
138
|
+
priority: 57
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
id: "deduplicate-inline-styles",
|
|
142
|
+
description: "Replace repeated inline styles with CSS class references within recommendation blocks",
|
|
143
|
+
type: "custom",
|
|
144
|
+
processor: (n) => {
|
|
145
|
+
const e = /<!--REC_START-->([\s\S]*?)<!--REC_END-->/g, l = / style="([^"]*)"/g, s = /* @__PURE__ */ new Map();
|
|
146
|
+
let r = e.exec(n);
|
|
147
|
+
for (; r !== null; ) {
|
|
148
|
+
let t = l.exec(r[1]);
|
|
149
|
+
for (; t !== null; ) {
|
|
150
|
+
const [, o] = t;
|
|
151
|
+
s.set(o, (s.get(o) || 0) + 1), t = l.exec(r[1]);
|
|
152
|
+
}
|
|
153
|
+
l.lastIndex = 0, r = e.exec(n);
|
|
154
|
+
}
|
|
155
|
+
const i = /* @__PURE__ */ new Map(), p = [];
|
|
156
|
+
let u = 0;
|
|
157
|
+
if (s.forEach((t, o) => {
|
|
158
|
+
if (t >= 6) {
|
|
159
|
+
const c = `rc${u++}`;
|
|
160
|
+
i.set(o, c), p.push(`.${c}{${o}}`);
|
|
161
|
+
}
|
|
162
|
+
}), i.size === 0) {
|
|
163
|
+
let t = n;
|
|
164
|
+
return t = t.replaceAll("<!--REC_START-->", ""), t = t.replaceAll("<!--REC_END-->", ""), t;
|
|
165
|
+
}
|
|
166
|
+
const I = (t) => t.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), E = (t, o) => `${t.slice(0, -1)} ${o}"`, S = /* @__PURE__ */ new Map();
|
|
167
|
+
i.forEach((t, o) => {
|
|
168
|
+
const c = I(o);
|
|
169
|
+
S.set(o, {
|
|
170
|
+
caseA: new RegExp(`(class="[^"]*")((?:[^>]*?)) style="${c}"`, "g"),
|
|
171
|
+
caseB: new RegExp(` style="${c}"((?:[^>]*?))(class="[^"]*")`, "g")
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
let m = n.replace("</style>", `${p.join("")}</style>`);
|
|
175
|
+
return m = m.replace(
|
|
176
|
+
/<!--REC_START-->([\s\S]*?)<!--REC_END-->/g,
|
|
177
|
+
(t, o) => {
|
|
178
|
+
let c = o;
|
|
179
|
+
return i.forEach((a, f) => {
|
|
180
|
+
const T = S.get(f);
|
|
181
|
+
T.caseA.lastIndex = 0, c = c.replace(
|
|
182
|
+
T.caseA,
|
|
183
|
+
($, g, b) => E(g, a) + b
|
|
184
|
+
), T.caseB.lastIndex = 0, c = c.replace(
|
|
185
|
+
T.caseB,
|
|
186
|
+
($, g, b) => g + E(b, a)
|
|
187
|
+
), c = c.replaceAll(` style="${f}"`, ` class="${a}"`);
|
|
188
|
+
}), c;
|
|
189
|
+
}
|
|
190
|
+
), m = m.replaceAll("<!--REC_START-->", ""), m = m.replaceAll("<!--REC_END-->", ""), m;
|
|
191
|
+
},
|
|
192
|
+
priority: 58
|
|
85
193
|
}
|
|
86
194
|
];
|
|
87
195
|
export {
|
|
88
|
-
|
|
196
|
+
w as recommendationCompilerRules
|
|
89
197
|
};
|
|
@@ -1,130 +1,131 @@
|
|
|
1
|
-
import { useRecommendation as
|
|
2
|
-
function b(e,
|
|
3
|
-
const
|
|
4
|
-
return
|
|
1
|
+
import { useRecommendation as S } from "../../../composables/useRecommendation.js";
|
|
2
|
+
function b(e, n, r, c) {
|
|
3
|
+
const u = `{{${e}_${n}_${r}}}`, t = `{{${e}_${n}_currency}}`;
|
|
4
|
+
return c === "before" ? `${t} ${u}` : `${u} ${t}`;
|
|
5
5
|
}
|
|
6
|
-
function p(e,
|
|
7
|
-
switch (
|
|
6
|
+
function p(e, n, r, c, u) {
|
|
7
|
+
switch (n) {
|
|
8
8
|
case "productImage": {
|
|
9
9
|
const t = e.querySelector("img");
|
|
10
|
-
t && (t.setAttribute("src", `{{${r}_${
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
t && (t.setAttribute("src", `{{${r}_${c}_image_url}}`), t.setAttribute("alt", `{{${r}_${c}_name}}`));
|
|
11
|
+
const o = e.querySelector("a");
|
|
12
|
+
o && o.setAttribute("href", `{{${r}_${c}_url}}`);
|
|
13
13
|
break;
|
|
14
14
|
}
|
|
15
15
|
case "productName": {
|
|
16
16
|
const t = e.querySelector("p");
|
|
17
17
|
if (t) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const o = t.querySelector("strong") || t;
|
|
19
|
+
o.textContent = `{{${r}_${c}_name}}`;
|
|
20
20
|
}
|
|
21
21
|
break;
|
|
22
22
|
}
|
|
23
23
|
case "productPrice": {
|
|
24
24
|
const t = e.querySelector("p");
|
|
25
25
|
if (t) {
|
|
26
|
-
const
|
|
27
|
-
|
|
26
|
+
const o = t.querySelector("strong") || t;
|
|
27
|
+
o.textContent = b(r, c, "price", u);
|
|
28
28
|
}
|
|
29
29
|
break;
|
|
30
30
|
}
|
|
31
31
|
case "productOldPrice": {
|
|
32
32
|
const t = e.querySelector("p");
|
|
33
33
|
if (t) {
|
|
34
|
-
const
|
|
35
|
-
|
|
34
|
+
const o = t.querySelector("strong") || t;
|
|
35
|
+
o.textContent = b(
|
|
36
36
|
r,
|
|
37
|
-
|
|
37
|
+
c,
|
|
38
38
|
"original_price",
|
|
39
|
-
|
|
39
|
+
u
|
|
40
40
|
), t.setAttribute("product-attr", "discount");
|
|
41
41
|
}
|
|
42
42
|
break;
|
|
43
43
|
}
|
|
44
44
|
case "productButton": {
|
|
45
45
|
const t = e.querySelector("a");
|
|
46
|
-
t && t.setAttribute("href", `{{${r}_${
|
|
46
|
+
t && t.setAttribute("href", `{{${r}_${c}_url}}`);
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
49
|
case "productOmnibusPrice": {
|
|
50
50
|
const t = e.querySelector(".omnibus-price-value");
|
|
51
51
|
if (t) {
|
|
52
|
-
t.textContent = `{{${r}_${
|
|
53
|
-
const
|
|
54
|
-
|
|
52
|
+
t.textContent = `{{${r}_${c}_omnibus_price}}`;
|
|
53
|
+
const o = t.closest("p");
|
|
54
|
+
o && (o.setAttribute("product-attr", "omnibus_price"), o.setAttribute("composition", "true"));
|
|
55
55
|
}
|
|
56
56
|
break;
|
|
57
57
|
}
|
|
58
58
|
case "productOmnibusDiscount": {
|
|
59
59
|
const t = e.querySelector(".omnibus-discount-value");
|
|
60
60
|
if (t) {
|
|
61
|
-
t.textContent = `{{${r}_${
|
|
62
|
-
const
|
|
63
|
-
|
|
61
|
+
t.textContent = `{{${r}_${c}_omnibus_discount}}`;
|
|
62
|
+
const o = t.closest("p");
|
|
63
|
+
o && (o.setAttribute("product-attr", "omnibus_discount"), o.setAttribute("composition", "true"));
|
|
64
64
|
}
|
|
65
65
|
break;
|
|
66
66
|
}
|
|
67
67
|
default: {
|
|
68
68
|
const t = e.getAttribute("product-attr") ? e : e.querySelector("[product-attr]");
|
|
69
69
|
if (t) {
|
|
70
|
-
const
|
|
70
|
+
const o = t.getAttribute("product-attr"), s = t.querySelector("p");
|
|
71
71
|
if (s) {
|
|
72
72
|
const i = s.querySelector("strong") || s;
|
|
73
|
-
i.textContent = `{{${r}_${
|
|
73
|
+
i.textContent = `{{${r}_${c}_${o}}}`;
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
e.querySelectorAll(".recommendation-product-row").forEach((
|
|
82
|
-
|
|
83
|
-
const i = s.getAttribute("data-attribute-type") || "",
|
|
84
|
-
|
|
85
|
-
p(
|
|
86
|
-
}) : p(s, i,
|
|
80
|
+
function _(e, n, r) {
|
|
81
|
+
e.querySelectorAll(".recommendation-product-row").forEach((u, t) => {
|
|
82
|
+
u.querySelectorAll("[data-attribute-type]").forEach((s) => {
|
|
83
|
+
const i = s.getAttribute("data-attribute-type") || "", a = s.querySelectorAll(".attribute-cell");
|
|
84
|
+
a.length > 0 ? a.forEach((l) => {
|
|
85
|
+
p(l, i, n, t, r);
|
|
86
|
+
}) : p(s, i, n, t, r);
|
|
87
87
|
});
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
if (!
|
|
90
|
+
function $(e, n, r) {
|
|
91
|
+
const c = e.querySelectorAll(".recommendation-product-row");
|
|
92
|
+
if (!c.length)
|
|
93
93
|
return;
|
|
94
|
-
const [
|
|
95
|
-
|
|
96
|
-
s.querySelectorAll("[data-attribute-type]").forEach((
|
|
97
|
-
const f =
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
p(y, f,
|
|
94
|
+
const [u] = c, t = u.querySelector("[data-attribute-type]"), o = t ? t.querySelectorAll(".attribute-cell").length : 1;
|
|
95
|
+
c.forEach((s, i) => {
|
|
96
|
+
s.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
97
|
+
const f = l.getAttribute("data-attribute-type") || "";
|
|
98
|
+
l.querySelectorAll(".attribute-cell").forEach((y, m) => {
|
|
99
|
+
const A = i * o + m;
|
|
100
|
+
p(y, f, n, A, r);
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
function
|
|
106
|
-
e.querySelectorAll(".ins-recommendation-product-container").forEach((
|
|
107
|
-
|
|
105
|
+
function d(e, n, r) {
|
|
106
|
+
e.querySelectorAll(".ins-recommendation-product-container").forEach((u) => {
|
|
107
|
+
$(u, n, r);
|
|
108
108
|
});
|
|
109
109
|
}
|
|
110
|
-
function
|
|
111
|
-
const r = e.getAttribute("data-layout") || "grid",
|
|
112
|
-
r === "list" ?
|
|
110
|
+
function q(e, n) {
|
|
111
|
+
const r = e.getAttribute("data-layout") || "grid", c = e.getAttribute("currency-alignment") || "after";
|
|
112
|
+
r === "list" ? _(e, n, c) : d(e, n, c);
|
|
113
113
|
}
|
|
114
|
-
function g(e,
|
|
114
|
+
function g(e, n) {
|
|
115
115
|
const r = e.match(/<!DOCTYPE[^>]*>/i);
|
|
116
116
|
return (r ? `${r[0]}
|
|
117
|
-
` : "") +
|
|
117
|
+
` : "") + n.documentElement.outerHTML;
|
|
118
118
|
}
|
|
119
119
|
function E(e) {
|
|
120
|
-
const
|
|
121
|
-
if (!
|
|
120
|
+
const n = e.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), r = new DOMParser().parseFromString(n, "text/html"), c = r.querySelectorAll(".recommendation-block-v2");
|
|
121
|
+
if (!c.length)
|
|
122
122
|
return e;
|
|
123
|
-
const { buildCampaignUrl:
|
|
124
|
-
return
|
|
125
|
-
|
|
126
|
-
s
|
|
127
|
-
|
|
123
|
+
const { buildCampaignUrl: u } = S();
|
|
124
|
+
return c.forEach((o) => {
|
|
125
|
+
var i, a;
|
|
126
|
+
const s = o.getAttribute("recommendation-id");
|
|
127
|
+
s && ((i = o.parentNode) == null || i.insertBefore(r.createComment("REC_START"), o), (a = o.parentNode) == null || a.insertBefore(r.createComment("REC_END"), o.nextSibling), u(s), q(o, s));
|
|
128
|
+
}), g(n, r).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
128
129
|
}
|
|
129
130
|
export {
|
|
130
131
|
b as formatPriceVariable,
|
|
@@ -169,7 +169,7 @@ class q extends b {
|
|
|
169
169
|
if (e && e.includes(a))
|
|
170
170
|
return t;
|
|
171
171
|
}
|
|
172
|
-
return "querySelector" in t ? t.querySelector(`.${a}`)
|
|
172
|
+
return "querySelector" in t ? t.querySelector(`.${a}`) : null;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* Migrate configuration from legacy format
|