@useinsider/guido 3.7.0-beta.24bdfa3 → 3.7.0-beta.30ff65e
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/@types/config/schemas.js +66 -70
- package/dist/composables/usePreviewMode.js +14 -15
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +82 -90
- package/dist/config/migrator/recommendation/htmlBuilder.js +58 -59
- package/dist/config/migrator/recommendation/settingsMapper.js +33 -38
- package/dist/extensions/Blocks/Recommendation/block.js +43 -59
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +32 -41
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +313 -377
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +72 -84
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +66 -68
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +7 -21
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +4 -64
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +5 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +72 -101
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -31
- package/dist/extensions/Blocks/Recommendation/templates/index.js +7 -9
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +59 -74
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +21 -21
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +57 -88
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -10
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +3 -29
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +1 -3
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +0 -16
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +0 -13
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +2 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +1 -33
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -15
- package/dist/src/stores/config.d.ts +0 -36
- package/package.json +1 -1
- package/dist/composables/useRecommendationPreview.js +0 -100
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +0 -133
- package/dist/src/composables/useRecommendationPreview.d.ts +0 -10
- package/dist/src/composables/useRecommendationPreview.test.d.ts +0 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +0 -59
|
@@ -1,33 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var p = (d,
|
|
3
|
-
var s = (d,
|
|
1
|
+
var C = Object.defineProperty;
|
|
2
|
+
var p = (d, c, t) => c in d ? C(d, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : d[c] = t;
|
|
3
|
+
var s = (d, c, t) => p(d, typeof c != "symbol" ? c + "" : c, t);
|
|
4
4
|
import { CommonControl as g } from "../../../common-control.js";
|
|
5
|
-
import { DEFAULT_NODE_CONFIG as
|
|
6
|
-
import { RecommendationConfigService as
|
|
5
|
+
import { DEFAULT_NODE_CONFIG as a } from "../../constants/defaultConfig.js";
|
|
6
|
+
import { RecommendationConfigService as h } from "../../services/configService.js";
|
|
7
7
|
import { useRecommendationExtensionStore as y } from "../../store/recommendation.js";
|
|
8
8
|
import { AlgorithmControl as N } from "./algorithm.js";
|
|
9
|
-
import { ALGORITHM_CONTROL_ID as
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
|
|
10
10
|
import { CurrencyControl as R } from "./currency.js";
|
|
11
|
-
import { CURRENCY_CONTROL_ID as
|
|
11
|
+
import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
|
|
12
12
|
import { FiltersControl as _ } from "./filters.js";
|
|
13
|
-
import { FILTERS_CONTROL_ID as
|
|
13
|
+
import { FILTERS_CONTROL_ID as et } from "./filters.js";
|
|
14
14
|
import { LayoutOrientationControl as b } from "./layoutOrientation.js";
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
16
|
-
import { LocaleControl as
|
|
17
|
-
import { LOCALE_CONTROL_ID as
|
|
18
|
-
import { PricePlacementControl as T } from "./pricePlacement.js";
|
|
19
|
-
import { PRICE_PLACEMENT_CONTROL_ID as at } from "./pricePlacement.js";
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
|
|
16
|
+
import { LocaleControl as O } from "./locale.js";
|
|
17
|
+
import { LOCALE_CONTROL_ID as it } from "./locale.js";
|
|
20
18
|
import { ProductCountControl as I } from "./productCount.js";
|
|
21
|
-
import { PRODUCT_COUNT_CONTROL_ID as
|
|
22
|
-
import { ProductLayoutControl as
|
|
23
|
-
import { PRODUCT_LAYOUT_CONTROL_ID as
|
|
24
|
-
import { ShuffleControl as
|
|
25
|
-
import { SHUFFLE_CONTROL_ID as
|
|
26
|
-
import { setCurrencyAttributes as
|
|
27
|
-
import { adjustProductsToSize as
|
|
28
|
-
import { useDebounceFn as
|
|
29
|
-
const
|
|
30
|
-
class
|
|
19
|
+
import { PRODUCT_COUNT_CONTROL_ID as at } from "./productCount.js";
|
|
20
|
+
import { ProductLayoutControl as T } from "./productLayout.js";
|
|
21
|
+
import { PRODUCT_LAYOUT_CONTROL_ID as lt } from "./productLayout.js";
|
|
22
|
+
import { ShuffleControl as S } from "./shuffle.js";
|
|
23
|
+
import { SHUFFLE_CONTROL_ID as dt } from "./shuffle.js";
|
|
24
|
+
import { setCurrencyAttributes as L, getBlockElement as P, updateProductContentInPlace as D, regenerateProductRowsWithStyles as k } from "./utils.js";
|
|
25
|
+
import { adjustProductsToSize as mt, formatProductPrice as ft, getCardComposition as Ct, getCurrentLayout as pt, reapplySpacing as gt, regenerateMobileProductRows as yt, regenerateProductRows as Nt, updatePricesInPlace as Rt, updateSingleProductContent as _t } from "./utils.js";
|
|
26
|
+
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
27
|
+
const E = "recommendation-id", v = "ui-elements-recommendation-block";
|
|
28
|
+
class K extends g {
|
|
31
29
|
constructor() {
|
|
32
30
|
super(...arguments);
|
|
33
31
|
s(this, "store", y());
|
|
@@ -41,12 +39,11 @@ class J extends g {
|
|
|
41
39
|
s(this, "productLayoutControl", null);
|
|
42
40
|
s(this, "filtersControl", null);
|
|
43
41
|
s(this, "shuffleControl", null);
|
|
44
|
-
s(this, "pricePlacementControl", null);
|
|
45
42
|
s(this, "layoutOrientationControl", null);
|
|
46
43
|
/**
|
|
47
44
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
48
45
|
*/
|
|
49
|
-
s(this, "_debouncedFetchProducts",
|
|
46
|
+
s(this, "_debouncedFetchProducts", m(() => {
|
|
50
47
|
this.store.fetchRecommendationProducts();
|
|
51
48
|
}, 500));
|
|
52
49
|
/**
|
|
@@ -60,12 +57,12 @@ class J extends g {
|
|
|
60
57
|
* count. The store pads products to the configured size, so in-place only
|
|
61
58
|
* fails when the size actually changed.
|
|
62
59
|
*/
|
|
63
|
-
s(this, "_debouncedRegenerateWithProducts",
|
|
60
|
+
s(this, "_debouncedRegenerateWithProducts", m(() => {
|
|
64
61
|
const t = this.store.recommendationProducts;
|
|
65
62
|
if (!this.currentNode || !this.api)
|
|
66
63
|
return;
|
|
67
64
|
const e = this.api.getDocumentModifier();
|
|
68
|
-
|
|
65
|
+
D({
|
|
69
66
|
currentNode: this.currentNode,
|
|
70
67
|
documentModifier: e,
|
|
71
68
|
products: t
|
|
@@ -80,7 +77,7 @@ class J extends g {
|
|
|
80
77
|
return v;
|
|
81
78
|
}
|
|
82
79
|
getTemplate() {
|
|
83
|
-
return this.algorithmControl = new N(), this.localeControl = new
|
|
80
|
+
return this.algorithmControl = new N(), this.localeControl = new O(), this.currencyControl = new R(), this.productCountControl = new I(), this.productLayoutControl = new T(), this.filtersControl = new _(), this.shuffleControl = new S(), this.layoutOrientationControl = new b(), [
|
|
84
81
|
this.algorithmControl,
|
|
85
82
|
this.localeControl,
|
|
86
83
|
this.currencyControl,
|
|
@@ -88,7 +85,6 @@ class J extends g {
|
|
|
88
85
|
this.productLayoutControl,
|
|
89
86
|
this.filtersControl,
|
|
90
87
|
this.shuffleControl,
|
|
91
|
-
this.pricePlacementControl,
|
|
92
88
|
this.layoutOrientationControl
|
|
93
89
|
].forEach((e) => {
|
|
94
90
|
e.api = this.api;
|
|
@@ -99,7 +95,6 @@ class J extends g {
|
|
|
99
95
|
${this.productLayoutControl.getTemplate()}
|
|
100
96
|
${this.algorithmControl.getTemplate()}
|
|
101
97
|
${this.localeControl.getTemplate()}
|
|
102
|
-
${this.pricePlacementControl.getTemplate()}
|
|
103
98
|
${this.currencyControl.getTemplate()}
|
|
104
99
|
${this.filtersControl.getTemplate()}
|
|
105
100
|
${this.shuffleControl.getTemplate()}
|
|
@@ -129,8 +124,7 @@ class J extends g {
|
|
|
129
124
|
this.currencyControl,
|
|
130
125
|
this.productLayoutControl,
|
|
131
126
|
this.filtersControl,
|
|
132
|
-
this.shuffleControl
|
|
133
|
-
this.pricePlacementControl
|
|
127
|
+
this.shuffleControl
|
|
134
128
|
].forEach((n) => {
|
|
135
129
|
var i;
|
|
136
130
|
n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
|
|
@@ -145,8 +139,7 @@ class J extends g {
|
|
|
145
139
|
this.currencyControl,
|
|
146
140
|
this.productLayoutControl,
|
|
147
141
|
this.filtersControl,
|
|
148
|
-
this.shuffleControl
|
|
149
|
-
this.pricePlacementControl
|
|
142
|
+
this.shuffleControl
|
|
150
143
|
].forEach((e) => {
|
|
151
144
|
var o;
|
|
152
145
|
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
@@ -165,8 +158,7 @@ class J extends g {
|
|
|
165
158
|
this.currencyControl,
|
|
166
159
|
this.productLayoutControl,
|
|
167
160
|
this.filtersControl,
|
|
168
|
-
this.shuffleControl
|
|
169
|
-
this.pricePlacementControl
|
|
161
|
+
this.shuffleControl
|
|
170
162
|
].forEach((e) => {
|
|
171
163
|
var o;
|
|
172
164
|
e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
|
|
@@ -185,7 +177,7 @@ class J extends g {
|
|
|
185
177
|
*/
|
|
186
178
|
_syncNodeConfigToStore() {
|
|
187
179
|
var r;
|
|
188
|
-
const t =
|
|
180
|
+
const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
189
181
|
this.store.patchCurrentBlockConfig({
|
|
190
182
|
strategy: t.strategy,
|
|
191
183
|
language: t.language,
|
|
@@ -196,8 +188,6 @@ class J extends g {
|
|
|
196
188
|
// for filters (edited via the filter drawer).
|
|
197
189
|
...o ? {} : { filters: t.filters },
|
|
198
190
|
shuffleProducts: t.shuffleProducts,
|
|
199
|
-
priceMovedToNextLine: t.priceMovedToNextLine,
|
|
200
|
-
priceHideIfSameAsDiscounted: t.priceHideIfSameAsDiscounted,
|
|
201
191
|
currencySettings: {
|
|
202
192
|
name: t.currency.code,
|
|
203
193
|
value: t.currency.code,
|
|
@@ -244,36 +234,36 @@ class J extends g {
|
|
|
244
234
|
_applySmartDefaults() {
|
|
245
235
|
if (!this.currentNode || !this.api)
|
|
246
236
|
return;
|
|
247
|
-
const t =
|
|
237
|
+
const t = h.getConfig(this.currentNode), e = {};
|
|
248
238
|
let o = null, r = null, n = null;
|
|
249
|
-
if (t.currency.code ===
|
|
239
|
+
if (t.currency.code === a.currency.code) {
|
|
250
240
|
const { currencyList: i } = this.store;
|
|
251
241
|
i.length > 0 && (i.some(
|
|
252
|
-
(u) => u.value === `price.${
|
|
242
|
+
(u) => u.value === `price.${a.currency.code}`
|
|
253
243
|
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
254
|
-
...
|
|
244
|
+
...a.currency,
|
|
255
245
|
code: o,
|
|
256
246
|
symbol: o
|
|
257
247
|
}));
|
|
258
248
|
}
|
|
259
|
-
if (t.strategy ===
|
|
249
|
+
if (t.strategy === a.strategy) {
|
|
260
250
|
const i = this.store.getActivePredictiveAlgorithms;
|
|
261
251
|
i.length > 0 && (i.some(
|
|
262
|
-
(u) => u.value ===
|
|
252
|
+
(u) => u.value === a.strategy
|
|
263
253
|
) || (r = i[0].value, e.strategy = r));
|
|
264
254
|
}
|
|
265
|
-
if (t.language ===
|
|
255
|
+
if (t.language === a.language) {
|
|
266
256
|
const i = this.store.getLanguages;
|
|
267
257
|
i.length > 0 && (i.some(
|
|
268
|
-
(u) => u.value ===
|
|
258
|
+
(u) => u.value === a.language
|
|
269
259
|
) || (n = i[0].value, e.language = n));
|
|
270
260
|
}
|
|
271
|
-
!o && !r && !n || (
|
|
261
|
+
!o && !r && !n || (h.updateConfig(
|
|
272
262
|
this.api,
|
|
273
263
|
this.currentNode,
|
|
274
264
|
e,
|
|
275
265
|
"Applied smart defaults"
|
|
276
|
-
), o && e.currency &&
|
|
266
|
+
), o && e.currency && L({
|
|
277
267
|
currentNode: this.currentNode,
|
|
278
268
|
documentModifier: this.api.getDocumentModifier(),
|
|
279
269
|
currency: e.currency
|
|
@@ -283,10 +273,10 @@ class J extends g {
|
|
|
283
273
|
name: o,
|
|
284
274
|
value: o,
|
|
285
275
|
symbol: o,
|
|
286
|
-
alignment:
|
|
287
|
-
decimalCount:
|
|
288
|
-
decimalSeparator:
|
|
289
|
-
thousandSeparator:
|
|
276
|
+
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
277
|
+
decimalCount: a.currency.decimalCount.toString(),
|
|
278
|
+
decimalSeparator: a.currency.decimalSeparator,
|
|
279
|
+
thousandSeparator: a.currency.thousandSeparator
|
|
290
280
|
}
|
|
291
281
|
} : {},
|
|
292
282
|
...r ? { strategy: r } : {},
|
|
@@ -297,10 +287,10 @@ class J extends g {
|
|
|
297
287
|
* Reads the recommendation-id attribute from the block element within the node
|
|
298
288
|
*/
|
|
299
289
|
_getRecommendationIdFromNode(t) {
|
|
300
|
-
const e =
|
|
290
|
+
const e = P(t);
|
|
301
291
|
if (!e || !("getAttribute" in e))
|
|
302
292
|
return null;
|
|
303
|
-
const o = e.getAttribute(
|
|
293
|
+
const o = e.getAttribute(E);
|
|
304
294
|
if (!o)
|
|
305
295
|
return null;
|
|
306
296
|
const r = parseInt(o);
|
|
@@ -330,8 +320,8 @@ class J extends g {
|
|
|
330
320
|
}
|
|
331
321
|
const i = t.$state.configVersion;
|
|
332
322
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
333
|
-
const
|
|
334
|
-
u &&
|
|
323
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
324
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
335
325
|
});
|
|
336
326
|
}
|
|
337
327
|
/**
|
|
@@ -342,7 +332,7 @@ class J extends g {
|
|
|
342
332
|
if (!this.currentNode || !this.api)
|
|
343
333
|
return;
|
|
344
334
|
const { filters: t } = this.store.recommendationConfigs;
|
|
345
|
-
|
|
335
|
+
h.updateConfig(
|
|
346
336
|
this.api,
|
|
347
337
|
this.currentNode,
|
|
348
338
|
{ filters: t },
|
|
@@ -351,37 +341,35 @@ class J extends g {
|
|
|
351
341
|
}
|
|
352
342
|
}
|
|
353
343
|
export {
|
|
354
|
-
|
|
344
|
+
Q as ALGORITHM_CONTROL_ID,
|
|
355
345
|
N as AlgorithmControl,
|
|
356
346
|
v as CONTROL_BLOCK_ID,
|
|
357
|
-
|
|
347
|
+
Z as CURRENCY_CONTROL_ID,
|
|
358
348
|
R as CurrencyControl,
|
|
359
|
-
|
|
349
|
+
et as FILTERS_CONTROL_ID,
|
|
360
350
|
_ as FiltersControl,
|
|
361
|
-
|
|
362
|
-
|
|
351
|
+
rt as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
352
|
+
it as LOCALE_CONTROL_ID,
|
|
363
353
|
b as LayoutOrientationControl,
|
|
364
|
-
|
|
365
|
-
at as
|
|
366
|
-
|
|
367
|
-
ht as PRODUCT_LAYOUT_CONTROL_ID,
|
|
368
|
-
T as PricePlacementControl,
|
|
354
|
+
O as LocaleControl,
|
|
355
|
+
at as PRODUCT_COUNT_CONTROL_ID,
|
|
356
|
+
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
369
357
|
I as ProductCountControl,
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
358
|
+
T as ProductLayoutControl,
|
|
359
|
+
K as RecommendationBlockControl,
|
|
360
|
+
dt as SHUFFLE_CONTROL_ID,
|
|
361
|
+
S as ShuffleControl,
|
|
362
|
+
mt as adjustProductsToSize,
|
|
363
|
+
ft as formatProductPrice,
|
|
364
|
+
P as getBlockElement,
|
|
365
|
+
Ct as getCardComposition,
|
|
366
|
+
pt as getCurrentLayout,
|
|
367
|
+
gt as reapplySpacing,
|
|
368
|
+
yt as regenerateMobileProductRows,
|
|
369
|
+
Nt as regenerateProductRows,
|
|
382
370
|
k as regenerateProductRowsWithStyles,
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
371
|
+
L as setCurrencyAttributes,
|
|
372
|
+
Rt as updatePricesInPlace,
|
|
373
|
+
D as updateProductContentInPlace,
|
|
374
|
+
_t as updateSingleProductContent
|
|
387
375
|
};
|
|
@@ -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 { CURRENCY_ATTR as y, MOBILE_CONTAINER_SELECTOR as q, MOBILE_ROW_SELECTOR as k, DESKTOP_CONTAINER_SELECTOR as P, CONTAINER_SELECTOR as
|
|
4
|
-
import { RecommendationConfigService as
|
|
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 V } from "../../constants/selectors.js";
|
|
4
|
+
import { RecommendationConfigService as E } 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
|
|
11
|
-
function
|
|
7
|
+
import { formatPrice as W } from "../../utils/priceFormatter.js";
|
|
8
|
+
import { isTdNode as j } from "../../utils/tagName.js";
|
|
9
|
+
import { getDefaultProducts as L, DEFAULT_CARD_COMPOSITION as h, sanitizeImageUrl as F, toDisplayableAttributeValue as G } from "../../templates/utils.js";
|
|
10
|
+
const M = "recommendation-block-v2";
|
|
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(M))
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
return "querySelector" in t ? t.querySelector(`.${
|
|
19
|
+
return "querySelector" in t ? t.querySelector(`.${M}`) ?? null : null;
|
|
20
20
|
}
|
|
21
|
-
function
|
|
22
|
-
const e =
|
|
21
|
+
function b(t) {
|
|
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
28
|
function x(t) {
|
|
29
|
-
const e =
|
|
29
|
+
const e = R(t);
|
|
30
30
|
if (!e || !("getAttribute" in e))
|
|
31
|
-
return
|
|
31
|
+
return h;
|
|
32
32
|
const o = e.getAttribute("data-card-composition");
|
|
33
|
-
return o ? o.split(",").filter(Boolean) :
|
|
33
|
+
return o ? o.split(",").filter(Boolean) : h;
|
|
34
34
|
}
|
|
35
35
|
function D(t) {
|
|
36
36
|
if (!t || !("childNodes" in t))
|
|
@@ -47,14 +47,14 @@ function S(t, e, o) {
|
|
|
47
47
|
function U(t, e) {
|
|
48
48
|
return t && t.length > 0 ? t : e.length > 0 ? e : L();
|
|
49
49
|
}
|
|
50
|
-
function
|
|
50
|
+
function Y(t) {
|
|
51
51
|
const { currentNode: e, documentModifier: o } = t;
|
|
52
52
|
if (!e || !("querySelector" in e))
|
|
53
53
|
return;
|
|
54
54
|
const n = e.querySelector(k);
|
|
55
55
|
n && (o.modifyHtml(n).setInnerHtml(""), o.apply(new p("Cleared mobile row content")));
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function K(t) {
|
|
58
58
|
const {
|
|
59
59
|
currentNode: e,
|
|
60
60
|
documentModifier: o,
|
|
@@ -64,9 +64,9 @@ function X(t) {
|
|
|
64
64
|
} = t;
|
|
65
65
|
if (!e || !("querySelector" in e))
|
|
66
66
|
return;
|
|
67
|
-
const r = i ??
|
|
67
|
+
const r = i ?? b(e), s = E.getConfig(e);
|
|
68
68
|
if (r === "list" || !s.mobileLayoutEnabled) {
|
|
69
|
-
|
|
69
|
+
Y({ currentNode: e, documentModifier: o });
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
const u = e.querySelector(k);
|
|
@@ -75,12 +75,11 @@ function X(t) {
|
|
|
75
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
76
|
productsPerRow: s.mobileCardsInRow,
|
|
77
77
|
composition: a,
|
|
78
|
-
filterList: l.filterList
|
|
79
|
-
priceInline: !s.priceMovedToNextLine
|
|
78
|
+
filterList: l.filterList
|
|
80
79
|
})}</table></td>`;
|
|
81
80
|
o.modifyHtml(u).setInnerHtml(g), o.apply(new p("Updated mobile product rows"));
|
|
82
81
|
}
|
|
83
|
-
function
|
|
82
|
+
function X(t) {
|
|
84
83
|
const {
|
|
85
84
|
currentNode: e,
|
|
86
85
|
documentModifier: o,
|
|
@@ -91,16 +90,15 @@ function z(t) {
|
|
|
91
90
|
} = t;
|
|
92
91
|
if (!e || !("querySelector" in e))
|
|
93
92
|
return;
|
|
94
|
-
const s = e.querySelector(P) ?? e.querySelector(
|
|
93
|
+
const s = e.querySelector(P) ?? e.querySelector(v);
|
|
95
94
|
if (!s)
|
|
96
95
|
return;
|
|
97
|
-
const u = C(), l = U(i, u.recommendationProducts), { cardsInRow: d } = u.recommendationConfigs, a = r ?? x(e), f = c ??
|
|
96
|
+
const u = C(), l = U(i, u.recommendationProducts), { cardsInRow: d } = u.recommendationConfigs, a = r ?? x(e), f = c ?? b(e), g = _(l, f, {
|
|
98
97
|
productsPerRow: d,
|
|
99
98
|
composition: a,
|
|
100
|
-
filterList: u.filterList
|
|
101
|
-
priceInline: !g
|
|
99
|
+
filterList: u.filterList
|
|
102
100
|
});
|
|
103
|
-
o.modifyHtml(s).setInnerHtml(
|
|
101
|
+
o.modifyHtml(s).setInnerHtml(g).apply(new p("Updated product")), K(t), n == null || n();
|
|
104
102
|
}
|
|
105
103
|
function T(t, e, o, n) {
|
|
106
104
|
const c = `0 ${Math.floor(o / 2)}px`;
|
|
@@ -113,7 +111,7 @@ function T(t, e, o, n) {
|
|
|
113
111
|
t.querySelectorAll(".product-card-wrapper")
|
|
114
112
|
).forEach((u) => {
|
|
115
113
|
const l = "parentNode" in u ? u.parentNode : null;
|
|
116
|
-
l &&
|
|
114
|
+
l && j(l) && (e.modifyHtml(l).setStyle("padding", c), r = !0);
|
|
117
115
|
}), r;
|
|
118
116
|
}
|
|
119
117
|
function I(t, e, o) {
|
|
@@ -123,11 +121,11 @@ function I(t, e, o) {
|
|
|
123
121
|
e.modifyHtml(r).setStyle("height", n), c = !0;
|
|
124
122
|
}), c;
|
|
125
123
|
}
|
|
126
|
-
function
|
|
124
|
+
function z(t) {
|
|
127
125
|
const { currentNode: e, documentModifier: o } = t;
|
|
128
126
|
if (!e)
|
|
129
127
|
return;
|
|
130
|
-
const n =
|
|
128
|
+
const n = E.getConfig(e), i = b(e);
|
|
131
129
|
let c = !1;
|
|
132
130
|
const r = e.querySelector(P);
|
|
133
131
|
if (r) {
|
|
@@ -162,9 +160,9 @@ function J(t) {
|
|
|
162
160
|
}
|
|
163
161
|
c && o.apply(new p("Reapply spacing after regeneration"));
|
|
164
162
|
}
|
|
165
|
-
function
|
|
163
|
+
function ae(t) {
|
|
166
164
|
const { currentNode: e, documentModifier: o, afterRegenerate: n, products: i, layout: c, composition: r } = t;
|
|
167
|
-
e &&
|
|
165
|
+
e && X({
|
|
168
166
|
currentNode: e,
|
|
169
167
|
documentModifier: o,
|
|
170
168
|
products: i,
|
|
@@ -172,12 +170,12 @@ function de(t) {
|
|
|
172
170
|
composition: r,
|
|
173
171
|
afterRegenerate: () => {
|
|
174
172
|
setTimeout(() => {
|
|
175
|
-
|
|
173
|
+
z({ currentNode: e, documentModifier: o });
|
|
176
174
|
}, 0), n == null || n();
|
|
177
175
|
}
|
|
178
176
|
});
|
|
179
177
|
}
|
|
180
|
-
function
|
|
178
|
+
function de(t, e) {
|
|
181
179
|
return t.length === e ? t : t.length > e ? t.slice(0, e) : [...t, ...L(e - t.length)];
|
|
182
180
|
}
|
|
183
181
|
function H() {
|
|
@@ -193,12 +191,12 @@ function H() {
|
|
|
193
191
|
}
|
|
194
192
|
function A(t, e = "price") {
|
|
195
193
|
const o = H(), n = t[e], i = (n == null ? void 0 : n[o.code]) ?? Object.values(n ?? {})[0] ?? 0;
|
|
196
|
-
return
|
|
194
|
+
return W({
|
|
197
195
|
price: i,
|
|
198
196
|
currency: o
|
|
199
197
|
});
|
|
200
198
|
}
|
|
201
|
-
function
|
|
199
|
+
function J(t) {
|
|
202
200
|
var c, r;
|
|
203
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;
|
|
204
202
|
return i > 0 ? `-${i}%` : "0%";
|
|
@@ -219,12 +217,12 @@ function $(t) {
|
|
|
219
217
|
S(e, u, l) && (s = !0);
|
|
220
218
|
}
|
|
221
219
|
if (r && "querySelector" in r) {
|
|
222
|
-
const u = r.querySelector(".omnibus-discount-value") ?? null, l =
|
|
220
|
+
const u = r.querySelector(".omnibus-discount-value") ?? null, l = J(o);
|
|
223
221
|
S(e, u, l) && (s = !0);
|
|
224
222
|
}
|
|
225
223
|
return s;
|
|
226
224
|
}
|
|
227
|
-
function
|
|
225
|
+
function Q(t) {
|
|
228
226
|
const {
|
|
229
227
|
documentModifier: e,
|
|
230
228
|
product: o,
|
|
@@ -239,7 +237,7 @@ function Z(t) {
|
|
|
239
237
|
let d = !1;
|
|
240
238
|
if (n && "querySelector" in n) {
|
|
241
239
|
const a = n.querySelector("img");
|
|
242
|
-
a && (e.modifyHtml(a).setAttribute("src",
|
|
240
|
+
a && (e.modifyHtml(a).setAttribute("src", F(o.image_url)).setAttribute("alt", o.name), d = !0);
|
|
243
241
|
const f = n.querySelector("a");
|
|
244
242
|
f && (e.modifyHtml(f).setAttribute("href", o.url), d = !0);
|
|
245
243
|
}
|
|
@@ -264,7 +262,7 @@ function B(t) {
|
|
|
264
262
|
return "querySelector" in t ? t.querySelector(P) ?? t : t;
|
|
265
263
|
}
|
|
266
264
|
const O = "product_attribute.";
|
|
267
|
-
function
|
|
265
|
+
function Z(t, e) {
|
|
268
266
|
var n;
|
|
269
267
|
let o;
|
|
270
268
|
if (t.startsWith(O)) {
|
|
@@ -272,9 +270,9 @@ function ee(t, e) {
|
|
|
272
270
|
o = (n = e.product_attributes) == null ? void 0 : n[i];
|
|
273
271
|
} else
|
|
274
272
|
o = e[t];
|
|
275
|
-
return
|
|
273
|
+
return G(o) || null;
|
|
276
274
|
}
|
|
277
|
-
function
|
|
275
|
+
function ee(t, e, o) {
|
|
278
276
|
if (!("querySelectorAll" in t))
|
|
279
277
|
return !1;
|
|
280
278
|
const n = t.querySelectorAll(
|
|
@@ -286,7 +284,7 @@ function te(t, e, o) {
|
|
|
286
284
|
n.forEach((r) => {
|
|
287
285
|
if (!("getAttribute" in r))
|
|
288
286
|
return;
|
|
289
|
-
const s = r.getAttribute(
|
|
287
|
+
const s = r.getAttribute(V);
|
|
290
288
|
if (!s)
|
|
291
289
|
return;
|
|
292
290
|
const u = i.get(s) ?? [];
|
|
@@ -298,7 +296,7 @@ function te(t, e, o) {
|
|
|
298
296
|
r.slice(0, u).forEach((l, d) => {
|
|
299
297
|
if (!("querySelector" in l))
|
|
300
298
|
return;
|
|
301
|
-
const a =
|
|
299
|
+
const a = Z(s, o[d]);
|
|
302
300
|
if (a === null)
|
|
303
301
|
return;
|
|
304
302
|
const f = l.querySelector("p") ?? null;
|
|
@@ -306,7 +304,7 @@ function te(t, e, o) {
|
|
|
306
304
|
});
|
|
307
305
|
}), c;
|
|
308
306
|
}
|
|
309
|
-
function
|
|
307
|
+
function w(t, e, o) {
|
|
310
308
|
if (!("querySelectorAll" in t))
|
|
311
309
|
return !1;
|
|
312
310
|
const n = t.querySelectorAll(
|
|
@@ -326,7 +324,7 @@ function N(t, e, o) {
|
|
|
326
324
|
), d = Math.min(n.length, o.length);
|
|
327
325
|
let a = !1;
|
|
328
326
|
for (let f = 0; f < d; f++) {
|
|
329
|
-
const g =
|
|
327
|
+
const g = Q({
|
|
330
328
|
documentModifier: e,
|
|
331
329
|
product: o[f],
|
|
332
330
|
imageEl: n[f] ?? null,
|
|
@@ -339,9 +337,9 @@ function N(t, e, o) {
|
|
|
339
337
|
});
|
|
340
338
|
a = a || g;
|
|
341
339
|
}
|
|
342
|
-
return
|
|
340
|
+
return ee(t, e, o) && (a = !0), a;
|
|
343
341
|
}
|
|
344
|
-
function
|
|
342
|
+
function fe(t) {
|
|
345
343
|
const { currentNode: e, documentModifier: o, products: n } = t;
|
|
346
344
|
if (!e || !("querySelectorAll" in e))
|
|
347
345
|
return !1;
|
|
@@ -350,12 +348,12 @@ function me(t) {
|
|
|
350
348
|
`[esd-extension-block-id="${m.IMAGE}"]`
|
|
351
349
|
).length !== n.length)
|
|
352
350
|
return !1;
|
|
353
|
-
let r =
|
|
354
|
-
const s =
|
|
351
|
+
let r = w(i, o, n);
|
|
352
|
+
const s = b(e), u = E.getConfig(e);
|
|
355
353
|
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
356
354
|
const l = e.querySelector(q);
|
|
357
355
|
if (l) {
|
|
358
|
-
const d =
|
|
356
|
+
const d = w(
|
|
359
357
|
l,
|
|
360
358
|
o,
|
|
361
359
|
n
|
|
@@ -365,7 +363,7 @@ function me(t) {
|
|
|
365
363
|
}
|
|
366
364
|
return r && o.apply(new p("Updated product content in-place")), !0;
|
|
367
365
|
}
|
|
368
|
-
function
|
|
366
|
+
function N(t, e, o) {
|
|
369
367
|
if (!("querySelectorAll" in t))
|
|
370
368
|
return !1;
|
|
371
369
|
const n = t.querySelectorAll(
|
|
@@ -389,7 +387,7 @@ function w(t, e, o) {
|
|
|
389
387
|
}) && (u = !0);
|
|
390
388
|
return u;
|
|
391
389
|
}
|
|
392
|
-
function
|
|
390
|
+
function me(t) {
|
|
393
391
|
const { currentNode: e, documentModifier: o } = t;
|
|
394
392
|
if (!e || !("querySelectorAll" in e))
|
|
395
393
|
return !1;
|
|
@@ -397,19 +395,19 @@ function pe(t) {
|
|
|
397
395
|
if (i.length === 0)
|
|
398
396
|
return !1;
|
|
399
397
|
const c = B(e);
|
|
400
|
-
let r =
|
|
401
|
-
const s =
|
|
398
|
+
let r = N(c, o, i);
|
|
399
|
+
const s = b(e), u = E.getConfig(e);
|
|
402
400
|
if (s !== "list" && u.mobileLayoutEnabled && "querySelector" in e) {
|
|
403
401
|
const l = e.querySelector(q);
|
|
404
402
|
if (l) {
|
|
405
|
-
const d =
|
|
403
|
+
const d = N(l, o, i);
|
|
406
404
|
r = r || d;
|
|
407
405
|
}
|
|
408
406
|
}
|
|
409
407
|
return r && o.apply(new p("Updated price formatting in-place")), r;
|
|
410
408
|
}
|
|
411
|
-
function
|
|
412
|
-
const { currentNode: e, documentModifier: o, currency: n } = t, i =
|
|
409
|
+
function pe(t) {
|
|
410
|
+
const { currentNode: e, documentModifier: o, currency: n } = t, i = R(e);
|
|
413
411
|
if (!i)
|
|
414
412
|
return;
|
|
415
413
|
const c = n.alignment === "before" ? "0" : "1", r = (s, u) => {
|
|
@@ -418,17 +416,17 @@ function ye(t) {
|
|
|
418
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"));
|
|
419
417
|
}
|
|
420
418
|
export {
|
|
421
|
-
|
|
419
|
+
de as adjustProductsToSize,
|
|
422
420
|
A as formatProductPrice,
|
|
423
|
-
|
|
421
|
+
R as getBlockElement,
|
|
424
422
|
x as getCardComposition,
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
423
|
+
b as getCurrentLayout,
|
|
424
|
+
z as reapplySpacing,
|
|
425
|
+
K as regenerateMobileProductRows,
|
|
426
|
+
X as regenerateProductRows,
|
|
427
|
+
ae as regenerateProductRowsWithStyles,
|
|
428
|
+
pe as setCurrencyAttributes,
|
|
429
|
+
me as updatePricesInPlace,
|
|
430
|
+
fe as updateProductContentInPlace,
|
|
431
|
+
Q as updateSingleProductContent
|
|
434
432
|
};
|