@useinsider/guido 1.0.2-beta.ab357f5 → 1.0.2-beta.ad1dcd9

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 (162) hide show
  1. package/README.md +1 -1
  2. package/dist/@types/generic.d.ts +8 -0
  3. package/dist/components/Guido.vue.d.ts +2 -2
  4. package/dist/components/Guido.vue.js +2 -2
  5. package/dist/components/Guido.vue2.js +66 -61
  6. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.d.ts +2 -0
  7. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue.js +18 -0
  8. package/dist/components/organisms/unsubscribe/UnsubscribeBreadcrumb.vue2.js +16 -0
  9. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.d.ts +2 -0
  10. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +24 -0
  11. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +64 -0
  12. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.d.ts +2 -0
  13. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue.js +18 -0
  14. package/dist/components/organisms/unsubscribe/UnsubscribeTypeSelection.vue2.js +108 -0
  15. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.d.ts +2 -0
  16. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue.js +18 -0
  17. package/dist/components/organisms/unsubscribe/UnsubscribeWrapper.vue2.js +12 -0
  18. package/dist/components/wrappers/WpDrawer.vue.d.ts +6 -4
  19. package/dist/components/wrappers/WpDrawer.vue.js +6 -4
  20. package/dist/composables/useHtmlValidator.d.ts +2 -1
  21. package/dist/composables/useHtmlValidator.js +114 -95
  22. package/dist/composables/useSave.js +6 -6
  23. package/dist/composables/useStripo.js +35 -29
  24. package/dist/config/compiler/unsubscribeCompilerRules.js +19 -19
  25. package/dist/config/migrator/checkboxMigrator.d.ts +1 -0
  26. package/dist/config/migrator/checkboxMigrator.js +83 -0
  27. package/dist/config/migrator/index.d.ts +1 -0
  28. package/dist/config/migrator/index.js +9 -0
  29. package/dist/config/migrator/unsubscribeMigrator.d.ts +1 -0
  30. package/dist/config/migrator/unsubscribeMigrator.js +112 -0
  31. package/dist/enums/defaults.js +6 -3
  32. package/dist/enums/unsubscribe.d.ts +19 -0
  33. package/dist/enums/unsubscribe.js +39 -6
  34. package/dist/extensions/Blocks/Checkbox/block.d.ts +10 -0
  35. package/dist/extensions/Blocks/Checkbox/block.js +39 -0
  36. package/dist/extensions/Blocks/Checkbox/control.d.ts +22 -0
  37. package/dist/extensions/Blocks/Checkbox/control.js +104 -0
  38. package/dist/extensions/Blocks/Checkbox/extension.d.ts +2 -0
  39. package/dist/extensions/Blocks/Checkbox/extension.js +20 -0
  40. package/dist/extensions/Blocks/Checkbox/settingsPanel.d.ts +4 -0
  41. package/dist/extensions/Blocks/Checkbox/settingsPanel.js +38 -0
  42. package/dist/extensions/Blocks/Checkbox/template.d.ts +6 -0
  43. package/dist/extensions/Blocks/Checkbox/template.js +75 -0
  44. package/dist/extensions/Blocks/Unsubscribe/block.d.ts +30 -0
  45. package/dist/extensions/Blocks/Unsubscribe/block.js +141 -0
  46. package/dist/extensions/Blocks/Unsubscribe/control.d.ts +29 -0
  47. package/dist/extensions/Blocks/Unsubscribe/control.js +180 -0
  48. package/dist/extensions/Blocks/Unsubscribe/elements/preview.d.ts +11 -0
  49. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +54 -0
  50. package/dist/extensions/Blocks/Unsubscribe/extension.d.ts +2 -0
  51. package/dist/extensions/Blocks/Unsubscribe/extension.js +21 -0
  52. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.d.ts +4 -0
  53. package/dist/extensions/Blocks/Unsubscribe/settingsPanel.js +32 -0
  54. package/dist/extensions/Blocks/Unsubscribe/template.d.ts +3 -0
  55. package/dist/extensions/Blocks/Unsubscribe/template.js +28 -0
  56. package/dist/extensions/Blocks/Unsubscribe/utils/constants.d.ts +9 -0
  57. package/dist/extensions/Blocks/Unsubscribe/utils/constants.js +11 -0
  58. package/dist/extensions/Blocks/Unsubscribe/utils/utils.d.ts +7 -0
  59. package/dist/extensions/Blocks/Unsubscribe/utils/utils.js +6 -0
  60. package/dist/extensions/Blocks/_Boilerplate/block.d.ts +10 -0
  61. package/dist/extensions/Blocks/_Boilerplate/control.d.ts +17 -0
  62. package/dist/extensions/Blocks/_Boilerplate/extension.d.ts +2 -0
  63. package/dist/extensions/Blocks/_Boilerplate/settingsPanel.d.ts +4 -0
  64. package/dist/extensions/Blocks/_Boilerplate/template.d.ts +6 -0
  65. package/dist/extensions/DynamicContent/dynamic-content.js +41 -27
  66. package/dist/extensions/DynamicContent/extension.js +18 -6
  67. package/dist/guido.css +1 -1
  68. package/dist/mock/api/unsubscribe.d.ts +2 -0
  69. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/Extension.js +72 -48
  70. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ExtensionBuilder.js +74 -49
  71. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/Block.js +120 -38
  72. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AiAssistantValueType.js +5 -11
  73. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockCompositionType.js +5 -11
  74. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockName.js +12 -0
  75. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockType.js +5 -11
  76. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BuiltInControlTypes.js +116 -101
  77. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/ContextActionType.js +5 -11
  78. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/EditorStatePropertyType.js +5 -11
  79. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PanelPosition.js +5 -11
  80. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/Popover.js +12 -0
  81. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/PreviewDeviceMode.js +5 -11
  82. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/SettingsTab.js +5 -11
  83. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementType.js +5 -11
  84. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/UIElementsAttributes.js +23 -43
  85. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/Control.js +21 -17
  86. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelRegistry.js +8 -15
  87. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/SettingsPanelTab.js +30 -29
  88. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/modifications/ModificationDescription.js +19 -23
  89. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElement.js +37 -19
  90. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/ui-elements/UIElementTagRegistry.js +2 -15
  91. package/dist/services/unsubscribeApi.d.ts +4 -0
  92. package/dist/services/unsubscribeApi.js +16 -0
  93. package/dist/stores/unsubscribe.d.ts +183 -5
  94. package/dist/stores/unsubscribe.js +125 -6
  95. package/package.json +2 -2
  96. package/dist/_virtual/AddCustomFont.js +0 -4
  97. package/dist/_virtual/AiAssistantValueType.js +0 -4
  98. package/dist/_virtual/BackgroundColorBuiltInControl.js +0 -4
  99. package/dist/_virtual/BackgroundImageBuiltInControl.js +0 -4
  100. package/dist/_virtual/Block.js +0 -4
  101. package/dist/_virtual/BlockAttributes.js +0 -4
  102. package/dist/_virtual/BlockCompositionType.js +0 -4
  103. package/dist/_virtual/BlockPaddingsBuiltInControl.js +0 -4
  104. package/dist/_virtual/BlockRenderer.js +0 -4
  105. package/dist/_virtual/BlockType.js +0 -4
  106. package/dist/_virtual/BlocksPanel.js +0 -4
  107. package/dist/_virtual/BuiltInControl.js +0 -4
  108. package/dist/_virtual/BuiltInControlTypes.js +0 -4
  109. package/dist/_virtual/ButtonBorderBuiltInControl.js +0 -4
  110. package/dist/_virtual/ButtonColorBuiltInControl.js +0 -4
  111. package/dist/_virtual/ButtonFontColorBuiltInControl.js +0 -4
  112. package/dist/_virtual/ButtonInternalIndentsBuiltInControl.js +0 -4
  113. package/dist/_virtual/ButtonTextBuiltInControl.js +0 -4
  114. package/dist/_virtual/ContextAction.js +0 -4
  115. package/dist/_virtual/ContextActionType.js +0 -4
  116. package/dist/_virtual/Control.js +0 -4
  117. package/dist/_virtual/EditorStatePropertyType.js +0 -4
  118. package/dist/_virtual/Extension.js +0 -4
  119. package/dist/_virtual/ExtensionBuilder.js +0 -4
  120. package/dist/_virtual/FontFamilyBuiltInControl.js +0 -4
  121. package/dist/_virtual/LinkColorBuiltInControl.js +0 -4
  122. package/dist/_virtual/ModificationDescription.js +0 -4
  123. package/dist/_virtual/PanelPosition.js +0 -4
  124. package/dist/_virtual/PreviewDeviceMode.js +0 -4
  125. package/dist/_virtual/SettingsPanelRegistry.js +0 -4
  126. package/dist/_virtual/SettingsPanelTab.js +0 -4
  127. package/dist/_virtual/SettingsTab.js +0 -4
  128. package/dist/_virtual/StructureBorderBuiltInControl.js +0 -4
  129. package/dist/_virtual/StructurePaddingsBuiltInControl.js +0 -4
  130. package/dist/_virtual/TextColorBuiltInControl.js +0 -4
  131. package/dist/_virtual/TextLineSpacingBuiltInControl.js +0 -4
  132. package/dist/_virtual/TextSizeBuiltInControl.js +0 -4
  133. package/dist/_virtual/TextStyleBuiltInControl.js +0 -4
  134. package/dist/_virtual/UIElement.js +0 -4
  135. package/dist/_virtual/UIElementTagRegistry.js +0 -4
  136. package/dist/_virtual/UIElementType.js +0 -4
  137. package/dist/_virtual/UIElementsAttributes.js +0 -4
  138. package/dist/_virtual/index.js +0 -5
  139. package/dist/_virtual/index2.js +0 -4
  140. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlockRenderer.js +0 -18
  141. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/BlocksPanel.js +0 -32
  142. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/blocks/ContextAction.js +0 -18
  143. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/AddCustomFont.js +0 -8
  144. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/constants/BlockAttributes.js +0 -34
  145. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundColorBuiltInControl.js +0 -43
  146. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BackgroundImageBuiltInControl.js +0 -46
  147. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BlockPaddingsBuiltInControl.js +0 -44
  148. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/BuiltInControl.js +0 -22
  149. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonBorderBuiltInControl.js +0 -46
  150. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonColorBuiltInControl.js +0 -46
  151. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonFontColorBuiltInControl.js +0 -45
  152. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonInternalIndentsBuiltInControl.js +0 -45
  153. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/ButtonTextBuiltInControl.js +0 -45
  154. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/FontFamilyBuiltInControl.js +0 -43
  155. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/LinkColorBuiltInControl.js +0 -45
  156. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructureBorderBuiltInControl.js +0 -46
  157. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/StructurePaddingsBuiltInControl.js +0 -44
  158. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextColorBuiltInControl.js +0 -43
  159. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextLineSpacingBuiltInControl.js +0 -43
  160. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextSizeBuiltInControl.js +0 -45
  161. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/controls/TextStyleBuiltInControl.js +0 -43
  162. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/index.js +0 -266
