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