@useinsider/guido 3.21.2-beta.cfc5be2 → 3.21.2-beta.eda5c2e

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 (62) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +39 -41
  3. package/dist/components/Guido.vue.js +6 -6
  4. package/dist/components/Guido.vue2.js +79 -81
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +5 -5
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +9 -9
  7. package/dist/composables/useBlocksConfig.js +24 -32
  8. package/dist/enums/academy.js +0 -1
  9. package/dist/guido.css +1 -1
  10. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +92 -93
  11. package/dist/node_modules/valibot/dist/index.js +261 -297
  12. package/dist/src/@types/config/schemas.d.ts +0 -4
  13. package/dist/src/composables/useConfig.d.ts +0 -2
  14. package/dist/src/enums/academy.d.ts +0 -1
  15. package/dist/src/stores/config.d.ts +0 -166
  16. package/dist/src/stores/unsubscribe.d.ts +10 -0
  17. package/dist/stores/config.js +6 -13
  18. package/dist/stores/unsubscribe.js +28 -24
  19. package/dist/utils/pairProductVariables.js +14 -15
  20. package/package.json +1 -1
  21. package/dist/@types/display-condition.js +0 -25
  22. package/dist/components/organisms/display-conditions/CodeEditorField.vue.js +0 -20
  23. package/dist/components/organisms/display-conditions/CodeEditorField.vue2.js +0 -30
  24. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.js +0 -30
  25. package/dist/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue2.js +0 -71
  26. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.js +0 -34
  27. package/dist/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue2.js +0 -57
  28. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue.js +0 -17
  29. package/dist/components/organisms/display-conditions/DisplayConditionsHost.vue2.js +0 -22
  30. package/dist/composables/useDisplayConditions.js +0 -102
  31. package/dist/enums/display-condition.js +0 -12
  32. package/dist/extensions/DisplayConditions/bridge.js +0 -17
  33. package/dist/extensions/DisplayConditions/constants.js +0 -17
  34. package/dist/extensions/DisplayConditions/control.js +0 -178
  35. package/dist/extensions/DisplayConditions/display-conditions.css.js +0 -201
  36. package/dist/extensions/DisplayConditions/extension.js +0 -28
  37. package/dist/extensions/DisplayConditions/iconsRegistry.js +0 -20
  38. package/dist/extensions/DisplayConditions/library.js +0 -27
  39. package/dist/extensions/DisplayConditions/settingsPanel.js +0 -17
  40. package/dist/services/displayConditionApi.js +0 -39
  41. package/dist/src/@types/display-condition.d.ts +0 -59
  42. package/dist/src/components/organisms/display-conditions/CodeEditorField.vue.d.ts +0 -43
  43. package/dist/src/components/organisms/display-conditions/DisplayConditionCreateDrawer.vue.d.ts +0 -2
  44. package/dist/src/components/organisms/display-conditions/DisplayConditionSelectDrawer.vue.d.ts +0 -2
  45. package/dist/src/components/organisms/display-conditions/DisplayConditionsHost.vue.d.ts +0 -2
  46. package/dist/src/composables/useDisplayConditions.d.ts +0 -16
  47. package/dist/src/enums/display-condition.d.ts +0 -15
  48. package/dist/src/extensions/DisplayConditions/bridge.d.ts +0 -6
  49. package/dist/src/extensions/DisplayConditions/constants.d.ts +0 -14
  50. package/dist/src/extensions/DisplayConditions/control.d.ts +0 -23
  51. package/dist/src/extensions/DisplayConditions/extension.d.ts +0 -2
  52. package/dist/src/extensions/DisplayConditions/iconsRegistry.d.ts +0 -4
  53. package/dist/src/extensions/DisplayConditions/library.d.ts +0 -8
  54. package/dist/src/extensions/DisplayConditions/settingsPanel.d.ts +0 -5
  55. package/dist/src/mock/api/display-conditions.d.ts +0 -2
  56. package/dist/src/services/displayConditionApi.d.ts +0 -8
  57. package/dist/src/stores/display-condition.d.ts +0 -81
  58. package/dist/src/utils/displayCondition.d.ts +0 -10
  59. package/dist/src/utils/protectTableText.d.ts +0 -2
  60. package/dist/stores/display-condition.js +0 -28
  61. package/dist/utils/displayCondition.js +0 -26
  62. package/dist/utils/protectTableText.js +0 -22
