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