@useinsider/guido 3.19.0-beta.8776c42 → 3.19.0-beta.892c3ca

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 (51) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +33 -31
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +87 -90
  5. package/dist/components/organisms/AutoSaveController.vue2.js +9 -8
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +90 -55
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  10. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  11. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +49 -0
  12. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  13. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  14. package/dist/composables/useCortexBlueprintBridge.js +54 -122
  15. package/dist/composables/useEmailTemplateApplier.js +50 -106
  16. package/dist/composables/useHtmlCompiler.js +37 -26
  17. package/dist/composables/useHtmlValidator.js +2 -0
  18. package/dist/composables/useSave.js +90 -45
  19. package/dist/composables/useSaveValidation.js +282 -0
  20. package/dist/composables/useSaveValidationRollout.js +9 -0
  21. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  22. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  23. package/dist/enums/save-validation.js +4 -0
  24. package/dist/guido.css +1 -1
  25. package/dist/src/@types/config/schemas.d.ts +4 -0
  26. package/dist/src/@types/save-validation.d.ts +19 -0
  27. package/dist/src/components/Guido.vue.d.ts +17 -1
  28. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  29. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  30. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  31. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  32. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  33. package/dist/src/composables/useConfig.d.ts +2 -0
  34. package/dist/src/composables/useCortexBlueprintBridge.d.ts +3 -2
  35. package/dist/src/composables/useEmailTemplateApplier.d.ts +5 -18
  36. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  37. package/dist/src/composables/useSave.d.ts +6 -1
  38. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  39. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  40. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  41. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  42. package/dist/src/enums/save-validation.d.ts +27 -0
  43. package/dist/src/stores/config.d.ts +32 -0
  44. package/dist/src/stores/guido-email-editor.d.ts +10 -20
  45. package/dist/src/stores/save-validation.d.ts +22 -0
  46. package/dist/src/utils/templatePreparation.d.ts +30 -0
  47. package/dist/stores/config.js +84 -67
  48. package/dist/stores/guido-email-editor.js +1 -3
  49. package/dist/stores/save-validation.js +30 -0
  50. package/dist/utils/templatePreparation.js +39 -36
  51. package/package.json +1 -1
@@ -1,16 +1,4 @@
1
1
  type ApplyStatus = 'pending' | 'applying' | 'applied' | 'failed';
2
- /**
3
- * Terminal outcome of an apply; every promise here settles with one, since the bridge acks on it.
4
- * `superseded`: a newer payload for the same key replaced this one and owns the ack.
5
- */
6
- export type ApplyOutcome = {
7
- status: 'applied';
8
- } | {
9
- status: 'failed';
10
- error: unknown;
11
- } | {
12
- status: 'superseded';
13
- };
14
2
  /**
15
3
  * Applies email_template blueprints from the chat agent to the Stripo editor.
16
4
  *
@@ -21,19 +9,18 @@ export type ApplyOutcome = {
21
9
  * - manual Apply click (first apply): immediate.
22
10
  * - blueprint_update after the user has applied once: debounced 250 ms trailing
23
11
  * so rapid mid-stream updates don't thrash updateHtmlAndCss.
24
- * - a click before Stripo is ready is queued and flushed when `isStripoInitialized` flips.
25
12
  */
26
13
  export declare const useEmailTemplateApplier: () => {
27
14
  applyStatus: import("vue").Ref<Record<string, ApplyStatus>>;
28
- markPending: (key: string) => void;
29
- applyTemplate: (key: string, data: {
15
+ markPending: (blueprintId: string) => void;
16
+ applyTemplate: (blueprintId: string, data: {
30
17
  html?: string;
31
18
  css?: string;
32
- }) => Promise<ApplyOutcome>;
33
- applyTemplateDebounced: (key: string, data: {
19
+ }) => void;
20
+ applyTemplateDebounced: (blueprintId: string, data: {
34
21
  html?: string;
35
22
  css?: string;
36
- }) => Promise<ApplyOutcome>;
23
+ }) => void;
37
24
  };
38
25
  export declare const resetEmailTemplateApplier: () => void;
