@useinsider/guido 3.21.1-beta.7e3b468 → 3.21.1-beta.7f84ba7
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/htmlCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +55 -53
- package/dist/extensions/Blocks/Recommendation/block.js +223 -138
- package/dist/extensions/Blocks/Recommendation/controls/image/index.js +76 -16
- package/dist/extensions/Blocks/Recommendation/controls/main/algorithm.js +18 -23
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +171 -141
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +68 -59
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +249 -248
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +16 -15
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +62 -45
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +52 -31
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +25 -7
- package/dist/src/extensions/Blocks/Recommendation/controls/image/index.d.ts +31 -17
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +5 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +6 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +11 -0
- package/dist/static/styles/components/tabs.css.js +5 -0
- package/package.json +2 -2
|
@@ -88,7 +88,7 @@ const d = [
|
|
|
88
88
|
/<!--\[if\s\(mso 16\)\]>\s*<style\s*\S*>\s*a\s*\{\s*text-decoration\s*:\s*none\s*;*\s*\}\s*<\/style>\s*<!\[endif\]-->/g,
|
|
89
89
|
/<!--\[if\sgte mso 9\]>\s*<style\s*\S*>\s*sup\s*\{\s*font-size\s*:\s*100%\s*!important\s*;*\s*\}\s*<\/style>\s*<!\[endif\]-->/g,
|
|
90
90
|
/<!--\[if\sgte mso 9\]>\s*<noscript>\s*<xml>\s*<o:OfficeDocumentSettings>\s*<o:AllowPNG>\s*<\/o:AllowPNG>\s*<o:PixelsPerInch>\d+<\/o:PixelsPerInch>\s*<\/o:OfficeDocumentSettings>\s*<\/xml>\s*<\/noscript>\s*<!\[endif\]-->/g,
|
|
91
|
-
/<!--\[if mso\]>\s*<xml>\s*<w:WordDocument\s+xmlns:w="urn:schemas-microsoft-com:office:word">\s*<w:DontUseAdvancedTypographyReadingMail
|
|
91
|
+
/<!--\[if mso\]>\s*<xml>\s*<w:WordDocument\s+xmlns:w="urn:schemas-microsoft-com:office:word">\s*<w:DontUseAdvancedTypographyReadingMail\s*(?:\/>|><\/w:DontUseAdvancedTypographyReadingMail>)\s*<\/w:WordDocument>\s*<\/xml>\s*<!\[endif\]-->/g,
|
|
92
92
|
/<\!--\[if \!mso\]><\!--\s*\d*\s*-->\s*<\!--\[if \!mso\]><\!--\s*\d*\s*-->\s*<\!--<!\[endif\]-->/g,
|
|
93
93
|
/<!--\[if\s\!mso\]>\s*<!-- \d -->/g
|
|
94
94
|
],
|
|
@@ -7,13 +7,13 @@ function L(t, r, e, o, c = "") {
|
|
|
7
7
|
const i = `{{${c}${t}_${r}_${e}}}`, n = `{{${c}${t}_${r}_currency}}`;
|
|
8
8
|
return o === "before" ? `${n} ${i}` : `${i} ${n}`;
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function A(t) {
|
|
11
11
|
let r = t;
|
|
12
12
|
for (; r.children.length === 1; )
|
|
13
13
|
[r] = r.children;
|
|
14
14
|
return r;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function y(t, r, e, o, c, i) {
|
|
17
17
|
switch (r) {
|
|
18
18
|
case "productImage": {
|
|
19
19
|
const n = t.querySelector("img");
|
|
@@ -24,7 +24,7 @@ function A(t, r, e, o, c, i) {
|
|
|
24
24
|
}
|
|
25
25
|
case "productName": {
|
|
26
26
|
const n = t.querySelector("p");
|
|
27
|
-
n && (
|
|
27
|
+
n && (A(n).textContent = `{{${i}${e}_${o}_name}}`);
|
|
28
28
|
break;
|
|
29
29
|
}
|
|
30
30
|
// Inline mode ("Move to next line" OFF) merges BOTH prices into one row
|
|
@@ -32,16 +32,16 @@ function A(t, r, e, o, c, i) {
|
|
|
32
32
|
// substitute by cell content, not by the row's anchor (SD-145161).
|
|
33
33
|
case "productPrice":
|
|
34
34
|
case "productOldPrice": {
|
|
35
|
-
const n = (
|
|
36
|
-
|
|
35
|
+
const n = (a, l) => {
|
|
36
|
+
a && (A(a).textContent = L(
|
|
37
37
|
e,
|
|
38
38
|
o,
|
|
39
|
-
|
|
39
|
+
l,
|
|
40
40
|
c,
|
|
41
41
|
i
|
|
42
42
|
));
|
|
43
|
-
}, s = t.querySelector(".product-price p"),
|
|
44
|
-
n(s ?? (r === "productPrice" ? u : null), "price"), n(
|
|
43
|
+
}, s = t.querySelector(".product-price p"), d = t.querySelector(".product-old-price p"), u = !s && !d ? t.querySelector("p") : null;
|
|
44
|
+
n(s ?? (r === "productPrice" ? u : null), "price"), n(d ?? (r === "productOldPrice" ? u : null), "original_price");
|
|
45
45
|
break;
|
|
46
46
|
}
|
|
47
47
|
case "productButton": {
|
|
@@ -70,8 +70,8 @@ function A(t, r, e, o, c, i) {
|
|
|
70
70
|
default: {
|
|
71
71
|
const n = t.getAttribute("product-attr") ? t : t.querySelector("[product-attr]");
|
|
72
72
|
if (n) {
|
|
73
|
-
const s = n.getAttribute("product-attr"),
|
|
74
|
-
|
|
73
|
+
const s = n.getAttribute("product-attr"), d = n.querySelector("p");
|
|
74
|
+
d && (A(d).textContent = `{{${i}${e}_${o}_${s}}}`);
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
77
77
|
}
|
|
@@ -88,54 +88,54 @@ function b(t, r, e, o) {
|
|
|
88
88
|
function R(t, r, e) {
|
|
89
89
|
return b(t, r, 0, e);
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function w(t, r, e, o) {
|
|
92
92
|
if (!t.innerHTML.includes("{{"))
|
|
93
93
|
return;
|
|
94
94
|
const { open: c, close: i } = b(t.ownerDocument, r, e, o);
|
|
95
95
|
t.insertBefore(c, t.firstChild), t.appendChild(i);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function D(t, r, e, o) {
|
|
98
98
|
var n, s;
|
|
99
99
|
if (!t.innerHTML.includes("{{"))
|
|
100
100
|
return;
|
|
101
101
|
const { open: c, close: i } = b(t.ownerDocument, r, e, o);
|
|
102
102
|
(n = t.parentNode) == null || n.insertBefore(c, t), (s = t.parentNode) == null || s.insertBefore(i, t.nextSibling);
|
|
103
103
|
}
|
|
104
|
-
function
|
|
104
|
+
function v(t, r, e, o) {
|
|
105
105
|
t.querySelectorAll(".recommendation-product-row").forEach((i, n) => {
|
|
106
|
-
i.querySelectorAll("[data-attribute-type]").forEach((
|
|
107
|
-
const u =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}) :
|
|
111
|
-
}),
|
|
106
|
+
i.querySelectorAll("[data-attribute-type]").forEach((d) => {
|
|
107
|
+
const u = d.getAttribute("data-attribute-type") || "", a = d.querySelectorAll(".attribute-cell");
|
|
108
|
+
a.length > 0 ? a.forEach((l) => {
|
|
109
|
+
y(l, u, r, n, e, o);
|
|
110
|
+
}) : y(d, u, r, n, e, o);
|
|
111
|
+
}), D(i, r, n, o);
|
|
112
112
|
});
|
|
113
113
|
}
|
|
114
|
-
function
|
|
114
|
+
function H(t, r, e, o) {
|
|
115
115
|
const c = t.querySelectorAll(".recommendation-product-row");
|
|
116
116
|
if (!c.length)
|
|
117
117
|
return;
|
|
118
118
|
const [i] = c, n = i.querySelector("[data-attribute-type]"), s = n ? n.querySelectorAll(".attribute-cell").length : 1;
|
|
119
|
-
c.forEach((
|
|
120
|
-
|
|
121
|
-
const p =
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
119
|
+
c.forEach((d, u) => {
|
|
120
|
+
d.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
121
|
+
const p = l.getAttribute("data-attribute-type") || "";
|
|
122
|
+
l.querySelectorAll(".attribute-cell").forEach((f, h) => {
|
|
123
|
+
const S = u * s + h;
|
|
124
|
+
y(f, p, r, S, e, o), w(f, r, S, o);
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function W(t, r, e, o) {
|
|
130
130
|
t.querySelectorAll(".ins-recommendation-product-container").forEach((i) => {
|
|
131
|
-
|
|
131
|
+
H(i, r, e, o);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
function F(t, r, e) {
|
|
135
135
|
const o = t.getAttribute("data-layout") || "grid", c = t.getAttribute("currency-alignment") || "after";
|
|
136
|
-
o === "list" ?
|
|
136
|
+
o === "list" ? v(t, r, c, e) : W(t, r, c, e);
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function _(t, r, e) {
|
|
139
139
|
const o = new RegExp(`${r}\\s*:\\s*(\\d+)\\s*px`, "i"), c = t.match(o);
|
|
140
140
|
return c ? parseInt(c[1]) : e;
|
|
141
141
|
}
|
|
@@ -150,7 +150,7 @@ function C(t) {
|
|
|
150
150
|
const e = (t.getAttribute("style") || "").match(/(?:^|[;\s])width\s*:\s*(\d+(?:\.\d+)?(?:px|%))/i);
|
|
151
151
|
return e && $(e[1]) ? e[1] : null;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
153
|
+
function x(t, r) {
|
|
154
154
|
let e = t.parentElement;
|
|
155
155
|
for (; e && e !== r; ) {
|
|
156
156
|
if (e.tagName === "TD" && C(e))
|
|
@@ -159,35 +159,37 @@ function G(t, r) {
|
|
|
159
159
|
}
|
|
160
160
|
return null;
|
|
161
161
|
}
|
|
162
|
-
function
|
|
163
|
-
const r = t.getAttribute("style") || "", e =
|
|
162
|
+
function G(t) {
|
|
163
|
+
const r = t.getAttribute("style") || "", e = _(r, "width", 600), o = _(r, "padding", 0) * 2, c = Math.max(0, e - o);
|
|
164
164
|
c !== 0 && t.querySelectorAll("img.adapt-img").forEach((i) => {
|
|
165
165
|
if (i.hasAttribute("width"))
|
|
166
166
|
return;
|
|
167
|
-
const n =
|
|
167
|
+
const n = x(i, t);
|
|
168
168
|
if (!n)
|
|
169
169
|
return;
|
|
170
|
-
const s = C(n),
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
170
|
+
const s = C(n), d = _(n.getAttribute("style") || "", "padding", 0) * 2, u = s.endsWith("%") ? Math.floor(c * parseFloat(s) / 100) : parseInt(s), a = Math.max(1, u - d), l = i.getAttribute("style") || "", p = /(?:^|[;\s])max-height\s*:\s*(\d+(?:\.\d+)?)px/i.exec(l);
|
|
171
|
+
if (p) {
|
|
172
|
+
i.setAttribute("width", String(Math.max(1, Math.min(a, Math.floor(parseFloat(p[1])))))), i.removeAttribute("height");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (i.setAttribute("width", String(a)), !/\bwidth\s*:\s*\d/i.test(l)) {
|
|
176
|
+
const m = l && !l.trim().endsWith(";") ? "; " : "";
|
|
177
|
+
i.setAttribute("style", `${l}${m}width: ${a}px`);
|
|
176
178
|
}
|
|
177
179
|
});
|
|
178
180
|
}
|
|
179
|
-
const E = "MSO_MOBILE_HIDE_START",
|
|
180
|
-
function
|
|
181
|
+
const E = "MSO_MOBILE_HIDE_START", V = "MSO_MOBILE_HIDE_END";
|
|
182
|
+
function U(t, r) {
|
|
181
183
|
t.querySelectorAll(q).forEach((e) => {
|
|
182
184
|
var i, n;
|
|
183
185
|
const o = e.querySelector(M);
|
|
184
186
|
if (!o || o.children.length === 0)
|
|
185
187
|
return;
|
|
186
188
|
const c = e.previousSibling;
|
|
187
|
-
(c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(
|
|
189
|
+
(c == null ? void 0 : c.nodeType) === Node.COMMENT_NODE && c.data === E || ((i = e.parentNode) == null || i.insertBefore(r.createComment(E), e), (n = e.parentNode) == null || n.insertBefore(r.createComment(V), e.nextSibling));
|
|
188
190
|
});
|
|
189
191
|
}
|
|
190
|
-
function
|
|
192
|
+
function X(t, r) {
|
|
191
193
|
const e = t.match(/<!DOCTYPE[^>]*>/i);
|
|
192
194
|
return (e ? `${e[0]}
|
|
193
195
|
` : "") + r.documentElement.outerHTML;
|
|
@@ -200,17 +202,17 @@ function Q(t) {
|
|
|
200
202
|
i.recommendationCampaignUrls = {};
|
|
201
203
|
const { isFeatureEnabled: n } = g(), s = n("liquidSyntax") ? "reco_" : "";
|
|
202
204
|
return o.forEach((u) => {
|
|
203
|
-
var
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
if ((
|
|
207
|
-
F(u,
|
|
208
|
-
const { open:
|
|
209
|
-
(
|
|
205
|
+
var l, p, m, f;
|
|
206
|
+
const a = u.getAttribute("recommendation-id");
|
|
207
|
+
if (a) {
|
|
208
|
+
if ((l = u.parentNode) == null || l.insertBefore(e.createComment("REC_START"), u), (p = u.parentNode) == null || p.insertBefore(e.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((h) => h.remove()), c(a), U(u, e), !T(u)) {
|
|
209
|
+
F(u, a, s);
|
|
210
|
+
const { open: h, close: S } = R(e, a, s);
|
|
211
|
+
(m = u.parentNode) == null || m.insertBefore(h, u), (f = u.parentNode) == null || f.insertBefore(S, u.nextSibling);
|
|
210
212
|
}
|
|
211
|
-
|
|
213
|
+
G(u);
|
|
212
214
|
}
|
|
213
|
-
}),
|
|
215
|
+
}), X(r, e).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
214
216
|
}
|
|
215
217
|
export {
|
|
216
218
|
L as formatPriceVariable,
|