@useinsider/guido 3.0.0-beta.a72fd61 → 3.0.0-beta.ae0075e
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/Guido.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
- package/dist/extensions/Blocks/Recommendation/block.js +3 -0
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +27 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +134 -126
- package/dist/extensions/Blocks/Recommendation/extension.js +18 -16
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +126 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +124 -106
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +8 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -33
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/variables.css.js +3 -0
- package/package.json +1 -1
|
@@ -1,36 +1,36 @@
|
|
|
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 { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as
|
|
4
|
-
import { RecommendationConfigService as
|
|
3
|
+
import { MOBILE_CONTAINER_SELECTOR as g, CURRENCY_ATTR as y, DESKTOP_CONTAINER_SELECTOR as A, CONTAINER_SELECTOR as $, MOBILE_ROW_SELECTOR as N } from "../../constants/selectors.js";
|
|
4
|
+
import { RecommendationConfigService as k } from "../../services/configService.js";
|
|
5
5
|
import { useRecommendationExtensionStore as E } from "../../store/recommendation.js";
|
|
6
|
-
import { prepareProductRows as
|
|
6
|
+
import { prepareProductRows as T } from "../../templates/index.js";
|
|
7
7
|
import { formatPrice as B } from "../../utils/priceFormatter.js";
|
|
8
8
|
import { isTdNode as v } from "../../utils/tagName.js";
|
|
9
|
-
import { getDefaultProducts as
|
|
10
|
-
const
|
|
11
|
-
function
|
|
9
|
+
import { getDefaultProducts as _, DEFAULT_CARD_COMPOSITION as M, sanitizeImageUrl as j } from "../../templates/utils.js";
|
|
10
|
+
const h = "recommendation-block-v2";
|
|
11
|
+
function P(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;
|
|
20
20
|
}
|
|
21
21
|
function b(t) {
|
|
22
|
-
const e =
|
|
22
|
+
const e = P(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
|
|
29
|
-
const e =
|
|
28
|
+
function x(t) {
|
|
29
|
+
const e = P(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
31
|
+
return M;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : M;
|
|
34
34
|
}
|
|
35
35
|
function S(t, e, o) {
|
|
36
36
|
if (!e || !("childNodes" in e))
|
|
@@ -40,41 +40,47 @@ function S(t, e, o) {
|
|
|
40
40
|
);
|
|
41
41
|
return r ? (t.modifyHtml(r).setText(o), !0) : !1;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
return t && t.length > 0 ? t : e.length > 0 ? e :
|
|
43
|
+
function D(t, e) {
|
|
44
|
+
return t && t.length > 0 ? t : e.length > 0 ? e : _();
|
|
45
45
|
}
|
|
46
46
|
function V(t) {
|
|
47
47
|
const { currentNode: e, documentModifier: o } = t;
|
|
48
48
|
if (!e || !("querySelector" in e))
|
|
49
49
|
return;
|
|
50
|
-
const n = e.querySelector(
|
|
50
|
+
const n = e.querySelector(N), r = e.querySelector(g);
|
|
51
51
|
n && o.modifyHtml(n).setStyle("display", "none"), r && o.modifyHtml(r).setInnerHtml(""), (n || r) && o.apply(new p("Hide mobile row for list layout"));
|
|
52
52
|
}
|
|
53
53
|
function W(t) {
|
|
54
54
|
const { currentNode: e, documentModifier: o } = t;
|
|
55
55
|
if (!e || !("querySelector" in e))
|
|
56
56
|
return;
|
|
57
|
-
const n = e.querySelector(
|
|
57
|
+
const n = e.querySelector(N);
|
|
58
58
|
n && o.modifyHtml(n).removeStyle("display").apply(new p("Show mobile row for grid layout"));
|
|
59
59
|
}
|
|
60
60
|
function G(t) {
|
|
61
|
-
const {
|
|
61
|
+
const {
|
|
62
|
+
currentNode: e,
|
|
63
|
+
documentModifier: o,
|
|
64
|
+
products: n,
|
|
65
|
+
layout: r,
|
|
66
|
+
composition: c
|
|
67
|
+
} = t;
|
|
62
68
|
if (!e || !("querySelector" in e))
|
|
63
69
|
return;
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
70
|
+
const i = r ?? b(e);
|
|
71
|
+
if (i === "list") {
|
|
66
72
|
V({ currentNode: e, documentModifier: o });
|
|
67
73
|
return;
|
|
68
74
|
}
|
|
69
75
|
W({ currentNode: e, documentModifier: o });
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
76
|
+
const u = e.querySelector(g);
|
|
77
|
+
if (!u)
|
|
72
78
|
return;
|
|
73
|
-
const s = E(),
|
|
74
|
-
productsPerRow:
|
|
75
|
-
composition:
|
|
79
|
+
const s = E(), l = k.getConfig(e), f = D(n, s.recommendationProducts), d = c ?? x(e), a = T(f, i, {
|
|
80
|
+
productsPerRow: l.mobileCardsInRow,
|
|
81
|
+
composition: d
|
|
76
82
|
});
|
|
77
|
-
o.modifyHtml(
|
|
83
|
+
o.modifyHtml(u).setInnerHtml(a).apply(new p("Updated mobile product rows"));
|
|
78
84
|
}
|
|
79
85
|
function Y(t) {
|
|
80
86
|
const {
|
|
@@ -82,34 +88,35 @@ function Y(t) {
|
|
|
82
88
|
documentModifier: o,
|
|
83
89
|
afterRegenerate: n,
|
|
84
90
|
products: r,
|
|
85
|
-
layout: c
|
|
91
|
+
layout: c,
|
|
92
|
+
composition: i
|
|
86
93
|
} = t;
|
|
87
94
|
if (!e || !("querySelector" in e))
|
|
88
95
|
return;
|
|
89
|
-
const
|
|
90
|
-
if (!
|
|
96
|
+
const u = e.querySelector(A) ?? e.querySelector($);
|
|
97
|
+
if (!u)
|
|
91
98
|
return;
|
|
92
|
-
const s = E(),
|
|
93
|
-
productsPerRow:
|
|
94
|
-
composition:
|
|
99
|
+
const s = E(), l = D(r, s.recommendationProducts), { cardsInRow: f } = s.recommendationConfigs, d = i ?? x(e), a = c ?? b(e), C = T(l, a, {
|
|
100
|
+
productsPerRow: f,
|
|
101
|
+
composition: d
|
|
95
102
|
});
|
|
96
|
-
o.modifyHtml(
|
|
103
|
+
o.modifyHtml(u).setInnerHtml(C).apply(new p("Updated product")), G(t), n == null || n();
|
|
97
104
|
}
|
|
98
|
-
function
|
|
105
|
+
function R(t, e, o, n) {
|
|
99
106
|
const c = `0 ${Math.floor(o / 2)}px`;
|
|
100
107
|
let i = !1;
|
|
101
108
|
return n === "grid" ? Array.from(
|
|
102
109
|
t.querySelectorAll(".attribute-cell")
|
|
103
|
-
).forEach((
|
|
104
|
-
e.modifyHtml(
|
|
110
|
+
).forEach((s) => {
|
|
111
|
+
e.modifyHtml(s).setStyle("padding", c), i = !0;
|
|
105
112
|
}) : Array.from(
|
|
106
113
|
t.querySelectorAll(".product-card-wrapper")
|
|
107
|
-
).forEach((
|
|
108
|
-
const l = "parentNode" in
|
|
114
|
+
).forEach((s) => {
|
|
115
|
+
const l = "parentNode" in s ? s.parentNode : null;
|
|
109
116
|
l && v(l) && (e.modifyHtml(l).setStyle("padding", c), i = !0);
|
|
110
117
|
}), i;
|
|
111
118
|
}
|
|
112
|
-
function
|
|
119
|
+
function I(t, e, o) {
|
|
113
120
|
const n = `${o}px`, r = Array.from(t.querySelectorAll(".spacer"));
|
|
114
121
|
let c = !1;
|
|
115
122
|
return r.forEach((i) => {
|
|
@@ -120,34 +127,34 @@ function F(t) {
|
|
|
120
127
|
const { currentNode: e, documentModifier: o } = t;
|
|
121
128
|
if (!e)
|
|
122
129
|
return;
|
|
123
|
-
const n =
|
|
130
|
+
const n = k.getConfig(e), r = b(e);
|
|
124
131
|
let c = !1;
|
|
125
|
-
const i = e.querySelector(
|
|
132
|
+
const i = e.querySelector(A);
|
|
126
133
|
if (i) {
|
|
127
|
-
c =
|
|
134
|
+
c = R(
|
|
128
135
|
i,
|
|
129
136
|
o,
|
|
130
137
|
n.columnSpacing,
|
|
131
138
|
r
|
|
132
139
|
);
|
|
133
|
-
const l =
|
|
140
|
+
const l = I(
|
|
134
141
|
i,
|
|
135
142
|
o,
|
|
136
143
|
n.rowSpacing
|
|
137
144
|
);
|
|
138
145
|
c = c || l;
|
|
139
146
|
}
|
|
140
|
-
const
|
|
141
|
-
if (
|
|
142
|
-
const
|
|
143
|
-
|
|
147
|
+
const u = e.querySelector(g);
|
|
148
|
+
if (u) {
|
|
149
|
+
const s = R(
|
|
150
|
+
u,
|
|
144
151
|
o,
|
|
145
152
|
n.mobileColumnSpacing,
|
|
146
153
|
r
|
|
147
154
|
);
|
|
148
|
-
c = c ||
|
|
149
|
-
const l =
|
|
150
|
-
|
|
155
|
+
c = c || s;
|
|
156
|
+
const l = I(
|
|
157
|
+
u,
|
|
151
158
|
o,
|
|
152
159
|
n.mobileRowSpacing
|
|
153
160
|
);
|
|
@@ -156,12 +163,13 @@ function F(t) {
|
|
|
156
163
|
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
157
164
|
}
|
|
158
165
|
function ie(t) {
|
|
159
|
-
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: c } = t;
|
|
166
|
+
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: r, layout: c, composition: i } = t;
|
|
160
167
|
e && Y({
|
|
161
168
|
currentNode: e,
|
|
162
169
|
documentModifier: o,
|
|
163
170
|
products: r,
|
|
164
171
|
layout: c,
|
|
172
|
+
composition: i,
|
|
165
173
|
afterRegenerate: () => {
|
|
166
174
|
setTimeout(() => {
|
|
167
175
|
F({ currentNode: e, documentModifier: o });
|
|
@@ -170,9 +178,9 @@ function ie(t) {
|
|
|
170
178
|
});
|
|
171
179
|
}
|
|
172
180
|
function ce(t, e) {
|
|
173
|
-
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...
|
|
181
|
+
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ..._(e - t.length)];
|
|
174
182
|
}
|
|
175
|
-
function
|
|
183
|
+
function H() {
|
|
176
184
|
const t = E(), { currencySettings: e } = t.recommendationConfigs, o = parseInt(e.decimalCount);
|
|
177
185
|
return {
|
|
178
186
|
code: e.value,
|
|
@@ -183,8 +191,8 @@ function D() {
|
|
|
183
191
|
thousandSeparator: e.thousandSeparator
|
|
184
192
|
};
|
|
185
193
|
}
|
|
186
|
-
function
|
|
187
|
-
const o =
|
|
194
|
+
function q(t, e = "price") {
|
|
195
|
+
const o = H(), n = t[e], r = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
188
196
|
return B({
|
|
189
197
|
price: r,
|
|
190
198
|
currency: o
|
|
@@ -192,29 +200,29 @@ function C(t, e = "price") {
|
|
|
192
200
|
}
|
|
193
201
|
function K(t) {
|
|
194
202
|
var c, i;
|
|
195
|
-
const e =
|
|
203
|
+
const e = H(), o = ((c = t.original_price) == null ? void 0 : c[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;
|
|
196
204
|
return r > 0 ? `-${r}%` : "0%";
|
|
197
205
|
}
|
|
198
|
-
function
|
|
206
|
+
function L(t) {
|
|
199
207
|
const { documentModifier: e, product: o, priceEl: n, oldPriceEl: r, omnibusPriceEl: c, omnibusDiscountEl: i } = t;
|
|
200
|
-
let
|
|
208
|
+
let u = !1;
|
|
201
209
|
if (n && "querySelector" in n) {
|
|
202
|
-
const
|
|
203
|
-
S(e,
|
|
210
|
+
const s = n.querySelector("strong"), l = q(o, "price");
|
|
211
|
+
S(e, s, l) && (u = !0);
|
|
204
212
|
}
|
|
205
213
|
if (r && "querySelector" in r) {
|
|
206
|
-
const
|
|
207
|
-
S(e,
|
|
214
|
+
const s = r.querySelector("strong"), l = q(o, "original_price");
|
|
215
|
+
S(e, s, l) && (u = !0);
|
|
208
216
|
}
|
|
209
217
|
if (c && "querySelector" in c) {
|
|
210
|
-
const
|
|
211
|
-
S(e,
|
|
218
|
+
const s = c.querySelector(".omnibus-price-value"), l = q(o, "original_price");
|
|
219
|
+
S(e, s, l) && (u = !0);
|
|
212
220
|
}
|
|
213
221
|
if (i && "querySelector" in i) {
|
|
214
|
-
const
|
|
215
|
-
S(e,
|
|
222
|
+
const s = i.querySelector(".omnibus-discount-value"), l = K(o);
|
|
223
|
+
S(e, s, l) && (u = !0);
|
|
216
224
|
}
|
|
217
|
-
return
|
|
225
|
+
return u;
|
|
218
226
|
}
|
|
219
227
|
function z(t) {
|
|
220
228
|
const {
|
|
@@ -224,38 +232,38 @@ function z(t) {
|
|
|
224
232
|
nameEl: r,
|
|
225
233
|
priceEl: c,
|
|
226
234
|
oldPriceEl: i,
|
|
227
|
-
omnibusPriceEl:
|
|
228
|
-
omnibusDiscountEl:
|
|
235
|
+
omnibusPriceEl: u,
|
|
236
|
+
omnibusDiscountEl: s,
|
|
229
237
|
buttonEl: l
|
|
230
238
|
} = t;
|
|
231
239
|
let f = !1;
|
|
232
240
|
if (n && "querySelector" in n) {
|
|
233
|
-
const
|
|
234
|
-
|
|
235
|
-
const
|
|
236
|
-
|
|
241
|
+
const d = n.querySelector("img");
|
|
242
|
+
d && (e.modifyHtml(d).setAttribute("src", j(o.image_url)).setAttribute("alt", o.name), f = !0);
|
|
243
|
+
const a = n.querySelector("a");
|
|
244
|
+
a && (e.modifyHtml(a).setAttribute("href", o.url), f = !0);
|
|
237
245
|
}
|
|
238
246
|
if (r && "querySelector" in r) {
|
|
239
|
-
const
|
|
240
|
-
S(e,
|
|
247
|
+
const d = r.querySelector("strong");
|
|
248
|
+
S(e, d, o.name) && (f = !0);
|
|
241
249
|
}
|
|
242
|
-
if (
|
|
250
|
+
if (L({
|
|
243
251
|
documentModifier: e,
|
|
244
252
|
product: o,
|
|
245
253
|
priceEl: c,
|
|
246
254
|
oldPriceEl: i,
|
|
247
|
-
omnibusPriceEl:
|
|
248
|
-
omnibusDiscountEl:
|
|
255
|
+
omnibusPriceEl: u,
|
|
256
|
+
omnibusDiscountEl: s
|
|
249
257
|
}) && (f = !0), l && "querySelector" in l) {
|
|
250
|
-
const
|
|
251
|
-
|
|
258
|
+
const d = l.querySelector("a.es-button") || l.querySelector("a");
|
|
259
|
+
d && (e.modifyHtml(d).setAttribute("href", o.url), f = !0);
|
|
252
260
|
}
|
|
253
261
|
return f;
|
|
254
262
|
}
|
|
255
|
-
function
|
|
256
|
-
return "querySelector" in t ? t.querySelector(
|
|
263
|
+
function U(t) {
|
|
264
|
+
return "querySelector" in t ? t.querySelector(A) ?? t : t;
|
|
257
265
|
}
|
|
258
|
-
function
|
|
266
|
+
function w(t, e, o) {
|
|
259
267
|
if (!("querySelectorAll" in t))
|
|
260
268
|
return !1;
|
|
261
269
|
const n = t.querySelectorAll(
|
|
@@ -266,45 +274,45 @@ function I(t, e, o) {
|
|
|
266
274
|
`[esd-extension-block-id="${m.PRICE}"]`
|
|
267
275
|
), i = t.querySelectorAll(
|
|
268
276
|
`[esd-extension-block-id="${m.OLD_PRICE}"]`
|
|
269
|
-
), s = t.querySelectorAll(
|
|
270
|
-
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
271
277
|
), u = t.querySelectorAll(
|
|
278
|
+
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
279
|
+
), s = t.querySelectorAll(
|
|
272
280
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
273
281
|
), l = t.querySelectorAll(
|
|
274
282
|
`[esd-extension-block-id="${m.BUTTON}"]`
|
|
275
283
|
), f = Math.min(n.length, o.length);
|
|
276
|
-
let
|
|
277
|
-
for (let
|
|
278
|
-
const
|
|
284
|
+
let d = !1;
|
|
285
|
+
for (let a = 0; a < f; a++) {
|
|
286
|
+
const C = z({
|
|
279
287
|
documentModifier: e,
|
|
280
|
-
product: o[
|
|
281
|
-
imageEl: n[
|
|
282
|
-
nameEl: r[
|
|
283
|
-
priceEl: c[
|
|
284
|
-
oldPriceEl: i[
|
|
285
|
-
omnibusPriceEl:
|
|
286
|
-
omnibusDiscountEl:
|
|
287
|
-
buttonEl: l[
|
|
288
|
+
product: o[a],
|
|
289
|
+
imageEl: n[a] ?? null,
|
|
290
|
+
nameEl: r[a] ?? null,
|
|
291
|
+
priceEl: c[a] ?? null,
|
|
292
|
+
oldPriceEl: i[a] ?? null,
|
|
293
|
+
omnibusPriceEl: u[a] ?? null,
|
|
294
|
+
omnibusDiscountEl: s[a] ?? null,
|
|
295
|
+
buttonEl: l[a] ?? null
|
|
288
296
|
});
|
|
289
|
-
|
|
297
|
+
d = d || C;
|
|
290
298
|
}
|
|
291
|
-
return
|
|
299
|
+
return d;
|
|
292
300
|
}
|
|
293
301
|
function le(t) {
|
|
294
302
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
295
303
|
if (!e || !("querySelectorAll" in e))
|
|
296
304
|
return !1;
|
|
297
|
-
const r =
|
|
305
|
+
const r = U(e);
|
|
298
306
|
if (!("querySelectorAll" in r) || r.querySelectorAll(
|
|
299
307
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
300
308
|
).length !== n.length)
|
|
301
309
|
return !1;
|
|
302
|
-
let i =
|
|
310
|
+
let i = w(r, o, n);
|
|
303
311
|
if (b(e) !== "list" && "querySelector" in e) {
|
|
304
|
-
const
|
|
305
|
-
if (
|
|
306
|
-
const l =
|
|
307
|
-
|
|
312
|
+
const s = e.querySelector(g);
|
|
313
|
+
if (s) {
|
|
314
|
+
const l = w(
|
|
315
|
+
s,
|
|
308
316
|
o,
|
|
309
317
|
n
|
|
310
318
|
);
|
|
@@ -313,7 +321,7 @@ function le(t) {
|
|
|
313
321
|
}
|
|
314
322
|
return i && o.apply(new p("Updated product content in-place")), !0;
|
|
315
323
|
}
|
|
316
|
-
function
|
|
324
|
+
function O(t, e, o) {
|
|
317
325
|
if (!("querySelectorAll" in t))
|
|
318
326
|
return !1;
|
|
319
327
|
const n = t.querySelectorAll(
|
|
@@ -324,58 +332,58 @@ function w(t, e, o) {
|
|
|
324
332
|
`[esd-extension-block-id="${m.OMNIBUS_PRICE}"]`
|
|
325
333
|
), i = t.querySelectorAll(
|
|
326
334
|
`[esd-extension-block-id="${m.OMNIBUS_DISCOUNT}"]`
|
|
327
|
-
),
|
|
328
|
-
let
|
|
329
|
-
for (let l = 0; l <
|
|
330
|
-
|
|
335
|
+
), u = Math.min(n.length, o.length);
|
|
336
|
+
let s = !1;
|
|
337
|
+
for (let l = 0; l < u; l++)
|
|
338
|
+
L({
|
|
331
339
|
documentModifier: e,
|
|
332
340
|
product: o[l],
|
|
333
341
|
priceEl: n[l] ?? null,
|
|
334
342
|
oldPriceEl: r[l] ?? null,
|
|
335
343
|
omnibusPriceEl: c[l] ?? null,
|
|
336
344
|
omnibusDiscountEl: i[l] ?? null
|
|
337
|
-
}) && (
|
|
338
|
-
return
|
|
345
|
+
}) && (s = !0);
|
|
346
|
+
return s;
|
|
339
347
|
}
|
|
340
|
-
function
|
|
348
|
+
function se(t) {
|
|
341
349
|
const { currentNode: e, documentModifier: o } = t;
|
|
342
350
|
if (!e || !("querySelectorAll" in e))
|
|
343
351
|
return !1;
|
|
344
352
|
const r = E().recommendationProducts;
|
|
345
353
|
if (r.length === 0)
|
|
346
354
|
return !1;
|
|
347
|
-
const c =
|
|
348
|
-
let i =
|
|
355
|
+
const c = U(e);
|
|
356
|
+
let i = O(c, o, r);
|
|
349
357
|
if (b(e) !== "list" && "querySelector" in e) {
|
|
350
|
-
const
|
|
351
|
-
if (
|
|
352
|
-
const l =
|
|
358
|
+
const s = e.querySelector(g);
|
|
359
|
+
if (s) {
|
|
360
|
+
const l = O(s, o, r);
|
|
353
361
|
i = i || l;
|
|
354
362
|
}
|
|
355
363
|
}
|
|
356
364
|
return i && o.apply(new p("Updated price formatting in-place")), i;
|
|
357
365
|
}
|
|
358
|
-
function
|
|
359
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, r =
|
|
366
|
+
function ue(t) {
|
|
367
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, r = P(e);
|
|
360
368
|
if (!r)
|
|
361
369
|
return;
|
|
362
|
-
const c = n.alignment === "before" ? "0" : "1", i = (
|
|
363
|
-
o.modifyHtml(r).setAttribute(
|
|
370
|
+
const c = n.alignment === "before" ? "0" : "1", i = (u, s) => {
|
|
371
|
+
o.modifyHtml(r).setAttribute(u, s);
|
|
364
372
|
};
|
|
365
373
|
i(y.CURRENCY, n.code), i(y.SYMBOL, n.symbol), i(y.ALIGNMENT, c), i(y.THOUSAND_SEPARATOR, n.thousandSeparator), i(y.DECIMAL_SEPARATOR, n.decimalSeparator), i(y.DECIMAL_COUNT, n.decimalCount.toString()), o.apply(new p("Update currency attributes"));
|
|
366
374
|
}
|
|
367
375
|
export {
|
|
368
376
|
ce as adjustProductsToSize,
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
377
|
+
q as formatProductPrice,
|
|
378
|
+
P as getBlockElement,
|
|
379
|
+
x as getCardComposition,
|
|
372
380
|
b as getCurrentLayout,
|
|
373
381
|
F as reapplySpacing,
|
|
374
382
|
G as regenerateMobileProductRows,
|
|
375
383
|
Y as regenerateProductRows,
|
|
376
384
|
ie as regenerateProductRowsWithStyles,
|
|
377
|
-
|
|
378
|
-
|
|
385
|
+
ue as setCurrencyAttributes,
|
|
386
|
+
se as updatePricesInPlace,
|
|
379
387
|
le as updateProductContentInPlace,
|
|
380
388
|
z as updateSingleProductContent
|
|
381
389
|
};
|
|
@@ -8,35 +8,37 @@ import { OldPriceControls as l } from "./controls/oldPrice/index.js";
|
|
|
8
8
|
import { OmnibusPriceControls as s } from "./controls/omnibusPrice/index.js";
|
|
9
9
|
import { OmnibusDiscountControls as a } from "./controls/omnibusDiscount/index.js";
|
|
10
10
|
import { ButtonControls as p } from "./controls/button/index.js";
|
|
11
|
-
import { ImageControls as
|
|
12
|
-
import {
|
|
11
|
+
import { ImageControls as C } from "./controls/image/index.js";
|
|
12
|
+
import { CustomAttributeControls as c } from "./controls/customAttribute/index.js";
|
|
13
|
+
import { SpacingControl as f } from "./controls/spacing/index.js";
|
|
13
14
|
import { CardBackgroundColorControl as d } from "./controls/cardBackground/index.js";
|
|
14
|
-
import { LayoutControl as
|
|
15
|
-
import { RecommendationCardCompositionControl as
|
|
16
|
-
import { RecommendationIconsRegistry as
|
|
17
|
-
import
|
|
18
|
-
import { SettingsPanel as
|
|
19
|
-
const
|
|
15
|
+
import { LayoutControl as u } from "./controls/layout/index.js";
|
|
16
|
+
import { RecommendationCardCompositionControl as g } from "./controls/cardComposition/index.js";
|
|
17
|
+
import { RecommendationIconsRegistry as R } from "./iconsRegistry.js";
|
|
18
|
+
import y from "./recommendation.css.js";
|
|
19
|
+
import { SettingsPanel as B } from "./settingsPanel.js";
|
|
20
|
+
const b = [
|
|
20
21
|
i,
|
|
21
22
|
e,
|
|
22
23
|
l,
|
|
23
24
|
s,
|
|
24
25
|
a,
|
|
25
26
|
p,
|
|
27
|
+
C,
|
|
26
28
|
c
|
|
27
29
|
], P = [
|
|
28
30
|
n,
|
|
29
31
|
d,
|
|
32
|
+
u,
|
|
30
33
|
f,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
], b = [
|
|
34
|
+
g
|
|
35
|
+
], k = [
|
|
34
36
|
...P,
|
|
35
|
-
...
|
|
36
|
-
],
|
|
37
|
+
...b.flatMap((o) => Object.values(o))
|
|
38
|
+
], J = k.reduce(
|
|
37
39
|
(o, t) => o.addControl(t),
|
|
38
|
-
new r().addBlock(m).withSettingsPanelRegistry(
|
|
39
|
-
).addStyles(
|
|
40
|
+
new r().addBlock(m).withSettingsPanelRegistry(B)
|
|
41
|
+
).addStyles(y).withIconsRegistry(R).build();
|
|
40
42
|
export {
|
|
41
|
-
|
|
43
|
+
J as default
|
|
42
44
|
};
|