@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
|
@@ -1,399 +1,449 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
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
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
import { useRecommendationExtensionStore as
|
|
6
|
-
import { prepareProductRows as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { getDefaultProducts as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
12
|
-
if (!
|
|
3
|
+
import { CURRENCY_ATTR as g, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as j, ATTR_PRODUCT_ATTR as V } from "../../constants/selectors.js";
|
|
4
|
+
import { RecommendationConfigService as b } from "../../services/configService.js";
|
|
5
|
+
import { useRecommendationExtensionStore as C } from "../../store/recommendation.js";
|
|
6
|
+
import { prepareProductRows as L } from "../../templates/index.js";
|
|
7
|
+
import { formatPrice as W } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as F } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as _, DEFAULT_CARD_COMPOSITION as M, sanitizeImageUrl as G, isSamePrice as Y, toDisplayableAttributeValue as K } from "../../templates/utils.js";
|
|
10
|
+
const R = "recommendation-block-v2";
|
|
11
|
+
function T(t) {
|
|
12
|
+
if (!t)
|
|
13
13
|
return null;
|
|
14
|
-
if ("getAttribute" in
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
17
|
-
return
|
|
14
|
+
if ("getAttribute" in t) {
|
|
15
|
+
const e = t.getAttribute("class");
|
|
16
|
+
if (e && e.includes(R))
|
|
17
|
+
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${R}`) ?? null : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
21
|
+
function E(t) {
|
|
22
|
+
const e = T(t);
|
|
23
|
+
if (!e || !("getAttribute" in e))
|
|
24
24
|
return "grid";
|
|
25
|
-
const
|
|
26
|
-
return
|
|
25
|
+
const o = e.getAttribute("data-layout");
|
|
26
|
+
return o === "list" || o === "horizontal" ? "list" : "grid";
|
|
27
27
|
}
|
|
28
|
-
function x(
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
31
|
-
return
|
|
32
|
-
const
|
|
33
|
-
return
|
|
28
|
+
function x(t) {
|
|
29
|
+
const e = T(t);
|
|
30
|
+
if (!e || !("getAttribute" in e))
|
|
31
|
+
return M;
|
|
32
|
+
const o = e.getAttribute("data-card-composition");
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : M;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
if (!
|
|
35
|
+
function H(t) {
|
|
36
|
+
if (!t || !("childNodes" in t))
|
|
37
37
|
return null;
|
|
38
|
-
const
|
|
39
|
-
(
|
|
38
|
+
const e = t.childNodes(), o = e.find(
|
|
39
|
+
(n) => "getType" in n && n.getType() === "text"
|
|
40
40
|
);
|
|
41
|
-
return
|
|
42
|
-
}
|
|
43
|
-
function b(e, t, n) {
|
|
44
|
-
const o = D(t);
|
|
45
|
-
return o ? (e.modifyHtml(o).setText(n), !0) : !1;
|
|
41
|
+
return o || e.reduce((n, r) => n || !("getType" in r) || r.getType() === "text" ? n : H(r), null);
|
|
46
42
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
43
|
+
function S(t, e, o) {
|
|
44
|
+
const n = H(e);
|
|
45
|
+
return n ? (t.modifyHtml(n).setText(o), !0) : !1;
|
|
49
46
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
return `0 ${e / 2}px`;
|
|
47
|
+
function D(t, e) {
|
|
48
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : _();
|
|
53
49
|
}
|
|
54
|
-
function
|
|
55
|
-
const { currentNode:
|
|
56
|
-
if (!
|
|
57
|
-
return
|
|
58
|
-
const
|
|
59
|
-
|
|
50
|
+
function X(t) {
|
|
51
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
52
|
+
if (!e || !("querySelector" in e))
|
|
53
|
+
return;
|
|
54
|
+
const n = e.querySelector(k);
|
|
55
|
+
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
60
56
|
}
|
|
61
|
-
function
|
|
62
|
-
return "getOuterHTML" in
|
|
57
|
+
function z(t) {
|
|
58
|
+
return "getOuterHTML" in t && typeof t.getOuterHTML == "function" ? t.getOuterHTML() : "";
|
|
63
59
|
}
|
|
64
|
-
function
|
|
65
|
-
const
|
|
66
|
-
return !
|
|
60
|
+
function J(t) {
|
|
61
|
+
const e = t.querySelector(".container");
|
|
62
|
+
return !e || !("childNodes" in e) ? null : e.childNodes().find((n) => "getTagName" in n && n.getTagName() === "tbody") ?? e.querySelector("tbody") ?? null;
|
|
67
63
|
}
|
|
68
|
-
function
|
|
69
|
-
const
|
|
70
|
-
if (!
|
|
64
|
+
function Q(t, e, o) {
|
|
65
|
+
const n = J(t);
|
|
66
|
+
if (!n || !("childNodes" in n))
|
|
71
67
|
return;
|
|
72
|
-
const r =
|
|
73
|
-
|
|
68
|
+
const r = n.childNodes().map(z).join(""), l = `<tr class="ins-recommendation-mobile-row">${o}</tr>`;
|
|
69
|
+
e.modifyHtml(n).setInnerHtml(r + l), e.apply(new p("Added mobile product row"));
|
|
74
70
|
}
|
|
75
|
-
function
|
|
71
|
+
function Z(t) {
|
|
76
72
|
const {
|
|
77
|
-
currentNode:
|
|
73
|
+
currentNode: e,
|
|
78
74
|
documentModifier: o,
|
|
79
|
-
products:
|
|
80
|
-
layout:
|
|
81
|
-
composition:
|
|
82
|
-
} =
|
|
83
|
-
if (!
|
|
84
|
-
return
|
|
85
|
-
const
|
|
86
|
-
if (
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
75
|
+
products: n,
|
|
76
|
+
layout: r,
|
|
77
|
+
composition: l
|
|
78
|
+
} = t;
|
|
79
|
+
if (!e || !("querySelector" in e))
|
|
80
|
+
return;
|
|
81
|
+
const i = r ?? E(e), s = b.getConfig(e);
|
|
82
|
+
if (i === "list" || !s.mobileLayoutEnabled) {
|
|
83
|
+
X({ currentNode: e, documentModifier: o });
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const u = C(), c = D(n, u.recommendationProducts), d = l ?? x(e), a = `<td><table class="ins-recommendation-product-container ins-recommendation-mobile-container" width="100%" cellpadding="0" cellspacing="0" border="0">${L(c, i, {
|
|
87
|
+
productsPerRow: s.mobileCardsInRow,
|
|
90
88
|
composition: d,
|
|
91
|
-
filterList:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function fe(e) {
|
|
100
|
-
$(e, k(e.currentNode)) && e.documentModifier.apply(new g("Updated mobile product rows"));
|
|
89
|
+
filterList: u.filterList,
|
|
90
|
+
priceInline: !s.priceMovedToNextLine
|
|
91
|
+
})}</table></td>`, y = e.querySelector(k);
|
|
92
|
+
if (!y) {
|
|
93
|
+
Q(e, o, a);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
o.modifyHtml(y).setInnerHtml(a), o.apply(new p("Updated mobile product rows"));
|
|
101
97
|
}
|
|
102
|
-
function
|
|
98
|
+
function ee(t) {
|
|
103
99
|
const {
|
|
104
|
-
currentNode:
|
|
100
|
+
currentNode: e,
|
|
105
101
|
documentModifier: o,
|
|
102
|
+
afterRegenerate: n,
|
|
106
103
|
products: r,
|
|
107
|
-
layout:
|
|
104
|
+
layout: l,
|
|
108
105
|
composition: i
|
|
109
|
-
} =
|
|
110
|
-
if (!
|
|
111
|
-
return
|
|
112
|
-
const
|
|
113
|
-
if (!
|
|
114
|
-
return
|
|
115
|
-
const
|
|
116
|
-
productsPerRow:
|
|
117
|
-
composition:
|
|
118
|
-
filterList:
|
|
119
|
-
|
|
120
|
-
cellPadding: a === 1 ? "0" : U(y.columnSpacing),
|
|
121
|
-
rowSpacingPx: y.rowSpacing,
|
|
122
|
-
...t
|
|
106
|
+
} = t;
|
|
107
|
+
if (!e || !("querySelector" in e))
|
|
108
|
+
return;
|
|
109
|
+
const s = e.querySelector(P) ?? e.querySelector(j);
|
|
110
|
+
if (!s)
|
|
111
|
+
return;
|
|
112
|
+
const u = C(), c = D(r, u.recommendationProducts), { cardsInRow: d } = b.getConfig(e), f = i ?? x(e), a = l ?? E(e), { priceMovedToNextLine: y } = b.getConfig(e), v = L(c, a, {
|
|
113
|
+
productsPerRow: d,
|
|
114
|
+
composition: f,
|
|
115
|
+
filterList: u.filterList,
|
|
116
|
+
priceInline: !y
|
|
123
117
|
});
|
|
124
|
-
|
|
118
|
+
o.modifyHtml(s).setInnerHtml(v).apply(new p("Updated product")), Z(t), n == null || n();
|
|
125
119
|
}
|
|
126
|
-
function
|
|
127
|
-
const {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
function h(t, e, o, n) {
|
|
121
|
+
const l = `0 ${Math.floor(o / 2)}px`;
|
|
122
|
+
let i = !1;
|
|
123
|
+
return n === "grid" ? Array.from(
|
|
124
|
+
t.querySelectorAll(".attribute-cell")
|
|
125
|
+
).forEach((u) => {
|
|
126
|
+
e.modifyHtml(u).setStyle("padding", l), i = !0;
|
|
127
|
+
}) : Array.from(
|
|
128
|
+
t.querySelectorAll(".product-card-wrapper")
|
|
129
|
+
).forEach((u) => {
|
|
130
|
+
const c = "parentNode" in u ? u.parentNode : null;
|
|
131
|
+
c && F(c) && (e.modifyHtml(c).setStyle("padding", l), i = !0);
|
|
132
|
+
}), i;
|
|
133
|
+
}
|
|
134
|
+
function I(t, e, o) {
|
|
135
|
+
const n = `${o}px`, r = Array.from(t.querySelectorAll(".spacer"));
|
|
136
|
+
let l = !1;
|
|
137
|
+
return r.forEach((i) => {
|
|
138
|
+
e.modifyHtml(i).setStyle("height", n), l = !0;
|
|
139
|
+
}), l;
|
|
140
|
+
}
|
|
141
|
+
function te(t) {
|
|
142
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
143
|
+
if (!e)
|
|
137
144
|
return;
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
|
|
145
|
+
const n = b.getConfig(e), r = E(e);
|
|
146
|
+
let l = !1;
|
|
147
|
+
const i = e.querySelector(P);
|
|
148
|
+
if (i) {
|
|
149
|
+
l = h(
|
|
150
|
+
i,
|
|
151
|
+
o,
|
|
152
|
+
n.columnSpacing,
|
|
153
|
+
r
|
|
154
|
+
);
|
|
155
|
+
const c = I(
|
|
156
|
+
i,
|
|
157
|
+
o,
|
|
158
|
+
n.rowSpacing
|
|
159
|
+
);
|
|
160
|
+
l = l || c;
|
|
161
|
+
}
|
|
162
|
+
const s = e.querySelector(q);
|
|
163
|
+
if (s) {
|
|
164
|
+
const u = h(
|
|
165
|
+
s,
|
|
166
|
+
o,
|
|
167
|
+
n.mobileColumnSpacing,
|
|
168
|
+
r
|
|
169
|
+
);
|
|
170
|
+
l = l || u;
|
|
171
|
+
const c = I(
|
|
172
|
+
s,
|
|
173
|
+
o,
|
|
174
|
+
n.mobileRowSpacing
|
|
175
|
+
);
|
|
176
|
+
l = l || c;
|
|
177
|
+
}
|
|
178
|
+
l && o.apply(new p("Reapply spacing after regeneration"));
|
|
179
|
+
}
|
|
180
|
+
function ye(t) {
|
|
181
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: l, composition: i } = t;
|
|
182
|
+
e && ee({
|
|
183
|
+
currentNode: e,
|
|
184
|
+
documentModifier: o,
|
|
141
185
|
products: r,
|
|
142
|
-
layout:
|
|
143
|
-
composition: i
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
186
|
+
layout: l,
|
|
187
|
+
composition: i,
|
|
188
|
+
afterRegenerate: () => {
|
|
189
|
+
setTimeout(() => {
|
|
190
|
+
te({ currentNode: e, documentModifier: o });
|
|
191
|
+
}, 0), n == null || n();
|
|
192
|
+
}
|
|
193
|
+
});
|
|
147
194
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
195
|
+
function ge(t, e) {
|
|
196
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ..._(e - t.length)];
|
|
150
197
|
}
|
|
151
|
-
function
|
|
152
|
-
const
|
|
198
|
+
function U() {
|
|
199
|
+
const t = C(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
153
200
|
return {
|
|
154
|
-
code:
|
|
155
|
-
symbol:
|
|
156
|
-
alignment:
|
|
157
|
-
decimalCount: Number.isNaN(
|
|
158
|
-
decimalSeparator:
|
|
159
|
-
thousandSeparator:
|
|
201
|
+
code: e.value,
|
|
202
|
+
symbol: e.symbol,
|
|
203
|
+
alignment: e.alignment === "0" ? "before" : "after",
|
|
204
|
+
decimalCount: Number.isNaN(o) ? 2 : o,
|
|
205
|
+
decimalSeparator: e.decimalSeparator,
|
|
206
|
+
thousandSeparator: e.thousandSeparator
|
|
160
207
|
};
|
|
161
208
|
}
|
|
162
|
-
function A(
|
|
163
|
-
const
|
|
164
|
-
return
|
|
209
|
+
function A(t, e = "price") {
|
|
210
|
+
const o = U(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
211
|
+
return W({
|
|
165
212
|
price: r,
|
|
166
|
-
currency:
|
|
213
|
+
currency: o
|
|
167
214
|
});
|
|
168
215
|
}
|
|
169
|
-
function
|
|
170
|
-
var
|
|
171
|
-
const
|
|
216
|
+
function oe(t) {
|
|
217
|
+
var l, i;
|
|
218
|
+
const e = U(), o = ((l = t.original_price) == null ? void 0 : l[e.code]) ?? Object.values(t.original_price ?? {})[0] ?? 0, n = ((i = t.price) == null ? void 0 : i[e.code]) ?? Object.values(t.price ?? {})[0] ?? 0, r = o > 0 ? Math.round((o - n) / o * 100) : 0;
|
|
172
219
|
return r > 0 ? `-${r}%` : "0%";
|
|
173
220
|
}
|
|
174
|
-
function
|
|
175
|
-
const { documentModifier:
|
|
176
|
-
let
|
|
177
|
-
if (
|
|
178
|
-
const
|
|
179
|
-
|
|
221
|
+
function $(t) {
|
|
222
|
+
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: l, omnibusDiscountEl: i } = t;
|
|
223
|
+
let s = !1;
|
|
224
|
+
if (n && "querySelector" in n) {
|
|
225
|
+
const u = n.querySelector("strong") ?? n.querySelector("p"), c = A(o, "price");
|
|
226
|
+
S(e, u ?? null, c) && (s = !0);
|
|
180
227
|
}
|
|
181
228
|
if (r && "querySelector" in r) {
|
|
182
|
-
const
|
|
183
|
-
|
|
229
|
+
const u = r.querySelector("strong") ?? r.querySelector("p"), c = A(o, "original_price");
|
|
230
|
+
S(e, u ?? null, c) && (s = !0), e.modifyHtml(r).setAttribute("data-same-price", String(Y(o))), s = !0;
|
|
184
231
|
}
|
|
185
|
-
if (
|
|
186
|
-
const
|
|
187
|
-
|
|
232
|
+
if (l && "querySelector" in l) {
|
|
233
|
+
const u = l.querySelector(".omnibus-price-value") ?? null, c = A(o, "original_price");
|
|
234
|
+
S(e, u, c) && (s = !0);
|
|
188
235
|
}
|
|
189
236
|
if (i && "querySelector" in i) {
|
|
190
|
-
const
|
|
191
|
-
|
|
237
|
+
const u = i.querySelector(".omnibus-discount-value") ?? null, c = oe(o);
|
|
238
|
+
S(e, u, c) && (s = !0);
|
|
192
239
|
}
|
|
193
|
-
return
|
|
240
|
+
return s;
|
|
194
241
|
}
|
|
195
|
-
function
|
|
242
|
+
function ne(t) {
|
|
196
243
|
const {
|
|
197
|
-
documentModifier:
|
|
198
|
-
product:
|
|
199
|
-
imageEl:
|
|
244
|
+
documentModifier: e,
|
|
245
|
+
product: o,
|
|
246
|
+
imageEl: n,
|
|
200
247
|
nameEl: r,
|
|
201
|
-
priceEl:
|
|
248
|
+
priceEl: l,
|
|
202
249
|
oldPriceEl: i,
|
|
203
|
-
omnibusPriceEl:
|
|
204
|
-
omnibusDiscountEl:
|
|
205
|
-
buttonEl:
|
|
206
|
-
} =
|
|
207
|
-
let
|
|
208
|
-
if (
|
|
209
|
-
const
|
|
210
|
-
|
|
211
|
-
const
|
|
212
|
-
|
|
250
|
+
omnibusPriceEl: s,
|
|
251
|
+
omnibusDiscountEl: u,
|
|
252
|
+
buttonEl: c
|
|
253
|
+
} = t;
|
|
254
|
+
let d = !1;
|
|
255
|
+
if (n && "querySelector" in n) {
|
|
256
|
+
const f = n.querySelector("img");
|
|
257
|
+
f && (e.modifyHtml(f).setAttribute("src", G(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
258
|
+
const a = n.querySelector("a");
|
|
259
|
+
a && (e.modifyHtml(a).setAttribute("href", o.url), d = !0);
|
|
213
260
|
}
|
|
214
261
|
if (r && "querySelector" in r) {
|
|
215
|
-
const
|
|
216
|
-
|
|
262
|
+
const f = r.querySelector("strong") ?? r.querySelector("p");
|
|
263
|
+
S(e, f ?? null, o.name) && (d = !0);
|
|
217
264
|
}
|
|
218
|
-
if (
|
|
219
|
-
documentModifier:
|
|
220
|
-
product:
|
|
221
|
-
priceEl:
|
|
265
|
+
if ($({
|
|
266
|
+
documentModifier: e,
|
|
267
|
+
product: o,
|
|
268
|
+
priceEl: l,
|
|
222
269
|
oldPriceEl: i,
|
|
223
|
-
omnibusPriceEl:
|
|
224
|
-
omnibusDiscountEl:
|
|
225
|
-
}) && (
|
|
226
|
-
const
|
|
227
|
-
|
|
270
|
+
omnibusPriceEl: s,
|
|
271
|
+
omnibusDiscountEl: u
|
|
272
|
+
}) && (d = !0), c && "querySelector" in c) {
|
|
273
|
+
const f = c.querySelector("a.es-button") || c.querySelector("a");
|
|
274
|
+
f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
|
|
228
275
|
}
|
|
229
|
-
return
|
|
276
|
+
return d;
|
|
230
277
|
}
|
|
231
|
-
function
|
|
232
|
-
return "querySelector" in
|
|
278
|
+
function B(t) {
|
|
279
|
+
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
233
280
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
281
|
+
const N = "product_attribute.";
|
|
282
|
+
function re(t, e) {
|
|
283
|
+
var n;
|
|
284
|
+
let o;
|
|
285
|
+
if (t.startsWith(N)) {
|
|
286
|
+
const r = t.slice(N.length);
|
|
287
|
+
o = (n = e.product_attributes) == null ? void 0 : n[r];
|
|
240
288
|
} else
|
|
241
|
-
|
|
242
|
-
return
|
|
289
|
+
o = e[t];
|
|
290
|
+
return K(o) || null;
|
|
243
291
|
}
|
|
244
|
-
function
|
|
245
|
-
if (!("querySelectorAll" in
|
|
292
|
+
function ie(t, e, o) {
|
|
293
|
+
if (!("querySelectorAll" in t))
|
|
246
294
|
return !1;
|
|
247
|
-
const
|
|
295
|
+
const n = t.querySelectorAll(
|
|
248
296
|
`[esd-extension-block-id="${m.CUSTOM_ATTRIBUTE}"]`
|
|
249
297
|
);
|
|
250
|
-
if (
|
|
298
|
+
if (n.length === 0)
|
|
251
299
|
return !1;
|
|
252
300
|
const r = /* @__PURE__ */ new Map();
|
|
253
|
-
|
|
301
|
+
n.forEach((i) => {
|
|
254
302
|
if (!("getAttribute" in i))
|
|
255
303
|
return;
|
|
256
|
-
const
|
|
257
|
-
if (!
|
|
304
|
+
const s = i.getAttribute(V);
|
|
305
|
+
if (!s)
|
|
258
306
|
return;
|
|
259
|
-
const
|
|
260
|
-
|
|
307
|
+
const u = r.get(s) ?? [];
|
|
308
|
+
u.push(i), r.set(s, u);
|
|
261
309
|
});
|
|
262
|
-
let
|
|
263
|
-
return r.forEach((i,
|
|
264
|
-
const
|
|
265
|
-
i.slice(0,
|
|
266
|
-
if (!("querySelector" in
|
|
310
|
+
let l = !1;
|
|
311
|
+
return r.forEach((i, s) => {
|
|
312
|
+
const u = Math.min(i.length, o.length);
|
|
313
|
+
i.slice(0, u).forEach((c, d) => {
|
|
314
|
+
if (!("querySelector" in c))
|
|
267
315
|
return;
|
|
268
|
-
const
|
|
269
|
-
if (
|
|
316
|
+
const f = re(s, o[d]);
|
|
317
|
+
if (f === null)
|
|
270
318
|
return;
|
|
271
|
-
const
|
|
272
|
-
|
|
319
|
+
const a = c.querySelector("p") ?? null;
|
|
320
|
+
S(e, a, f) && (l = !0);
|
|
273
321
|
});
|
|
274
|
-
}),
|
|
322
|
+
}), l;
|
|
275
323
|
}
|
|
276
|
-
function
|
|
277
|
-
if (!("querySelectorAll" in
|
|
324
|
+
function O(t, e, o) {
|
|
325
|
+
if (!("querySelectorAll" in t))
|
|
278
326
|
return !1;
|
|
279
|
-
const
|
|
327
|
+
const n = t.querySelectorAll(
|
|
280
328
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
281
|
-
), r =
|
|
329
|
+
), r = t.querySelectorAll(
|
|
282
330
|
`[esd-extension-block-id="${m.NAME}"]`
|
|
283
|
-
),
|
|
331
|
+
), l = t.querySelectorAll(
|
|
284
332
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
285
|
-
), i =
|
|
333
|
+
), i = t.querySelectorAll(
|
|
286
334
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
287
|
-
),
|
|
335
|
+
), s = t.querySelectorAll(
|
|
288
336
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
289
|
-
),
|
|
337
|
+
), u = t.querySelectorAll(
|
|
290
338
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
291
|
-
),
|
|
339
|
+
), c = t.querySelectorAll(
|
|
292
340
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
293
|
-
),
|
|
294
|
-
let
|
|
295
|
-
for (let
|
|
296
|
-
const y =
|
|
297
|
-
documentModifier:
|
|
298
|
-
product:
|
|
299
|
-
imageEl:
|
|
300
|
-
nameEl: r[
|
|
301
|
-
priceEl:
|
|
302
|
-
oldPriceEl: i[
|
|
303
|
-
omnibusPriceEl:
|
|
304
|
-
omnibusDiscountEl:
|
|
305
|
-
buttonEl:
|
|
341
|
+
), d = Math.min(n.length, o.length);
|
|
342
|
+
let f = !1;
|
|
343
|
+
for (let a = 0; a < d; a++) {
|
|
344
|
+
const y = ne({
|
|
345
|
+
documentModifier: e,
|
|
346
|
+
product: o[a],
|
|
347
|
+
imageEl: n[a] ?? null,
|
|
348
|
+
nameEl: r[a] ?? null,
|
|
349
|
+
priceEl: l[a] ?? null,
|
|
350
|
+
oldPriceEl: i[a] ?? null,
|
|
351
|
+
omnibusPriceEl: s[a] ?? null,
|
|
352
|
+
omnibusDiscountEl: u[a] ?? null,
|
|
353
|
+
buttonEl: c[a] ?? null
|
|
306
354
|
});
|
|
307
|
-
|
|
355
|
+
f = f || y;
|
|
308
356
|
}
|
|
309
|
-
return
|
|
357
|
+
return ie(t, e, o) && (f = !0), f;
|
|
310
358
|
}
|
|
311
|
-
function
|
|
312
|
-
const { currentNode:
|
|
313
|
-
if (!
|
|
359
|
+
function Se(t) {
|
|
360
|
+
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
361
|
+
if (!e || !("querySelectorAll" in e))
|
|
314
362
|
return !1;
|
|
315
|
-
const r =
|
|
363
|
+
const r = B(e);
|
|
316
364
|
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
317
365
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
318
|
-
).length !==
|
|
366
|
+
).length !== n.length)
|
|
319
367
|
return !1;
|
|
320
|
-
let i =
|
|
321
|
-
const
|
|
322
|
-
if (
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
368
|
+
let i = O(r, o, n);
|
|
369
|
+
const s = E(e), u = b.getConfig(e);
|
|
370
|
+
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
371
|
+
const c = e.querySelector(q);
|
|
372
|
+
if (c) {
|
|
373
|
+
const d = O(
|
|
374
|
+
c,
|
|
375
|
+
o,
|
|
376
|
+
n
|
|
329
377
|
);
|
|
330
|
-
i = i ||
|
|
378
|
+
i = i || d;
|
|
331
379
|
}
|
|
332
380
|
}
|
|
333
|
-
return i &&
|
|
381
|
+
return i && o.apply(new p("Updated product content in-place")), !0;
|
|
334
382
|
}
|
|
335
|
-
function
|
|
336
|
-
if (!("querySelectorAll" in
|
|
383
|
+
function w(t, e, o) {
|
|
384
|
+
if (!("querySelectorAll" in t))
|
|
337
385
|
return !1;
|
|
338
|
-
const
|
|
386
|
+
const n = t.querySelectorAll(
|
|
339
387
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
340
|
-
), r =
|
|
388
|
+
), r = t.querySelectorAll(
|
|
341
389
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
342
|
-
),
|
|
390
|
+
), l = t.querySelectorAll(
|
|
343
391
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
344
|
-
), i =
|
|
392
|
+
), i = t.querySelectorAll(
|
|
345
393
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
346
|
-
),
|
|
347
|
-
let
|
|
348
|
-
for (let
|
|
349
|
-
|
|
350
|
-
documentModifier:
|
|
351
|
-
product:
|
|
352
|
-
priceEl:
|
|
353
|
-
oldPriceEl: r[
|
|
354
|
-
omnibusPriceEl:
|
|
355
|
-
omnibusDiscountEl: i[
|
|
356
|
-
}) && (
|
|
357
|
-
return
|
|
394
|
+
), s = Math.min(n.length, o.length);
|
|
395
|
+
let u = !1;
|
|
396
|
+
for (let c = 0; c < s; c++)
|
|
397
|
+
$({
|
|
398
|
+
documentModifier: e,
|
|
399
|
+
product: o[c],
|
|
400
|
+
priceEl: n[c] ?? null,
|
|
401
|
+
oldPriceEl: r[c] ?? null,
|
|
402
|
+
omnibusPriceEl: l[c] ?? null,
|
|
403
|
+
omnibusDiscountEl: i[c] ?? null
|
|
404
|
+
}) && (u = !0);
|
|
405
|
+
return u;
|
|
358
406
|
}
|
|
359
|
-
function be(
|
|
360
|
-
const { currentNode:
|
|
361
|
-
if (!
|
|
407
|
+
function be(t) {
|
|
408
|
+
const { currentNode: e, documentModifier: o } = t;
|
|
409
|
+
if (!e || !("querySelectorAll" in e))
|
|
362
410
|
return !1;
|
|
363
|
-
const r =
|
|
411
|
+
const r = C().recommendationProducts;
|
|
364
412
|
if (r.length === 0)
|
|
365
413
|
return !1;
|
|
366
|
-
const
|
|
367
|
-
let i =
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
const
|
|
371
|
-
if (
|
|
372
|
-
const
|
|
373
|
-
i = i ||
|
|
414
|
+
const l = B(e);
|
|
415
|
+
let i = w(l, o, r);
|
|
416
|
+
const s = E(e), u = b.getConfig(e);
|
|
417
|
+
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
418
|
+
const c = e.querySelector(q);
|
|
419
|
+
if (c) {
|
|
420
|
+
const d = w(c, o, r);
|
|
421
|
+
i = i || d;
|
|
374
422
|
}
|
|
375
423
|
}
|
|
376
|
-
return i &&
|
|
424
|
+
return i && o.apply(new p("Updated price formatting in-place")), i;
|
|
377
425
|
}
|
|
378
|
-
function
|
|
379
|
-
const { currentNode:
|
|
426
|
+
function Ee(t) {
|
|
427
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, r = T(e);
|
|
380
428
|
if (!r)
|
|
381
429
|
return;
|
|
382
|
-
const
|
|
383
|
-
|
|
430
|
+
const l = n.alignment === "before" ? "0" : "1", i = (s, u) => {
|
|
431
|
+
o.modifyHtml(r).setAttribute(s, u);
|
|
384
432
|
};
|
|
385
|
-
i(
|
|
433
|
+
i(g.CURRENCY, n.code), i(g.SYMBOL, n.symbol), i(g.ALIGNMENT, l), i(g.THOUSAND_SEPARATOR, n.thousandSeparator), i(g.DECIMAL_SEPARATOR, n.decimalSeparator), i(g.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
386
434
|
}
|
|
387
435
|
export {
|
|
388
|
-
|
|
436
|
+
ge as adjustProductsToSize,
|
|
389
437
|
A as formatProductPrice,
|
|
390
|
-
|
|
438
|
+
T as getBlockElement,
|
|
391
439
|
x as getCardComposition,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
440
|
+
E as getCurrentLayout,
|
|
441
|
+
te as reapplySpacing,
|
|
442
|
+
Z as regenerateMobileProductRows,
|
|
443
|
+
ee as regenerateProductRows,
|
|
444
|
+
ye as regenerateProductRowsWithStyles,
|
|
445
|
+
Ee as setCurrencyAttributes,
|
|
396
446
|
be as updatePricesInPlace,
|
|
397
|
-
|
|
398
|
-
|
|
447
|
+
Se as updateProductContentInPlace,
|
|
448
|
+
ne as updateSingleProductContent
|
|
399
449
|
};
|