@useinsider/guido 3.17.0-beta.a0d17c2 → 3.17.0-beta.a2334c9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Guido.vue.js +4 -4
- package/dist/components/Guido.vue2.js +48 -46
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +7 -7
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +80 -55
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js +18 -0
- package/dist/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue2.js +25 -0
- package/dist/composables/useLegacyStrategyConversion.js +52 -0
- package/dist/enums/extensions/recommendationBlock.js +2 -1
- package/dist/extensions/Blocks/Recommendation/block.js +12 -11
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +14 -13
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +92 -90
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +62 -28
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +90 -49
- package/dist/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js +58 -0
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +9 -9
- package/dist/guido.css +1 -1
- package/dist/services/recommendationApi.js +61 -52
- package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts +2 -0
- package/dist/src/composables/useLegacyStrategyConversion.d.ts +3 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +54 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/legacyStrategyMigration.d.ts +39 -0
- package/dist/src/services/recommendationApi.d.ts +2 -1
- package/dist/static/styles/components/recommendation-strategy.css.js +33 -3
- package/package.json +1 -1
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as b, getOperatorOptions as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as b, getOperatorOptions as D, PriceAttributes as F } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as P } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as R } 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 { DEFAULT_NODE_CONFIG as N, CURRENT_CONFIG_VERSION as w, EXCLUDED_ALGORITHM_IDS as M } from "../constants/defaultConfig.js";
|
|
8
|
+
import { getDefaultProducts as k } from "../templates/utils.js";
|
|
9
|
+
import { generateCompleteFilterQuery as C } 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 u = 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: w,
|
|
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 v() {
|
|
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 R().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;
|
|
@@ -138,7 +151,7 @@ const z = () => ({
|
|
|
138
151
|
},
|
|
139
152
|
getActivePredictiveAlgorithms: (t) => {
|
|
140
153
|
const e = b(), r = [];
|
|
141
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
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]: v()
|
|
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 ? v() : 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
|
},
|
|
@@ -379,6 +398,28 @@ const z = () => ({
|
|
|
379
398
|
...t.size !== void 0 ? { size: String(t.size) } : {}
|
|
380
399
|
});
|
|
381
400
|
},
|
|
401
|
+
async convertLegacyStrategy(t) {
|
|
402
|
+
const e = this.currentRecommendationId;
|
|
403
|
+
if (e === null || !this.blockStates[e])
|
|
404
|
+
throw new Error("[Guido] convertLegacyStrategy called without an active block");
|
|
405
|
+
this.blockStates[e].legacyConversionLoading = !0;
|
|
406
|
+
try {
|
|
407
|
+
const r = await u.migrateLegacyStrategy(t);
|
|
408
|
+
try {
|
|
409
|
+
await this.fetchStrategies();
|
|
410
|
+
} catch (s) {
|
|
411
|
+
console.error("[Guido] strategy listing refresh after conversion failed", s);
|
|
412
|
+
}
|
|
413
|
+
const n = this.strategies.find((s) => String(s.strategy_id) === r);
|
|
414
|
+
return this.patchCurrentBlockConfig({
|
|
415
|
+
strategyId: r,
|
|
416
|
+
nodeConfigVersion: w,
|
|
417
|
+
...(n == null ? void 0 : n.size) !== void 0 ? { size: String(n.size) } : {}
|
|
418
|
+
}), r;
|
|
419
|
+
} finally {
|
|
420
|
+
this.blockStates[e].legacyConversionLoading = !1;
|
|
421
|
+
}
|
|
422
|
+
},
|
|
382
423
|
removeStrategy() {
|
|
383
424
|
this.patchCurrentBlockConfig({ strategyId: "", size: N.size });
|
|
384
425
|
},
|
|
@@ -412,18 +453,18 @@ const z = () => ({
|
|
|
412
453
|
},
|
|
413
454
|
async fetchRecommendationFilters() {
|
|
414
455
|
if (!Object.keys(this.filterList).length) {
|
|
415
|
-
if (
|
|
416
|
-
await
|
|
456
|
+
if (g) {
|
|
457
|
+
await g;
|
|
417
458
|
return;
|
|
418
459
|
}
|
|
419
|
-
|
|
460
|
+
g = (async () => {
|
|
420
461
|
const t = await u.fetchRecommendationFilters();
|
|
421
462
|
this.filterList = t;
|
|
422
463
|
})();
|
|
423
464
|
try {
|
|
424
|
-
await
|
|
465
|
+
await g;
|
|
425
466
|
} finally {
|
|
426
|
-
|
|
467
|
+
g = null;
|
|
427
468
|
}
|
|
428
469
|
}
|
|
429
470
|
},
|
|
@@ -452,7 +493,7 @@ const z = () => ({
|
|
|
452
493
|
const n = [...e.recommendationConfigs.filters];
|
|
453
494
|
n[r] = {
|
|
454
495
|
...t,
|
|
455
|
-
isValid:
|
|
496
|
+
isValid: A(t)
|
|
456
497
|
}, e.recommendationConfigs.filters = n;
|
|
457
498
|
}
|
|
458
499
|
},
|
|
@@ -490,7 +531,7 @@ const z = () => ({
|
|
|
490
531
|
}), e.recommendationConfigs.filters = r;
|
|
491
532
|
},
|
|
492
533
|
generateFilterQuery() {
|
|
493
|
-
return
|
|
534
|
+
return C(this.recommendationConfigs.filters);
|
|
494
535
|
},
|
|
495
536
|
/**
|
|
496
537
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -498,33 +539,33 @@ const z = () => ({
|
|
|
498
539
|
* every block's recommendationConfigs across user edits.
|
|
499
540
|
*/
|
|
500
541
|
hasInvalidBlock() {
|
|
501
|
-
return Object.values(this.blockStates).some((t) => !
|
|
542
|
+
return Object.values(this.blockStates).some((t) => !O(t.recommendationConfigs, this));
|
|
502
543
|
},
|
|
503
544
|
// ====================================================================
|
|
504
545
|
// Per-Block Product Fetching
|
|
505
546
|
// ====================================================================
|
|
506
547
|
async fetchRecommendationProducts() {
|
|
507
548
|
if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
|
|
508
|
-
if (
|
|
509
|
-
await
|
|
549
|
+
if (h) {
|
|
550
|
+
await h;
|
|
510
551
|
return;
|
|
511
552
|
}
|
|
512
|
-
|
|
553
|
+
h = this._doFetchProducts();
|
|
513
554
|
try {
|
|
514
|
-
await
|
|
555
|
+
await h;
|
|
515
556
|
} finally {
|
|
516
|
-
|
|
557
|
+
h = null;
|
|
517
558
|
}
|
|
518
559
|
}
|
|
519
560
|
},
|
|
520
561
|
async _doFetchProducts() {
|
|
521
562
|
var d;
|
|
522
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
563
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = R();
|
|
523
564
|
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
524
565
|
await this._doFetchStrategyProducts(t);
|
|
525
566
|
return;
|
|
526
567
|
}
|
|
527
|
-
const s = r.filters.filter((m) => m.isValid), i =
|
|
568
|
+
const s = r.filters.filter((m) => m.isValid), i = C(s), o = ((d = b().find((m) => m.key === r.strategy)) == null ? void 0 : d.path) || "", c = parseInt(r.size) || 6, a = {
|
|
528
569
|
locale: r.language,
|
|
529
570
|
currency: r.currencySettings.value,
|
|
530
571
|
partnerName: n.partnerName,
|
|
@@ -532,9 +573,9 @@ const z = () => ({
|
|
|
532
573
|
details: !0,
|
|
533
574
|
campaignId: n.variationId
|
|
534
575
|
};
|
|
535
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
576
|
+
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(
|
|
536
577
|
a,
|
|
537
|
-
|
|
578
|
+
B(n.partnerName, r.strategy)
|
|
538
579
|
);
|
|
539
580
|
let l;
|
|
540
581
|
try {
|
|
@@ -567,14 +608,14 @@ const z = () => ({
|
|
|
567
608
|
_setBlockProducts(t, e, r) {
|
|
568
609
|
if (!this.blockStates[t])
|
|
569
610
|
return;
|
|
570
|
-
const n = e.length > 0 ? e :
|
|
611
|
+
const n = e.length > 0 ? e : k(r);
|
|
571
612
|
this.blockStates[t].recommendationProducts = [
|
|
572
613
|
...n.slice(0, r),
|
|
573
|
-
...
|
|
614
|
+
...k(Math.max(0, r - n.length))
|
|
574
615
|
];
|
|
575
616
|
}
|
|
576
617
|
}
|
|
577
618
|
});
|
|
578
619
|
export {
|
|
579
|
-
|
|
620
|
+
et as useRecommendationExtensionStore
|
|
580
621
|
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { OP_ANY_OF as u } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import "../constants/selectors.js";
|
|
3
|
+
import { CURRENT_CONFIG_VERSION as d } from "../constants/defaultConfig.js";
|
|
4
|
+
import { parseTagList as m } from "./filterUtil.js";
|
|
5
|
+
import { sanitizeProductIds as l } from "./productIds.js";
|
|
6
|
+
const I = "String", N = "manualMerchandising";
|
|
7
|
+
function _({ strategyId: t, nodeConfigVersion: e }) {
|
|
8
|
+
return !t && e < d;
|
|
9
|
+
}
|
|
10
|
+
const c = (t) => t === "|" ? "or" : "and", b = (t, e) => {
|
|
11
|
+
var r;
|
|
12
|
+
return {
|
|
13
|
+
conditionLogic: c(t.innerGroupOperator),
|
|
14
|
+
attribute: {
|
|
15
|
+
attributeName: t.attribute,
|
|
16
|
+
attributeType: ((r = e.find((o) => o.value === t.attribute)) == null ? void 0 : r.type) || I
|
|
17
|
+
},
|
|
18
|
+
operator: { operator: t.operator === u ? "=" : t.operator },
|
|
19
|
+
value: t.operator === u ? m(t.value).join(u) : t.value
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
function f(t, e) {
|
|
23
|
+
const r = /* @__PURE__ */ new Map();
|
|
24
|
+
return t.filter((o) => o.isValid).forEach((o) => {
|
|
25
|
+
r.set(o.filterGroup, [...r.get(o.filterGroup) ?? [], o]);
|
|
26
|
+
}), [...r.keys()].sort((o, i) => o - i).map((o) => {
|
|
27
|
+
const i = [...r.get(o) ?? []].sort((n, a) => n.filterNumber - a.filterNumber);
|
|
28
|
+
return {
|
|
29
|
+
groupLogic: c(i[0].outerGroupOperator),
|
|
30
|
+
conditionList: i.map((n) => b(n, e))
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function A({
|
|
35
|
+
blockId: t,
|
|
36
|
+
url: e,
|
|
37
|
+
templateId: r,
|
|
38
|
+
variationId: o,
|
|
39
|
+
strategy: i,
|
|
40
|
+
productIds: n,
|
|
41
|
+
filters: a,
|
|
42
|
+
attributes: g
|
|
43
|
+
}) {
|
|
44
|
+
const p = f(a, g), s = i === N ? l(n).split(",").filter(Boolean) : [];
|
|
45
|
+
return {
|
|
46
|
+
campaignId: Number.parseInt(r) || 0,
|
|
47
|
+
variationId: Number.parseInt(o) || 0,
|
|
48
|
+
blockId: String(t),
|
|
49
|
+
url: e,
|
|
50
|
+
...p.length ? { filters: p } : {},
|
|
51
|
+
...s.length ? { productIds: s } : {}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export {
|
|
55
|
+
A as buildLegacyMigrationPayload,
|
|
56
|
+
_ as isLegacyStrategyConfig,
|
|
57
|
+
f as toMigrationFilterGroups
|
|
58
|
+
};
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { ModificationDescription as f } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { RECOMMENDATION_ID_ATTR as m } from "../constants/selectors.js";
|
|
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;
|
|
13
|
-
const t = n.querySelector(`[${
|
|
13
|
+
const t = n.querySelector(`[${m}="${r}"]`);
|
|
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-6e711fd7]{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-6e711fd7]{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-d1f80922]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-d1f80922]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-d1f80922]{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-59777460]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-59777460] .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-13275a66]{position:relative;z-index:145}
|
|
@@ -1,88 +1,97 @@
|
|
|
1
|
-
import { useHttp as
|
|
2
|
-
import { URLS as
|
|
3
|
-
const
|
|
4
|
-
(
|
|
5
|
-
attributeName:
|
|
6
|
-
attributeJs:
|
|
7
|
-
attributeType:
|
|
8
|
-
type:
|
|
9
|
-
displayName:
|
|
10
|
-
isFilterable:
|
|
11
|
-
},
|
|
1
|
+
import { useHttp as y } from "../composables/useHttp.js";
|
|
2
|
+
import { URLS as c, QUERY_PARAMS as u } from "../enums/extensions/recommendationBlock.js";
|
|
3
|
+
const g = "[sr_strategies.status][=][active]*[sr_strategies.suitable_channels][~][EMAIL]", l = (s) => s.reduce(
|
|
4
|
+
(i, o, d) => (i[d] = {
|
|
5
|
+
attributeName: o.attributeName,
|
|
6
|
+
attributeJs: o.attributeJs,
|
|
7
|
+
attributeType: o.attributeType,
|
|
8
|
+
type: o.type,
|
|
9
|
+
displayName: o.displayName,
|
|
10
|
+
isFilterable: o.isFilterable
|
|
11
|
+
}, i),
|
|
12
12
|
{}
|
|
13
13
|
), _ = () => {
|
|
14
|
-
const { get:
|
|
14
|
+
const { get: s, post: i } = y(), { get: o } = y({ headers: {} }), d = "6KcLM9TwheVB1mgK";
|
|
15
15
|
return {
|
|
16
16
|
fetchRecommendationCreateData: async () => {
|
|
17
17
|
try {
|
|
18
|
-
return (await c
|
|
19
|
-
} catch (
|
|
20
|
-
throw console.error("fetchUserModalState error:",
|
|
18
|
+
return (await s(`${c.NEWSLETTER_RECOMMENDATIONS_PATH}/create-data`)).data;
|
|
19
|
+
} catch (t) {
|
|
20
|
+
throw console.error("fetchUserModalState error:", t), t;
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
fetchRecommendationFilters: async () => {
|
|
24
24
|
try {
|
|
25
|
-
const { data:
|
|
26
|
-
|
|
27
|
-
),
|
|
28
|
-
return
|
|
29
|
-
} catch (
|
|
30
|
-
throw console.error("fetchRecommendationFilters error:",
|
|
25
|
+
const { data: t } = await s(
|
|
26
|
+
c.PRODUCT_ATTRIBUTES_PATH
|
|
27
|
+
), r = Array.isArray(t) ? t : (t == null ? void 0 : t.data) ?? [];
|
|
28
|
+
return l(r);
|
|
29
|
+
} catch (t) {
|
|
30
|
+
throw console.error("fetchRecommendationFilters error:", t), t;
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
|
-
fetchRecommendationProducts: async (
|
|
34
|
-
var
|
|
33
|
+
fetchRecommendationProducts: async (t, r) => {
|
|
34
|
+
var e;
|
|
35
35
|
try {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
console.debug("🏁 Recommendation API Query:",
|
|
40
|
-
const
|
|
41
|
-
`${
|
|
36
|
+
const a = new URLSearchParams(Object.entries(r));
|
|
37
|
+
a.set(u.CLIENT_ID, d);
|
|
38
|
+
const m = decodeURIComponent(a.toString());
|
|
39
|
+
console.debug("🏁 Recommendation API Query:", m);
|
|
40
|
+
const n = await o(
|
|
41
|
+
`${c.RECOMMENDATION_API_URL}/v2/${t}?${m}`
|
|
42
42
|
);
|
|
43
|
-
return ((
|
|
44
|
-
} catch (
|
|
45
|
-
throw console.error("fetchRecommendationProducts error:",
|
|
43
|
+
return ((e = n == null ? void 0 : n.data) == null ? void 0 : e.data) ?? [];
|
|
44
|
+
} catch (a) {
|
|
45
|
+
throw console.error("fetchRecommendationProducts error:", a), a;
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
|
-
fetchRecommendationProductsByUrl: async (
|
|
49
|
-
var
|
|
48
|
+
fetchRecommendationProductsByUrl: async (t) => {
|
|
49
|
+
var r;
|
|
50
50
|
try {
|
|
51
|
-
const
|
|
52
|
-
|
|
51
|
+
const e = new RegExp(`[?&]${u.CLIENT_ID}=`).test(t), a = t.includes("?") ? "&" : "?", m = e ? t : `${t}${a}${u.CLIENT_ID}=${d}`, n = await o(
|
|
52
|
+
m
|
|
53
53
|
);
|
|
54
|
-
return ((
|
|
55
|
-
} catch (
|
|
56
|
-
return console.error("fetchRecommendationProductsByUrl error:",
|
|
54
|
+
return ((r = n == null ? void 0 : n.data) == null ? void 0 : r.data) ?? [];
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return console.error("fetchRecommendationProductsByUrl error:", e), [];
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
fetchRecommendationStrategies: async () => {
|
|
60
60
|
try {
|
|
61
|
-
const { data:
|
|
62
|
-
`${
|
|
61
|
+
const { data: t } = await s(
|
|
62
|
+
`${c.RECOMMENDATION_STRATEGIES_PATH}?filters=${encodeURIComponent(g)}`
|
|
63
63
|
);
|
|
64
|
-
return Array.isArray(
|
|
65
|
-
} catch (
|
|
66
|
-
throw console.error("fetchRecommendationStrategies error:",
|
|
64
|
+
return Array.isArray(t) ? t : (t == null ? void 0 : t.data) ?? [];
|
|
65
|
+
} catch (t) {
|
|
66
|
+
throw console.error("fetchRecommendationStrategies error:", t), t;
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
generateStrategyEndpoint: async (
|
|
69
|
+
generateStrategyEndpoint: async (t, r) => {
|
|
70
70
|
try {
|
|
71
|
-
const { data:
|
|
72
|
-
`${
|
|
71
|
+
const { data: e } = await i(
|
|
72
|
+
`${c.RECOMMENDATION_STRATEGIES_PATH}/endpoint-generate`,
|
|
73
73
|
{
|
|
74
74
|
campaignId: 0,
|
|
75
75
|
pageTypes: [],
|
|
76
76
|
isPreviewer: !1,
|
|
77
|
-
strategy:
|
|
77
|
+
strategy: t,
|
|
78
78
|
userId: "",
|
|
79
|
-
currency:
|
|
79
|
+
currency: r
|
|
80
80
|
}
|
|
81
81
|
);
|
|
82
|
-
return !
|
|
83
|
-
} catch (
|
|
84
|
-
return console.error("generateStrategyEndpoint error:",
|
|
82
|
+
return !e || typeof e != "object" || !("full_path" in e || "data" in e) ? (console.error("generateStrategyEndpoint unexpected response shape:", e), null) : "full_path" in e ? e : e.data;
|
|
83
|
+
} catch (e) {
|
|
84
|
+
return console.error("generateStrategyEndpoint error:", e), null;
|
|
85
85
|
}
|
|
86
|
+
},
|
|
87
|
+
migrateLegacyStrategy: async (t) => {
|
|
88
|
+
const { data: r } = await i(
|
|
89
|
+
`${c.NEWSLETTER_RECOMMENDATIONS_PATH}/migrate-strategies`,
|
|
90
|
+
t
|
|
91
|
+
), e = r && typeof r == "object" && "data" in r ? r.data : r, a = e == null ? void 0 : e.strategyId;
|
|
92
|
+
if (a == null || a === "")
|
|
93
|
+
throw new Error("[Guido] migrate-strategies returned no strategyId");
|
|
94
|
+
return String(a);
|
|
86
95
|
}
|
|
87
96
|
};
|
|
88
97
|
};
|
package/dist/src/components/organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.d.ts
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
|
+
export default _default;
|
|
@@ -72,6 +72,8 @@ export declare const ATTR_CUSTOM_PREFIX = "customAttr:";
|
|
|
72
72
|
export declare const ATTR_DATA_CUSTOM_ATTRIBUTES = "data-custom-attributes";
|
|
73
73
|
/** HTML data attribute on the block root holding the comma-joined composition order */
|
|
74
74
|
export declare const ATTR_DATA_CARD_COMPOSITION = "data-card-composition";
|
|
75
|
+
/** HTML attribute on the block root carrying its per-document unique id */
|
|
76
|
+
export declare const RECOMMENDATION_ID_ATTR = "recommendation-id";
|
|
75
77
|
/** HTML attribute on <td> elements identifying the product attribute for compiler template variable generation */
|
|
76
78
|
export declare const ATTR_PRODUCT_ATTR = "product-attr";
|
|
77
79
|
/** Class every composition attribute row carries — the visibility toggle and the compiler both key on it */
|
|
@@ -2,6 +2,7 @@ import { CommonControl } from '../../../common-control';
|
|
|
2
2
|
export declare const STRATEGY_CONTROL_ID = "recommendation-strategy-control";
|
|
3
3
|
export declare class StrategyControl extends CommonControl {
|
|
4
4
|
private store;
|
|
5
|
+
private legacyConversion;
|
|
5
6
|
private storeUnsubscription;
|
|
6
7
|
private listeners;
|
|
7
8
|
private lastPaintedState;
|