@useinsider/guido 3.18.2-beta.8ef3138 → 3.18.2-beta.ec25841

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.
Files changed (41) hide show
  1. package/dist/components/Guido.vue.js +3 -3
  2. package/dist/components/Guido.vue2.js +30 -30
  3. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue.js +13 -11
  4. package/dist/components/organisms/extensions/recommendation/AssignStrategyDrawer.vue2.js +70 -52
  5. package/dist/components/organisms/extensions/recommendation/RemoveStrategyModal.vue2.js +23 -37
  6. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  7. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  8. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  9. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  10. package/dist/composables/useCustomInterfaceAppearance.js +56 -46
  11. package/dist/composables/useHtmlValidator.js +84 -79
  12. package/dist/composables/useHttp.js +22 -24
  13. package/dist/composables/useRecommendation.js +40 -35
  14. package/dist/composables/useStripo.js +30 -30
  15. package/dist/enums/extensions/recommendationBlock.js +38 -31
  16. package/dist/extensions/Blocks/Recommendation/block.js +43 -39
  17. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +21 -20
  18. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +38 -33
  19. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
  20. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +176 -79
  21. package/dist/extensions/Blocks/Recommendation/utils/strategyDetach.js +19 -0
  22. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  23. package/dist/guido.css +1 -1
  24. package/dist/services/templateLibraryApi.js +14 -17
  25. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  26. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  27. package/dist/src/extensions/Blocks/Recommendation/constants/defaultConfig.d.ts +1 -0
  28. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  29. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  30. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
  31. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +75 -0
  32. package/dist/src/extensions/Blocks/Recommendation/utils/strategyDetach.d.ts +12 -0
  33. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  34. package/dist/src/stores/onboarding.d.ts +377 -0
  35. package/dist/src/utils/genericUtil.d.ts +0 -6
  36. package/dist/static/styles/components/recommendation-strategy.css.js +34 -4
  37. package/dist/static/styles/components/skeleton.css.js +23 -0
  38. package/dist/stores/onboarding.js +41 -36
  39. package/dist/utils/genericUtil.js +39 -45
  40. package/dist/utils/templatePreparation.js +59 -60
  41. package/package.json +1 -1
@@ -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;
@@ -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,12 @@
1
+ /**
2
+ * Repaints a block whose strategy assignment was just cleared, straight to the document.
3
+ *
4
+ * Both callers are host-rendered UI outside `ui-editor`, so neither can leave this to the
5
+ * settings panel: the remove modal's click deselects the block and destroys the control, and
6
+ * the edit button opens the strategy page in the same gesture, so the panel's 500 ms debounced
7
+ * refetch races a tab that is already gone. Either way the canvas kept the old strategy's
8
+ * products while the block read as unassigned (SD-149916).
9
+ *
10
+ * Call AFTER the store assignment is cleared (`removeStrategy`).
11
+ */
12
+ export declare function commitStrategyDetach(blockId: number): Promise<void>;
@@ -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;