@useinsider/guido 3.18.1-beta.23c7bd6 → 3.18.1-beta.280b4e1
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 +3 -21
- package/dist/@types/config/schemas.js +51 -59
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +53 -55
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +57 -82
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +22 -24
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +24 -28
- package/dist/composables/useCustomInterfaceAppearance.js +42 -46
- package/dist/enums/extensions/recommendationBlock.js +31 -40
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +69 -70
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +28 -72
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +44 -45
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +57 -121
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +7 -7
- package/dist/guido.css +1 -1
- package/dist/library.js +15 -13
- package/dist/public/editorState.js +4 -0
- package/dist/services/recommendationApi.js +37 -46
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/composables/useConfig.d.ts +0 -4
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -5
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +0 -4
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -70
- package/dist/src/library.d.ts +2 -0
- package/dist/src/public/editorState.d.ts +14 -0
- package/dist/src/public/trackingIds.d.ts +6 -2
- package/dist/src/services/recommendationApi.d.ts +1 -2
- package/dist/src/stores/config.d.ts +0 -322
- package/dist/src/stores/guido-email-editor.d.ts +27 -27
- package/dist/src/stores/onboarding.d.ts +10 -808
- package/dist/static/styles/components/recommendation-strategy.css.js +5 -70
- package/dist/stores/config.js +60 -74
- package/dist/stores/guido-email-editor.js +0 -4
- package/dist/stores/onboarding.js +36 -46
- package/package.json +5 -1
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +0 -18
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +0 -25
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue2.js +0 -46
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +0 -21
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +0 -46
- package/dist/composables/useLegacyStrategyConversion.js +0 -61
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +0 -42
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/RecommendationLegacyStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +0 -2
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +0 -3
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +0 -32
- package/dist/static/assets/icons/filled-arrow-rising.svg.js +0 -5
- package/dist/static/assets/icons/line-info.svg.js +0 -5
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as b, getOperatorOptions as G, PriceAttributes as v } 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 P } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as F } 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 {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let f = null, g = null, h = null, S = null;
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as _, DEFAULT_CARDS_IN_ROW as U } from "../constants/layout.js";
|
|
7
|
+
import { DEFAULT_NODE_CONFIG as N, EXCLUDED_ALGORITHM_IDS as L } from "../constants/defaultConfig.js";
|
|
8
|
+
import { getDefaultProducts as R } from "../templates/utils.js";
|
|
9
|
+
import { generateCompleteFilterQuery as k } from "../utils/filterUtil.js";
|
|
10
|
+
import { getPartnerRecommendationParams as x } from "../utils/partnerCustomizations.js";
|
|
11
|
+
import { sanitizeProductIds as A } from "../utils/productIds.js";
|
|
12
|
+
import { isFilterValid as B } from "../validation/filterSchema.js";
|
|
13
|
+
import { isConfigValid as M } from "../validation/requiredFields.js";
|
|
14
|
+
const u = D();
|
|
15
|
+
let f = null, h = null, g = null, S = null;
|
|
17
16
|
const p = /* @__PURE__ */ new Map();
|
|
18
|
-
function
|
|
17
|
+
function w() {
|
|
19
18
|
return {
|
|
20
|
-
cardsInRow:
|
|
19
|
+
cardsInRow: U,
|
|
21
20
|
currencySettings: {
|
|
22
21
|
name: "USD",
|
|
23
22
|
value: "USD",
|
|
@@ -31,7 +30,7 @@ function G() {
|
|
|
31
30
|
productIds: [],
|
|
32
31
|
id: 1,
|
|
33
32
|
language: "en_US",
|
|
34
|
-
mobileCardsInRow:
|
|
33
|
+
mobileCardsInRow: _,
|
|
35
34
|
mobileLayoutEnabled: !1,
|
|
36
35
|
orientation: "grid",
|
|
37
36
|
recommendedProducts: [],
|
|
@@ -39,7 +38,6 @@ function G() {
|
|
|
39
38
|
shuffleProducts: !1,
|
|
40
39
|
strategy: "mostPopular",
|
|
41
40
|
strategyId: "",
|
|
42
|
-
nodeConfigVersion: y,
|
|
43
41
|
textTrimming: !0,
|
|
44
42
|
unresponsive: !1,
|
|
45
43
|
size: "6",
|
|
@@ -48,22 +46,20 @@ function G() {
|
|
|
48
46
|
priceHideIfSameAsDiscounted: !1
|
|
49
47
|
};
|
|
50
48
|
}
|
|
51
|
-
function
|
|
49
|
+
function C() {
|
|
52
50
|
return {
|
|
53
|
-
recommendationConfigs:
|
|
51
|
+
recommendationConfigs: w(),
|
|
54
52
|
recommendationProducts: [],
|
|
55
53
|
filterStatus: !1,
|
|
56
54
|
filterSelectionDrawerStatus: !1,
|
|
57
55
|
assignStrategyDrawerStatus: !1,
|
|
58
56
|
removeStrategyModalStatus: !1,
|
|
59
|
-
legacyStrategyUpdatedModalStatus: !1,
|
|
60
57
|
filterGroup: 1,
|
|
61
58
|
isInitialized: !1,
|
|
62
|
-
filterSnapshot: null
|
|
63
|
-
legacyConversionLoading: !1
|
|
59
|
+
filterSnapshot: null
|
|
64
60
|
};
|
|
65
61
|
}
|
|
66
|
-
const
|
|
62
|
+
const z = () => ({
|
|
67
63
|
recommendationCampaignUrls: {},
|
|
68
64
|
activePredictiveAlgorithms: [],
|
|
69
65
|
languages: {},
|
|
@@ -75,8 +71,8 @@ const E = () => ({
|
|
|
75
71
|
blockStates: {},
|
|
76
72
|
currentRecommendationId: null,
|
|
77
73
|
configVersion: 0
|
|
78
|
-
}),
|
|
79
|
-
state: () =>
|
|
74
|
+
}), Y = F("guidoRecommendationExtension", {
|
|
75
|
+
state: () => z(),
|
|
80
76
|
getters: {
|
|
81
77
|
// ====================================================================
|
|
82
78
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -86,7 +82,7 @@ const E = () => ({
|
|
|
86
82
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
87
83
|
*/
|
|
88
84
|
recommendationConfigs(t) {
|
|
89
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
85
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : w();
|
|
90
86
|
},
|
|
91
87
|
/**
|
|
92
88
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -106,15 +102,6 @@ const E = () => ({
|
|
|
106
102
|
removeStrategyModalStatus(t) {
|
|
107
103
|
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].removeStrategyModalStatus : !1;
|
|
108
104
|
},
|
|
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
|
-
},
|
|
118
105
|
assignedStrategy(t) {
|
|
119
106
|
const { strategyId: e } = this.recommendationConfigs;
|
|
120
107
|
return e ? t.strategies.find((r) => String(r.strategy_id) === e) ?? null : null;
|
|
@@ -150,8 +137,8 @@ const E = () => ({
|
|
|
150
137
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
|
|
151
138
|
},
|
|
152
139
|
getActivePredictiveAlgorithms: (t) => {
|
|
153
|
-
const e =
|
|
154
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
140
|
+
const e = b(), r = [];
|
|
141
|
+
return t.activePredictiveAlgorithms.filter((n) => !L.includes(n)).forEach((n) => {
|
|
155
142
|
r.push(...e.filter((s) => s.id === n));
|
|
156
143
|
}), r.map((n) => ({
|
|
157
144
|
text: n.name,
|
|
@@ -169,7 +156,7 @@ const E = () => ({
|
|
|
169
156
|
getFilterList() {
|
|
170
157
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
171
158
|
let e;
|
|
172
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
159
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : v.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
173
160
|
text: t.displayName,
|
|
174
161
|
value: e,
|
|
175
162
|
type: t.attributeType
|
|
@@ -191,7 +178,7 @@ const E = () => ({
|
|
|
191
178
|
setCurrentBlock(t) {
|
|
192
179
|
this.blockStates[t] || (this.blockStates = {
|
|
193
180
|
...this.blockStates,
|
|
194
|
-
[t]:
|
|
181
|
+
[t]: C()
|
|
195
182
|
}), this.currentRecommendationId = t;
|
|
196
183
|
},
|
|
197
184
|
/**
|
|
@@ -259,7 +246,7 @@ const E = () => ({
|
|
|
259
246
|
decimalCount: String(e.currencyDecimalCount),
|
|
260
247
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
261
248
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
262
|
-
}, s = !this.blockStates[t], i = s ?
|
|
249
|
+
}, s = !this.blockStates[t], i = s ? C() : this.blockStates[t];
|
|
263
250
|
i.recommendationConfigs = {
|
|
264
251
|
...i.recommendationConfigs,
|
|
265
252
|
strategy: e.strategy,
|
|
@@ -298,7 +285,7 @@ const E = () => ({
|
|
|
298
285
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
299
286
|
*/
|
|
300
287
|
createDefaultFilter(t, e) {
|
|
301
|
-
const [r] = this.getFilterList, [n] =
|
|
288
|
+
const [r] = this.getFilterList, [n] = G(r == null ? void 0 : r.type);
|
|
302
289
|
return {
|
|
303
290
|
type: "standardFilter",
|
|
304
291
|
attribute: (r == null ? void 0 : r.value) ?? "",
|
|
@@ -351,12 +338,6 @@ const E = () => ({
|
|
|
351
338
|
closeAssignStrategyDrawer() {
|
|
352
339
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].assignStrategyDrawerStatus = !1);
|
|
353
340
|
},
|
|
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
|
-
},
|
|
360
341
|
openRemoveStrategyModal() {
|
|
361
342
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !0);
|
|
362
343
|
},
|
|
@@ -371,7 +352,7 @@ const E = () => ({
|
|
|
371
352
|
S = (async () => {
|
|
372
353
|
this.strategiesLoading = !0;
|
|
373
354
|
try {
|
|
374
|
-
this.strategies = await
|
|
355
|
+
this.strategies = await u.fetchRecommendationStrategies();
|
|
375
356
|
} finally {
|
|
376
357
|
this.strategiesLoading = !1;
|
|
377
358
|
}
|
|
@@ -386,7 +367,7 @@ const E = () => ({
|
|
|
386
367
|
const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
|
|
387
368
|
if (s)
|
|
388
369
|
return s;
|
|
389
|
-
const { full_path: i = "" } = await
|
|
370
|
+
const { full_path: i = "" } = await u.generateStrategyEndpoint(t, e) ?? {};
|
|
390
371
|
return n && i && (this.strategyUrlTemplates = {
|
|
391
372
|
...this.strategyUrlTemplates,
|
|
392
373
|
[n]: i
|
|
@@ -398,44 +379,8 @@ const E = () => ({
|
|
|
398
379
|
...t.size !== void 0 ? { size: String(t.size) } : {}
|
|
399
380
|
});
|
|
400
381
|
},
|
|
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
|
-
},
|
|
424
|
-
/**
|
|
425
|
-
* Undoes the config half of a conversion whose document write never landed, so the
|
|
426
|
-
* panel and the drawer fall back to "Legacy Strategy" instead of showing an assignment
|
|
427
|
-
* the document never received.
|
|
428
|
-
*/
|
|
429
|
-
revertLegacyConversion(t, e) {
|
|
430
|
-
const r = this.blockStates[t];
|
|
431
|
-
r && (r.recommendationConfigs = { ...r.recommendationConfigs, ...e }, this.currentRecommendationId === t && this.configVersion++);
|
|
432
|
-
},
|
|
433
382
|
removeStrategy() {
|
|
434
|
-
this.patchCurrentBlockConfig({
|
|
435
|
-
strategyId: "",
|
|
436
|
-
size: N.size,
|
|
437
|
-
nodeConfigVersion: y
|
|
438
|
-
});
|
|
383
|
+
this.patchCurrentBlockConfig({ strategyId: "", size: N.size });
|
|
439
384
|
},
|
|
440
385
|
// ====================================================================
|
|
441
386
|
// Shared Data Fetching (fetched once, used by all blocks)
|
|
@@ -451,7 +396,7 @@ const E = () => ({
|
|
|
451
396
|
activePredictiveAlgorithms: t,
|
|
452
397
|
languages: e,
|
|
453
398
|
currencies: r
|
|
454
|
-
} = await
|
|
399
|
+
} = await u.fetchRecommendationCreateData();
|
|
455
400
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
456
401
|
const n = this.blockStates[this.currentRecommendationId];
|
|
457
402
|
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
@@ -467,18 +412,18 @@ const E = () => ({
|
|
|
467
412
|
},
|
|
468
413
|
async fetchRecommendationFilters() {
|
|
469
414
|
if (!Object.keys(this.filterList).length) {
|
|
470
|
-
if (
|
|
471
|
-
await
|
|
415
|
+
if (h) {
|
|
416
|
+
await h;
|
|
472
417
|
return;
|
|
473
418
|
}
|
|
474
|
-
|
|
475
|
-
const t = await
|
|
419
|
+
h = (async () => {
|
|
420
|
+
const t = await u.fetchRecommendationFilters();
|
|
476
421
|
this.filterList = t;
|
|
477
422
|
})();
|
|
478
423
|
try {
|
|
479
|
-
await
|
|
424
|
+
await h;
|
|
480
425
|
} finally {
|
|
481
|
-
|
|
426
|
+
h = null;
|
|
482
427
|
}
|
|
483
428
|
}
|
|
484
429
|
},
|
|
@@ -507,7 +452,7 @@ const E = () => ({
|
|
|
507
452
|
const n = [...e.recommendationConfigs.filters];
|
|
508
453
|
n[r] = {
|
|
509
454
|
...t,
|
|
510
|
-
isValid:
|
|
455
|
+
isValid: B(t)
|
|
511
456
|
}, e.recommendationConfigs.filters = n;
|
|
512
457
|
}
|
|
513
458
|
},
|
|
@@ -545,7 +490,7 @@ const E = () => ({
|
|
|
545
490
|
}), e.recommendationConfigs.filters = r;
|
|
546
491
|
},
|
|
547
492
|
generateFilterQuery() {
|
|
548
|
-
return
|
|
493
|
+
return k(this.recommendationConfigs.filters);
|
|
549
494
|
},
|
|
550
495
|
/**
|
|
551
496
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -553,33 +498,33 @@ const E = () => ({
|
|
|
553
498
|
* every block's recommendationConfigs across user edits.
|
|
554
499
|
*/
|
|
555
500
|
hasInvalidBlock() {
|
|
556
|
-
return Object.values(this.blockStates).some((t) => !
|
|
501
|
+
return Object.values(this.blockStates).some((t) => !M(t.recommendationConfigs, this));
|
|
557
502
|
},
|
|
558
503
|
// ====================================================================
|
|
559
504
|
// Per-Block Product Fetching
|
|
560
505
|
// ====================================================================
|
|
561
506
|
async fetchRecommendationProducts() {
|
|
562
507
|
if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
|
|
563
|
-
if (
|
|
564
|
-
await
|
|
508
|
+
if (g) {
|
|
509
|
+
await g;
|
|
565
510
|
return;
|
|
566
511
|
}
|
|
567
|
-
|
|
512
|
+
g = this._doFetchProducts();
|
|
568
513
|
try {
|
|
569
|
-
await
|
|
514
|
+
await g;
|
|
570
515
|
} finally {
|
|
571
|
-
|
|
516
|
+
g = null;
|
|
572
517
|
}
|
|
573
518
|
}
|
|
574
519
|
},
|
|
575
520
|
async _doFetchProducts() {
|
|
576
521
|
var d;
|
|
577
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
522
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = P();
|
|
578
523
|
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
579
524
|
await this._doFetchStrategyProducts(t);
|
|
580
525
|
return;
|
|
581
526
|
}
|
|
582
|
-
const s = r.filters.filter((
|
|
527
|
+
const s = r.filters.filter((m) => m.isValid), i = k(s), o = ((d = b().find((m) => m.key === r.strategy)) == null ? void 0 : d.path) || "", c = parseInt(r.size) || 6, a = {
|
|
583
528
|
locale: r.language,
|
|
584
529
|
currency: r.currencySettings.value,
|
|
585
530
|
partnerName: n.partnerName,
|
|
@@ -587,27 +532,18 @@ const E = () => ({
|
|
|
587
532
|
details: !0,
|
|
588
533
|
campaignId: n.variationId
|
|
589
534
|
};
|
|
590
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
535
|
+
r.strategy === "manualMerchandising" ? a.productId = A(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(
|
|
591
536
|
a,
|
|
592
|
-
|
|
537
|
+
x(n.partnerName, r.strategy)
|
|
593
538
|
);
|
|
594
539
|
let l;
|
|
595
540
|
try {
|
|
596
|
-
l = await
|
|
541
|
+
l = await u.fetchRecommendationProducts(o, a);
|
|
597
542
|
} catch {
|
|
598
543
|
l = [];
|
|
599
544
|
}
|
|
600
545
|
this._setBlockProducts(t, l, c);
|
|
601
546
|
},
|
|
602
|
-
/**
|
|
603
|
-
* Block-scoped counterpart of `fetchRecommendationProducts`, which only ever serves the
|
|
604
|
-
* selected block. The legacy conversion must refresh the products of the block that
|
|
605
|
-
* started it even after the user selected another one.
|
|
606
|
-
*/
|
|
607
|
-
async fetchStrategyProductsForBlock(t) {
|
|
608
|
-
var e;
|
|
609
|
-
(e = this.blockStates[t]) != null && e.recommendationConfigs.strategyId && await this._doFetchStrategyProducts(t);
|
|
610
|
-
},
|
|
611
547
|
async _doFetchStrategyProducts(t) {
|
|
612
548
|
const e = (p.get(t) ?? 0) + 1;
|
|
613
549
|
p.set(t, e);
|
|
@@ -620,8 +556,8 @@ const E = () => ({
|
|
|
620
556
|
);
|
|
621
557
|
if (i) {
|
|
622
558
|
s = parseInt(String(i.size ?? "")) || s;
|
|
623
|
-
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),
|
|
624
|
-
|
|
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), m = (l === -1 ? "" : a.slice(l + 1)).split("&").filter((I) => I && !I.startsWith("user_id=")), y = m.length ? `${d}?${m.join("&")}` : d;
|
|
560
|
+
y && (n = await u.fetchRecommendationProductsByUrl(y));
|
|
625
561
|
}
|
|
626
562
|
} catch {
|
|
627
563
|
n = [];
|
|
@@ -631,14 +567,14 @@ const E = () => ({
|
|
|
631
567
|
_setBlockProducts(t, e, r) {
|
|
632
568
|
if (!this.blockStates[t])
|
|
633
569
|
return;
|
|
634
|
-
const n = e.length > 0 ? e :
|
|
570
|
+
const n = e.length > 0 ? e : R(r);
|
|
635
571
|
this.blockStates[t].recommendationProducts = [
|
|
636
572
|
...n.slice(0, r),
|
|
637
|
-
...
|
|
573
|
+
...R(Math.max(0, r - n.length))
|
|
638
574
|
];
|
|
639
575
|
}
|
|
640
576
|
}
|
|
641
577
|
});
|
|
642
578
|
export {
|
|
643
|
-
|
|
579
|
+
Y as useRecommendationExtensionStore
|
|
644
580
|
};
|
|
@@ -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 a, updateProductContentInPlace as d, regenerateProductRowsWithStyles as l } from "../controls/main/utils.js";
|
|
4
|
+
import { RecommendationConfigService as s } from "../services/configService.js";
|
|
5
5
|
let e = null;
|
|
6
|
-
function
|
|
6
|
+
function N(r) {
|
|
7
7
|
e = r;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function D(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 N(r, c, i, u) {
|
|
|
14
14
|
if (!t)
|
|
15
15
|
return !1;
|
|
16
16
|
const o = e.getDocumentModifier();
|
|
17
|
-
return
|
|
17
|
+
return s.stageConfig(o, t, c), a(t) ? (o.apply(new f(u)), !0) : (d({ currentNode: t, documentModifier: o, products: i }) || l({ currentNode: t, documentModifier: o, products: i }), !0);
|
|
18
18
|
}
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
D as commitBlockChangeOutsidePanel,
|
|
21
|
+
N 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-050dfa52]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-050dfa52]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-050dfa52]{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}.assign-strategy-drawer-content .assign-strategy-select[data-v-2580a7d9]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-2580a7d9] .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}
|
package/dist/library.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { MessageType as
|
|
1
|
+
import { default as a } from "./components/Guido.vue.js";
|
|
2
|
+
import { MessageType as t, ProductType as d } from "./@types/config/schemas.js";
|
|
3
3
|
import "./@types/config/defaults.js";
|
|
4
|
-
import { getValidationErrors as
|
|
5
|
-
import { assignTrackingIds as
|
|
4
|
+
import { getValidationErrors as s, isValidConfig as p, parseConfig as g, parseConfigSafe as m, validateConfig as n } from "./@types/config/validator.js";
|
|
5
|
+
import { assignTrackingIds as u, readTrackFloor as x, readTrackSeq as T } from "./utils/linkTrackingIds.js";
|
|
6
|
+
import { useGuidoEmailEditorStore as C } from "./stores/guido-email-editor.js";
|
|
6
7
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
a as Guido,
|
|
9
|
+
t as MessageType,
|
|
10
|
+
d as ProductType,
|
|
11
|
+
u as assignTrackingIds,
|
|
12
|
+
s as getValidationErrors,
|
|
12
13
|
p as isValidConfig,
|
|
13
14
|
g as parseConfig,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
m as parseConfigSafe,
|
|
16
|
+
x as readTrackFloor,
|
|
17
|
+
T as readTrackSeq,
|
|
18
|
+
C as useGuidoEmailEditorStore,
|
|
19
|
+
n as validateConfig
|
|
18
20
|
};
|
|
@@ -1,100 +1,91 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
(s,
|
|
5
|
-
attributeName:
|
|
6
|
-
attributeJs:
|
|
7
|
-
attributeType:
|
|
8
|
-
type:
|
|
9
|
-
displayName:
|
|
10
|
-
isFilterable:
|
|
1
|
+
import { useHttp as l } from "../composables/useHttp.js";
|
|
2
|
+
import { URLS as m, QUERY_PARAMS as u } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const y = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", R = (c) => c.reduce(
|
|
4
|
+
(s, r, i) => (s[i] = {
|
|
5
|
+
attributeName: r.attributeName,
|
|
6
|
+
attributeJs: r.attributeJs,
|
|
7
|
+
attributeType: r.attributeType,
|
|
8
|
+
type: r.type,
|
|
9
|
+
displayName: r.displayName,
|
|
10
|
+
isFilterable: r.isFilterable
|
|
11
11
|
}, s),
|
|
12
12
|
{}
|
|
13
|
-
),
|
|
14
|
-
const { get:
|
|
13
|
+
), _ = () => {
|
|
14
|
+
const { get: c, post: s } = l(), { get: r } = l({ headers: {} }), i = "6KcLM9TwheVB1mgK";
|
|
15
15
|
return {
|
|
16
16
|
fetchRecommendationCreateData: async () => {
|
|
17
17
|
try {
|
|
18
|
-
return (await
|
|
18
|
+
return (await c("/newsletter/recommendations/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 c(
|
|
26
|
+
m.PRODUCT_ATTRIBUTES_PATH
|
|
27
|
+
), o = Array.isArray(e) ? e : (e == null ? void 0 : e.data) ?? [];
|
|
28
|
+
return R(o);
|
|
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, o) => {
|
|
34
34
|
var t;
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
console.debug("🏁 Recommendation API Query:",
|
|
40
|
-
const
|
|
41
|
-
`${
|
|
36
|
+
const n = new URLSearchParams(Object.entries(o));
|
|
37
|
+
n.set(u.CLIENT_ID, i);
|
|
38
|
+
const d = decodeURIComponent(n.toString());
|
|
39
|
+
console.debug("🏁 Recommendation API Query:", d);
|
|
40
|
+
const a = await r(
|
|
41
|
+
`${m.RECOMMENDATION_API_URL}/v2/${e}?${d}`
|
|
42
42
|
);
|
|
43
|
-
return ((t =
|
|
44
|
-
} catch (
|
|
45
|
-
throw console.error("fetchRecommendationProducts error:",
|
|
43
|
+
return ((t = a == null ? void 0 : a.data) == null ? void 0 : t.data) ?? [];
|
|
44
|
+
} catch (n) {
|
|
45
|
+
throw console.error("fetchRecommendationProducts error:", n), n;
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
fetchRecommendationProductsByUrl: async (e) => {
|
|
49
|
-
var
|
|
49
|
+
var o;
|
|
50
50
|
try {
|
|
51
|
-
const t = new RegExp(`[?&]${u.CLIENT_ID}=`).test(e),
|
|
52
|
-
|
|
51
|
+
const t = new RegExp(`[?&]${u.CLIENT_ID}=`).test(e), n = e.includes("?") ? "&" : "?", d = t ? e : `${e}${n}${u.CLIENT_ID}=${i}`, a = await r(
|
|
52
|
+
d
|
|
53
53
|
);
|
|
54
|
-
return ((
|
|
54
|
+
return ((o = a == null ? void 0 : a.data) == null ? void 0 : o.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 c(
|
|
62
|
+
`${m.RECOMMENDATION_STRATEGIES_PATH}?filters=${encodeURIComponent(y)}`
|
|
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, o) => {
|
|
70
70
|
try {
|
|
71
71
|
const { data: t } = await s(
|
|
72
|
-
`${
|
|
72
|
+
`${m.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: o
|
|
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);
|
|
95
86
|
}
|
|
96
87
|
};
|
|
97
88
|
};
|
|
98
89
|
export {
|
|
99
|
-
|
|
90
|
+
_ as useRecommendationApi
|
|
100
91
|
};
|