39
26
  export {};
@@ -1,5 +1,12 @@
1
1
  import type { DynamicContent } from '@@/Types/generic';
2
2
  import type { FiltersResponse } from '@@/Types/recommendation';
3
+ /**
4
+ * Extracts recommendation block IDs directly from the HTML by parsing
5
+ * the recommendation-id attribute on block elements.
6
+ * This avoids depending on store state which may not be populated
7
+ * when the settings panel hasn't been opened yet (e.g., saved templates).
8
+ */
9
+ export declare function getRecommendationBlockIds(html: string): string[];
3
10
  /**
4
11
  * Parses a `{{recoId_index_attributeName}}` variable (already stripped of the
5
12
  * braces/whitespace) into its recommendation id and attribute name. Returns
@@ -27,6 +34,20 @@ export declare function buildPartnerAttributeNameSet(filterList: FiltersResponse
27
34
  * before, so flagging it would false-positive on merge tags like `{{user.name}}`.
28
35
  */
29
36
  export declare function findInvalidCustomFields(html: string, validCustomFields: string[], recommendationBlockIds: string[], ignoredIds: Set<string>, ignoredAttributeNames: Set<string> | null): string[];
37
+ /**
38
+ * Returns the invalid `{{ ... }}` dynamic-content tags found in the HTML.
39
+ *
40
+ * A tag's variable name is the part before the first `|` (everything after it is the fallback).
41
+ * Surrounding whitespace is always allowed (trimmed). A tag is valid only when the variable name
42
+ * is an allowed system token, or it is a clean identifier (`[A-Za-z0-9_.]`) and — when a `|` is
43
+ * present — the fallback after it is not empty. Otherwise the tag is invalid (e.g.
44
+ * `{{Api Response: OA1 Main Item Url}}` — spaces/`:` — or `{{bounce|}}` — empty fallback).
45
+ *
46
+ * `data-*` block-config attribute values are excluded from the scan: blocks such as Items/cart
47
+ * store product merge tags (`data-product_button_link="{{Abandoned Cart Item (1) Url}}"`) that the
48
+ * backend resolves through its own pipeline, so they must not be treated as user-authored tags.
49
+ */
50
+ export declare function getInvalidDynamicContentTags(html: string): string[];
30
51
  export declare const useHtmlValidator: () => {
31
52
  validateHtml: (html: string, customFields: DynamicContent[], isOnSaveValidation?: boolean) => Promise<boolean>;
32
53
  };
@@ -1,4 +1,9 @@
1
1
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
+ type SaveDetails = Omit<SavedTemplateDetails, 'metadata' | 'silent'>;
3
+ type SaveResult = SaveDetails | undefined;
2
4
  export declare const useSave: () => {
3
- save: (suppressEmit?: boolean, silent?: boolean) => Promise<Omit<SavedTemplateDetails, "metadata" | "silent"> | undefined>;
5
+ save: (suppressEmit?: boolean, silent?: boolean) => Promise<SaveResult>;
6
+ saveWithErrors: () => Promise<SaveResult>;
7
+ saveRawOnly: () => Promise<SaveResult>;
4
8
  };
9
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { DynamicContent } from '@@/Types/generic';
2
+ import type { SaveValidationError } from '@@/Types/save-validation';
3
+ export declare const useSaveValidation: () => {
4
+ collectSaveValidationErrors: (compiledHtml: string, dynamicContentList: DynamicContent[]) => Promise<SaveValidationError[]>;
5
+ validateCurrentTemplate: () => Promise<SaveValidationError[]>;
6
+ };
@@ -0,0 +1,3 @@
1
+ export declare const useSaveValidationRollout: () => {
2
+ isEnabled: import("vue").ComputedRef<boolean>;
3
+ };
@@ -1,3 +1,6 @@
1
+ export declare const COUPON_TAG_MODIFIED_KEY = "newsletter.coupon-tag-modified";
2
+ /** Pure core: the tag text of every coupon block whose code was modified. */
3
+ export declare function findInvalidCouponBlocks(html: string): string[];
1
4
  export declare const useCouponBlockValidator: () => {
2
5
  validateCouponBlockTags: (html: string) => boolean;
3
6
  };
