@useinsider/guido 3.19.0-beta.3906ea8 → 3.19.0-beta.3abc7c5

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 (54) 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 +50 -48
  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 +85 -57
  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 +48 -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/useActionsApi.js +52 -47
  15. package/dist/composables/useCodeEditorApi.js +23 -9
  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 +279 -0
  20. package/dist/composables/useSaveValidationRollout.js +9 -0
  21. package/dist/composables/useTranslations.js +3 -2
  22. package/dist/composables/useVersionHistoryApi.js +33 -24
  23. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  24. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  25. package/dist/enums/save-validation.js +4 -0
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +54 -47
  27. package/dist/guido.css +1 -1
  28. package/dist/src/@types/config/schemas.d.ts +4 -0
  29. package/dist/src/@types/save-validation.d.ts +19 -0
  30. package/dist/src/components/Guido.vue.d.ts +17 -1
  31. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  32. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  33. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  34. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  35. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  36. package/dist/src/composables/useConfig.d.ts +2 -0
  37. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  38. package/dist/src/composables/useSave.d.ts +6 -1
  39. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  40. package/dist/src/composables/useSaveValidationRollout.d.ts +3 -0
  41. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  42. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  43. package/dist/src/enums/save-validation.d.ts +27 -0
  44. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +5 -0
  45. package/dist/src/stores/config.d.ts +32 -0
  46. package/dist/src/stores/save-validation.d.ts +22 -0
  47. package/dist/src/utils/stripoEditorApi.d.ts +4 -0
  48. package/dist/src/utils/templatePreparation.d.ts +30 -0
  49. package/dist/stores/config.js +84 -67
  50. package/dist/stores/save-validation.js +30 -0
  51. package/dist/stores/unsubscribe.js +3 -3
  52. package/dist/utils/stripoEditorApi.js +11 -0
  53. package/dist/utils/templatePreparation.js +39 -36
  54. package/package.json +3 -2
