@useinsider/guido 3.30.0-beta.1360af2 → 3.30.0-beta.16d665a
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/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +16 -11
- package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue.js +11 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +51 -51
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
- package/dist/composables/useExport.js +7 -8
- package/dist/composables/useHtmlValidator.js +100 -102
- package/dist/composables/useToaster.js +10 -11
- package/dist/composables/useVersionHistoryApi.js +21 -22
- package/dist/composables/validators/useLiquidValidator.js +24 -26
- package/dist/config/migrator/itemsBlockMigrator.js +164 -161
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +141 -148
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +53 -53
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +39 -40
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +26 -27
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +32 -33
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -23
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +78 -79
- package/dist/extensions/Blocks/Recommendation/utils/compositionKeys.js +41 -50
- package/dist/guido.css +1 -1
- package/dist/package.json.js +1 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/compositionKeys.d.ts +0 -2
- package/dist/src/stores/preview.d.ts +0 -3
- package/dist/stores/preview.js +15 -21
- package/dist/utils/pairProductVariables.js +98 -108
- package/package.json +1 -1
- package/dist/src/utils/ampPreviewSanitizer.d.ts +0 -5
- package/dist/utils/ampPreviewSanitizer.js +0 -46
|
@@ -5,9 +5,9 @@ import { RecommendationConfigService as g } from "../../services/configService.j
|
|
|
5
5
|
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
6
6
|
import { prepareProductRows as D } from "../../templates/index.js";
|
|
7
7
|
import { captureStyles as H } from "../../utils/captureStyleTemplates.js";
|
|
8
|
-
import { normalizeCompositionKeys as U,
|
|
9
|
-
import { formatPrice as
|
|
10
|
-
import { getDefaultProducts as B, DEFAULT_CARD_COMPOSITION as O, sanitizeImageUrl as
|
|
8
|
+
import { normalizeCompositionKeys as U, normalizeCustomAttrValues as X } from "../../utils/compositionKeys.js";
|
|
9
|
+
import { formatPrice as Q } from "../../utils/priceFormatter.js";
|
|
10
|
+
import { getDefaultProducts as B, DEFAULT_CARD_COMPOSITION as O, sanitizeImageUrl as Z, isSamePrice as ee, toDisplayableAttributeValue as te } from "../../templates/utils.js";
|
|
11
11
|
const L = "recommendation-block-v2";
|
|
12
12
|
function P(e) {
|
|
13
13
|
if (!e)
|
|
@@ -19,7 +19,7 @@ function P(e) {
|
|
|
19
19
|
}
|
|
20
20
|
return "querySelector" in e ? e.querySelector(`.${L}`) ?? null : null;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function ne(e) {
|
|
23
23
|
const t = P(e);
|
|
24
24
|
return !t || !("getAttribute" in t) ? !1 : (t.getAttribute("class") ?? "").split(/\s+/).includes(Y);
|
|
25
25
|
}
|
|
@@ -36,7 +36,7 @@ function $(e, t = {}) {
|
|
|
36
36
|
return O;
|
|
37
37
|
const o = n.getAttribute(q);
|
|
38
38
|
return o ? U(
|
|
39
|
-
|
|
39
|
+
o.split(",").filter(Boolean),
|
|
40
40
|
n,
|
|
41
41
|
t
|
|
42
42
|
) : O;
|
|
@@ -59,32 +59,32 @@ function A(e, t, n, o) {
|
|
|
59
59
|
function j(e, t) {
|
|
60
60
|
return e && e.length > 0 ? e : t.length > 0 ? t : B();
|
|
61
61
|
}
|
|
62
|
-
function
|
|
62
|
+
function F(e) {
|
|
63
63
|
if (typeof e == "number")
|
|
64
64
|
return `0 ${e / 2}px`;
|
|
65
65
|
}
|
|
66
|
-
function
|
|
66
|
+
function oe(e) {
|
|
67
67
|
const { currentNode: t, documentModifier: n } = e;
|
|
68
68
|
if (!t || !("querySelector" in t))
|
|
69
69
|
return !1;
|
|
70
70
|
const o = t.querySelector(x);
|
|
71
71
|
return o ? (n.modifyHtml(o).setInnerHtml(""), !0) : !1;
|
|
72
72
|
}
|
|
73
|
-
function
|
|
73
|
+
function re(e) {
|
|
74
74
|
return "getOuterHTML" in e && typeof e.getOuterHTML == "function" ? e.getOuterHTML() : "";
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function ie(e) {
|
|
77
77
|
const t = e.querySelector(".container");
|
|
78
78
|
return !t || !("childNodes" in t) ? null : t.childNodes().find((o) => "getTagName" in o && o.getTagName() === "tbody") ?? t.querySelector("tbody") ?? null;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
const o =
|
|
80
|
+
function le(e, t, n) {
|
|
81
|
+
const o = ie(e);
|
|
82
82
|
if (!o || !("childNodes" in o))
|
|
83
83
|
return;
|
|
84
|
-
const r = o.childNodes().map(
|
|
84
|
+
const r = o.childNodes().map(re).join(""), s = `<tr class="ins-recommendation-mobile-row">${n}</tr>`;
|
|
85
85
|
t.modifyHtml(o).setInnerHtml(r + s), t.apply(new C("Added mobile product row"));
|
|
86
86
|
}
|
|
87
|
-
function
|
|
87
|
+
function K(e, t = {}) {
|
|
88
88
|
const {
|
|
89
89
|
currentNode: n,
|
|
90
90
|
documentModifier: o,
|
|
@@ -96,23 +96,23 @@ function F(e, t = {}) {
|
|
|
96
96
|
return !1;
|
|
97
97
|
const u = s ?? T(n), l = g.getConfig(n), c = e.mobileLayoutEnabled ?? l.mobileLayoutEnabled;
|
|
98
98
|
if (u === "list" || !c)
|
|
99
|
-
return
|
|
99
|
+
return oe({ currentNode: n, documentModifier: o });
|
|
100
100
|
const f = E(), a = j(r, f.recommendationProducts), d = i ?? $(n, f.filterList), y = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${D(a, u, {
|
|
101
101
|
productsPerRow: l.mobileCardsInRow,
|
|
102
102
|
composition: d,
|
|
103
103
|
filterList: f.filterList,
|
|
104
104
|
priceInline: !l.priceMovedToNextLine,
|
|
105
105
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
106
|
-
cellPadding:
|
|
106
|
+
cellPadding: F(l.mobileColumnSpacing),
|
|
107
107
|
rowSpacingPx: l.mobileRowSpacing,
|
|
108
108
|
...t
|
|
109
109
|
})}</table></td>`, h = n.querySelector(x);
|
|
110
|
-
return h ? (o.modifyHtml(h).setInnerHtml(y), !0) : (
|
|
110
|
+
return h ? (o.modifyHtml(h).setInnerHtml(y), !0) : (le(n, o, y), !1);
|
|
111
111
|
}
|
|
112
|
-
function
|
|
113
|
-
|
|
112
|
+
function Re(e) {
|
|
113
|
+
K(e, H(e.currentNode)) && e.documentModifier.apply(new C("Updated mobile product rows"));
|
|
114
114
|
}
|
|
115
|
-
function
|
|
115
|
+
function ce(e, t = {}) {
|
|
116
116
|
const {
|
|
117
117
|
currentNode: n,
|
|
118
118
|
documentModifier: o,
|
|
@@ -131,13 +131,13 @@ function ue(e, t = {}) {
|
|
|
131
131
|
filterList: l.filterList,
|
|
132
132
|
priceInline: !p.priceMovedToNextLine,
|
|
133
133
|
// Match the initial render's gutter so a regeneration never changes block height (SD-143023, #386).
|
|
134
|
-
cellPadding:
|
|
134
|
+
cellPadding: F(p.columnSpacing),
|
|
135
135
|
rowSpacingPx: p.rowSpacing,
|
|
136
136
|
...t
|
|
137
137
|
});
|
|
138
138
|
return o.modifyHtml(u).setInnerHtml(y), !0;
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function ue(e) {
|
|
141
141
|
if (!e)
|
|
142
142
|
return null;
|
|
143
143
|
try {
|
|
@@ -147,7 +147,7 @@ function se(e) {
|
|
|
147
147
|
return null;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
function
|
|
150
|
+
function se(e, t, n) {
|
|
151
151
|
const o = P(e);
|
|
152
152
|
if (n || !o || !("getAttribute" in o))
|
|
153
153
|
return !1;
|
|
@@ -156,9 +156,9 @@ function ae(e, t, n) {
|
|
|
156
156
|
return !1;
|
|
157
157
|
const s = E(), i = r.split(",").filter(Boolean), u = U(i, o, s.filterList), l = [], c = u.join(",") !== i.join(",");
|
|
158
158
|
c && l.push([q, u.join(",")]);
|
|
159
|
-
const f =
|
|
159
|
+
const f = ue(
|
|
160
160
|
o.getAttribute(M)
|
|
161
|
-
), a = f &&
|
|
161
|
+
), a = f && X(f, o, s.filterList);
|
|
162
162
|
if (f && a && a.join(",") !== f.join(",") && l.push([M, JSON.stringify(a)]), l.length === 0)
|
|
163
163
|
return !1;
|
|
164
164
|
if (l.forEach(([d, p]) => {
|
|
@@ -172,7 +172,7 @@ function ae(e, t, n) {
|
|
|
172
172
|
}
|
|
173
173
|
return !0;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
175
|
+
function qe(e) {
|
|
176
176
|
const {
|
|
177
177
|
currentNode: t,
|
|
178
178
|
documentModifier: n,
|
|
@@ -192,10 +192,10 @@ function he(e) {
|
|
|
192
192
|
layout: s,
|
|
193
193
|
composition: i
|
|
194
194
|
};
|
|
195
|
-
let a =
|
|
196
|
-
return a =
|
|
195
|
+
let a = ce(f, c);
|
|
196
|
+
return a = K(f, c) || a, a && (se(t, n, i), n.apply(new C(l ?? "Regenerate products with styles"))), o == null || o(), a;
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function he(e, t) {
|
|
199
199
|
return e.length === t ? e : e.length > t ? e.slice(0, t) : [...e, ...B(t - e.length)];
|
|
200
200
|
}
|
|
201
201
|
function V() {
|
|
@@ -211,12 +211,12 @@ function V() {
|
|
|
211
211
|
}
|
|
212
212
|
function R(e, t = "price") {
|
|
213
213
|
const n = V(), o = e[t], r = (o == null ? void 0 : o[n.code]) ?? Object.values(o ?? {})[0] ?? 0;
|
|
214
|
-
return
|
|
214
|
+
return Q({
|
|
215
215
|
price: r,
|
|
216
216
|
currency: n
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function ae(e) {
|
|
220
220
|
var s, i;
|
|
221
221
|
const t = V(), n = ((s = e.original_price) == null ? void 0 : s[t.code]) ?? Object.values(e.original_price ?? {})[0] ?? 0, o = ((i = e.price) == null ? void 0 : i[t.code]) ?? Object.values(e.price ?? {})[0] ?? 0, r = n > 0 ? Math.round((n - o) / n * 100) : 0;
|
|
222
222
|
return r > 0 ? `-${r}%` : "0%";
|
|
@@ -230,19 +230,19 @@ function G(e) {
|
|
|
230
230
|
}
|
|
231
231
|
if (r && "querySelector" in r) {
|
|
232
232
|
const l = r.querySelector("strong") ?? r.querySelector("p"), c = R(n, "original_price");
|
|
233
|
-
S(t, l ?? null, c) && (u = !0), A(t, r, "data-same-price", String(
|
|
233
|
+
S(t, l ?? null, c) && (u = !0), A(t, r, "data-same-price", String(ee(n))) && (u = !0);
|
|
234
234
|
}
|
|
235
235
|
if (s && "querySelector" in s) {
|
|
236
236
|
const l = s.querySelector(".omnibus-price-value") ?? null, c = R(n, "original_price");
|
|
237
237
|
S(t, l, c) && (u = !0);
|
|
238
238
|
}
|
|
239
239
|
if (i && "querySelector" in i) {
|
|
240
|
-
const l = i.querySelector(".omnibus-discount-value") ?? null, c =
|
|
240
|
+
const l = i.querySelector(".omnibus-discount-value") ?? null, c = ae(n);
|
|
241
241
|
S(t, l, c) && (u = !0);
|
|
242
242
|
}
|
|
243
243
|
return u;
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function fe(e) {
|
|
246
246
|
const {
|
|
247
247
|
documentModifier: t,
|
|
248
248
|
product: n,
|
|
@@ -258,7 +258,7 @@ function de(e) {
|
|
|
258
258
|
if (o && "querySelector" in o) {
|
|
259
259
|
const a = o.querySelector("img");
|
|
260
260
|
if (a) {
|
|
261
|
-
const p = A(t, a, "src",
|
|
261
|
+
const p = A(t, a, "src", Z(n.image_url)), y = A(t, a, "alt", n.name);
|
|
262
262
|
f = f || p || y;
|
|
263
263
|
}
|
|
264
264
|
const d = o.querySelector("a");
|
|
@@ -284,7 +284,7 @@ function de(e) {
|
|
|
284
284
|
function W(e) {
|
|
285
285
|
return "querySelector" in e ? e.querySelector(k) ?? e : e;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function de(e, t) {
|
|
288
288
|
var o;
|
|
289
289
|
let n;
|
|
290
290
|
if (e.startsWith(I)) {
|
|
@@ -292,9 +292,9 @@ function me(e, t) {
|
|
|
292
292
|
n = (o = t.product_attributes) == null ? void 0 : o[r];
|
|
293
293
|
} else
|
|
294
294
|
n = t[e];
|
|
295
|
-
return
|
|
295
|
+
return te(n) || null;
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function me(e, t, n) {
|
|
298
298
|
if (!("querySelectorAll" in e))
|
|
299
299
|
return !1;
|
|
300
300
|
const o = e.querySelectorAll(
|
|
@@ -318,7 +318,7 @@ function pe(e, t, n) {
|
|
|
318
318
|
i.slice(0, l).forEach((c, f) => {
|
|
319
319
|
if (!("querySelector" in c))
|
|
320
320
|
return;
|
|
321
|
-
const a =
|
|
321
|
+
const a = de(u, n[f]);
|
|
322
322
|
if (a === null)
|
|
323
323
|
return;
|
|
324
324
|
const d = c.querySelector("p") ?? null;
|
|
@@ -346,7 +346,7 @@ function _(e, t, n) {
|
|
|
346
346
|
), f = Math.min(o.length, n.length);
|
|
347
347
|
let a = !1;
|
|
348
348
|
for (let d = 0; d < f; d++) {
|
|
349
|
-
const p =
|
|
349
|
+
const p = fe({
|
|
350
350
|
documentModifier: t,
|
|
351
351
|
product: n[d],
|
|
352
352
|
imageEl: o[d] ?? null,
|
|
@@ -359,9 +359,9 @@ function _(e, t, n) {
|
|
|
359
359
|
});
|
|
360
360
|
a = a || p;
|
|
361
361
|
}
|
|
362
|
-
return
|
|
362
|
+
return me(e, t, n) && (a = !0), a;
|
|
363
363
|
}
|
|
364
|
-
function
|
|
364
|
+
function Me(e) {
|
|
365
365
|
const { currentNode: t, documentModifier: n, products: o, onApplied: r, description: s } = e;
|
|
366
366
|
if (!t || !("querySelectorAll" in t))
|
|
367
367
|
return !1;
|
|
@@ -409,11 +409,11 @@ function N(e, t, n) {
|
|
|
409
409
|
}) && (l = !0);
|
|
410
410
|
return l;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function Ie(e) {
|
|
413
413
|
const { currentNode: t, documentModifier: n } = e;
|
|
414
414
|
if (!t || !("querySelectorAll" in t))
|
|
415
415
|
return !1;
|
|
416
|
-
if (
|
|
416
|
+
if (ne(t))
|
|
417
417
|
return !0;
|
|
418
418
|
const r = E().recommendationProducts;
|
|
419
419
|
if (r.length === 0)
|
|
@@ -430,7 +430,7 @@ function Oe(e) {
|
|
|
430
430
|
}
|
|
431
431
|
return i && n.apply(new C("Updated price formatting in-place")), i;
|
|
432
432
|
}
|
|
433
|
-
function
|
|
433
|
+
function Oe(e) {
|
|
434
434
|
const { currentNode: t, documentModifier: n, currency: o } = e, r = P(t);
|
|
435
435
|
if (!r)
|
|
436
436
|
return;
|
|
@@ -440,17 +440,17 @@ function Le(e) {
|
|
|
440
440
|
i(b.CURRENCY, o.code), i(b.SYMBOL, o.symbol), i(b.ALIGNMENT, s), i(b.THOUSAND_SEPARATOR, o.thousandSeparator), i(b.DECIMAL_SEPARATOR, o.decimalSeparator), i(b.DECIMAL_COUNT, o.decimalCount.toString()), n.apply(new C("Update currency attributes"));
|
|
441
441
|
}
|
|
442
442
|
export {
|
|
443
|
-
|
|
443
|
+
he as adjustProductsToSize,
|
|
444
444
|
R as formatProductPrice,
|
|
445
445
|
P as getBlockElement,
|
|
446
446
|
$ as getCardComposition,
|
|
447
447
|
T as getCurrentLayout,
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
448
|
+
ie as getMainContainerTbody,
|
|
449
|
+
ne as isPartnerManagedBlock,
|
|
450
|
+
Re as regenerateMobileProductRows,
|
|
451
|
+
qe as regenerateProductRowsWithStyles,
|
|
452
|
+
Oe as setCurrencyAttributes,
|
|
453
|
+
Ie as updatePricesInPlace,
|
|
454
|
+
Me as updateProductContentInPlace,
|
|
455
|
+
fe as updateSingleProductContent
|
|
456
456
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { escapeHtml as h } from "../../../../../utils/htmlEscape.js";
|
|
2
1
|
import { RecommendationBlockId as t } from "../../constants/blockIds.js";
|
|
3
|
-
import { ATTR_PRODUCT_ATTR as
|
|
4
|
-
import { formatProductPrice as _, cellBgStyleAttr as T, renderStyledParagraph as
|
|
2
|
+
import { ATTR_PRODUCT_ATTR as h, ATTR_PRODUCT_BUTTON as E, CSS_CLASS_RECO_BUTTON as S, ATTR_PRODUCT_OMNIBUS_DISCOUNT as U, ATTR_PRODUCT_OMNIBUS_PRICE as v, ATTR_PRODUCT_OLD_PRICE as n, ATTR_PRODUCT_PRICE as I, ATTR_PRODUCT_NAME as L, ATTR_PRODUCT_IMAGE as D } from "../../constants/selectors.js";
|
|
3
|
+
import { formatProductPrice as _, cellBgStyleAttr as T, renderStyledParagraph as C, resolveSegmentBgStyle as N, CUSTOM_CELL_HTML as M, DEFAULT_BUTTON_BORDER_STYLE as z, DEFAULT_BUTTON_ANCHOR_STYLE as G, renderButtonLabel as F, resolveButtonBorderClass as H, resolvePStyle as s, getCurrentCurrencyConfig as O, resolveOmnibusText as P, isSamePrice as w, DEFAULT_IMG_STYLE as Y, sanitizeImageUrl as j } from "../utils.js";
|
|
5
4
|
const g = "0 5px", $ = "attribute-cell", B = {
|
|
6
5
|
pStyle: "font-size: 16px; color: #333333;",
|
|
7
6
|
openTags: "<strong>",
|
|
@@ -11,36 +10,36 @@ const g = "0 5px", $ = "attribute-cell", B = {
|
|
|
11
10
|
openTags: "<s><strong>",
|
|
12
11
|
closeTags: "</strong></s>"
|
|
13
12
|
};
|
|
14
|
-
function
|
|
13
|
+
function Q(c, e = g) {
|
|
15
14
|
return `<td class="${$}" style="padding: ${e};" width="${c}%"></td>`;
|
|
16
15
|
}
|
|
17
16
|
function b(c, e = "") {
|
|
18
|
-
const l =
|
|
17
|
+
const l = N(e, c);
|
|
19
18
|
return `<table class="product-card-segment" width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"${l ? ` style="${l}"` : ""}>`;
|
|
20
19
|
}
|
|
21
|
-
function
|
|
20
|
+
function V(c, e = !0, l, a, d) {
|
|
22
21
|
const r = _(c, "price"), u = _(c, "original_price"), A = r === u, x = (y) => `<td
|
|
23
22
|
class="esd-block-text product-price ${y}"
|
|
24
23
|
align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
|
|
25
24
|
valign="middle"
|
|
26
25
|
esd-extension-block-id="${t.PRICE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
|
|
27
|
-
${
|
|
26
|
+
${C(
|
|
28
27
|
r,
|
|
29
28
|
B,
|
|
30
29
|
l == null ? void 0 : l.styleTemplate
|
|
31
30
|
)}
|
|
32
|
-
</td>`,
|
|
31
|
+
</td>`, m = (y) => `<td
|
|
33
32
|
class="esd-block-text product-old-price ${y}"
|
|
34
33
|
align="${(a == null ? void 0 : a.cellAlignment) ?? "center"}"
|
|
35
34
|
valign="middle"
|
|
36
35
|
data-same-price="${A}"
|
|
37
36
|
esd-extension-block-id="${t.OLD_PRICE}"${T(a == null ? void 0 : a.cellBackgroundColor)}>
|
|
38
|
-
${
|
|
37
|
+
${C(
|
|
39
38
|
u,
|
|
40
39
|
f,
|
|
41
40
|
a == null ? void 0 : a.styleTemplate
|
|
42
41
|
)}
|
|
43
|
-
</td>`, k = e ?
|
|
42
|
+
</td>`, k = e ? m("es-p15l es-p5r") : x("es-p15l es-p5r"), R = e ? x("es-p5l es-p15r") : m("es-p5l es-p15r");
|
|
44
43
|
return `
|
|
45
44
|
<td class="${$}" style="padding: ${g}; height: 100%;" valign="top">
|
|
46
45
|
${b(d)}
|
|
@@ -51,7 +50,7 @@ function X(c, e = !0, l, a, d) {
|
|
|
51
50
|
<tbody>
|
|
52
51
|
<tr valign="middle">
|
|
53
52
|
${k}
|
|
54
|
-
${
|
|
53
|
+
${R}
|
|
55
54
|
</tr>
|
|
56
55
|
</tbody>
|
|
57
56
|
</table>
|
|
@@ -62,10 +61,10 @@ function X(c, e = !0, l, a, d) {
|
|
|
62
61
|
</td>
|
|
63
62
|
`;
|
|
64
63
|
}
|
|
65
|
-
const
|
|
66
|
-
[
|
|
64
|
+
const W = {
|
|
65
|
+
[D]: (c, e) => {
|
|
67
66
|
var d;
|
|
68
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = ((d = e == null ? void 0 : e.styleTemplate) == null ? void 0 : d.imgStyle) ??
|
|
67
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = ((d = e == null ? void 0 : e.styleTemplate) == null ? void 0 : d.imgStyle) ?? Y;
|
|
69
68
|
return `
|
|
70
69
|
<td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
|
|
71
70
|
${b(e == null ? void 0 : e.cardBackgroundColor)}
|
|
@@ -75,9 +74,9 @@ const Z = {
|
|
|
75
74
|
class="esd-block-image product-image"
|
|
76
75
|
align="center"
|
|
77
76
|
esd-extension-block-id="${t.IMAGE}">
|
|
78
|
-
<a target="_blank" href="${c.url}" class="${
|
|
77
|
+
<a target="_blank" href="${c.url}" class="${S}">
|
|
79
78
|
<img
|
|
80
|
-
src="${
|
|
79
|
+
src="${j(c.image_url)}"
|
|
81
80
|
alt="${c.name}"
|
|
82
81
|
style="${a}"
|
|
83
82
|
class="adapt-img">
|
|
@@ -89,8 +88,8 @@ const Z = {
|
|
|
89
88
|
</td>
|
|
90
89
|
`;
|
|
91
90
|
},
|
|
92
|
-
[
|
|
93
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a =
|
|
91
|
+
[L]: (c, e) => {
|
|
92
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
|
|
94
93
|
c.name,
|
|
95
94
|
{ pStyle: "font-size: 16px; color: #333333;", openTags: "<strong>", closeTags: "</strong>" },
|
|
96
95
|
e == null ? void 0 : e.styleTemplate
|
|
@@ -112,8 +111,8 @@ const Z = {
|
|
|
112
111
|
</td>
|
|
113
112
|
`;
|
|
114
113
|
},
|
|
115
|
-
[
|
|
116
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a =
|
|
114
|
+
[I]: (c, e) => {
|
|
115
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
|
|
117
116
|
_(c, "price"),
|
|
118
117
|
B,
|
|
119
118
|
e == null ? void 0 : e.styleTemplate
|
|
@@ -135,8 +134,8 @@ const Z = {
|
|
|
135
134
|
</td>
|
|
136
135
|
`;
|
|
137
136
|
},
|
|
138
|
-
[
|
|
139
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a =
|
|
137
|
+
[n]: (c, e) => {
|
|
138
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = C(
|
|
140
139
|
_(c, "original_price"),
|
|
141
140
|
f,
|
|
142
141
|
e == null ? void 0 : e.styleTemplate
|
|
@@ -149,7 +148,7 @@ const Z = {
|
|
|
149
148
|
<td
|
|
150
149
|
class="esd-block-text product-old-price ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
151
150
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
152
|
-
data-same-price="${
|
|
151
|
+
data-same-price="${w(c)}"
|
|
153
152
|
esd-extension-block-id="${t.OLD_PRICE}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
154
153
|
${a}
|
|
155
154
|
</td>
|
|
@@ -159,8 +158,8 @@ const Z = {
|
|
|
159
158
|
</td>
|
|
160
159
|
`;
|
|
161
160
|
},
|
|
162
|
-
[
|
|
163
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a =
|
|
161
|
+
[v]: (c, e) => {
|
|
162
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = s("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), { before: d, after: r } = P(e == null ? void 0 : e.omnibusText, "Lowest 30-day price: ");
|
|
164
163
|
return `
|
|
165
164
|
<td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
|
|
166
165
|
${b(e == null ? void 0 : e.cardBackgroundColor)}
|
|
@@ -184,9 +183,9 @@ const Z = {
|
|
|
184
183
|
</td>
|
|
185
184
|
`;
|
|
186
185
|
},
|
|
187
|
-
[
|
|
188
|
-
var
|
|
189
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a =
|
|
186
|
+
[U]: (c, e) => {
|
|
187
|
+
var R, y;
|
|
188
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = s("font-size: 12px; color: #666666;", e == null ? void 0 : e.styleTemplate), d = O(), r = ((R = c.original_price) == null ? void 0 : R[d.code]) ?? Object.values(c.original_price ?? {})[0] ?? 0, u = ((y = c.price) == null ? void 0 : y[d.code]) ?? Object.values(c.price ?? {})[0] ?? 0, A = r > 0 ? Math.round((r - u) / r * 100) : 0, x = A > 0 ? `-${A}%` : "0%", { before: m, after: k } = P(e == null ? void 0 : e.omnibusText);
|
|
190
189
|
return `
|
|
191
190
|
<td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
|
|
192
191
|
${b(e == null ? void 0 : e.cardBackgroundColor)}
|
|
@@ -195,11 +194,11 @@ const Z = {
|
|
|
195
194
|
<td
|
|
196
195
|
class="esd-block-text product-omnibus-discount ${(e == null ? void 0 : e.cellClasses) ?? "es-p15l es-p15r"}"
|
|
197
196
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
198
|
-
data-text-before="${
|
|
197
|
+
data-text-before="${m}"
|
|
199
198
|
data-text-after="${k}"
|
|
200
199
|
esd-extension-block-id="${t.OMNIBUS_DISCOUNT}"${T(e == null ? void 0 : e.cellBackgroundColor)}>
|
|
201
200
|
<p contenteditable="false" style="${a}">
|
|
202
|
-
<span class="omnibus-text-before">${
|
|
201
|
+
<span class="omnibus-text-before">${m}</span>
|
|
203
202
|
<span class="omnibus-discount-value">${x}</span>
|
|
204
203
|
<span class="omnibus-text-after">${k}</span>
|
|
205
204
|
</p>
|
|
@@ -210,8 +209,8 @@ const Z = {
|
|
|
210
209
|
</td>
|
|
211
210
|
`;
|
|
212
211
|
},
|
|
213
|
-
[
|
|
214
|
-
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = e == null ? void 0 : e.styleTemplate, d = (a == null ? void 0 : a.buttonBorderStyle) ??
|
|
212
|
+
[E]: (c, e) => {
|
|
213
|
+
const l = (e == null ? void 0 : e.cellPadding) ?? g, a = e == null ? void 0 : e.styleTemplate, d = (a == null ? void 0 : a.buttonBorderStyle) ?? z, r = (a == null ? void 0 : a.buttonAnchorStyle) ?? G, u = F((a == null ? void 0 : a.buttonText) ?? "Buy", a);
|
|
215
214
|
return `
|
|
216
215
|
<td class="${$}" style="padding: ${l}; height: 100%;" valign="top">
|
|
217
216
|
${b(e == null ? void 0 : e.cardBackgroundColor)}
|
|
@@ -221,10 +220,10 @@ const Z = {
|
|
|
221
220
|
class="esd-block-button product-button ${(e == null ? void 0 : e.cellClasses) ?? "es-p10t es-p10b"}"
|
|
222
221
|
align="${(e == null ? void 0 : e.cellAlignment) ?? "center"}"
|
|
223
222
|
esd-extension-block-id="${t.BUTTON}">
|
|
224
|
-
<span class="${
|
|
223
|
+
<span class="${H(a)}" style="${d}">
|
|
225
224
|
<a
|
|
226
225
|
href="#"
|
|
227
|
-
class="es-button ${
|
|
226
|
+
class="es-button ${S}"
|
|
228
227
|
target="_blank"
|
|
229
228
|
style="${r}">
|
|
230
229
|
${u}
|
|
@@ -244,8 +243,8 @@ const Z = {
|
|
|
244
243
|
* @param productAttrValue - Resolved product-attr value (e.g., "brand" for default, "product_attribute.rating_star" for custom)
|
|
245
244
|
* @param content - Display content for the cell
|
|
246
245
|
*/
|
|
247
|
-
[
|
|
248
|
-
const a = (l == null ? void 0 : l.cellPadding) ?? g, d =
|
|
246
|
+
[M]: (c, e, l) => {
|
|
247
|
+
const a = (l == null ? void 0 : l.cellPadding) ?? g, d = C(
|
|
249
248
|
e,
|
|
250
249
|
{ pStyle: "font-size: 12px; color: #666666;", openTags: "", closeTags: "" },
|
|
251
250
|
l == null ? void 0 : l.styleTemplate
|
|
@@ -256,7 +255,7 @@ const Z = {
|
|
|
256
255
|
<tbody>
|
|
257
256
|
<tr valign="top">
|
|
258
257
|
<td
|
|
259
|
-
${
|
|
258
|
+
${h}="${c}"
|
|
260
259
|
class="esd-block-text product-custom-attribute ${(l == null ? void 0 : l.cellClasses) ?? "es-p0t es-p0b es-p15l es-p15r"}"
|
|
261
260
|
align="${(l == null ? void 0 : l.cellAlignment) ?? "center"}"
|
|
262
261
|
esd-extension-block-id="${t.CUSTOM_ATTRIBUTE}"${T(l == null ? void 0 : l.cellBackgroundColor)}>
|
|
@@ -272,7 +271,7 @@ const Z = {
|
|
|
272
271
|
export {
|
|
273
272
|
$ as ATTRIBUTE_CELL_CLASS,
|
|
274
273
|
g as DEFAULT_CELL_PADDING,
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
Q as buildFillerCell,
|
|
275
|
+
W as gridElementRenderer,
|
|
276
|
+
V as renderInlineGridPriceCell
|
|
278
277
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const V = `
|
|
1
|
+
import { ATTR_PRODUCT_PRICE as D, ATTR_PRODUCT_OLD_PRICE as O } from "../../constants/selectors.js";
|
|
2
|
+
import { DEFAULT_PRODUCTS_PER_ROW as w } from "../../constants/layout.js";
|
|
3
|
+
import { createBlockTemplate as A, getDefaultProducts as g, DEFAULTS as U, buildSpacer as h, DEFAULT_CARD_COMPOSITION as Y, buildElementRenderer as B, buildCellOptions as m, DEFAULT_CARD_VISIBILITY as F } from "../utils.js";
|
|
4
|
+
import { DEFAULT_CELL_PADDING as W, renderInlineGridPriceCell as k, buildFillerCell as H, gridElementRenderer as x } from "./elementRenderer.js";
|
|
5
|
+
import { resolveInlinePriceOrder as y } from "../../utils/inlinePriceOrder.js";
|
|
6
|
+
const G = `
|
|
8
7
|
<tr class="recommendation-product-row">
|
|
9
8
|
<td>
|
|
10
9
|
<table
|
|
@@ -21,7 +20,7 @@ const V = `
|
|
|
21
20
|
</table>
|
|
22
21
|
</td>
|
|
23
22
|
</tr>
|
|
24
|
-
`,
|
|
23
|
+
`, V = `
|
|
25
24
|
<tr
|
|
26
25
|
class="recommendation-attribute-row"
|
|
27
26
|
data-attribute-type="{-{-ATTR_TYPE-}-}"
|
|
@@ -30,53 +29,53 @@ const V = `
|
|
|
30
29
|
{-{-CELLS-}-}
|
|
31
30
|
</tr>
|
|
32
31
|
`;
|
|
33
|
-
function
|
|
34
|
-
const { cellPadding: s =
|
|
32
|
+
function j(t, r, n, e = Y, c = {}, i = {}) {
|
|
33
|
+
const { cellPadding: s = W, cardBackgroundColor: u, visibility: a, priceInline: o = !1 } = i, d = (100 / r).toFixed(2), p = r - t.length, T = p > 0 ? H(d, s).repeat(p) : "", I = B(n, e, c), R = y(e), L = o ? e.filter((l) => l !== R.skip) : e, C = m(D, i), P = m(O, i);
|
|
35
34
|
return L.filter((l) => I[l]).map((l) => {
|
|
36
|
-
const _ = (a == null ? void 0 : a[l]) ??
|
|
35
|
+
const _ = (a == null ? void 0 : a[l]) ?? F[l] ?? !0, b = _ ? "" : 'style="display: none;"', S = m(l, i, e), f = t.map((E) => (o && l === R.anchor ? k(
|
|
37
36
|
E,
|
|
38
37
|
R.originalFirst,
|
|
39
38
|
C,
|
|
40
39
|
P,
|
|
41
40
|
u
|
|
42
|
-
) : I[l](E,
|
|
43
|
-
return
|
|
41
|
+
) : I[l](E, S)).replace("<td", `<td width="${d}%"`)).join("");
|
|
42
|
+
return V.replace("{-{-ATTR_TYPE-}-}", l).replace("{-{-VISIBILITY-}-}", _ ? "1" : "0").replace("{-{-DISPLAY_STYLE-}-}", b).replace("{-{-CELLS-}-}", f + T);
|
|
44
43
|
}).join("");
|
|
45
44
|
}
|
|
46
|
-
function
|
|
45
|
+
function v(t, r, n, e, c = {}, i = {}) {
|
|
47
46
|
const s = [];
|
|
48
47
|
for (let o = 0; o < t.length; o += r)
|
|
49
48
|
s.push(t.slice(o, o + r));
|
|
50
|
-
const u =
|
|
49
|
+
const u = h(i.rowSpacingPx);
|
|
51
50
|
return s.map((o, d) => {
|
|
52
|
-
const p =
|
|
51
|
+
const p = j(
|
|
53
52
|
o,
|
|
54
53
|
r,
|
|
55
54
|
n,
|
|
56
55
|
e,
|
|
57
56
|
c,
|
|
58
57
|
i
|
|
59
|
-
), T =
|
|
58
|
+
), T = G.replace("{-{-ATTRIBUTE_ROWS-}-}", p);
|
|
60
59
|
return d > 0 ? u + T : T;
|
|
61
60
|
}).join("");
|
|
62
61
|
}
|
|
63
|
-
function
|
|
64
|
-
return
|
|
62
|
+
function M(t, r, n, e = {}, c = {}) {
|
|
63
|
+
return v(
|
|
65
64
|
t,
|
|
66
65
|
r,
|
|
67
|
-
|
|
66
|
+
x,
|
|
68
67
|
n,
|
|
69
68
|
e,
|
|
70
69
|
c
|
|
71
70
|
);
|
|
72
71
|
}
|
|
73
|
-
function
|
|
74
|
-
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, n =
|
|
75
|
-
return n.replace("{-{-TITLE-}-}",
|
|
72
|
+
function X(t) {
|
|
73
|
+
const r = t ? `ins-recommendation-v3-block-${t}` : void 0, n = A("grid", r), e = g(), c = M(e, w);
|
|
74
|
+
return n.replace("{-{-TITLE-}-}", U.TITLE).replace("{-{-PRODUCT_ROWS-}-}", c).replace("{-{-MOBILE_PRODUCT_ROWS-}-}", "");
|
|
76
75
|
}
|
|
77
76
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
77
|
+
X as getDefaultTemplate,
|
|
78
|
+
j as prepareGridAttributeRows,
|
|
79
|
+
v as prepareGridProductRows,
|
|
80
|
+
M as prepareProductRows
|
|
82
81
|
};
|