@useinsider/guido 3.18.2-beta.3e1d9ab → 3.18.2-beta.6cafced
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 +3 -3
- package/dist/components/Guido.vue2.js +30 -30
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
- package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +70 -51
- package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
- 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/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
- package/dist/composables/useCustomInterfaceAppearance.js +56 -46
- package/dist/composables/useHtmlValidator.js +84 -79
- package/dist/composables/useHttp.js +22 -24
- package/dist/composables/useRecommendation.js +40 -35
- package/dist/composables/useStripo.js +30 -30
- package/dist/enums/extensions/recommendationBlock.js +38 -31
- package/dist/extensions/Blocks/Recommendation/block.js +43 -39
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +40 -35
- package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +74 -74
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +189 -90
- package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +26 -16
- package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +24 -0
- package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
- package/dist/guido.css +1 -1
- package/dist/services/templateLibraryApi.js +14 -17
- package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
- package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- 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/controls/main/utils.d.ts +7 -2
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +75 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/strategyCommit.d.ts +14 -0
- package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
- package/dist/src/stores/onboarding.d.ts +377 -0
- package/dist/src/utils/genericUtil.d.ts +0 -6
- package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
- package/dist/static/styles/components/skeleton.css.js +23 -0
- package/dist/stores/onboarding.js +41 -36
- package/dist/utils/genericUtil.js +54 -63
- package/dist/utils/templatePreparation.js +59 -60
- package/package.json +1 -1
- package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
- package/dist/utils/liquidDynamicContent.js +0 -15
|
@@ -4,14 +4,13 @@ import { useToaster as C } from "../composables/useToaster.js";
|
|
|
4
4
|
import { useTranslations as h } from "../composables/useTranslations.js";
|
|
5
5
|
import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
|
|
6
6
|
import { EditorType as v } from "../enums/defaults.js";
|
|
7
|
-
import { ToasterTypeOptions as
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { useSaveAsTemplateStore as
|
|
7
|
+
import { ToasterTypeOptions as N } from "../enums/toaster.js";
|
|
8
|
+
import { useRecommendationExtensionStore as x } from "../extensions/Blocks/Recommendation/store/recommendation.js";
|
|
9
|
+
import { useSaveAsTemplateStore as E } from "../stores/save-as-template.js";
|
|
10
10
|
import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
|
|
11
|
-
import { isPlainObject as P } from "../utils/genericUtil.js";
|
|
12
11
|
import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
|
|
13
|
-
const
|
|
14
|
-
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax:
|
|
12
|
+
const j = () => {
|
|
13
|
+
const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = h();
|
|
15
14
|
return {
|
|
16
15
|
getCategories: async () => {
|
|
17
16
|
try {
|
|
@@ -41,10 +40,10 @@ const B = () => {
|
|
|
41
40
|
createTemplate: async () => {
|
|
42
41
|
var e, t, d, y;
|
|
43
42
|
try {
|
|
44
|
-
const { prepareTemplateDetails: i } = A(), s =
|
|
45
|
-
if (p("liquidSyntax") && !await
|
|
43
|
+
const { prepareTemplateDetails: i } = A(), s = E(), a = await i();
|
|
44
|
+
if (p("liquidSyntax") && !await g(a.compiledHtml))
|
|
46
45
|
return !1;
|
|
47
|
-
const
|
|
46
|
+
const f = {
|
|
48
47
|
name: s.getTemplateName,
|
|
49
48
|
categories: s.getSelectedCategoryIds,
|
|
50
49
|
productId: ((t = (e = c.value) == null ? void 0 : e.partner) == null ? void 0 : t.productType) || 0,
|
|
@@ -55,7 +54,7 @@ const B = () => {
|
|
|
55
54
|
unsubscriptionPreferencePageStatus: !1,
|
|
56
55
|
unsubscriptionPreferencePages: [],
|
|
57
56
|
recommendationCampaignUrls: r(
|
|
58
|
-
|
|
57
|
+
x().recommendationCampaignUrls
|
|
59
58
|
),
|
|
60
59
|
recommendationConfigs: r({}),
|
|
61
60
|
isGuido: !0,
|
|
@@ -67,18 +66,16 @@ const B = () => {
|
|
|
67
66
|
css: a.css,
|
|
68
67
|
dynamicContentList: a.dynamicContentList
|
|
69
68
|
})
|
|
70
|
-
}, { data:
|
|
69
|
+
}, { data: { type: T } } = await m(
|
|
71
70
|
"/newsletter/template-library/create-template",
|
|
72
|
-
|
|
71
|
+
f
|
|
73
72
|
);
|
|
74
|
-
|
|
75
|
-
throw new Error("Unexpected create-template response");
|
|
76
|
-
return g.type === "alert" ? (l({
|
|
73
|
+
return T === "alert" ? (l({
|
|
77
74
|
message: u(
|
|
78
75
|
"newsletter.template-library-save-alert",
|
|
79
76
|
{ templateName: s.getTemplateName }
|
|
80
77
|
),
|
|
81
|
-
type:
|
|
78
|
+
type: N.Error
|
|
82
79
|
}), !1) : (l({
|
|
83
80
|
message: u(
|
|
84
81
|
"newsletter.template-library-save-success",
|
|
@@ -93,5 +90,5 @@ const B = () => {
|
|
|
93
90
|
};
|
|
94
91
|
};
|
|
95
92
|
export {
|
|
96
|
-
|
|
93
|
+
j as useTemplateLibraryApi
|
|
97
94
|
};
|
|
@@ -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;
|
|
@@ -5,7 +5,9 @@ export declare const URLS: {
|
|
|
5
5
|
PRODUCT_ATTRIBUTES_PATH: string;
|
|
6
6
|
RECOMMENDATION_STRATEGIES_PATH: string;
|
|
7
7
|
RECOMMENDATION_STRATEGIES_PANEL_PATH: string;
|
|
8
|
+
RECOMMENDATION_STRATEGY_CREATE_PATH: string;
|
|
8
9
|
};
|
|
10
|
+
export declare const strategyEditPath: (strategyId: string | number) => string;
|
|
9
11
|
export declare const QUERY_PARAMS: {
|
|
10
12
|
CLIENT_ID: string;
|
|
11
13
|
};
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import type { RecommendationNodeConfig, CurrencyConfig, OmnibusTextConfig } from '../types/nodeConfig';
|
|
11
11
|
export declare const PRE_RRS_CONFIG_VERSION = 1;
|
|
12
12
|
export declare const CURRENT_CONFIG_VERSION = 2;
|
|
13
|
+
export declare const RRS_CONFIG_VERSION = 2;
|
|
13
14
|
/**
|
|
14
15
|
* Default currency configuration
|
|
15
16
|
* Uses USD as the base currency with standard formatting
|
|
@@ -10,4 +10,4 @@ export { RecommendationBlockId } from './blockIds';
|
|
|
10
10
|
export { RecommendationControlId } from './controlIds';
|
|
11
11
|
export { BLOCK_ROOT_SELECTOR, CONTAINER_SELECTOR, DESKTOP_CONTAINER_SELECTOR, MOBILE_CONTAINER_SELECTOR, MOBILE_ROW_SELECTOR, CSS_CLASS_RECO_BUTTON, CSS_CLASS_SKIP_COMPILE, RECOMMENDATION_VARIABLE_BUILTIN_ATTRIBUTES, CURRENCY_ATTR, ATTR_PRODUCT_IMAGE, ATTR_PRODUCT_NAME, ATTR_PRODUCT_PRICE, ATTR_PRODUCT_OLD_PRICE, ATTR_PRODUCT_OMNIBUS_PRICE, ATTR_PRODUCT_OMNIBUS_DISCOUNT, ATTR_PRODUCT_BUTTON, ATTR_RECOMMENDATION_TITLE, SELECTOR_TITLE_CELL, ATTR_CUSTOM_PREFIX, ATTR_DATA_CARD_COMPOSITION, ATTR_DATA_CUSTOM_ATTRIBUTES, ATTR_PRODUCT_ATTR, CSS_CLASS_ATTRIBUTE_ROW, CSS_CLASS_SPACER, SELECTOR_ATTRIBUTE_ROW, ATTR_DATA_ATTRIBUTE_TYPE, ATTR_DATA_VISIBILITY, PRODUCT_ATTRIBUTE_PREFIX, BUILT_IN_DEFAULT_ATTRIBUTES, } from './selectors';
|
|
12
12
|
export { LAYOUT_VALUES, LAYOUT_OPTIONS, DEFAULT_PRODUCTS_PER_ROW, DEFAULT_CARDS_IN_ROW, DEFAULT_MOBILE_CARDS_IN_ROW, MAX_PRODUCT_COUNT, MIN_PRODUCT_COUNT, MAX_PRODUCTS_PER_ROW, MIN_PRODUCTS_PER_ROW, MAX_MOBILE_PRODUCTS_PER_ROW, MIN_MOBILE_PRODUCTS_PER_ROW, DEFAULT_COLUMN_SPACING, DEFAULT_ROW_SPACING, DEFAULT_MOBILE_COLUMN_SPACING, DEFAULT_MOBILE_ROW_SPACING, MIN_SPACING, MAX_SPACING, SPACING_STEP, } from './layout';
|
|
13
|
-
export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, PRE_RRS_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
|
|
13
|
+
export { DEFAULT_NODE_CONFIG, DEFAULT_CURRENCY, DEFAULT_COMPOSITION, DEFAULT_VISIBILITY, CURRENT_CONFIG_VERSION, PRE_RRS_CONFIG_VERSION, RRS_CONFIG_VERSION, EXCLUDED_ALGORITHM_IDS, } from './defaultConfig';
|
|
@@ -70,6 +70,8 @@ export declare class RecommendationBlockControl extends CommonControl {
|
|
|
70
70
|
* state was rebuilt with (SD-150347).
|
|
71
71
|
*/
|
|
72
72
|
private _syncNodeConfigIfChanged;
|
|
73
|
+
/** Whether the deferred write would move the node's strategyId — see the caller (SD-149916). */
|
|
74
|
+
private _isPendingStrategyIdChange;
|
|
73
75
|
private _capturePendingNodeConfigWrite;
|
|
74
76
|
/**
|
|
75
77
|
* Accumulates the pending write into `documentModifier` without applying, so the
|
|
@@ -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 onboardingStore;
|
|
5
6
|
private storeUnsubscription;
|
|
6
7
|
private listeners;
|
|
7
8
|
private lastPaintedState;
|
|
@@ -9,6 +10,14 @@ export declare class StrategyControl extends CommonControl {
|
|
|
9
10
|
getTemplate(): string;
|
|
10
11
|
private _strategyAction;
|
|
11
12
|
onRender(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the document itself says this block has no strategy.
|
|
15
|
+
*
|
|
16
|
+
* Read the node, not the store: when the main control cannot resolve the block id off the
|
|
17
|
+
* node it never syncs the persisted config, so the store still holds defaults (empty
|
|
18
|
+
* strategyId) for an assigned block.
|
|
19
|
+
*/
|
|
20
|
+
private _isNodeUnassigned;
|
|
12
21
|
onDestroy(): void;
|
|
13
22
|
private _teardown;
|
|
14
23
|
private _setupButtonListeners;
|
|
@@ -107,7 +107,7 @@ export interface RegenerateWithStylesOptions extends Omit<RegenerateProductRowsO
|
|
|
107
107
|
* HTML removes the need for any post-rebuild reapply pass.
|
|
108
108
|
* @param options - Configuration options for regeneration
|
|
109
109
|
*/
|
|
110
|
-
export declare function regenerateProductRowsWithStyles(options: RegenerateWithStylesOptions):
|
|
110
|
+
export declare function regenerateProductRowsWithStyles(options: RegenerateWithStylesOptions): boolean;
|
|
111
111
|
/**
|
|
112
112
|
* Adjusts a products array to a target size.
|
|
113
113
|
* Used by ProductLayoutControl to synchronously match products to the new size
|
|
@@ -151,6 +151,11 @@ export interface UpdateProductContentInPlaceOptions {
|
|
|
151
151
|
currentNode: ImmutableHtmlNode | null | undefined;
|
|
152
152
|
documentModifier: DocumentModifier;
|
|
153
153
|
products: RecommendationProduct[];
|
|
154
|
+
/**
|
|
155
|
+
* Called when the batch was actually committed. Identical products commit nothing, which
|
|
156
|
+
* leaves anything a caller staged into the same batch unwritten unless it applies itself.
|
|
157
|
+
*/
|
|
158
|
+
onApplied?: () => void;
|
|
154
159
|
}
|
|
155
160
|
/**
|
|
156
161
|
* Updates product content in-place without regenerating HTML structure.
|
|
@@ -161,7 +166,7 @@ export interface UpdateProductContentInPlaceOptions {
|
|
|
161
166
|
* After updating desktop, also updates mobile container to keep them in sync.
|
|
162
167
|
*
|
|
163
168
|
* Falls back to false when product count changed (need to add/remove elements).
|
|
164
|
-
* @param options - Configuration options
|
|
169
|
+
* @param options - Configuration options; `onApplied` fires only when a batch was committed
|
|
165
170
|
* @returns true if in-place update was successful, false to fall back to full regeneration
|
|
166
171
|
*/
|
|
167
172
|
export declare function updateProductContentInPlace(options: UpdateProductContentInPlaceOptions): boolean;
|
|
@@ -83,8 +83,11 @@ interface StoreState {
|
|
|
83
83
|
strategies: RrsStrategy[];
|
|
84
84
|
strategiesLoading: boolean;
|
|
85
85
|
strategyUrlTemplates: Record<string, string>;
|
|
86
|
+
strategiesFetched: boolean;
|
|
87
|
+
strategiesSettled: boolean;
|
|
86
88
|
blockStates: Record<number, PerBlockState>;
|
|
87
89
|
currentRecommendationId: number | null;
|
|
90
|
+
strategyPanelOpen: boolean;
|
|
88
91
|
configVersion: number;
|
|
89
92
|
}
|
|
90
93
|
export declare const useRecommendationExtensionStore: import("pinia").StoreDefinition<"guidoRecommendationExtension", StoreState, {
|
|
@@ -111,8 +114,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
111
114
|
}[];
|
|
112
115
|
strategiesLoading: boolean;
|
|
113
116
|
strategyUrlTemplates: Record<string, string>;
|
|
117
|
+
strategiesFetched: boolean;
|
|
118
|
+
strategiesSettled: boolean;
|
|
114
119
|
blockStates: Record<number, PerBlockState>;
|
|
115
120
|
currentRecommendationId: number | null;
|
|
121
|
+
strategyPanelOpen: boolean;
|
|
116
122
|
configVersion: number;
|
|
117
123
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): PerBlockConfigs;
|
|
118
124
|
/**
|
|
@@ -137,8 +143,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
137
143
|
}[];
|
|
138
144
|
strategiesLoading: boolean;
|
|
139
145
|
strategyUrlTemplates: Record<string, string>;
|
|
146
|
+
strategiesFetched: boolean;
|
|
147
|
+
strategiesSettled: boolean;
|
|
140
148
|
blockStates: Record<number, PerBlockState>;
|
|
141
149
|
currentRecommendationId: number | null;
|
|
150
|
+
strategyPanelOpen: boolean;
|
|
142
151
|
configVersion: number;
|
|
143
152
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): RecommendationProduct[];
|
|
144
153
|
/**
|
|
@@ -163,8 +172,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
163
172
|
}[];
|
|
164
173
|
strategiesLoading: boolean;
|
|
165
174
|
strategyUrlTemplates: Record<string, string>;
|
|
175
|
+
strategiesFetched: boolean;
|
|
176
|
+
strategiesSettled: boolean;
|
|
166
177
|
blockStates: Record<number, PerBlockState>;
|
|
167
178
|
currentRecommendationId: number | null;
|
|
179
|
+
strategyPanelOpen: boolean;
|
|
168
180
|
configVersion: number;
|
|
169
181
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
170
182
|
assignStrategyDrawerStatus(state: {
|
|
@@ -186,8 +198,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
186
198
|
}[];
|
|
187
199
|
strategiesLoading: boolean;
|
|
188
200
|
strategyUrlTemplates: Record<string, string>;
|
|
201
|
+
strategiesFetched: boolean;
|
|
202
|
+
strategiesSettled: boolean;
|
|
189
203
|
blockStates: Record<number, PerBlockState>;
|
|
190
204
|
currentRecommendationId: number | null;
|
|
205
|
+
strategyPanelOpen: boolean;
|
|
191
206
|
configVersion: number;
|
|
192
207
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
193
208
|
removeStrategyModalStatus(state: {
|
|
@@ -209,8 +224,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
209
224
|
}[];
|
|
210
225
|
strategiesLoading: boolean;
|
|
211
226
|
strategyUrlTemplates: Record<string, string>;
|
|
227
|
+
strategiesFetched: boolean;
|
|
228
|
+
strategiesSettled: boolean;
|
|
212
229
|
blockStates: Record<number, PerBlockState>;
|
|
213
230
|
currentRecommendationId: number | null;
|
|
231
|
+
strategyPanelOpen: boolean;
|
|
214
232
|
configVersion: number;
|
|
215
233
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
216
234
|
assignedStrategy(state: {
|
|
@@ -232,8 +250,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
232
250
|
}[];
|
|
233
251
|
strategiesLoading: boolean;
|
|
234
252
|
strategyUrlTemplates: Record<string, string>;
|
|
253
|
+
strategiesFetched: boolean;
|
|
254
|
+
strategiesSettled: boolean;
|
|
235
255
|
blockStates: Record<number, PerBlockState>;
|
|
236
256
|
currentRecommendationId: number | null;
|
|
257
|
+
strategyPanelOpen: boolean;
|
|
237
258
|
configVersion: number;
|
|
238
259
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): RrsStrategy | null;
|
|
239
260
|
/**
|
|
@@ -258,8 +279,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
258
279
|
}[];
|
|
259
280
|
strategiesLoading: boolean;
|
|
260
281
|
strategyUrlTemplates: Record<string, string>;
|
|
282
|
+
strategiesFetched: boolean;
|
|
283
|
+
strategiesSettled: boolean;
|
|
261
284
|
blockStates: Record<number, PerBlockState>;
|
|
262
285
|
currentRecommendationId: number | null;
|
|
286
|
+
strategyPanelOpen: boolean;
|
|
263
287
|
configVersion: number;
|
|
264
288
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
|
|
265
289
|
/**
|
|
@@ -284,8 +308,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
284
308
|
}[];
|
|
285
309
|
strategiesLoading: boolean;
|
|
286
310
|
strategyUrlTemplates: Record<string, string>;
|
|
311
|
+
strategiesFetched: boolean;
|
|
312
|
+
strategiesSettled: boolean;
|
|
287
313
|
blockStates: Record<number, PerBlockState>;
|
|
288
314
|
currentRecommendationId: number | null;
|
|
315
|
+
strategyPanelOpen: boolean;
|
|
289
316
|
configVersion: number;
|
|
290
317
|
} & import("pinia").PiniaCustomStateProperties<StoreState>): number;
|
|
291
318
|
hasFilters(): boolean;
|
|
@@ -311,8 +338,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
311
338
|
}[];
|
|
312
339
|
strategiesLoading: boolean;
|
|
313
340
|
strategyUrlTemplates: Record<string, string>;
|
|
341
|
+
strategiesFetched: boolean;
|
|
342
|
+
strategiesSettled: boolean;
|
|
314
343
|
blockStates: Record<number, PerBlockState>;
|
|
315
344
|
currentRecommendationId: number | null;
|
|
345
|
+
strategyPanelOpen: boolean;
|
|
316
346
|
configVersion: number;
|
|
317
347
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => {
|
|
318
348
|
text: string;
|
|
@@ -337,8 +367,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
337
367
|
}[];
|
|
338
368
|
strategiesLoading: boolean;
|
|
339
369
|
strategyUrlTemplates: Record<string, string>;
|
|
370
|
+
strategiesFetched: boolean;
|
|
371
|
+
strategiesSettled: boolean;
|
|
340
372
|
blockStates: Record<number, PerBlockState>;
|
|
341
373
|
currentRecommendationId: number | null;
|
|
374
|
+
strategyPanelOpen: boolean;
|
|
342
375
|
configVersion: number;
|
|
343
376
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => {
|
|
344
377
|
text: string;
|
|
@@ -363,8 +396,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
363
396
|
}[];
|
|
364
397
|
strategiesLoading: boolean;
|
|
365
398
|
strategyUrlTemplates: Record<string, string>;
|
|
399
|
+
strategiesFetched: boolean;
|
|
400
|
+
strategiesSettled: boolean;
|
|
366
401
|
blockStates: Record<number, PerBlockState>;
|
|
367
402
|
currentRecommendationId: number | null;
|
|
403
|
+
strategyPanelOpen: boolean;
|
|
368
404
|
configVersion: number;
|
|
369
405
|
} & import("pinia").PiniaCustomStateProperties<StoreState>) => {
|
|
370
406
|
text: string;
|
|
@@ -445,6 +481,40 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
445
481
|
openRemoveStrategyModal(): void;
|
|
446
482
|
closeRemoveStrategyModal(): void;
|
|
447
483
|
fetchStrategies(): Promise<void>;
|
|
484
|
+
invalidateStrategies(): void;
|
|
485
|
+
/**
|
|
486
|
+
* Opens a Smart Recommender strategy page in a new tab and refreshes the list every time
|
|
487
|
+
* the user comes back. `visibilitychange` only: a `focus` listener would also fire when
|
|
488
|
+
* focus merely returns from the Stripo canvas iframe to the panel, refetching and
|
|
489
|
+
* regenerating the canvas while the user never left the editor (SD-149916).
|
|
490
|
+
*
|
|
491
|
+
* Deliberately NOT one-shot: the strategy tab stays open, so a user can create a second
|
|
492
|
+
* strategy in it and come back again — a listener that disarmed on the first return would
|
|
493
|
+
* leave that one missing from the list. It disarms on the first return AFTER that tab is
|
|
494
|
+
* closed instead, so an ordinary alt-tab later in the session costs nothing. Armed only
|
|
495
|
+
* once the user actually opens a strategy page, so anyone who never does pays nothing.
|
|
496
|
+
*/
|
|
497
|
+
_armStrategyPageReturn(url: string): void;
|
|
498
|
+
/**
|
|
499
|
+
* Reloads the products of the block the user is on, so an edit made in the strategy tab
|
|
500
|
+
* lands on the canvas instead of waiting for the assign drawer to be reopened.
|
|
501
|
+
*
|
|
502
|
+
* Only the selected block: the canvas regeneration is driven off the active block's
|
|
503
|
+
* product array, so refreshing an unselected block would fetch without redrawing it.
|
|
504
|
+
*/
|
|
505
|
+
_refreshAssignedStrategyProducts(): Promise<void>;
|
|
506
|
+
/** Lets the editor tear the return listeners down when it unmounts. */
|
|
507
|
+
disposeStrategyPageReturn(): void;
|
|
508
|
+
/**
|
|
509
|
+
* Opens Smart Recommender's strategy creation page. Every return refreshes the list so the
|
|
510
|
+
* new strategy is offered; the user picks it themselves.
|
|
511
|
+
*/
|
|
512
|
+
openStrategyCreation(): void;
|
|
513
|
+
/**
|
|
514
|
+
* Opens the strategy's edit page. Every return refreshes the list so the block reflects the
|
|
515
|
+
* edited configuration.
|
|
516
|
+
*/
|
|
517
|
+
openStrategyEdit(strategyId: string | number): void;
|
|
448
518
|
resolveStrategyUrlTemplate(strategy: RrsStrategy, currency: string): Promise<string>;
|
|
449
519
|
assignStrategy(strategy: RrsStrategy): void;
|
|
450
520
|
removeStrategy(): void;
|
|
@@ -462,6 +532,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
|
|
|
462
532
|
* every block's recommendationConfigs across user edits.
|
|
463
533
|
*/
|
|
464
534
|
hasInvalidBlock(): boolean;
|
|
535
|
+
/**
|
|
536
|
+
* Which required fields are missing across the design's blocks, so the save
|
|
537
|
+
* toaster can name the cause instead of always showing the generic message.
|
|
538
|
+
*/
|
|
539
|
+
invalidBlockFields(): string[];
|
|
465
540
|
fetchRecommendationProducts(): Promise<void>;
|
|
466
541
|
_doFetchProducts(): Promise<void>;
|
|
467
542
|
_doFetchStrategyProducts(blockId: number): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Writes a strategy change and its products straight to the document, without the settings panel.
|
|
3
|
+
*
|
|
4
|
+
* Every entry point is host-rendered UI outside `ui-editor`, and none of them can rely on the
|
|
5
|
+
* panel control: opening the strategy page deselects the block, so by the time the user comes back
|
|
6
|
+
* and presses Assign the control — and with it the subscription that does the node write, the
|
|
7
|
+
* product fetch and the repaint — is gone. The assignment then reaches Pinia and nothing else
|
|
8
|
+
* (SD-149916).
|
|
9
|
+
*
|
|
10
|
+
* Call AFTER the store change (`assignStrategy` / `removeStrategy`).
|
|
11
|
+
* @param description - labels the undo entry
|
|
12
|
+
* @returns whether the write reached a node
|
|
13
|
+
*/
|
|
14
|
+
export declare function commitStrategyChange(blockId: number, description: string): Promise<boolean>;
|
|
@@ -15,7 +15,11 @@ export interface RequiredField {
|
|
|
15
15
|
getAvailableOptions?: (store: ExtensionStoreSlice) => string[];
|
|
16
16
|
condition?: (config: PerBlockConfigs) => boolean;
|
|
17
17
|
}
|
|
18
|
+
/** Field key of the strategy/algorithm descriptor, used to pick the toaster message. */
|
|
19
|
+
export declare const STRATEGY_FIELD_KEY = "strategy";
|
|
18
20
|
export declare const REQUIRED_RECOMMENDATION_FIELDS: RequiredField[];
|
|
19
21
|
export declare const RecommendationRequiredFieldsKey = "newsletter.recommendation-fill-required-fields";
|
|
22
|
+
/** Shown instead of the generic message when the only thing missing is the strategy. */
|
|
23
|
+
export declare const RecommendationAssignStrategyKey = "newsletter.recommendation-assign-strategy";
|
|
20
24
|
export declare function getInvalidFields(config: PerBlockConfigs, store: ExtensionStoreSlice, fields?: RequiredField[]): string[];
|
|
21
25
|
export declare function isConfigValid(config: PerBlockConfigs, store: ExtensionStoreSlice): boolean;
|