@useinsider/guido 1.0.3-beta.a6893cb → 1.0.3-beta.a6a2da8

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 (112) hide show
  1. package/dist/@types/generic.d.ts +9 -0
  2. package/dist/components/Guido.vue.d.ts +2 -2
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +74 -69
  5. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +2 -0
  6. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +18 -0
  7. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +16 -0
  8. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +2 -0
  9. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +24 -0
  10. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +64 -0
  11. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
  12. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +18 -0
  13. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +107 -0
  14. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
  15. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +18 -0
  16. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue2.js +12 -0
  17. package/dist/components/wrappers/WpDrawer.vue.d.ts +6 -4
  18. package/dist/components/wrappers/WpDrawer.vue.js +6 -4
  19. package/dist/composables/useStripo.js +40 -32
  20. package/dist/config/compiler/unsubscribeCompilerRules.js +42 -29
  21. package/dist/config/migrator/couponBlockMigrator.d.ts +1 -0
  22. package/dist/config/migrator/couponBlockMigrator.js +67 -0
  23. package/dist/config/migrator/index.d.ts +1 -1
  24. package/dist/config/migrator/index.js +7 -5
  25. package/dist/config/migrator/unsubscribeMigrator.d.ts +1 -0
  26. package/dist/config/migrator/unsubscribeMigrator.js +124 -0
  27. package/dist/enums/defaults.js +6 -3
  28. package/dist/enums/unsubscribe.d.ts +19 -0
  29. package/dist/enums/unsubscribe.js +39 -6
  30. package/dist/extensions/Blocks/Checkbox/block.d.ts +1 -0
  31. package/dist/extensions/Blocks/Checkbox/block.js +15 -24
  32. package/dist/extensions/Blocks/Checkbox/control.js +24 -38
  33. package/dist/extensions/Blocks/Checkbox/extension.js +5 -16
  34. package/dist/extensions/Blocks/Checkbox/iconsRegistry.d.ts +4 -0
  35. package/dist/extensions/Blocks/Checkbox/iconsRegistry.js +18 -0
  36. package/dist/extensions/Blocks/Checkbox/settingsPanel.js +12 -25
  37. package/dist/extensions/Blocks/Checkbox/template.js +5 -16
  38. package/dist/extensions/Blocks/CouponBlock/block.d.ts +12 -0
  39. package/dist/extensions/Blocks/CouponBlock/block.js +33 -0
  40. package/dist/extensions/Blocks/CouponBlock/extension.d.ts +2 -0
  41. package/dist/extensions/Blocks/CouponBlock/extension.js +8 -0
  42. package/dist/extensions/Blocks/CouponBlock/iconsRegistry.d.ts +4 -0
  43. package/dist/extensions/Blocks/CouponBlock/iconsRegistry.js +33 -0
  44. package/dist/extensions/Blocks/CouponBlock/settingsPanel.d.ts +4 -0
  45. package/dist/extensions/Blocks/CouponBlock/settingsPanel.js +24 -0
  46. package/dist/extensions/Blocks/CouponBlock/template.d.ts +3 -0
  47. package/dist/extensions/Blocks/CouponBlock/template.js +18 -0
  48. package/dist/extensions/Blocks/RadioButton/block.d.ts +1 -0
  49. package/dist/extensions/Blocks/RadioButton/block.js +13 -22
  50. package/dist/extensions/Blocks/RadioButton/control.js +32 -46
  51. package/dist/extensions/Blocks/RadioButton/extension.js +4 -15
  52. package/dist/extensions/Blocks/RadioButton/iconsRegistry.d.ts +4 -0
  53. package/dist/extensions/Blocks/RadioButton/iconsRegistry.js +14 -0
  54. package/dist/extensions/Blocks/RadioButton/settingsPanel.js +13 -26
  55. package/dist/extensions/Blocks/RadioButton/template.js +7 -18
  56. package/dist/extensions/Blocks/Unsubscribe/block.d.ts +32 -0
  57. package/dist/extensions/Blocks/Unsubscribe/block.js +131 -0
  58. package/dist/extensions/Blocks/Unsubscribe/control.d.ts +29 -0
  59. package/dist/extensions/Blocks/Unsubscribe/control.js +167 -0
  60. package/dist/extensions/Blocks/Unsubscribe/elements/preview.d.ts +11 -0
  61. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +42 -0
  62. package/dist/extensions/Blocks/Unsubscribe/extension.d.ts +2 -0
  63. package/dist/extensions/Blocks/Unsubscribe/extension.js +21 -0
  64. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.d.ts +4 -0
  65. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.js +21 -0
  66. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.d.ts +4 -0
  67. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +35 -0
  68. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +42 -0
  69. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.d.ts +4 -0
  70. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.js +10 -0
  71. package/dist/extensions/Blocks/Unsubscribe/template.d.ts +12 -0
  72. package/dist/extensions/Blocks/Unsubscribe/template.js +22 -0
  73. package/dist/extensions/Blocks/Unsubscribe/utils/constants.d.ts +9 -0
  74. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +11 -0
  75. package/dist/extensions/Blocks/Unsubscribe/utils/utils.d.ts +7 -0
  76. package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +6 -0
  77. package/dist/extensions/Blocks/_Boilerplate/block.d.ts +1 -0
  78. package/dist/extensions/Blocks/_Boilerplate/iconsRegistry.d.ts +4 -0
  79. package/dist/extensions/DynamicContent/dynamic-content.js +31 -45
  80. package/dist/extensions/DynamicContent/extension.js +6 -18
  81. package/dist/guido.css +1 -1
  82. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +648 -0
  83. package/dist/services/unsubscribeApi.d.ts +4 -0
  84. package/dist/services/unsubscribeApi.js +16 -0
  85. package/dist/stores/config.d.ts +96 -0
  86. package/dist/stores/config.js +17 -0
  87. package/dist/stores/unsubscribe.d.ts +253 -5
  88. package/dist/stores/unsubscribe.js +126 -6
  89. package/dist/utils/templatePreparation.js +17 -16
  90. package/package.json +2 -2
  91. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +0 -75
  92. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +0 -77
  93. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +0 -123
  94. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +0 -7
  95. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +0 -7
  96. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js +0 -12
  97. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +0 -7
  98. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +0 -119
  99. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +0 -7
  100. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +0 -7
  101. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +0 -7
  102. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js +0 -12
  103. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +0 -7
  104. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +0 -7
  105. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +0 -7
  106. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +0 -24
  107. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +0 -24
  108. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +0 -11
  109. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +0 -33
  110. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +0 -22
  111. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +0 -40
  112. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +0 -5
