@useinsider/guido 3.18.1-beta.280b4e1 → 3.18.1-beta.2e195ed

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 (36) 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 +65 -53
  5. package/dist/components/organisms/onboarding/OnboardingWrapper.vue2.js +20 -18
  6. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.js +21 -0
  7. package/dist/components/organisms/onboarding/RecommendationStrategyOnboarding.vue2.js +47 -0
  8. package/dist/composables/useCustomInterfaceAppearance.js +56 -48
  9. package/dist/composables/useHtmlValidator.js +84 -79
  10. package/dist/composables/useRecommendation.js +21 -18
  11. package/dist/composables/useStripo.js +30 -30
  12. package/dist/enums/extensions/recommendationBlock.js +38 -31
  13. package/dist/extensions/Blocks/Recommendation/block.js +43 -39
  14. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +62 -57
  15. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +84 -52
  16. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +165 -78
  17. package/dist/extensions/Blocks/Recommendation/validation/requiredFields.js +21 -12
  18. package/dist/guido.css +1 -1
  19. package/dist/library.js +13 -15
  20. package/dist/src/components/organisms/onboarding/RecommendationStrategyOnboarding.vue.d.ts +2 -0
  21. package/dist/src/enums/extensions/recommendationBlock.d.ts +2 -0
  22. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +2 -0
  23. package/dist/src/extensions/Blocks/Recommendation/controls/main/strategy.d.ts +9 -0
  24. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +74 -0
  25. package/dist/src/extensions/Blocks/Recommendation/validation/requiredFields.d.ts +4 -0
  26. package/dist/src/library.d.ts +0 -2
  27. package/dist/src/public/trackingIds.d.ts +2 -6
  28. package/dist/src/stores/guido-email-editor.d.ts +27 -27
  29. package/dist/src/stores/onboarding.d.ts +377 -0
  30. package/dist/static/styles/components/recommendation-strategy.css.js +51 -4
  31. package/dist/stores/guido-email-editor.js +4 -0
  32. package/dist/stores/onboarding.js +41 -36
  33. package/dist/utils/templatePreparation.js +50 -50
  34. package/package.json +1 -5
  35. package/dist/public/editorState.js +0 -4
  36. package/dist/src/public/editorState.d.ts +0 -14
@@ -71,8 +71,11 @@ interface StoreState {
71
71
  strategies: RrsStrategy[];
72
72
  strategiesLoading: boolean;
73
73
  strategyUrlTemplates: Record<string, string>;
74
+ strategiesFetched: boolean;
75
+ strategiesSettled: boolean;
74
76
  blockStates: Record<number, PerBlockState>;
75
77
  currentRecommendationId: number | null;
78
+ strategyPanelOpen: boolean;
76
79
  configVersion: number;
77
80
  }
78
81
  export declare const useRecommendationExtensionStore: import("pinia").StoreDefinition<"guidoRecommendationExtension", StoreState, {
@@ -99,8 +102,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
99
102
  }[];
100
103
  strategiesLoading: boolean;
101
104
  strategyUrlTemplates: Record<string, string>;
105
+ strategiesFetched: boolean;
106
+ strategiesSettled: boolean;
102
107
  blockStates: Record<number, PerBlockState>;
103
108
  currentRecommendationId: number | null;
109
+ strategyPanelOpen: boolean;
104
110
  configVersion: number;
105
111
  } & import("pinia").PiniaCustomStateProperties<StoreState>): PerBlockConfigs;