@@ -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: {
@@ -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 {};
@@ -0,0 +1,4 @@
1
+ import type { StripoEditorApi } from '@@/Types/stripo';
2
+ export declare const EDITOR_NOT_READY_MESSAGE = "The editor is not ready yet. Please wait for it to load and try again.";
3
+ export declare const findEditorApi: () => StripoEditorApi | undefined;
4
+ export declare const getEditorApi: () => StripoEditorApi;
@@ -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 {};
@@ -1,8 +1,8 @@
1
- import "../@types/config/schemas.js";
1
+ import { MessageType as r } from "../@types/config/schemas.js";
2
2
  import "../@types/config/defaults.js";
3
- import { parseConfig as o } from "../@types/config/validator.js";
4
- import { defineStore as a } from "pinia";
5
- const s = a("guido-config", {
3
+ import { parseConfig as a } from "../@types/config/validator.js";
4
+ import { defineStore as o } from "pinia";
5
+ const g = o("guido-config", {
6
6
  state: () => ({
7
7
  initialized: !1,
8
8
  config: null
@@ -11,135 +11,152 @@ const s = a("guido-config", {
11
11
  /**
12
12
  * Get the identity configuration
13
13
  */
14
- identity: (e) => {
15
- var i;
16
- return ((i = e.config) == null ? void 0 : i.identity) ?? null;
14
+ identity: (i) => {
15
+ var e;
16
+ return ((e = i.config) == null ? void 0 : e.identity) ?? null;
17
17
  },
18
18
  /**
19
19
  * Get the partner configuration
20
20
  */
21
- partner: (e) => {
22
- var i;
23
- return ((i = e.config) == null ? void 0 : i.partner) ?? null;
21
+ partner: (i) => {
22
+ var e;
23
+ return ((e = i.config) == null ? void 0 : e.partner) ?? null;
24
24
  },
25
25
  /**
26
26
  * Get the template configuration
27
27
  */
28
- template: (e) => {
29
- var i;
30
- return ((i = e.config) == null ? void 0 : i.template) ?? null;
28
+ template: (i) => {
29
+ var e;
30
+ return ((e = i.config) == null ? void 0 : e.template) ?? null;
31
31
  },
32
32
  /**
33
33
  * Get the editor configuration
34
34
  */
35
- editor: (e) => {
36
- var i;
37
- return ((i = e.config) == null ? void 0 : i.editor) ?? null;
35
+ editor: (i) => {
36
+ var e;
37
+ return ((e = i.config) == null ? void 0 : e.editor) ?? null;
38
38
  },
39
39
  /**
40
40
  * Get the UI configuration
41
41
  */
42
- ui: (e) => {
43
- var i;
44
- return ((i = e.config) == null ? void 0 : i.ui) ?? null;
42
+ ui: (i) => {
43
+ var e;
44
+ return ((e = i.config) == null ? void 0 : e.ui) ?? null;
45
45
  },
46
46
  /**
47
47
  * Get the features configuration
48
48
  */
49
- features: (e) => {
50
- var i;
51
- return ((i = e.config) == null ? void 0 : i.features) ?? null;
49
+ features: (i) => {
50
+ var e;
51
+ return ((e = i.config) == null ? void 0 : e.features) ?? null;
52
52
  },
53
53
  /**
54
54
  * Get the blocks configuration
55
55
  */
56
- blocks: (e) => {
57
- var i;
58
- return ((i = e.config) == null ? void 0 : i.blocks) ?? null;
56
+ blocks: (i) => {
57
+ var e;
58
+ return ((e = i.config) == null ? void 0 : e.blocks) ?? null;
59
59
  },
60
60
  /**
61
61
  * Get the compiler configuration
62
62
  */
63
- compiler: (e) => {
64
- var i;
65
- return ((i = e.config) == null ? void 0 : i.compiler) ?? null;
63
+ compiler: (i) => {
64
+ var e;
65
+ return ((e = i.config) == null ? void 0 : e.compiler) ?? null;
66
66
  },
67
67
  /**
68
68
  * Get the callbacks configuration
69
69
  */
70
- callbacks: (e) => {
71
- var i;
72
- return ((i = e.config) == null ? void 0 : i.callbacks) ?? null;
70
+ callbacks: (i) => {
71
+ var e;
72
+ return ((e = i.config) == null ? void 0 : e.callbacks) ?? null;
73
73
  },
74
74
  /**
75
75
  * Get the template ID
76
76
  */
77
- templateId: (e) => {
78
- var i, t;
79
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateId) ?? "";
77
+ templateId: (i) => {
78
+ var e, t;
79
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateId) ?? "";
80
80
  },
81
81
  /**
82
82
  * Get the user ID
83
83
  */
84
- userId: (e) => {
85
- var i, t;
86
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.userId) ?? "";
84
+ userId: (i) => {
85
+ var e, t;
86
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.userId) ?? "";
87
87
  },
88
88
  /**
89
89
  * Get the variation ID
90
90
  */
91
- variationId: (e) => {
92
- var i, t;
93
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.variationId) ?? "";
91
+ variationId: (i) => {
92
+ var e, t;
93
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.variationId) ?? "";
94
94
  },
95
95
  /**
96
96
  * Get the campaign ID
97
97
  */
98
- campaignId: (e) => {
99
- var i, t;
100
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.campaignId) ?? "";
98
+ campaignId: (i) => {
99
+ var e, t;
100
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.campaignId) ?? "";
101
101
  },
102
102
  /**
103
103
  * Get the template-library ID of the host template
104
104
  */
105
- templateLibraryId: (e) => {
106
- var i, t;
107
- return ((t = (i = e.config) == null ? void 0 : i.identity) == null ? void 0 : t.templateLibraryId) ?? "";
105
+ templateLibraryId: (i) => {
106
+ var e, t;
107
+ return ((t = (e = i.config) == null ? void 0 : e.identity) == null ? void 0 : t.templateLibraryId) ?? "";
108
108
  },
109
109
  /**
110
110
  * Get the partner name
111
111
  */
112
- partnerName: (e) => {
113
- var i, t;
114
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.name) ?? "";
112
+ partnerName: (i) => {
113
+ var e, t;
114
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.name) ?? "";
115
115
  },
116
116
  /**
117
117
  * Get the product type
118
118
  */
119
- productType: (e) => {
120
- var i, t;
121
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.productType) ?? 60;
119
+ productType: (i) => {
120
+ var e, t;
121
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.productType) ?? 60;
122
122
  },
123
123
  /**
124
124
  * Get the message type
125
125
  */
126
- messageType: (e) => {
127
- var i, t;
128
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.messageType) ?? 1;
126
+ messageType: (i) => {
127
+ var e, t;
128
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.messageType) ?? 1;
129
+ },
130
+ /**
131
+ * Transactional campaigns keep the hard save block. Reactive getter, so
132
+ * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
133
+ */
134
+ isTransactional() {
135
+ return this.messageType === r.TRANSACTIONAL;
136
+ },
137
+ /**
138
+ * Soft-save policy: may the editor persist a template with validation errors?
139
+ * Default true (host sets features.allowSaveWithErrors=false for transactional +
140
+ * unsub). Reactive getter defaulting true — reading via isFeatureEnabled would
141
+ * floor to false pre-init and momentarily hide the soft-save option (SD-147430).
142
+ */
143
+ allowSaveWithErrors() {
144
+ var i;
145
+ return ((i = this.features) == null ? void 0 : i.allowSaveWithErrors) ?? !0;
129
146
  },
130
147
  /**
131
148
  * Get the username
132
149
  */
133
- username: (e) => {
134
- var i, t;
135
- return ((t = (i = e.config) == null ? void 0 : i.partner) == null ? void 0 : t.username) ?? "Guido User";
150
+ username: (i) => {
151
+ var e, t;
152
+ return ((t = (e = i.config) == null ? void 0 : e.partner) == null ? void 0 : t.username) ?? "Guido User";
136
153
  },
137
154
  /**
138
155
  * Check if header should be shown
139
156
  */
140
- showHeader: (e) => {
141
- var i, t;
142
- return ((t = (i = e.config) == null ? void 0 : i.ui) == null ? void 0 : t.showHeader) ?? !0;
157
+ showHeader: (i) => {
158
+ var e, t;
159
+ return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
143
160
  },
144
161
  /**
145
162
  * Check if a specific feature is enabled.
@@ -147,18 +164,18 @@ const s = a("guido-config", {
147
164
  * flash on during loading, then disappear once config resolves.
148
165
  */
149
166
  // eslint-disable-next-line @stylistic/max-len
150
- isFeatureEnabled: (e) => (i) => {
167
+ isFeatureEnabled: (i) => (e) => {
151
168
  var t, n;
152
- return ((n = (t = e.config) == null ? void 0 : t.features) == null ? void 0 : n[i]) ?? !1;
169
+ return ((n = (t = i.config) == null ? void 0 : t.features) == null ? void 0 : n[e]) ?? !1;
153
170
  }
154
171
  },
155
172
  actions: {
156
173
  /**
157
174
  * Initialize the config store with validated configuration
158
175
  */
159
- init(e) {
160
- const i = o(e);
161
- this.config = i, this.initialized = !0;
176
+ init(i) {
177
+ const e = a(i);
178
+ this.config = e, this.initialized = !0;
162
179
  },
163
180
  /**
164
181
  * Reset the config store
@@ -169,5 +186,5 @@ const s = a("guido-config", {
169
186
  }
170
187
  });
171
188
  export {
172
- s as useConfigStore
189
+ g as useConfigStore
173
190
  };
@@ -0,0 +1,30 @@
1
+ import { defineStore as n } from "pinia";
2
+ function i(e) {
3
+ const t = /* @__PURE__ */ new Set();
4
+ return e.filter((r) => {
5
+ const s = JSON.stringify([r.rule, r.message, r.detail ?? ""]);
6
+ return t.has(s) ? !1 : (t.add(s), !0);
7
+ });
8
+ }
9
+ const o = n("guidoSaveValidation", {
10
+ state: () => ({
11
+ errors: [],
12
+ isDrawerOpen: !1,
13
+ intent: null
14
+ }),
15
+ getters: {
16
+ errorCount: (e) => e.errors.length
17
+ },
18
+ actions: {
19
+ open(e, t) {
20
+ this.errors = i(e), this.intent = t, this.isDrawerOpen = !0;
21
+ },
22
+ // Errors are retained so rows don't blank during the ~300ms close animation.
23
+ close() {
24
+ this.isDrawerOpen = !1;
25
+ }
26
+ }
27
+ });
28
+ export {
29
+ o as useSaveValidationStore
30
+ };
@@ -39,16 +39,16 @@ const r = () => ({
39
39
  });
40
40
  },
41
41
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType];
42
+ const t = i[e.selectedCollectionType] ?? [];
43
43
  return e.activeType === t[0];
44
44
  },
45
45
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType];
46
+ const t = i[e.selectedCollectionType] ?? [];
47
47
  return e.activeType === t[t.length - 1];
48
48
  },
49
49
  hasTemplatesByCollectionType: (e) => {
50
50
  const t = {};
51
- return i[e.selectedCollectionType].forEach((s) => {
51
+ return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
52
  t[s] = e.templates.some((c) => c.type === s);
53
53
  }), t;
54
54
  },
@@ -0,0 +1,11 @@
1
+ const o = "The editor is not ready yet. Please wait for it to load and try again.", i = () => window.StripoEditorApi, r = () => {
2
+ const t = i();
3
+ if (!t)
4
+ throw new Error(o);
5
+ return t;
6
+ };
7
+ export {
8
+ o as EDITOR_NOT_READY_MESSAGE,
9
+ i as findEditorApi,
10
+ r as getEditorApi
11
+ };