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