@useinsider/guido 3.18.1-beta.e39fb14 → 3.18.1-beta.e489d08
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 +0 -1
- package/dist/@types/config/schemas.js +26 -28
- package/dist/components/Guido.vue.js +6 -6
- package/dist/components/Guido.vue2.js +70 -72
- package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +65 -53
- package/dist/components/organisms/header/EditorActions.vue.js +2 -2
- package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
- package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
- package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
- package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
- package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
- package/dist/components/wrappers/WpDrawer.vue.js +7 -9
- package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
- package/dist/composables/useCustomInterfaceAppearance.js +46 -41
- package/dist/composables/useHtmlCompiler.js +26 -37
- package/dist/composables/useHtmlValidator.js +84 -81
- package/dist/composables/useRecommendation.js +21 -18
- package/dist/composables/useSave.js +45 -90
- package/dist/composables/useStripo.js +7 -7
- package/dist/composables/validators/useCouponBlockValidator.js +21 -24
- package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
- package/dist/enums/extensions/recommendationBlock.js +38 -31
- package/dist/extensions/Blocks/Recommendation/block.js +43 -39
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +62 -57
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +80 -52
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +145 -75
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -4
- package/dist/src/components/Guido.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
- package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useHtmlValidator.d.ts +0 -21
- package/dist/src/composables/useSave.d.ts +1 -6
- package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
- package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +59 -3
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/stores/config.d.ts +0 -30
- package/dist/src/stores/onboarding.d.ts +377 -0
- package/dist/src/utils/templatePreparation.d.ts +0 -30
- package/dist/static/styles/components/recommendation-strategy.css.js +51 -4
- package/dist/stores/config.js +22 -39
- package/dist/stores/onboarding.js +41 -36
- package/dist/utils/templatePreparation.js +47 -50
- package/package.json +1 -1
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
- package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
- package/dist/composables/useSaveValidation.js +0 -279
- package/dist/composables/useSaveValidationRollout.js +0 -9
- package/dist/enums/save-validation.js +0 -4
- package/dist/src/@types/save-validation.d.ts +0 -19
- package/dist/src/composables/useSaveValidation.d.ts +0 -6
- package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
- package/dist/src/enums/save-validation.d.ts +0 -27
- package/dist/src/stores/save-validation.d.ts +0 -22
- package/dist/stores/save-validation.js +0 -30
- /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → onboarding/RecommendationStrategyOnboarding.vue.d.ts} +0 -0
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { getRecommendationFeedSourceMaps as
|
|
2
|
-
import { useRecommendationApi as
|
|
3
|
-
import { useConfigStore as
|
|
4
|
-
import { defineStore as
|
|
1
|
+
import { getRecommendationFeedSourceMaps as k, strategyEditPath as G, URLS as D, getOperatorOptions as _, PriceAttributes as L } from "../../../../enums/extensions/recommendationBlock.js";
|
|
2
|
+
import { useRecommendationApi as E } from "../../../../services/recommendationApi.js";
|
|
3
|
+
import { useConfigStore as P } from "../../../../stores/config.js";
|
|
4
|
+
import { defineStore as N } from "pinia";
|
|
5
5
|
import "../constants/selectors.js";
|
|
6
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as U, DEFAULT_CARDS_IN_ROW as
|
|
7
|
-
import { DEFAULT_NODE_CONFIG as
|
|
8
|
-
import { getDefaultProducts as
|
|
9
|
-
import { generateCompleteFilterQuery as
|
|
10
|
-
import { getPartnerRecommendationParams as
|
|
11
|
-
import { sanitizeProductIds as
|
|
12
|
-
import { isFilterValid as
|
|
13
|
-
import { isConfigValid as
|
|
14
|
-
const
|
|
15
|
-
let
|
|
16
|
-
const
|
|
17
|
-
|
|
6
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as U, DEFAULT_CARDS_IN_ROW as A } from "../constants/layout.js";
|
|
7
|
+
import { DEFAULT_NODE_CONFIG as x, EXCLUDED_ALGORITHM_IDS as B } from "../constants/defaultConfig.js";
|
|
8
|
+
import { getDefaultProducts as C } from "../templates/utils.js";
|
|
9
|
+
import { generateCompleteFilterQuery as v } from "../utils/filterUtil.js";
|
|
10
|
+
import { getPartnerRecommendationParams as M } from "../utils/partnerCustomizations.js";
|
|
11
|
+
import { sanitizeProductIds as O } from "../utils/productIds.js";
|
|
12
|
+
import { isFilterValid as T } from "../validation/filterSchema.js";
|
|
13
|
+
import { getInvalidFields as z, isConfigValid as V } from "../validation/requiredFields.js";
|
|
14
|
+
const d = E();
|
|
15
|
+
let h = null, g = null, S = null, p = null, y = 0;
|
|
16
|
+
const b = /* @__PURE__ */ new Map();
|
|
17
|
+
let u = null;
|
|
18
|
+
function F() {
|
|
18
19
|
return {
|
|
19
|
-
cardsInRow:
|
|
20
|
+
cardsInRow: A,
|
|
20
21
|
currencySettings: {
|
|
21
22
|
name: "USD",
|
|
22
23
|
value: "USD",
|
|
@@ -36,7 +37,11 @@ function v() {
|
|
|
36
37
|
recommendedProducts: [],
|
|
37
38
|
sendProductRequestFlag: !1,
|
|
38
39
|
shuffleProducts: !1,
|
|
39
|
-
|
|
40
|
+
// With RRS on, a block that has not been synced yet must not claim an algorithm:
|
|
41
|
+
// that default is what reached buildCampaignUrl and baked a most-popular feed URL
|
|
42
|
+
// for a block the user never configured (SD-149916). Legacy blocks still get their real
|
|
43
|
+
// algorithm from the node-config sync or the save-time seed.
|
|
44
|
+
strategy: P().isFeatureEnabled("reusableRecommendationStrategy") ? "" : "mostPopular",
|
|
40
45
|
strategyId: "",
|
|
41
46
|
textTrimming: !0,
|
|
42
47
|
unresponsive: !1,
|
|
@@ -48,7 +53,7 @@ function v() {
|
|
|
48
53
|
}
|
|
49
54
|
function w() {
|
|
50
55
|
return {
|
|
51
|
-
recommendationConfigs:
|
|
56
|
+
recommendationConfigs: F(),
|
|
52
57
|
recommendationProducts: [],
|
|
53
58
|
filterStatus: !1,
|
|
54
59
|
filterSelectionDrawerStatus: !1,
|
|
@@ -59,7 +64,7 @@ function w() {
|
|
|
59
64
|
filterSnapshot: null
|
|
60
65
|
};
|
|
61
66
|
}
|
|
62
|
-
const
|
|
67
|
+
const j = () => ({
|
|
63
68
|
recommendationCampaignUrls: {},
|
|
64
69
|
activePredictiveAlgorithms: [],
|
|
65
70
|
languages: {},
|
|
@@ -68,11 +73,13 @@ const O = () => ({
|
|
|
68
73
|
strategies: [],
|
|
69
74
|
strategiesLoading: !1,
|
|
70
75
|
strategyUrlTemplates: {},
|
|
76
|
+
strategiesFetched: !1,
|
|
71
77
|
blockStates: {},
|
|
72
78
|
currentRecommendationId: null,
|
|
79
|
+
strategyPanelOpen: !1,
|
|
73
80
|
configVersion: 0
|
|
74
|
-
}),
|
|
75
|
-
state: () =>
|
|
81
|
+
}), nt = N("guidoRecommendationExtension", {
|
|
82
|
+
state: () => j(),
|
|
76
83
|
getters: {
|
|
77
84
|
// ====================================================================
|
|
78
85
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -82,7 +89,7 @@ const O = () => ({
|
|
|
82
89
|
* This allows all existing code that reads `store.recommendationConfigs` to work unchanged.
|
|
83
90
|
*/
|
|
84
91
|
recommendationConfigs(t) {
|
|
85
|
-
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs :
|
|
92
|
+
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].recommendationConfigs : F();
|
|
86
93
|
},
|
|
87
94
|
/**
|
|
88
95
|
* Proxy getter: delegates to blockStates[currentRecommendationId].recommendationProducts
|
|
@@ -137,8 +144,8 @@ const O = () => ({
|
|
|
137
144
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
|
|
138
145
|
},
|
|
139
146
|
getActivePredictiveAlgorithms: (t) => {
|
|
140
|
-
const e =
|
|
141
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
147
|
+
const e = k(), r = [];
|
|
148
|
+
return t.activePredictiveAlgorithms.filter((n) => !B.includes(n)).forEach((n) => {
|
|
142
149
|
r.push(...e.filter((s) => s.id === n));
|
|
143
150
|
}), r.map((n) => ({
|
|
144
151
|
text: n.name,
|
|
@@ -156,7 +163,7 @@ const O = () => ({
|
|
|
156
163
|
getFilterList() {
|
|
157
164
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
158
165
|
let e;
|
|
159
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
166
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : L.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
160
167
|
text: t.displayName,
|
|
161
168
|
value: e,
|
|
162
169
|
type: t.attributeType
|
|
@@ -285,7 +292,7 @@ const O = () => ({
|
|
|
285
292
|
* Creates a filter with the first available attribute and operator pre-selected.
|
|
286
293
|
*/
|
|
287
294
|
createDefaultFilter(t, e) {
|
|
288
|
-
const [r] = this.getFilterList, [n] =
|
|
295
|
+
const [r] = this.getFilterList, [n] = _(r == null ? void 0 : r.type);
|
|
289
296
|
return {
|
|
290
297
|
type: "standardFilter",
|
|
291
298
|
attribute: (r == null ? void 0 : r.value) ?? "",
|
|
@@ -345,29 +352,87 @@ const O = () => ({
|
|
|
345
352
|
this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId] || (this.blockStates[this.currentRecommendationId].removeStrategyModalStatus = !1);
|
|
346
353
|
},
|
|
347
354
|
async fetchStrategies() {
|
|
348
|
-
if (
|
|
349
|
-
await S;
|
|
355
|
+
if (p && await p, this.strategiesFetched)
|
|
350
356
|
return;
|
|
351
|
-
|
|
352
|
-
|
|
357
|
+
const t = y;
|
|
358
|
+
p = (async () => {
|
|
353
359
|
this.strategiesLoading = !0;
|
|
354
360
|
try {
|
|
355
|
-
|
|
361
|
+
const e = await d.fetchRecommendationStrategies();
|
|
362
|
+
if (t !== y)
|
|
363
|
+
return;
|
|
364
|
+
this.strategies = e, this.strategiesFetched = !0;
|
|
356
365
|
} finally {
|
|
357
366
|
this.strategiesLoading = !1;
|
|
358
367
|
}
|
|
359
368
|
})();
|
|
360
369
|
try {
|
|
361
|
-
await
|
|
370
|
+
await p;
|
|
362
371
|
} finally {
|
|
363
|
-
|
|
372
|
+
p = null;
|
|
364
373
|
}
|
|
365
374
|
},
|
|
375
|
+
invalidateStrategies() {
|
|
376
|
+
this.strategiesFetched = !1, y += 1;
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* Opens a Smart Recommender strategy page in a new tab and refreshes the list every time
|
|
380
|
+
* the user comes back. `visibilitychange` covers the tab case; `focus` covers the page
|
|
381
|
+
* landing in a separate window, where this document never goes hidden.
|
|
382
|
+
*
|
|
383
|
+
* Deliberately NOT one-shot: the strategy tab stays open, so a user can create a second
|
|
384
|
+
* strategy in it and come back again — a listener that disarmed on the first return would
|
|
385
|
+
* leave that one missing from the list. Armed only once the user actually opens a strategy
|
|
386
|
+
* page, so anyone who never does pays nothing.
|
|
387
|
+
*/
|
|
388
|
+
_armStrategyPageReturn(t) {
|
|
389
|
+
window.open(t, "_blank", "noopener"), u == null || u();
|
|
390
|
+
let e = !1;
|
|
391
|
+
const r = () => {
|
|
392
|
+
document.hidden || e || (e = !0, this.invalidateStrategies(), this.fetchStrategies().then(() => this._refreshAssignedStrategyProducts()).catch(() => {
|
|
393
|
+
}).finally(() => {
|
|
394
|
+
e = !1;
|
|
395
|
+
}));
|
|
396
|
+
};
|
|
397
|
+
document.addEventListener("visibilitychange", r), window.addEventListener("focus", r), u = () => {
|
|
398
|
+
document.removeEventListener("visibilitychange", r), window.removeEventListener("focus", r), u = null;
|
|
399
|
+
};
|
|
400
|
+
},
|
|
401
|
+
/**
|
|
402
|
+
* Reloads the products of the block the user is on, so an edit made in the strategy tab
|
|
403
|
+
* lands on the canvas instead of waiting for the assign drawer to be reopened.
|
|
404
|
+
*
|
|
405
|
+
* Only the selected block: the canvas regeneration is driven off the active block's
|
|
406
|
+
* product array, so refreshing an unselected block would fetch without redrawing it.
|
|
407
|
+
*/
|
|
408
|
+
async _refreshAssignedStrategyProducts() {
|
|
409
|
+
var e;
|
|
410
|
+
const t = this.currentRecommendationId;
|
|
411
|
+
t === null || !((e = this.blockStates[t]) != null && e.recommendationConfigs.strategyId) || await this.fetchRecommendationProducts();
|
|
412
|
+
},
|
|
413
|
+
/** Lets the editor tear the return listeners down when it unmounts. */
|
|
414
|
+
disposeStrategyPageReturn() {
|
|
415
|
+
u == null || u();
|
|
416
|
+
},
|
|
417
|
+
/**
|
|
418
|
+
* Opens Smart Recommender's strategy creation page. Every return refreshes the list so the
|
|
419
|
+
* new strategy is offered; the user picks it themselves.
|
|
420
|
+
*/
|
|
421
|
+
openStrategyCreation() {
|
|
422
|
+
this._armStrategyPageReturn(D.RECOMMENDATION_STRATEGY_CREATE_PATH);
|
|
423
|
+
},
|
|
424
|
+
/**
|
|
425
|
+
* Opens the strategy's edit page. Every return refreshes the list so the block reflects the
|
|
426
|
+
* edited configuration.
|
|
427
|
+
*/
|
|
428
|
+
openStrategyEdit(t) {
|
|
429
|
+
this._armStrategyPageReturn(G(t));
|
|
430
|
+
},
|
|
366
431
|
async resolveStrategyUrlTemplate(t, e) {
|
|
367
432
|
const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
|
|
368
433
|
if (s)
|
|
369
434
|
return s;
|
|
370
|
-
const { full_path: i = "" } = await
|
|
435
|
+
const { full_path: i = "" } = await d.generateStrategyEndpoint(t, e) ?? {};
|
|
371
436
|
return n && i && (this.strategyUrlTemplates = {
|
|
372
437
|
...this.strategyUrlTemplates,
|
|
373
438
|
[n]: i
|
|
@@ -380,23 +445,23 @@ const O = () => ({
|
|
|
380
445
|
});
|
|
381
446
|
},
|
|
382
447
|
removeStrategy() {
|
|
383
|
-
this.patchCurrentBlockConfig({ strategyId: "", size:
|
|
448
|
+
this.patchCurrentBlockConfig({ strategyId: "", size: x.size });
|
|
384
449
|
},
|
|
385
450
|
// ====================================================================
|
|
386
451
|
// Shared Data Fetching (fetched once, used by all blocks)
|
|
387
452
|
// ====================================================================
|
|
388
453
|
async fetchRecommendationCreateData() {
|
|
389
454
|
if (!this.activePredictiveAlgorithms.length) {
|
|
390
|
-
if (
|
|
391
|
-
await
|
|
455
|
+
if (h) {
|
|
456
|
+
await h;
|
|
392
457
|
return;
|
|
393
458
|
}
|
|
394
|
-
|
|
459
|
+
h = (async () => {
|
|
395
460
|
const {
|
|
396
461
|
activePredictiveAlgorithms: t,
|
|
397
462
|
languages: e,
|
|
398
463
|
currencies: r
|
|
399
|
-
} = await
|
|
464
|
+
} = await d.fetchRecommendationCreateData();
|
|
400
465
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
401
466
|
const n = this.blockStates[this.currentRecommendationId];
|
|
402
467
|
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
@@ -404,26 +469,26 @@ const O = () => ({
|
|
|
404
469
|
this.currencyList = r;
|
|
405
470
|
})();
|
|
406
471
|
try {
|
|
407
|
-
await
|
|
472
|
+
await h;
|
|
408
473
|
} finally {
|
|
409
|
-
|
|
474
|
+
h = null;
|
|
410
475
|
}
|
|
411
476
|
}
|
|
412
477
|
},
|
|
413
478
|
async fetchRecommendationFilters() {
|
|
414
479
|
if (!Object.keys(this.filterList).length) {
|
|
415
|
-
if (
|
|
416
|
-
await
|
|
480
|
+
if (g) {
|
|
481
|
+
await g;
|
|
417
482
|
return;
|
|
418
483
|
}
|
|
419
|
-
|
|
420
|
-
const t = await
|
|
484
|
+
g = (async () => {
|
|
485
|
+
const t = await d.fetchRecommendationFilters();
|
|
421
486
|
this.filterList = t;
|
|
422
487
|
})();
|
|
423
488
|
try {
|
|
424
|
-
await
|
|
489
|
+
await g;
|
|
425
490
|
} finally {
|
|
426
|
-
|
|
491
|
+
g = null;
|
|
427
492
|
}
|
|
428
493
|
}
|
|
429
494
|
},
|
|
@@ -452,7 +517,7 @@ const O = () => ({
|
|
|
452
517
|
const n = [...e.recommendationConfigs.filters];
|
|
453
518
|
n[r] = {
|
|
454
519
|
...t,
|
|
455
|
-
isValid:
|
|
520
|
+
isValid: T(t)
|
|
456
521
|
}, e.recommendationConfigs.filters = n;
|
|
457
522
|
}
|
|
458
523
|
},
|
|
@@ -490,7 +555,7 @@ const O = () => ({
|
|
|
490
555
|
}), e.recommendationConfigs.filters = r;
|
|
491
556
|
},
|
|
492
557
|
generateFilterQuery() {
|
|
493
|
-
return
|
|
558
|
+
return v(this.recommendationConfigs.filters);
|
|
494
559
|
},
|
|
495
560
|
/**
|
|
496
561
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -498,40 +563,45 @@ const O = () => ({
|
|
|
498
563
|
* every block's recommendationConfigs across user edits.
|
|
499
564
|
*/
|
|
500
565
|
hasInvalidBlock() {
|
|
501
|
-
return Object.values(this.blockStates).some((t) => !
|
|
566
|
+
return Object.values(this.blockStates).some((t) => !V(t.recommendationConfigs, this));
|
|
502
567
|
},
|
|
503
568
|
/**
|
|
504
|
-
*
|
|
505
|
-
*
|
|
569
|
+
* Which required fields are missing across the design's blocks, so the save
|
|
570
|
+
* toaster can name the cause instead of always showing the generic message.
|
|
506
571
|
*/
|
|
507
|
-
|
|
508
|
-
return Object.
|
|
572
|
+
invalidBlockFields() {
|
|
573
|
+
return Object.values(this.blockStates).flatMap((t) => z(t.recommendationConfigs, this));
|
|
509
574
|
},
|
|
510
575
|
// ====================================================================
|
|
511
576
|
// Per-Block Product Fetching
|
|
512
577
|
// ====================================================================
|
|
513
578
|
async fetchRecommendationProducts() {
|
|
514
579
|
if (!(this.currentRecommendationId === null || !this.blockStates[this.currentRecommendationId])) {
|
|
515
|
-
if (
|
|
516
|
-
await
|
|
580
|
+
if (S) {
|
|
581
|
+
await S;
|
|
517
582
|
return;
|
|
518
583
|
}
|
|
519
|
-
|
|
584
|
+
S = this._doFetchProducts();
|
|
520
585
|
try {
|
|
521
|
-
await
|
|
586
|
+
await S;
|
|
522
587
|
} finally {
|
|
523
|
-
|
|
588
|
+
S = null;
|
|
524
589
|
}
|
|
525
590
|
}
|
|
526
591
|
},
|
|
527
592
|
async _doFetchProducts() {
|
|
528
|
-
var
|
|
529
|
-
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n =
|
|
593
|
+
var f;
|
|
594
|
+
const t = this.currentRecommendationId, e = this.blockStates[t], { recommendationConfigs: r } = e, n = P();
|
|
530
595
|
if (r.strategyId && n.isFeatureEnabled("reusableRecommendationStrategy")) {
|
|
531
596
|
await this._doFetchStrategyProducts(t);
|
|
532
597
|
return;
|
|
533
598
|
}
|
|
534
|
-
const s =
|
|
599
|
+
const s = parseInt(r.size) || 6;
|
|
600
|
+
if (!r.strategy) {
|
|
601
|
+
this._setBlockProducts(t, [], s);
|
|
602
|
+
return;
|
|
603
|
+
}
|
|
604
|
+
const i = r.filters.filter((m) => m.isValid), o = v(i), c = ((f = k().find((m) => m.key === r.strategy)) == null ? void 0 : f.path) || "", a = {
|
|
535
605
|
locale: r.language,
|
|
536
606
|
currency: r.currencySettings.value,
|
|
537
607
|
partnerName: n.partnerName,
|
|
@@ -539,21 +609,21 @@ const O = () => ({
|
|
|
539
609
|
details: !0,
|
|
540
610
|
campaignId: n.variationId
|
|
541
611
|
};
|
|
542
|
-
r.strategy === "manualMerchandising" ? a.productId =
|
|
612
|
+
r.strategy === "manualMerchandising" ? a.productId = O(r.productIds) : r.strategy === "similarViewed" && (a.productId = "{itemId}"), r.strategy === "userBased" && (a.userId = "{user_id}"), o && (a.filter = o), r.shuffleProducts && (a.shuffle = !0), Object.assign(
|
|
543
613
|
a,
|
|
544
|
-
|
|
614
|
+
M(n.partnerName, r.strategy)
|
|
545
615
|
);
|
|
546
616
|
let l;
|
|
547
617
|
try {
|
|
548
|
-
l = await
|
|
618
|
+
l = await d.fetchRecommendationProducts(c, a);
|
|
549
619
|
} catch {
|
|
550
620
|
l = [];
|
|
551
621
|
}
|
|
552
|
-
this._setBlockProducts(t, l,
|
|
622
|
+
this._setBlockProducts(t, l, s);
|
|
553
623
|
},
|
|
554
624
|
async _doFetchStrategyProducts(t) {
|
|
555
|
-
const e = (
|
|
556
|
-
|
|
625
|
+
const e = (b.get(t) ?? 0) + 1;
|
|
626
|
+
b.set(t, e);
|
|
557
627
|
const { recommendationConfigs: r } = this.blockStates[t];
|
|
558
628
|
let n = [], s = parseInt(r.size) || 6;
|
|
559
629
|
try {
|
|
@@ -563,25 +633,25 @@ const O = () => ({
|
|
|
563
633
|
);
|
|
564
634
|
if (i) {
|
|
565
635
|
s = parseInt(String(i.size ?? "")) || s;
|
|
566
|
-
const o = r.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(i, o)).replaceAll("{locale}", r.language).replaceAll("{currency}", o), l = a.indexOf("?"),
|
|
567
|
-
|
|
636
|
+
const o = r.currencySettings.value, a = (await this.resolveStrategyUrlTemplate(i, o)).replaceAll("{locale}", r.language).replaceAll("{currency}", o), l = a.indexOf("?"), f = l === -1 ? a : a.slice(0, l), m = (l === -1 ? "" : a.slice(l + 1)).split("&").filter((R) => R && !R.startsWith("user_id=")), I = m.length ? `${f}?${m.join("&")}` : f;
|
|
637
|
+
I && (n = await d.fetchRecommendationProductsByUrl(I));
|
|
568
638
|
}
|
|
569
639
|
} catch {
|
|
570
640
|
n = [];
|
|
571
641
|
}
|
|
572
|
-
|
|
642
|
+
b.get(t) === e && this._setBlockProducts(t, n, s);
|
|
573
643
|
},
|
|
574
644
|
_setBlockProducts(t, e, r) {
|
|
575
645
|
if (!this.blockStates[t])
|
|
576
646
|
return;
|
|
577
|
-
const n = e.length > 0 ? e :
|
|
647
|
+
const n = e.length > 0 ? e : C(r);
|
|
578
648
|
this.blockStates[t].recommendationProducts = [
|
|
579
649
|
...n.slice(0, r),
|
|
580
|
-
...
|
|
650
|
+
...C(Math.max(0, r - n.length))
|
|
581
651
|
];
|
|
582
652
|
}
|
|
583
653
|
}
|
|
584
654
|
});
|
|
585
655
|
export {
|
|
586
|
-
|
|
656
|
+
nt as useRecommendationExtensionStore
|
|
587
657
|
};
|
|
@@ -1,34 +1,43 @@
|
|
|
1
|
-
const
|
|
1
|
+
const o = "strategy", u = [
|
|
2
2
|
{
|
|
3
3
|
key: "locale",
|
|
4
4
|
getValue: (e) => e.language,
|
|
5
5
|
getAvailableOptions: (e) => Object.keys(e.languages)
|
|
6
6
|
},
|
|
7
|
+
{
|
|
8
|
+
// A block feeds from either an assigned strategy (RRS) or an algorithm (legacy).
|
|
9
|
+
// Only a fresh RRS block has neither, and its feed URL would otherwise be built
|
|
10
|
+
// from an empty algorithm path.
|
|
11
|
+
key: o,
|
|
12
|
+
getValue: (e) => e.strategyId || e.strategy
|
|
13
|
+
},
|
|
7
14
|
{
|
|
8
15
|
key: "currency",
|
|
9
16
|
getValue: (e) => e.currencySettings.value,
|
|
10
17
|
getAvailableOptions: (e) => e.currencyList.map((n) => n.text),
|
|
11
18
|
canBeEmpty: !0
|
|
12
19
|
}
|
|
13
|
-
],
|
|
14
|
-
function c(e, n, i =
|
|
20
|
+
], l = "newsletter.recommendation-fill-required-fields", g = "newsletter.recommendation-assign-strategy";
|
|
21
|
+
function c(e, n, i = u) {
|
|
15
22
|
return i.filter((t) => {
|
|
16
|
-
var
|
|
23
|
+
var s;
|
|
17
24
|
if (t.condition && !t.condition(e))
|
|
18
25
|
return !1;
|
|
19
|
-
const
|
|
20
|
-
if (t.canBeEmpty && (
|
|
26
|
+
const a = (s = t.getAvailableOptions) == null ? void 0 : s.call(t, n);
|
|
27
|
+
if (t.canBeEmpty && (a == null ? void 0 : a.length) === 0)
|
|
21
28
|
return !1;
|
|
22
|
-
const
|
|
23
|
-
return
|
|
29
|
+
const r = t.getValue(e);
|
|
30
|
+
return r ? a !== void 0 && !a.includes(r) : !0;
|
|
24
31
|
}).map((t) => t.key);
|
|
25
32
|
}
|
|
26
|
-
function
|
|
33
|
+
function y(e, n) {
|
|
27
34
|
return c(e, n).length === 0;
|
|
28
35
|
}
|
|
29
36
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
u as REQUIRED_RECOMMENDATION_FIELDS,
|
|
38
|
+
g as RecommendationAssignStrategyKey,
|
|
39
|
+
l as RecommendationRequiredFieldsKey,
|
|
40
|
+
o as STRATEGY_FIELD_KEY,
|
|
32
41
|
c as getInvalidFields,
|
|
33
|
-
|
|
42
|
+
y as isConfigValid
|
|
34
43
|
};
|
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-
|
|
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-cc5ee925]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-cc5ee925]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-cc5ee925]{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-ec2027ff] .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-b447f626]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-b447f626] .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}
|
|
@@ -395,8 +395,6 @@ export declare const FeaturesSchema: v.ObjectSchema<{
|
|
|
395
395
|
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
396
396
|
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
397
397
|
readonly linkTrackingIds: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
398
|
-
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
399
|
-
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
400
398
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
401
399
|
}, undefined>;
|
|
402
400
|
/**
|
|
@@ -797,8 +795,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
797
795
|
readonly allowlistEnabled: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
798
796
|
/** Enable persistent link tracking-id assignment for the click heatmap (opt-in) */
|
|
799
797
|
readonly linkTrackingIds: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
800
|
-
/** Allow persisting a template that still has validation errors (drawer "Save and Continue" soft-save). Host sets false for transactional + unsubscribe. */
|
|
801
|
-
readonly allowSaveWithErrors: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
802
798
|
readonly reusableRecommendationStrategy: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
803
799
|
}, undefined>, {}>;
|
|
804
800
|
/** Block configuration */
|
|
@@ -15,23 +15,7 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
15
15
|
close: () => void;
|
|
16
16
|
};
|
|
17
17
|
hasChanges: import("vue").ComputedRef<boolean>;
|
|
18
|
-
saveSilent: () => Promise<
|
|
19
|
-
dynamicContentList: import("@@/Types/generic").DynamicContent[];
|
|
20
|
-
compiledHtml: string;
|
|
21
|
-
rawHtml: string;
|
|
22
|
-
css: string;
|
|
23
|
-
ampHtml: string;
|
|
24
|
-
ampErrors: string[];
|
|
25
|
-
modules: number[];
|
|
26
|
-
recommendation: {
|
|
27
|
-
campaignUrls: Record<string, import("../@types/recommendation").RecommendationCampaignUrlValue>;
|
|
28
|
-
configs: Record<string, string>;
|
|
29
|
-
};
|
|
30
|
-
unsubscribe: {
|
|
31
|
-
status: boolean;
|
|
32
|
-
config: number[];
|
|
33
|
-
};
|
|
34
|
-
} | undefined> | undefined;
|
|
18
|
+
saveSilent: () => Promise<Omit<SavedTemplateDetails, "metadata" | "silent"> | undefined> | undefined;
|
|
35
19
|
setLoading: (value: boolean) => void;
|
|
36
20
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {
|
|
37
21
|
"dynamic-content:open": (detail: {
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
handleSave: (isSilent: boolean) => Promise<
|
|
3
|
-
dynamicContentList: import("../../../@types/generic.js").DynamicContent[];
|
|
4
|
-
compiledHtml: string;
|
|
5
|
-
rawHtml: string;
|
|
6
|
-
css: string;
|
|
7
|
-
ampHtml: string;
|
|
8
|
-
ampErrors: string[];
|
|
9
|
-
modules: number[];
|
|
10
|
-
recommendation: {
|
|
11
|
-
campaignUrls: Record<string, import("../../../@types/recommendation.js").RecommendationCampaignUrlValue>;
|
|
12
|
-
configs: Record<string, string>;
|
|
13
|
-
};
|
|
14
|
-
unsubscribe: {
|
|
15
|
-
status: boolean;
|
|
16
|
-
config: number[];
|
|
17
|
-
};
|
|
18
|
-
} | undefined> | undefined;
|
|
2
|
+
handleSave: (isSilent: boolean) => Promise<Omit<import("../../../@types/stripo.js").SavedTemplateDetails, "metadata" | "silent"> | undefined> | undefined;
|
|
19
3
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
20
4
|
export default _default;
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
handleSave: (isSilent: boolean) => Promise<
|
|
3
|
-
dynamicContentList: import("../../../@types/generic.js").DynamicContent[];
|
|
4
|
-
compiledHtml: string;
|
|
5
|
-
rawHtml: string;
|
|
6
|
-
css: string;
|
|
7
|
-
ampHtml: string;
|
|
8
|
-
ampErrors: string[];
|
|
9
|
-
modules: number[];
|
|
10
|
-
recommendation: {
|
|
11
|
-
campaignUrls: Record<string, import("../../../@types/recommendation.js").RecommendationCampaignUrlValue>;
|
|
12
|
-
configs: Record<string, string>;
|
|
13
|
-
};
|
|
14
|
-
unsubscribe: {
|
|
15
|
-
status: boolean;
|
|
16
|
-
config: number[];
|
|
17
|
-
};
|
|
18
|
-
} | undefined> | undefined;
|
|
2
|
+
handleSave: (isSilent: boolean) => Promise<Omit<import("../../../@types/stripo.js").SavedTemplateDetails, "metadata" | "silent"> | undefined> | undefined;
|
|
19
3
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
20
4
|
export default _default;
|
|
@@ -1,20 +1,4 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
-
handleSave: (isSilent: boolean) => Promise<
|
|
3
|
-
dynamicContentList: import("../../../@types/generic.js").DynamicContent[];
|
|
4
|
-
compiledHtml: string;
|
|
5
|
-
rawHtml: string;
|
|
6
|
-
css: string;
|
|
7
|
-
ampHtml: string;
|
|
8
|
-
ampErrors: string[];
|
|
9
|
-
modules: number[];
|
|
10
|
-
recommendation: {
|
|
11
|
-
campaignUrls: Record<string, import("../../../@types/recommendation.js").RecommendationCampaignUrlValue>;
|
|
12
|
-
configs: Record<string, string>;
|
|
13
|
-
};
|
|
14
|
-
unsubscribe: {
|
|
15
|
-
status: boolean;
|
|
16
|
-
config: number[];
|
|
17
|
-
};
|
|
18
|
-
} | undefined> | undefined;
|
|
2
|
+
handleSave: (isSilent: boolean) => Promise<Omit<import("../../../@types/stripo.js").SavedTemplateDetails, "metadata" | "silent"> | undefined> | undefined;
|
|
19
3
|
}, {}, {}, {}, import("vue/types/v3-component-options.js").ComponentOptionsMixin, import("vue/types/v3-component-options.js").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
20
4
|
export default _default;
|
|
@@ -10,11 +10,11 @@ interface Props {
|
|
|
10
10
|
status: boolean;
|
|
11
11
|
titleText: string;
|
|
12
12
|
}
|
|
13
|
-
declare var
|
|
13
|
+
declare var __VLS_12: {}, __VLS_14: {};
|
|
14
14
|
type __VLS_Slots = {} & {
|
|
15
|
-
headerBottomSlot?: (props: typeof
|
|
15
|
+
headerBottomSlot?: (props: typeof __VLS_12) => any;
|
|
16
16
|
} & {
|
|
17
|
-
default?: (props: typeof
|
|
17
|
+
default?: (props: typeof __VLS_14) => any;
|
|
18
18
|
};
|
|
19
19
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
20
20
|
className: string;
|
|
@@ -26,7 +26,6 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
|
|
|
26
26
|
cancelOrBackButtonEvent: () => void;
|
|
27
27
|
onCloseEvent: () => void;
|
|
28
28
|
primaryButtonEvent: () => void;
|
|
29
|
-
secondaryButtonEvent: () => void;
|
|
30
29
|
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<Props>, {
|
|
31
30
|
className: string;
|
|
32
31
|
size: string;
|