106
112
  /**
@@ -125,8 +131,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
125
131
  }[];
126
132
  strategiesLoading: boolean;
127
133
  strategyUrlTemplates: Record<string, string>;
134
+ strategiesFetched: boolean;
135
+ strategiesSettled: boolean;
128
136
  blockStates: Record<number, PerBlockState>;
129
137
  currentRecommendationId: number | null;
138
+ strategyPanelOpen: boolean;
130
139
  configVersion: number;
131
140
  } & import("pinia").PiniaCustomStateProperties<StoreState>): RecommendationProduct[];
132
141
  /**
@@ -151,8 +160,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
151
160
  }[];
152
161
  strategiesLoading: boolean;
153
162
  strategyUrlTemplates: Record<string, string>;
163
+ strategiesFetched: boolean;
164
+ strategiesSettled: boolean;
154
165
  blockStates: Record<number, PerBlockState>;
155
166
  currentRecommendationId: number | null;
167
+ strategyPanelOpen: boolean;
156
168
  configVersion: number;
157
169
  } & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
158
170
  assignStrategyDrawerStatus(state: {
@@ -174,8 +186,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
174
186
  }[];
175
187
  strategiesLoading: boolean;
176
188
  strategyUrlTemplates: Record<string, string>;
189
+ strategiesFetched: boolean;
190
+ strategiesSettled: boolean;
177
191
  blockStates: Record<number, PerBlockState>;
178
192
  currentRecommendationId: number | null;
193
+ strategyPanelOpen: boolean;
179
194
  configVersion: number;
180
195
  } & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
181
196
  removeStrategyModalStatus(state: {
@@ -197,8 +212,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
197
212
  }[];
198
213
  strategiesLoading: boolean;
199
214
  strategyUrlTemplates: Record<string, string>;
215
+ strategiesFetched: boolean;
216
+ strategiesSettled: boolean;
200
217
  blockStates: Record<number, PerBlockState>;
201
218
  currentRecommendationId: number | null;
219
+ strategyPanelOpen: boolean;
202
220
  configVersion: number;
203
221
  } & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
204
222
  assignedStrategy(state: {
@@ -220,8 +238,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
220
238
  }[];
221
239
  strategiesLoading: boolean;
222
240
  strategyUrlTemplates: Record<string, string>;
241
+ strategiesFetched: boolean;
242
+ strategiesSettled: boolean;
223
243
  blockStates: Record<number, PerBlockState>;
224
244
  currentRecommendationId: number | null;
245
+ strategyPanelOpen: boolean;
225
246
  configVersion: number;
226
247
  } & import("pinia").PiniaCustomStateProperties<StoreState>): RrsStrategy | null;
227
248
  /**
@@ -246,8 +267,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
246
267
  }[];
247
268
  strategiesLoading: boolean;
248
269
  strategyUrlTemplates: Record<string, string>;
270
+ strategiesFetched: boolean;
271
+ strategiesSettled: boolean;
249
272
  blockStates: Record<number, PerBlockState>;
250
273
  currentRecommendationId: number | null;
274
+ strategyPanelOpen: boolean;
251
275
  configVersion: number;
252
276
  } & import("pinia").PiniaCustomStateProperties<StoreState>): boolean;
253
277
  /**
@@ -272,8 +296,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
272
296
  }[];
273
297
  strategiesLoading: boolean;
274
298
  strategyUrlTemplates: Record<string, string>;
299
+ strategiesFetched: boolean;
300
+ strategiesSettled: boolean;
275
301
  blockStates: Record<number, PerBlockState>;
276
302
  currentRecommendationId: number | null;
303
+ strategyPanelOpen: boolean;
277
304
  configVersion: number;
278
305
  } & import("pinia").PiniaCustomStateProperties<StoreState>): number;
279
306
  hasFilters(): boolean;
@@ -299,8 +326,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
299
326
  }[];
300
327
  strategiesLoading: boolean;
301
328
  strategyUrlTemplates: Record<string, string>;
329
+ strategiesFetched: boolean;
330
+ strategiesSettled: boolean;
302
331
  blockStates: Record<number, PerBlockState>;
303
332
  currentRecommendationId: number | null;
333
+ strategyPanelOpen: boolean;
304
334
  configVersion: number;
305
335
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
306
336
  text: string;
@@ -325,8 +355,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
325
355
  }[];
326
356
  strategiesLoading: boolean;
327
357
  strategyUrlTemplates: Record<string, string>;
358
+ strategiesFetched: boolean;
359
+ strategiesSettled: boolean;
328
360
  blockStates: Record<number, PerBlockState>;
329
361
  currentRecommendationId: number | null;
362
+ strategyPanelOpen: boolean;
330
363
  configVersion: number;
331
364
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
332
365
  text: string;
@@ -351,8 +384,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
351
384
  }[];
352
385
  strategiesLoading: boolean;
353
386
  strategyUrlTemplates: Record<string, string>;
387
+ strategiesFetched: boolean;
388
+ strategiesSettled: boolean;
354
389
  blockStates: Record<number, PerBlockState>;
355
390
  currentRecommendationId: number | null;
391
+ strategyPanelOpen: boolean;
356
392
  configVersion: number;
357
393
  } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
358
394
  text: string;
@@ -433,6 +469,39 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
433
469
  openRemoveStrategyModal(): void;
434
470
  closeRemoveStrategyModal(): void;
435
471
  fetchStrategies(): Promise<void>;
472
+ invalidateStrategies(): void;
473
+ /**
474
+ * Opens a Smart Recommender strategy page in a new tab and refreshes the list every time
475
+ * the user comes back. `visibilitychange` covers the tab case; `focus` covers the page
476
+ * landing in a separate window, where this document never goes hidden.
477
+ *
478
+ * Deliberately NOT one-shot: the strategy tab stays open, so a user can create a second
479
+ * strategy in it and come back again — a listener that disarmed on the first return would
480
+ * leave that one missing from the list. It disarms on the first return AFTER that tab is
481
+ * closed instead, so an ordinary alt-tab later in the session costs nothing. Armed only
482
+ * once the user actually opens a strategy page, so anyone who never does pays nothing.
483
+ */
484
+ _armStrategyPageReturn(url: string): void;
485
+ /**
486
+ * Reloads the products of the block the user is on, so an edit made in the strategy tab
487
+ * lands on the canvas instead of waiting for the assign drawer to be reopened.
488
+ *
489
+ * Only the selected block: the canvas regeneration is driven off the active block's
490
+ * product array, so refreshing an unselected block would fetch without redrawing it.
491
+ */
492
+ _refreshAssignedStrategyProducts(): Promise<void>;
493
+ /** Lets the editor tear the return listeners down when it unmounts. */
494
+ disposeStrategyPageReturn(): void;
495
+ /**
496
+ * Opens Smart Recommender's strategy creation page. Every return refreshes the list so the
497
+ * new strategy is offered; the user picks it themselves.
498
+ */
499
+ openStrategyCreation(): void;
500
+ /**
501
+ * Opens the strategy's edit page. Every return refreshes the list so the block reflects the
502
+ * edited configuration.
503
+ */
504
+ openStrategyEdit(strategyId: string | number): void;
436
505
  resolveStrategyUrlTemplate(strategy: RrsStrategy, currency: string): Promise<string>;