@@ -1,4 +1,14 @@
1
+ declare const SINGLETON_BLOCK_RULES: {
2
+ pageType: number;
3
+ messageKey: string;
4
+ }[];
5
+ export declare const EMPTY_BLOCK_KEY = "unsubscription-preference.select-page-to-continue";
6
+ /** Pure core: the singleton rules whose page type appears more than once. */
7
+ export declare function findDuplicateUnsubPageTypes(html: string): typeof SINGLETON_BLOCK_RULES;
8
+ /** Pure core: count of unsubscribe blocks with no page type or page list chosen. */
9
+ export declare function countUnsubBlocksWithoutPage(html: string): number;
1
10
  export declare const useUnsubscribeBlockValidator: () => {
2
11
  validateUnsubscribeBlockUniqueness: (html: string) => boolean;
3
12
  validateUnsubscribeBlockHasTemplate: (html: string) => boolean;
4
13
  };
14
+ export {};
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Stable discriminators for each save-validation rule site — one per rule that
3
+ * can produce a drawer row, kept in sync with the collector + legacy validator chains.
4
+ */
5
+ export declare enum SaveValidationRule {
6
+ CouponTagModified = "coupon-tag-modified",
7
+ DuplicateUnsubBlock = "duplicate-unsub-block",
8
+ UnsubBlockMissingTemplate = "unsub-block-missing-template",
9
+ LiquidSyntax = "liquid-syntax",
10
+ InvalidLinks = "invalid-links",
11
+ LinkCheckInProgress = "link-check-in-progress",
12
+ CustomFieldScript = "custom-field-script",
13
+ EmptyHtml = "empty-html",
14
+ MismatchedBraces = "mismatched-braces",
15
+ InvalidDynamicTag = "invalid-dynamic-tag",
16
+ InvalidCustomField = "invalid-custom-field",
17
+ ConditionsSyntax = "conditions-syntax",
18
+ WrongEqualityOperator = "wrong-equality-operator",
19
+ MissingIfEndif = "missing-if-endif",
20
+ ConditionTagSpacing = "condition-tag-spacing",
21
+ BracesInsideIfTag = "braces-inside-if-tag",
22
+ RecommendationRequiredFields = "recommendation-required-fields",
23
+ RecommendationFilters = "recommendation-filters",
24
+ InvalidImageType = "invalid-image-type",
25
+ CheckboxUnsubGroup = "checkbox-unsub-group",
26
+ RadioButtonUnsubGroup = "radio-button-unsub-group"
27
+ }
@@ -106,6 +106,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
106
106
  autosave: boolean;
107
107
  allowlistEnabled: boolean;
108
108
  linkTrackingIds: boolean;
109
+ allowSaveWithErrors: boolean;
109
110
  reusableRecommendationStrategy: boolean;
110
111
  };
111
112
  blocks: {
@@ -249,6 +250,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
249
250
  autosave: boolean;
250
251
  allowlistEnabled: boolean;
251
252
  linkTrackingIds: boolean;
253
+ allowSaveWithErrors: boolean;
252
254
  reusableRecommendationStrategy: boolean;
253
255
  };
254
256
  blocks: {
@@ -392,6 +394,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
392
394
  autosave: boolean;
393
395
  allowlistEnabled: boolean;
394
396
  linkTrackingIds: boolean;
397
+ allowSaveWithErrors: boolean;
395
398
  reusableRecommendationStrategy: boolean;
396
399
  };
397
400
  blocks: {
@@ -535,6 +538,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
535
538
  autosave: boolean;
536
539
  allowlistEnabled: boolean;
537
540
  linkTrackingIds: boolean;
541
+ allowSaveWithErrors: boolean;
538
542
  reusableRecommendationStrategy: boolean;
539
543
  };
540
544
  blocks: {
@@ -678,6 +682,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
678
682
  autosave: boolean;
679
683
  allowlistEnabled: boolean;
680
684
  linkTrackingIds: boolean;
685
+ allowSaveWithErrors: boolean;
681
686
  reusableRecommendationStrategy: boolean;
682
687
  };
