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