437
506
  assignStrategy(strategy: RrsStrategy): void;
438
507
  removeStrategy(): void;
@@ -450,6 +519,11 @@ export declare const useRecommendationExtensionStore: import("pinia").StoreDefin
450
519
  * every block's recommendationConfigs across user edits.
451
520
  */
452
521
  hasInvalidBlock(): boolean;
522
+ /**
523
+ * Which required fields are missing across the design's blocks, so the save
524
+ * toaster can name the cause instead of always showing the generic message.
525
+ */
526
+ invalidBlockFields(): string[];
453
527
  fetchRecommendationProducts(): Promise<void>;
454
528
  _doFetchProducts(): Promise<void>;
455
529
  _doFetchStrategyProducts(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;
@@ -2,7 +2,5 @@ export { default as Guido } from './components/Guido.vue';
2
2
  export type { GuidoConfig, GuidoConfigInput, IdentityConfig, PartnerConfig, TemplateConfig, TemplateMigrationConfig, LegacyRecommendationConfig, EditorConfig, UIConfig, FeaturesConfig, BlocksConfig, CompilerConfig, DynamicContent, EmailHeader, DefaultBlockType, CustomBlockType, ValidationResult, ValidationError, } from './@types/config';
3
3
  export { validateConfig, parseConfig, parseConfigSafe, isValidConfig, getValidationErrors, MessageType, ProductType, } from './@types/config';
4
4
  export { assignTrackingIds, readTrackFloor, readTrackSeq } from './public/trackingIds';
5
- export { useGuidoEmailEditorStore } from './public/editorState';
6
- export type { GuidoEmailEditorState } from './public/editorState';
7
5
  export type { StripoEventType } from './@types/events';
8
6
  export type { PositionData, DynamicContentEvent, MergeTagClickEvent, MergeTag, BaseDynamicContent, DynamicContentNode, DynamicContentList, TooltipOptions, TextValueObject, L10n, } from './@types/generic';
@@ -4,10 +4,6 @@
4
4
  * Importing from here pulls in nothing else, so the editor never enters a
5
5
  * consumer's module graph. Re-export surface only: this is the contract,
6
6
  * `utils/linkTrackingIds` is the implementation and stays free to move.
7
- *
8
- * Relative, not the `@@/Utils/` alias: vue-tsc copies the specifier into the emitted
9
- * .d.ts verbatim, and a consumer's TypeScript cannot resolve our alias table. A relative
10
- * path resolves against dist/src/, so the published types actually load.
11
7
  */
12
- export { assignTrackingIds, readTrackFloor, readTrackSeq, TRACK_ID_ATTRIBUTE, TRACK_SEQ_ATTRIBUTE, } from '../utils/linkTrackingIds';
13
- export type { TrackingIdResult } from '../utils/linkTrackingIds';
8
+ export { assignTrackingIds, readTrackFloor, readTrackSeq, TRACK_ID_ATTRIBUTE, TRACK_SEQ_ATTRIBUTE, } from '@@/Utils/linkTrackingIds';
9
+ export type { TrackingIdResult } from '@@/Utils/linkTrackingIds';
@@ -1,41 +1,41 @@
1
- /** The published editor snapshot — the shape a consumer reads off the shared store. */
2
- export interface GuidoEmailEditorState {
1
+ /**
2
+ * Outbound contract Guido publishes to the host's shared Pinia singleton so
3
+ * cortex-fe can pick up the current editor state and forward it as
4
+ * `clientState.editor` on the next chat-stream POST.
5
+ *
6
+ * State + getters only — `useGuidoStateBridge` writes via `$patch`, no actions
7
+ * live here (architecture invariant).
8
+ *
9
+ * Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it via
10
+ * `pinia._s.get('guidoEmailEditor')` at runtime. The internal Guido editor
11
+ * store keeps id `guidoEditor` — these are intentionally separate. The
12
+ * internal store carries UI state that cortex-fe should not see; this public
13
+ * store carries the contract Guido is willing to share.
14
+ */
15
+ export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", {
3
16
  /** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
4
17
  html: string;
5
18
  /** Current Stripo CSS — es-p* utility classes used by the html. */
6
19
  css: string;
7
20
  /** Wall-clock ms when html/css were last written by the bridge. */
8
21
  lastUpdatedAt: number;
9
- /** Template id from the editor config, so a consumer can scope per-template. */
22
+ /** Template id from the editor config, for cortex-fe to scope per-template. */
10
23
  templateId: string;
11
- }
12
- /**
13
- * Outbound contract Guido publishes to the host's shared Pinia singleton so a
14
- * consumer can read the current editor state: cortex-fe forwards it as
15
- * `clientState.editor` on the next chat-stream POST, email-fe scans it for the
16
- * Array of Objects lock.
17
- *
18
- * Published as `@useinsider/guido/editor-state` and from the root barrel, so a
19
- * consumer imports this store instead of re-declaring one under the same id.
20
- *
21
- * State + getters only, no actions. `useGuidoStateBridge` is the only intended
22
- * writer, but that is Guido's own convention rather than something the store
23
- * enforces: publishing the definition hands a consumer `$patch` as well, exactly
24
- * as the runtime `pinia._s` probe always did.
25
- *
26
- * Store id `guidoEmailEditor` is cross-MFE: cortex-fe reads it via
27
- * `pinia._s.get('guidoEmailEditor')` at runtime rather than importing it, so the
28
- * id stays part of the contract. The internal Guido editor store keeps id
29
- * `guidoEditor` — these are intentionally separate. The internal store carries
30
- * UI state a consumer should not see; this public store carries the contract
31
- * Guido is willing to share.
32
- */
33
- export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", GuidoEmailEditorState, {
24
+ }, {
34
25
  /** True once the bridge has published at least one snapshot. */
35
26
  hasSnapshot: (state: {
36
27
  html: string;
37
28
  css: string;
38
29
  lastUpdatedAt: number;
39
30
  templateId: string;
40
- } & import("pinia").PiniaCustomStateProperties<GuidoEmailEditorState>) => boolean;
31
+ } & import("pinia").PiniaCustomStateProperties<{
32
+ /** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
33
+ html: string;
34
+ /** Current Stripo CSS — es-p* utility classes used by the html. */
35
+ css: string;
36
+ /** Wall-clock ms when html/css were last written by the bridge. */
37
+ lastUpdatedAt: number;
38
+ /** Template id from the editor config, for cortex-fe to scope per-template. */
39
+ templateId: string;
40
+ }>) => boolean;
41
41
  }, {}>;