@useinsider/guido 3.19.0-beta.d04f200 → 3.19.0-beta.e110e88
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/@types/config/schemas.js +91 -104
- package/dist/components/Guido.vue.js +8 -8
- package/dist/components/Guido.vue2.js +74 -79
- package/dist/components/wrappers/WpModal.vue.js +1 -1
- package/dist/components/wrappers/WpModal.vue2.js +3 -4
- package/dist/composables/useHttp.js +54 -64
- package/dist/composables/useLegacyStrategyConversion.js +19 -23
- package/dist/composables/useStripo.js +20 -24
- package/dist/composables/useToaster.js +15 -17
- package/dist/composables/validators/useLiquidValidator.js +15 -15
- package/dist/config/migrator/index.js +13 -14
- package/dist/enums/extensions/recommendationBlock.js +29 -30
- package/dist/extensions/Blocks/Recommendation/block.js +22 -21
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +107 -97
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +49 -72
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +209 -203
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +91 -67
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -21
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +55 -16
- package/dist/guido.css +1 -1
- package/dist/src/@types/config/schemas.d.ts +0 -16
- package/dist/src/components/wrappers/WpModal.vue.d.ts +1 -5
- package/dist/src/composables/useConfig.d.ts +0 -2
- package/dist/src/composables/useHttp.d.ts +0 -2
- package/dist/src/config/migrator/index.d.ts +1 -2
- package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +13 -2
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +0 -6
- package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +7 -0
- package/dist/src/stores/config.d.ts +0 -20
- package/dist/static/styles/components/recommendation-strategy.css.js +0 -9
- package/package.json +1 -1
- package/dist/components/organisms/base/AuthErrorModal.vue.js +0 -18
- package/dist/components/organisms/base/AuthErrorModal.vue2.js +0 -42
- package/dist/composables/useAuthError.js +0 -52
- package/dist/config/migrator/recommendationPartnerMigrator.js +0 -50
- package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +0 -25
- package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +0 -2
- package/dist/src/composables/useAuthError.d.ts +0 -12
- package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +0 -19
- package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +0 -33
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { useToaster as
|
|
2
|
-
import { useTranslations as
|
|
3
|
-
import { getRecommendationFeedSourceMaps as
|
|
1
|
+
import { useToaster as L } from "../../../../composables/useToaster.js";
|
|
2
|
+
import { useTranslations as U } from "../../../../composables/useTranslations.js";
|
|
3
|
+
import { getRecommendationFeedSourceMaps as w, strategyEditPath as E, URLS as N, getOperatorOptions as M, PriceAttributes as A } from "../../../../enums/extensions/recommendationBlock.js";
|
|
4
4
|
import { ToasterTypeOptions as B } from "../../../../enums/toaster.js";
|
|
5
5
|
import { useRecommendationApi as z } from "../../../../services/recommendationApi.js";
|
|
6
6
|
import { useConfigStore as R } from "../../../../stores/config.js";
|
|
7
|
-
import { defineStore as
|
|
7
|
+
import { defineStore as O } from "pinia";
|
|
8
8
|
import "../constants/selectors.js";
|
|
9
|
-
import { DEFAULT_MOBILE_CARDS_IN_ROW as
|
|
10
|
-
import { CURRENT_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as
|
|
11
|
-
import { getDefaultProducts as
|
|
12
|
-
import { generateCompleteFilterQuery as
|
|
13
|
-
import { isLegacyStrategyConfig as
|
|
14
|
-
import { getPartnerRecommendationParams as
|
|
15
|
-
import { sanitizeProductIds as
|
|
16
|
-
import { isFilterValid as
|
|
17
|
-
import { getInvalidFields as
|
|
18
|
-
const
|
|
9
|
+
import { DEFAULT_MOBILE_CARDS_IN_ROW as T, DEFAULT_CARDS_IN_ROW as x } from "../constants/layout.js";
|
|
10
|
+
import { CURRENT_CONFIG_VERSION as C, DEFAULT_NODE_CONFIG as V, EXCLUDED_ALGORITHM_IDS as j } from "../constants/defaultConfig.js";
|
|
11
|
+
import { getDefaultProducts as P } from "../templates/utils.js";
|
|
12
|
+
import { generateCompleteFilterQuery as G } from "../utils/filterUtil.js";
|
|
13
|
+
import { isLegacyStrategyConfig as $ } from "../utils/legacyStrategyMigration.js";
|
|
14
|
+
import { getPartnerRecommendationParams as q } from "../utils/partnerCustomizations.js";
|
|
15
|
+
import { sanitizeProductIds as K } from "../utils/productIds.js";
|
|
16
|
+
import { isFilterValid as H } from "../validation/filterSchema.js";
|
|
17
|
+
import { getInvalidFields as J, isConfigValid as Q } from "../validation/requiredFields.js";
|
|
18
|
+
const u = z();
|
|
19
19
|
let S = null, p = null, y = null, I = "", k = null, b = 0;
|
|
20
20
|
const g = /* @__PURE__ */ new Map();
|
|
21
21
|
let l = null;
|
|
@@ -35,7 +35,7 @@ function D() {
|
|
|
35
35
|
productIds: [],
|
|
36
36
|
id: 1,
|
|
37
37
|
language: "en_US",
|
|
38
|
-
mobileCardsInRow:
|
|
38
|
+
mobileCardsInRow: T,
|
|
39
39
|
mobileLayoutEnabled: !1,
|
|
40
40
|
orientation: "grid",
|
|
41
41
|
recommendedProducts: [],
|
|
@@ -56,7 +56,7 @@ function D() {
|
|
|
56
56
|
priceHideIfSameAsDiscounted: !1
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
-
function
|
|
59
|
+
function _() {
|
|
60
60
|
return {
|
|
61
61
|
recommendationConfigs: D(),
|
|
62
62
|
recommendationProducts: [],
|
|
@@ -72,7 +72,7 @@ function G() {
|
|
|
72
72
|
legacyConversionLoading: !1
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const W = () => ({
|
|
76
76
|
recommendationCampaignUrls: {},
|
|
77
77
|
activePredictiveAlgorithms: [],
|
|
78
78
|
languages: {},
|
|
@@ -87,8 +87,8 @@ const Q = () => ({
|
|
|
87
87
|
currentRecommendationId: null,
|
|
88
88
|
strategyPanelOpen: !1,
|
|
89
89
|
configVersion: 0
|
|
90
|
-
}),
|
|
91
|
-
state: () =>
|
|
90
|
+
}), gt = O("guidoRecommendationExtension", {
|
|
91
|
+
state: () => W(),
|
|
92
92
|
getters: {
|
|
93
93
|
// ====================================================================
|
|
94
94
|
// Proxy Getters — Backward Compatible Access to Current Block State
|
|
@@ -119,7 +119,7 @@ const Q = () => ({
|
|
|
119
119
|
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].removeStrategyModalStatus : !1;
|
|
120
120
|
},
|
|
121
121
|
isLegacyStrategyBlock() {
|
|
122
|
-
return R().isFeatureEnabled("reusableRecommendationStrategy") &&
|
|
122
|
+
return R().isFeatureEnabled("reusableRecommendationStrategy") && $(this.recommendationConfigs);
|
|
123
123
|
},
|
|
124
124
|
legacyConversionLoading(t) {
|
|
125
125
|
return t.currentRecommendationId !== null && t.blockStates[t.currentRecommendationId] ? t.blockStates[t.currentRecommendationId].legacyConversionLoading ?? !1 : !1;
|
|
@@ -162,8 +162,8 @@ const Q = () => ({
|
|
|
162
162
|
return [...new Set(t.map((e) => e.filterGroup))].sort((e, r) => e - r);
|
|
163
163
|
},
|
|
164
164
|
getActivePredictiveAlgorithms: (t) => {
|
|
165
|
-
const e =
|
|
166
|
-
return t.activePredictiveAlgorithms.filter((n) => !
|
|
165
|
+
const e = w(), r = [];
|
|
166
|
+
return t.activePredictiveAlgorithms.filter((n) => !j.includes(n)).forEach((n) => {
|
|
167
167
|
r.push(...e.filter((s) => s.id === n));
|
|
168
168
|
}), r.map((n) => ({
|
|
169
169
|
text: n.name,
|
|
@@ -181,7 +181,7 @@ const Q = () => ({
|
|
|
181
181
|
getFilterList() {
|
|
182
182
|
return Object.values(this.filterList).filter((t) => t.isFilterable !== 0 && t.isFilterable !== !1).map((t) => {
|
|
183
183
|
let e;
|
|
184
|
-
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` :
|
|
184
|
+
return t.type === "productAttribute" ? e = `product_attributes.${t.attributeName}` : A.includes(t.attributeName) ? e = `${t.attributeName}.${this.recommendationConfigs.currencySettings.value}` : e = t.attributeName, {
|
|
185
185
|
text: t.displayName,
|
|
186
186
|
value: e,
|
|
187
187
|
type: t.attributeType
|
|
@@ -203,7 +203,7 @@ const Q = () => ({
|
|
|
203
203
|
setCurrentBlock(t) {
|
|
204
204
|
this.blockStates[t] || (this.blockStates = {
|
|
205
205
|
...this.blockStates,
|
|
206
|
-
[t]:
|
|
206
|
+
[t]: _()
|
|
207
207
|
}), this.currentRecommendationId = t;
|
|
208
208
|
},
|
|
209
209
|
/**
|
|
@@ -275,7 +275,7 @@ const Q = () => ({
|
|
|
275
275
|
decimalCount: String(e.currencyDecimalCount),
|
|
276
276
|
decimalSeparator: r(e.currencyDecimalSeparator, ","),
|
|
277
277
|
thousandSeparator: r(e.currencyThousandSeparator, ".")
|
|
278
|
-
}, s = !this.blockStates[t], i = s ?
|
|
278
|
+
}, s = !this.blockStates[t], i = s ? _() : this.blockStates[t];
|
|
279
279
|
i.recommendationConfigs = {
|
|
280
280
|
...i.recommendationConfigs,
|
|
281
281
|
strategy: e.strategy,
|
|
@@ -390,7 +390,7 @@ const Q = () => ({
|
|
|
390
390
|
const t = b, e = (async () => {
|
|
391
391
|
this.strategiesLoading = !0;
|
|
392
392
|
try {
|
|
393
|
-
const r = await
|
|
393
|
+
const r = await u.fetchRecommendationStrategies();
|
|
394
394
|
if (t !== b)
|
|
395
395
|
return;
|
|
396
396
|
this.strategies = r, this.strategiesFetched = !0;
|
|
@@ -434,9 +434,9 @@ const Q = () => ({
|
|
|
434
434
|
_armStrategyPageReturn(t) {
|
|
435
435
|
const e = window.open(t, "_blank");
|
|
436
436
|
if (!e)
|
|
437
|
-
return
|
|
437
|
+
return L().showToaster({
|
|
438
438
|
type: B.Error,
|
|
439
|
-
message:
|
|
439
|
+
message: U()("discovery-strategy.error-description")
|
|
440
440
|
}), !1;
|
|
441
441
|
e.opener = null, l == null || l();
|
|
442
442
|
let r = !1;
|
|
@@ -471,20 +471,20 @@ const Q = () => ({
|
|
|
471
471
|
* new strategy is offered; the user picks it themselves.
|
|
472
472
|
*/
|
|
473
473
|
openStrategyCreation() {
|
|
474
|
-
return this._armStrategyPageReturn(N
|
|
474
|
+
return this._armStrategyPageReturn(N.RECOMMENDATION_STRATEGY_CREATE_PATH);
|
|
475
475
|
},
|
|
476
476
|
/**
|
|
477
477
|
* Opens the strategy's edit page. Every return refreshes the list so the block reflects the
|
|
478
478
|
* edited configuration.
|
|
479
479
|
*/
|
|
480
480
|
openStrategyEdit(t) {
|
|
481
|
-
return this._armStrategyPageReturn(
|
|
481
|
+
return this._armStrategyPageReturn(E(t));
|
|
482
482
|
},
|
|
483
483
|
async resolveStrategyUrlTemplate(t, e) {
|
|
484
484
|
const r = typeof t.updated_at == "string" ? t.updated_at : "", n = r ? `${t.strategy_id}:${r}:${e}` : "", s = n ? this.strategyUrlTemplates[n] : void 0;
|
|
485
485
|
if (s)
|
|
486
486
|
return s;
|
|
487
|
-
const { full_path: i = "" } = await
|
|
487
|
+
const { full_path: i = "" } = await u.generateStrategyEndpoint(t, e) ?? {};
|
|
488
488
|
return n && i && (this.strategyUrlTemplates = {
|
|
489
489
|
...this.strategyUrlTemplates,
|
|
490
490
|
[n]: i
|
|
@@ -502,8 +502,7 @@ const Q = () => ({
|
|
|
502
502
|
throw new Error("[Guido] convertLegacyStrategy called without an active block");
|
|
503
503
|
this.blockStates[r].legacyConversionLoading = !0;
|
|
504
504
|
try {
|
|
505
|
-
const n = await
|
|
506
|
-
this.invalidateStrategies();
|
|
505
|
+
const n = await u.migrateLegacyStrategy(t, e);
|
|
507
506
|
try {
|
|
508
507
|
await this.fetchStrategies();
|
|
509
508
|
} catch (o) {
|
|
@@ -533,7 +532,7 @@ const Q = () => ({
|
|
|
533
532
|
this.patchCurrentBlockConfig({
|
|
534
533
|
strategyId: "",
|
|
535
534
|
strategy: "",
|
|
536
|
-
size:
|
|
535
|
+
size: V.size,
|
|
537
536
|
nodeConfigVersion: C
|
|
538
537
|
});
|
|
539
538
|
},
|
|
@@ -551,7 +550,7 @@ const Q = () => ({
|
|
|
551
550
|
activePredictiveAlgorithms: t,
|
|
552
551
|
languages: e,
|
|
553
552
|
currencies: r
|
|
554
|
-
} = await
|
|
553
|
+
} = await u.fetchRecommendationCreateData();
|
|
555
554
|
if (this.activePredictiveAlgorithms = t, this.languages = e, this.currentRecommendationId !== null && this.blockStates[this.currentRecommendationId]) {
|
|
556
555
|
const n = this.blockStates[this.currentRecommendationId];
|
|
557
556
|
n.filterStatus = !!n.recommendationConfigs.filters.length;
|
|
@@ -572,7 +571,7 @@ const Q = () => ({
|
|
|
572
571
|
return;
|
|
573
572
|
}
|
|
574
573
|
p = (async () => {
|
|
575
|
-
const t = await
|
|
574
|
+
const t = await u.fetchRecommendationFilters();
|
|
576
575
|
this.filterList = t;
|
|
577
576
|
})();
|
|
578
577
|
try {
|
|
@@ -607,7 +606,7 @@ const Q = () => ({
|
|
|
607
606
|
const n = [...e.recommendationConfigs.filters];
|
|
608
607
|
n[r] = {
|
|
609
608
|
...t,
|
|
610
|
-
isValid:
|
|
609
|
+
isValid: H(t)
|
|
611
610
|
}, e.recommendationConfigs.filters = n;
|
|
612
611
|
}
|
|
613
612
|
},
|
|
@@ -621,7 +620,7 @@ const Q = () => ({
|
|
|
621
620
|
let i = 1;
|
|
622
621
|
n = n.map((o) => o.filterGroup === t.filterGroup ? { ...o, filterNumber: i++ } : o);
|
|
623
622
|
} else {
|
|
624
|
-
const i = [...new Set(n.map((a) => a.filterGroup))].sort((a,
|
|
623
|
+
const i = [...new Set(n.map((a) => a.filterGroup))].sort((a, m) => a - m), o = new Map(i.map((a, m) => [a, m + 1]));
|
|
625
624
|
n = n.map((a) => ({
|
|
626
625
|
...a,
|
|
627
626
|
filterGroup: o.get(a.filterGroup) ?? a.filterGroup
|
|
@@ -645,7 +644,7 @@ const Q = () => ({
|
|
|
645
644
|
}), e.recommendationConfigs.filters = r;
|
|
646
645
|
},
|
|
647
646
|
generateFilterQuery() {
|
|
648
|
-
return
|
|
647
|
+
return G(this.recommendationConfigs.filters);
|
|
649
648
|
},
|
|
650
649
|
/**
|
|
651
650
|
* Validation-only check invoked at save-CTA time. Defined as an action
|
|
@@ -653,14 +652,14 @@ const Q = () => ({
|
|
|
653
652
|
* every block's recommendationConfigs across user edits.
|
|
654
653
|
*/
|
|
655
654
|
hasInvalidBlock() {
|
|
656
|
-
return Object.values(this.blockStates).some((t) => !
|
|
655
|
+
return Object.values(this.blockStates).some((t) => !Q(t.recommendationConfigs, this));
|
|
657
656
|
},
|
|
658
657
|
/**
|
|
659
658
|
* Which required fields are missing across the design's blocks, so the save
|
|
660
659
|
* toaster can name the cause instead of always showing the generic message.
|
|
661
660
|
*/
|
|
662
661
|
invalidBlockFields() {
|
|
663
|
-
return Object.values(this.blockStates).flatMap((t) =>
|
|
662
|
+
return Object.values(this.blockStates).flatMap((t) => J(t.recommendationConfigs, this));
|
|
664
663
|
},
|
|
665
664
|
// ====================================================================
|
|
666
665
|
// Per-Block Product Fetching
|
|
@@ -698,7 +697,7 @@ const Q = () => ({
|
|
|
698
697
|
this._setBlockProducts(t, [], i);
|
|
699
698
|
return;
|
|
700
699
|
}
|
|
701
|
-
const o = r.filters.filter((f) => f.isValid), a =
|
|
700
|
+
const o = r.filters.filter((f) => f.isValid), a = G(o), m = ((h = w().find((f) => f.key === r.strategy)) == null ? void 0 : h.path) || "", c = {
|
|
702
701
|
locale: r.language,
|
|
703
702
|
currency: r.currencySettings.value,
|
|
704
703
|
partnerName: n.partnerName,
|
|
@@ -706,58 +705,83 @@ const Q = () => ({
|
|
|
706
705
|
details: !0,
|
|
707
706
|
campaignId: n.variationId
|
|
708
707
|
};
|
|
709
|
-
r.strategy === "manualMerchandising" ? c.productId =
|
|
708
|
+
r.strategy === "manualMerchandising" ? c.productId = K(r.productIds) : r.strategy === "similarViewed" && (c.productId = "{itemId}"), r.strategy === "userBased" && (c.userId = "{user_id}"), a && (c.filter = a), r.shuffleProducts && (c.shuffle = !0), Object.assign(
|
|
710
709
|
c,
|
|
711
|
-
|
|
710
|
+
q(n.partnerName, r.strategy)
|
|
712
711
|
);
|
|
713
|
-
let
|
|
712
|
+
let d;
|
|
714
713
|
try {
|
|
715
|
-
|
|
714
|
+
d = await u.fetchRecommendationProducts(m, c);
|
|
716
715
|
} catch {
|
|
717
|
-
|
|
716
|
+
d = [];
|
|
718
717
|
}
|
|
719
|
-
g.get(t) === s && this._setBlockProducts(t,
|
|
718
|
+
g.get(t) === s && this._setBlockProducts(t, d, i);
|
|
720
719
|
},
|
|
721
720
|
/**
|
|
722
721
|
* Block-scoped counterpart of `fetchRecommendationProducts`, which only ever serves the
|
|
723
722
|
* selected block. The legacy conversion must refresh the products of the block that
|
|
724
723
|
* started it even after the user selected another one.
|
|
724
|
+
* @returns whether real products arrived
|
|
725
725
|
*/
|
|
726
|
-
async fetchStrategyProductsForBlock(t) {
|
|
727
|
-
var
|
|
728
|
-
(
|
|
726
|
+
async fetchStrategyProductsForBlock(t, e = {}) {
|
|
727
|
+
var r;
|
|
728
|
+
return (r = this.blockStates[t]) != null && r.recommendationConfigs.strategyId ? this._doFetchStrategyProducts(t, e) : !1;
|
|
729
729
|
},
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
730
|
+
/**
|
|
731
|
+
* Reloads a block's products and adopts its strategy's current size, which may have
|
|
732
|
+
* moved since the block was assigned.
|
|
733
|
+
* @returns whether a fresh listing holds the strategy and its products arrived
|
|
734
|
+
*/
|
|
735
|
+
async refreshStrategyBlock(t) {
|
|
736
|
+
var s;
|
|
737
|
+
const e = (s = this.blockStates[t]) == null ? void 0 : s.recommendationConfigs.strategyId;
|
|
738
|
+
if (!e)
|
|
739
|
+
return !1;
|
|
740
|
+
try {
|
|
741
|
+
await this.fetchStrategies();
|
|
742
|
+
} catch {
|
|
743
|
+
return !1;
|
|
744
|
+
}
|
|
745
|
+
const r = this.strategiesFetched ? this.strategies.find((i) => String(i.strategy_id) === e) : void 0;
|
|
746
|
+
if (!r || !await this.fetchStrategyProductsForBlock(t, { keepOnFailure: !0 }))
|
|
747
|
+
return !1;
|
|
748
|
+
const n = this.blockStates[t];
|
|
749
|
+
return n ? (r.size !== void 0 && (n.recommendationConfigs = {
|
|
750
|
+
...n.recommendationConfigs,
|
|
751
|
+
size: String(r.size)
|
|
752
|
+
}), !0) : !1;
|
|
753
|
+
},
|
|
754
|
+
async _doFetchStrategyProducts(t, { keepOnFailure: e = !1 } = {}) {
|
|
755
|
+
const r = (g.get(t) ?? 0) + 1;
|
|
756
|
+
g.set(t, r);
|
|
757
|
+
const { recommendationConfigs: n } = this.blockStates[t];
|
|
758
|
+
let s = [], i = parseInt(n.size) || 6;
|
|
735
759
|
try {
|
|
736
760
|
await this.fetchStrategies();
|
|
737
|
-
const
|
|
738
|
-
(
|
|
761
|
+
const o = this.strategies.find(
|
|
762
|
+
(a) => String(a.strategy_id) === n.strategyId
|
|
739
763
|
);
|
|
740
|
-
if (
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
|
|
764
|
+
if (o) {
|
|
765
|
+
i = parseInt(String(o.size ?? "")) || i;
|
|
766
|
+
const a = n.currencySettings.value, c = (await this.resolveStrategyUrlTemplate(o, a)).replaceAll("{locale}", n.language).replaceAll("{currency}", a), d = c.indexOf("?"), h = d === -1 ? c : c.slice(0, d), f = (d === -1 ? "" : c.slice(d + 1)).split("&").filter((F) => F && !F.startsWith("user_id=")), v = f.length ? `${h}?${f.join("&")}` : h;
|
|
767
|
+
v && (s = await u.fetchRecommendationProductsByUrl(v));
|
|
744
768
|
}
|
|
745
769
|
} catch {
|
|
746
|
-
|
|
770
|
+
s = [];
|
|
747
771
|
}
|
|
748
|
-
g.get(t)
|
|
772
|
+
return g.get(t) !== r || !s.length && e ? !1 : (this._setBlockProducts(t, s, i), s.length > 0);
|
|
749
773
|
},
|
|
750
774
|
_setBlockProducts(t, e, r) {
|
|
751
775
|
if (!this.blockStates[t])
|
|
752
776
|
return;
|
|
753
|
-
const n = e.length > 0 ? e :
|
|
777
|
+
const n = e.length > 0 ? e : P(r);
|
|
754
778
|
this.blockStates[t].recommendationProducts = [
|
|
755
779
|
...n.slice(0, r),
|
|
756
|
-
...
|
|
780
|
+
...P(Math.max(0, r - n.length))
|
|
757
781
|
];
|
|
758
782
|
}
|
|
759
783
|
}
|
|
760
784
|
});
|
|
761
785
|
export {
|
|
762
|
-
|
|
786
|
+
gt as useRecommendationExtensionStore
|
|
763
787
|
};
|
|
@@ -1,32 +1,37 @@
|
|
|
1
|
-
import { ModificationDescription as
|
|
2
|
-
import { RECOMMENDATION_ID_ATTR as
|
|
3
|
-
import { isPartnerManagedBlock as
|
|
4
|
-
import { RecommendationConfigService as
|
|
5
|
-
let
|
|
6
|
-
function
|
|
7
|
-
|
|
1
|
+
import { ModificationDescription as m } from "../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RECOMMENDATION_ID_ATTR as a } from "../constants/selectors.js";
|
|
3
|
+
import { isPartnerManagedBlock as C, updateProductContentInPlace as N, regenerateProductRowsWithStyles as p } from "../controls/main/utils.js";
|
|
4
|
+
import { RecommendationConfigService as l } from "../services/configService.js";
|
|
5
|
+
let e = null;
|
|
6
|
+
function O(n) {
|
|
7
|
+
e = n;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
function R(n) {
|
|
10
|
+
const o = e == null ? void 0 : e.getDocumentRootHtmlNode();
|
|
11
|
+
return !o || !("querySelectorAll" in o) ? [] : o.querySelectorAll(`[${a}="${n}"]`).map((i) => l.getConfig(i));
|
|
12
|
+
}
|
|
13
|
+
function P(n, o, i, u) {
|
|
14
|
+
const c = e == null ? void 0 : e.getDocumentRootHtmlNode();
|
|
15
|
+
if (!e || !c || !("querySelector" in c))
|
|
12
16
|
return !1;
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
17
|
+
const t = c.querySelector(`[${a}="${n}"]`);
|
|
18
|
+
if (!t)
|
|
15
19
|
return !1;
|
|
16
|
-
const
|
|
17
|
-
if (
|
|
18
|
-
return
|
|
20
|
+
const r = e.getDocumentModifier(), d = l.getConfig(t), s = Object.keys(o).some((g) => JSON.stringify(d[g]) !== JSON.stringify(o[g]));
|
|
21
|
+
if (l.stageConfig(r, t, o), C(t))
|
|
22
|
+
return r.apply(new m(u)), !0;
|
|
19
23
|
let f = !1;
|
|
20
|
-
return
|
|
21
|
-
currentNode:
|
|
22
|
-
documentModifier:
|
|
23
|
-
products:
|
|
24
|
+
return N({
|
|
25
|
+
currentNode: t,
|
|
26
|
+
documentModifier: r,
|
|
27
|
+
products: i,
|
|
24
28
|
onApplied: () => {
|
|
25
29
|
f = !0;
|
|
26
30
|
}
|
|
27
|
-
}) || (f =
|
|
31
|
+
}) || (f = p({ currentNode: t, documentModifier: r, products: i })), !f && s && r.apply(new m(u)), !0;
|
|
28
32
|
}
|
|
29
33
|
export {
|
|
30
34
|
P as commitBlockChangeOutsidePanel,
|
|
31
|
-
|
|
35
|
+
R as readBlockNodeConfigs,
|
|
36
|
+
O as registerNodeConfigWriter
|
|
32
37
|
};
|
|
@@ -1,24 +1,63 @@
|
|
|
1
|
-
import { useRecommendationExtensionStore as
|
|
2
|
-
import { commitBlockChangeOutsidePanel as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useRecommendationExtensionStore as m } from "../store/recommendation.js";
|
|
2
|
+
import { commitBlockChangeOutsidePanel as d, readBlockNodeConfigs as l } from "./nodeConfigWriter.js";
|
|
3
|
+
function i(e) {
|
|
4
|
+
return {
|
|
5
|
+
strategy: e.strategy,
|
|
6
|
+
strategyId: e.strategyId,
|
|
7
|
+
language: e.language,
|
|
8
|
+
size: e.size,
|
|
9
|
+
productIds: [...e.productIds],
|
|
10
|
+
filters: structuredClone(e.filters),
|
|
11
|
+
shuffleProducts: e.shuffleProducts,
|
|
12
|
+
currencyCode: e.currency.code,
|
|
13
|
+
currencySymbol: e.currency.symbol,
|
|
14
|
+
currencyAlignment: e.currency.alignment,
|
|
15
|
+
currencyDecimalCount: e.currency.decimalCount,
|
|
16
|
+
currencyDecimalSeparator: e.currency.decimalSeparator,
|
|
17
|
+
currencyThousandSeparator: e.currency.thousandSeparator
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function f(e, n) {
|
|
21
|
+
const o = JSON.stringify(i(n));
|
|
22
|
+
return l(e).find((r) => JSON.stringify(i(r)) !== o) ?? n;
|
|
23
|
+
}
|
|
24
|
+
async function C(e, n, o) {
|
|
25
|
+
const r = m(), c = [e, n];
|
|
26
|
+
(/* @__PURE__ */ new Map([[e, f(e, o)], [n, o]])).forEach((t, s) => {
|
|
27
|
+
var a;
|
|
28
|
+
t.strategyId && ((a = r.blockStates[s]) == null ? void 0 : a.recommendationConfigs.strategyId) !== t.strategyId && r.seedBlockUrlConfig(s, i(t));
|
|
29
|
+
}), r.resetArrivedBlock(n), await Promise.all(c.map(async (t) => {
|
|
30
|
+
if (!await r.refreshStrategyBlock(t))
|
|
31
|
+
return;
|
|
32
|
+
const { recommendationConfigs: s, recommendationProducts: a } = r.blockStates[t];
|
|
33
|
+
d(
|
|
34
|
+
t,
|
|
35
|
+
{ size: s.size },
|
|
36
|
+
a,
|
|
37
|
+
"Refresh duplicated recommendation strategy"
|
|
38
|
+
);
|
|
39
|
+
}));
|
|
40
|
+
}
|
|
41
|
+
async function S(e, n) {
|
|
42
|
+
const o = m(), r = o.blockStates[e];
|
|
43
|
+
if (!r)
|
|
6
44
|
return !1;
|
|
7
|
-
const { strategyId:
|
|
8
|
-
if (
|
|
45
|
+
const { strategyId: c, strategy: u, size: t, nodeConfigVersion: s } = r.recommendationConfigs;
|
|
46
|
+
if (o.currentRecommendationId === e)
|
|
9
47
|
try {
|
|
10
|
-
await
|
|
11
|
-
} catch (
|
|
12
|
-
console.error("[recommendation] product refetch after a strategy change failed",
|
|
48
|
+
await o.fetchRecommendationProducts();
|
|
49
|
+
} catch (y) {
|
|
50
|
+
console.error("[recommendation] product refetch after a strategy change failed", y);
|
|
13
51
|
}
|
|
14
|
-
const
|
|
52
|
+
const a = d(
|
|
15
53
|
e,
|
|
16
|
-
{ strategyId:
|
|
17
|
-
|
|
18
|
-
|
|
54
|
+
{ strategyId: c, strategy: u, size: t, configVersion: s },
|
|
55
|
+
r.recommendationProducts,
|
|
56
|
+
n
|
|
19
57
|
);
|
|
20
|
-
return
|
|
58
|
+
return a || console.error("[recommendation] strategy change did not reach a node", { blockId: e }), a;
|
|
21
59
|
}
|
|
22
60
|
export {
|
|
23
|
-
|
|
61
|
+
S as commitStrategyChange,
|
|
62
|
+
C as refreshDuplicatedStrategyBlocks
|
|
24
63
|
};
|
package/dist/guido.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@charset "UTF-8";.
|
|
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-c61cc8ea]{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-36867e2e]{--ribbon-offset: 0px;position:relative;width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__container[data-v-36867e2e]{width:100%;height:calc(100vh - 128px - var(--ribbon-offset))}.guido-editor__no-header[data-v-36867e2e]{height:calc(100vh - 75px - var(--ribbon-offset))}[data-v-293f1c47] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-91a26acd]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-91a26acd]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-91a26acd]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-91a26acd]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-91a26acd]{object-fit:cover;transform:scale(1)}[data-v-b9a93c6e] .guido__verion-history-view-option-selection-desktop svg,[data-v-b9a93c6e] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-b9a93c6e] .in-segments-wrapper__button_selected,[data-v-b9a93c6e] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-c3fd5d4b]{gap:16px}.desktop-browser-header[data-v-d86c5af5]{height:79px;min-height:79px}.desktop-browser-header__left[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:378px}.desktop-browser-header__center[data-v-d86c5af5]{height:79px;background-repeat:repeat-x;background-size:auto 100%;background-position:left top}.desktop-browser-header__right[data-v-d86c5af5]{-webkit-user-drag:none;height:79px;width:112px}.desktop-preview[data-v-cf946232]{min-width:602px;height:70vh;min-height:583px;border-radius:10px}.desktop-preview iframe[data-v-cf946232]{min-height:504px}.iframe-wrapper[data-v-f255b2bb]{width:258px}.iframe-scaled[data-v-f255b2bb]{width:320px;height:124.0310077519%;transform:scale(.80625);transform-origin:top left}.cropped-text[data-v-eb3d05d7]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mobile-preview-wrapper__phone[data-v-3f472f96]{width:282px}.mobile-preview-wrapper__phone img[data-v-3f472f96]{object-fit:cover;border-radius:44px}.mobile-preview-wrapper__content[data-v-3f472f96]{width:258px;height:450px;left:12px}[data-v-6bcaca8a] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-f16f20f8] .vueperslides__bullets{pointer-events:none!important}[data-v-f16f20f8] .vueperslides__parallax-wrapper{padding-bottom:110px!important}[data-v-bb3cca55] .vueperslides__bullets{pointer-events:none!important}[data-v-bb3cca55] .vueperslides__parallax-wrapper{height:110px!important;padding-bottom:110px!important}[data-v-19d8cb42] .vueperslides__bullets,[data-v-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-6ce48dfd]{width:100%;max-width:none}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-skeleton{width:100%!important}.assign-strategy-drawer-content .assign-strategy-select[data-v-6ce48dfd] .in-dropdown-box__container{width:413px}.assign-strategy-drawer .spaced-dot-sep{background-image:linear-gradient(90deg,#91949f 20%,#fff0 0);background-position:center bottom;background-repeat:repeat-x;background-size:5px 1px}.assign-strategy-drawer .spaced-dot-sep--top{background-position:center top}.assign-strategy-drawer .spaced-dot-sep--fc-n:first-child{background:none}.legacy-strategy-updated-modal[data-v-da2225a1]{position:relative;z-index:145}
|
|
@@ -278,14 +278,6 @@ export declare const TemplateSchema: v.ObjectSchema<{
|
|
|
278
278
|
* mount. Non-numbers still fail, like every other field in this schema.
|
|
279
279
|
*/
|
|
280
280
|
readonly trackIdCounter: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, number>]>, 0>;
|
|
281
|
-
/**
|
|
282
|
-
* The variation's saved `recommendationCampaignUrls`, keyed by block id. A block
|
|
283
|
-
* that still names a strategy but has no entry here had it dropped by a
|
|
284
|
-
* cross-account duplicate, so Guido resets it on load (SD-151945). Omit it and
|
|
285
|
-
* that check is off, and so is any non-object value such as `null`, because a reset
|
|
286
|
-
* cannot be undone. Hosts send `[]` for an empty map.
|
|
287
|
-
*/
|
|
288
|
-
readonly recommendationCampaignUrls: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnknownSchema, v.TransformAction<unknown, Record<string, unknown> | undefined>]>, undefined>;
|
|
289
281
|
/** Migration-only inputs (legacy block configs) */
|
|
290
282
|
readonly migration: v.OptionalSchema<v.ObjectSchema<{
|
|
291
283
|
/**
|
|
@@ -709,14 +701,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
|
|
|
709
701
|
* mount. Non-numbers still fail, like every other field in this schema.
|
|
710
702
|
*/
|
|
711
703
|
readonly trackIdCounter: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, number>]>, 0>;
|
|
712
|
-
/**
|
|
713
|
-
* The variation's saved `recommendationCampaignUrls`, keyed by block id. A block
|
|
714
|
-
* that still names a strategy but has no entry here had it dropped by a
|
|
715
|
-
* cross-account duplicate, so Guido resets it on load (SD-151945). Omit it and
|
|
716
|
-
* that check is off, and so is any non-object value such as `null`, because a reset
|
|
717
|
-
* cannot be undone. Hosts send `[]` for an empty map.
|
|
718
|
-
*/
|
|
719
|
-
readonly recommendationCampaignUrls: v.OptionalSchema<v.SchemaWithPipe<readonly [v.UnknownSchema, v.TransformAction<unknown, Record<string, unknown> | undefined>]>, undefined>;
|
|
720
704
|
/** Migration-only inputs (legacy block configs) */
|
|
721
705
|
readonly migration: v.OptionalSchema<v.ObjectSchema<{
|
|
722
706
|
/**
|
|
@@ -3,7 +3,6 @@ type __VLS_Props = {
|
|
|
3
3
|
id: string;
|
|
4
4
|
title: string;
|
|
5
5
|
description?: string;
|
|
6
|
-
state?: 'default' | 'primary' | 'warning' | 'danger';
|
|
7
6
|
size?: 'X-small' | 'small' | 'medium' | 'large';
|
|
8
7
|
footerButtonOptions?: FooterButtonGroup;
|
|
9
8
|
closeButtonStatus?: boolean;
|
|
@@ -16,7 +15,6 @@ type __VLS_Slots = {} & {
|
|
|
16
15
|
};
|
|
17
16
|
declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
18
17
|
description: string;
|
|
19
|
-
state: string;
|
|
20
18
|
size: string;
|
|
21
19
|
footerButtonOptions: undefined;
|
|
22
20
|
closeButtonStatus: boolean;
|
|
@@ -28,7 +26,6 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
|
|
|
28
26
|
"secondary-action": () => void;
|
|
29
27
|
}, string, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<__VLS_Props>, {
|
|
30
28
|
description: string;
|
|
31
|
-
state: string;
|
|
32
29
|
size: string;
|
|
33
30
|
footerButtonOptions: undefined;
|
|
34
31
|
closeButtonStatus: boolean;
|
|
@@ -37,10 +34,9 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
|
|
|
37
34
|
}>>>, {
|
|
38
35
|
size: "X-small" | "small" | "medium" | "large";
|
|
39
36
|
description: string;
|
|
40
|
-
|
|
37
|
+
closeOnOutsideClick: boolean;
|
|
41
38
|
footerButtonOptions: FooterButtonGroup;
|
|
42
39
|
closeButtonStatus: boolean;
|
|
43
|
-
closeOnOutsideClick: boolean;
|
|
44
40
|
footerStatus: boolean;
|
|
45
41
|
}>;
|
|
46
42
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -43,7 +43,6 @@ export declare const useConfig: () => {
|
|
|
43
43
|
selectedUnsubscribePages: number[];
|
|
44
44
|
forceRecreate: boolean;
|
|
45
45
|
trackIdCounter: number;
|
|
46
|
-
recommendationCampaignUrls?: Record<string, unknown> | undefined;
|
|
47
46
|
migration: {
|
|
48
47
|
recommendationConfigs: {
|
|
49
48
|
[x: string]: {
|
|
@@ -181,7 +180,6 @@ export declare const useConfig: () => {
|
|
|
181
180
|
selectedUnsubscribePages: number[];
|
|
182
181
|
forceRecreate: boolean;
|
|
183
182
|
trackIdCounter: number;
|
|
184
|
-
recommendationCampaignUrls?: Record<string, unknown> | undefined;
|
|
185
183
|
migration: {
|
|
186
184
|
recommendationConfigs: {
|
|
187
185
|
[x: string]: {
|
|
@@ -16,7 +16,6 @@ export interface HttpError {
|
|
|
16
16
|
status?: number;
|
|
17
17
|
statusText?: string;
|
|
18
18
|
response?: Response;
|
|
19
|
-
authReported?: boolean;
|
|
20
19
|
}
|
|
21
20
|
export declare const useHttp: (defaultOptions?: HttpOptions) => {
|
|
22
21
|
loading: import("vue").ComputedRef<boolean>;
|
|
@@ -66,7 +65,6 @@ export declare const useHttp: (defaultOptions?: HttpOptions) => {
|
|
|
66
65
|
json: () => Promise<any>;
|
|
67
66
|
text: () => Promise<string>;
|
|
68
67
|
} | undefined;
|
|
69
|
-
authReported?: boolean | undefined;
|
|
70
68
|
} | null>;
|
|
71
69
|
hasError: import("vue").ComputedRef<boolean>;
|
|
72
70
|
request: <T = unknown>(method: HttpMethod, url: string, data?: unknown, options?: HttpOptions) => Promise<HttpResponse<T>>;
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import type { LegacyRecommendationConfig } from '@@/Types/config';
|
|
2
|
-
|
|
3
|
-
export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>, partnerScope?: PartnerScopeMigrationOptions) => Promise<string>;
|
|
2
|
+
export declare const migrate: (html: string, recommendationConfigs?: Record<string, LegacyRecommendationConfig>) => Promise<string>;
|
|
@@ -8,8 +8,8 @@ export declare const URLS: {
|
|
|
8
8
|
NEWSLETTER_RECOMMENDATIONS_PATH: string;
|
|
9
9
|
MIGRATE_STRATEGIES_PATH: string;
|
|
10
10
|
TEMPLATE_MIGRATE_STRATEGIES_PATH: string;
|
|
11
|
+
RECOMMENDATION_STRATEGY_CREATE_PATH: string;
|
|
11
12
|
};
|
|
12
|
-
export declare const strategyCreatePath: () => string;
|
|
13
13
|
export declare const strategyEditPath: (strategyId: string | number) => string;
|
|
14
14
|
export declare const MIGRATION_PATHS: Record<RrsMigrationTarget['scope'], string>;
|
|
15
15
|
export declare const QUERY_PARAMS: {
|