@useinsider/guido 1.0.3-beta.ce4cdcb → 1.0.3-beta.cedc8cb

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 (115) hide show
  1. package/dist/@types/generic.d.ts +13 -0
  2. package/dist/components/Guido.vue.d.ts +3 -2
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +99 -70
  5. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.d.ts +19 -0
  6. package/dist/components/organisms/extensions/recommendation/FilterItem.vue.js +28 -0
  7. package/dist/components/organisms/extensions/recommendation/FilterItem.vue2.js +38 -0
  8. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.d.ts +2 -0
  9. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue.js +17 -0
  10. package/dist/components/organisms/extensions/recommendation/FilterSelectionDrawer.vue2.js +37 -0
  11. package/dist/components/organisms/extensions/recommendation/Filters.vue.d.ts +2 -0
  12. package/dist/components/organisms/extensions/recommendation/Filters.vue.js +20 -0
  13. package/dist/components/organisms/extensions/recommendation/Filters.vue2.js +44 -0
  14. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.d.ts +16 -0
  15. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue.js +17 -0
  16. package/dist/components/organisms/extensions/recommendation/LogicAdapter.vue2.js +27 -0
  17. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +2 -0
  18. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +18 -0
  19. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +16 -0
  20. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +2 -0
  21. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +24 -0
  22. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +64 -0
  23. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
  24. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +18 -0
  25. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +107 -0
  26. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
  27. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +18 -0
  28. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue2.js +12 -0
  29. package/dist/components/wrappers/WpDrawer.vue.d.ts +6 -4
  30. package/dist/components/wrappers/WpDrawer.vue.js +6 -4
  31. package/dist/composables/useApiErrorTracking.d.ts +26 -0
  32. package/dist/composables/useApiErrorTracking.js +120 -0
  33. package/dist/composables/useErrorTracking.d.ts +30 -0
  34. package/dist/composables/useErrorTracking.js +98 -0
  35. package/dist/composables/useHttp.js +89 -52
  36. package/dist/composables/useStripo.js +160 -61
  37. package/dist/composables/useStripoErrorCategory.d.ts +26 -0
  38. package/dist/composables/useStripoErrorCategory.js +86 -0
  39. package/dist/composables/useStripoSlackNotifier.d.ts +8 -0
  40. package/dist/composables/useStripoSlackNotifier.js +47 -0
  41. package/dist/config/compiler/unsubscribeCompilerRules.js +42 -29
  42. package/dist/config/migrator/index.d.ts +1 -1
  43. package/dist/config/migrator/index.js +7 -6
  44. package/dist/config/migrator/unsubscribeMigrator.d.ts +1 -0
  45. package/dist/config/migrator/unsubscribeMigrator.js +124 -0
  46. package/dist/enums/defaults.js +6 -3
  47. package/dist/enums/extensions/recommendationBlock.d.ts +16 -0
  48. package/dist/enums/extensions/recommendationBlock.js +80 -0
  49. package/dist/enums/unsubscribe.d.ts +19 -0
  50. package/dist/enums/unsubscribe.js +39 -6
  51. package/dist/extensions/Blocks/Checkbox/control.js +35 -39
  52. package/dist/extensions/Blocks/RadioButton/control.js +33 -37
  53. package/dist/extensions/Blocks/RadioButton/template.js +6 -6
  54. package/dist/extensions/Blocks/Recommendation/block.d.ts +10 -0
  55. package/dist/extensions/Blocks/Recommendation/block.js +27 -0
  56. package/dist/extensions/Blocks/Recommendation/control.d.ts +29 -0
  57. package/dist/extensions/Blocks/Recommendation/control.js +277 -0
  58. package/dist/extensions/Blocks/Recommendation/extension.d.ts +2 -0
  59. package/dist/extensions/Blocks/Recommendation/extension.js +10 -0
  60. package/dist/extensions/Blocks/Recommendation/iconsRegistry.d.ts +4 -0
  61. package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +51 -0
  62. package/dist/extensions/Blocks/Recommendation/recommendation.css.js +19 -0
  63. package/dist/extensions/Blocks/Recommendation/settingsPanel.d.ts +4 -0
  64. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +32 -0
  65. package/dist/extensions/Blocks/Recommendation/store/recommendation.d.ts +555 -0
  66. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +266 -0
  67. package/dist/extensions/Blocks/Recommendation/template.d.ts +6 -0
  68. package/dist/extensions/Blocks/Recommendation/template.js +200 -0
  69. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.d.ts +7 -0
  70. package/dist/extensions/Blocks/Recommendation/utils/filterUtil.js +28 -0
  71. package/dist/extensions/Blocks/Unsubscribe/block.d.ts +32 -0
  72. package/dist/extensions/Blocks/Unsubscribe/block.js +131 -0
  73. package/dist/extensions/Blocks/Unsubscribe/control.d.ts +29 -0
  74. package/dist/extensions/Blocks/Unsubscribe/control.js +167 -0
  75. package/dist/extensions/Blocks/Unsubscribe/elements/preview.d.ts +11 -0
  76. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +42 -0
  77. package/dist/extensions/Blocks/Unsubscribe/extension.d.ts +2 -0
  78. package/dist/extensions/Blocks/Unsubscribe/extension.js +21 -0
  79. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.d.ts +4 -0
  80. package/dist/extensions/Blocks/Unsubscribe/iconsRegistry.js +21 -0
  81. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.d.ts +4 -0
  82. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +35 -0
  83. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +42 -0
  84. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.d.ts +4 -0
  85. package/dist/extensions/Blocks/Unsubscribe/tagRegistry.js +10 -0
  86. package/dist/extensions/Blocks/Unsubscribe/template.d.ts +12 -0
  87. package/dist/extensions/Blocks/Unsubscribe/template.js +22 -0
  88. package/dist/extensions/Blocks/Unsubscribe/utils/constants.d.ts +9 -0
  89. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +11 -0
  90. package/dist/extensions/Blocks/Unsubscribe/utils/utils.d.ts +7 -0
  91. package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +6 -0
  92. package/dist/extensions/Blocks/common-control.d.ts +66 -0
  93. package/dist/extensions/Blocks/common-control.js +102 -0
  94. package/dist/guido.css +1 -1
  95. package/dist/mock/api/recommendation.d.ts +2 -0
  96. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +83 -71
  97. package/dist/services/recommendationApi.d.ts +6 -0
  98. package/dist/services/recommendationApi.js +43 -0
  99. package/dist/services/slackNotificationService.d.ts +110 -0
  100. package/dist/services/slackNotificationService.js +167 -0
  101. package/dist/services/stripoApi.js +49 -19
  102. package/dist/services/stripoErrorDeduplicationService.d.ts +75 -0
  103. package/dist/services/stripoErrorDeduplicationService.js +91 -0
  104. package/dist/services/unsubscribeApi.d.ts +4 -0
  105. package/dist/services/unsubscribeApi.js +16 -0
  106. package/dist/stores/config.d.ts +96 -0
  107. package/dist/stores/config.js +17 -0
  108. package/dist/stores/editor.d.ts +21 -0
  109. package/dist/stores/editor.js +2 -1
  110. package/dist/stores/unsubscribe.d.ts +253 -5
  111. package/dist/stores/unsubscribe.js +126 -6
  112. package/dist/utils/genericUtil.d.ts +1 -0
  113. package/dist/utils/genericUtil.js +8 -7
  114. package/dist/utils/templatePreparation.js +17 -16
  115. package/package.json +2 -2
