@useinsider/guido 3.7.2-beta.13c9a35 → 3.7.2-beta.3cec1a4
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 +45 -61
- 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 +84 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +80 -82
- 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/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 R } from "./algorithm.js";
|
|
9
|
-
import { ALGORITHM_CONTROL_ID as
|
|
10
|
-
import { CurrencyControl as
|
|
11
|
-
import { CURRENCY_CONTROL_ID as
|
|
12
|
-
import { FiltersControl as
|
|
13
|
-
import { FILTERS_CONTROL_ID as
|
|
14
|
-
import { LayoutOrientationControl as
|
|
15
|
-
import { LAYOUT_ORIENTATION_CONTROL_ID as
|
|
16
|
-
import { LocaleControl as
|
|
17
|
-
import { LOCALE_CONTROL_ID as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const w = "recommendation-id", A = "ui-elements-recommendation-block";
|
|
30
|
-
class J extends g {
|
|
9
|
+
import { ALGORITHM_CONTROL_ID as Q } from "./algorithm.js";
|
|
10
|
+
import { CurrencyControl as b } from "./currency.js";
|
|
11
|
+
import { CURRENCY_CONTROL_ID as Z } from "./currency.js";
|
|
12
|
+
import { FiltersControl as N } from "./filters.js";
|
|
13
|
+
import { FILTERS_CONTROL_ID as et } from "./filters.js";
|
|
14
|
+
import { LayoutOrientationControl as I } from "./layoutOrientation.js";
|
|
15
|
+
import { LAYOUT_ORIENTATION_CONTROL_ID as rt } from "./layoutOrientation.js";
|
|
16
|
+
import { LocaleControl as _ } from "./locale.js";
|
|
17
|
+
import { LOCALE_CONTROL_ID as it } from "./locale.js";
|
|
18
|
+
import { ProductCountControl as O } from "./productCount.js";
|
|
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 k, regenerateProductRowsWithStyles as D } 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 Rt, updatePricesInPlace as bt, updateSingleProductContent as Nt } from "./utils.js";
|
|
26
|
+
import { useDebounceFn as m } from "../../../../../node_modules/@vueuse/shared/index.js";
|
|
27
|
+
const E = "recommendation-id", w = "ui-elements-recommendation-block";
|
|
28
|
+
class K extends g {
|
|
31
29
|
constructor() {
|
|
32
30
|
super(...arguments);
|
|
33
31
|
s(this, "store", y());
|
|
@@ -42,12 +40,11 @@ class J extends g {
|
|
|
42
40
|
s(this, "productLayoutControl", null);
|
|
43
41
|
s(this, "filtersControl", null);
|
|
44
42
|
s(this, "shuffleControl", null);
|
|
45
|
-
s(this, "pricePlacementControl", null);
|
|
46
43
|
s(this, "layoutOrientationControl", null);
|
|
47
44
|
/**
|
|
48
45
|
* Debounced product fetch to prevent rapid API calls during config changes
|
|
49
46
|
*/
|
|
50
|
-
s(this, "_debouncedFetchProducts",
|
|
47
|
+
s(this, "_debouncedFetchProducts", m(() => {
|
|
51
48
|
this.store.fetchRecommendationProducts();
|
|
52
49
|
}, 500));
|
|
53
50
|
/**
|
|
@@ -61,16 +58,16 @@ class J extends g {
|
|
|
61
58
|
* count. The store pads products to the configured size, so in-place only
|
|
62
59
|
* fails when the size actually changed.
|
|
63
60
|
*/
|
|
64
|
-
s(this, "_debouncedRegenerateWithProducts",
|
|
61
|
+
s(this, "_debouncedRegenerateWithProducts", m(() => {
|
|
65
62
|
const t = this.store.recommendationProducts;
|
|
66
63
|
if (!this.currentNode || !this.api)
|
|
67
64
|
return;
|
|
68
65
|
const e = this.api.getDocumentModifier();
|
|
69
|
-
|
|
66
|
+
k({
|
|
70
67
|
currentNode: this.currentNode,
|
|
71
68
|
documentModifier: e,
|
|
72
69
|
products: t
|
|
73
|
-
}) ||
|
|
70
|
+
}) || D({
|
|
74
71
|
currentNode: this.currentNode,
|
|
75
72
|
documentModifier: e,
|
|
76
73
|
products: t
|
|
@@ -78,10 +75,10 @@ class J extends g {
|
|
|
78
75
|
}, 100));
|
|
79
76
|
}
|
|
80
77
|
getId() {
|
|
81
|
-
return
|
|
78
|
+
return w;
|
|
82
79
|
}
|
|
83
80
|
getTemplate() {
|
|
84
|
-
return this.algorithmControl = new R(), this.localeControl = new
|
|
81
|
+
return this.algorithmControl = new R(), this.localeControl = new _(), this.currencyControl = new b(), this.productCountControl = new O(), this.productLayoutControl = new T(), this.filtersControl = new N(), this.shuffleControl = new S(), this.layoutOrientationControl = new I(), [
|
|
85
82
|
this.algorithmControl,
|
|
86
83
|
this.localeControl,
|
|
87
84
|
this.currencyControl,
|
|
@@ -89,7 +86,6 @@ class J extends g {
|
|
|
89
86
|
this.productLayoutControl,
|
|
90
87
|
this.filtersControl,
|
|
91
88
|
this.shuffleControl,
|
|
92
|
-
this.pricePlacementControl,
|
|
93
89
|
this.layoutOrientationControl
|
|
94
90
|
].forEach((e) => {
|
|
95
91
|
e.api = this.api;
|
|
@@ -100,7 +96,6 @@ class J extends g {
|
|
|
100
96
|
${this.productLayoutControl.getTemplate()}
|
|
101
97
|
${this.algorithmControl.getTemplate()}
|
|
102
98
|
${this.localeControl.getTemplate()}
|
|
103
|
-
${this.pricePlacementControl.getTemplate()}
|
|
104
99
|
${this.currencyControl.getTemplate()}
|
|
105
100
|
${this.filtersControl.getTemplate()}
|
|
106
101
|
${this.shuffleControl.getTemplate()}
|
|
@@ -130,8 +125,7 @@ class J extends g {
|
|
|
130
125
|
this.currencyControl,
|
|
131
126
|
this.productLayoutControl,
|
|
132
127
|
this.filtersControl,
|
|
133
|
-
this.shuffleControl
|
|
134
|
-
this.pricePlacementControl
|
|
128
|
+
this.shuffleControl
|
|
135
129
|
].forEach((n) => {
|
|
136
130
|
var i;
|
|
137
131
|
n != null && n.api && (n.currentNode = t, (i = n.onTemplateNodeUpdated) == null || i.call(n, t));
|
|
@@ -146,8 +140,7 @@ class J extends g {
|
|
|
146
140
|
this.currencyControl,
|
|
147
141
|
this.productLayoutControl,
|
|
148
142
|
this.filtersControl,
|
|
149
|
-
this.shuffleControl
|
|
150
|
-
this.pricePlacementControl
|
|
143
|
+
this.shuffleControl
|
|
151
144
|
].forEach((e) => {
|
|
152
145
|
var o;
|
|
153
146
|
return (o = e == null ? void 0 : e.onDestroy) == null ? void 0 : o.call(e);
|
|
@@ -166,8 +159,7 @@ class J extends g {
|
|
|
166
159
|
this.currencyControl,
|
|
167
160
|
this.productLayoutControl,
|
|
168
161
|
this.filtersControl,
|
|
169
|
-
this.shuffleControl
|
|
170
|
-
this.pricePlacementControl
|
|
162
|
+
this.shuffleControl
|
|
171
163
|
].forEach((e) => {
|
|
172
164
|
var o;
|
|
173
165
|
e && (e.api = this.api, e.currentNode = this.currentNode, (o = e.onRender) == null || o.call(e));
|
|
@@ -186,7 +178,7 @@ class J extends g {
|
|
|
186
178
|
*/
|
|
187
179
|
_syncNodeConfigToStore() {
|
|
188
180
|
var r;
|
|
189
|
-
const t =
|
|
181
|
+
const t = h.getConfig(this.currentNode), e = this.store.currentRecommendationId, o = e !== null && ((r = this.store.blockStates[e]) == null ? void 0 : r.isInitialized);
|
|
190
182
|
this.store.patchCurrentBlockConfig({
|
|
191
183
|
strategy: t.strategy,
|
|
192
184
|
language: t.language,
|
|
@@ -201,8 +193,6 @@ class J extends g {
|
|
|
201
193
|
// for filters (edited via the filter drawer).
|
|
202
194
|
...o ? {} : { filters: t.filters },
|
|
203
195
|
shuffleProducts: t.shuffleProducts,
|
|
204
|
-
priceMovedToNextLine: t.priceMovedToNextLine,
|
|
205
|
-
priceHideIfSameAsDiscounted: t.priceHideIfSameAsDiscounted,
|
|
206
196
|
currencySettings: {
|
|
207
197
|
name: t.currency.code,
|
|
208
198
|
value: t.currency.code,
|
|
@@ -249,36 +239,36 @@ class J extends g {
|
|
|
249
239
|
_applySmartDefaults() {
|
|
250
240
|
if (!this.currentNode || !this.api)
|
|
251
241
|
return;
|
|
252
|
-
const t =
|
|
242
|
+
const t = h.getConfig(this.currentNode), e = {};
|
|
253
243
|
let o = null, r = null, n = null;
|
|
254
|
-
if (t.currency.code ===
|
|
244
|
+
if (t.currency.code === a.currency.code) {
|
|
255
245
|
const { currencyList: i } = this.store;
|
|
256
246
|
i.length > 0 && (i.some(
|
|
257
|
-
(u) => u.value === `price.${
|
|
247
|
+
(u) => u.value === `price.${a.currency.code}`
|
|
258
248
|
) || (o = i[0].value.replace("price.", ""), e.currency = {
|
|
259
|
-
...
|
|
249
|
+
...a.currency,
|
|
260
250
|
code: o,
|
|
261
251
|
symbol: o
|
|
262
252
|
}));
|
|
263
253
|
}
|
|
264
|
-
if (t.strategy ===
|
|
254
|
+
if (t.strategy === a.strategy) {
|
|
265
255
|
const i = this.store.getActivePredictiveAlgorithms;
|
|
266
256
|
i.length > 0 && (i.some(
|
|
267
|
-
(u) => u.value ===
|
|
257
|
+
(u) => u.value === a.strategy
|
|
268
258
|
) || (r = i[0].value, e.strategy = r));
|
|
269
259
|
}
|
|
270
|
-
if (t.language ===
|
|
260
|
+
if (t.language === a.language) {
|
|
271
261
|
const i = this.store.getLanguages;
|
|
272
262
|
i.length > 0 && (i.some(
|
|
273
|
-
(u) => u.value ===
|
|
263
|
+
(u) => u.value === a.language
|
|
274
264
|
) || (n = i[0].value, e.language = n));
|
|
275
265
|
}
|
|
276
|
-
!o && !r && !n || (
|
|
266
|
+
!o && !r && !n || (h.updateConfig(
|
|
277
267
|
this.api,
|
|
278
268
|
this.currentNode,
|
|
279
269
|
e,
|
|
280
270
|
"Applied smart defaults"
|
|
281
|
-
), o && e.currency &&
|
|
271
|
+
), o && e.currency && L({
|
|
282
272
|
currentNode: this.currentNode,
|
|
283
273
|
documentModifier: this.api.getDocumentModifier(),
|
|
284
274
|
currency: e.currency
|
|
@@ -288,10 +278,10 @@ class J extends g {
|
|
|
288
278
|
name: o,
|
|
289
279
|
value: o,
|
|
290
280
|
symbol: o,
|
|
291
|
-
alignment:
|
|
292
|
-
decimalCount:
|
|
293
|
-
decimalSeparator:
|
|
294
|
-
thousandSeparator:
|
|
281
|
+
alignment: a.currency.alignment === "before" ? "0" : "1",
|
|
282
|
+
decimalCount: a.currency.decimalCount.toString(),
|
|
283
|
+
decimalSeparator: a.currency.decimalSeparator,
|
|
284
|
+
thousandSeparator: a.currency.thousandSeparator
|
|
295
285
|
}
|
|
296
286
|
} : {},
|
|
297
287
|
...r ? { strategy: r } : {},
|
|
@@ -302,10 +292,10 @@ class J extends g {
|
|
|
302
292
|
* Reads the recommendation-id attribute from the block element within the node
|
|
303
293
|
*/
|
|
304
294
|
_getRecommendationIdFromNode(t) {
|
|
305
|
-
const e =
|
|
295
|
+
const e = P(t);
|
|
306
296
|
if (!e || !("getAttribute" in e))
|
|
307
297
|
return null;
|
|
308
|
-
const o = e.getAttribute(
|
|
298
|
+
const o = e.getAttribute(E);
|
|
309
299
|
if (!o)
|
|
310
300
|
return null;
|
|
311
301
|
const r = parseInt(o);
|
|
@@ -335,8 +325,8 @@ class J extends g {
|
|
|
335
325
|
}
|
|
336
326
|
const i = t.$state.configVersion;
|
|
337
327
|
i !== o && (o = i, this._persistFiltersToNodeConfig(), this._debouncedFetchProducts());
|
|
338
|
-
const
|
|
339
|
-
u &&
|
|
328
|
+
const l = t.recommendationProducts, u = l !== e, f = Array.isArray(l) && l.length > 0;
|
|
329
|
+
u && f && (e = l, this._debouncedRegenerateWithProducts());
|
|
340
330
|
});
|
|
341
331
|
}
|
|
342
332
|
/**
|
|
@@ -347,7 +337,7 @@ class J extends g {
|
|
|
347
337
|
if (!this.currentNode || !this.api)
|
|
348
338
|
return;
|
|
349
339
|
const { filters: t } = this.store.recommendationConfigs;
|
|
350
|
-
|
|
340
|
+
h.updateConfig(
|
|
351
341
|
this.api,
|
|
352
342
|
this.currentNode,
|
|
353
343
|
{ filters: t },
|
|
@@ -356,37 +346,35 @@ class J extends g {
|
|
|
356
346
|
}
|
|
357
347
|
}
|
|
358
348
|
export {
|
|
359
|
-
|
|
349
|
+
Q as ALGORITHM_CONTROL_ID,
|
|
360
350
|
R as AlgorithmControl,
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
at as
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
T as
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
D as updateProductContentInPlace,
|
|
391
|
-
Pt as updateSingleProductContent
|
|
351
|
+
w as CONTROL_BLOCK_ID,
|
|
352
|
+
Z as CURRENCY_CONTROL_ID,
|
|
353
|
+
b as CurrencyControl,
|
|
354
|
+
et as FILTERS_CONTROL_ID,
|
|
355
|
+
N as FiltersControl,
|
|
356
|
+
rt as LAYOUT_ORIENTATION_CONTROL_ID,
|
|
357
|
+
it as LOCALE_CONTROL_ID,
|
|
358
|
+
I as LayoutOrientationControl,
|
|
359
|
+
_ as LocaleControl,
|
|
360
|
+
at as PRODUCT_COUNT_CONTROL_ID,
|
|
361
|
+
lt as PRODUCT_LAYOUT_CONTROL_ID,
|
|
362
|
+
O as ProductCountControl,
|
|
363
|
+
T as ProductLayoutControl,
|
|
364
|
+
K as RecommendationBlockControl,
|
|
365
|
+
dt as SHUFFLE_CONTROL_ID,
|
|
366
|
+
S as ShuffleControl,
|
|
367
|
+
mt as adjustProductsToSize,
|
|
368
|
+
ft as formatProductPrice,
|
|
369
|
+
P as getBlockElement,
|
|
370
|
+
Ct as getCardComposition,
|
|
371
|
+
pt as getCurrentLayout,
|
|
372
|
+
gt as reapplySpacing,
|
|
373
|
+
yt as regenerateMobileProductRows,
|
|
374
|
+
Rt as regenerateProductRows,
|
|
375
|
+
D as regenerateProductRowsWithStyles,
|
|
376
|
+
L as setCurrencyAttributes,
|
|
377
|
+
bt as updatePricesInPlace,
|
|
378
|
+
k as updateProductContentInPlace,
|
|
379
|
+
Nt as updateSingleProductContent
|
|
392
380
|
};
|