@@ -1,32 +1,33 @@
1
- import { __exports as s } from "../../../../../_virtual/SettingsPanelTab.js";
2
- var r;
3
- function l() {
4
- if (r) return s;
5
- r = 1, Object.defineProperty(s, "__esModule", { value: !0 }), s.SettingsPanelTab = void 0;
6
- var i = (
7
- /** @class */
8
- (function() {
9
- function n(t, e) {
10
- this.tabId = t, this.controlsIds = e;
11
- }
12
- return n.prototype.getTabId = function() {
13
- return this.tabId;
14
- }, n.prototype.getLabel = function() {
15
- return this.label;
16
- }, n.prototype.getControlsIds = function() {
17
- return this.controlsIds;
18
- }, n.prototype.withLabel = function(t) {
19
- return this.label = t, this;
20
- }, n.prototype.addControl = function(t, e) {
21
- return e < 0 ? this.controlsIds.unshift(t) : e > this.controlsIds.length ? this.controlsIds.push(t) : this.controlsIds.splice(e, 0, t), this;
22
- }, n.prototype.deleteControl = function(t) {
23
- var e = this.controlsIds.indexOf(t);
24
- e !== -1 && this.controlsIds.splice(e, 1);
25
- }, n;
26
- })()
27
- );
28
- return s.SettingsPanelTab = i, s;
1
+ var r = Object.defineProperty;
2
+ var n = (e, s, t) => s in e ? r(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var l = (e, s, t) => n(e, typeof s != "symbol" ? s + "" : s, t);
4
+ class o {
5
+ constructor(s, t) {
6
+ l(this, "tabId");
7
+ l(this, "label");
8
+ l(this, "controlsIds");
9
+ this.tabId = s, this.controlsIds = t;
10
+ }
11
+ getTabId() {
12
+ return this.tabId;
13
+ }
14
+ getLabel() {
15
+ return this.label;
16
+ }
17
+ getControlsIds() {
18
+ return this.controlsIds;
19
+ }
20
+ withLabel(s) {
21
+ return this.label = s, this;
22
+ }
23
+ addControl(s, t) {
24
+ return t < 0 ? this.controlsIds.unshift(s) : t > this.controlsIds.length ? this.controlsIds.push(s) : this.controlsIds.splice(t, 0, s), this;
25
+ }
26
+ deleteControl(s) {
27
+ const t = this.controlsIds.indexOf(s);
28
+ t !== -1 && this.controlsIds.splice(t, 1);
29
+ }
29
30
  }
30
31
  export {
31
- l as __require
32
+ o as SettingsPanelTab
32
33
  };
@@ -1,26 +1,22 @@
1
- import { __exports as i } from "../../../../../_virtual/ModificationDescription.js";
2
- var r;
3
- function a() {
4
- if (r) return i;
5
- r = 1, Object.defineProperty(i, "__esModule", { value: !0 }), i.ModificationDescription = void 0;
6
- var e = (
7
- /** @class */
8
- (function() {
9
- function t(o) {
10
- this.key = o;
11
- }
12
- return t.prototype.withParams = function(o) {
13
- return this.params = o, this;
14
- }, t.prototype.getValue = function() {
15
- return {
16
- key: this.key,
17
- params: this.params
18
- };
19
- }, t;
20
- })()
21
- );
22
- return i.ModificationDescription = e, i;
1
+ var i = Object.defineProperty;
2
+ var e = (t, s, a) => s in t ? i(t, s, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[s] = a;
3
+ var r = (t, s, a) => e(t, typeof s != "symbol" ? s + "" : s, a);
4
+ class o {
5
+ constructor(s) {
6
+ r(this, "key");
7
+ r(this, "params");
8
+ this.key = s;
9
+ }
10
+ withParams(s) {
11
+ return this.params = s, this;
12
+ }
13
+ getValue() {
14
+ return {
15
+ key: this.key,
16
+ params: this.params
17
+ };
18
+ }
23
19
  }
24
20
  export {
25
- a as __require
21
+ o as ModificationDescription
26
22
  };
@@ -1,22 +1,40 @@
1
- import { __exports as t } from "../../../../../_virtual/UIElement.js";
2
- var n;
3
- function l() {
4
- if (n) return t;
5
- n = 1, Object.defineProperty(t, "__esModule", { value: !0 }), t.UIElement = void 0;
6
- var r = (
7
- /** @class */
8
- (function() {
9
- function e() {
10
- }
11
- return e.prototype.onDestroy = function() {
12
- }, e.prototype.getValue = function() {
13
- }, e.prototype.setValue = function(o) {
14
- }, e.prototype.onAttributeUpdated = function(o, u) {
15
- }, e;
16
- })()
17
- );
18
- return t.UIElement = r, t;
1
+ var u = Object.defineProperty;
2
+ var n = (t, e, a) => e in t ? u(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a;
3
+ var l = (t, e, a) => n(t, typeof e != "symbol" ? e + "" : e, a);
4
+ class s {
5
+ constructor() {
6
+ /** Provides access to editor functionalities specific to this UI element instance. */
7
+ l(this, "api");
8
+ }
9
+ /**
10
+ * Optional cleanup hook called when the UI element is being destroyed.
11
+ * Use this to remove event listeners or perform other cleanup tasks.
12
+ */
13
+ onDestroy() {
14
+ }
15
+ /**
16
+ * Optional method to get the current value of the UI element.
17
+ * Implement this if the element manages a state or value (e.g., input fields).
18
+ * @returns The current value of the element.
19
+ */
20
+ getValue() {
21
+ }
22
+ /**
23
+ * Optional method to set the value of the UI element.
24
+ * Implement this if the element manages a state or value and needs to be updated externally.
25
+ * @param value - The new value to set.
26
+ */
27
+ setValue(e) {
28
+ }
29
+ /**
30
+ * @description Optional hook called when one of the element's supported attributes ({@link UEAttr}) gets updated externally.
31
+ * Implement this to react to attribute changes (e.g., visibility, disabled state).
32
+ * @param name - The name of the attribute that was updated.
33
+ * @param value - The new value of the attribute.
34
+ */
35
+ onAttributeUpdated(e, a) {
36
+ }
19
37
  }
20
38
  export {
21
- l as __require
39
+ s as UIElement
22
40
  };
@@ -1,18 +1,5 @@
1
- import { __exports as e } from "../../../../../_virtual/UIElementTagRegistry.js";
2
- var r;
3
- function g() {
4
- if (r) return e;
5
- r = 1, Object.defineProperty(e, "__esModule", { value: !0 }), e.UIElementTagRegistry = void 0;
6
- var t = (
7
- /** @class */
8
- /* @__PURE__ */ (function() {
9
- function i() {
10
- }
11
- return i;
12
- })()
13
- );
14
- return e.UIElementTagRegistry = t, e;
1
+ class s {
15
2
  }
16
3
  export {
17
- g as __require
4
+ s as UIElementTagRegistry
18
5
  };
@@ -0,0 +1,4 @@
1
+ import type { UnsubscribePage } from '@@/Types/unsubscribe';
2
+ export declare const useUnsubscribeApi: () => {
3
+ getUnsubscribePages: () => Promise<UnsubscribePage[]>;
4
+ };
@@ -0,0 +1,16 @@
1
+ import { useHttp as t } from "../composables/useHttp.js";
2
+ import { useToaster as n } from "../composables/useToaster.js";
3
+ const u = () => {
4
+ const { get: r } = t(), { handleError: s } = n();
5
+ return { getUnsubscribePages: async () => {
6
+ try {
7
+ const { data: e = [] } = await r("/unsubscribe-pages/get-all");
8
+ return e;
9
+ } catch (e) {
10
+ return s(e, "Failed to fetch unsubscribe pages"), [];
11
+ }
12
+ } };
13
+ };
14
+ export {
15
+ u as useUnsubscribeApi
16
+ };
@@ -1,8 +1,186 @@
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
+ isActiveTypeFirstInCollection: (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>) => boolean;
123
+ isActiveTypeLastInCollection: (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>) => boolean;
147
+ hasTemplatesByCollectionType: (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>) => Record<number, boolean>;
171
+ }, {
172
+ $reset(): void;
173
+ fetchTemplates(): Promise<void>;
174
+ setCollection(collectionType: number): void;
175
+ setCollectionWithoutAutoSelection(collectionType: number): void;
176
+ setSelectedTemplate(template: number): void;
177
+ setNextType(): void;
178
+ setPreviousType(): void;
179
+ loadSelectedTemplates(templates: number[]): void;
180
+ getThumbnailByTemplateId(id: number): string;
181
+ getSelectedTemplatesByCollection(type: number): number[];
182
+ addUnsubscribePages(pageIds: number[]): void;
183
+ removeUnsubscribePages(pageIds: number[]): void;
184
+ getSelectedUnsubscribePagesByCollection(collectionType: number): number[];
185
+ }>;
8
186
  export {};
@@ -1,9 +1,128 @@
1
- import { defineStore as e } from "pinia";
2
- const t = () => ({
3
- selectedUnsubscribePages: []
4
- }), r = e("unsubscribe", {
5
- state: () => t()
1
+ import { TYPE_COLLECTIONS as l, PAGE_TYPES as o } from "../enums/unsubscribe.js";
2
+ import { useUnsubscribeApi as p } from "../services/unsubscribeApi.js";
3
+ import { defineStore as r } from "pinia";
4
+ const a = () => ({
5
+ templates: [],
6
+ selectedTemplates: {},
7
+ selectedUnsubscribePages: [],
8
+ selectedCollectionType: o.GLOBAL_UNSUBSCRIBE,
9
+ activeType: o.GLOBAL_UNSUBSCRIBE,
10
+ pageSelectionUpdateStatus: !1,
11
+ pageSelectionDrawerStatus: !1,
12
+ typeSelectionDrawerStatus: !1,
13
+ isGlobalUnsubscribeDisabled: !1,
14
+ isSubscriptionPreferencesCenterDisabled: !1
15
+ }), u = r("unsubscribe", {
16
+ state: () => a(),
17
+ getters: {
18
+ getSelectedCollection: (e) => l[e.selectedCollectionType],
19
+ getSelectedTemplateByActiveType: (e) => e.selectedTemplates[e.activeType],
20
+ getTemplatesByActiveType: (e) => e.templates.filter((t) => t.type === e.activeType),
21
+ isActiveTypeFirstInCollection: (e) => {
22
+ const t = l[e.selectedCollectionType];
23
+ return e.activeType === t[0];
24
+ },
25
+ isActiveTypeLastInCollection: (e) => {
26
+ const t = l[e.selectedCollectionType];
27
+ return e.activeType === t[t.length - 1];
28
+ },
29
+ hasTemplatesByCollectionType: (e) => {
30
+ const t = {};
31
+ return l[e.selectedCollectionType].forEach((s) => {
32
+ t[s] = e.templates.some((i) => i.type === s);
33
+ }), t;
34
+ }
35
+ },
36
+ actions: {
37
+ $reset() {
38
+ const { templates: e, selectedUnsubscribePages: t } = this;
39
+ Object.assign(this, {
40
+ ...a(),
41
+ templates: e,
42
+ selectedUnsubscribePages: t
43
+ });
44
+ },
45
+ async fetchTemplates() {
46
+ if (this.templates.length)
47
+ return;
48
+ const { getUnsubscribePages: e } = p(), t = await e();
49
+ this.templates = t;
50
+ },
51
+ setCollection(e) {
52
+ this.selectedCollectionType = e;
53
+ const t = l[e];
54
+ if (t && t.length > 0) {
55
+ [this.activeType] = t;
56
+ const c = { ...this.selectedTemplates };
57
+ t.forEach((s) => {
58
+ if (!c[s]) {
59
+ const i = this.templates.find((n) => n.type === s);
60
+ i && (c[s] = i.id);
61
+ }
62
+ }), this.selectedTemplates = c;
63
+ }
64
+ },
65
+ setCollectionWithoutAutoSelection(e) {
66
+ this.selectedCollectionType = e;
67
+ const t = l[e];
68
+ t && t.length > 0 && ([this.activeType] = t);
69
+ },
70
+ setSelectedTemplate(e) {
71
+ this.selectedTemplates = {
72
+ ...this.selectedTemplates,
73
+ [this.activeType]: e
74
+ };
75
+ },
76
+ setNextType() {
77
+ const t = this.getSelectedCollection.indexOf(this.activeType) + 1;
78
+ t < this.getSelectedCollection.length && (this.activeType = this.getSelectedCollection[t]);
79
+ },
80
+ setPreviousType() {
81
+ const t = this.getSelectedCollection.indexOf(this.activeType) - 1;
82
+ t >= 0 && (this.activeType = this.getSelectedCollection[t]);
83
+ },
84
+ loadSelectedTemplates(e) {
85
+ const t = new Map(this.templates.map((s) => [s.id, s.type])), c = { ...this.selectedTemplates };
86
+ e.forEach((s) => {
87
+ const i = t.get(s);
88
+ i !== void 0 && (c[i] = s);
89
+ }), this.selectedTemplates = c;
90
+ },
91
+ getThumbnailByTemplateId(e) {
92
+ var t;
93
+ return ((t = this.templates.find((c) => c.id === e)) == null ? void 0 : t.thumbnail) ?? "";
94
+ },
95
+ getSelectedTemplatesByCollection(e) {
96
+ const t = l[e], c = [];
97
+ return t.forEach((s) => {
98
+ this.selectedTemplates[s] && c.push(this.selectedTemplates[s]);
99
+ }), c;
100
+ },
101
+ addUnsubscribePages(e) {
102
+ const t = /* @__PURE__ */ new Set([...this.selectedUnsubscribePages, ...e]);
103
+ this.selectedUnsubscribePages = Array.from(t);
104
+ },
105
+ removeUnsubscribePages(e) {
106
+ this.selectedUnsubscribePages = this.selectedUnsubscribePages.filter(
107
+ (t) => !e.includes(t)
108
+ );
109
+ },
110
+ getSelectedUnsubscribePagesByCollection(e) {
111
+ const t = l[e];
112
+ if (!t)
113
+ return [];
114
+ const c = /* @__PURE__ */ new Map();
115
+ this.templates.forEach((i) => {
116
+ c.set(i.id, i.type);
117
+ });
118
+ const s = new Set(t);
119
+ return this.selectedUnsubscribePages.filter((i) => {
120
+ const n = c.get(i);
121
+ return n !== void 0 && s.has(n);
122
+ });
123
+ }
124
+ }
6
125
  });
7
126
  export {
8
- r as useUnsubscribeStore
127
+ u as useUnsubscribeStore
9
128
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.2-beta.ab357f5",
3
+ "version": "1.0.2-beta.ad1dcd9",
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": "1.0.6",
34
+ "@stripoinc/ui-editor-extensions": "2.0.2",
35
35
  "@useinsider/design-system-vue": "0.14.8",
36
36
  "@vueuse/core": "11.3.0",
37
37
  "lodash-es": "4.17.21",
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var s = {};
2
- export {
3
- s as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var t = {};
2
- export {
3
- t as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var e = {};
2
- export {
3
- e as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var e = {};
2
- export {
3
- e as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var a = {};
2
- export {
3
- a as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var o = {};
2
- export {
3
- o as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var t = {};
2
- export {
3
- t as __exports
4
- };
@@ -1,4 +0,0 @@
1
- var t = {};
2
- export {
3
- t as __exports
4
- };