@useinsider/guido 3.30.0-beta.64ede62 → 3.30.0-beta.6972d4f
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/useAutoSave.js +13 -13
- 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 +59 -64
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +39 -40
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +32 -33
- 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 +4 -4
- 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
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
var at = Object.defineProperty;
|
|
2
|
-
var ct = (_,
|
|
3
|
-
var v = (_,
|
|
2
|
+
var ct = (_, g, t) => g in _ ? at(_, g, { enumerable: !0, configurable: !0, writable: !0, value: t }) : _[g] = t;
|
|
3
|
+
var v = (_, g, t) => ct(_, typeof g != "symbol" ? g + "" : g, t);
|
|
4
4
|
import { ACADEMY_LINKS as dt } from "../../../../../enums/academy.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as ht, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as pt, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _t, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, CSS_CLASS_SPACER as ft, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
5
|
+
import { UIElementType as f, UEAttr as O, ModificationDescription as y } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
6
|
+
import { CommonControl as ut } from "../../../common-control.js";
|
|
7
|
+
import { ATTR_PRODUCT_IMAGE as q, ATTR_PRODUCT_NAME as mt, ATTR_PRODUCT_PRICE as p, ATTR_PRODUCT_OLD_PRICE as I, ATTR_PRODUCT_OMNIBUS_PRICE as ht, ATTR_PRODUCT_OMNIBUS_DISCOUNT as pt, ATTR_PRODUCT_BUTTON as F, ATTR_RECOMMENDATION_TITLE as $, ATTR_DATA_CARD_COMPOSITION as K, ATTR_DATA_CUSTOM_ATTRIBUTES as W, ATTR_CUSTOM_PREFIX as N, SELECTOR_ATTRIBUTE_ROW as E, SELECTOR_TITLE_CELL as G, ATTR_DATA_VISIBILITY as D, ATTR_DATA_ATTRIBUTE_TYPE as R, CSS_CLASS_ATTRIBUTE_ROW as z, CSS_CLASS_SPACER as _t, BUILT_IN_DEFAULT_ATTRIBUTES as gt } from "../../constants/selectors.js";
|
|
9
8
|
import { DEFAULT_COMPOSITION as Y, DEFAULT_VISIBILITY as X } from "../../constants/defaultConfig.js";
|
|
10
9
|
import { RecommendationConfigService as T } from "../../services/configService.js";
|
|
11
|
-
import { useRecommendationExtensionStore as
|
|
12
|
-
import { ATTRIBUTE_CELL_CLASS as
|
|
13
|
-
import { listElementRenderer as
|
|
14
|
-
import { buildTitleRows as
|
|
15
|
-
import { toDisplayName as
|
|
16
|
-
import { normalizeCompositionKeys as
|
|
17
|
-
import { getTableDisplayValue as
|
|
18
|
-
import { isPartnerManagedBlock as
|
|
19
|
-
import { resolveInlinePriceOrder as
|
|
20
|
-
const
|
|
10
|
+
import { useRecommendationExtensionStore as ft } from "../../store/recommendation.js";
|
|
11
|
+
import { ATTRIBUTE_CELL_CLASS as bt, gridElementRenderer as yt, DEFAULT_CELL_PADDING as Tt, buildFillerCell as Ct } from "../../templates/grid/elementRenderer.js";
|
|
12
|
+
import { listElementRenderer as St } from "../../templates/list/elementRenderer.js";
|
|
13
|
+
import { buildTitleRows as At, DEFAULT_TITLE_PARAGRAPH as It, DEFAULT_TITLE_TEXT as $t } from "../../templates/titleRows.js";
|
|
14
|
+
import { toDisplayName as vt, toDisplayableAttributeValue as Nt, buildElementRenderer as J } from "../../templates/utils.js";
|
|
15
|
+
import { normalizeCompositionKeys as Et, normalizeCustomAttrValues as Rt, compositionKeyToProductAttr as k, resolveRowVisibilityKeys as Lt, filterToProductAttrValue as C, findAttributeRow as Ot, rewriteLegacyRowKeyHtml as Q, bareAttributeName as H, isDefaultProductAttr as Dt, productAttrToCompositionKey as M } from "../../utils/compositionKeys.js";
|
|
16
|
+
import { getTableDisplayValue as Ht } from "../../utils/tagName.js";
|
|
17
|
+
import { isPartnerManagedBlock as Pt, regenerateProductRowsWithStyles as wt, getMainContainerTbody as Bt, getCurrentLayout as kt } from "../main/utils.js";
|
|
18
|
+
import { resolveInlinePriceOrder as Mt } from "../../utils/inlinePriceOrder.js";
|
|
19
|
+
const Ut = "ui-elements-recommendation-card-composition", U = ".product-card-wrapper > tbody", Z = ".product-info-cell > table > tbody", tt = {
|
|
21
20
|
ADD_ATTRIBUTE: "addAttribute"
|
|
22
|
-
}, b = 5, P = "reorderIcon_",
|
|
21
|
+
}, b = 5, P = "reorderIcon_", qt = '<svg width="14" height="10" viewBox="0 0 14 10" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2.5" r="1.2"/><circle cx="7" cy="2.5" r="1.2"/><circle cx="12" cy="2.5" r="1.2"/><circle cx="2" cy="7.5" r="1.2"/><circle cx="7" cy="7.5" r="1.2"/><circle cx="12" cy="7.5" r="1.2"/></svg>', m = [
|
|
23
22
|
{ key: q, label: "Product Image" },
|
|
24
|
-
{ key:
|
|
23
|
+
{ key: mt, label: "Product Name" },
|
|
25
24
|
{ key: p, label: "Product Price" },
|
|
26
25
|
{ key: I, label: "Product Original Price" },
|
|
27
|
-
{ key:
|
|
28
|
-
{ key:
|
|
26
|
+
{ key: ht, label: "Omnibus Price" },
|
|
27
|
+
{ key: pt, label: "Omnibus Discount" },
|
|
29
28
|
{ key: F, label: "Product Button" }
|
|
30
|
-
], L = { key: $, label: "Title" },
|
|
31
|
-
class
|
|
29
|
+
], L = { key: $, label: "Title" }, Ft = new Set(m.map((_) => _.key)), A = "customAttr_", w = "deleteAttr_";
|
|
30
|
+
class oe extends ut {
|
|
32
31
|
constructor() {
|
|
33
32
|
super(...arguments);
|
|
34
|
-
v(this, "store",
|
|
33
|
+
v(this, "store", ft());
|
|
35
34
|
v(this, "unsubscribeStore", null);
|
|
36
35
|
v(this, "eventController", null);
|
|
37
36
|
/**
|
|
@@ -41,7 +40,7 @@ class ce extends mt {
|
|
|
41
40
|
v(this, "reorderInProgress", !1);
|
|
42
41
|
}
|
|
43
42
|
getId() {
|
|
44
|
-
return
|
|
43
|
+
return Ut;
|
|
45
44
|
}
|
|
46
45
|
// ========================================================================
|
|
47
46
|
// Lifecycle
|
|
@@ -68,30 +67,30 @@ class ce extends mt {
|
|
|
68
67
|
{ length: r },
|
|
69
68
|
(d, c) => `
|
|
70
69
|
<div data-reorder-icon-key="${P}${c}" style="display: none;">
|
|
71
|
-
<${
|
|
70
|
+
<${f.BUTTON}
|
|
72
71
|
class="guido-drag-handle-btn flat-inline flat-white"
|
|
73
72
|
${O.BUTTON.name}="${P}${c}"
|
|
74
73
|
>
|
|
75
|
-
<${
|
|
74
|
+
<${f.ICON}
|
|
76
75
|
src="reorder"
|
|
77
76
|
class="icon-button"
|
|
78
|
-
></${
|
|
79
|
-
</${
|
|
77
|
+
></${f.ICON}>
|
|
78
|
+
</${f.BUTTON}>
|
|
80
79
|
</div>
|
|
81
80
|
`
|
|
82
81
|
).join(""), s = Array.from(
|
|
83
82
|
{ length: b },
|
|
84
83
|
(d, c) => `
|
|
85
84
|
<div data-custom-delete-key="${w}${c}" style="display: none;">
|
|
86
|
-
<${
|
|
85
|
+
<${f.BUTTON}
|
|
87
86
|
class="custom-attr-delete flat-inline flat-white"
|
|
88
87
|
${O.BUTTON.name}="${w}${c}"
|
|
89
88
|
>
|
|
90
|
-
<${
|
|
89
|
+
<${f.ICON}
|
|
91
90
|
src="delete"
|
|
92
91
|
class="icon-button"
|
|
93
|
-
></${
|
|
94
|
-
</${
|
|
92
|
+
></${f.ICON}>
|
|
93
|
+
</${f.BUTTON}>
|
|
95
94
|
</div>
|
|
96
95
|
`
|
|
97
96
|
).join(""), o = dt.EMAIL_RECOMMENDATION_BLOCK, n = this.api.translate(
|
|
@@ -157,7 +156,7 @@ class ce extends mt {
|
|
|
157
156
|
const t = (r = this.getContainer()) == null ? void 0 : r.querySelector("[data-card-composition-control]");
|
|
158
157
|
if (!t)
|
|
159
158
|
return;
|
|
160
|
-
const e =
|
|
159
|
+
const e = Pt(this.currentNode);
|
|
161
160
|
t.style.pointerEvents = e ? "none" : "", t.style.opacity = e ? "0.5" : "";
|
|
162
161
|
}
|
|
163
162
|
onTemplateNodeUpdated(t) {
|
|
@@ -200,11 +199,7 @@ class ce extends mt {
|
|
|
200
199
|
}
|
|
201
200
|
/** Upgrades legacy bare-name custom keys to the canonical form. (SD-147101) */
|
|
202
201
|
_normalizeComposition(t) {
|
|
203
|
-
return
|
|
204
|
-
Lt(t),
|
|
205
|
-
this.currentNode,
|
|
206
|
-
this.store.filterList
|
|
207
|
-
);
|
|
202
|
+
return Et(t, this.currentNode, this.store.filterList);
|
|
208
203
|
}
|
|
209
204
|
_readCustomAttributesFromNode() {
|
|
210
205
|
if (!this.currentNode || !("getAttribute" in this.currentNode))
|
|
@@ -212,8 +207,8 @@ class ce extends mt {
|
|
|
212
207
|
const t = this.currentNode.getAttribute(W);
|
|
213
208
|
if (t)
|
|
214
209
|
try {
|
|
215
|
-
return
|
|
216
|
-
JSON.parse(t).map((e) => String(e))
|
|
210
|
+
return Rt(
|
|
211
|
+
JSON.parse(t).map((e) => String(e)),
|
|
217
212
|
this.currentNode,
|
|
218
213
|
this.store.filterList
|
|
219
214
|
);
|
|
@@ -247,7 +242,7 @@ class ce extends mt {
|
|
|
247
242
|
if (!("getAttribute" in r))
|
|
248
243
|
return;
|
|
249
244
|
const i = r.getAttribute(D);
|
|
250
|
-
i !== null &&
|
|
245
|
+
i !== null && Lt(r).forEach((s) => {
|
|
251
246
|
e[s] = this._parseVisibilityValue(i);
|
|
252
247
|
});
|
|
253
248
|
}), e;
|
|
@@ -282,12 +277,12 @@ class ce extends mt {
|
|
|
282
277
|
if (!(i.dataset.inlinePrices !== String(s)) && this._tryReorderInPlace(i, t))
|
|
283
278
|
return !1;
|
|
284
279
|
i.dataset.inlinePrices = String(s);
|
|
285
|
-
const n = new Set(e), l =
|
|
280
|
+
const n = new Set(e), l = Mt(t);
|
|
286
281
|
let a = 0, d = 0;
|
|
287
282
|
const c = t.map((u) => {
|
|
288
283
|
if (s && (u === p || u === I))
|
|
289
284
|
return u === l.anchor ? this._createPriceGroupItemHtml(d++, l.originalFirst) : "";
|
|
290
|
-
if (
|
|
285
|
+
if (Ft.has(u)) {
|
|
291
286
|
const h = m.find((S) => S.key === u);
|
|
292
287
|
return this._createBuiltInItemHtml(h, d++);
|
|
293
288
|
}
|
|
@@ -354,7 +349,7 @@ class ce extends mt {
|
|
|
354
349
|
var n, l;
|
|
355
350
|
const r = ((n = m.find((a) => a.key === p)) == null ? void 0 : n.label) ?? "Product Price", i = ((l = m.find((a) => a.key === I)) == null ? void 0 : l.label) ?? "Product Original Price", s = (a, d) => `
|
|
356
351
|
<div class="price-suborderable-item" draggable="true" data-subkey="${a}">
|
|
357
|
-
<span class="sub-drag-handle">${
|
|
352
|
+
<span class="sub-drag-handle">${qt}</span>
|
|
358
353
|
<span class="item-label">${this.api.translate(d)}</span>
|
|
359
354
|
</div>`, o = e ? s(I, i) + s(p, r) : s(p, r) + s(I, i);
|
|
360
355
|
return `
|
|
@@ -372,7 +367,7 @@ class ce extends mt {
|
|
|
372
367
|
_createCustomItemHtml(t, e, r) {
|
|
373
368
|
return `
|
|
374
369
|
<div class="orderable-item" draggable="true"
|
|
375
|
-
data-key="${
|
|
370
|
+
data-key="${t}" data-custom-index="${e}">
|
|
376
371
|
<span class="guido-drag-handle" data-reorder-icon-slot="${r}"></span>
|
|
377
372
|
<div class="custom-attr-select-wrap"
|
|
378
373
|
data-custom-select-slot="${e}"></div>
|
|
@@ -659,7 +654,7 @@ class ce extends mt {
|
|
|
659
654
|
try {
|
|
660
655
|
this._updateBothAttributes(t, e);
|
|
661
656
|
const r = this._isInlinePrices();
|
|
662
|
-
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode &&
|
|
657
|
+
this._getCurrentLayout() === "grid" && !r ? this._reorderProductAttributes(t) : this.currentNode && wt({
|
|
663
658
|
currentNode: this.currentNode,
|
|
664
659
|
documentModifier: this.api.getDocumentModifier()
|
|
665
660
|
});
|
|
@@ -677,7 +672,7 @@ class ce extends mt {
|
|
|
677
672
|
* DOM converge on the next composition change without writing on open.
|
|
678
673
|
*/
|
|
679
674
|
_getExistingRowHtml(t, e) {
|
|
680
|
-
const r =
|
|
675
|
+
const r = Ot(t, e);
|
|
681
676
|
if (r && "getOuterHTML" in r)
|
|
682
677
|
return Q(r.getOuterHTML(), e);
|
|
683
678
|
const i = t.querySelector(
|
|
@@ -698,11 +693,11 @@ class ce extends mt {
|
|
|
698
693
|
let c = 0;
|
|
699
694
|
s.forEach((u) => {
|
|
700
695
|
var V;
|
|
701
|
-
const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${
|
|
696
|
+
const h = u.querySelector(E), S = ((V = h == null ? void 0 : h.querySelectorAll(`.${bt}`)) == null ? void 0 : V.length) || 1, x = (100 / S).toFixed(2), { bgStyle: et, bgAttr: rt } = this._extractSegmentBgFromCard(u), B = d > 0 ? Math.min(S, d - c) : S, it = i.map((j) => {
|
|
702
697
|
if (j === r) {
|
|
703
698
|
const st = Array.from(
|
|
704
699
|
{ length: B },
|
|
705
|
-
(
|
|
700
|
+
(xt, nt) => {
|
|
706
701
|
const lt = this._resolveAttributeContent(
|
|
707
702
|
t,
|
|
708
703
|
e,
|
|
@@ -717,7 +712,7 @@ class ce extends mt {
|
|
|
717
712
|
l
|
|
718
713
|
);
|
|
719
714
|
}
|
|
720
|
-
).join(""), ot =
|
|
715
|
+
).join(""), ot = Ct(x, l).repeat(S - B);
|
|
721
716
|
return `<tr class="${z}" ${R}="${r}" ${D}="1">${st}${ot}</tr>`;
|
|
722
717
|
}
|
|
723
718
|
return this._getExistingRowHtml(u, j);
|
|
@@ -821,7 +816,7 @@ class ce extends mt {
|
|
|
821
816
|
return;
|
|
822
817
|
const o = e ? "1" : "0", n = e ? this.api.translate("visible") : this.api.translate("hidden"), l = `${this.api.translate("Set visibility")}: ${t} → ${n}`, a = this.api.getDocumentModifier();
|
|
823
818
|
s.forEach((c) => {
|
|
824
|
-
const u =
|
|
819
|
+
const u = Ht(c), h = e ? u : "none";
|
|
825
820
|
a.modifyHtml(c).setStyle("display", h).setAttribute(D, o);
|
|
826
821
|
});
|
|
827
822
|
const d = {
|
|
@@ -859,7 +854,7 @@ class ce extends mt {
|
|
|
859
854
|
const e = this._findTitleContainerBody(), r = e ? this._readInnerHtml(e) : null;
|
|
860
855
|
if (!e || r === null)
|
|
861
856
|
return null;
|
|
862
|
-
const i = t.previousTitleHtml ||
|
|
857
|
+
const i = t.previousTitleHtml || At(this._defaultTitleParagraph(), !0, t.rowSpacing);
|
|
863
858
|
return { containerBody: e, html: i + r };
|
|
864
859
|
}
|
|
865
860
|
_readTitleHtml(t) {
|
|
@@ -880,16 +875,16 @@ class ce extends mt {
|
|
|
880
875
|
return i && this._isSpacerRow(i) ? [e[r], i] : [e[r]];
|
|
881
876
|
}
|
|
882
877
|
_isSpacerRow(t) {
|
|
883
|
-
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(
|
|
878
|
+
return "children" in t && t.children().some((e) => "hasClass" in e && e.hasClass(_t));
|
|
884
879
|
}
|
|
885
880
|
_findTitleContainerBody() {
|
|
886
|
-
return (this.currentNode ?
|
|
881
|
+
return (this.currentNode ? Bt(this.currentNode) : null) ?? void 0;
|
|
887
882
|
}
|
|
888
883
|
_readInnerHtml(t) {
|
|
889
884
|
return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : null;
|
|
890
885
|
}
|
|
891
886
|
_defaultTitleParagraph() {
|
|
892
|
-
return
|
|
887
|
+
return It.replace("{-{-TITLE-}-}", this.api.translate($t));
|
|
893
888
|
}
|
|
894
889
|
// ========================================================================
|
|
895
890
|
// Utilities
|
|
@@ -910,7 +905,7 @@ class ce extends mt {
|
|
|
910
905
|
return -1;
|
|
911
906
|
}
|
|
912
907
|
_getCurrentLayout() {
|
|
913
|
-
return this.store.recommendationConfigs.orientation ||
|
|
908
|
+
return this.store.recommendationConfigs.orientation || kt(this.currentNode);
|
|
914
909
|
}
|
|
915
910
|
/**
|
|
916
911
|
* Extracts background color properties from existing card elements.
|
|
@@ -1006,7 +1001,7 @@ class ce extends mt {
|
|
|
1006
1001
|
*/
|
|
1007
1002
|
_getDisplayNameForAttribute(t) {
|
|
1008
1003
|
const e = Object.values(this.store.filterList).find((r) => C(r) === t);
|
|
1009
|
-
return e ? e.displayName :
|
|
1004
|
+
return e ? e.displayName : vt(H(t));
|
|
1010
1005
|
}
|
|
1011
1006
|
/**
|
|
1012
1007
|
* Resolves the display content for a custom attribute cell.
|
|
@@ -1014,22 +1009,22 @@ class ce extends mt {
|
|
|
1014
1009
|
*/
|
|
1015
1010
|
_resolveAttributeContent(t, e, r) {
|
|
1016
1011
|
var l;
|
|
1017
|
-
const s = this.store.recommendationProducts[r], o = H(t), n =
|
|
1018
|
-
return
|
|
1012
|
+
const s = this.store.recommendationProducts[r], o = H(t), n = Dt(t) ? s == null ? void 0 : s[o] : (l = s == null ? void 0 : s.product_attributes) == null ? void 0 : l[o];
|
|
1013
|
+
return Nt(n) ?? e;
|
|
1019
1014
|
}
|
|
1020
1015
|
_getGridCellHtml(t, e, r, i = "", s = "", o = "") {
|
|
1021
|
-
const n = M(t), l = H(t), a = J(
|
|
1016
|
+
const n = M(t), l = H(t), a = J(yt, [n], this.store.filterList), d = {
|
|
1022
1017
|
[l]: e,
|
|
1023
1018
|
product_attributes: { [l]: e }
|
|
1024
1019
|
};
|
|
1025
1020
|
let c = a[n](d);
|
|
1026
1021
|
return c = c.replace("<td", `<td width="${r}%"`), o && (c = c.replace(
|
|
1027
|
-
`padding: ${
|
|
1022
|
+
`padding: ${Tt}`,
|
|
1028
1023
|
`padding: ${o}`
|
|
1029
1024
|
)), i && (c = c.replace(/style="table-layout: fixed;"/, `style="table-layout: fixed; ${i}"`)), s && (c = c.replace(/border="0"/, `border="0" bgcolor="${s}"`)), c;
|
|
1030
1025
|
}
|
|
1031
1026
|
_getListRowHtml(t, e, r) {
|
|
1032
|
-
const i = H(t), s = J(
|
|
1027
|
+
const i = H(t), s = J(St, [r], this.store.filterList), o = {
|
|
1033
1028
|
[i]: e,
|
|
1034
1029
|
product_attributes: { [i]: e }
|
|
1035
1030
|
}, l = s[r](o).replace(/<tr>/, "").replace(/<\/tr>/, "");
|
|
@@ -1037,6 +1032,6 @@ class ce extends mt {
|
|
|
1037
1032
|
}
|
|
1038
1033
|
}
|
|
1039
1034
|
export {
|
|
1040
|
-
|
|
1041
|
-
|
|
1035
|
+
Ut as COMPOSITION_CONTROL_BLOCK_ID,
|
|
1036
|
+
oe as RecommendationCardCompositionControl
|
|
1042
1037
|
};
|
|
@@ -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
|
};
|