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