@useinsider/guido 3.6.0-beta.0e98cf4 → 3.6.0-beta.177b0b7
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/extensions/Blocks/Recommendation/controls/cardComposition/index.js +123 -127
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +12 -11
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +46 -46
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +29 -31
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +28 -28
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +49 -56
- package/dist/extensions/Blocks/Recommendation/utils/priceFormatter.js +20 -20
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -7
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +0 -8
- package/package.json +1 -1
- /package/dist/src/extensions/Blocks/Recommendation/{templates/utils.test.d.ts → utils/priceFormatter.test.d.ts} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ModificationDescription as p } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RecommendationBlockId as m } from "../../constants/blockIds.js";
|
|
3
|
-
import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as
|
|
3
|
+
import { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as v, ATTR_PRODUCT_ATTR as W } from "../../constants/selectors.js";
|
|
4
4
|
import { RecommendationConfigService as E } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
6
|
import { prepareProductRows as _ } from "../../templates/index.js";
|
|
7
|
-
import { formatPrice as
|
|
8
|
-
import { isTdNode as
|
|
9
|
-
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as
|
|
7
|
+
import { formatPrice as j } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as F } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as R, sanitizeImageUrl as V } from "../../templates/utils.js";
|
|
10
10
|
const M = "recommendation-block-v2";
|
|
11
|
-
function
|
|
11
|
+
function h(t) {
|
|
12
12
|
if (!t)
|
|
13
13
|
return null;
|
|
14
14
|
if ("getAttribute" in t) {
|
|
@@ -19,18 +19,18 @@ function R(t) {
|
|
|
19
19
|
return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
|
|
20
20
|
}
|
|
21
21
|
function b(t) {
|
|
22
|
-
const e =
|
|
22
|
+
const e = h(t);
|
|
23
23
|
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
25
|
const o = e.getAttribute("data-layout");
|
|
26
26
|
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
28
|
function x(t) {
|
|
29
|
-
const e =
|
|
29
|
+
const e = h(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
31
|
+
return R;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : R;
|
|
34
34
|
}
|
|
35
35
|
function D(t) {
|
|
36
36
|
if (!t || !("childNodes" in t))
|
|
@@ -47,14 +47,14 @@ function S(t, e, o) {
|
|
|
47
47
|
function U(t, e) {
|
|
48
48
|
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function G(t) {
|
|
51
51
|
const { currentNode: e, documentModifier: o } = t;
|
|
52
52
|
if (!e || !("querySelector" in e))
|
|
53
53
|
return;
|
|
54
54
|
const n = e.querySelector(k);
|
|
55
55
|
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function Y(t) {
|
|
58
58
|
const {
|
|
59
59
|
currentNode: e,
|
|
60
60
|
documentModifier: o,
|
|
@@ -66,7 +66,7 @@ function K(t) {
|
|
|
66
66
|
return;
|
|
67
67
|
const r = i ?? b(e), s = E.getConfig(e);
|
|
68
68
|
if (r === "list" || !s.mobileLayoutEnabled) {
|
|
69
|
-
|
|
69
|
+
G({ currentNode: e, documentModifier: o });
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
const u = e.querySelector(k);
|
|
@@ -79,7 +79,7 @@ function K(t) {
|
|
|
79
79
|
})}</table></td>`;
|
|
80
80
|
o.modifyHtml(u).setInnerHtml(g), o.apply(new p("Updated mobile product rows"));
|
|
81
81
|
}
|
|
82
|
-
function
|
|
82
|
+
function K(t) {
|
|
83
83
|
const {
|
|
84
84
|
currentNode: e,
|
|
85
85
|
documentModifier: o,
|
|
@@ -98,7 +98,7 @@ function X(t) {
|
|
|
98
98
|
composition: a,
|
|
99
99
|
filterList: u.filterList
|
|
100
100
|
});
|
|
101
|
-
o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")),
|
|
101
|
+
o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), Y(t), n == null || n();
|
|
102
102
|
}
|
|
103
103
|
function T(t, e, o, n) {
|
|
104
104
|
const c = `0 ${Math.floor(o / 2)}px`;
|
|
@@ -111,7 +111,7 @@ function T(t, e, o, n) {
|
|
|
111
111
|
t.querySelectorAll(".product-card-wrapper")
|
|
112
112
|
).forEach((u) => {
|
|
113
113
|
const l = "parentNode" in u ? u.parentNode : null;
|
|
114
|
-
l &&
|
|
114
|
+
l && F(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
|
|
115
115
|
}), r;
|
|
116
116
|
}
|
|
117
117
|
function I(t, e, o) {
|
|
@@ -121,7 +121,7 @@ function I(t, e, o) {
|
|
|
121
121
|
e.modifyHtml(r).setStyle("height", n), c = !0;
|
|
122
122
|
}), c;
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function X(t) {
|
|
125
125
|
const { currentNode: e, documentModifier: o } = t;
|
|
126
126
|
if (!e)
|
|
127
127
|
return;
|
|
@@ -160,9 +160,9 @@ function z(t) {
|
|
|
160
160
|
}
|
|
161
161
|
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function se(t) {
|
|
164
164
|
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
|
|
165
|
-
e &&
|
|
165
|
+
e && K({
|
|
166
166
|
currentNode: e,
|
|
167
167
|
documentModifier: o,
|
|
168
168
|
products: i,
|
|
@@ -170,12 +170,12 @@ function ae(t) {
|
|
|
170
170
|
composition: r,
|
|
171
171
|
afterRegenerate: () => {
|
|
172
172
|
setTimeout(() => {
|
|
173
|
-
|
|
173
|
+
X({ currentNode: e, documentModifier: o });
|
|
174
174
|
}, 0), n == null || n();
|
|
175
175
|
}
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
|
-
function
|
|
178
|
+
function ae(t, e) {
|
|
179
179
|
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
180
180
|
}
|
|
181
181
|
function H() {
|
|
@@ -191,12 +191,12 @@ function H() {
|
|
|
191
191
|
}
|
|
192
192
|
function A(t, e = "price") {
|
|
193
193
|
const o = H(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
194
|
-
return
|
|
194
|
+
return j({
|
|
195
195
|
price: i,
|
|
196
196
|
currency: o
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
-
function
|
|
199
|
+
function z(t) {
|
|
200
200
|
var c, r;
|
|
201
201
|
const e = H(), o = ((c = t.original_price) == null ? void 0 : c[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((r = t.price) == null ? void 0 : r[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, i = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
202
202
|
return i > 0 ? `-${i}%` : "0%";
|
|
@@ -217,12 +217,12 @@ function $(t) {
|
|
|
217
217
|
S(e, u, l) && (s = !0);
|
|
218
218
|
}
|
|
219
219
|
if (r && "querySelector" in r) {
|
|
220
|
-
const u = r.querySelector(".omnibus-discount-value") ?? null, l =
|
|
220
|
+
const u = r.querySelector(".omnibus-discount-value") ?? null, l = z(o);
|
|
221
221
|
S(e, u, l) && (s = !0);
|
|
222
222
|
}
|
|
223
223
|
return s;
|
|
224
224
|
}
|
|
225
|
-
function
|
|
225
|
+
function J(t) {
|
|
226
226
|
const {
|
|
227
227
|
documentModifier: e,
|
|
228
228
|
product: o,
|
|
@@ -237,7 +237,7 @@ function Q(t) {
|
|
|
237
237
|
let d = !1;
|
|
238
238
|
if (n && "querySelector" in n) {
|
|
239
239
|
const a = n.querySelector("img");
|
|
240
|
-
a && (e.modifyHtml(a).setAttribute("src",
|
|
240
|
+
a && (e.modifyHtml(a).setAttribute("src", V(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
241
241
|
const f = n.querySelector("a");
|
|
242
242
|
f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
|
|
243
243
|
}
|
|
@@ -262,7 +262,7 @@ function B(t) {
|
|
|
262
262
|
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
263
263
|
}
|
|
264
264
|
const O = "product_attribute.";
|
|
265
|
-
function
|
|
265
|
+
function Q(t, e) {
|
|
266
266
|
var n;
|
|
267
267
|
let o;
|
|
268
268
|
if (t.startsWith(O)) {
|
|
@@ -270,9 +270,9 @@ function Z(t, e) {
|
|
|
270
270
|
o = (n = e.product_attributes) == null ? void 0 : n[i];
|
|
271
271
|
} else
|
|
272
272
|
o = e[t];
|
|
273
|
-
return
|
|
273
|
+
return typeof o == "string" && o.length > 0 ? o : typeof o == "number" ? String(o) : null;
|
|
274
274
|
}
|
|
275
|
-
function
|
|
275
|
+
function Z(t, e, o) {
|
|
276
276
|
if (!("querySelectorAll" in t))
|
|
277
277
|
return !1;
|
|
278
278
|
const n = t.querySelectorAll(
|
|
@@ -284,7 +284,7 @@ function ee(t, e, o) {
|
|
|
284
284
|
n.forEach((r) => {
|
|
285
285
|
if (!("getAttribute" in r))
|
|
286
286
|
return;
|
|
287
|
-
const s = r.getAttribute(
|
|
287
|
+
const s = r.getAttribute(W);
|
|
288
288
|
if (!s)
|
|
289
289
|
return;
|
|
290
290
|
const u = i.get(s) ?? [];
|
|
@@ -296,7 +296,7 @@ function ee(t, e, o) {
|
|
|
296
296
|
r.slice(0, u).forEach((l, d) => {
|
|
297
297
|
if (!("querySelector" in l))
|
|
298
298
|
return;
|
|
299
|
-
const a =
|
|
299
|
+
const a = Q(s, o[d]);
|
|
300
300
|
if (a === null)
|
|
301
301
|
return;
|
|
302
302
|
const f = l.querySelector("p") ?? null;
|
|
@@ -324,7 +324,7 @@ function w(t, e, o) {
|
|
|
324
324
|
), d = Math.min(n.length, o.length);
|
|
325
325
|
let a = !1;
|
|
326
326
|
for (let f = 0; f < d; f++) {
|
|
327
|
-
const g =
|
|
327
|
+
const g = J({
|
|
328
328
|
documentModifier: e,
|
|
329
329
|
product: o[f],
|
|
330
330
|
imageEl: n[f] ?? null,
|
|
@@ -337,9 +337,9 @@ function w(t, e, o) {
|
|
|
337
337
|
});
|
|
338
338
|
a = a || g;
|
|
339
339
|
}
|
|
340
|
-
return
|
|
340
|
+
return Z(t, e, o) && (a = !0), a;
|
|
341
341
|
}
|
|
342
|
-
function
|
|
342
|
+
function de(t) {
|
|
343
343
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
344
344
|
if (!e || !("querySelectorAll" in e))
|
|
345
345
|
return !1;
|
|
@@ -387,7 +387,7 @@ function N(t, e, o) {
|
|
|
387
387
|
}) && (u = !0);
|
|
388
388
|
return u;
|
|
389
389
|
}
|
|
390
|
-
function
|
|
390
|
+
function fe(t) {
|
|
391
391
|
const { currentNode: e, documentModifier: o } = t;
|
|
392
392
|
if (!e || !("querySelectorAll" in e))
|
|
393
393
|
return !1;
|
|
@@ -406,8 +406,8 @@ function me(t) {
|
|
|
406
406
|
}
|
|
407
407
|
return r && o.apply(new p("Updated price formatting in-place")), r;
|
|
408
408
|
}
|
|
409
|
-
function
|
|
410
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, i =
|
|
409
|
+
function me(t) {
|
|
410
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, i = h(e);
|
|
411
411
|
if (!i)
|
|
412
412
|
return;
|
|
413
413
|
const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
|
|
@@ -416,17 +416,17 @@ function pe(t) {
|
|
|
416
416
|
r(y.CURRENCY, n.code), r(y.SYMBOL, n.symbol), r(y.ALIGNMENT, c), r(y.THOUSAND_SEPARATOR, n.thousandSeparator), r(y.DECIMAL_SEPARATOR, n.decimalSeparator), r(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
417
417
|
}
|
|
418
418
|
export {
|
|
419
|
-
|
|
419
|
+
ae as adjustProductsToSize,
|
|
420
420
|
A as formatProductPrice,
|
|
421
|
-
|
|
421
|
+
h as getBlockElement,
|
|
422
422
|
x as getCardComposition,
|
|
423
423
|
b as getCurrentLayout,
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
424
|
+
X as reapplySpacing,
|
|
425
|
+
Y as regenerateMobileProductRows,
|
|
426
|
+
K as regenerateProductRows,
|
|
427
|
+
se as regenerateProductRowsWithStyles,
|
|
428
|
+
me as setCurrencyAttributes,
|
|
429
|
+
fe as updatePricesInPlace,
|
|
430
|
+
de as updateProductContentInPlace,
|
|
431
|
+
J as updateSingleProductContent
|
|
432
432
|
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import { RecommendationBlockId as
|
|
2
|
-
import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as
|
|
3
|
-
import { useRecommendationExtensionStore as
|
|
1
|
+
import { RecommendationBlockId as s } from "../../constants/blockIds.js";
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as u, CSS_CLASS_RECO_BUTTON as p, ATTR_PRODUCT_BUTTON as m, ATTR_PRODUCT_OMNIBUS_DISCOUNT as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OLD_PRICE as T, ATTR_PRODUCT_PRICE as f, ATTR_PRODUCT_NAME as x, ATTR_PRODUCT_IMAGE as _ } from "../../constants/selectors.js";
|
|
3
|
+
import { useRecommendationExtensionStore as $ } from "../../store/recommendation.js";
|
|
4
4
|
import { formatPrice as C } from "../../utils/priceFormatter.js";
|
|
5
5
|
import { CUSTOM_CELL_HTML as R, sanitizeImageUrl as O } from "../utils.js";
|
|
6
|
-
const
|
|
7
|
-
function S(t, e = s) {
|
|
8
|
-
return `<td class="${a}" style="padding: ${e};" width="${t}%"></td>`;
|
|
9
|
-
}
|
|
6
|
+
const a = "0 5px", l = "attribute-cell";
|
|
10
7
|
function g() {
|
|
11
|
-
const t =
|
|
8
|
+
const t = $(), { currencySettings: e } = t.recommendationConfigs;
|
|
12
9
|
return {
|
|
13
10
|
code: e.value,
|
|
14
11
|
symbol: e.symbol,
|
|
@@ -25,9 +22,9 @@ function i(t, e = "price") {
|
|
|
25
22
|
currency: o
|
|
26
23
|
});
|
|
27
24
|
}
|
|
28
|
-
const
|
|
25
|
+
const S = {
|
|
29
26
|
[_]: (t) => `
|
|
30
|
-
<td class="${
|
|
27
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
31
28
|
<table
|
|
32
29
|
class="product-card-segment"
|
|
33
30
|
width="100%"
|
|
@@ -40,7 +37,7 @@ const A = {
|
|
|
40
37
|
<td
|
|
41
38
|
class="esd-block-image product-image"
|
|
42
39
|
align="center"
|
|
43
|
-
esd-extension-block-id="${
|
|
40
|
+
esd-extension-block-id="${s.IMAGE}">
|
|
44
41
|
<a target="_blank" href="${t.url}" class="${p}">
|
|
45
42
|
<img
|
|
46
43
|
src="${O(t.image_url)}"
|
|
@@ -54,8 +51,8 @@ const A = {
|
|
|
54
51
|
</table>
|
|
55
52
|
</td>
|
|
56
53
|
`,
|
|
57
|
-
[
|
|
58
|
-
<td class="${
|
|
54
|
+
[x]: (t) => `
|
|
55
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
59
56
|
<table
|
|
60
57
|
class="product-card-segment"
|
|
61
58
|
width="100%"
|
|
@@ -69,7 +66,7 @@ const A = {
|
|
|
69
66
|
<td
|
|
70
67
|
class="esd-block-text product-name es-p10t es-p10b es-p15l es-p15r"
|
|
71
68
|
align="center"
|
|
72
|
-
esd-extension-block-id="${
|
|
69
|
+
esd-extension-block-id="${s.NAME}">
|
|
73
70
|
<p contenteditable="false" style="font-size: 16px; color: #333333;">
|
|
74
71
|
<strong>${t.name}</strong>
|
|
75
72
|
</p>
|
|
@@ -80,7 +77,7 @@ const A = {
|
|
|
80
77
|
</td>
|
|
81
78
|
`,
|
|
82
79
|
[f]: (t) => `
|
|
83
|
-
<td class="${
|
|
80
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
84
81
|
<table
|
|
85
82
|
class="product-card-segment"
|
|
86
83
|
width="100%"
|
|
@@ -93,7 +90,7 @@ const A = {
|
|
|
93
90
|
<td
|
|
94
91
|
class="esd-block-text product-price es-p15l es-p15r"
|
|
95
92
|
align="center"
|
|
96
|
-
esd-extension-block-id="${
|
|
93
|
+
esd-extension-block-id="${s.PRICE}">
|
|
97
94
|
<p contenteditable="false" style="font-size: 16px; color: #333333;">
|
|
98
95
|
<strong>${i(t, "price")}</strong>
|
|
99
96
|
</p>
|
|
@@ -104,7 +101,7 @@ const A = {
|
|
|
104
101
|
</td>
|
|
105
102
|
`,
|
|
106
103
|
[T]: (t) => `
|
|
107
|
-
<td class="${
|
|
104
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
108
105
|
<table
|
|
109
106
|
class="product-card-segment"
|
|
110
107
|
width="100%"
|
|
@@ -117,8 +114,10 @@ const A = {
|
|
|
117
114
|
<td
|
|
118
115
|
class="esd-block-text product-old-price es-p15l es-p15r"
|
|
119
116
|
align="center"
|
|
120
|
-
esd-extension-block-id="${
|
|
121
|
-
<p
|
|
117
|
+
esd-extension-block-id="${s.OLD_PRICE}">
|
|
118
|
+
<p
|
|
119
|
+
contenteditable="false"
|
|
120
|
+
style="font-size: 14px; color: #999999; text-decoration: line-through;">
|
|
122
121
|
<strong>${i(t, "original_price")}</strong>
|
|
123
122
|
</p>
|
|
124
123
|
</td>
|
|
@@ -128,7 +127,7 @@ const A = {
|
|
|
128
127
|
</td>
|
|
129
128
|
`,
|
|
130
129
|
[y]: (t) => `
|
|
131
|
-
<td class="${
|
|
130
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
132
131
|
<table
|
|
133
132
|
class="product-card-segment"
|
|
134
133
|
width="100%"
|
|
@@ -143,7 +142,7 @@ const A = {
|
|
|
143
142
|
align="center"
|
|
144
143
|
data-text-before="Lowest 30-day price: "
|
|
145
144
|
data-text-after=""
|
|
146
|
-
esd-extension-block-id="${
|
|
145
|
+
esd-extension-block-id="${s.OMNIBUS_PRICE}">
|
|
147
146
|
<p contenteditable="false" style="font-size: 12px; color: #666666;">
|
|
148
147
|
<span class="omnibus-text-before">Lowest 30-day price: </span>
|
|
149
148
|
<span class="omnibus-price-value">${i(t, "original_price")}</span>
|
|
@@ -159,7 +158,7 @@ const A = {
|
|
|
159
158
|
var r, c;
|
|
160
159
|
const e = g(), o = ((r = t.original_price) == null ? void 0 : r[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((c = t.price) == null ? void 0 : c[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, d = o > 0 ? Math.round((o - n) / o * 100) : 0, b = d > 0 ? `-${d}%` : "0%";
|
|
161
160
|
return `
|
|
162
|
-
<td class="${
|
|
161
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
163
162
|
<table
|
|
164
163
|
class="product-card-segment"
|
|
165
164
|
width="100%"
|
|
@@ -174,7 +173,7 @@ const A = {
|
|
|
174
173
|
align="center"
|
|
175
174
|
data-text-before=""
|
|
176
175
|
data-text-after=""
|
|
177
|
-
esd-extension-block-id="${
|
|
176
|
+
esd-extension-block-id="${s.OMNIBUS_DISCOUNT}">
|
|
178
177
|
<p contenteditable="false" style="font-size: 12px; color: #666666;">
|
|
179
178
|
<span class="omnibus-text-before"></span>
|
|
180
179
|
<span class="omnibus-discount-value">${b}</span>
|
|
@@ -188,7 +187,7 @@ const A = {
|
|
|
188
187
|
`;
|
|
189
188
|
},
|
|
190
189
|
[m]: () => `
|
|
191
|
-
<td class="${
|
|
190
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="top">
|
|
192
191
|
<table
|
|
193
192
|
class="product-card-segment"
|
|
194
193
|
width="100%"
|
|
@@ -201,7 +200,7 @@ const A = {
|
|
|
201
200
|
<td
|
|
202
201
|
class="esd-block-button product-button es-p10t es-p10b"
|
|
203
202
|
align="center"
|
|
204
|
-
esd-extension-block-id="${
|
|
203
|
+
esd-extension-block-id="${s.BUTTON}">
|
|
205
204
|
<span
|
|
206
205
|
class="es-button-border"
|
|
207
206
|
style="
|
|
@@ -240,7 +239,7 @@ const A = {
|
|
|
240
239
|
* @param content - Display content for the cell
|
|
241
240
|
*/
|
|
242
241
|
[R]: (t, e) => `
|
|
243
|
-
<td class="${
|
|
242
|
+
<td class="${l}" style="padding: ${a}; height: 100%;" valign="middle">
|
|
244
243
|
<table
|
|
245
244
|
class="product-card-segment"
|
|
246
245
|
width="100%"
|
|
@@ -255,7 +254,7 @@ const A = {
|
|
|
255
254
|
${u}="${t}"
|
|
256
255
|
class="esd-block-text product-custom-attribute es-p0t es-p0b es-p15l es-p15r"
|
|
257
256
|
align="center"
|
|
258
|
-
esd-extension-block-id="${
|
|
257
|
+
esd-extension-block-id="${s.CUSTOM_ATTRIBUTE}">
|
|
259
258
|
<p contenteditable="false" style="font-size: 12px; color: #666666;">${e}</p>
|
|
260
259
|
</td>
|
|
261
260
|
</tr>
|
|
@@ -265,8 +264,7 @@ const A = {
|
|
|
265
264
|
`
|
|
266
265
|
};
|
|
267
266
|
export {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
S as
|
|
271
|
-
A as gridElementRenderer
|
|
267
|
+
l as ATTRIBUTE_CELL_CLASS,
|
|
268
|
+
a as DEFAULT_CELL_PADDING,
|
|
269
|
+
S as gridElementRenderer
|
|
272
270
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DEFAULT_PRODUCTS_PER_ROW as
|
|
2
|
-
import { getDefaultProducts as
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
1
|
+
import { DEFAULT_PRODUCTS_PER_ROW as L } from "../../constants/layout.js";
|
|
2
|
+
import { getDefaultProducts as E, DEFAULTS as I, createBlockTemplate as _, DEFAULT_CARD_COMPOSITION as S, spacer as b, buildElementRenderer as A, DEFAULT_CARD_VISIBILITY as f } from "../utils.js";
|
|
3
|
+
import { ATTRIBUTE_CELL_CLASS as w, DEFAULT_CELL_PADDING as D, gridElementRenderer as C } from "./elementRenderer.js";
|
|
4
|
+
const O = `
|
|
5
5
|
<tr class="recommendation-product-row">
|
|
6
6
|
<td>
|
|
7
7
|
<table
|
|
@@ -18,7 +18,7 @@ const D = `
|
|
|
18
18
|
</table>
|
|
19
19
|
</td>
|
|
20
20
|
</tr>
|
|
21
|
-
`,
|
|
21
|
+
`, g = `
|
|
22
22
|
<tr
|
|
23
23
|
class="recommendation-attribute-row"
|
|
24
24
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -27,38 +27,38 @@ const D = `
|
|
|
27
27
|
{-{-CELLS-}-}
|
|
28
28
|
</tr>
|
|
29
29
|
`;
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
return r.filter((
|
|
33
|
-
const
|
|
34
|
-
return
|
|
30
|
+
function P(t, e, o, r = S, n = {}) {
|
|
31
|
+
const c = (100 / e).toFixed(2), i = e - t.length, l = `<td class="${w}" style="padding: ${D};" width="${c}%"></td>`, d = i > 0 ? l.repeat(i) : "", a = A(o, r, n);
|
|
32
|
+
return r.filter((s) => a[s]).map((s) => {
|
|
33
|
+
const T = f[s] ?? !0, u = T ? "" : 'style="display: none;"', R = t.map((m) => a[s](m).replace("<td", `<td width="${c}%"`)).join("");
|
|
34
|
+
return g.replace("{-{-ATTR_TYPE-}-}", s).replace("{-{-VISIBILITY-}-}", T ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", u).replace("{-{-CELLS-}-}", R + d);
|
|
35
35
|
}).join("");
|
|
36
36
|
}
|
|
37
|
-
function
|
|
38
|
-
const
|
|
37
|
+
function U(t, e, o, r, n = {}) {
|
|
38
|
+
const c = [];
|
|
39
39
|
for (let l = 0; l < t.length; l += e)
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
const
|
|
40
|
+
c.push(t.slice(l, l + e));
|
|
41
|
+
return c.map((l, d) => {
|
|
42
|
+
const a = P(
|
|
43
43
|
l,
|
|
44
44
|
e,
|
|
45
|
-
|
|
45
|
+
o,
|
|
46
46
|
r,
|
|
47
|
-
|
|
48
|
-
),
|
|
49
|
-
return
|
|
47
|
+
n
|
|
48
|
+
), p = O.replace("{-{-ATTRIBUTE_ROWS-}-}", a);
|
|
49
|
+
return d > 0 ? b + p : p;
|
|
50
50
|
}).join("");
|
|
51
51
|
}
|
|
52
|
-
function
|
|
53
|
-
return
|
|
52
|
+
function h(t, e, o, r = {}) {
|
|
53
|
+
return U(t, e, C, o, r);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
56
|
-
const e = t ? `ins-recommendation-v3-block-${t}` : void 0,
|
|
57
|
-
return
|
|
55
|
+
function F(t) {
|
|
56
|
+
const e = t ? `ins-recommendation-v3-block-${t}` : void 0, o = _("grid", e), r = E(), n = h(r, L);
|
|
57
|
+
return o.replace("{-{-TITLE-}-}", I.TITLE).replace("{-{-PRODUCT_ROWS-}-}", n).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
58
58
|
}
|
|
59
59
|
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
F as getDefaultTemplate,
|
|
61
|
+
P as prepareGridAttributeRows,
|
|
62
|
+
U as prepareGridProductRows,
|
|
63
|
+
h as prepareProductRows
|
|
64
64
|
};
|