@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,4 +1,4 @@
|
|
|
1
|
-
import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationCampaignUrlValue, RecommendationProduct, RrsStrategy } from '@@/Types/recommendation';
|
|
1
|
+
import type { Orientation, Languages, Currency, NumericSeparator, FiltersResponse, Filter, RecommendationCampaignUrlValue, RecommendationProduct, RrsMigrationPayload, RrsStrategy } from '@@/Types/recommendation';
|
|
2
2
|
export interface PerBlockConfigs {
|
|
3
3
|
cardsInRow: number;
|
|
4
4
|
currencySettings: {
|
|
@@ -22,6 +22,7 @@ export interface PerBlockConfigs {
|
|
|
22
22
|
shuffleProducts: boolean;
|
|
23
23
|
strategy: string;
|
|
24
24
|
strategyId: string;
|
|
25
|
+
nodeConfigVersion: number;
|
|
25
26
|
textTrimming: boolean;
|
|
26
27
|
unresponsive: boolean;
|
|
27
28
|
size: string;
|
|
@@ -36,11 +37,13 @@ interface PerBlockState {
|
|
|
36
37
|
filterSelectionDrawerStatus: boolean;
|
|
37
38
|
assignStrategyDrawerStatus: boolean;
|
|
38
39
|
removeStrategyModalStatus: boolean;
|
|
40
|
+
legacyStrategyUpdatedModalStatus: boolean;
|
|
39
41
|
filterGroup: number;
|
|
40
42
|
/** Whether initial API data (filters, algorithms, products) has been fetched for this block */
|
|
41
43
|
isInitialized: boolean;
|
|
42
44
|
/** Snapshot of filters taken when the drawer opens, used to revert on cancel */
|
|
43
45
|
filterSnapshot: Filter[] | null;
|
|
46
|
+
legacyConversionLoading: boolean;
|
|
44
47
|
}
|
|
45
48
|
/**
|
|
46
49
|
* Persisted-config subset used by `seedBlockUrlConfig` to reconstruct
|
|
@@ -201,6 +204,53 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
201
204
|
currentRecommendationId: number | null;
|
|
202
205
|
configVersion: number;
|
|
203
206
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
207
|
+
isLegacyStrategyBlock(): boolean;
|
|
208
|
+
legacyConversionLoading(state: {
|
|
209
|
+
recommendationCampaignUrls: Record<string, RecommendationCampaignUrlValue>;
|
|
210
|
+
activePredictiveAlgorithms: number[];
|
|
211
|
+
languages: Languages;
|
|
212
|
+
currencyList: {
|
|
213
|
+
text: string;
|
|
214
|
+
value: string;
|
|
215
|
+
}[];
|
|
216
|
+
filterList: FiltersResponse;
|
|
217
|
+
strategies: {
|
|
218
|
+
[x: string]: unknown;
|
|
219
|
+
strategy_id: number;
|
|
220
|
+
name: string;
|
|
221
|
+
status: string;
|
|
222
|
+
suitable_channels: string;
|
|
223
|
+
size?: (number | string) | undefined;
|
|
224
|
+
}[];
|
|
225
|
+
strategiesLoading: boolean;
|
|
226
|
+
strategyUrlTemplates: Record<string, string>;
|
|
227
|
+
blockStates: Record<number, PerBlockState>;
|
|
228
|
+
currentRecommendationId: number | null;
|
|
229
|
+
configVersion: number;
|
|
230
|
+
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
231
|
+
legacyStrategyUpdatedModalStatus(state: {
|
|
232
|
+
recommendationCampaignUrls: Record<string, RecommendationCampaignUrlValue>;
|
|
233
|
+
activePredictiveAlgorithms: number[];
|
|
234
|
+
languages: Languages;
|
|
235
|
+
currencyList: {
|
|
236
|
+
text: string;
|
|
237
|
+
value: string;
|
|
238
|
+
}[];
|
|
239
|
+
filterList: FiltersResponse;
|
|
240
|
+
strategies: {
|
|
241
|
+
[x: string]: unknown;
|
|
242
|
+
strategy_id: number;
|
|
243
|
+
name: string;
|
|
244
|
+
status: string;
|
|
245
|
+
suitable_channels: string;
|
|
246
|
+
size?: (number | string) | undefined;
|
|
247
|
+
}[];
|
|
248
|
+
strategiesLoading: boolean;
|
|
249
|
+
strategyUrlTemplates: Record<string, string>;
|
|
250
|
+
blockStates: Record<number, PerBlockState>;
|
|
251
|
+
currentRecommendationId: number | null;
|
|
252
|
+
configVersion: number;
|
|
253
|
+
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
204
254
|
assignedStrategy(state: {
|
|
205
255
|
recommendationCampaignUrls: Record<string, RecommendationCampaignUrlValue>;
|
|
206
256
|
activePredictiveAlgorithms: number[];
|
|
@@ -430,11 +480,14 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
430
480
|
cancelFilterDrawer(): void;
|
|
431
481
|
openAssignStrategyDrawer(): void;
|
|
432
482
|
closeAssignStrategyDrawer(): void;
|
|
483
|
+
openLegacyStrategyUpdatedModal(): void;
|
|
484
|
+
closeLegacyStrategyUpdatedModal(): void;
|
|
433
485
|
openRemoveStrategyModal(): void;
|
|
434
486
|
closeRemoveStrategyModal(): void;
|
|
435
487
|
fetchStrategies(): Promise<void>;
|
|
436
488
|
resolveStrategyUrlTemplate(strategy: RrsStrategy, currency: string): Promise<string>;
|
|
437
489
|
assignStrategy(strategy: RrsStrategy): void;
|
|
490
|
+
convertLegacyStrategy(payload: RrsMigrationPayload): Promise<string>;
|
|
438
491
|
removeStrategy(): void;
|
|
439
492
|
fetchRecommendationCreateData(): Promise<void>;
|
|
440
493
|
fetchRecommendationFilters(): Promise<void>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Filter, RrsMigrationFilterGroup, RrsMigrationPayload } from '@@/Types/recommendation';
|
|
2
|
+
type FilterAttribute = {
|
|
3
|
+
value: string;
|
|
4
|
+
type: string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A block authored before reusable strategies: it still carries a plain feed
|
|
8
|
+
* configuration (compiled into a feed URL string) instead of a strategy id.
|
|
9
|
+
* Blocks created under RRS stamp `CURRENT_CONFIG_VERSION`, so the version is
|
|
10
|
+
* what separates "never converted" from "not assigned yet".
|
|
11
|
+
*/
|
|
12
|
+
export declare function isLegacyStrategyConfig({ strategyId, nodeConfigVersion }: {
|
|
13
|
+
strategyId: string;
|
|
14
|
+
nodeConfigVersion: number;
|
|
15
|
+
}): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Groups the block's valid filters the way the feed URL groups them, in the
|
|
18
|
+
* shape the migration endpoint validates. The URL's filter DSL states no
|
|
19
|
+
* attribute type and cannot express a mixed-operator group, which is exactly
|
|
20
|
+
* what this override exists to supply.
|
|
21
|
+
*/
|
|
22
|
+
export declare function toMigrationFilterGroups(filters: Filter[], attributes: FilterAttribute[]): RrsMigrationFilterGroup[];
|
|
23
|
+
interface MigrationInputs {
|
|
24
|
+
blockId: number;
|
|
25
|
+
url: string;
|
|
26
|
+
templateId: string;
|
|
27
|
+
variationId: string;
|
|
28
|
+
strategy: string;
|
|
29
|
+
productIds: string[];
|
|
30
|
+
filters: Filter[];
|
|
31
|
+
attributes: FilterAttribute[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The server names and de-duplicates the strategy, so nothing here derives a
|
|
35
|
+
* name; `campaignId`/`variationId` only feed that name and fall back to 0 for
|
|
36
|
+
* templates and modules, which carry no numeric campaign.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildLegacyMigrationPayload({ blockId, url, templateId, variationId, strategy, productIds, filters, attributes, }: MigrationInputs): RrsMigrationPayload;
|
|
39
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InitialResponse, FiltersResponse, RecommendationProduct, RecommendationProductsParams, RrsEndpointGenerateResponse, RrsStrategy } from '@@/Types/recommendation';
|
|
1
|
+
import type { InitialResponse, FiltersResponse, RecommendationProduct, RecommendationProductsParams, RrsEndpointGenerateResponse, RrsMigrationPayload, RrsStrategy } from '@@/Types/recommendation';
|
|
2
2
|
export declare const useRecommendationApi: () => {
|
|
3
3
|
fetchRecommendationCreateData: () => Promise<InitialResponse>;
|
|
4
4
|
fetchRecommendationFilters: () => Promise<FiltersResponse>;
|
|
@@ -6,4 +6,5 @@ export declare const useRecommendationApi: () => {
|
|
|
6
6
|
fetchRecommendationProductsByUrl: (url: string) => Promise<RecommendationProduct[]>;
|
|
7
7
|
fetchRecommendationStrategies: () => Promise<RrsStrategy[]>;
|
|
8
8
|
generateStrategyEndpoint: (strategy: RrsStrategy, currency: string) => Promise<RrsEndpointGenerateResponse | null>;
|
|
9
|
+
migrateLegacyStrategy: (payload: RrsMigrationPayload) => Promise<string>;
|
|
9
10
|
};
|
|
@@ -14,14 +14,16 @@ const n = `.strategy-control-header {
|
|
|
14
14
|
padding: 8px 16px 16px;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
.strategy-control-description
|
|
17
|
+
.strategy-control-description,
|
|
18
|
+
.strategy-control-legacy-notice {
|
|
18
19
|
margin: 0;
|
|
19
20
|
color: var(--guido-color-gray-600);
|
|
20
21
|
font-size: 13px;
|
|
21
22
|
line-height: 16px;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
.strategy-control-description a
|
|
25
|
+
.strategy-control-description a,
|
|
26
|
+
.strategy-control-legacy-notice a {
|
|
25
27
|
color: var(--guido-color-primary-500);
|
|
26
28
|
text-decoration: underline;
|
|
27
29
|
}
|
|
@@ -117,6 +119,11 @@ const n = `.strategy-control-header {
|
|
|
117
119
|
mask-image: var(--guido-icon-line-plus);
|
|
118
120
|
}
|
|
119
121
|
|
|
122
|
+
.strategy-control-action--update::before {
|
|
123
|
+
mask-image: var(--guido-icon-line-change);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.strategy-control-action--update,
|
|
120
127
|
.strategy-control-action--change {
|
|
121
128
|
color: var(--guido-color-primary-500);
|
|
122
129
|
}
|
|
@@ -129,7 +136,30 @@ const n = `.strategy-control-header {
|
|
|
129
136
|
text-decoration: underline;
|
|
130
137
|
}
|
|
131
138
|
|
|
132
|
-
.recommendation-controls-container
|
|
139
|
+
.recommendation-controls-container.legacy-strategy-block .strategy-control-container {
|
|
140
|
+
display: block;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.strategy-control-skeleton {
|
|
144
|
+
height: 48px;
|
|
145
|
+
margin: 0 16px 16px;
|
|
146
|
+
border-radius: 4px;
|
|
147
|
+
background: linear-gradient(
|
|
148
|
+
90deg,
|
|
149
|
+
var(--guido-color-gray-0) 25%,
|
|
150
|
+
var(--guido-color-gray-100) 37%,
|
|
151
|
+
var(--guido-color-gray-0) 63%
|
|
152
|
+
);
|
|
153
|
+
background-size: 400% 100%;
|
|
154
|
+
animation: strategy-control-skeleton-shimmer 1.4s ease infinite;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@keyframes strategy-control-skeleton-shimmer {
|
|
158
|
+
0% { background-position: 100% 50%; }
|
|
159
|
+
100% { background-position: 0 50%; }
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.recommendation-controls-container:not(.strategy-block):not(.legacy-strategy-block) .strategy-control-container,
|
|
133
163
|
.recommendation-controls-container.strategy-block .product-count-control-container,
|
|
134
164
|
.recommendation-controls-container.strategy-block .algorithm-control-container,
|
|
135
165
|
.recommendation-controls-container.strategy-block .filters-control-container,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.17.0-beta.
|
|
3
|
+
"version": "3.17.0-beta.a2334c9",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|