@useinsider/guido 3.18.1-beta.fd927f4 → 3.18.1-beta.fefef3c
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 +21 -3
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +83 -87
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +82 -57
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +24 -22
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +28 -24
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +46 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +46 -0
- package/dist/composables/useActionsApi.js +20 -24
- package/dist/composables/useCortexBlueprintBridge.js +54 -115
- package/dist/composables/useCustomInterfaceAppearance.js +46 -42
- package/dist/composables/useEmailTemplateApplier.js +50 -93
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/enums/extensions/recommendationBlock.js +17 -14
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +70 -69
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +45 -44
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +104 -58
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +72 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +93 -84
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -4
- package/dist/src/composables/useEmailTemplateApplier.d.ts +2 -22
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +3 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +4 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +54 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +44 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/guido-email-editor.d.ts +7 -29
- package/dist/src/stores/onboarding.d.ts +808 -10
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +5 -0
- package/dist/static/assets/icons/line-info.svg.js +5 -0
- package/dist/static/styles/components/recommendation-strategy.css.js +70 -5
- package/dist/stores/config.js +74 -60
- package/dist/stores/guido-email-editor.js +1 -5
- package/dist/stores/onboarding.js +46 -36
- package/package.json +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as R, getOperatorOptions as D, PriceAttributes as F } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as P } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as k } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as L } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
7
|
-
import { DEFAULT_NODE_CONFIG as N, EXCLUDED_ALGORITHM_IDS as
|
|
8
|
-
import { getDefaultProducts as
|
|
9
|
-
import { generateCompleteFilterQuery as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as U, DEFAULT_CARDS_IN_ROW as _ } from "../constants/layout.js";
|
|
7
|
+
import { CURRENT_CONFIG_VERSION as y, DEFAULT_NODE_CONFIG as N, EXCLUDED_ALGORITHM_IDS as M } from "../constants/defaultConfig.js";
|
|
8
|
+
import { getDefaultProducts as C } from "../templates/utils.js";
|
|
9
|
+
import { generateCompleteFilterQuery as v } from "../utils/filterUtil.js";
|
|
10
|
+
import { isLegacyStrategyConfig as x } from "../utils/legacyStrategyMigration.js";
|
|
11
|
+
import { getPartnerRecommendationParams as z } from "../utils/partnerCustomizations.js";
|
|
12
|
+
import { sanitizeProductIds as B } from "../utils/productIds.js";
|
|
13
|
+
import { isFilterValid as A } from "../validation/filterSchema.js";
|
|
14
|
+
import { isConfigValid as O } from "../validation/requiredFields.js";
|
|
15
|
+
const m = P();
|
|
16
|
+
let f = null, g = null, h = null, S = null;
|
|
16
17
|
const p = /* @__PURE__ */ new Map();
|
|
17
|
-
function
|
|
18
|
+
function G() {
|
|
18
19
|
return {
|
|
19
|
-
cardsInRow:
|
|
20
|
+
cardsInRow: _,
|
|
20
21
|
currencySettings: {
|
|
21
22
|
name: "USD",
|
|
22
23
|
value: "USD",
|
|
@@ -30,7 +31,7 @@ function w() {
|
|
|
30
31
|
productIds: [],
|
|
31
32
|
id: 1,
|
|
32
33
|
language: "en_US",
|
|
33
|
-
mobileCardsInRow:
|
|
34
|
+
mobileCardsInRow: U,
|
|
34
35
|
mobileLayoutEnabled: !1,
|
|
35
36
|
orientation: "grid",
|
|
36
37
|
recommendedProducts: [],
|
|
@@ -38,6 +39,7 @@ function w() {
|
|
|
38
39
|
shuffleProducts: !1,
|
|
39
40
|
strategy: "mostPopular",
|
|
40
41
|
strategyId: "",
|
|
42
|
+
nodeConfigVersion: y,
|
|
41
43
|
textTrimming: !0,
|
|
42
44
|
unresponsive: !1,
|
|
43
45
|
size: "6",
|
|
@@ -46,20 +48,22 @@ function w() {
|
|
|
46
48
|
priceHideIfSameAsDiscounted: !1
|
|
47
49
|
};
|
|
48
50
|
}
|
|
49
|
-
function
|
|
51
|
+
function w() {
|
|
50
52
|
return {
|
|
51
|
-
recommendationConfigs:
|
|
53
|
+
recommendationConfigs: G(),
|
|
52
54
|
recommendationProducts: [],
|
|
53
55
|
filterStatus: !1,
|
|
54
56
|
filterSelectionDrawerStatus: !1,
|
|
55
57
|
assignStrategyDrawerStatus: !1,
|
|
56
58
|
removeStrategyModalStatus: !1,
|
|
59
|
+
legacyStrategyUpdatedModalStatus: !1,
|
|
57
60
|
filterGroup: 1,
|
|
58
61
|
isInitialized: !1,
|
|
59
|
-
filterSnapshot: null
|
|
62
|
+
filterSnapshot: null,
|
|
63
|
+
legacyConversionLoading: !1
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
|
-
const
|
|
66
|
+
const E = () => ({
|
|
63
67
|
recommendationCampaignUrls: {},
|
|
64
68
|
activePredictiveAlgorithms: [],
|
|
65
69
|
languages: {},
|
|
@@ -71,8 +75,8 @@ const z = () => ({
|
|
|
71
75
|
blockStates: {},
|
|
72
76
|
currentRecommendationId: null,
|
|
73
77
|
configVersion: 0
|
|
74
|
-
}),
|
|
75
|
-
state: () =>
|
|
78
|
+
}), et = L("guidoRecommendationExtension", {
|
|
79
|
+
state: () => E(),
|
|
76
80
|
getters: {
|
|
77
81
|
// ====================================================================
|
|
78
82
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -82,7 +86,7 @@ const z = () => ({
|
|
|
82
86
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
83
87
|
*/
|
|
84
88
|
recommendationConfigs(t) {
|
|
85
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
89
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : G();
|
|
86
90
|
},
|
|
87
91
|
/**
|
|
88
92
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -102,6 +106,15 @@ const z = () => ({
|
|
|
102
106
|
removeStrategyModalStatus(t) {
|
|
103
107
|
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].removeStrategyModalStatus : !1;
|
|
104
108
|
},
|
|
109
|
+
isLegacyStrategyBlock() {
|
|
110
|
+
return k().isFeatureEnabled("reusableRecommendationStrategy") && x(this.recommendationConfigs);
|
|
111
|
+
},
|
|
112
|
+
legacyConversionLoading(t) {
|
|
113
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].legacyConversionLoading : !1;
|
|
114
|
+
},
|
|
115
|
+
legacyStrategyUpdatedModalStatus(t) {
|
|
116
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].legacyStrategyUpdatedModalStatus : !1;
|
|
117
|
+
},
|
|
105
118
|
assignedStrategy(t) {
|
|
106
119
|
const { strategyId: e } = this.recommendationConfigs;
|
|
107
120
|
return e ? t.strategies.find((r) => String(r.strategy_id) === e) ?? null : null;
|
|
@@ -137,8 +150,8 @@ const z = () => ({
|
|
|
137
150
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
|
|
138
151
|
},
|
|
139
152
|
getActivePredictiveAlgorithms: (t) => {
|
|
140
|
-
const e =
|
|
141
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
153
|
+
const e = R(), r = [];
|
|
154
|
+
return t.activePredictiveAlgorithms.filter((n) => !M.includes(n)).forEach((n) => {
|
|
142
155
|
r.push(...e.filter((s) => s.id === n));
|
|
143
156
|
}), r.map((n) => ({
|
|
144
157
|
text: n.name,
|
|
@@ -156,7 +169,7 @@ const z = () => ({
|
|
|
156
169
|
getFilterList() {
|
|
157
170
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
158
171
|
let e;
|
|
159
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
172
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : F.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
160
173
|
text: t.displayName,
|
|
161
174
|
value: e,
|
|
162
175
|
type: t.attributeType
|
|
@@ -178,7 +191,7 @@ const z = () => ({
|
|
|
178
191
|
setCurrentBlock(t) {
|
|
179
192
|
this.blockStates[t] || (this.blockStates = {
|
|
180
193
|
...this.blockStates,
|
|
181
|
-
[t]:
|
|
194
|
+
[t]: w()
|
|
182
195
|
}), this.currentRecommendationId = t;
|
|
183
196
|
},
|
|
184
197
|
/**
|
|
@@ -246,7 +259,7 @@ const z = () => ({
|
|
|
246
259
|
decimalCount: String(e.currencyDecimalCount),
|
|
247
260
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
248
261
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
249
|
-
}, s = !this.blockStates[t], i = s ?
|
|
262
|
+
}, s = !this.blockStates[t], i = s ? w() : this.blockStates[t];
|
|
250
263
|
i.recommendationConfigs = {
|
|
251
264
|
...i.recommendationConfigs,
|
|
252
265
|
strategy: e.strategy,
|
|
@@ -285,7 +298,7 @@ const z = () => ({
|
|
|
285
298
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
286
299
|
*/
|
|
287
300
|
createDefaultFilter(t, e) {
|
|
288
|
-
const [r] = this.getFilterList, [n] =
|
|
301
|
+
const [r] = this.getFilterList, [n] = D(r == null ? void 0 : r.type);
|
|
289
302
|
return {
|
|
290
303
|
type: "standardFilter",
|
|
291
304
|
attribute: (r == null ? void 0 : r.value) ?? "",
|
|
@@ -338,6 +351,12 @@ const z = () => ({
|
|
|
338
351
|
closeAssignStrategyDrawer() {
|
|
339
352
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !1);
|
|
340
353
|
},
|
|
354
|
+
openLegacyStrategyUpdatedModal() {
|
|
355
|
+
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].legacyStrategyUpdatedModalStatus = !0);
|
|
356
|
+
},
|
|
357
|
+
closeLegacyStrategyUpdatedModal() {
|
|
358
|
+
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].legacyStrategyUpdatedModalStatus = !1);
|
|
359
|
+
},
|
|
341
360
|
openRemoveStrategyModal() {
|
|
342
361
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !0);
|
|
343
362
|
},
|
|
@@ -352,7 +371,7 @@ const z = () => ({
|
|
|
352
371
|
S = (async () => {
|
|
353
372
|
this.strategiesLoading = !0;
|
|
354
373
|
try {
|
|
355
|
-
this.strategies = await
|
|
374
|
+
this.strategies = await m.fetchRecommendationStrategies();
|
|
356
375
|
} finally {
|
|
357
376
|
this.strategiesLoading = !1;
|
|
358
377
|
}
|
|
@@ -367,7 +386,7 @@ const z = () => ({
|
|
|
367
386
|
const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
|
|
368
387
|
if (s)
|
|
369
388
|
return s;
|
|
370
|
-
const { full_path: i = "" } = await
|
|
389
|
+
const { full_path: i = "" } = await m.generateStrategyEndpoint(t, e) ?? {};
|
|
371
390
|
return n && i && (this.strategyUrlTemplates = {
|
|
372
391
|
...this.strategyUrlTemplates,
|
|
373
392
|
[n]: i
|
|
@@ -379,8 +398,35 @@ const z = () => ({
|
|
|
379
398
|
...t.size !== void 0 ? { size: String(t.size) } : {}
|
|
380
399
|
});
|
|
381
400
|
},
|
|
401
|
+
async convertLegacyStrategy(t, e = { scope: "campaign" }) {
|
|
402
|
+
const r = this.currentRecommendationId;
|
|
403
|
+
if (r === null || !this.blockStates[r])
|
|
404
|
+
throw new Error("[Guido] convertLegacyStrategy called without an active block");
|
|
405
|
+
this.blockStates[r].legacyConversionLoading = !0;
|
|
406
|
+
try {
|
|
407
|
+
const n = await m.migrateLegacyStrategy(t, e);
|
|
408
|
+
try {
|
|
409
|
+
await this.fetchStrategies();
|
|
410
|
+
} catch (o) {
|
|
411
|
+
console.error("[Guido] strategy listing refresh after conversion failed", o);
|
|
412
|
+
}
|
|
413
|
+
const s = this.strategies.find((o) => String(o.strategy_id) === n), i = this.blockStates[r];
|
|
414
|
+
return i && (i.recommendationConfigs = {
|
|
415
|
+
...i.recommendationConfigs,
|
|
416
|
+
strategyId: n,
|
|
417
|
+
nodeConfigVersion: y,
|
|
418
|
+
...(s == null ? void 0 : s.size) !== void 0 ? { size: String(s.size) } : {}
|
|
419
|
+
}), this.currentRecommendationId === r && this.configVersion++, n;
|
|
420
|
+
} finally {
|
|
421
|
+
this.blockStates[r] && (this.blockStates[r].legacyConversionLoading = !1);
|
|
422
|
+
}
|
|
423
|
+
},
|
|
382
424
|
removeStrategy() {
|
|
383
|
-
this.patchCurrentBlockConfig({
|
|
425
|
+
this.patchCurrentBlockConfig({
|
|
426
|
+
strategyId: "",
|
|
427
|
+
size: N.size,
|
|
428
|
+
nodeConfigVersion: y
|
|
429
|
+
});
|
|
384
430
|
},
|
|
385
431
|
// ====================================================================
|
|
386
432
|
// Shared Data Fetching (fetched once, used by all blocks)
|
|
@@ -396,7 +442,7 @@ const z = () => ({
|
|
|
396
442
|
activePredictiveAlgorithms: t,
|
|
397
443
|
languages: e,
|
|
398
444
|
currencies: r
|
|
399
|
-
} = await
|
|
445
|
+
} = await m.fetchRecommendationCreateData();
|
|
400
446
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
401
447
|
const n = this.blockStates[this.currentRecommendationId];
|
|
402
448
|
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
@@ -412,18 +458,18 @@ const z = () => ({
|
|
|
412
458
|
},
|
|
413
459
|
async fetchRecommendationFilters() {
|
|
414
460
|
if (!Object.keys(this.filterList).length) {
|
|
415
|
-
if (
|
|
416
|
-
await
|
|
461
|
+
if (g) {
|
|
462
|
+
await g;
|
|
417
463
|
return;
|
|
418
464
|
}
|
|
419
|
-
|
|
420
|
-
const t = await
|
|
465
|
+
g = (async () => {
|
|
466
|
+
const t = await m.fetchRecommendationFilters();
|
|
421
467
|
this.filterList = t;
|
|
422
468
|
})();
|
|
423
469
|
try {
|
|
424
|
-
await
|
|
470
|
+
await g;
|
|
425
471
|
} finally {
|
|
426
|
-
|
|
472
|
+
g = null;
|
|
427
473
|
}
|
|
428
474
|
}
|
|
429
475
|
},
|
|
@@ -452,7 +498,7 @@ const z = () => ({
|
|
|
452
498
|
const n = [...e.recommendationConfigs.filters];
|
|
453
499
|
n[r] = {
|
|
454
500
|
...t,
|
|
455
|
-
isValid:
|
|
501
|
+
isValid: A(t)
|
|
456
502
|
}, e.recommendationConfigs.filters = n;
|
|
457
503
|
}
|
|
458
504
|
},
|
|
@@ -490,7 +536,7 @@ const z = () => ({
|
|
|
490
536
|
}), e.recommendationConfigs.filters = r;
|
|
491
537
|
},
|
|
492
538
|
generateFilterQuery() {
|
|
493
|
-
return
|
|
539
|
+
return v(this.recommendationConfigs.filters);
|
|
494
540
|
},
|
|
495
541
|
/**
|
|
496
542
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -498,33 +544,33 @@ const z = () => ({
|
|
|
498
544
|
* every block's recommendationConfigs across user edits.
|
|
499
545
|
*/
|
|
500
546
|
hasInvalidBlock() {
|
|
501
|
-
return Object.values(this.blockStates).some((t) => !
|
|
547
|
+
return Object.values(this.blockStates).some((t) => !O(t.recommendationConfigs, this));
|
|
502
548
|
},
|
|
503
549
|
// ====================================================================
|
|
504
550
|
// Per-Block Product Fetching
|
|
505
551
|
// ====================================================================
|
|
506
552
|
async fetchRecommendationProducts() {
|
|
507
553
|
if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
|
|
508
|
-
if (
|
|
509
|
-
await
|
|
554
|
+
if (h) {
|
|
555
|
+
await h;
|
|
510
556
|
return;
|
|
511
557
|
}
|
|
512
|
-
|
|
558
|
+
h = this._doFetchProducts();
|
|
513
559
|
try {
|
|
514
|
-
await
|
|
560
|
+
await h;
|
|
515
561
|
} finally {
|
|
516
|
-
|
|
562
|
+
h = null;
|
|
517
563
|
}
|
|
518
564
|
}
|
|
519
565
|
},
|
|
520
566
|
async _doFetchProducts() {
|
|
521
567
|
var d;
|
|
522
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
568
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = k();
|
|
523
569
|
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
524
570
|
await this._doFetchStrategyProducts(t);
|
|
525
571
|
return;
|
|
526
572
|
}
|
|
527
|
-
const s = r.filters.filter((
|
|
573
|
+
const s = r.filters.filter((u) => u.isValid), i = v(s), o = ((d = R().find((u) => u.key === r.strategy)) == null ? void 0 : d.path) || "", c = parseInt(r.size) || 6, a = {
|
|
528
574
|
locale: r.language,
|
|
529
575
|
currency: r.currencySettings.value,
|
|
530
576
|
partnerName: n.partnerName,
|
|
@@ -532,13 +578,13 @@ const z = () => ({
|
|
|
532
578
|
details: !0,
|
|
533
579
|
campaignId: n.variationId
|
|
534
580
|
};
|
|
535
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
581
|
+
r.strategy === "manualMerchandising" ? a.productId = B(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), i && (a.filter = i), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
536
582
|
a,
|
|
537
|
-
|
|
583
|
+
z(n.partnerName, r.strategy)
|
|
538
584
|
);
|
|
539
585
|
let l;
|
|
540
586
|
try {
|
|
541
|
-
l = await
|
|
587
|
+
l = await m.fetchRecommendationProducts(o, a);
|
|
542
588
|
} catch {
|
|
543
589
|
l = [];
|
|
544
590
|
}
|
|
@@ -556,8 +602,8 @@ const z = () => ({
|
|
|
556
602
|
);
|
|
557
603
|
if (i) {
|
|
558
604
|
s = parseInt(String(i.size ?? "")) || s;
|
|
559
|
-
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),
|
|
560
|
-
|
|
605
|
+
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=")), I = u.length ? `${d}?${u.join("&")}` : d;
|
|
606
|
+
I && (n = await m.fetchRecommendationProductsByUrl(I));
|
|
561
607
|
}
|
|
562
608
|
} catch {
|
|
563
609
|
n = [];
|
|
@@ -567,14 +613,14 @@ const z = () => ({
|
|
|
567
613
|
_setBlockProducts(t, e, r) {
|
|
568
614
|
if (!this.blockStates[t])
|
|
569
615
|
return;
|
|
570
|
-
const n = e.length > 0 ? e :
|
|
616
|
+
const n = e.length > 0 ? e : C(r);
|
|
571
617
|
this.blockStates[t].recommendationProducts = [
|
|
572
618
|
...n.slice(0, r),
|
|
573
|
-
...
|
|
619
|
+
...C(Math.max(0, r - n.length))
|
|
574
620
|
];
|
|
575
621
|
}
|
|
576
622
|
}
|
|
577
623
|
});
|
|
578
624
|
export {
|
|
579
|
-
|
|
625
|
+
et as useRecommendationExtensionStore
|
|
580
626
|
};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { OP_ANY_OF as p } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import "../constants/selectors.js";
|
|
3
|
+
import { CURRENT_CONFIG_VERSION as l } from "../constants/defaultConfig.js";
|
|
4
|
+
import { parseTagList as I } from "./filterUtil.js";
|
|
5
|
+
import { sanitizeProductIds as N } from "./productIds.js";
|
|
6
|
+
const b = "String", f = "manualMerchandising";
|
|
7
|
+
function A({ strategyId: t, nodeConfigVersion: o }) {
|
|
8
|
+
return !t && o < l;
|
|
9
|
+
}
|
|
10
|
+
const m = (t) => {
|
|
11
|
+
const o = String(t ?? "").trim();
|
|
12
|
+
return /^[1-9]\d*$/.test(o) ? o : null;
|
|
13
|
+
};
|
|
14
|
+
function O({ campaignId: t, templateLibraryId: o }) {
|
|
15
|
+
if (m(t))
|
|
16
|
+
return { scope: "campaign" };
|
|
17
|
+
const e = m(o);
|
|
18
|
+
return e ? { scope: "template", templateId: e } : { scope: "campaign" };
|
|
19
|
+
}
|
|
20
|
+
const d = (t) => t === "|" ? "or" : "and", y = (t, o) => {
|
|
21
|
+
var e;
|
|
22
|
+
return {
|
|
23
|
+
conditionLogic: d(t.innerGroupOperator),
|
|
24
|
+
attribute: {
|
|
25
|
+
attributeName: t.attribute,
|
|
26
|
+
attributeType: ((e = o.find((r) => r.value === t.attribute)) == null ? void 0 : e.type) || b
|
|
27
|
+
},
|
|
28
|
+
operator: { operator: t.operator === p ? "=" : t.operator },
|
|
29
|
+
value: t.operator === p ? I(t.value).join(p) : t.value
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
function L(t, o) {
|
|
33
|
+
const e = /* @__PURE__ */ new Map();
|
|
34
|
+
return t.filter((r) => r.isValid).forEach((r) => {
|
|
35
|
+
e.set(r.filterGroup, [...e.get(r.filterGroup) ?? [], r]);
|
|
36
|
+
}), [...e.keys()].sort((r, n) => r - n).map((r) => {
|
|
37
|
+
const n = [...e.get(r) ?? []].sort((i, a) => i.filterNumber - a.filterNumber);
|
|
38
|
+
return {
|
|
39
|
+
groupLogic: d(n[0].outerGroupOperator),
|
|
40
|
+
conditionList: n.map((i) => y(i, o))
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function S({
|
|
45
|
+
blockId: t,
|
|
46
|
+
url: o,
|
|
47
|
+
campaignId: e,
|
|
48
|
+
variationId: r,
|
|
49
|
+
strategy: n,
|
|
50
|
+
productIds: i,
|
|
51
|
+
filters: a,
|
|
52
|
+
attributes: g,
|
|
53
|
+
target: u
|
|
54
|
+
}) {
|
|
55
|
+
const s = L(a, g), c = n === f ? N(i).split(",").filter(Boolean) : [];
|
|
56
|
+
return {
|
|
57
|
+
...u.scope === "template" ? { templateId: Number.parseInt(u.templateId) } : {
|
|
58
|
+
campaignId: Number.parseInt(e) || 0,
|
|
59
|
+
variationId: Number.parseInt(r) || 0
|
|
60
|
+
},
|
|
61
|
+
blockId: String(t),
|
|
62
|
+
url: o,
|
|
63
|
+
...s.length ? { filters: s } : {},
|
|
64
|
+
...c.length ? { productIds: c } : {}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
S as buildLegacyMigrationPayload,
|
|
69
|
+
A as isLegacyStrategyConfig,
|
|
70
|
+
O as resolveMigrationTarget,
|
|
71
|
+
L as toMigrationFilterGroups
|
|
72
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ModificationDescription as f } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
2
|
import { RECOMMENDATION_ID_ATTR as m } from "../constants/selectors.js";
|
|
3
|
-
import { isPartnerManagedBlock as
|
|
4
|
-
import { RecommendationConfigService as
|
|
3
|
+
import { isPartnerManagedBlock as l, updateProductContentInPlace as a, regenerateProductRowsWithStyles as d } from "../controls/main/utils.js";
|
|
4
|
+
import { RecommendationConfigService as p } from "../services/configService.js";
|
|
5
5
|
let e = null;
|
|
6
|
-
function
|
|
6
|
+
function M(r) {
|
|
7
7
|
e = r;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function N(r, c, i, u) {
|
|
10
10
|
const n = e == null ? void 0 : e.getDocumentRootHtmlNode();
|
|
11
11
|
if (!e || !n || !("querySelector" in n))
|
|
12
12
|
return !1;
|
|
@@ -14,9 +14,9 @@ function D(r, c, i, u) {
|
|
|
14
14
|
if (!t)
|
|
15
15
|
return !1;
|
|
16
16
|
const o = e.getDocumentModifier();
|
|
17
|
-
return
|
|
17
|
+
return p.stageConfig(o, t, c), l(t) ? (o.apply(new f(u)), !0) : (a({ currentNode: t, documentModifier: o, products: i, forceApply: !0 }) || d({ currentNode: t, documentModifier: o, products: i, forceApply: !0 }), !0);
|
|
18
18
|
}
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
N as commitBlockChangeOutsidePanel,
|
|
21
|
+
M as registerNodeConfigWriter
|
|
22
22
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.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-
|
|
1
|
+
@charset "UTF-8";.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-17b3c665]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-17b3c665]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-17b3c665]{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-19d8cb42] .vueperslides__bullets,[data-v-1f4a4044] .vueperslides__bullets,[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}.assign-strategy-drawer-content .assign-strategy-select[data-v-4019dc4d]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-4019dc4d] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
|