683
688
  blocks: {
@@ -821,6 +826,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
821
826
  autosave: boolean;
822
827
  allowlistEnabled: boolean;
823
828
  linkTrackingIds: boolean;
829
+ allowSaveWithErrors: boolean;
824
830
  reusableRecommendationStrategy: boolean;
825
831
  };
826
832
  blocks: {
@@ -964,6 +970,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
964
970
  autosave: boolean;
965
971
  allowlistEnabled: boolean;
966
972
  linkTrackingIds: boolean;
973
+ allowSaveWithErrors: boolean;
967
974
  reusableRecommendationStrategy: boolean;
968
975
  };
969
976
  blocks: {
@@ -1107,6 +1114,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1107
1114
  autosave: boolean;
1108
1115
  allowlistEnabled: boolean;
1109
1116
  linkTrackingIds: boolean;
1117
+ allowSaveWithErrors: boolean;
1110
1118
  reusableRecommendationStrategy: boolean;
1111
1119
  };
1112
1120
  blocks: {
@@ -1250,6 +1258,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1250
1258
  autosave: boolean;
1251
1259
  allowlistEnabled: boolean;
1252
1260
  linkTrackingIds: boolean;
1261
+ allowSaveWithErrors: boolean;
1253
1262
  reusableRecommendationStrategy: boolean;
1254
1263
  };
1255
1264
  blocks: {
@@ -1393,6 +1402,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1393
1402
  autosave: boolean;
1394
1403
  allowlistEnabled: boolean;
1395
1404
  linkTrackingIds: boolean;
1405
+ allowSaveWithErrors: boolean;
1396
1406
  reusableRecommendationStrategy: boolean;
1397
1407
  };
1398
1408
  blocks: {
@@ -1536,6 +1546,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1536
1546
  autosave: boolean;
1537
1547
  allowlistEnabled: boolean;
1538
1548
  linkTrackingIds: boolean;
1549
+ allowSaveWithErrors: boolean;
1539
1550
  reusableRecommendationStrategy: boolean;
1540
1551
  };
1541
1552
  blocks: {
@@ -1679,6 +1690,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1679
1690
  autosave: boolean;
1680
1691
  allowlistEnabled: boolean;
1681
1692
  linkTrackingIds: boolean;
1693
+ allowSaveWithErrors: boolean;
1682
1694
  reusableRecommendationStrategy: boolean;
1683
1695
  };
1684
1696
  blocks: {
@@ -1822,6 +1834,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1822
1834
  autosave: boolean;
1823
1835
  allowlistEnabled: boolean;
1824
1836
  linkTrackingIds: boolean;
1837
+ allowSaveWithErrors: boolean;
1825
1838
  reusableRecommendationStrategy: boolean;
1826
1839
  };
1827
1840
  blocks: {
@@ -1965,6 +1978,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1965
1978
  autosave: boolean;
1966
1979
  allowlistEnabled: boolean;
1967
1980
  linkTrackingIds: boolean;
1981
+ allowSaveWithErrors: boolean;
1968
1982
  reusableRecommendationStrategy: boolean;
1969
1983
  };
1970
1984
  blocks: {
@@ -2108,6 +2122,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2108
2122
  autosave: boolean;
2109
2123
  allowlistEnabled: boolean;
2110
2124
  linkTrackingIds: boolean;
2125
+ allowSaveWithErrors: boolean;
2111
2126
  reusableRecommendationStrategy: boolean;
2112
2127
  };
2113
2128
  blocks: {
@@ -2251,6 +2266,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2251
2266
  autosave: boolean;
2252
2267
  allowlistEnabled: boolean;
2253
2268
  linkTrackingIds: boolean;
2269
+ allowSaveWithErrors: boolean;
2254
2270
  reusableRecommendationStrategy: boolean;
2255
2271
  };
2256
2272
  blocks: {
@@ -2394,6 +2410,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2394
2410
  autosave: boolean;
2395
2411
  allowlistEnabled: boolean;
2396
2412
  linkTrackingIds: boolean;
2413
+ allowSaveWithErrors: boolean;
2397
2414
  reusableRecommendationStrategy: boolean;
2398
2415
  };
