@useinsider/guido 3.7.2-beta.1489585 → 3.7.2-beta.2220fb0
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/@types/config/schemas.js +70 -66
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +100 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +92 -78
- package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/extensions/Blocks/Recommendation/block.js +60 -41
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +369 -288
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +338 -288
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -30
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +217 -155
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -56
- package/dist/extensions/Blocks/Recommendation/templates/index.js +10 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +135 -145
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -43
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +96 -109
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +47 -163
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -216
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
|
@@ -2,144 +2,158 @@ import { useConfig as _ } from "../../../composables/useConfig.js";
|
|
|
2
2
|
import { useRecommendation as g } from "../../../composables/useRecommendation.js";
|
|
3
3
|
import { CSS_CLASS_RECO_BUTTON as q } from "../../../extensions/Blocks/Recommendation/constants/selectors.js";
|
|
4
4
|
import { useRecommendationExtensionStore as C } from "../../../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
5
|
-
function
|
|
6
|
-
const c = `{{${
|
|
7
|
-
return o === "before" ? `${
|
|
5
|
+
function b(r, n, t, o, s = "") {
|
|
6
|
+
const c = `{{${s}${r}_${n}_${t}}}`, e = `{{${s}${r}_${n}_currency}}`;
|
|
7
|
+
return o === "before" ? `${e} ${c}` : `${c} ${e}`;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function f(r) {
|
|
10
10
|
let n = r;
|
|
11
11
|
for (; n.children.length === 1; )
|
|
12
12
|
[n] = n.children;
|
|
13
13
|
return n;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function h(r, n, t, o, s, c) {
|
|
16
16
|
switch (n) {
|
|
17
17
|
case "productImage": {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
18
|
+
const e = r.querySelector("img");
|
|
19
|
+
e && (e.setAttribute("src", `{{${c}${t}_${o}_image_url}}`), e.setAttribute("alt", `{{${c}${t}_${o}_name}}`));
|
|
20
|
+
const i = r.querySelector("a");
|
|
21
|
+
i && (i.setAttribute("href", `{{${c}${t}_${o}_url}}`), i.classList.add(q));
|
|
22
22
|
break;
|
|
23
23
|
}
|
|
24
24
|
case "productName": {
|
|
25
|
-
const
|
|
26
|
-
|
|
25
|
+
const e = r.querySelector("p");
|
|
26
|
+
if (e) {
|
|
27
|
+
const i = e.querySelector("strong") || e;
|
|
28
|
+
i.textContent = `{{${c}${t}_${o}_name}}`;
|
|
29
|
+
}
|
|
27
30
|
break;
|
|
28
31
|
}
|
|
29
32
|
case "productPrice": {
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
const e = r.querySelector(".product-price p") ?? r.querySelector("p");
|
|
34
|
+
e && (f(e).textContent = b(
|
|
35
|
+
t,
|
|
33
36
|
o,
|
|
34
37
|
"price",
|
|
35
|
-
|
|
38
|
+
s,
|
|
39
|
+
c
|
|
40
|
+
));
|
|
41
|
+
const i = r.querySelector(".product-old-price p");
|
|
42
|
+
i && (f(i).textContent = b(
|
|
43
|
+
t,
|
|
44
|
+
o,
|
|
45
|
+
"original_price",
|
|
46
|
+
s,
|
|
36
47
|
c
|
|
37
48
|
));
|
|
38
49
|
break;
|
|
39
50
|
}
|
|
40
51
|
case "productOldPrice": {
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
const e = r.querySelector("p");
|
|
53
|
+
e && (f(e).textContent = b(
|
|
54
|
+
t,
|
|
44
55
|
o,
|
|
45
56
|
"original_price",
|
|
46
|
-
|
|
57
|
+
s,
|
|
47
58
|
c
|
|
48
|
-
)
|
|
59
|
+
));
|
|
49
60
|
break;
|
|
50
61
|
}
|
|
51
62
|
case "productButton": {
|
|
52
|
-
const
|
|
53
|
-
|
|
63
|
+
const e = r.querySelector("a");
|
|
64
|
+
e && e.setAttribute("href", `{{${c}${t}_${o}_url}}`);
|
|
54
65
|
break;
|
|
55
66
|
}
|
|
56
67
|
case "productOmnibusPrice": {
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
68
|
+
const e = r.querySelector(".omnibus-price-value");
|
|
69
|
+
if (e) {
|
|
70
|
+
e.textContent = `{{${c}${t}_${o}_omnibus_price}}`;
|
|
71
|
+
const i = e.closest("p");
|
|
72
|
+
i && (i.setAttribute("product-attr", "omnibus_price"), i.setAttribute("composition", "true"));
|
|
62
73
|
}
|
|
63
74
|
break;
|
|
64
75
|
}
|
|
65
76
|
case "productOmnibusDiscount": {
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
|
|
77
|
+
const e = r.querySelector(".omnibus-discount-value");
|
|
78
|
+
if (e) {
|
|
79
|
+
e.textContent = `{{${c}${t}_${o}_omnibus_discount}}`;
|
|
80
|
+
const i = e.closest("p");
|
|
81
|
+
i && (i.setAttribute("product-attr", "omnibus_discount"), i.setAttribute("composition", "true"));
|
|
71
82
|
}
|
|
72
83
|
break;
|
|
73
84
|
}
|
|
74
85
|
default: {
|
|
75
|
-
const
|
|
76
|
-
if (
|
|
77
|
-
const
|
|
78
|
-
|
|
86
|
+
const e = r.getAttribute("product-attr") ? r : r.querySelector("[product-attr]");
|
|
87
|
+
if (e) {
|
|
88
|
+
const i = e.getAttribute("product-attr"), a = e.querySelector("p");
|
|
89
|
+
if (a) {
|
|
90
|
+
const u = a.querySelector("strong") || a;
|
|
91
|
+
u.textContent = `{{${c}${t}_${o}_${i}}}`;
|
|
92
|
+
}
|
|
79
93
|
}
|
|
80
94
|
break;
|
|
81
95
|
}
|
|
82
96
|
}
|
|
83
97
|
}
|
|
84
|
-
function w(r, n,
|
|
85
|
-
r.querySelectorAll(".recommendation-product-row").forEach((c,
|
|
98
|
+
function w(r, n, t, o) {
|
|
99
|
+
r.querySelectorAll(".recommendation-product-row").forEach((c, e) => {
|
|
86
100
|
c.querySelectorAll("[data-attribute-type]").forEach((a) => {
|
|
87
101
|
const u = a.getAttribute("data-attribute-type") || "", p = a.querySelectorAll(".attribute-cell");
|
|
88
102
|
p.length > 0 ? p.forEach((l) => {
|
|
89
|
-
|
|
90
|
-
}) :
|
|
103
|
+
h(l, u, n, e, t, o);
|
|
104
|
+
}) : h(a, u, n, e, t, o);
|
|
91
105
|
});
|
|
92
106
|
});
|
|
93
107
|
}
|
|
94
|
-
function E(r, n,
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
108
|
+
function E(r, n, t, o) {
|
|
109
|
+
const s = r.querySelectorAll(".recommendation-product-row");
|
|
110
|
+
if (!s.length)
|
|
97
111
|
return;
|
|
98
|
-
const [c] =
|
|
99
|
-
|
|
112
|
+
const [c] = s, e = c.querySelector("[data-attribute-type]"), i = e ? e.querySelectorAll(".attribute-cell").length : 1;
|
|
113
|
+
s.forEach((a, u) => {
|
|
100
114
|
a.querySelectorAll("[data-attribute-type]").forEach((l) => {
|
|
101
115
|
const d = l.getAttribute("data-attribute-type") || "";
|
|
102
|
-
l.querySelectorAll(".attribute-cell").forEach((
|
|
103
|
-
const S = u *
|
|
104
|
-
A
|
|
116
|
+
l.querySelectorAll(".attribute-cell").forEach((A, $) => {
|
|
117
|
+
const S = u * i + $;
|
|
118
|
+
h(A, d, n, S, t, o);
|
|
105
119
|
});
|
|
106
120
|
});
|
|
107
121
|
});
|
|
108
122
|
}
|
|
109
|
-
function
|
|
123
|
+
function P(r, n, t, o) {
|
|
110
124
|
r.querySelectorAll(".ins-recommendation-product-container").forEach((c) => {
|
|
111
|
-
E(c, n,
|
|
125
|
+
E(c, n, t, o);
|
|
112
126
|
});
|
|
113
127
|
}
|
|
114
|
-
function
|
|
115
|
-
const o = r.getAttribute("data-layout") || "grid",
|
|
116
|
-
o === "list" ? w(r, n,
|
|
128
|
+
function R(r, n, t) {
|
|
129
|
+
const o = r.getAttribute("data-layout") || "grid", s = r.getAttribute("currency-alignment") || "after";
|
|
130
|
+
o === "list" ? w(r, n, s, t) : P(r, n, s, t);
|
|
117
131
|
}
|
|
118
|
-
function
|
|
119
|
-
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"),
|
|
120
|
-
return
|
|
132
|
+
function y(r, n, t) {
|
|
133
|
+
const o = new RegExp(`${n}\\s*:\\s*(\\d+)\\s*px`, "i"), s = r.match(o);
|
|
134
|
+
return s ? parseInt(s[1]) : t;
|
|
121
135
|
}
|
|
122
|
-
function
|
|
123
|
-
let
|
|
124
|
-
for (;
|
|
125
|
-
if (
|
|
126
|
-
const o =
|
|
136
|
+
function O(r, n) {
|
|
137
|
+
let t = r.parentElement;
|
|
138
|
+
for (; t && t !== n; ) {
|
|
139
|
+
if (t.tagName === "TD") {
|
|
140
|
+
const o = t.getAttribute("width");
|
|
127
141
|
if (o && o.endsWith("%") && parseFloat(o) < 100)
|
|
128
|
-
return
|
|
142
|
+
return t;
|
|
129
143
|
}
|
|
130
|
-
|
|
144
|
+
t = t.parentElement;
|
|
131
145
|
}
|
|
132
146
|
return null;
|
|
133
147
|
}
|
|
134
|
-
function
|
|
135
|
-
const n = r.getAttribute("style") || "",
|
|
136
|
-
|
|
148
|
+
function T(r) {
|
|
149
|
+
const n = r.getAttribute("style") || "", t = y(n, "width", 600), o = y(n, "padding", 0) * 2, s = Math.max(0, t - o);
|
|
150
|
+
s !== 0 && r.querySelectorAll("img.adapt-img").forEach((c) => {
|
|
137
151
|
if (c.hasAttribute("width"))
|
|
138
152
|
return;
|
|
139
|
-
const
|
|
140
|
-
if (!
|
|
153
|
+
const e = O(c, r);
|
|
154
|
+
if (!e)
|
|
141
155
|
return;
|
|
142
|
-
const
|
|
156
|
+
const i = e.getAttribute("width"), a = parseFloat(i), u = y(e.getAttribute("style") || "", "padding", 0) * 2, p = Math.floor(s * a / 100), l = Math.max(1, p - u);
|
|
143
157
|
c.setAttribute("width", String(l));
|
|
144
158
|
const d = c.getAttribute("style") || "";
|
|
145
159
|
if (!/\bwidth\s*:\s*\d/i.test(d)) {
|
|
@@ -148,25 +162,25 @@ function v(r) {
|
|
|
148
162
|
}
|
|
149
163
|
});
|
|
150
164
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
153
|
-
return (
|
|
165
|
+
function v(r, n) {
|
|
166
|
+
const t = r.match(/<!DOCTYPE[^>]*>/i);
|
|
167
|
+
return (t ? `${t[0]}
|
|
154
168
|
` : "") + n.documentElement.outerHTML;
|
|
155
169
|
}
|
|
156
170
|
function N(r) {
|
|
157
|
-
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"),
|
|
171
|
+
const n = r.replaceAll("{%", "<!--{%").replaceAll("%}", "%}-->"), t = new DOMParser().parseFromString(n, "text/html"), o = t.querySelectorAll(".recommendation-block-v2");
|
|
158
172
|
if (!o.length)
|
|
159
173
|
return r;
|
|
160
|
-
const { buildCampaignUrl:
|
|
174
|
+
const { buildCampaignUrl: s } = g(), c = C();
|
|
161
175
|
c.recommendationCampaignUrls = {};
|
|
162
|
-
const { isFeatureEnabled:
|
|
176
|
+
const { isFeatureEnabled: e } = _(), i = e("liquidSyntax") ? "reco_" : "";
|
|
163
177
|
return o.forEach((u) => {
|
|
164
178
|
var l, d;
|
|
165
179
|
const p = u.getAttribute("recommendation-id");
|
|
166
|
-
p && ((l = u.parentNode) == null || l.insertBefore(
|
|
167
|
-
}),
|
|
180
|
+
p && ((l = u.parentNode) == null || l.insertBefore(t.createComment("REC_START"), u), (d = u.parentNode) == null || d.insertBefore(t.createComment("REC_END"), u.nextSibling), u.querySelectorAll('[data-visibility="0"]').forEach((m) => m.remove()), s(p), R(u, p, i), T(u));
|
|
181
|
+
}), v(n, t).replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}").replaceAll("<!--{%", "{%").replaceAll("%}-->", "%}");
|
|
168
182
|
}
|
|
169
183
|
export {
|
|
170
|
-
|
|
184
|
+
b as formatPriceVariable,
|
|
171
185
|
N as prepareRecommendationBlocks
|
|
172
186
|
};
|
|
@@ -35,11 +35,11 @@ function O(t, o) {
|
|
|
35
35
|
function lt(t, o, e, l) {
|
|
36
36
|
const s = t.width ? ` width="${t.width}"` : "", n = t.height ? ` height="${t.height}"` : "", i = ["display: block", "max-width: 100%", "height: auto"];
|
|
37
37
|
t.width && i.push(`width: ${t.width}px`), t.height && i.push(`height: ${t.height}px`);
|
|
38
|
-
const
|
|
38
|
+
const r = i.join("; "), a = e ? ` style="background-color: ${c(e)}"` : "";
|
|
39
39
|
return `
|
|
40
40
|
${O(l, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
41
41
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
42
|
-
class="product-card-segment"${
|
|
42
|
+
class="product-card-segment"${a}>
|
|
43
43
|
<tbody>
|
|
44
44
|
<tr valign="top">
|
|
45
45
|
<td align="center"
|
|
@@ -48,7 +48,7 @@ function lt(t, o, e, l) {
|
|
|
48
48
|
<a target="_blank" href="https://example.com/product/${o + 1}">
|
|
49
49
|
<img src="${Y}" alt="Product Name"
|
|
50
50
|
class="adapt-img"${s}${n}
|
|
51
|
-
style="${
|
|
51
|
+
style="${r}">
|
|
52
52
|
</a>
|
|
53
53
|
</td>
|
|
54
54
|
</tr>
|
|
@@ -57,12 +57,12 @@ function lt(t, o, e, l) {
|
|
|
57
57
|
</td>
|
|
58
58
|
`;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
const
|
|
60
|
+
function D(t, o, e, l, s, n, i) {
|
|
61
|
+
const a = `table-layout: fixed${n ? `; background-color: ${c(n)}` : ""}`, d = b(s.tdStyle), p = y(s.align), u = `esd-block-text ${o}`.trim(), m = $(l, s.pStyle);
|
|
62
62
|
return `
|
|
63
63
|
${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
64
64
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
65
|
-
class="product-card-segment" style="${
|
|
65
|
+
class="product-card-segment" style="${a}">
|
|
66
66
|
<tbody>
|
|
67
67
|
<tr valign="top">
|
|
68
68
|
<td${p}
|
|
@@ -77,7 +77,7 @@ function L(t, o, e, l, s, n, i) {
|
|
|
77
77
|
`;
|
|
78
78
|
}
|
|
79
79
|
function st(t, o, e, l) {
|
|
80
|
-
const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align),
|
|
80
|
+
const s = o ? ` style="background-color: ${c(o)}"` : "", n = b(t.tdStyle), i = y(t.align), a = $("font-size: 14px; color: #999999", t.pStyle);
|
|
81
81
|
return `
|
|
82
82
|
${O(e, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
83
83
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
@@ -87,7 +87,7 @@ function st(t, o, e, l) {
|
|
|
87
87
|
<td${i}
|
|
88
88
|
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
89
89
|
esd-extension-block-id="${g.OLD_PRICE}"${n}>
|
|
90
|
-
<p contenteditable="false"${b(
|
|
90
|
+
<p contenteditable="false"${b(a)}>
|
|
91
91
|
<s>${k(l, t)}</s>
|
|
92
92
|
</p>
|
|
93
93
|
</td>
|
|
@@ -97,18 +97,18 @@ function st(t, o, e, l) {
|
|
|
97
97
|
</td>
|
|
98
98
|
`;
|
|
99
99
|
}
|
|
100
|
-
function
|
|
101
|
-
const
|
|
100
|
+
function L(t, o, e, l, s, n, i) {
|
|
101
|
+
const r = s ? `; background-color: ${c(s)}` : "", a = b(l.tdStyle), d = y(l.align), u = $("font-size: 12px; color: #666666", l.pStyle);
|
|
102
102
|
return `
|
|
103
103
|
${O(i, 'valign="top" style="padding: 0 5px; height: 100%"')}>
|
|
104
104
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
105
|
-
class="product-card-segment" style="table-layout: fixed${
|
|
105
|
+
class="product-card-segment" style="table-layout: fixed${r}">
|
|
106
106
|
<tbody>
|
|
107
107
|
<tr valign="top">
|
|
108
108
|
<td${d}
|
|
109
109
|
data-text-before="" data-text-after=""
|
|
110
110
|
class="esd-block-text ${n} es-p15l es-p15r"
|
|
111
|
-
esd-extension-block-id="${t}"${
|
|
111
|
+
esd-extension-block-id="${t}"${a}>
|
|
112
112
|
<p contenteditable="false"${b(u)}>
|
|
113
113
|
<span class="omnibus-text-before"></span>
|
|
114
114
|
<span class="${o}">${c(e)}</span>
|
|
@@ -122,7 +122,7 @@ function D(t, o, e, l, s, n, i) {
|
|
|
122
122
|
`;
|
|
123
123
|
}
|
|
124
124
|
function it(t, o, e, l) {
|
|
125
|
-
const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align),
|
|
125
|
+
const s = e ? ` style="background-color: ${c(e)}"` : "", n = $("padding: 0 5px; height: 100%", o.tdStyle), i = y(o.align), r = o.text || J, a = $(X, o.spanStyle), d = $(K, o.aStyle);
|
|
126
126
|
return `
|
|
127
127
|
${O(l, `valign="top" style="${c(n)}"`)}>
|
|
128
128
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
@@ -132,10 +132,10 @@ function it(t, o, e, l) {
|
|
|
132
132
|
<td${i}
|
|
133
133
|
class="esd-block-button product-button es-p10t es-p10b es-p5l es-p5r"
|
|
134
134
|
esd-extension-block-id="${g.BUTTON}">
|
|
135
|
-
<span class="es-button-border" style="${c(
|
|
135
|
+
<span class="es-button-border" style="${c(a)}">
|
|
136
136
|
<a href="https://example.com/product/${t + 1}" target="_blank"
|
|
137
137
|
class="es-button ${z}"
|
|
138
|
-
style="${c(d)}">${c(
|
|
138
|
+
style="${c(d)}">${c(r)}</a>
|
|
139
139
|
</span>
|
|
140
140
|
</td>
|
|
141
141
|
</tr>
|
|
@@ -145,14 +145,14 @@ function it(t, o, e, l) {
|
|
|
145
145
|
`;
|
|
146
146
|
}
|
|
147
147
|
function ct(t, o, e, l, s) {
|
|
148
|
-
const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle),
|
|
148
|
+
const n = l ? `; background-color: ${c(l)}` : "", i = b(e.tdStyle), r = y(e.align), d = $("font-size: 12px; color: #666666; margin: 0", e.pStyle), p = o.replace(/_/g, " ").replace(/\b\w/g, (u) => u.toUpperCase());
|
|
149
149
|
return `
|
|
150
150
|
${O(s, 'valign="middle" style="padding: 0 5px; height: 100%"')}>
|
|
151
151
|
<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"
|
|
152
152
|
class="product-card-segment" style="table-layout: fixed${n}">
|
|
153
153
|
<tbody>
|
|
154
154
|
<tr valign="top">
|
|
155
|
-
<td product-attr="${c(t)}"${
|
|
155
|
+
<td product-attr="${c(t)}"${r}
|
|
156
156
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
157
157
|
esd-extension-block-id="${g.CUSTOM_ATTRIBUTE}"${i}>
|
|
158
158
|
<p contenteditable="false"${b(d)}>${c(p)}</p>
|
|
@@ -163,54 +163,54 @@ function ct(t, o, e, l, s) {
|
|
|
163
163
|
</td>
|
|
164
164
|
`;
|
|
165
165
|
}
|
|
166
|
-
function
|
|
167
|
-
const
|
|
166
|
+
function rt(t, o, e, l, s, n, i) {
|
|
167
|
+
const r = o[t], a = r ?? _();
|
|
168
168
|
switch (t) {
|
|
169
169
|
case I:
|
|
170
170
|
return lt(
|
|
171
|
-
|
|
171
|
+
r ?? {},
|
|
172
172
|
s,
|
|
173
173
|
l,
|
|
174
174
|
n
|
|
175
175
|
);
|
|
176
176
|
case G:
|
|
177
|
-
return
|
|
177
|
+
return D(
|
|
178
178
|
g.NAME,
|
|
179
179
|
"product-name es-p10t es-p10b es-p15l es-p15r",
|
|
180
180
|
"Product Name",
|
|
181
181
|
"font-size: 16px; color: #333333",
|
|
182
|
-
|
|
182
|
+
a,
|
|
183
183
|
l,
|
|
184
184
|
n
|
|
185
185
|
);
|
|
186
186
|
case H:
|
|
187
|
-
return
|
|
187
|
+
return D(
|
|
188
188
|
g.PRICE,
|
|
189
189
|
"product-price es-p15l es-p15r",
|
|
190
190
|
i.pricePlaceholder,
|
|
191
191
|
"font-size: 16px; color: #333333",
|
|
192
|
-
q(
|
|
192
|
+
q(r),
|
|
193
193
|
l,
|
|
194
194
|
n
|
|
195
195
|
);
|
|
196
196
|
case j:
|
|
197
|
-
return st(
|
|
197
|
+
return st(a, l, n, i.oldPricePlaceholder);
|
|
198
198
|
case U:
|
|
199
|
-
return
|
|
199
|
+
return L(
|
|
200
200
|
g.OMNIBUS_PRICE,
|
|
201
201
|
"omnibus-price-value",
|
|
202
202
|
i.omnibusPricePlaceholder,
|
|
203
|
-
|
|
203
|
+
a,
|
|
204
204
|
l,
|
|
205
205
|
"product-omnibus-price",
|
|
206
206
|
n
|
|
207
207
|
);
|
|
208
208
|
case V:
|
|
209
|
-
return
|
|
209
|
+
return L(
|
|
210
210
|
g.OMNIBUS_DISCOUNT,
|
|
211
211
|
"omnibus-discount-value",
|
|
212
212
|
"-10%",
|
|
213
|
-
|
|
213
|
+
a,
|
|
214
214
|
l,
|
|
215
215
|
"product-omnibus-discount",
|
|
216
216
|
n
|
|
@@ -218,14 +218,14 @@ function at(t, o, e, l, s, n, i) {
|
|
|
218
218
|
case N:
|
|
219
219
|
return it(
|
|
220
220
|
s,
|
|
221
|
-
|
|
221
|
+
r ?? {},
|
|
222
222
|
l,
|
|
223
223
|
n
|
|
224
224
|
);
|
|
225
225
|
default:
|
|
226
226
|
if (t.startsWith(E)) {
|
|
227
227
|
const d = e[t] ?? t.slice(E.length), p = t.slice(E.length);
|
|
228
|
-
return ct(d, p,
|
|
228
|
+
return ct(d, p, a, l, n);
|
|
229
229
|
}
|
|
230
230
|
return null;
|
|
231
231
|
}
|
|
@@ -235,7 +235,7 @@ const Q = `
|
|
|
235
235
|
<td class="spacer" style="height: 10px"></td>
|
|
236
236
|
</tr>
|
|
237
237
|
`;
|
|
238
|
-
function
|
|
238
|
+
function at(t) {
|
|
239
239
|
return {
|
|
240
240
|
pricePlaceholder: v({ price: 18, currency: t }),
|
|
241
241
|
oldPricePlaceholder: v({ price: 20, currency: t }),
|
|
@@ -243,7 +243,7 @@ function rt(t) {
|
|
|
243
243
|
};
|
|
244
244
|
}
|
|
245
245
|
function dt(t, o, e, l) {
|
|
246
|
-
const { composition: s, visibility: n, perElement: i, customAttrValues:
|
|
246
|
+
const { composition: s, visibility: n, perElement: i, customAttrValues: r, cardBg: a } = l, d = (100 / e).toFixed(2), p = e - o, u = `<td class="${F}" style="padding: 0 5px;" width="${d}%"></td>`, m = p > 0 ? u.repeat(p) : "";
|
|
247
247
|
return `
|
|
248
248
|
<tr class="recommendation-product-row">
|
|
249
249
|
<td>
|
|
@@ -252,11 +252,11 @@ function dt(t, o, e, l) {
|
|
|
252
252
|
<tbody>${s.map((T) => {
|
|
253
253
|
const w = n[T] !== !1, f = w ? "" : ' style="display: none"', C = w ? "1" : "0", S = [];
|
|
254
254
|
for (let x = 0; x < o; x += 1) {
|
|
255
|
-
const A =
|
|
255
|
+
const A = rt(
|
|
256
256
|
T,
|
|
257
257
|
i,
|
|
258
|
-
a,
|
|
259
258
|
r,
|
|
259
|
+
a,
|
|
260
260
|
t + x,
|
|
261
261
|
d,
|
|
262
262
|
l
|
|
@@ -287,60 +287,60 @@ function pt(t, o, e) {
|
|
|
287
287
|
function ut(t, o, e, l) {
|
|
288
288
|
const s = o[t];
|
|
289
289
|
if (t === G) {
|
|
290
|
-
const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle),
|
|
290
|
+
const n = s ?? _(), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), r = y(n.align ?? "left");
|
|
291
291
|
return `
|
|
292
292
|
<td class="esd-block-text product-name"
|
|
293
|
-
esd-extension-block-id="${g.NAME}"${
|
|
293
|
+
esd-extension-block-id="${g.NAME}"${r}${b(n.tdStyle)}>
|
|
294
294
|
<p contenteditable="false"${b(i)}>${k("Product Name", n)}</p>
|
|
295
295
|
</td>
|
|
296
296
|
`;
|
|
297
297
|
}
|
|
298
298
|
if (t === H) {
|
|
299
|
-
const n = q(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle),
|
|
299
|
+
const n = q(s), i = $("font-size: 16px; color: #333333; margin: 0", n.pStyle), r = y(n.align ?? "left");
|
|
300
300
|
return `
|
|
301
301
|
<td class="esd-block-text product-price"
|
|
302
|
-
esd-extension-block-id="${g.PRICE}"${
|
|
302
|
+
esd-extension-block-id="${g.PRICE}"${r}${b(n.tdStyle)}>
|
|
303
303
|
<p contenteditable="false"${b(i)}>${k(l.pricePlaceholder, n)}</p>
|
|
304
304
|
</td>
|
|
305
305
|
`;
|
|
306
306
|
}
|
|
307
307
|
if (t === j) {
|
|
308
|
-
const n = s ?? _(),
|
|
308
|
+
const n = s ?? _(), r = $("font-size: 14px; color: #999999; text-decoration: line-through; margin: 0", n.pStyle), a = y(n.align ?? "left");
|
|
309
309
|
return `
|
|
310
310
|
<td class="esd-block-text product-old-price"
|
|
311
|
-
esd-extension-block-id="${g.OLD_PRICE}"${
|
|
312
|
-
<p contenteditable="false"${b(
|
|
311
|
+
esd-extension-block-id="${g.OLD_PRICE}"${a}${b(n.tdStyle)}>
|
|
312
|
+
<p contenteditable="false"${b(r)}><s>${k(l.oldPricePlaceholder, n)}</s></p>
|
|
313
313
|
</td>
|
|
314
314
|
`;
|
|
315
315
|
}
|
|
316
316
|
if (t === U || t === V) {
|
|
317
|
-
const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT,
|
|
317
|
+
const n = t === U, i = n ? g.OMNIBUS_PRICE : g.OMNIBUS_DISCOUNT, r = n ? "omnibus-price-value" : "omnibus-discount-value", a = n ? l.omnibusPricePlaceholder : "-10%", d = n ? "product-omnibus-price" : "product-omnibus-discount", p = s ?? _(), u = $("font-size: 12px; color: #666666; margin: 0", p.pStyle), m = y(p.align ?? "left");
|
|
318
318
|
return `
|
|
319
319
|
<td class="esd-block-text ${d}"
|
|
320
320
|
data-text-before="" data-text-after=""
|
|
321
321
|
esd-extension-block-id="${i}"${m}${b(p.tdStyle)}>
|
|
322
322
|
<p contenteditable="false"${b(u)}>
|
|
323
323
|
<span class="omnibus-text-before"></span>
|
|
324
|
-
<span class="${
|
|
324
|
+
<span class="${r}">${c(a)}</span>
|
|
325
325
|
<span class="omnibus-text-after"></span>
|
|
326
326
|
</p>
|
|
327
327
|
</td>
|
|
328
328
|
`;
|
|
329
329
|
}
|
|
330
330
|
if (t.startsWith(E)) {
|
|
331
|
-
const n = s ?? _(), i = e[t] ?? t.slice(E.length),
|
|
331
|
+
const n = s ?? _(), i = e[t] ?? t.slice(E.length), a = t.slice(E.length).replace(/_/g, " ").replace(/\b\w/g, (m) => m.toUpperCase()), d = $("font-size: 12px; color: #666666; margin: 0", n.pStyle), p = y(n.align ?? "left"), u = g.CUSTOM_ATTRIBUTE;
|
|
332
332
|
return `
|
|
333
333
|
<td product-attr="${c(i)}"
|
|
334
334
|
class="esd-block-text product-custom-attribute"
|
|
335
335
|
esd-extension-block-id="${u}"${p}${b(n.tdStyle)}>
|
|
336
|
-
<p contenteditable="false"${b(d)}>${c(
|
|
336
|
+
<p contenteditable="false"${b(d)}>${c(a)}</p>
|
|
337
337
|
</td>
|
|
338
338
|
`;
|
|
339
339
|
}
|
|
340
340
|
return null;
|
|
341
341
|
}
|
|
342
342
|
function bt(t, o) {
|
|
343
|
-
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o,
|
|
343
|
+
const { composition: e, visibility: l, perElement: s, customAttrValues: n, cardBg: i } = o, r = i ? `background-color: ${c(i)}` : "", a = r ? `style="table-layout: fixed; ${r}"` : 'style="table-layout: fixed"', d = s[I] ?? {}, p = l[I] !== !1, u = d.width ? ` width="${d.width}"` : "", m = p ? "" : ' style="display: none"', h = `
|
|
344
344
|
<td width="120"
|
|
345
345
|
class="esd-block-image product-image-cell recommendation-attribute-row es-p5"
|
|
346
346
|
esd-extension-block-id="${g.IMAGE}"
|
|
@@ -384,7 +384,7 @@ function bt(t, o) {
|
|
|
384
384
|
<tr class="recommendation-product-row">
|
|
385
385
|
<td style="padding: 0 5px">
|
|
386
386
|
<table width="100%" cellpadding="0" cellspacing="0" border="0"
|
|
387
|
-
class="product-card-wrapper" ${
|
|
387
|
+
class="product-card-wrapper" ${a}>
|
|
388
388
|
<tbody>
|
|
389
389
|
<tr>${h}${w}${W}</tr>
|
|
390
390
|
</tbody>
|
|
@@ -400,13 +400,13 @@ function gt(t, o) {
|
|
|
400
400
|
return e.join("");
|
|
401
401
|
}
|
|
402
402
|
function mt(t, o) {
|
|
403
|
-
var
|
|
403
|
+
var a, d, p, u, m, h;
|
|
404
404
|
const e = t == null ? void 0 : t.theme, l = [];
|
|
405
|
-
(
|
|
406
|
-
const s = l.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o),
|
|
405
|
+
(a = e == null ? void 0 : e.textStyle) != null && a["font-family"] && l.push(`font-family: ${e.textStyle["font-family"]}`), l.push(`font-size: ${((d = e == null ? void 0 : e.textStyle) == null ? void 0 : d["font-size"]) ?? "28px"}`), l.push(`color: ${((p = e == null ? void 0 : e.textColor) == null ? void 0 : p.color) ?? "#333333"}`), (u = e == null ? void 0 : e.textStyle) != null && u["font-weight"] && l.push(`font-weight: ${e.textStyle["font-weight"]}`), (m = e == null ? void 0 : e.textStyle) != null && m["font-style"] && l.push(`font-style: ${e.textStyle["font-style"]}`);
|
|
406
|
+
const s = l.join("; "), n = ((h = e == null ? void 0 : e.textStyle) == null ? void 0 : h["font-weight"]) !== "normal", i = c(o), r = n ? `<strong>${i}</strong>` : i;
|
|
407
407
|
return `
|
|
408
408
|
<td class="esd-block-text es-p10t es-p10b es-p20l es-p20r" align="center">
|
|
409
|
-
<p${b(s)}>${
|
|
409
|
+
<p${b(s)}>${r}</p>
|
|
410
410
|
</td>
|
|
411
411
|
`;
|
|
412
412
|
}
|
|
@@ -422,15 +422,15 @@ function Tt(t) {
|
|
|
422
422
|
titleText: s,
|
|
423
423
|
extraClasses: n = "",
|
|
424
424
|
legacyId: i,
|
|
425
|
-
legacyBgColor:
|
|
426
|
-
} = t,
|
|
425
|
+
legacyBgColor: r
|
|
426
|
+
} = t, a = parseInt(o.size) || 6, d = o.layout === "list" ? ' data-layout="list"' : "", p = o.layout === "list" ? " es-m-p0 ins-recommendation-list-layout" : "", u = {
|
|
427
427
|
composition: e.composition,
|
|
428
428
|
visibility: e.visibility,
|
|
429
429
|
perElement: e.perElementStyles,
|
|
430
430
|
customAttrValues: e.customAttrValues,
|
|
431
431
|
cardBg: l,
|
|
432
|
-
...
|
|
433
|
-
}, m = o.layout === "list" ? gt(
|
|
432
|
+
...at(o.currency)
|
|
433
|
+
}, m = o.layout === "list" ? gt(a, u) : pt(a, o.cardsInRow, u), h = mt(e.titleVariable, s), T = e.composition.join(","), w = JSON.stringify(e.customAttributes), f = [
|
|
434
434
|
"recommendation-block-v2",
|
|
435
435
|
"esd-block-recommendation-v3-block",
|
|
436
436
|
`es-p20${p}`,
|
|
@@ -443,7 +443,7 @@ function Tt(t) {
|
|
|
443
443
|
"esd-container-frame",
|
|
444
444
|
"ins-recommendation-no-mobile-layout",
|
|
445
445
|
n
|
|
446
|
-
].filter(Boolean).join(" "), C = $t(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A =
|
|
446
|
+
].filter(Boolean).join(" "), C = $t(o.currency), S = ` esd-ext-config="${c(JSON.stringify(o))}"`, x = i ? ` id="${c(i)}"` : "", A = r ? ` bgcolor="${c(r)}"` : "";
|
|
447
447
|
return nt(`
|
|
448
448
|
<td align="left"
|
|
449
449
|
esd-extension-block-id="recommendation-block"
|
|
@@ -455,7 +455,8 @@ function Tt(t) {
|
|
|
455
455
|
data-column-spacing="${o.columnSpacing}"
|
|
456
456
|
data-row-spacing="${o.rowSpacing}"
|
|
457
457
|
data-mobile-column-spacing="${o.mobileColumnSpacing}"
|
|
458
|
-
data-mobile-row-spacing="${o.mobileRowSpacing}"
|
|
458
|
+
data-mobile-row-spacing="${o.mobileRowSpacing}"
|
|
459
|
+
hide-price="${o.priceHideIfSameAsDiscounted}"${d}${S}>
|
|
459
460
|
<table width="100%" cellpadding="0" cellspacing="0" border="0">
|
|
460
461
|
<tbody>
|
|
461
462
|
<tr>
|