@@ -384,8 +384,6 @@ export declare const UISchema: v.ObjectSchema<{
384
384
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
385
385
  /** Custom label for back button (if shown) */
386
386
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
387
- /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
388
- readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
389
387
  }, undefined>;
390
388
  /**
391
389
  * Features configuration - enable/disable editor features
@@ -806,8 +804,6 @@ export declare const GuidoConfigSchema: v.ObjectSchema<{
806
804
  readonly showHeader: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
807
805
  /** Custom label for back button (if shown) */
808
806
  readonly backButtonLabel: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
809
- /** Replace Stripo's display-condition UI with the Conditions tab and create/select drawers */
810
- readonly externalDisplayConditions: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
811
807
  }, undefined>, {}>;
812
808
  /** Feature toggles */
813
809
  readonly features: v.OptionalSchema<v.ObjectSchema<{
@@ -89,7 +89,6 @@ export declare const useConfig: () => {
89
89
  ui: {
90
90
  showHeader: boolean;
91
91
  backButtonLabel?: string | undefined;
92
- externalDisplayConditions: boolean;
93
92
  };
94
93
  features: {
95
94
  dynamicContent: boolean;
@@ -229,7 +228,6 @@ export declare const useConfig: () => {
229
228
  ui: import("vue").ComputedRef<{
230
229
  showHeader: boolean;
231
230
  backButtonLabel?: string | undefined;
232
- externalDisplayConditions: boolean;
233
231
  } | null>;
234
232
  features: import("vue").ComputedRef<{
235
233
  dynamicContent: boolean;
@@ -8,7 +8,6 @@ export declare const ACADEMY_LINKS: {
8
8
  readonly EMAIL_EDITOR: "https://academy.insiderone.com/docs/email-drag-and-drop-editor";
9
9
  readonly GLOBAL_UNSUBSCRIBE: "https://academy.insiderone.com/docs/global-unsubscribe-preference-center";
10
10
  readonly AMP_FOR_EMAILS: "https://academy.insiderone.com/docs/amp-for-emails";
11
- readonly EMAIL_DISPLAY_CONDITIONS: "https://academy.insiderone.com/docs/new-editor-add-display-conditions-to-an-email";
12
11
  readonly EMAIL_RECOMMENDATION_BLOCK: "https://academy.insiderone.com/docs/new-editor-email-recommendation-block";
13
12
  };
14
13
  export type AcademyLinkKey = keyof typeof ACADEMY_LINKS;
@@ -94,7 +94,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
94
94
  ui: {
95
95
  showHeader: boolean;
96
96
  backButtonLabel?: string | undefined;
97
- externalDisplayConditions: boolean;
98
97
  };
99
98
  features: {
100
99
  dynamicContent: boolean;
@@ -240,7 +239,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
240
239
  ui: {
241
240
  showHeader: boolean;
242
241
  backButtonLabel?: string | undefined;
243
- externalDisplayConditions: boolean;
244
242
  };
245
243
  features: {
246
244
  dynamicContent: boolean;
@@ -386,7 +384,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
386
384
  ui: {
387
385
  showHeader: boolean;
388
386
  backButtonLabel?: string | undefined;
389
- externalDisplayConditions: boolean;
390
387
  };
391
388
  features: {
392
389
  dynamicContent: boolean;
@@ -532,7 +529,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
532
529
  ui: {
533
530
  showHeader: boolean;
534
531
  backButtonLabel?: string | undefined;
535
- externalDisplayConditions: boolean;
536
532
  };
537
533
  features: {
538
534
  dynamicContent: boolean;
@@ -678,7 +674,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
678
674
  ui: {
679
675
  showHeader: boolean;
680
676
  backButtonLabel?: string | undefined;
681
- externalDisplayConditions: boolean;
682
677
  };
683
678
  features: {
684
679
  dynamicContent: boolean;
@@ -824,7 +819,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
824
819
  ui: {
825
820
  showHeader: boolean;
826
821
  backButtonLabel?: string | undefined;
827
- externalDisplayConditions: boolean;
828
822
  };
829
823
  features: {
830
824
  dynamicContent: boolean;
@@ -970,7 +964,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
970
964
  ui: {
971
965
  showHeader: boolean;
972
966
  backButtonLabel?: string | undefined;
973
- externalDisplayConditions: boolean;
974
967
  };
975
968
  features: {
976
969
  dynamicContent: boolean;
@@ -1116,7 +1109,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1116
1109
  ui: {
1117
1110
  showHeader: boolean;
1118
1111
  backButtonLabel?: string | undefined;
1119
- externalDisplayConditions: boolean;
1120
1112
  };
1121
1113
  features: {
1122
1114
  dynamicContent: boolean;
@@ -1262,7 +1254,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1262
1254
  ui: {
1263
1255
  showHeader: boolean;
1264
1256
  backButtonLabel?: string | undefined;
1265
- externalDisplayConditions: boolean;
1266
1257
  };
1267
1258
  features: {
1268
1259
  dynamicContent: boolean;
@@ -1408,7 +1399,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1408
1399
  ui: {
1409
1400
  showHeader: boolean;
1410
1401
  backButtonLabel?: string | undefined;
1411
- externalDisplayConditions: boolean;
1412
1402
  };
1413
1403
  features: {
1414
1404
  dynamicContent: boolean;
@@ -1554,7 +1544,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1554
1544
  ui: {
1555
1545
  showHeader: boolean;
1556
1546
  backButtonLabel?: string | undefined;
1557
- externalDisplayConditions: boolean;
1558
1547
  };
1559
1548
  features: {
1560
1549
  dynamicContent: boolean;
@@ -1700,7 +1689,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1700
1689
  ui: {
1701
1690
  showHeader: boolean;
1702
1691
  backButtonLabel?: string | undefined;
1703
- externalDisplayConditions: boolean;
1704
1692
  };
1705
1693
  features: {
1706
1694
  dynamicContent: boolean;
@@ -1846,7 +1834,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1846
1834
  ui: {
1847
1835
  showHeader: boolean;
1848
1836
  backButtonLabel?: string | undefined;
1849
- externalDisplayConditions: boolean;
1850
1837
  };
1851
1838
  features: {
1852
1839
  dynamicContent: boolean;
@@ -1992,7 +1979,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
1992
1979
  ui: {
1993
1980
  showHeader: boolean;
1994
1981
  backButtonLabel?: string | undefined;
1995
- externalDisplayConditions: boolean;
1996
1982
  };
1997
1983
  features: {
1998
1984
  dynamicContent: boolean;
@@ -2138,7 +2124,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2138
2124
  ui: {
2139
2125
  showHeader: boolean;
2140
2126
  backButtonLabel?: string | undefined;
2141
- externalDisplayConditions: boolean;
2142
2127
  };
2143
2128
  features: {
2144
2129
  dynamicContent: boolean;
@@ -2284,7 +2269,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2284
2269
  ui: {
2285
2270
  showHeader: boolean;
2286
2271
  backButtonLabel?: string | undefined;
2287
- externalDisplayConditions: boolean;
2288
2272
  };
2289
2273
  features: {
2290
2274
  dynamicContent: boolean;
@@ -2430,7 +2414,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2430
2414
  ui: {
2431
2415
  showHeader: boolean;
2432
2416
  backButtonLabel?: string | undefined;
2433
- externalDisplayConditions: boolean;
2434
2417
  };
2435
2418
  features: {
2436
2419
  dynamicContent: boolean;
@@ -2588,7 +2571,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2588
2571
  ui: {
2589
2572
  showHeader: boolean;
2590
2573
  backButtonLabel?: string | undefined;
2591
- externalDisplayConditions: boolean;
2592
2574
  };
2593
2575
  features: {
2594
2576
  dynamicContent: boolean;
@@ -2734,153 +2716,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
2734
2716
  ui: {
2735
2717
  showHeader: boolean;
2736
2718
  backButtonLabel?: string | undefined;
2737
- externalDisplayConditions: boolean;
2738
- };
2739
- features: {
2740
- dynamicContent: boolean;
2741
- saveAsTemplate: boolean;
2742
- versionHistory: boolean;
2743
- testMessage: boolean;
2744
- displayConditions: boolean;
2745
- unsubscribe: boolean;
2746
- modulesDisabled: boolean;
2747
- liquidSyntax: boolean;
2748
- autosave: boolean;
2749
- allowlistEnabled: boolean;
2750
- linkTrackingIds: boolean;
2751
- allowSaveWithErrors: boolean;
2752
- reusableRecommendationStrategy: boolean;
2753
- };
2754
- blocks: {
2755
- excludeDefaults: ("amp-accordion" | "amp-carousel" | "amp-form-controls" | "banner-block" | "button-block" | "html-block" | "image-block" | "menu-block" | "social-block" | "spacer-block" | "text-block" | "timer-block" | "video-block")[];
2756
- includeCustoms: ("dynamic-content" | "checkbox-block" | "radio-button-block" | "recommendation-block" | "unsubscribe-block" | "coupon-block" | "items-block")[];
2757
- };
2758
- compiler: {
2759
- customRules: ({
2760
- type: "replace";
2761
- search: string;
2762
- replacement: string;
2763
- replaceAll?: boolean | undefined;
2764
- id: string;
2765
- description?: string | undefined;
2766
- priority: number;
2767
- } | {
2768
- type: "regex";
2769
- pattern: string;
2770
- replacement: string;
2771
- flags?: string | undefined;
2772
- id: string;
2773
- description?: string | undefined;
2774
- priority: number;
2775
- } | {
2776
- type: "remove";
2777
- targets: string[];
2778
- id: string;
2779
- description?: string | undefined;
2780
- priority: number;
2781
- } | {
2782
- type: "custom";
2783
- processor: (html: string) => string;
2784
- id: string;
2785
- description?: string | undefined;
2786
- priority: number;
2787
- })[];
2788
- ignoreDefaultRules: boolean;
2789
- };
2790
- callbacks: {
2791
- externalValidation?: import("@@/Types/config").ExternalValidationHandler | undefined;
2792
- };
2793
- } | null;
2794
- } & import("pinia").PiniaCustomStateProperties<ConfigStoreState>) => boolean;
2795
- /**
2796
- * Check if the Insider display-condition UI replaces Stripo's
2797
- */
2798
- externalDisplayConditions: (state: {
2799
- initialized: boolean;
2800
- config: {
2801
- identity: {
2802
- templateId: string;
2803
- userId: string;
2804
- variationId?: string | undefined;
2805
- campaignId?: string | undefined;
2806
- templateLibraryId?: string | undefined;
2807
- };
2808
- partner: {
2809
- name: string;
2810
- productType: 60 | 49 | 97;
2811
- messageType: 1 | 2;
2812
- username: string;
2813
- fallbackFont?: {
2814
- name: string;
2815
- family: string;
2816
- } | undefined;
2817
- };
2818
- template: {
2819
- html: string;
2820
- css: string;
2821
- preselectedDynamicContent: {
2822
- text: string;
2823
- value: string;
2824
- fallback?: string | undefined;
2825
- format?: {
2826
- key: string;
2827
- value: string;
2828
- } | undefined;
2829
- }[];
2830
- dynamicContentList: {
2831
- [x: string]: import("../library").DynamicContentNode[];
2832
- };
2833
- customFieldAttributes: string[];
2834
- selectedUnsubscribePages: number[];
2835
- forceRecreate: boolean;
2836
- trackIdCounter: number;
2837
- recommendationCampaignUrls?: Record<string, unknown> | undefined;
2838
- migration: {
2839
- recommendationConfigs: {
2840
- [x: string]: {
2841
- id?: number | undefined;
2842
- decimalCount?: string | number | undefined;
2843
- productIds?: unknown[] | undefined;
2844
- sendProductRequestFlag?: boolean | undefined;
2845
- shuffleProducts?: boolean | undefined;
2846
- filters?: unknown[] | undefined;
2847
- currency?: string | undefined;
2848
- currencySettings?: unknown;
2849
- language?: string | undefined;
2850
- strategy?: string | undefined;
2851
- recommendedProducts?: unknown[] | undefined;
2852
- cardsInRow?: number | undefined;
2853
- mobileRightPadding?: number | undefined;
2854
- mobileLeftPadding?: number | undefined;
2855
- unresponsive?: boolean | undefined;
2856
- orientation?: string | undefined;
2857
- textTrimming?: boolean | undefined;
2858
- blockType?: string | undefined;
2859
- size?: string | number | undefined;
2860
- verticalResponsiveness?: boolean | undefined;
2861
- isPriceMovedToNextLine?: boolean | undefined;
2862
- isPriceDeletedForZeroSale?: boolean | undefined;
2863
- } & {
2864
- [key: string]: unknown;
2865
- };
2866
- };
2867
- };
2868
- };
2869
- editor: {
2870
- locale: string;
2871
- translationsPath: string;
2872
- migrationDate: number;
2873
- emailHeader: {
2874
- senderName: string;
2875
- subject: string;
2876
- };
2877
- savedModulesFolderName: string;
2878
- defaultModulesFolderName: string;
2879
- };
2880
- ui: {
2881
- showHeader: boolean;
2882
- backButtonLabel?: string | undefined;
2883
- externalDisplayConditions: boolean;
2884
2719
  };
2885
2720
  features: {
2886
2721
  dynamicContent: boolean;
@@ -3028,7 +2863,6 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
3028
2863
  ui: {
3029
2864
  showHeader: boolean;
3030
2865
  backButtonLabel?: string | undefined;
3031
- externalDisplayConditions: boolean;
3032
2866
  };
3033
2867
  features: {
3034
2868
  dynamicContent: boolean;
@@ -26,6 +26,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
26
26
  createdAt: string;
27
27
  updatedAt: string;
28
28
  status: number;
29
+ isDefault?: boolean | undefined;
29
30
  }[];
30
31
  selectedTemplates: Record<number, number>;
31
32
  selectedUnsubscribePages: number[];
@@ -51,6 +52,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
51
52
  createdAt: string;
52
53
  updatedAt: string;
53
54
  status: number;
55
+ isDefault?: boolean | undefined;
54
56
  }[];
55
57
  selectedTemplates: Record<number, number>;
56
58
  selectedUnsubscribePages: number[];
@@ -76,6 +78,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
76
78
  createdAt: string;
77
79
  updatedAt: string;
78
80
  status: number;
81
+ isDefault?: boolean | undefined;
79
82
  }[];
80
83
  selectedTemplates: Record<number, number>;
81
84
  selectedUnsubscribePages: number[];
@@ -99,6 +102,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
99
102
  createdAt: string;
100
103
  updatedAt: string;
101
104
  status: number;
105
+ isDefault?: boolean | undefined;
102
106
  }[];
103
107
  getThumbnailByTemplateId: (state: {
104
108
  templates: {
@@ -113,6 +117,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
113
117
  createdAt: string;
114
118
  updatedAt: string;
115
119
  status: number;
120
+ isDefault?: boolean | undefined;
116
121
  }[];
117
122
  selectedTemplates: Record<number, number>;
118
123
  selectedUnsubscribePages: number[];
@@ -138,6 +143,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
138
143
  createdAt: string;
139
144
  updatedAt: string;
140
145
  status: number;
146
+ isDefault?: boolean | undefined;
141
147
  }[];
142
148
  selectedTemplates: Record<number, number>;
143
149
  selectedUnsubscribePages: number[];
@@ -163,6 +169,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
163
169
  createdAt: string;
164
170
  updatedAt: string;
165
171
  status: number;
172
+ isDefault?: boolean | undefined;
166
173
  }[];
167
174
  selectedTemplates: Record<number, number>;
168
175
  selectedUnsubscribePages: number[];
@@ -188,6 +195,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
188
195
  createdAt: string;
189
196
  updatedAt: string;
190
197
  status: number;
198
+ isDefault?: boolean | undefined;
191
199
  }[];
192
200
  selectedTemplates: Record<number, number>;
193
201
  selectedUnsubscribePages: number[];
@@ -213,6 +221,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
213
221
  createdAt: string;
214
222
  updatedAt: string;
215
223
  status: number;
224
+ isDefault?: boolean | undefined;
216
225
  }[];
217
226
  selectedTemplates: Record<number, number>;
218
227
  selectedUnsubscribePages: number[];
@@ -238,6 +247,7 @@ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"guido
238
247
  createdAt: string;
239
248
  updatedAt: string;
240
249
  status: number;
250
+ isDefault?: boolean | undefined;
241
251
  }[];
242
252
  selectedTemplates: Record<number, number>;
243
253
  selectedUnsubscribePages: number[];
@@ -1,8 +1,8 @@
1
- import { MessageType as a } from "../@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 l } from "pinia";
5
- const g = l("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
@@ -132,7 +132,7 @@ const g = l("guido-config", {
132
132
  * consumers stay safe in setup where a raw config read snapshots null (SD-147945).
133
133
  */
134
134
  isTransactional() {
135
- return this.messageType === a.TRANSACTIONAL;
135
+ return this.messageType === r.TRANSACTIONAL;
136
136
  },
137
137
  /**
138
138
  * Soft-save policy: may the editor persist a template with validation errors?
@@ -158,13 +158,6 @@ const g = l("guido-config", {
158
158
  var e, t;
159
159
  return ((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.showHeader) ?? !0;
160
160
  },
161
- /**
162
- * Check if the Insider display-condition UI replaces Stripo's
163
- */
164
- externalDisplayConditions: (i) => {
165
- var e, t, n, r;
166
- return (((t = (e = i.config) == null ? void 0 : e.ui) == null ? void 0 : t.externalDisplayConditions) ?? !1) && (((r = (n = i.config) == null ? void 0 : n.features) == null ? void 0 : r.displayConditions) ?? !0);
167
- },
168
161
  /**
169
162
  * Check if a specific feature is enabled.
170
163
  * Returns false before init (config null) so header controls don't
@@ -181,7 +174,7 @@ const g = l("guido-config", {
181
174
  * Initialize the config store with validated configuration
182
175
  */
183
176
  init(i) {
184
- const e = o(i);
177
+ const e = a(i);
185
178
  this.config = e, this.initialized = !0;
186
179
  },
187
180
  /**
@@ -1,23 +1,27 @@
1
- import { TYPE_COLLECTIONS as i, PAGE_TYPES as p } from "../enums/unsubscribe.js";
1
+ import { TYPE_COLLECTIONS as c, PAGE_TYPES as r } from "../enums/unsubscribe.js";
2
2
  import { useUnsubscribeApi as d } from "../services/unsubscribeApi.js";
3
3
  import { defineStore as u } from "pinia";
4
4
  let o = null;
5
- const r = () => ({
5
+ const p = () => ({
6
6
  templates: [],
7
7
  selectedTemplates: {},
8
8
  selectedUnsubscribePages: [],
9
- selectedCollectionType: p.GLOBAL_UNSUBSCRIBE,
10
- activeType: p.GLOBAL_UNSUBSCRIBE,
9
+ selectedCollectionType: r.GLOBAL_UNSUBSCRIBE,
10
+ activeType: r.GLOBAL_UNSUBSCRIBE,
11
11
  pageSelectionUpdateStatus: !1,
12
12
  pageSelectionDrawerStatus: !1,
13
13
  typeSelectionDrawerStatus: !1,
14
14
  isGlobalUnsubscribeDisabled: !1,
15
15
  isSubscriptionPreferencesCenterDisabled: !1,
16
16
  pendingBlockId: null
17
- }), b = u("guidoUnsubscribe", {
18
- state: () => r(),
17
+ });
18
+ function h(e) {
19
+ return [...e].sort((t, l) => +!!l.isDefault - +!!t.isDefault);
20
+ }
21
+ const f = u("guidoUnsubscribe", {
22
+ state: () => p(),
19
23
  getters: {
20
- getSelectedCollection: (e) => i[e.selectedCollectionType],
24
+ getSelectedCollection: (e) => c[e.selectedCollectionType],
21
25
  getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
22
26
  getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
23
27
  getThumbnailByTemplateId: (e) => (t) => {
@@ -25,31 +29,31 @@ const r = () => ({
25
29
  return ((l = e.templates.find((s) => s.id === t)) == null ? void 0 : l.thumbnail) ?? "";
26
30
  },
27
31
  getSelectedUnsubscribePagesByCollection: (e) => (t) => {
28
- const l = i[t];
32
+ const l = c[t];
29
33
  if (!l)
30
34
  return [];
31
35
  const s = /* @__PURE__ */ new Map();
32
36
  e.templates.forEach((n) => {
33
37
  s.set(n.id, n.type);
34
38
  });
35
- const c = new Set(l);
39
+ const i = new Set(l);
36
40
  return e.selectedUnsubscribePages.filter((n) => {
37
41
  const a = s.get(n);
38
- return a !== void 0 && c.has(a);
42
+ return a !== void 0 && i.has(a);
39
43
  });
40
44
  },
41
45
  isActiveTypeFirstInCollection: (e) => {
42
- const t = i[e.selectedCollectionType] ?? [];
46
+ const t = c[e.selectedCollectionType] ?? [];
43
47
  return e.activeType === t[0];
44
48
  },
45
49
  isActiveTypeLastInCollection: (e) => {
46
- const t = i[e.selectedCollectionType] ?? [];
50
+ const t = c[e.selectedCollectionType] ?? [];
47
51
  return e.activeType === t[t.length - 1];
48
52
  },
49
53
  hasTemplatesByCollectionType: (e) => {
50
54
  const t = {};
51
- return (i[e.selectedCollectionType] ?? []).forEach((s) => {
52
- t[s] = e.templates.some((c) => c.type === s);
55
+ return (c[e.selectedCollectionType] ?? []).forEach((s) => {
56
+ t[s] = e.templates.some((i) => i.type === s);
53
57
  }), t;
54
58
  },
55
59
  unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
@@ -58,7 +62,7 @@ const r = () => ({
58
62
  $reset() {
59
63
  const { templates: e, selectedUnsubscribePages: t } = this;
60
64
  Object.assign(this, {
61
- ...r(),
65
+ ...p(),
62
66
  templates: e,
63
67
  selectedUnsubscribePages: t
64
68
  });
@@ -66,28 +70,28 @@ const r = () => ({
66
70
  async fetchTemplates(e = !1) {
67
71
  !e && this.templates.length || ((e || !o) && (o = (async () => {
68
72
  const { getUnsubscribePages: t } = d();
69
- this.templates = await t();
73
+ this.templates = h(await t());
70
74
  })().finally(() => {
71
75
  o = null;
72
76
  })), await o);
73
77
  },
74
78
  setCollection(e) {
75
79
  this.selectedCollectionType = e;
76
- const t = i[e];
80
+ const t = c[e];
77
81
  if (t && t.length > 0) {
78
82
  [this.activeType] = t;
79
83
  const l = { ...this.selectedTemplates };
80
84
  t.forEach((s) => {
81
85
  if (!l[s]) {
82
- const c = this.templates.find((n) => n.type === s);
83
- c && (l[s] = c.id);
86
+ const i = this.templates.find((n) => n.type === s);
87
+ i && (l[s] = i.id);
84
88
  }
85
89
  }), this.selectedTemplates = l;
86
90
  }
87
91
  },
88
92
  setCollectionWithoutAutoSelection(e) {
89
93
  this.selectedCollectionType = e;
90
- const t = i[e];
94
+ const t = c[e];
91
95
  t && t.length > 0 && ([this.activeType] = t);
92
96
  },
93
97
  setSelectedTemplate(e) {
@@ -107,12 +111,12 @@ const r = () => ({
107
111
  loadSelectedTemplates(e) {
108
112
  const t = new Map(this.templates.map((s) => [s.id, s.type])), l = { ...this.selectedTemplates };
109
113
  e.forEach((s) => {
110
- const c = t.get(s);
111
- c !== void 0 && (l[c] = s);
114
+ const i = t.get(s);
115
+ i !== void 0 && (l[i] = s);
112
116
  }), this.selectedTemplates = l;
113
117
  },
114
118
  getSelectedTemplatesByCollection(e) {
115
- const t = i[e], l = [];
119
+ const t = c[e], l = [];
116
120
  return t.forEach((s) => {
117
121
  this.selectedTemplates[s] && l.push(this.selectedTemplates[s]);
118
122
  }), l;
@@ -129,5 +133,5 @@ const r = () => ({
129
133
  }
130
134
  });
131
135
  export {
132
- b as useUnsubscribeStore
136
+ f as useUnsubscribeStore
133
137
  };