2399
2416
  blocks: {
@@ -2437,6 +2454,18 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2437
2454
  };
2438
2455
  } | null;
2439
2456
  } & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => number;
2457
+ /**
2458
+ * Transactional campaigns keep the hard save block. Reactive getter, so
2459
+ * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
2460
+ */
2461
+ isTransactional(): boolean;
2462
+ /**
2463
+ * Soft-save policy: may the editor persist a template with validation errors?
2464
+ * Default true (host sets features.allowSaveWithErrors=false for transactional +
2465
+ * unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
2466
+ * floor to false pre-init and momentarily hide the soft-save option (SD-147430).
2467
+ */
2468
+ allowSaveWithErrors(): boolean;
2440
2469
  /**
2441
2470
  * Get the username
2442
2471
  */
@@ -2537,6 +2566,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2537
2566
  autosave: boolean;
2538
2567
  allowlistEnabled: boolean;
2539
2568
  linkTrackingIds: boolean;
2569
+ allowSaveWithErrors: boolean;
2540
2570
  reusableRecommendationStrategy: boolean;
2541
2571
  };
2542
2572
  blocks: {
@@ -2680,6 +2710,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2680
2710
  autosave: boolean;
2681
2711
  allowlistEnabled: boolean;
2682
2712
  linkTrackingIds: boolean;
2713
+ allowSaveWithErrors: boolean;
2683
2714
  reusableRecommendationStrategy: boolean;
2684
2715
  };
2685
2716
  blocks: {
@@ -2825,6 +2856,7 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2825
2856
  autosave: boolean;
2826
2857
  allowlistEnabled: boolean;
2827
2858
  linkTrackingIds: boolean;
2859
+ allowSaveWithErrors: boolean;
2828
2860
  reusableRecommendationStrategy: boolean;
2829
2861
  };
2830
2862
  blocks: {
@@ -1,13 +1,3 @@
1
- /** Terminal outcome of an editor write, keyed by `${blueprintId}:${version}`. */
2
- export interface ApplyAck {
3
- status: 'applied' | 'failed';
4
- /** The `applyRequestedAt` of the click this ack answers — lets cortex drop stale acks. */
5
- requestedAt: number;
6
- /** Strictly increasing per key, so two acks in the same millisecond still order. */
7
- ackAt: number;
8
- /** Stringified — cortex JSON-clones store-derived payloads, an Error would not survive. */
9
- error?: string;
10
- }
11
1
  /** The published editor snapshot — the shape a consumer reads off the shared store. */
12
2
  export interface GuidoEmailEditorState {
13
3
  /** Current Stripo HTML — stripe tables only, no DOCTYPE/wrapper. */
@@ -18,10 +8,6 @@ export interface GuidoEmailEditorState {
18
8
  lastUpdatedAt: number;
19
9
  /** Template id from the editor config, so a consumer can scope per-template. */
20
10
  templateId: string;
21
- /** True while a mounted Guido bridge is consuming the chat store. Gates cortex's Apply button. */
22
- bridgeActive: boolean;
23
- /** `${blueprintId}:${version}` → terminal outcome of the editor write, written only after it settles. */
24
- applyAcks: Record<string, ApplyAck>;
25
11
  }
26
12
  /**
27
13
  * Outbound contract Guido publishes to the host's shared Pinia singleton so a
@@ -32,11 +18,17 @@ export interface GuidoEmailEditorState {
32
18
  * Published as `@useinsider/guido/editor-state` and from the root barrel, so a
33
19
  * consumer imports this store instead of re-declaring one under the same id.
34
20
  *
35
- * State-only by contract: cortex-fe reads `pinia.state.value['guidoEmailEditor']`, which misses
36
- * actions and getters. Intended writers: `useGuidoStateBridge` and `useCortexBlueprintBridge`.
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.
37
25
  *
38
- * The id `guidoEmailEditor` is part of the cross-MFE contract; the internal
39
- * store `guidoEditor` is intentionally separate.
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.
40
32
  */
41
33
  export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"guidoEmailEditor", GuidoEmailEditorState, {
42
34
  /** True once the bridge has published at least one snapshot. */
@@ -45,7 +37,5 @@ export declare const useGuidoEmailEditorStore: import("pinia").StoreDefinition<"
45
37
  css: string;
46
38
  lastUpdatedAt: number;
47
39
  templateId: string;
48
- bridgeActive: boolean;
49
- applyAcks: Record<string, ApplyAck>;
50
40
  } & import("pinia").PiniaCustomStateProperties<GuidoEmailEditorState>) => boolean;
51
41
  }, {}>;
