@useinsider/guido 3.18.2-beta.3eec9b0 → 3.18.2-beta.4d2b065
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 -23
- package/dist/@types/config/schemas.js +59 -51
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +55 -53
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +53 -49
- 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/useCustomInterfaceAppearance.js +46 -42
- package/dist/composables/useGuidoStateBridge.js +24 -29
- package/dist/composables/useLegacyStrategyConversion.js +61 -0
- package/dist/composables/useStripo.js +7 -7
- package/dist/enums/extensions/recommendationBlock.js +40 -31
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +77 -76
- 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 +110 -46
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +42 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/library.js +13 -15
- package/dist/services/recommendationApi.js +46 -37
- 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/useGuidoStateBridge.d.ts +7 -11
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +5 -1
- 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 +70 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +32 -0
- package/dist/src/library.d.ts +0 -2
- package/dist/src/public/trackingIds.d.ts +2 -6
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/src/stores/config.d.ts +322 -0
- package/dist/src/stores/editor.d.ts +0 -25
- package/dist/src/stores/guido-email-editor.d.ts +27 -27
- 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/editor.js +0 -4
- package/dist/stores/guido-email-editor.js +4 -0
- package/dist/stores/onboarding.js +46 -36
- package/package.json +1 -5
- package/dist/public/editorState.js +0 -4
- package/dist/src/public/editorState.d.ts +0 -14
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as R, getOperatorOptions as F, PriceAttributes as P } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
2
|
import { useRecommendationApi as D } from "../../../../services/recommendationApi.js";
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
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
|
-
|
|
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 B } from "../utils/partnerCustomizations.js";
|
|
12
|
+
import { sanitizeProductIds as z } 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 = D();
|
|
15
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,21 +48,23 @@ 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
62
|
filterSnapshot: null,
|
|
60
|
-
syncedConfigFingerprint: null
|
|
63
|
+
syncedConfigFingerprint: null,
|
|
64
|
+
legacyConversionLoading: !1
|
|
61
65
|
};
|
|
62
66
|
}
|
|
63
|
-
const
|
|
67
|
+
const E = () => ({
|
|
64
68
|
recommendationCampaignUrls: {},
|
|
65
69
|
activePredictiveAlgorithms: [],
|
|
66
70
|
languages: {},
|
|
@@ -72,8 +76,8 @@ const z = () => ({
|
|
|
72
76
|
blockStates: {},
|
|
73
77
|
currentRecommendationId: null,
|
|
74
78
|
configVersion: 0
|
|
75
|
-
}),
|
|
76
|
-
state: () =>
|
|
79
|
+
}), et = L("guidoRecommendationExtension", {
|
|
80
|
+
state: () => E(),
|
|
77
81
|
getters: {
|
|
78
82
|
// ====================================================================
|
|
79
83
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -83,7 +87,7 @@ const z = () => ({
|
|
|
83
87
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
84
88
|
*/
|
|
85
89
|
recommendationConfigs(t) {
|
|
86
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
90
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : G();
|
|
87
91
|
},
|
|
88
92
|
/**
|
|
89
93
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -103,6 +107,15 @@ const z = () => ({
|
|
|
103
107
|
removeStrategyModalStatus(t) {
|
|
104
108
|
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].removeStrategyModalStatus : !1;
|
|
105
109
|
},
|
|
110
|
+
isLegacyStrategyBlock() {
|
|
111
|
+
return k().isFeatureEnabled("reusableRecommendationStrategy") && x(this.recommendationConfigs);
|
|
112
|
+
},
|
|
113
|
+
legacyConversionLoading(t) {
|
|
114
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].legacyConversionLoading : !1;
|
|
115
|
+
},
|
|
116
|
+
legacyStrategyUpdatedModalStatus(t) {
|
|
117
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].legacyStrategyUpdatedModalStatus : !1;
|
|
118
|
+
},
|
|
106
119
|
assignedStrategy(t) {
|
|
107
120
|
const { strategyId: e } = this.recommendationConfigs;
|
|
108
121
|
return e ? t.strategies.find((r) => String(r.strategy_id) === e) ?? null : null;
|
|
@@ -138,8 +151,8 @@ const z = () => ({
|
|
|
138
151
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
|
|
139
152
|
},
|
|
140
153
|
getActivePredictiveAlgorithms: (t) => {
|
|
141
|
-
const e =
|
|
142
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
154
|
+
const e = R(), r = [];
|
|
155
|
+
return t.activePredictiveAlgorithms.filter((n) => !M.includes(n)).forEach((n) => {
|
|
143
156
|
r.push(...e.filter((s) => s.id === n));
|
|
144
157
|
}), r.map((n) => ({
|
|
145
158
|
text: n.name,
|
|
@@ -157,7 +170,7 @@ const z = () => ({
|
|
|
157
170
|
getFilterList() {
|
|
158
171
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
159
172
|
let e;
|
|
160
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
173
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : P.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
161
174
|
text: t.displayName,
|
|
162
175
|
value: e,
|
|
163
176
|
type: t.attributeType
|
|
@@ -179,7 +192,7 @@ const z = () => ({
|
|
|
179
192
|
setCurrentBlock(t) {
|
|
180
193
|
this.blockStates[t] || (this.blockStates = {
|
|
181
194
|
...this.blockStates,
|
|
182
|
-
[t]:
|
|
195
|
+
[t]: w()
|
|
183
196
|
}), this.currentRecommendationId = t;
|
|
184
197
|
},
|
|
185
198
|
/**
|
|
@@ -247,7 +260,7 @@ const z = () => ({
|
|
|
247
260
|
decimalCount: String(e.currencyDecimalCount),
|
|
248
261
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
249
262
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
250
|
-
}, s = !this.blockStates[t], i = s ?
|
|
263
|
+
}, s = !this.blockStates[t], i = s ? w() : this.blockStates[t];
|
|
251
264
|
i.recommendationConfigs = {
|
|
252
265
|
...i.recommendationConfigs,
|
|
253
266
|
strategy: e.strategy,
|
|
@@ -286,7 +299,7 @@ const z = () => ({
|
|
|
286
299
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
287
300
|
*/
|
|
288
301
|
createDefaultFilter(t, e) {
|
|
289
|
-
const [r] = this.getFilterList, [n] =
|
|
302
|
+
const [r] = this.getFilterList, [n] = F(r == null ? void 0 : r.type);
|
|
290
303
|
return {
|
|
291
304
|
type: "standardFilter",
|
|
292
305
|
attribute: (r == null ? void 0 : r.value) ?? "",
|
|
@@ -339,6 +352,12 @@ const z = () => ({
|
|
|
339
352
|
closeAssignStrategyDrawer() {
|
|
340
353
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !1);
|
|
341
354
|
},
|
|
355
|
+
openLegacyStrategyUpdatedModal() {
|
|
356
|
+
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].legacyStrategyUpdatedModalStatus = !0);
|
|
357
|
+
},
|
|
358
|
+
closeLegacyStrategyUpdatedModal() {
|
|
359
|
+
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].legacyStrategyUpdatedModalStatus = !1);
|
|
360
|
+
},
|
|
342
361
|
openRemoveStrategyModal() {
|
|
343
362
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !0);
|
|
344
363
|
},
|
|
@@ -353,7 +372,7 @@ const z = () => ({
|
|
|
353
372
|
S = (async () => {
|
|
354
373
|
this.strategiesLoading = !0;
|
|
355
374
|
try {
|
|
356
|
-
this.strategies = await
|
|
375
|
+
this.strategies = await m.fetchRecommendationStrategies();
|
|
357
376
|
} finally {
|
|
358
377
|
this.strategiesLoading = !1;
|
|
359
378
|
}
|
|
@@ -368,7 +387,7 @@ const z = () => ({
|
|
|
368
387
|
const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
|
|
369
388
|
if (s)
|
|
370
389
|
return s;
|
|
371
|
-
const { full_path: i = "" } = await
|
|
390
|
+
const { full_path: i = "" } = await m.generateStrategyEndpoint(t, e) ?? {};
|
|
372
391
|
return n && i && (this.strategyUrlTemplates = {
|
|
373
392
|
...this.strategyUrlTemplates,
|
|
374
393
|
[n]: i
|
|
@@ -380,8 +399,44 @@ const z = () => ({
|
|
|
380
399
|
...t.size !== void 0 ? { size: String(t.size) } : {}
|
|
381
400
|
});
|
|
382
401
|
},
|
|
402
|
+
async convertLegacyStrategy(t, e = { scope: "campaign" }) {
|
|
403
|
+
const r = this.currentRecommendationId;
|
|
404
|
+
if (r === null || !this.blockStates[r])
|
|
405
|
+
throw new Error("[Guido] convertLegacyStrategy called without an active block");
|
|
406
|
+
this.blockStates[r].legacyConversionLoading = !0;
|
|
407
|
+
try {
|
|
408
|
+
const n = await m.migrateLegacyStrategy(t, e);
|
|
409
|
+
try {
|
|
410
|
+
await this.fetchStrategies();
|
|
411
|
+
} catch (o) {
|
|
412
|
+
console.error("[Guido] strategy listing refresh after conversion failed", o);
|
|
413
|
+
}
|
|
414
|
+
const s = this.strategies.find((o) => String(o.strategy_id) === n), i = this.blockStates[r];
|
|
415
|
+
return i && (i.recommendationConfigs = {
|
|
416
|
+
...i.recommendationConfigs,
|
|
417
|
+
strategyId: n,
|
|
418
|
+
nodeConfigVersion: y,
|
|
419
|
+
...(s == null ? void 0 : s.size) !== void 0 ? { size: String(s.size) } : {}
|
|
420
|
+
}), this.currentRecommendationId === r && this.configVersion++, n;
|
|
421
|
+
} finally {
|
|
422
|
+
this.blockStates[r] && (this.blockStates[r].legacyConversionLoading = !1);
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
/**
|
|
426
|
+
* Undoes the config half of a conversion whose document write never landed, so the
|
|
427
|
+
* panel and the drawer fall back to "Legacy Strategy" instead of showing an assignment
|
|
428
|
+
* the document never received.
|
|
429
|
+
*/
|
|
430
|
+
revertLegacyConversion(t, e) {
|
|
431
|
+
const r = this.blockStates[t];
|
|
432
|
+
r && (r.recommendationConfigs = { ...r.recommendationConfigs, ...e }, this.currentRecommendationId === t && this.configVersion++);
|
|
433
|
+
},
|
|
383
434
|
removeStrategy() {
|
|
384
|
-
this.patchCurrentBlockConfig({
|
|
435
|
+
this.patchCurrentBlockConfig({
|
|
436
|
+
strategyId: "",
|
|
437
|
+
size: N.size,
|
|
438
|
+
nodeConfigVersion: y
|
|
439
|
+
});
|
|
385
440
|
},
|
|
386
441
|
// ====================================================================
|
|
387
442
|
// Shared Data Fetching (fetched once, used by all blocks)
|
|
@@ -397,7 +452,7 @@ const z = () => ({
|
|
|
397
452
|
activePredictiveAlgorithms: t,
|
|
398
453
|
languages: e,
|
|
399
454
|
currencies: r
|
|
400
|
-
} = await
|
|
455
|
+
} = await m.fetchRecommendationCreateData();
|
|
401
456
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
402
457
|
const n = this.blockStates[this.currentRecommendationId];
|
|
403
458
|
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
@@ -418,7 +473,7 @@ const z = () => ({
|
|
|
418
473
|
return;
|
|
419
474
|
}
|
|
420
475
|
g = (async () => {
|
|
421
|
-
const t = await
|
|
476
|
+
const t = await m.fetchRecommendationFilters();
|
|
422
477
|
this.filterList = t;
|
|
423
478
|
})();
|
|
424
479
|
try {
|
|
@@ -453,7 +508,7 @@ const z = () => ({
|
|
|
453
508
|
const n = [...e.recommendationConfigs.filters];
|
|
454
509
|
n[r] = {
|
|
455
510
|
...t,
|
|
456
|
-
isValid:
|
|
511
|
+
isValid: A(t)
|
|
457
512
|
}, e.recommendationConfigs.filters = n;
|
|
458
513
|
}
|
|
459
514
|
},
|
|
@@ -491,7 +546,7 @@ const z = () => ({
|
|
|
491
546
|
}), e.recommendationConfigs.filters = r;
|
|
492
547
|
},
|
|
493
548
|
generateFilterQuery() {
|
|
494
|
-
return
|
|
549
|
+
return v(this.recommendationConfigs.filters);
|
|
495
550
|
},
|
|
496
551
|
/**
|
|
497
552
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -499,7 +554,7 @@ const z = () => ({
|
|
|
499
554
|
* every block's recommendationConfigs across user edits.
|
|
500
555
|
*/
|
|
501
556
|
hasInvalidBlock() {
|
|
502
|
-
return Object.values(this.blockStates).some((t) => !
|
|
557
|
+
return Object.values(this.blockStates).some((t) => !O(t.recommendationConfigs, this));
|
|
503
558
|
},
|
|
504
559
|
// ====================================================================
|
|
505
560
|
// Per-Block Product Fetching
|
|
@@ -520,12 +575,12 @@ const z = () => ({
|
|
|
520
575
|
},
|
|
521
576
|
async _doFetchProducts() {
|
|
522
577
|
var d;
|
|
523
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
578
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = k();
|
|
524
579
|
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
525
580
|
await this._doFetchStrategyProducts(t);
|
|
526
581
|
return;
|
|
527
582
|
}
|
|
528
|
-
const s = r.filters.filter((
|
|
583
|
+
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 = {
|
|
529
584
|
locale: r.language,
|
|
530
585
|
currency: r.currencySettings.value,
|
|
531
586
|
partnerName: n.partnerName,
|
|
@@ -533,18 +588,27 @@ const z = () => ({
|
|
|
533
588
|
details: !0,
|
|
534
589
|
campaignId: n.variationId
|
|
535
590
|
};
|
|
536
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
591
|
+
r.strategy === "manualMerchandising" ? a.productId = z(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(
|
|
537
592
|
a,
|
|
538
|
-
|
|
593
|
+
B(n.partnerName, r.strategy)
|
|
539
594
|
);
|
|
540
595
|
let l;
|
|
541
596
|
try {
|
|
542
|
-
l = await
|
|
597
|
+
l = await m.fetchRecommendationProducts(o, a);
|
|
543
598
|
} catch {
|
|
544
599
|
l = [];
|
|
545
600
|
}
|
|
546
601
|
this._setBlockProducts(t, l, c);
|
|
547
602
|
},
|
|
603
|
+
/**
|
|
604
|
+
* Block-scoped counterpart of `fetchRecommendationProducts`, which only ever serves the
|
|
605
|
+
* selected block. The legacy conversion must refresh the products of the block that
|
|
606
|
+
* started it even after the user selected another one.
|
|
607
|
+
*/
|
|
608
|
+
async fetchStrategyProductsForBlock(t) {
|
|
609
|
+
var e;
|
|
610
|
+
(e = this.blockStates[t]) != null && e.recommendationConfigs.strategyId && await this._doFetchStrategyProducts(t);
|
|
611
|
+
},
|
|
548
612
|
async _doFetchStrategyProducts(t) {
|
|
549
613
|
const e = (p.get(t) ?? 0) + 1;
|
|
550
614
|
p.set(t, e);
|
|
@@ -557,8 +621,8 @@ const z = () => ({
|
|
|
557
621
|
);
|
|
558
622
|
if (i) {
|
|
559
623
|
s = parseInt(String(i.size ?? "")) || s;
|
|
560
|
-
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),
|
|
561
|
-
|
|
624
|
+
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((I) => I && !I.startsWith("user_id=")), b = u.length ? `${d}?${u.join("&")}` : d;
|
|
625
|
+
b && (n = await m.fetchRecommendationProductsByUrl(b));
|
|
562
626
|
}
|
|
563
627
|
} catch {
|
|
564
628
|
n = [];
|
|
@@ -568,14 +632,14 @@ const z = () => ({
|
|
|
568
632
|
_setBlockProducts(t, e, r) {
|
|
569
633
|
if (!this.blockStates[t])
|
|
570
634
|
return;
|
|
571
|
-
const n = e.length > 0 ? e :
|
|
635
|
+
const n = e.length > 0 ? e : C(r);
|
|
572
636
|
this.blockStates[t].recommendationProducts = [
|
|
573
637
|
...n.slice(0, r),
|
|
574
|
-
...
|
|
638
|
+
...C(Math.max(0, r - n.length))
|
|
575
639
|
];
|
|
576
640
|
}
|
|
577
641
|
}
|
|
578
642
|
});
|
|
579
643
|
export {
|
|
580
|
-
|
|
644
|
+
et as useRecommendationExtensionStore
|
|
581
645
|
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "../constants/selectors.js";
|
|
2
|
+
import { CURRENT_CONFIG_VERSION as m } from "../constants/defaultConfig.js";
|
|
3
|
+
import { sanitizeProductIds as p } from "./productIds.js";
|
|
4
|
+
const d = "manualMerchandising";
|
|
5
|
+
function N({ strategyId: e, nodeConfigVersion: t }) {
|
|
6
|
+
return !e && t < m;
|
|
7
|
+
}
|
|
8
|
+
const o = (e) => {
|
|
9
|
+
const t = String(e ?? "").trim();
|
|
10
|
+
return /^[1-9]\d*$/.test(t) ? t : null;
|
|
11
|
+
};
|
|
12
|
+
function f({ campaignId: e, templateLibraryId: t }) {
|
|
13
|
+
if (o(e))
|
|
14
|
+
return { scope: "campaign" };
|
|
15
|
+
const n = o(t);
|
|
16
|
+
return n ? { scope: "template", templateId: n } : { scope: "campaign" };
|
|
17
|
+
}
|
|
18
|
+
function y({
|
|
19
|
+
blockId: e,
|
|
20
|
+
url: t,
|
|
21
|
+
campaignId: n,
|
|
22
|
+
variationId: a,
|
|
23
|
+
strategy: c,
|
|
24
|
+
productIds: s,
|
|
25
|
+
target: r
|
|
26
|
+
}) {
|
|
27
|
+
const i = c === d ? p(s).split(",").filter(Boolean) : [];
|
|
28
|
+
return {
|
|
29
|
+
...r.scope === "template" ? { templateId: Number.parseInt(r.templateId) } : {
|
|
30
|
+
campaignId: Number.parseInt(n) || 0,
|
|
31
|
+
variationId: Number.parseInt(a) || 0
|
|
32
|
+
},
|
|
33
|
+
blockId: String(e),
|
|
34
|
+
url: t,
|
|
35
|
+
...i.length ? { productIds: i } : {}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
y as buildLegacyMigrationPayload,
|
|
40
|
+
N as isLegacyStrategyConfig,
|
|
41
|
+
f as resolveMigrationTarget
|
|
42
|
+
};
|
|
@@ -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-6bbe5862]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6bbe5862] .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}
|
package/dist/library.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { MessageType as
|
|
1
|
+
import { default as e } from "./components/Guido.vue.js";
|
|
2
|
+
import { MessageType as f, ProductType as s } from "./@types/config/schemas.js";
|
|
3
3
|
import "./@types/config/defaults.js";
|
|
4
|
-
import { getValidationErrors as
|
|
5
|
-
import { assignTrackingIds as
|
|
6
|
-
import { useGuidoEmailEditorStore as C } from "./stores/guido-email-editor.js";
|
|
4
|
+
import { getValidationErrors as d, isValidConfig as p, parseConfig as g, parseConfigSafe as n, validateConfig as l } from "./@types/config/validator.js";
|
|
5
|
+
import { assignTrackingIds as T, readTrackFloor as c, readTrackSeq as x } from "./utils/linkTrackingIds.js";
|
|
7
6
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
e as Guido,
|
|
8
|
+
f as MessageType,
|
|
9
|
+
s as ProductType,
|
|
10
|
+
T as assignTrackingIds,
|
|
11
|
+
d as getValidationErrors,
|
|
13
12
|
p as isValidConfig,
|
|
14
13
|
g as parseConfig,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
n as validateConfig
|
|
14
|
+
n as parseConfigSafe,
|
|
15
|
+
c as readTrackFloor,
|
|
16
|
+
x as readTrackSeq,
|
|
17
|
+
l as validateConfig
|
|
20
18
|
};
|
|
@@ -1,91 +1,100 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { URLS as
|
|
3
|
-
const
|
|
4
|
-
(s,
|
|
5
|
-
attributeName:
|
|
6
|
-
attributeJs:
|
|
7
|
-
attributeType:
|
|
8
|
-
type:
|
|
9
|
-
displayName:
|
|
10
|
-
isFilterable:
|
|
1
|
+
import { useHttp as y } from "../composables/useHttp.js";
|
|
2
|
+
import { MIGRATION_PATHS as R, URLS as i, QUERY_PARAMS as u } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const g = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", l = (r) => r.reduce(
|
|
4
|
+
(s, a, d) => (s[d] = {
|
|
5
|
+
attributeName: a.attributeName,
|
|
6
|
+
attributeJs: a.attributeJs,
|
|
7
|
+
attributeType: a.attributeType,
|
|
8
|
+
type: a.type,
|
|
9
|
+
displayName: a.displayName,
|
|
10
|
+
isFilterable: a.isFilterable
|
|
11
11
|
}, s),
|
|
12
12
|
{}
|
|
13
|
-
),
|
|
14
|
-
const { get:
|
|
13
|
+
), h = (r) => r && typeof r == "object" && "data" in r ? r.data : r, w = () => {
|
|
14
|
+
const { get: r, post: s } = y(), { get: a } = y({ headers: {} }), d = "6KcLM9TwheVB1mgK";
|
|
15
15
|
return {
|
|
16
16
|
fetchRecommendationCreateData: async () => {
|
|
17
17
|
try {
|
|
18
|
-
return (await
|
|
18
|
+
return (await r(`${i.NEWSLETTER_RECOMMENDATIONS_PATH}/create-data`)).data;
|
|
19
19
|
} catch (e) {
|
|
20
20
|
throw console.error("fetchUserModalState error:", e), e;
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
fetchRecommendationFilters: async () => {
|
|
24
24
|
try {
|
|
25
|
-
const { data: e } = await
|
|
26
|
-
|
|
27
|
-
),
|
|
28
|
-
return
|
|
25
|
+
const { data: e } = await r(
|
|
26
|
+
i.PRODUCT_ATTRIBUTES_PATH
|
|
27
|
+
), n = Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
28
|
+
return l(n);
|
|
29
29
|
} catch (e) {
|
|
30
30
|
throw console.error("fetchRecommendationFilters error:", e), e;
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
fetchRecommendationProducts: async (e,
|
|
33
|
+
fetchRecommendationProducts: async (e, n) => {
|
|
34
34
|
var t;
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
console.debug("🏁 Recommendation API Query:",
|
|
40
|
-
const
|
|
41
|
-
`${
|
|
36
|
+
const o = new URLSearchParams(Object.entries(n));
|
|
37
|
+
o.set(u.CLIENT_ID, d);
|
|
38
|
+
const m = decodeURIComponent(o.toString());
|
|
39
|
+
console.debug("🏁 Recommendation API Query:", m);
|
|
40
|
+
const c = await a(
|
|
41
|
+
`${i.RECOMMENDATION_API_URL}/v2/${e}?${m}`
|
|
42
42
|
);
|
|
43
|
-
return ((t =
|
|
44
|
-
} catch (
|
|
45
|
-
throw console.error("fetchRecommendationProducts error:",
|
|
43
|
+
return ((t = c == null ? void 0 : c.data) == null ? void 0 : t.data) ?? [];
|
|
44
|
+
} catch (o) {
|
|
45
|
+
throw console.error("fetchRecommendationProducts error:", o), o;
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
fetchRecommendationProductsByUrl: async (e) => {
|
|
49
|
-
var
|
|
49
|
+
var n;
|
|
50
50
|
try {
|
|
51
|
-
const t = new RegExp(`[?&]${u.CLIENT_ID}=`).test(e),
|
|
52
|
-
|
|
51
|
+
const t = new RegExp(`[?&]${u.CLIENT_ID}=`).test(e), o = e.includes("?") ? "&" : "?", m = t ? e : `${e}${o}${u.CLIENT_ID}=${d}`, c = await a(
|
|
52
|
+
m
|
|
53
53
|
);
|
|
54
|
-
return ((
|
|
54
|
+
return ((n = c == null ? void 0 : c.data) == null ? void 0 : n.data) ?? [];
|
|
55
55
|
} catch (t) {
|
|
56
56
|
return console.error("fetchRecommendationProductsByUrl error:", t), [];
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
fetchRecommendationStrategies: async () => {
|
|
60
60
|
try {
|
|
61
|
-
const { data: e } = await
|
|
62
|
-
`${
|
|
61
|
+
const { data: e } = await r(
|
|
62
|
+
`${i.RECOMMENDATION_STRATEGIES_PATH}?filters=${encodeURIComponent(g)}`
|
|
63
63
|
);
|
|
64
64
|
return Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
65
65
|
} catch (e) {
|
|
66
66
|
throw console.error("fetchRecommendationStrategies error:", e), e;
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
generateStrategyEndpoint: async (e,
|
|
69
|
+
generateStrategyEndpoint: async (e, n) => {
|
|
70
70
|
try {
|
|
71
71
|
const { data: t } = await s(
|
|
72
|
-
`${
|
|
72
|
+
`${i.RECOMMENDATION_STRATEGIES_PATH}/endpoint-generate`,
|
|
73
73
|
{
|
|
74
74
|
campaignId: 0,
|
|
75
75
|
pageTypes: [],
|
|
76
76
|
isPreviewer: !1,
|
|
77
77
|
strategy: e,
|
|
78
78
|
userId: "",
|
|
79
|
-
currency:
|
|
79
|
+
currency: n
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
82
|
return !t || typeof t != "object" || !("full_path" in t || "data" in t) ? (console.error("generateStrategyEndpoint unexpected response shape:", t), null) : "full_path" in t ? t : t.data;
|
|
83
83
|
} catch (t) {
|
|
84
84
|
return console.error("generateStrategyEndpoint error:", t), null;
|
|
85
85
|
}
|
|
86
|
+
},
|
|
87
|
+
migrateLegacyStrategy: async (e, n = { scope: "campaign" }) => {
|
|
88
|
+
const { data: t } = await s(
|
|
89
|
+
R[n.scope],
|
|
90
|
+
e
|
|
91
|
+
), { strategyId: o } = h(t) ?? {};
|
|
92
|
+
if (o == null || o === "")
|
|
93
|
+
throw new Error("[Guido] migrate-strategies returned no strategyId");
|
|
94
|
+
return String(o);
|
|
86
95
|
}
|
|
87
96
|
};
|
|
88
97
|
};
|
|
89
98
|
export {
|
|
90
|
-
|
|
99
|
+
w as useRecommendationApi
|
|
91
100
|
};
|