@useinsider/guido 3.17.0-beta.668ca65 → 3.17.0-beta.a18fbda
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/README.md +5 -6
- package/dist/@types/config/schemas.js +6 -7
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +83 -83
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +54 -41
- package/dist/composables/useActionsApi.js +82 -67
- package/dist/composables/useAutoSave.js +31 -26
- package/dist/composables/useCustomInterfaceAppearance.js +38 -52
- package/dist/composables/useEditorLock.js +20 -0
- package/dist/composables/useGuidoStateBridge.js +37 -31
- package/dist/composables/useRecommendation.js +34 -41
- package/dist/composables/useSave.js +39 -36
- package/dist/config/migrator/recommendation/settingsMapper.js +17 -17
- package/dist/config/migrator/recommendationMigrator.js +4 -5
- package/dist/enums/academy.js +1 -2
- package/dist/enums/date.js +3 -5
- package/dist/enums/extensions/recommendationBlock.js +1 -3
- package/dist/extensions/Blocks/Recommendation/block.js +21 -26
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +34 -34
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +95 -96
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +166 -162
- package/dist/extensions/Blocks/Recommendation/services/configService.js +35 -35
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +79 -165
- package/dist/extensions/Blocks/common-control.js +19 -22
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +30 -69
- package/dist/src/@types/config/schemas.d.ts +0 -2
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useEditorLock.d.ts +10 -0
- package/dist/src/composables/useRecommendation.d.ts +0 -1
- package/dist/src/enums/academy.d.ts +0 -1
- package/dist/src/enums/date.d.ts +0 -1
- package/dist/src/enums/extensions/recommendationBlock.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +6 -2
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +4 -10
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +10 -150
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -1
- package/dist/src/extensions/Blocks/common-control.d.ts +1 -4
- package/dist/src/services/recommendationApi.d.ts +1 -4
- package/dist/src/stores/config.d.ts +0 -18
- package/dist/src/stores/save-as-template.d.ts +3 -4
- package/dist/utils/dateUtil.js +10 -23
- package/dist/utils/templatePreparation.js +34 -35
- package/package.json +2 -3
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +0 -21
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +0 -105
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.js +0 -19
- package/dist/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue2.js +0 -62
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +0 -124
- package/dist/src/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.d.ts +0 -3
- package/dist/src/components/organisms/extensions/recommendation/StrategyInfoBoxContent.vue.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -16
- package/dist/src/mock/api/recommendation-strategies.d.ts +0 -2
- package/dist/static/assets/icons/line-change.svg.js +0 -5
- package/dist/static/assets/icons/line-delete.svg.js +0 -5
- package/dist/static/assets/icons/line-plus.svg.js +0 -5
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -155
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as g, getOperatorOptions as R, PriceAttributes as C } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as y } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as G } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as P } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
7
|
-
import {
|
|
8
|
-
import { getDefaultProducts as
|
|
9
|
-
import { generateCompleteFilterQuery as
|
|
10
|
-
import { getPartnerRecommendationParams as
|
|
11
|
-
import { sanitizeProductIds as
|
|
12
|
-
import { isFilterValid as
|
|
13
|
-
import { isConfigValid as
|
|
14
|
-
const
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
function w() {
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as F, DEFAULT_CARDS_IN_ROW as D } from "../constants/layout.js";
|
|
7
|
+
import { EXCLUDED_ALGORITHM_IDS as w } from "../constants/defaultConfig.js";
|
|
8
|
+
import { getDefaultProducts as S } from "../templates/utils.js";
|
|
9
|
+
import { generateCompleteFilterQuery as b } from "../utils/filterUtil.js";
|
|
10
|
+
import { getPartnerRecommendationParams as v } from "../utils/partnerCustomizations.js";
|
|
11
|
+
import { sanitizeProductIds as N } from "../utils/productIds.js";
|
|
12
|
+
import { isFilterValid as x } from "../validation/filterSchema.js";
|
|
13
|
+
import { isConfigValid as L } from "../validation/requiredFields.js";
|
|
14
|
+
const h = y();
|
|
15
|
+
let m = null, u = null, d = null;
|
|
16
|
+
function k() {
|
|
18
17
|
return {
|
|
19
|
-
cardsInRow:
|
|
18
|
+
cardsInRow: D,
|
|
20
19
|
currencySettings: {
|
|
21
20
|
name: "USD",
|
|
22
21
|
value: "USD",
|
|
@@ -30,14 +29,13 @@ function w() {
|
|
|
30
29
|
productIds: [],
|
|
31
30
|
id: 1,
|
|
32
31
|
language: "en_US",
|
|
33
|
-
mobileCardsInRow:
|
|
32
|
+
mobileCardsInRow: F,
|
|
34
33
|
mobileLayoutEnabled: !1,
|
|
35
34
|
orientation: "grid",
|
|
36
35
|
recommendedProducts: [],
|
|
37
36
|
sendProductRequestFlag: !1,
|
|
38
37
|
shuffleProducts: !1,
|
|
39
38
|
strategy: "mostPopular",
|
|
40
|
-
strategyId: "",
|
|
41
39
|
textTrimming: !0,
|
|
42
40
|
unresponsive: !1,
|
|
43
41
|
size: "6",
|
|
@@ -46,32 +44,28 @@ function w() {
|
|
|
46
44
|
priceHideIfSameAsDiscounted: !1
|
|
47
45
|
};
|
|
48
46
|
}
|
|
49
|
-
function
|
|
47
|
+
function I() {
|
|
50
48
|
return {
|
|
51
|
-
recommendationConfigs:
|
|
49
|
+
recommendationConfigs: k(),
|
|
52
50
|
recommendationProducts: [],
|
|
53
51
|
filterStatus: !1,
|
|
54
52
|
filterSelectionDrawerStatus: !1,
|
|
55
|
-
assignStrategyDrawerStatus: !1,
|
|
56
53
|
filterGroup: 1,
|
|
57
54
|
isInitialized: !1,
|
|
58
55
|
filterSnapshot: null
|
|
59
56
|
};
|
|
60
57
|
}
|
|
61
|
-
const
|
|
58
|
+
const U = () => ({
|
|
62
59
|
recommendationCampaignUrls: {},
|
|
63
60
|
activePredictiveAlgorithms: [],
|
|
64
61
|
languages: {},
|
|
65
62
|
currencyList: [],
|
|
66
63
|
filterList: {},
|
|
67
|
-
strategies: [],
|
|
68
|
-
strategiesLoading: !1,
|
|
69
|
-
strategyUrlTemplates: {},
|
|
70
64
|
blockStates: {},
|
|
71
65
|
currentRecommendationId: null,
|
|
72
66
|
configVersion: 0
|
|
73
|
-
}),
|
|
74
|
-
state: () =>
|
|
67
|
+
}), H = P("guidoRecommendationExtension", {
|
|
68
|
+
state: () => U(),
|
|
75
69
|
getters: {
|
|
76
70
|
// ====================================================================
|
|
77
71
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -81,7 +75,7 @@ const O = () => ({
|
|
|
81
75
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
82
76
|
*/
|
|
83
77
|
recommendationConfigs(t) {
|
|
84
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
78
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : k();
|
|
85
79
|
},
|
|
86
80
|
/**
|
|
87
81
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -95,13 +89,6 @@ const O = () => ({
|
|
|
95
89
|
filterSelectionDrawerStatus(t) {
|
|
96
90
|
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].filterSelectionDrawerStatus : !1;
|
|
97
91
|
},
|
|
98
|
-
assignStrategyDrawerStatus(t) {
|
|
99
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].assignStrategyDrawerStatus : !1;
|
|
100
|
-
},
|
|
101
|
-
assignedStrategy(t) {
|
|
102
|
-
const { strategyId: e } = this.recommendationConfigs;
|
|
103
|
-
return e ? t.strategies.find((r) => String(r.strategy_id) === e) ?? null : null;
|
|
104
|
-
},
|
|
105
92
|
/**
|
|
106
93
|
* Proxy getter: delegates to blockStates[currentRecommendationId].filterStatus
|
|
107
94
|
*/
|
|
@@ -133,9 +120,9 @@ const O = () => ({
|
|
|
133
120
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
|
|
134
121
|
},
|
|
135
122
|
getActivePredictiveAlgorithms: (t) => {
|
|
136
|
-
const e =
|
|
137
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
138
|
-
r.push(...e.filter((
|
|
123
|
+
const e = g(), r = [];
|
|
124
|
+
return t.activePredictiveAlgorithms.filter((n) => !w.includes(n)).forEach((n) => {
|
|
125
|
+
r.push(...e.filter((c) => c.id === n));
|
|
139
126
|
}), r.map((n) => ({
|
|
140
127
|
text: n.name,
|
|
141
128
|
value: n.key
|
|
@@ -152,7 +139,7 @@ const O = () => ({
|
|
|
152
139
|
getFilterList() {
|
|
153
140
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
154
141
|
let e;
|
|
155
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
142
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : C.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
156
143
|
text: t.displayName,
|
|
157
144
|
value: e,
|
|
158
145
|
type: t.attributeType
|
|
@@ -174,7 +161,7 @@ const O = () => ({
|
|
|
174
161
|
setCurrentBlock(t) {
|
|
175
162
|
this.blockStates[t] || (this.blockStates = {
|
|
176
163
|
...this.blockStates,
|
|
177
|
-
[t]:
|
|
164
|
+
[t]: I()
|
|
178
165
|
}), this.currentRecommendationId = t;
|
|
179
166
|
},
|
|
180
167
|
/**
|
|
@@ -206,10 +193,10 @@ const O = () => ({
|
|
|
206
193
|
[e]: o
|
|
207
194
|
};
|
|
208
195
|
}
|
|
209
|
-
const n = t.toString(),
|
|
196
|
+
const n = t.toString(), c = e.toString(), i = this.recommendationCampaignUrls[n];
|
|
210
197
|
i && (this.recommendationCampaignUrls = {
|
|
211
198
|
...this.recommendationCampaignUrls,
|
|
212
|
-
[
|
|
199
|
+
[c]: i
|
|
213
200
|
});
|
|
214
201
|
},
|
|
215
202
|
/**
|
|
@@ -234,7 +221,7 @@ const O = () => ({
|
|
|
234
221
|
* `isInitialized`) alone.
|
|
235
222
|
*/
|
|
236
223
|
seedBlockUrlConfig(t, e) {
|
|
237
|
-
const r = (o,
|
|
224
|
+
const r = (o, s) => o === "." || o === "," || o === " " ? o : s, n = {
|
|
238
225
|
name: e.currencyCode,
|
|
239
226
|
value: e.currencyCode,
|
|
240
227
|
symbol: e.currencyCode,
|
|
@@ -242,18 +229,17 @@ const O = () => ({
|
|
|
242
229
|
decimalCount: String(e.currencyDecimalCount),
|
|
243
230
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
244
231
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
245
|
-
},
|
|
232
|
+
}, c = !this.blockStates[t], i = c ? I() : this.blockStates[t];
|
|
246
233
|
i.recommendationConfigs = {
|
|
247
234
|
...i.recommendationConfigs,
|
|
248
235
|
strategy: e.strategy,
|
|
249
|
-
strategyId: e.strategyId,
|
|
250
236
|
language: e.language,
|
|
251
237
|
size: e.size,
|
|
252
238
|
productIds: e.productIds,
|
|
253
239
|
filters: e.filters,
|
|
254
240
|
shuffleProducts: e.shuffleProducts,
|
|
255
241
|
currencySettings: n
|
|
256
|
-
},
|
|
242
|
+
}, c && (this.blockStates = {
|
|
257
243
|
...this.blockStates,
|
|
258
244
|
[t]: i
|
|
259
245
|
});
|
|
@@ -281,7 +267,7 @@ const O = () => ({
|
|
|
281
267
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
282
268
|
*/
|
|
283
269
|
createDefaultFilter(t, e) {
|
|
284
|
-
const [r] = this.getFilterList, [n] =
|
|
270
|
+
const [r] = this.getFilterList, [n] = R(r == null ? void 0 : r.type);
|
|
285
271
|
return {
|
|
286
272
|
type: "standardFilter",
|
|
287
273
|
attribute: (r == null ? void 0 : r.value) ?? "",
|
|
@@ -328,65 +314,21 @@ const O = () => ({
|
|
|
328
314
|
const t = this.blockStates[this.currentRecommendationId];
|
|
329
315
|
t.filterSnapshot !== null && (t.recommendationConfigs.filters = t.filterSnapshot, t.filterSnapshot = null), t.filterSelectionDrawerStatus = !1;
|
|
330
316
|
},
|
|
331
|
-
openAssignStrategyDrawer() {
|
|
332
|
-
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !0);
|
|
333
|
-
},
|
|
334
|
-
closeAssignStrategyDrawer() {
|
|
335
|
-
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !1);
|
|
336
|
-
},
|
|
337
|
-
async fetchStrategies() {
|
|
338
|
-
if (S) {
|
|
339
|
-
await S;
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
S = (async () => {
|
|
343
|
-
this.strategiesLoading = !0;
|
|
344
|
-
try {
|
|
345
|
-
this.strategies = await m.fetchRecommendationStrategies();
|
|
346
|
-
} finally {
|
|
347
|
-
this.strategiesLoading = !1;
|
|
348
|
-
}
|
|
349
|
-
})();
|
|
350
|
-
try {
|
|
351
|
-
await S;
|
|
352
|
-
} finally {
|
|
353
|
-
S = null;
|
|
354
|
-
}
|
|
355
|
-
},
|
|
356
|
-
async resolveStrategyUrlTemplate(t, e) {
|
|
357
|
-
const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
|
|
358
|
-
if (s)
|
|
359
|
-
return s;
|
|
360
|
-
const { full_path: i = "" } = await m.generateStrategyEndpoint(t, e) ?? {};
|
|
361
|
-
return n && i && (this.strategyUrlTemplates = {
|
|
362
|
-
...this.strategyUrlTemplates,
|
|
363
|
-
[n]: i
|
|
364
|
-
}), i;
|
|
365
|
-
},
|
|
366
|
-
assignStrategy(t) {
|
|
367
|
-
this.patchCurrentBlockConfig({
|
|
368
|
-
strategyId: String(t.strategy_id),
|
|
369
|
-
...t.size !== void 0 ? { size: String(t.size) } : {}
|
|
370
|
-
});
|
|
371
|
-
},
|
|
372
|
-
removeStrategy() {
|
|
373
|
-
this.patchCurrentBlockConfig({ strategyId: "", size: N.size });
|
|
374
|
-
},
|
|
375
317
|
// ====================================================================
|
|
376
318
|
// Shared Data Fetching (fetched once, used by all blocks)
|
|
377
319
|
// ====================================================================
|
|
378
320
|
async fetchRecommendationCreateData() {
|
|
379
321
|
if (!this.activePredictiveAlgorithms.length) {
|
|
380
|
-
if (
|
|
381
|
-
await
|
|
322
|
+
if (m) {
|
|
323
|
+
await m;
|
|
382
324
|
return;
|
|
383
325
|
}
|
|
384
|
-
|
|
326
|
+
m = (async () => {
|
|
385
327
|
const {
|
|
386
328
|
activePredictiveAlgorithms: t,
|
|
387
329
|
languages: e,
|
|
388
330
|
currencies: r
|
|
389
|
-
} = await
|
|
331
|
+
} = await h.fetchRecommendationCreateData();
|
|
390
332
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
391
333
|
const n = this.blockStates[this.currentRecommendationId];
|
|
392
334
|
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
@@ -394,26 +336,26 @@ const O = () => ({
|
|
|
394
336
|
this.currencyList = r;
|
|
395
337
|
})();
|
|
396
338
|
try {
|
|
397
|
-
await
|
|
339
|
+
await m;
|
|
398
340
|
} finally {
|
|
399
|
-
|
|
341
|
+
m = null;
|
|
400
342
|
}
|
|
401
343
|
}
|
|
402
344
|
},
|
|
403
345
|
async fetchRecommendationFilters() {
|
|
404
346
|
if (!Object.keys(this.filterList).length) {
|
|
405
|
-
if (
|
|
406
|
-
await
|
|
347
|
+
if (u) {
|
|
348
|
+
await u;
|
|
407
349
|
return;
|
|
408
350
|
}
|
|
409
|
-
|
|
410
|
-
const t = await
|
|
351
|
+
u = (async () => {
|
|
352
|
+
const t = await h.fetchRecommendationFilters();
|
|
411
353
|
this.filterList = t;
|
|
412
354
|
})();
|
|
413
355
|
try {
|
|
414
|
-
await
|
|
356
|
+
await u;
|
|
415
357
|
} finally {
|
|
416
|
-
|
|
358
|
+
u = null;
|
|
417
359
|
}
|
|
418
360
|
}
|
|
419
361
|
},
|
|
@@ -428,10 +370,10 @@ const O = () => ({
|
|
|
428
370
|
deleteFilterGroup(t) {
|
|
429
371
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
430
372
|
return;
|
|
431
|
-
const e = this.blockStates[this.currentRecommendationId], r = e.recommendationConfigs.filters.filter((i) => i.filterGroup !== t), n = [...new Set(r.map((i) => i.filterGroup))].sort((i, o) => i - o),
|
|
373
|
+
const e = this.blockStates[this.currentRecommendationId], r = e.recommendationConfigs.filters.filter((i) => i.filterGroup !== t), n = [...new Set(r.map((i) => i.filterGroup))].sort((i, o) => i - o), c = new Map(n.map((i, o) => [i, o + 1]));
|
|
432
374
|
e.recommendationConfigs.filters = r.map((i) => ({
|
|
433
375
|
...i,
|
|
434
|
-
filterGroup:
|
|
376
|
+
filterGroup: c.get(i.filterGroup) ?? i.filterGroup
|
|
435
377
|
}));
|
|
436
378
|
},
|
|
437
379
|
updateFilter(t) {
|
|
@@ -442,7 +384,7 @@ const O = () => ({
|
|
|
442
384
|
const n = [...e.recommendationConfigs.filters];
|
|
443
385
|
n[r] = {
|
|
444
386
|
...t,
|
|
445
|
-
isValid:
|
|
387
|
+
isValid: x(t)
|
|
446
388
|
}, e.recommendationConfigs.filters = n;
|
|
447
389
|
}
|
|
448
390
|
},
|
|
@@ -456,10 +398,10 @@ const O = () => ({
|
|
|
456
398
|
let i = 1;
|
|
457
399
|
n = n.map((o) => o.filterGroup === t.filterGroup ? { ...o, filterNumber: i++ } : o);
|
|
458
400
|
} else {
|
|
459
|
-
const i = [...new Set(n.map((
|
|
460
|
-
n = n.map((
|
|
461
|
-
...
|
|
462
|
-
filterGroup: o.get(
|
|
401
|
+
const i = [...new Set(n.map((s) => s.filterGroup))].sort((s, a) => s - a), o = new Map(i.map((s, a) => [s, a + 1]));
|
|
402
|
+
n = n.map((s) => ({
|
|
403
|
+
...s,
|
|
404
|
+
filterGroup: o.get(s.filterGroup) ?? s.filterGroup
|
|
463
405
|
}));
|
|
464
406
|
}
|
|
465
407
|
e.recommendationConfigs.filters = n;
|
|
@@ -468,19 +410,19 @@ const O = () => ({
|
|
|
468
410
|
addFilter(t) {
|
|
469
411
|
if (this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])
|
|
470
412
|
return;
|
|
471
|
-
const e = this.blockStates[this.currentRecommendationId], r = [...e.recommendationConfigs.filters],
|
|
413
|
+
const e = this.blockStates[this.currentRecommendationId], r = [...e.recommendationConfigs.filters], c = r.filter(
|
|
472
414
|
(o) => o.filterGroup === t.filterGroup
|
|
473
415
|
).length + 1, i = r.findLastIndex((o) => o.filterGroup === t.filterGroup);
|
|
474
416
|
i !== -1 ? r.splice(i + 1, 0, {
|
|
475
417
|
...t,
|
|
476
|
-
filterNumber:
|
|
418
|
+
filterNumber: c
|
|
477
419
|
}) : r.push({
|
|
478
420
|
...t,
|
|
479
|
-
filterNumber:
|
|
421
|
+
filterNumber: c
|
|
480
422
|
}), e.recommendationConfigs.filters = r;
|
|
481
423
|
},
|
|
482
424
|
generateFilterQuery() {
|
|
483
|
-
return
|
|
425
|
+
return b(this.recommendationConfigs.filters);
|
|
484
426
|
},
|
|
485
427
|
/**
|
|
486
428
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -488,83 +430,55 @@ const O = () => ({
|
|
|
488
430
|
* every block's recommendationConfigs across user edits.
|
|
489
431
|
*/
|
|
490
432
|
hasInvalidBlock() {
|
|
491
|
-
return Object.values(this.blockStates).some((t) => !
|
|
433
|
+
return Object.values(this.blockStates).some((t) => !L(t.recommendationConfigs, this));
|
|
492
434
|
},
|
|
493
435
|
// ====================================================================
|
|
494
436
|
// Per-Block Product Fetching
|
|
495
437
|
// ====================================================================
|
|
496
438
|
async fetchRecommendationProducts() {
|
|
497
439
|
if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
|
|
498
|
-
if (
|
|
499
|
-
await
|
|
440
|
+
if (d) {
|
|
441
|
+
await d;
|
|
500
442
|
return;
|
|
501
443
|
}
|
|
502
|
-
|
|
444
|
+
d = this._doFetchProducts();
|
|
503
445
|
try {
|
|
504
|
-
await
|
|
446
|
+
await d;
|
|
505
447
|
} finally {
|
|
506
|
-
|
|
448
|
+
d = null;
|
|
507
449
|
}
|
|
508
450
|
}
|
|
509
451
|
},
|
|
510
452
|
async _doFetchProducts() {
|
|
511
|
-
var
|
|
512
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
513
|
-
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
514
|
-
await this._doFetchStrategyProducts(t);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
const s = r.filters.filter((u) => u.isValid), i = R(s), o = ((d = I().find((u) => u.key === r.strategy)) == null ? void 0 : d.path) || "", c = parseInt(r.size) || 6, a = {
|
|
453
|
+
var p;
|
|
454
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = r.filters.filter((l) => l.isValid), c = b(n), i = ((p = g().find((l) => l.key === r.strategy)) == null ? void 0 : p.path) || "", o = G(), s = parseInt(r.size) || 6, a = {
|
|
518
455
|
locale: r.language,
|
|
519
456
|
currency: r.currencySettings.value,
|
|
520
|
-
partnerName:
|
|
457
|
+
partnerName: o.partnerName,
|
|
521
458
|
size: r.size,
|
|
522
459
|
details: !0,
|
|
523
|
-
campaignId:
|
|
460
|
+
campaignId: o.variationId
|
|
524
461
|
};
|
|
525
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
462
|
+
r.strategy === "manualMerchandising" ? a.productId = N(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), c && (a.filter = c), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
526
463
|
a,
|
|
527
|
-
|
|
464
|
+
v(o.partnerName, r.strategy)
|
|
528
465
|
);
|
|
529
|
-
let
|
|
466
|
+
let f;
|
|
530
467
|
try {
|
|
531
|
-
|
|
468
|
+
f = await h.fetchRecommendationProducts(i, a);
|
|
532
469
|
} catch {
|
|
533
|
-
|
|
470
|
+
f = [];
|
|
534
471
|
}
|
|
535
|
-
this.
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
let n = [], s = parseInt(r.size) || 6;
|
|
542
|
-
try {
|
|
543
|
-
await this.fetchStrategies();
|
|
544
|
-
const i = this.strategies.find(
|
|
545
|
-
(o) => String(o.strategy_id) === r.strategyId
|
|
546
|
-
);
|
|
547
|
-
if (i) {
|
|
548
|
-
s = parseInt(String(i.size ?? "")) || s;
|
|
549
|
-
const o = r.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(i, o)).replaceAll("{locale}", r.language).replaceAll("{currency}", o), l = a.indexOf("?"), d = l === -1 ? a : a.slice(0, l), u = (l === -1 ? "" : a.slice(l + 1)).split("&").filter((b) => b && !b.startsWith("user_id=")), y = u.length ? `${d}?${u.join("&")}` : d;
|
|
550
|
-
y && (n = await m.fetchRecommendationProductsByUrl(y));
|
|
551
|
-
}
|
|
552
|
-
} catch {
|
|
553
|
-
n = [];
|
|
472
|
+
if (this.blockStates[t]) {
|
|
473
|
+
const l = f.length > 0 ? f : S(s);
|
|
474
|
+
l.length < s ? this.blockStates[t].recommendationProducts = [
|
|
475
|
+
...l,
|
|
476
|
+
...S(s - l.length)
|
|
477
|
+
] : l.length > s ? this.blockStates[t].recommendationProducts = l.slice(0, s) : this.blockStates[t].recommendationProducts = l;
|
|
554
478
|
}
|
|
555
|
-
p.get(t) === e && this._setBlockProducts(t, n, s);
|
|
556
|
-
},
|
|
557
|
-
_setBlockProducts(t, e, r) {
|
|
558
|
-
if (!this.blockStates[t])
|
|
559
|
-
return;
|
|
560
|
-
const n = e.length > 0 ? e : k(r);
|
|
561
|
-
this.blockStates[t].recommendationProducts = [
|
|
562
|
-
...n.slice(0, r),
|
|
563
|
-
...k(Math.max(0, r - n.length))
|
|
564
|
-
];
|
|
565
479
|
}
|
|
566
480
|
}
|
|
567
481
|
});
|
|
568
482
|
export {
|
|
569
|
-
|
|
483
|
+
H as useRecommendationExtensionStore
|
|
570
484
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var c = Object.defineProperty;
|
|
2
|
-
var i = (
|
|
3
|
-
var
|
|
2
|
+
var i = (s, r, e) => r in s ? c(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
|
|
3
|
+
var u = (s, r, e) => i(s, typeof r != "symbol" ? r + "" : r, e);
|
|
4
4
|
import { Control as I, UIElementType as n, UEAttr as $ } from "../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
-
class
|
|
5
|
+
class d extends I {
|
|
6
6
|
constructor() {
|
|
7
7
|
super(...arguments);
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
u(this, "currentNode");
|
|
9
|
+
u(this, "lastBlockInstanceId", null);
|
|
10
10
|
}
|
|
11
11
|
getContainer() {
|
|
12
12
|
var e;
|
|
@@ -91,21 +91,21 @@ class _ extends I {
|
|
|
91
91
|
* and combines it with the text in Stripo's alert-message layout.
|
|
92
92
|
*/
|
|
93
93
|
_setInfoMessageValue(e, t) {
|
|
94
|
-
const E = this.getContainer(), o = E.querySelector(`[data-icon-key="${e}"]`),
|
|
94
|
+
const E = this.getContainer(), o = E.querySelector(`[data-icon-key="${e}"]`), a = o == null ? void 0 : o.querySelector("ue-icon-component"), l = (a == null ? void 0 : a.outerHTML) ?? "";
|
|
95
95
|
this.api.setUIEAttribute(
|
|
96
96
|
e,
|
|
97
97
|
"value",
|
|
98
98
|
`
|
|
99
99
|
<div class="service-element alert-message-main" style="align-items: start;">
|
|
100
|
-
${
|
|
100
|
+
${l}
|
|
101
101
|
<div class="service-element alert-message-text">
|
|
102
102
|
${t}
|
|
103
103
|
</div>
|
|
104
104
|
</div>
|
|
105
105
|
`
|
|
106
106
|
);
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const T = E.querySelector(`[data-info-message="${e}"]`);
|
|
108
|
+
T && (T.style.display = "");
|
|
109
109
|
}
|
|
110
110
|
_GuToggle(e) {
|
|
111
111
|
return `
|
|
@@ -126,15 +126,15 @@ class _ extends I {
|
|
|
126
126
|
placeholder: t,
|
|
127
127
|
options: E,
|
|
128
128
|
className: o = "es-180w",
|
|
129
|
-
searchable:
|
|
129
|
+
searchable: a = !1
|
|
130
130
|
}) {
|
|
131
131
|
return `
|
|
132
132
|
<${n.SELECTPICKER}
|
|
133
133
|
class="${o}"
|
|
134
134
|
${$.SELECTPICKER.name}="${e}"
|
|
135
|
-
${
|
|
135
|
+
${a ? `${$.SELECTPICKER.searchable}="true"` : ""}
|
|
136
136
|
${$.SELECTPICKER.placeholder}="${t}">
|
|
137
|
-
${E.map((
|
|
137
|
+
${E.map((l) => this._GuSelectItem(l)).join("")}
|
|
138
138
|
</${n.SELECTPICKER}>
|
|
139
139
|
`;
|
|
140
140
|
}
|
|
@@ -176,15 +176,12 @@ class _ extends I {
|
|
|
176
176
|
</${n.RADIO_BUTTONS}>
|
|
177
177
|
`;
|
|
178
178
|
}
|
|
179
|
-
_GuButton({ name: e, label: t, id: E = ""
|
|
179
|
+
_GuButton({ name: e, label: t, id: E = "" }) {
|
|
180
180
|
return `
|
|
181
181
|
<${n.BUTTON}
|
|
182
182
|
${$.BUTTON.name}="${e}"
|
|
183
183
|
${E ? `id="${E}"` : ""}
|
|
184
|
-
${
|
|
185
|
-
${r ? `${$.BUTTON.icon}="${r}"` : ""}
|
|
186
|
-
${s ? `${$.BUTTON.disabled}="true"` : ""}
|
|
187
|
-
${$.BUTTON.caption}="${t}">
|
|
184
|
+
${$.BUTTON.caption}="${t}"}>
|
|
188
185
|
</${n.BUTTON}>
|
|
189
186
|
`;
|
|
190
187
|
}
|
|
@@ -233,11 +230,11 @@ class _ extends I {
|
|
|
233
230
|
*/
|
|
234
231
|
_GuOrderable(e, t) {
|
|
235
232
|
let E = "";
|
|
236
|
-
t.forEach((
|
|
237
|
-
const
|
|
233
|
+
t.forEach((a) => {
|
|
234
|
+
const l = $.ORDERABLE_ITEM && "name" in $.ORDERABLE_ITEM ? $.ORDERABLE_ITEM.name : "name";
|
|
238
235
|
E += `
|
|
239
|
-
<${n.ORDERABLE_ITEM} ${
|
|
240
|
-
${
|
|
236
|
+
<${n.ORDERABLE_ITEM} ${l}="${a.key}">
|
|
237
|
+
${a.content}
|
|
241
238
|
</${n.ORDERABLE_ITEM}>
|
|
242
239
|
`;
|
|
243
240
|
});
|
|
@@ -308,5 +305,5 @@ class _ extends I {
|
|
|
308
305
|
}
|
|
309
306
|
}
|
|
310
307
|
export {
|
|
311
|
-
|
|
308
|
+
d as CommonControl
|
|
312
309
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
.gap-16[data-v-5553d071],.gap-16[data-v-0e1b0c54]{gap:16px}[data-v-73199fa4] .in-button-v2__wrapper{line-height:0}[data-v-22226124] .in-segments-wrapper__button_selected,[data-v-22226124] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb;color:#0010ac;border-color:#0010ac}[data-v-2cb418af] .in-progress-wrapper__progress p span:last-child{display:none!important}[data-v-2cb418af] .in-progress-description-status{display:none!important}.view-options-wrapper[data-v-87033101]{position:relative;display:inline-block}.new-tag[data-v-87033101]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-87033101] .guido__view-option-selection-desktop svg,[data-v-87033101] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-87033101] .in-segments-wrapper__button_selected,[data-v-87033101] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-87033101] .in-tooltip-wrapper-v2__icon{cursor:pointer}.editor-toolbar[data-v-173c3a40]{gap:4px}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history[data-v-fad98586]{gap:8px}.version-history__toolbar[data-v-fad98586]{gap:4px}.view-options-wrapper[data-v-6ebabfe4]{position:relative;display:inline-block}.new-tag[data-v-6ebabfe4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-6ebabfe4] .guido__verion-history-view-option-selection-desktop svg,[data-v-6ebabfe4] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6ebabfe4] .in-segments-wrapper__button_selected,[data-v-6ebabfe4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-6ebabfe4] .in-tooltip-wrapper-v2__icon{cursor:pointer}.auto-save-toggle[data-v-2c964af4]{position:relative}.auto-save-toggle__info-box[data-v-2c964af4]{position:absolute;top:100%;left:0;z-index:10;width:280px}.editor-actions[data-v-1ca6baf0]{gap:4px}.header-wrapper[data-v-d11dd577]{min-width:1000px}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-1f2703e5]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-1f2703e5]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-1f2703e5]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-b09e80c4] .vueperslides__bullets{pointer-events:none!important}[data-v-b09e80c4] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-9bdef600] .vueperslides__parallax-wrapper{padding-bottom:110px!important}
|