@@ -0,0 +1,22 @@
1
+ import type { SaveValidationError, SaveValidationIntent } from '@@/Types/save-validation';
2
+ interface SaveValidationState {
3
+ errors: SaveValidationError[];
4
+ isDrawerOpen: boolean;
5
+ intent: SaveValidationIntent | null;
6
+ }
7
+ export declare const useSaveValidationStore: import("pinia").StoreDefinition<"guidoSaveValidation", SaveValidationState, {
8
+ errorCount: (state: {
9
+ errors: {
10
+ rule: import("../enums/save-validation").SaveValidationRule;
11
+ message: string;
12
+ detail?: string | undefined;
13
+ type: import("../enums/toaster").ToasterTypeOptions;
14
+ }[];
15
+ isDrawerOpen: boolean;
16
+ intent: SaveValidationIntent | null;
17
+ } & import("pinia").PiniaCustomStateProperties<SaveValidationState>) => number;
18
+ }, {
19
+ open(errors: SaveValidationError[], intent: SaveValidationIntent): void;
20
+ close(): void;
21
+ }>;
22
+ export {};
@@ -15,6 +15,36 @@ import type { SavedTemplateDetails } from '@@/Types/stripo';
15
15
  * same source), so it is reliably present regardless of how the block was added.
16
16
  */
17
17
  export declare function getHtmlReferencedUnsubscribePages(html: string): number[];
18
+ /**
19
+ * Hydrates the recommendation extension store from the persisted `esd-ext-config`
20
+ * JSON blob on each `.recommendation-block-v2` element in the raw editor HTML.
21
+ *
22
+ * Why this runs before `compileHtml`:
23
+ * The HTML compiler's `prepareRecommendationBlocks` rule asks
24
+ * `useRecommendation.buildCampaignUrl(id)` to assemble each block's API URL
25
+ * from `blockStates[id].recommendationConfigs`. That Pinia entry is normally
26
+ * populated by `RecommendationBlockControl._syncNodeConfigToStore`, which
27
+ * only fires when the user *selects* the block. Saving without ever
28
+ * selecting a migrated block would otherwise build the URL from empty/
29
+ * default state and the campaign URL would not be saved.
30
+ *
31
+ * Why we read raw HTML, not compiled HTML:
32
+ * Stripo's `compileEmail()` strips editor-only attributes (`esd-*`) from the
33
+ * compiled output, so `esd-ext-config` is gone by the time the compiler
34
+ * pipeline sees the HTML. The raw HTML from `getTemplateData()` preserves
35
+ * the attribute as the migrator wrote it.
36
+ *
37
+ * Reference data pre-load:
38
+ * When the template has recommendation blocks, this also pre-loads the
39
+ * shared reference data (languages / currency list) so the save-time
40
+ * required-fields validator can check each block's locale and currency
41
+ * against the partner's real options. Best-effort — on a fetch failure the
42
+ * validator degrades to its empty-list guard (`requiredFields.ts`) instead
43
+ * of blocking the save or stranding the Save button.
44
+ */
45
+ declare function hydrateRecommendationStoreFromRawHtml(rawHtml: string): Promise<void>;
18
46
  export declare const useTemplatePreparation: () => {
19
47
  prepareTemplateDetails: () => Promise<Omit<SavedTemplateDetails, "metadata">>;
48
+ hydrateRecommendationStore: typeof hydrateRecommendationStoreFromRawHtml;
20
49
  };
50
+ export {};