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