@@ -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
  };
@@ -6,3 +6,4 @@ export declare const getCsrfToken: () => string;
6
6
  */
7
7
  export declare const getUrlParams: () => URLSearchParams;
8
8
  export declare const getUrlParam: (paramName: string, defaultValue?: string) => string;
9
+ export declare const replaceString: (string?: string, values?: Record<string, string | number>, isRemoveEmptyValues?: boolean) => string;
@@ -1,14 +1,15 @@
1
- const e = (l) => l.map((a) => a.format ? {
1
+ const o = (e) => e.map((a) => a.format ? {
2
2
  label: `${a.text} | ${a.format.key}=${a.format.value}`,
3
3
  value: `{{${a.value}|${a.format.key}=${a.format.value}}}`
4
4
  } : {
5
5
  label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
6
6
  value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
7
- }), r = () => {
8
- var l;
9
- return ((l = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : l.getAttribute("content")) ?? "";
10
- };
7
+ }), f = () => {
8
+ var e;
9
+ return ((e = document.head.querySelector('meta[name="csrf-token"]')) == null ? void 0 : e.getAttribute("content")) ?? "";
10
+ }, $ = (e = "", a = {}, n = !1) => Object.entries(a).reduce((l, [t, r]) => n && (r === "" || r === null || r === void 0) ? l.replace(`&${t}={${t}}`, "") : l.replace(`{${t}}`, String(r)), e);
11
11
  export {
12
- e as dynamicContentToMergeTags,
13
- r as getCsrfToken
12
+ o as dynamicContentToMergeTags,
13
+ f as getCsrfToken,
14
+ $ as replaceString
14
15
  };
@@ -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.ce4cdcb",
3
+ "version": "1.0.3-beta.cedc8cb",
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",
@@ -32,7 +32,7 @@
32
32
  "license": "ISC",
33
33
  "dependencies": {
34
34
  "@stripoinc/ui-editor-extensions": "3.0.0",
35
- "@useinsider/design-system-vue": "0.14.8",
35
+ "@useinsider/design-system-vue": "0.14.20",
36
36
  "@vueuse/core": "11.3.0",
37
37
  "lodash-es": "4.17.21",
38
38
  "pinia": "2.3.1",