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