@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,120 +1,139 @@
1
- import { useConfig as V } from "./useConfig.js";
2
- import { TemplateTypes as H } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as O, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as B, CampaignCouldNotBeSavedKey as _, CanNotMakeAnyChangesForRunningKey as R } from "../enums/html-validator.js";
4
- import { ToasterTypeOptions as r } from "../enums/toaster.js";
5
- import { useRecommendationStore as D } from "../stores/recommendation.js";
6
- import { base64EncodeWithSpecialChars as P } from "../utils/base64.js";
7
- import { useHttp as X } from "./useHttp.js";
8
- import { useToaster as j } from "./useToaster.js";
9
- import { useTranslations as z } from "./useTranslations.js";
10
- const tt = () => {
1
+ import { useConfig as H } from "./useConfig.js";
2
+ import { TemplateTypes as V } from "../enums/defaults.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as B, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as _, CampaignCouldNotBeSavedKey as D, CanNotMakeAnyChangesForRunningKey as P } from "../enums/html-validator.js";
4
+ import { ToasterTypeOptions as l } from "../enums/toaster.js";
5
+ import { useRecommendationStore as R } from "../stores/recommendation.js";
6
+ import { base64EncodeWithSpecialChars as $ } from "../utils/base64.js";
7
+ import { useHttp as j } from "./useHttp.js";
8
+ import { useToaster as G } from "./useToaster.js";
9
+ import { useTranslations as X } from "./useTranslations.js";
10
+ const te = () => {
11
11
  var d;
12
- const { showToaster: a } = j(), { post: y } = X(), { config: C } = V(), i = z(), m = D(), f = ((d = C.partner) == null ? void 0 : d.messageType) === H.transactional, h = async (t) => {
13
- const e = await y(
12
+ const { showToaster: c } = G(), { post: y } = j(), { config: h } = H(), o = X(), m = R(), u = ((d = h.partner) == null ? void 0 : d.messageType) === V.transactional, C = async (e) => {
13
+ const t = await y(
14
14
  "/newsletter/template-library/check-template-html-body",
15
- { html: P(t) }
16
- ), { status: n, message: c } = e.data;
17
- return n || a({
18
- type: r.Alert,
19
- message: n === void 0 ? c : i("newsletter.invalid-url-link-for-toaster")
20
- }), i(_), c === i(R) && a({
21
- type: r.Alert,
22
- message: i("newsletter.already-in-progress")
15
+ { html: $(e) }
16
+ ), { status: n, message: a } = t.data;
17
+ return n || c({
18
+ type: l.Alert,
19
+ message: n === void 0 ? a : o("newsletter.invalid-url-link-for-toaster")
20
+ }), o(D), a === o(P) && c({
21
+ type: l.Alert,
22
+ message: o("newsletter.already-in-progress")
23
23
  }), n;
24
- }, v = (t) => !["if", "endif", "else", "elif", "now"].includes(t.toLowerCase()), w = (t) => ["if", "endif"].includes(t.toLowerCase()), S = (t, s) => {
25
- const e = t.match(/({%(.*?)%})/g);
24
+ }, v = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), w = (e) => ["if", "endif"].includes(e.toLowerCase()), S = (e, s) => {
25
+ const t = e.match(/({%(.*?)%})/g);
26
26
  let n = !0;
27
- return e !== null && !f && e.forEach((c) => {
28
- const o = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
29
- if (o && o.length > 0) {
30
- const [l] = o;
31
- v(l) && !s.includes(l) && (a({
32
- type: r.Warning,
33
- message: i("custom-fields.invalid-custom-fields")
27
+ return t !== null && !u && t.forEach((a) => {
28
+ const i = a.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
29
+ if (i && i.length > 0) {
30
+ const [r] = i;
31
+ v(r) && !s.includes(r) && (c({
32
+ type: l.Warning,
33
+ message: o("custom-fields.invalid-custom-fields")
34
34
  }), n = !1);
35
35
  }
36
36
  }), n;
37
- }, E = async (t, s, e) => {
38
- const n = e ? await h(t) : !0;
39
- return S(t, s) && n;
40
- }, T = (t) => t.length > 0 ? !0 : (a({
41
- type: r.Warning,
42
- message: i("newsletter.html-content-is-empty")
43
- }), !1), I = (t) => {
44
- const s = (t.match(/{/gm) || []).length, e = (t.match(/}/gm) || []).length;
45
- return s > e && a({
46
- type: r.Warning,
47
- message: i("custom-fields.missing-closing-braces")
48
- }), s < e && a({
49
- type: r.Warning,
50
- message: i("custom-fields.missing-opening-braces")
51
- }), s === e;
52
- }, A = (t) => {
53
- const s = t.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
54
- return s || a({
55
- type: r.Warning,
56
- message: i("custom-fields.invalid-custom-fields")
37
+ }, b = async (e, s, t) => {
38
+ const n = t ? await C(e) : !0;
39
+ return S(e, s) && n;
40
+ }, E = (e) => e.length > 0 ? !0 : (c({
41
+ type: l.Warning,
42
+ message: o("newsletter.html-content-is-empty")
43
+ }), !1), A = (e) => {
44
+ const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
45
+ return s > t && c({
46
+ type: l.Warning,
47
+ message: o("custom-fields.missing-closing-braces")
48
+ }), s < t && c({
49
+ type: l.Warning,
50
+ message: o("custom-fields.missing-opening-braces")
51
+ }), s === t;
52
+ }, x = (e) => {
53
+ const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
54
+ return s || c({
55
+ type: l.Warning,
56
+ message: o("custom-fields.invalid-custom-fields")
57
57
  }), s;
58
- }, W = (t, s) => {
59
- const e = t.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
60
- if (e && !f) {
61
- const n = s.map((o) => o.toLowerCase()), c = e.some((o) => {
62
- const l = o.replace("{{", "").replace("}}", "").trim().toLowerCase();
63
- return !n.includes(l) || l === "";
64
- });
65
- return c && a({
66
- type: r.Warning,
67
- message: i("custom-fields.invalid-custom-fields")
68
- }), !c;
58
+ }, T = (e, s) => {
59
+ const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
60
+ if (t && !u) {
61
+ const n = new Set(s.map((i) => i.toLowerCase())), a = [];
62
+ if (t.forEach((i) => {
63
+ const r = i.slice(2, -2).trim().toLowerCase();
64
+ (!n.has(r) || r === "") && a.push(r);
65
+ }), a.length > 0) {
66
+ const i = `
67
+ <ul>
68
+ ${a.map((r) => `<li>${r}</li>`).join("")}
69
+ </ul>
70
+ `;
71
+ return c({
72
+ type: l.Alert,
73
+ message: o("custom-fields.invalid-custom-fields") + i
74
+ }), !1;
75
+ }
69
76
  }
70
77
  return !0;
71
- }, x = (t) => {
72
- const s = t.match(/{%(.*?)%}/g), e = [];
78
+ }, k = (e) => {
79
+ const s = e.match(/{%(.*?)%}/g), t = [];
73
80
  let n = !0;
74
- if (s && s.forEach((c) => {
75
- const o = c.match(O), l = c.match(B), L = (o == null ? void 0 : o.join("")) || "";
76
- (!o || c !== L) && !l && (a({
77
- type: r.Alert,
78
- message: i("newsletter.display-conditions-invalid-syntax")
79
- }), n = !1), o && o.forEach((u) => {
80
- u.trim() === "=" && (a({
81
- type: r.Alert,
82
- message: i("custom-conditions.wrong-equality-operators")
81
+ if (s && s.forEach((a) => {
82
+ const i = a.match(B), r = a.match(_), O = (i == null ? void 0 : i.join("")) || "";
83
+ (!i || a !== O) && !r && (c({
84
+ type: l.Alert,
85
+ message: o("newsletter.display-conditions-invalid-syntax")
86
+ }), n = !1), i && i.forEach((f) => {
87
+ f.trim() === "=" && (c({
88
+ type: l.Alert,
89
+ message: o("custom-conditions.wrong-equality-operators")
83
90
  }), n = !1);
84
- const g = u.match(/^[a-zA-Z]*$/g);
91
+ const g = f.match(/^[a-zA-Z]*$/g);
85
92
  g && g.forEach((p) => {
86
- w(p) && e.push(p);
93
+ w(p) && t.push(p);
87
94
  });
88
95
  });
89
- }), e.length) {
90
- const c = e.filter((l) => l === "if"), o = e.filter((l) => l === "endif");
91
- c.length !== o.length && (a({
92
- type: r.Alert,
93
- message: i("custom-conditions.missing-if-endif-tag")
96
+ }), t.length) {
97
+ const a = t.filter((r) => r === "if"), i = t.filter((r) => r === "endif");
98
+ a.length !== i.length && (c({
99
+ type: l.Alert,
100
+ message: o("custom-conditions.missing-if-endif-tag")
94
101
  }), n = !1);
95
102
  }
96
103
  return n;
97
- }, b = (t) => {
98
- const s = (t.match(/{% /gm) || []).length, e = (t.match(/ %}/gm) || []).length, n = s === e;
99
- return n || a({
100
- type: r.Warning,
101
- message: i("custom-conditions.no-space-after-braces")
104
+ }, F = (e) => {
105
+ const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
106
+ return n || c({
107
+ type: l.Warning,
108
+ message: o("custom-conditions.no-space-after-braces")
102
109
  }), n;
103
- }, N = (t) => (t.match(/({%(.*?)%})/g) || []).filter((e) => e.includes("if")).map((e) => (e.match(/{{.*}}/gm) || []).length).reduce((e, n) => e + n, 0) > 0 ? (a({
104
- type: r.Warning,
105
- message: i("custom-conditions.no-braces-inside-if-tag")
106
- }), !1) : !0, k = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((e) => e.value === "")) !== void 0 ? (a({
107
- type: r.Alert,
108
- message: i("newsletter.fill-all-necessary-fields")
109
- }), !1) : !0, F = (t) => {
110
+ }, I = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (c({
111
+ type: l.Warning,
112
+ message: o("custom-conditions.no-braces-inside-if-tag")
113
+ }), !1) : !0, W = () => m.recommendationConfigs && Object.values(m.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (c({
114
+ type: l.Alert,
115
+ message: o("newsletter.fill-all-necessary-fields")
116
+ }), !1) : !0, L = (e) => {
110
117
  const s = /src="[^"]*\.(svg|pst)"/gm;
111
- return t.match(s) === null ? !0 : (a({
112
- type: r.Alert,
113
- message: i("newsletter.invalid-image-type")
118
+ return e.match(s) === null ? !0 : (c({
119
+ type: l.Alert,
120
+ message: o("newsletter.invalid-image-type")
114
121
  }), !1);
122
+ }, N = (e) => {
123
+ const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
124
+ return Array.from(n).find((i) => {
125
+ var r;
126
+ return !((r = i.id) != null && r.trim());
127
+ }) ? (c({
128
+ type: l.Alert,
129
+ message: o("unsubscribe-templates.select-checkbox-groups")
130
+ }), !1) : !0;
115
131
  };
116
- return { validateHtml: async (t, s, e = !1) => await E(t, s, e) && T(t) && I(t) && A(t) && W(t, s) && x(t) && b(t) && N(t) && k() && F(t) };
132
+ return { validateHtml: async (e, s, t = !1) => {
133
+ const n = s.map((i) => i.value);
134
+ return await b(e, n, t) && E(e) && A(e) && x(e) && T(e, n) && k(e) && F(e) && I(e) && W() && L(e) && N(e);
135
+ } };
117
136
  };
118
137
  export {
119
- tt as useHtmlValidator
138
+ te as useHtmlValidator
120
139
  };
@@ -1,12 +1,12 @@
1
- import { useSaveStart as i, useSaveComplete as l } from "./useGuidoActions.js";
2
- import { useTemplatePreparation as m } from "../utils/templatePreparation.js";
3
- import { useHtmlValidator as n } from "./useHtmlValidator.js";
1
+ import { useSaveStart as i, useSaveComplete as m } from "./useGuidoActions.js";
2
+ import { useTemplatePreparation as n } from "../utils/templatePreparation.js";
3
+ import { useHtmlValidator as l } from "./useHtmlValidator.js";
4
4
  const f = () => {
5
- const e = i(), a = l(), { validateHtml: s } = n();
5
+ const e = i(), a = m(), { validateHtml: s } = l();
6
6
  return { save: async (o = !1) => {
7
7
  e();
8
- const { prepareTemplateDetails: r } = m(), t = await r();
9
- if (await s(t.compiledHtml, [], !0))
8
+ const { prepareTemplateDetails: r } = n(), t = await r();
9
+ if (await s(t.compiledHtml, t.dynamicContentList, !0))
10
10
  return o || a(t), t;
11
11
  } };
12
12
  };
@@ -1,21 +1,23 @@
1
1
  import { useActionsApi as f } from "./useActionsApi.js";
2
2
  import { useCustomInterfaceAppearance as S } from "./useCustomInterfaceAppearance.js";
3
- import { useStripoEventHandler as C } from "./useStripoEventHandler.js";
4
- import { useToaster as E } from "./useToaster.js";
3
+ import { useStripoEventHandler as E } from "./useStripoEventHandler.js";
4
+ import { useToaster as C } from "./useToaster.js";
5
5
  import { displayConditions as y } from "../enums/displayConditions.js";
6
- import h from "../extensions/DynamicContent/extension.js";
7
- import { useStripoApi as w } from "../services/stripoApi.js";
8
- import b from "../static/styles/customEditorStyle.css.js";
6
+ import h from "../extensions/Blocks/Checkbox/extension.js";
7
+ import w from "../extensions/Blocks/Unsubscribe/extension.js";
8
+ import b from "../extensions/DynamicContent/extension.js";
9
+ import { useStripoApi as _ } from "../services/stripoApi.js";
10
+ import k from "../static/styles/customEditorStyle.css.js";
9
11
  import { useEditorStore as V } from "../stores/editor.js";
10
- import { dynamicContentToMergeTags as _ } from "../utils/genericUtil.js";
11
- const R = (s) => {
12
- const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = w(), { handleEvent: l } = C(), p = (r, i = []) => {
13
- const e = V(), { html: o, css: a, forceRecreate: g } = r;
12
+ import { dynamicContentToMergeTags as B } from "../utils/genericUtil.js";
13
+ const q = (s) => {
14
+ const { handleError: d } = C(), { getToken: c, getCustomFonts: u } = _(), { handleEvent: l } = E(), m = (r, i = []) => {
15
+ const o = V(), { html: e, css: a, forceRecreate: g } = r;
14
16
  window.UIEditor.initEditor(
15
17
  document.querySelector("#guido-editor"),
16
18
  {
17
19
  metadata: s,
18
- html: o,
20
+ html: e,
19
21
  css: a,
20
22
  forceRecreate: g,
21
23
  locale: "en",
@@ -27,7 +29,7 @@ const R = (s) => {
27
29
  customAppearanceMergetags: !0,
28
30
  customAppearanceMergetagsBorderColor: "#f1f3fe",
29
31
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
30
- customViewStyles: b,
32
+ customViewStyles: k,
31
33
  conditionsEnabled: !0,
32
34
  customConditionsEnabled: !0,
33
35
  conditionCategories: y,
@@ -41,7 +43,7 @@ const R = (s) => {
41
43
  },
42
44
  mergeTags: [
43
45
  {
44
- entries: _(s.preselectedDynamicContentList)
46
+ entries: B(s.preselectedDynamicContentList)
45
47
  }
46
48
  ],
47
49
  async onTokenRefreshRequest(t) {
@@ -55,50 +57,54 @@ const R = (s) => {
55
57
  onTemplateLoaded() {
56
58
  try {
57
59
  const { importCss: t } = S(), { activateCustomViewStyles: n } = f();
58
- t(), n(), s.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
59
- e.hasChanges = !1;
60
+ t(), n(), s.onReady(), o.isStripoInitialized = !0, o.loadingStatus = !1, setTimeout(() => {
61
+ o.hasChanges = !1;
60
62
  }, 1e3);
61
63
  } catch (t) {
62
64
  d(t, "Failed to load custom interface appearance");
63
65
  }
64
66
  },
65
67
  onCodeEditorVisibilityChanged(t) {
66
- e.isCodeEditorOpen = t;
68
+ o.isCodeEditorOpen = t;
67
69
  },
68
70
  onEditorVisualModeChanged(t) {
69
- e.editorVisualMode = t.toLowerCase();
71
+ o.editorVisualMode = t.toLowerCase();
70
72
  },
71
73
  onVersionHistoryVisibilityChanged(t) {
72
- e.isVersionHistoryOpen = t;
74
+ o.isVersionHistoryOpen = t;
73
75
  },
74
76
  onDataChanged() {
75
- e.hasChanges = !0;
77
+ o.hasChanges = !0;
76
78
  },
77
79
  onEvent: l,
78
- ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal", ".in-on-board-wrapper"],
79
- extensions: [h]
80
+ ignoreClickOutsideSelectors: [
81
+ "#guido-dynamic-content-modal",
82
+ ".in-on-board-wrapper",
83
+ ".in-drawer__container"
84
+ ],
85
+ extensions: [b, h, w]
80
86
  }
81
87
  );
82
- }, m = (r) => new Promise((i, e) => {
88
+ }, p = (r) => new Promise((i, o) => {
83
89
  if (document.getElementById("UiEditorScript")) {
84
90
  r(), i();
85
91
  return;
86
92
  }
87
- const o = document.createElement("script");
88
- o.id = "UiEditorScript", o.type = "module", o.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", o.onload = () => {
93
+ const e = document.createElement("script");
94
+ e.id = "UiEditorScript", e.type = "module", e.src = "https://plugins.stripo.email/resources/uieditor/latest/UIEditor.js", e.onload = () => {
89
95
  r(), i();
90
- }, o.onerror = () => {
96
+ }, e.onerror = () => {
91
97
  const a = new Error("Failed to load Stripo UIEditor script");
92
- e(a);
93
- }, document.body.appendChild(o);
98
+ o(a);
99
+ }, document.body.appendChild(e);
94
100
  });
95
101
  return { initPlugin: async (r) => {
96
- await m(async () => {
102
+ await p(async () => {
97
103
  const i = await u();
98
- p(r, i);
104
+ m(r, i);
99
105
  });
100
106
  } };
101
107
  };
102
108
  export {
103
- R as useStripo
109
+ q as useStripo
104
110
  };
@@ -1,23 +1,23 @@
1
1
  import { usePartner as m } from "../../composables/usePartner.js";
2
- import { LINK_REGEXES as c, LINK_TYPES as p, URLS as E } from "../../enums/unsubscribe.js";
2
+ import { LINK_REGEXES as l, LINK_TYPES as p, URLS as d } from "../../enums/unsubscribe.js";
3
3
  import { useUnsubscribeStore as b } from "../../stores/unsubscribe.js";
4
4
  const S = [
5
5
  {
6
6
  id: "add-unsubscribe-link-values",
7
7
  description: "Adding unsubscribe link values",
8
8
  type: "custom",
9
- processor: (n) => {
9
+ processor: (t) => {
10
10
  var a, u;
11
- const { getPartnerName: i } = m(), t = b();
12
- let e = n;
13
- const o = `/${i()}/email/0?user={{iid}}`, r = (a = t.selectedUnsubscribePages) == null ? void 0 : a.find((l) => l.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = t.selectedUnsubscribePages) == null ? void 0 : u.find((l) => l.type === p.PREFERENCES_LINK_TYPE);
11
+ const { getPartnerName: n } = m(), i = b();
12
+ let e = t;
13
+ const c = `/${n()}/email/0?user={{iid}}`, r = (a = i.templates) == null ? void 0 : a.find((o) => i.selectedUnsubscribePages.includes(o.id) && o.type === p.UNSUBSCRIBE_LINK_TYPE), s = (u = i.templates) == null ? void 0 : u.find((o) => i.selectedUnsubscribePages.includes(o.id) && o.type === p.PREFERENCES_LINK_TYPE);
14
14
  return r && (e = e.replace(
15
- c.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
16
- E.UNSUBSCRIBE_URL + o
15
+ l.GLOBAL_UNSUBSCRIBE_LINK_REGEX,
16
+ d.UNSUBSCRIBE_URL + c
17
17
  )), s && (e = e.replace(
18
- c.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
19
- E.PREFERENCES_URL + o
20
- )), e.replace(c.UNSUBSCRIBE_LINK_REGEX, "");
18
+ l.PREFERENCES_UNSUBSCRIBE_LINK_REGEX,
19
+ d.PREFERENCES_URL + c
20
+ )), e.replace(l.UNSUBSCRIBE_LINK_REGEX, "");
21
21
  },
22
22
  priority: 60
23
23
  },
@@ -25,7 +25,7 @@ const S = [
25
25
  id: "remove-data-ogsb-button-styles",
26
26
  description: "Removing styles like [data-ogsb] .es-button.es-button-123 { background: red; }",
27
27
  type: "regex",
28
- pattern: c.DATA_OGSB_BUTTON_CSS_REGEX,
28
+ pattern: l.DATA_OGSB_BUTTON_CSS_REGEX,
29
29
  replacement: "",
30
30
  flags: "g",
31
31
  priority: 61
@@ -34,27 +34,27 @@ const S = [
34
34
  id: "format-comment-braces",
35
35
  description: "Adding spaces around comment braces for proper formatting",
36
36
  type: "custom",
37
- processor: (n) => n.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
37
+ processor: (t) => t.replace(/{#/g, "{ #").replace(/#}/g, "# }"),
38
38
  priority: 62
39
39
  },
40
40
  {
41
41
  id: "add-universal-link-flags",
42
42
  description: "Adding universal link flags",
43
43
  type: "custom",
44
- processor: (n) => {
45
- let i = n;
46
- const t = i.match(/<a[^>]+>(.*?)<\/a>/gm);
47
- return t && t.forEach((e) => {
44
+ processor: (t) => {
45
+ let n = t;
46
+ const i = n.match(/<a[^>]+>(.*?)<\/a>/gm);
47
+ return i && i.forEach((e) => {
48
48
  if (e.includes("insEmail=1"))
49
49
  return;
50
50
  if (e.match(/<a\s+(?:[^>]*?\s+)?href=(["'`”])(.*?)\1\s+(?:[^>]*?\s+)?universal=(["'`”])true\3/gm)) {
51
- const o = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
51
+ const c = e.replace(/href=(["'`”])(.*?)\1/gm, (r) => {
52
52
  const s = r.slice(6, r.length - 1).trim();
53
53
  return r.includes("?") || r.includes("#") ? s.slice(-1) === "&" ? r.replace(s, `${s}insEmail=1`) : r.replace(s, `${s}&insEmail=1`) : r.replace(s, `${s}?insEmail=1`);
54
54
  });
55
- i = i.replace(e, o);
55
+ n = n.replace(e, c);
56
56
  }
57
- }), i;
57
+ }), n;
58
58
  },
59
59
  priority: 63
60
60
  }
@@ -0,0 +1 @@
1
+ export declare function migrateCheckbox(html: string): string;
@@ -0,0 +1,83 @@
1
+ var x = Object.defineProperty;
2
+ var y = (s, t, e) => t in s ? x(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var m = (s, t, e) => y(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import b from "../../extensions/Blocks/Checkbox/template.js";
5
+ class f {
6
+ constructor() {
7
+ m(this, "parser");
8
+ this.parser = new DOMParser();
9
+ }
10
+ migrate(t) {
11
+ try {
12
+ const e = this.parser.parseFromString(t, "text/html"), i = e.querySelectorAll("td.checkbox-block");
13
+ return i.length === 0 ? t : (i.forEach((r) => {
14
+ const n = r.getAttribute("id"), l = this.extractTextFromElement(r, "ins-title"), c = this.extractTextFromElement(r, "ins-description"), a = this.buildTextBlock(l), p = this.buildTextBlock(c), g = b.replace("{-{-TITLE-}-}", a).replace("{-{-DESCRIPTION-}-}", p), o = this.parser.parseFromString(
15
+ `<table id="tempDoc"><tbody><tr>${g}</tr></tbody></table>`,
16
+ "text/html"
17
+ ).querySelector(".checkbox-block-v2");
18
+ o && r.parentNode && (o.setAttribute("id", n || ""), r.parentNode.replaceChild(o, r));
19
+ }), e.documentElement.outerHTML);
20
+ } catch (e) {
21
+ return console.error("CheckboxMigrator failed:", e), t;
22
+ }
23
+ }
24
+ extractTextFromElement(t, e) {
25
+ var o, u;
26
+ const i = t.querySelector(`.${e}`);
27
+ if (!i)
28
+ return {
29
+ text: e === "ins-title" ? "Title" : "Description",
30
+ isBold: !1,
31
+ isItalic: !1,
32
+ align: "left",
33
+ styles: ""
34
+ };
35
+ const r = i.querySelector("p");
36
+ if (!r)
37
+ return {
38
+ text: ((o = i.textContent) == null ? void 0 : o.trim()) || (e === "ins-title" ? "Title" : "Description"),
39
+ isBold: !1,
40
+ isItalic: !1,
41
+ align: i.getAttribute("align") || "left",
42
+ styles: ""
43
+ };
44
+ const n = ((u = r.textContent) == null ? void 0 : u.trim()) || (e === "ins-title" ? "Title" : "Description"), l = r.getAttribute("style") || "", c = i.getAttribute("align") || r.getAttribute("align") || "left", a = /font-weight\s*:\s*bold/i.test(l) || !!r.querySelector("b, strong"), p = /font-style\s*:\s*italic/i.test(l) || !!r.querySelector("i, em"), g = this.removeStyleProperties(l, ["font-weight", "font-style"]), d = this.convertInlineToBlock(g);
45
+ return {
46
+ text: n,
47
+ isBold: a,
48
+ isItalic: p,
49
+ align: c,
50
+ styles: d
51
+ };
52
+ }
53
+ buildTextBlock(t) {
54
+ let e = t.text;
55
+ t.isBold && t.isItalic ? e = `<strong path="1,0"><em path="1,0,0">${e}</em></strong>` : t.isBold ? e = `<strong path="1,0">${e}</strong>` : t.isItalic && (e = `<em path="1,0">${e}</em>`);
56
+ const i = t.align ? ` align="${t.align}"` : "", r = t.styles ? ` style="${t.styles}"` : "";
57
+ return `
58
+ <td class="esd-block-text" ${i}>
59
+ <p path="1" ${r}>
60
+ ${e}
61
+ </p>
62
+ </td>
63
+ `;
64
+ }
65
+ removeStyleProperties(t, e) {
66
+ return t ? e.reduce((r, n) => {
67
+ const l = new RegExp(`${n}\\s*:\\s*[^;]*;?`, "gi");
68
+ return r.replace(l, "");
69
+ }, t).replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim() : "";
70
+ }
71
+ convertInlineToBlock(t) {
72
+ if (!t)
73
+ return "";
74
+ let e = t.replace(/display\s*:\s*inline/gi, "display: block");
75
+ return /display\s*:/i.test(e) || (e = e ? `${e}; display: block` : "display: block"), e.replace(/;\s*;/g, ";").replace(/^;|;$/g, "").trim();
76
+ }
77
+ }
78
+ function k(s) {
79
+ return new f().migrate(s);
80
+ }
81
+ export {
82
+ k as migrateCheckbox
83
+ };
@@ -0,0 +1 @@
1
+ export declare const migrate: (html: string) => Promise<string>;
@@ -0,0 +1,9 @@
1
+ import { migrateCheckbox as e } from "./checkboxMigrator.js";
2
+ import { migrateUnsubscribe as m } from "./unsubscribeMigrator.js";
3
+ const o = async (t) => {
4
+ let r = t;
5
+ return r = e(r), r = await m(r), r;
6
+ };
7
+ export {
8
+ o as migrate
9
+ };
@@ -0,0 +1 @@
1
+ export declare function migrateUnsubscribe(html: string): Promise<string>;