@@ -0,0 +1,96 @@
1
+ import type { GuidoConfig, TemplateConfig } from '@@/Types/generic';
2
+ interface StoreState {
3
+ guidoConfig: GuidoConfig;
4
+ templateConfig?: TemplateConfig;
5
+ }
6
+ export declare const useConfigStore: import("pinia").StoreDefinition<"config", StoreState, {
7
+ getVariationId: (state: {
8
+ guidoConfig: {
9
+ translationsPath: string;
10
+ htmlCompilerRules?: ({
11
+ type: "replace";
12
+ search: string;
13
+ replacement: string;
14
+ replaceAll?: boolean | undefined;
15
+ id: string;
16
+ description?: string | undefined;
17
+ priority: number;
18
+ } | {
19
+ type: "regex";
20
+ pattern: string;
21
+ replacement: string;
22
+ flags?: string | undefined;
23
+ id: string;
24
+ description?: string | undefined;
25
+ priority: number;
26
+ } | {
27
+ type: "remove";
28
+ targets: string[] | {
29
+ exec: (string: string) => RegExpExecArray | null;
30
+ test: (string: string) => boolean;
31
+ readonly source: string;
32
+ readonly global: boolean;
33
+ readonly ignoreCase: boolean;
34
+ readonly multiline: boolean;
35
+ lastIndex: number;
36
+ compile: (pattern: string, flags?: string) => RegExp;
37
+ readonly flags: string;
38
+ readonly sticky: boolean;
39
+ readonly unicode: boolean;
40
+ readonly dotAll: boolean;
41
+ readonly hasIndices: boolean;
42
+ [Symbol.match]: (string: string) => RegExpMatchArray | null;
43
+ [Symbol.replace]: {
44
+ (string: string, replaceValue: string): string;
45
+ (string: string, replacer: (substring: string, ...args: any[]) => string): string;
46
+ };
47
+ [Symbol.search]: (string: string) => number;
48
+ [Symbol.split]: (string: string, limit?: number) => string[];
49
+ [Symbol.matchAll]: (str: string) => IterableIterator<RegExpMatchArray>;
50
+ }[];
51
+ id: string;
52
+ description?: string | undefined;
53
+ priority: number;
54
+ } | {
55
+ type: "custom";
56
+ processor: (html: string) => string;
57
+ id: string;
58
+ description?: string | undefined;
59
+ priority: number;
60
+ })[] | undefined;
61
+ ignoreDefaultHtmlCompilerRules?: boolean | undefined;
62
+ useHeader?: boolean | undefined;
63
+ emailHeader: {
64
+ senderName: string;
65
+ subject: string;
66
+ };
67
+ partner?: {
68
+ partnerName: string;
69
+ productType: number;
70
+ messageType: number;
71
+ } | undefined;
72
+ extensions?: {
73
+ unsubscribe?: boolean | undefined;
74
+ } | undefined;
75
+ features?: {
76
+ dynamicContent?: boolean | undefined;
77
+ saveAsTemplate?: boolean | undefined;
78
+ versionHistory?: boolean | undefined;
79
+ } | undefined;
80
+ };
81
+ templateConfig?: {
82
+ preselectedDynamicContentList?: {
83
+ value: string;
84
+ text: string;
85
+ fallback?: string | undefined;
86
+ format?: {
87
+ key: string;
88
+ value: string;
89
+ } | undefined;
90
+ }[] | undefined;
91
+ selectedUnsubscribePages?: number[] | undefined;
92
+ variationId?: string | undefined;
93
+ } | undefined;
94
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => string;
95
+ }, {}>;
96
+ export {};
@@ -0,0 +1,17 @@
1
+ import { DefaultGuidoConfig as e } from "../enums/defaults.js";
2
+ import { defineStore as i } from "pinia";
3
+ const r = i("config", {
4
+ state: () => ({
5
+ guidoConfig: e,
6
+ templateConfig: {}
7
+ }),
8
+ getters: {
9
+ getVariationId: (t) => {
10
+ var o;
11
+ return ((o = t.templateConfig) == null ? void 0 : o.variationId) ?? "";
12
+ }
13
+ }
14
+ });
15
+ export {
16
+ r as useConfigStore
17
+ };
@@ -1,8 +1,256 @@
1
- type UnsubscribePage = {
2
- type: number;
3
- };
1
+ import type { UnsubscribePage } from '@@/Types/unsubscribe';
4
2
  interface StoreState {
5
- selectedUnsubscribePages: UnsubscribePage[];
3
+ templates: UnsubscribePage[];
4
+ selectedTemplates: Record<number, number>;
5
+ selectedUnsubscribePages: number[];
6
+ selectedCollectionType: number;
7
+ activeType: number;
8
+ pageSelectionUpdateStatus: boolean;
9
+ pageSelectionDrawerStatus: boolean;
10
+ typeSelectionDrawerStatus: boolean;
11
+ isGlobalUnsubscribeDisabled: boolean;
12
+ isSubscriptionPreferencesCenterDisabled: boolean;
6
13
  }
7
- export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"unsubscribe", StoreState, {}, {}>;
14
+ export declare const useUnsubscribeStore: import("pinia").StoreDefinition<"unsubscribe", StoreState, {
15
+ getSelectedCollection: (state: {
16
+ templates: {
17
+ id: number;
18
+ name: string;
19
+ type: number;
20
+ isVisible: number;
21
+ html: string;
22
+ originalHtml: string;
23
+ css: string;
24
+ thumbnail: string;
25
+ createdAt: string;
26
+ updatedAt: string;
27
+ status: number;
28
+ }[];
29
+ selectedTemplates: Record<number, number>;
30
+ selectedUnsubscribePages: number[];
31
+ selectedCollectionType: number;
32
+ activeType: number;
33
+ pageSelectionUpdateStatus: boolean;
34
+ pageSelectionDrawerStatus: boolean;
35
+ typeSelectionDrawerStatus: boolean;
36
+ isGlobalUnsubscribeDisabled: boolean;
37
+ isSubscriptionPreferencesCenterDisabled: boolean;
38
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => number[];
39
+ getSelectedTemplateByActiveType: (state: {
40
+ templates: {
41
+ id: number;
42
+ name: string;
43
+ type: number;
44
+ isVisible: number;
45
+ html: string;
46
+ originalHtml: string;
47
+ css: string;
48
+ thumbnail: string;
49
+ createdAt: string;
50
+ updatedAt: string;
51
+ status: number;
52
+ }[];
53
+ selectedTemplates: Record<number, number>;
54
+ selectedUnsubscribePages: number[];
55
+ selectedCollectionType: number;
56
+ activeType: number;
57
+ pageSelectionUpdateStatus: boolean;
58
+ pageSelectionDrawerStatus: boolean;
59
+ typeSelectionDrawerStatus: boolean;
60
+ isGlobalUnsubscribeDisabled: boolean;
61
+ isSubscriptionPreferencesCenterDisabled: boolean;
62
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => number;
63
+ getTemplatesByActiveType: (state: {
64
+ templates: {
65
+ id: number;
66
+ name: string;
67
+ type: number;
68
+ isVisible: number;
69
+ html: string;
70
+ originalHtml: string;
71
+ css: string;
72
+ thumbnail: string;
73
+ createdAt: string;
74
+ updatedAt: string;
75
+ status: number;
76
+ }[];
77
+ selectedTemplates: Record<number, number>;
78
+ selectedUnsubscribePages: number[];
79
+ selectedCollectionType: number;
80
+ activeType: number;
81
+ pageSelectionUpdateStatus: boolean;
82
+ pageSelectionDrawerStatus: boolean;
83
+ typeSelectionDrawerStatus: boolean;
84
+ isGlobalUnsubscribeDisabled: boolean;
85
+ isSubscriptionPreferencesCenterDisabled: boolean;
86
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => {
87
+ id: number;
88
+ name: string;
89
+ type: number;
90
+ isVisible: number;
91
+ html: string;
92
+ originalHtml: string;
93
+ css: string;
94
+ thumbnail: string;
95
+ createdAt: string;
96
+ updatedAt: string;
97
+ status: number;
98
+ }[];
99
+ getThumbnailByTemplateId: (state: {
100
+ templates: {
101
+ id: number;
102
+ name: string;
103
+ type: number;
104
+ isVisible: number;
105
+ html: string;
106
+ originalHtml: string;
107
+ css: string;
108
+ thumbnail: string;
109
+ createdAt: string;
110
+ updatedAt: string;
111
+ status: number;
112
+ }[];
113
+ selectedTemplates: Record<number, number>;
114
+ selectedUnsubscribePages: number[];
115
+ selectedCollectionType: number;
116
+ activeType: number;
117
+ pageSelectionUpdateStatus: boolean;
118
+ pageSelectionDrawerStatus: boolean;
119
+ typeSelectionDrawerStatus: boolean;
120
+ isGlobalUnsubscribeDisabled: boolean;
121
+ isSubscriptionPreferencesCenterDisabled: boolean;
122
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => (id: number) => string;
123
+ getSelectedUnsubscribePagesByCollection: (state: {
124
+ templates: {
125
+ id: number;
126
+ name: string;
127
+ type: number;
128
+ isVisible: number;
129
+ html: string;
130
+ originalHtml: string;
131
+ css: string;
132
+ thumbnail: string;
133
+ createdAt: string;
134
+ updatedAt: string;
135
+ status: number;
136
+ }[];
137
+ selectedTemplates: Record<number, number>;
138
+ selectedUnsubscribePages: number[];
139
+ selectedCollectionType: number;
140
+ activeType: number;
141
+ pageSelectionUpdateStatus: boolean;
142
+ pageSelectionDrawerStatus: boolean;
143
+ typeSelectionDrawerStatus: boolean;
144
+ isGlobalUnsubscribeDisabled: boolean;
145
+ isSubscriptionPreferencesCenterDisabled: boolean;
146
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => (collectionType: number) => number[];
147
+ isActiveTypeFirstInCollection: (state: {
148
+ templates: {
149
+ id: number;
150
+ name: string;
151
+ type: number;
152
+ isVisible: number;
153
+ html: string;
154
+ originalHtml: string;
155
+ css: string;
156
+ thumbnail: string;
157
+ createdAt: string;
158
+ updatedAt: string;
159
+ status: number;
160
+ }[];
161
+ selectedTemplates: Record<number, number>;
162
+ selectedUnsubscribePages: number[];
163
+ selectedCollectionType: number;
164
+ activeType: number;
165
+ pageSelectionUpdateStatus: boolean;
166
+ pageSelectionDrawerStatus: boolean;
167
+ typeSelectionDrawerStatus: boolean;
168
+ isGlobalUnsubscribeDisabled: boolean;
169
+ isSubscriptionPreferencesCenterDisabled: boolean;
170
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
171
+ isActiveTypeLastInCollection: (state: {
172
+ templates: {
173
+ id: number;
174
+ name: string;
175
+ type: number;
176
+ isVisible: number;
177
+ html: string;
178
+ originalHtml: string;
179
+ css: string;
180
+ thumbnail: string;
181
+ createdAt: string;
182
+ updatedAt: string;
183
+ status: number;
184
+ }[];
185
+ selectedTemplates: Record<number, number>;
186
+ selectedUnsubscribePages: number[];
187
+ selectedCollectionType: number;
188
+ activeType: number;
189
+ pageSelectionUpdateStatus: boolean;
190
+ pageSelectionDrawerStatus: boolean;
191
+ typeSelectionDrawerStatus: boolean;
192
+ isGlobalUnsubscribeDisabled: boolean;
193
+ isSubscriptionPreferencesCenterDisabled: boolean;
194
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
195
+ hasTemplatesByCollectionType: (state: {
196
+ templates: {
197
+ id: number;
198
+ name: string;
199
+ type: number;
200
+ isVisible: number;
201
+ html: string;
202
+ originalHtml: string;
203
+ css: string;
204
+ thumbnail: string;
205
+ createdAt: string;
206
+ updatedAt: string;
207
+ status: number;
208
+ }[];
209
+ selectedTemplates: Record<number, number>;
210
+ selectedUnsubscribePages: number[];
211
+ selectedCollectionType: number;
212
+ activeType: number;
213
+ pageSelectionUpdateStatus: boolean;
214
+ pageSelectionDrawerStatus: boolean;
215
+ typeSelectionDrawerStatus: boolean;
216
+ isGlobalUnsubscribeDisabled: boolean;
217
+ isSubscriptionPreferencesCenterDisabled: boolean;
218
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => Record<number, boolean>;
219
+ unsubscribePagesStatus: (state: {
220
+ templates: {
221
+ id: number;
222
+ name: string;
223
+ type: number;
224
+ isVisible: number;
225
+ html: string;
226
+ originalHtml: string;
227
+ css: string;
228
+ thumbnail: string;
229
+ createdAt: string;
230
+ updatedAt: string;
231
+ status: number;
232
+ }[];
233
+ selectedTemplates: Record<number, number>;
234
+ selectedUnsubscribePages: number[];
235
+ selectedCollectionType: number;
236
+ activeType: number;
237
+ pageSelectionUpdateStatus: boolean;
238
+ pageSelectionDrawerStatus: boolean;
239
+ typeSelectionDrawerStatus: boolean;
240
+ isGlobalUnsubscribeDisabled: boolean;
241
+ isSubscriptionPreferencesCenterDisabled: boolean;
242
+ } & import("pinia").PiniaCustomStateProperties<StoreState>) => boolean;
243
+ }, {
244
+ $reset(): void;
245
+ fetchTemplates(): Promise<void>;
246
+ setCollection(collectionType: number): void;
247
+ setCollectionWithoutAutoSelection(collectionType: number): void;
248
+ setSelectedTemplate(template: number): void;
249
+ setNextType(): void;
250
+ setPreviousType(): void;
251
+ loadSelectedTemplates(templates: number[]): void;
252
+ getSelectedTemplatesByCollection(type: number): number[];
253
+ addUnsubscribePages(pageIds: number[]): void;
254
+ removeUnsubscribePages(pageIds: number[]): void;
255
+ }>;
8
256
  export {};
@@ -1,9 +1,129 @@
1
- import { defineStore as e } from "pinia";
2
- const t = () => ({
3
- selectedUnsubscribePages: []
4
- }), r = e("unsubscribe", {
5
- state: () => t()
1
+ import { TYPE_COLLECTIONS as i, PAGE_TYPES as a } from "../enums/unsubscribe.js";
2
+ import { useUnsubscribeApi as r } from "../services/unsubscribeApi.js";
3
+ import { defineStore as d } from "pinia";
4
+ const p = () => ({
5
+ templates: [],
6
+ selectedTemplates: {},
7
+ selectedUnsubscribePages: [],
8
+ selectedCollectionType: a.GLOBAL_UNSUBSCRIBE,
9
+ activeType: a.GLOBAL_UNSUBSCRIBE,
10
+ pageSelectionUpdateStatus: !1,
11
+ pageSelectionDrawerStatus: !1,
12
+ typeSelectionDrawerStatus: !1,
13
+ isGlobalUnsubscribeDisabled: !1,
14
+ isSubscriptionPreferencesCenterDisabled: !1
15
+ }), g = d("unsubscribe", {
16
+ state: () => p(),
17
+ getters: {
18
+ getSelectedCollection: (e) => i[e.selectedCollectionType],
19
+ getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
20
+ getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
21
+ getThumbnailByTemplateId: (e) => (t) => {
22
+ var c;
23
+ return ((c = e.templates.find((s) => s.id === t)) == null ? void 0 : c.thumbnail) ?? "";
24
+ },
25
+ getSelectedUnsubscribePagesByCollection: (e) => (t) => {
26
+ const c = i[t];
27
+ if (!c)
28
+ return [];
29
+ const s = /* @__PURE__ */ new Map();
30
+ e.templates.forEach((n) => {
31
+ s.set(n.id, n.type);
32
+ });
33
+ const l = new Set(c);
34
+ return e.selectedUnsubscribePages.filter((n) => {
35
+ const o = s.get(n);
36
+ return o !== void 0 && l.has(o);
37
+ });
38
+ },
39
+ isActiveTypeFirstInCollection: (e) => {
40
+ const t = i[e.selectedCollectionType];
41
+ return e.activeType === t[0];
42
+ },
43
+ isActiveTypeLastInCollection: (e) => {
44
+ const t = i[e.selectedCollectionType];
45
+ return e.activeType === t[t.length - 1];
46
+ },
47
+ hasTemplatesByCollectionType: (e) => {
48
+ const t = {};
49
+ return i[e.selectedCollectionType].forEach((s) => {
50
+ t[s] = e.templates.some((l) => l.type === s);
51
+ }), t;
52
+ },
53
+ unsubscribePagesStatus: (e) => e.selectedUnsubscribePages.length > 0
54
+ },
55
+ actions: {
56
+ $reset() {
57
+ const { templates: e, selectedUnsubscribePages: t } = this;
58
+ Object.assign(this, {
59
+ ...p(),
60
+ templates: e,
61
+ selectedUnsubscribePages: t
62
+ });
63
+ },
64
+ async fetchTemplates() {
65
+ if (this.templates.length)
66
+ return;
67
+ const { getUnsubscribePages: e } = r(), t = await e();
68
+ this.templates = t;
69
+ },
70
+ setCollection(e) {
71
+ this.selectedCollectionType = e;
72
+ const t = i[e];
73
+ if (t && t.length > 0) {
74
+ [this.activeType] = t;
75
+ const c = { ...this.selectedTemplates };
76
+ t.forEach((s) => {
77
+ if (!c[s]) {
78
+ const l = this.templates.find((n) => n.type === s);
79
+ l && (c[s] = l.id);
80
+ }
81
+ }), this.selectedTemplates = c;
82
+ }
83
+ },
84
+ setCollectionWithoutAutoSelection(e) {
85
+ this.selectedCollectionType = e;
86
+ const t = i[e];
87
+ t && t.length > 0 && ([this.activeType] = t);
88
+ },
89
+ setSelectedTemplate(e) {
90
+ this.selectedTemplates = {
91
+ ...this.selectedTemplates,
92
+ [this.activeType]: e
93
+ };
94
+ },
95
+ setNextType() {
96
+ const t = this.getSelectedCollection.indexOf(this.activeType) + 1;
97
+ t < this.getSelectedCollection.length && (this.activeType = this.getSelectedCollection[t]);
98
+ },
99
+ setPreviousType() {
100
+ const t = this.getSelectedCollection.indexOf(this.activeType) - 1;
101
+ t >= 0 && (this.activeType = this.getSelectedCollection[t]);
102
+ },
103
+ loadSelectedTemplates(e) {
104
+ const t = new Map(this.templates.map((s) => [s.id, s.type])), c = { ...this.selectedTemplates };
105
+ e.forEach((s) => {
106
+ const l = t.get(s);
107
+ l !== void 0 && (c[l] = s);
108
+ }), this.selectedTemplates = c;
109
+ },
110
+ getSelectedTemplatesByCollection(e) {
111
+ const t = i[e], c = [];
112
+ return t.forEach((s) => {
113
+ this.selectedTemplates[s] && c.push(this.selectedTemplates[s]);
114
+ }), c;
115
+ },
116
+ addUnsubscribePages(e) {
117
+ const t = /* @__PURE__ */ new Set([...this.selectedUnsubscribePages, ...e]);
118
+ this.selectedUnsubscribePages = Array.from(t);
119
+ },
120
+ removeUnsubscribePages(e) {
121
+ this.selectedUnsubscribePages = this.selectedUnsubscribePages.filter(
122
+ (t) => !e.includes(t)
123
+ );
124
+ }
125
+ }
6
126
  });
7
127
  export {
8
- r as useUnsubscribeStore
128
+ g as useUnsubscribeStore
9
129
  };
@@ -1,14 +1,15 @@
1
- import { useActionsApi as g } from "../composables/useActionsApi.js";
2
- import { useHtmlCompiler as S } from "../composables/useHtmlCompiler.js";
1
+ import { useActionsApi as S } from "../composables/useActionsApi.js";
2
+ import { useHtmlCompiler as b } from "../composables/useHtmlCompiler.js";
3
3
  import { useDynamicContentStore as f } from "../stores/dynamic-content.js";
4
- const H = () => {
5
- const t = f(), { getCompiledEmail: i, getTemplateData: o } = g(), { compileHtml: n } = S();
4
+ import { useUnsubscribeStore as C } from "../stores/unsubscribe.js";
5
+ const z = () => {
6
+ const i = f(), t = C(), { getCompiledEmail: o, getTemplateData: s } = S(), { compileHtml: n } = b();
6
7
  return {
7
8
  prepareTemplateDetails: async () => {
8
- const { html: a, ampHtml: s = "", ampErrors: m = [] } = await i({
9
+ const { html: a, ampHtml: m = "", ampErrors: r = [] } = await o({
9
10
  minimize: !0,
10
11
  resetDataSavedFlag: !1
11
- }), { html: r, css: c, syncModulesIds: l = [] } = await o(), { compiledHtml: p, stats: e, appliedRules: d } = n(a), u = t.getSelectedDynamicContentList;
12
+ }), { html: c, css: l, syncModulesIds: p = [] } = await s(), { compiledHtml: u, stats: e, appliedRules: d } = n(a), g = i.getSelectedDynamicContentList;
12
13
  return console.debug("HTML Compilation Stats:", {
13
14
  originalSize: e.originalSize,
14
15
  compiledSize: e.compiledSize,
@@ -16,25 +17,25 @@ const H = () => {
16
17
  appliedRules: d,
17
18
  executionTime: `${e.executionTime.toFixed(2)}ms`
18
19
  }), {
19
- dynamicContentList: u,
20
- compiledHtml: p,
21
- rawHtml: r,
22
- css: c,
23
- ampHtml: s,
24
- ampErrors: m,
25
- modules: l,
20
+ dynamicContentList: g,
21
+ compiledHtml: u,
22
+ rawHtml: c,
23
+ css: l,
24
+ ampHtml: m,
25
+ ampErrors: r,
26
+ modules: p,
26
27
  recommendation: {
27
28
  campaignUrls: {},
28
29
  configs: {}
29
30
  },
30
31
  unsubscribe: {
31
- status: !1,
32
- config: []
32
+ status: t.unsubscribePagesStatus,
33
+ config: t.selectedUnsubscribePages
33
34
  }
34
35
  };
35
36
  }
36
37
  };
37
38
  };
38
39
  export {
39
- H as useTemplatePreparation
40
+ z as useTemplatePreparation
40
41
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.3-beta.a6893cb",
3
+ "version": "1.0.3-beta.a6a2da8",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -31,7 +31,7 @@
31
31
  "author": "",
32
32
  "license": "ISC",
33
33
  "dependencies": {
34
- "@stripoinc/ui-editor-extensions": "2.0.2",
34
+ "@stripoinc/ui-editor-extensions": "3.0.0",
35
35
  "@useinsider/design-system-vue": "0.14.8",
36
36
  "@vueuse/core": "11.3.0",
37
37
  "lodash-es": "4.17.21",
@@ -1,75 +0,0 @@
1
- var E = Object.defineProperty;
2
- var L = (r, e, i) => e in r ? E(r, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : r[e] = i;
3
- var t = (r, e, i) => L(r, typeof e != "symbol" ? e + "" : e, i);
4
- class A {
5
- constructor(e, i, s = [], n, a = [], l, o = [], g = [], y, h, x, u, b, c, m) {
6
- t(this, "i18n");
7
- t(this, "styles");
8
- t(this, "previewStyles");
9
- t(this, "uiElements", []);
10
- t(this, "uiElementTagRegistry");
11
- t(this, "controls", []);
12
- t(this, "settingsPanelRegistry");
13
- t(this, "contextActions", []);
14
- t(this, "blocks", []);
15
- t(this, "id");
16
- t(this, "externalSmartElementsLibrary");
17
- t(this, "externalImageLibrary");
18
- t(this, "externalAiAssistant");
19
- t(this, "externalDisplayConditionsLibrary");
20
- t(this, "externalVideoLibrary");
21
- t(this, "blocksPanel");
22
- this.i18n = e, this.styles = i, this.previewStyles = x, this.uiElements = s, this.uiElementTagRegistry = n, this.controls = a, this.settingsPanelRegistry = l, this.contextActions = o, this.blocks = g, this.externalSmartElementsLibrary = y, this.externalImageLibrary = h, this.externalAiAssistant = u, this.externalDisplayConditionsLibrary = b, this.externalVideoLibrary = c, this.blocksPanel = m, this.id = Math.random().toString(36).substring(2);
23
- }
24
- getI18n() {
25
- return this.i18n;
26
- }
27
- getStyles() {
28
- return this.styles;
29
- }
30
- getPreviewStyles() {
31
- return this.previewStyles;
32
- }
33
- getUiElements() {
34
- return this.uiElements;
35
- }
36
- getUiElementTagRegistry() {
37
- return this.uiElementTagRegistry;
38
- }
39
- getControls() {
40
- return this.controls;
41
- }
42
- getSettingsPanelRegistry() {
43
- return this.settingsPanelRegistry;
44
- }
45
- getContextActions() {
46
- return this.contextActions;
47
- }
48
- getBlocks() {
49
- return this.blocks;
50
- }
51
- getId() {
52
- return this.id;
53
- }
54
- getExternalSmartElementsLibrary() {
55
- return this.externalSmartElementsLibrary;
56
- }
57
- getExternalImageLibrary() {
58
- return this.externalImageLibrary;
59
- }
60
- getExternalAiAssistant() {
61
- return this.externalAiAssistant;
62
- }
63
- getExternalDisplayConditionsLibrary() {
64
- return this.externalDisplayConditionsLibrary;
65
- }
66
- getExternalVideoLibrary() {
67
- return this.externalVideoLibrary;
68
- }
69
- getBlocksPanel() {
70
- return this.blocksPanel;
71
- }
72
- }
73
- export {
74
- A as Extension
75
- };