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