@useinsider/guido 2.1.0-beta.7d0f92a → 2.1.0-beta.84a7014

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 (90) hide show
  1. package/README.md +77 -2
  2. package/dist/@types/config/schemas.js +70 -65
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +73 -62
  5. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue.js +1 -1
  6. package/dist/components/organisms/unsubscribe/UnsubscribePageSelection.vue2.js +19 -19
  7. package/dist/composables/useBlocksConfig.js +26 -16
  8. package/dist/composables/useHtmlValidator.js +107 -119
  9. package/dist/composables/useSave.js +16 -12
  10. package/dist/composables/useStripo.js +63 -57
  11. package/dist/composables/useStripoEventHandler.js +27 -12
  12. package/dist/composables/useSyncModuleExtractor.js +45 -0
  13. package/dist/composables/useVersionHistoryApi.js +1 -1
  14. package/dist/config/compiler/utils/recommendationCompilerUtils.js +27 -22
  15. package/dist/config/i18n/en/index.js +11 -0
  16. package/dist/config/i18n/en/labels.json.js +7 -0
  17. package/dist/config/i18n/en/toasters.json.js +56 -0
  18. package/dist/config/i18n/en/tooltips.json.js +82 -0
  19. package/dist/config/i18n/index.js +7 -0
  20. package/dist/config/migrator/itemsBlockMigrator.js +127 -122
  21. package/dist/enums/defaults.js +8 -4
  22. package/dist/enums/unsubscribe.js +25 -21
  23. package/dist/extensions/Blocks/Recommendation/block.js +26 -23
  24. package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +27 -26
  25. package/dist/extensions/Blocks/Recommendation/constants/layout.js +6 -4
  26. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +12 -10
  27. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +103 -70
  28. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +87 -37
  29. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +138 -117
  30. package/dist/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.js +21 -0
  31. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +117 -107
  32. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +25 -30
  33. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +27 -30
  34. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +20 -25
  35. package/dist/extensions/Blocks/Recommendation/templates/utils.js +43 -31
  36. package/dist/extensions/Blocks/Unsubscribe/block.js +29 -29
  37. package/dist/extensions/Blocks/Unsubscribe/control.js +12 -9
  38. package/dist/extensions/Blocks/Unsubscribe/elements/preview.js +13 -11
  39. package/dist/extensions/Blocks/Unsubscribe/styles.css.js +31 -1
  40. package/dist/extensions/ModulesTabIcons/extension.js +17 -0
  41. package/dist/guido.css +1 -1
  42. package/dist/node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js +257 -187
  43. package/dist/services/recommendationApi.js +11 -9
  44. package/dist/services/stripoApi.js +56 -17
  45. package/dist/src/@types/config/schemas.d.ts +9 -1
  46. package/dist/src/@types/events.d.ts +38 -2
  47. package/dist/src/components/Guido.vue.d.ts +2 -2
  48. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  49. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  50. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  51. package/dist/src/composables/useConfig.d.ts +4 -0
  52. package/dist/src/composables/useGuidoActions.d.ts +1 -1
  53. package/dist/src/composables/useSave.d.ts +2 -2
  54. package/dist/src/composables/useStripo.d.ts +2 -2
  55. package/dist/src/composables/useSyncModuleExtractor.d.ts +4 -0
  56. package/dist/src/config/i18n/en/index.d.ts +1 -0
  57. package/dist/src/config/i18n/index.d.ts +16 -0
  58. package/dist/src/enums/defaults.d.ts +4 -0
  59. package/dist/src/enums/unsubscribe.d.ts +3 -0
  60. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +2 -2
  61. package/dist/src/extensions/Blocks/Recommendation/constants/layout.d.ts +6 -0
  62. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +4 -0
  63. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +12 -1
  64. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +22 -4
  65. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +9 -2
  66. package/dist/src/extensions/Blocks/Recommendation/controls/mobileLayout/cssRules.d.ts +29 -0
  67. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +7 -0
  68. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +1 -1
  69. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +2 -0
  70. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +12 -3
  71. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  72. package/dist/src/extensions/Blocks/Unsubscribe/control.d.ts +1 -0
  73. package/dist/src/extensions/ModulesTabIcons/extension.d.ts +2 -0
  74. package/dist/src/mock/api/settings.d.ts +2 -0
  75. package/dist/src/services/stripoApi.d.ts +5 -0
  76. package/dist/src/stores/config.d.ts +36 -0
  77. package/dist/src/stores/editor.d.ts +23 -0
  78. package/dist/src/utils/templatePreparation.d.ts +1 -1
  79. package/dist/static/styles/components/notification.css.js +19 -0
  80. package/dist/static/styles/components/tools.css.js +6 -2
  81. package/dist/static/styles/components/version-history.css.js +10 -2
  82. package/dist/static/styles/components/wide-panel.css.js +18 -2
  83. package/dist/static/styles/customEditorStyle.css.js +10 -9
  84. package/dist/static/styles/variables.css.js +2 -0
  85. package/dist/static/templates/empty/index.html.js +74 -0
  86. package/dist/static/templates/empty/style.css.js +779 -0
  87. package/dist/stores/editor.js +2 -1
  88. package/dist/stores/unsubscribe.js +37 -34
  89. package/dist/utils/templatePreparation.js +1 -1
  90. package/package.json +1 -1
@@ -1,15 +1,15 @@
1
- import { defineComponent as f, ref as y, computed as n, watch as T } from "vue";
2
- import g from "../../wrappers/WpDrawer.vue.js";
3
- import { useToaster as S } from "../../../composables/useToaster.js";
4
- import { useTranslations as v } from "../../../composables/useTranslations.js";
5
- import { ToasterTypeOptions as B } from "../../../enums/toaster.js";
1
+ import { defineComponent as g, ref as y, computed as n, watch as S } from "vue";
2
+ import T from "../../wrappers/WpDrawer.vue.js";
3
+ import { useToaster as v } from "../../../composables/useToaster.js";
4
+ import { useTranslations as B } from "../../../composables/useTranslations.js";
5
+ import { ToasterTypeOptions as C } from "../../../enums/toaster.js";
6
6
  import { useUnsubscribeStore as w } from "../../../stores/unsubscribe.js";
7
- import { InContainer as C } from "@useinsider/design-system-vue";
8
- import h from "./UnsubscribeBreadcrumb.vue.js";
9
- const E = /* @__PURE__ */ f({
7
+ import { InContainer as h } from "@useinsider/design-system-vue";
8
+ import U from "./UnsubscribeBreadcrumb.vue.js";
9
+ const F = /* @__PURE__ */ g({
10
10
  __name: "UnsubscribePageSelection",
11
- setup(_) {
12
- const s = v(), e = w(), { showToaster: a } = S(), o = y(!1), c = n(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = n(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), p = n(() => ({
11
+ setup(P) {
12
+ const s = B(), e = w(), { showToaster: a } = v(), o = y(!1), c = n(() => e.isActiveTypeLastInCollection ? o.value ? s("unsubscription-preference.applying-changes") : s("statistics.apply") : s("products.select-and-continue")), i = n(() => e.pageSelectionUpdateStatus && e.isActiveTypeFirstInCollection ? s("products.cancel") : s("newsletter.back")), u = n(() => ({
13
13
  primaryButton: {
14
14
  styling: "solid",
15
15
  type: "primary",
@@ -23,28 +23,28 @@ const E = /* @__PURE__ */ f({
23
23
  labelText: i.value,
24
24
  disabledStatus: o.value
25
25
  }
26
- })), u = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", r = (t) => {
26
+ })), p = (t) => e.getSelectedTemplateByActiveType === t ? "bor-w-3 bor-s-s bor-c-7" : "bor-w-1 bor-s-s bor-c-6", r = (t) => {
27
27
  e.pageSelectionDrawerStatus = !1, t && setTimeout(() => {
28
28
  t();
29
29
  }, 500);
30
- }, m = () => {
30
+ }, d = () => {
31
31
  if (e.isActiveTypeFirstInCollection) {
32
32
  r(), e.pageSelectionUpdateStatus || (e.typeSelectionDrawerStatus = !0);
33
33
  return;
34
34
  }
35
35
  e.setPreviousType();
36
- }, d = () => {
36
+ }, m = () => {
37
37
  if (e.isActiveTypeLastInCollection) {
38
38
  o.value = !0;
39
- const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t);
40
- e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
39
+ const t = e.selectedCollectionType, l = e.getSelectedTemplatesByCollection(t), f = e.getSelectedUnsubscribePagesByCollection(t);
40
+ e.removeUnsubscribePages(f), e.addUnsubscribePages(l), document.dispatchEvent(new CustomEvent("unsubscribe:select", {
41
41
  detail: {
42
42
  collectionType: t,
43
43
  selectedPages: l
44
44
  }
45
45
  })), r(() => {
46
46
  o.value = !1, a({
47
- type: B.Success,
47
+ type: C.Success,
48
48
  message: s("global-unsubscribe.pages-were-attached")
49
49
  });
50
50
  });
@@ -54,11 +54,11 @@ const E = /* @__PURE__ */ f({
54
54
  }, b = (t) => {
55
55
  e.setSelectedTemplate(t);
56
56
  };
57
- return T(() => e.pageSelectionDrawerStatus, (t) => {
57
+ return S(() => e.pageSelectionDrawerStatus, (t) => {
58
58
  t && e.pageSelectionUpdateStatus && e.fetchTemplates();
59
- }), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: a, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: p, getBorderClass: u, closeModal: r, handleBack: m, handleSave: d, selectTemplate: b, WpDrawer: g, InContainer: C, UnsubscribeBreadcrumb: h };
59
+ }), { __sfc: !0, trans: s, unsubscribeStore: e, showToaster: a, isApplying: o, getPrimaryButtonText: c, getCancelOrBackButtonText: i, footerButtonGroupOptions: u, getBorderClass: p, closeModal: r, handleBack: d, handleSave: m, selectTemplate: b, WpDrawer: T, InContainer: h, UnsubscribeBreadcrumb: U };
60
60
  }
61
61
  });
62
62
  export {
63
- E as default
63
+ F as default
64
64
  };
@@ -1,5 +1,6 @@
1
+ import r from "../extensions/ModulesTabIcons/extension.js";
1
2
  import { useConfigStore as l } from "../stores/config.js";
2
- const r = {
3
+ const a = {
3
4
  "amp-accordion": "ampAccordionEnabled",
4
5
  "amp-carousel": "ampCarouselEnabled",
5
6
  "amp-form-controls": "ampFormControlsEnabled",
@@ -13,7 +14,7 @@ const r = {
13
14
  "text-block": "textEnabled",
14
15
  "timer-block": "timerEnabled",
15
16
  "video-block": "videoEnabled"
16
- }, c = {
17
+ }, s = {
17
18
  "dynamic-content": () => import("../extensions/DynamicContent/extension.js"),
18
19
  "checkbox-block": () => import("../extensions/Blocks/Checkbox/extension.js"),
19
20
  "radio-button-block": () => import("../extensions/Blocks/RadioButton/extension.js"),
@@ -21,31 +22,40 @@ const r = {
21
22
  "unsubscribe-block": () => import("../extensions/Blocks/Unsubscribe/extension.js"),
22
23
  "coupon-block": () => import("../extensions/Blocks/CouponBlock/extension.js"),
23
24
  "items-block": () => import("../extensions/Blocks/Items/extension.js")
24
- }, a = (n) => {
25
+ }, i = (n) => {
25
26
  if (!n || !n.length)
26
27
  return {};
27
- const e = {};
28
+ const t = {};
28
29
  return n.forEach((o) => {
29
- const t = r[o];
30
- t && (e[t] = !1);
31
- }), e;
32
- }, i = async (n) => !n || !n.length ? [] : (await Promise.all(
33
- n.map(async (o) => {
34
- const t = c[o];
35
- return t ? (await t()).default : null;
36
- })
37
- )).filter((o) => o !== null), m = () => {
30
+ const e = a[o];
31
+ e && (t[e] = !1);
32
+ }), t;
33
+ }, b = () => [r], m = async (n) => {
34
+ const t = b();
35
+ if (!n || !n.length)
36
+ return t;
37
+ const o = await Promise.all(
38
+ n.map(async (e) => {
39
+ const c = s[e];
40
+ return c ? (await c()).default : null;
41
+ })
42
+ );
43
+ return [
44
+ ...t,
45
+ ...o.filter((e) => e !== null)
46
+ ];
47
+ }, E = () => {
38
48
  const n = l();
39
49
  return {
40
50
  getStripoBlocksConfig: async () => {
41
51
  const o = n.blocks;
42
52
  return {
43
- baseBlocks: a(o == null ? void 0 : o.excludeDefaults),
44
- extensions: await i(o == null ? void 0 : o.includeCustoms)
53
+ baseBlocks: i(o == null ? void 0 : o.excludeDefaults),
54
+ extensions: await m(o == null ? void 0 : o.includeCustoms)
45
55
  };
46
56
  }
47
57
  };
48
58
  };
49
59
  export {
50
- m as useBlocksConfig
60
+ E as useBlocksConfig
51
61
  };
@@ -1,171 +1,159 @@
1
- import { useConfig as D } from "./useConfig.js";
2
- import { TemplateTypes as L } from "../enums/defaults.js";
3
- import { DISPLAY_CONDITIONS_REGEX as V, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as M, CanNotMakeAnyChangesForRunningKey as $ } from "../enums/html-validator.js";
4
- import { ToasterTypeOptions as l } from "../enums/toaster.js";
5
- import { itemsBlockDynamicVariables as P } from "../extensions/Blocks/Items/enums/productEnums.js";
6
- import { useRecommendationExtensionStore as j } from "../extensions/Blocks/Recommendation/store/recommendation.js";
7
- import { useRecommendationStore as G } from "../stores/recommendation.js";
8
- import { base64EncodeWithSpecialChars as q } from "../utils/base64.js";
9
- import { useHttp as z } from "./useHttp.js";
10
- import { useToaster as U } from "./useToaster.js";
11
- import { useTranslations as X } from "./useTranslations.js";
12
- const K = [
13
- "img",
14
- "url",
15
- "name",
16
- "price",
17
- "currency",
18
- "original_price",
19
- "omnibus_price",
20
- "omnibus_discount"
21
- ];
22
- function Y() {
23
- const a = j();
24
- return Object.keys(a.blockStates).flatMap((d) => {
25
- const f = a.blockStates[Number(d)], i = parseInt(f.recommendationConfigs.size) || 10;
26
- return Array.from({ length: i }, (m, u) => u).flatMap((m) => K.map((u) => `${d}_${m}_${u}`));
27
- });
1
+ import { useConfig as L } from "./useConfig.js";
2
+ import { TemplateTypes as V } from "../enums/defaults.js";
3
+ import { DISPLAY_CONDITIONS_REGEX as _, DISPLAY_CONDITIONS_EXCEPTIONS_REGEX as H, CampaignCouldNotBeSavedKey as P, CanNotMakeAnyChangesForRunningKey as G } from "../enums/html-validator.js";
4
+ import { ToasterTypeOptions as c } from "../enums/toaster.js";
5
+ import { itemsBlockDynamicVariables as M } from "../extensions/Blocks/Items/enums/productEnums.js";
6
+ import { useRecommendationStore as $ } from "../stores/recommendation.js";
7
+ import { base64EncodeWithSpecialChars as X } from "../utils/base64.js";
8
+ import { useHttp as j } from "./useHttp.js";
9
+ import { useToaster as q } from "./useToaster.js";
10
+ import { useTranslations as z } from "./useTranslations.js";
11
+ const K = /recommendation-id="(\d+)"/g;
12
+ function U(i) {
13
+ return [...i.matchAll(K)].map((u) => u[1]);
28
14
  }
29
- const le = () => {
30
- var p, y;
31
- const { showToaster: a } = U(), { post: d } = z(), { config: f } = D(), i = X(), g = G(), m = ((y = (p = f.value) == null ? void 0 : p.partner) == null ? void 0 : y.messageType) === L.transactional, u = async (e) => {
32
- const t = await d(
15
+ function Y(i, u) {
16
+ return u.some((d) => i.startsWith(`${d}_`));
17
+ }
18
+ const ce = () => {
19
+ var y, h;
20
+ const { showToaster: i } = q(), { post: u } = j(), { config: d } = L(), r = z(), g = $(), p = ((h = (y = d.value) == null ? void 0 : y.partner) == null ? void 0 : h.messageType) === V.transactional, w = async (e) => {
21
+ const t = await u(
33
22
  "/newsletter/template-library/check-template-html-body",
34
- { html: q(e) }
35
- ), { status: n, message: c } = t.data;
36
- return n || a({
37
- type: l.Alert,
38
- message: n === void 0 ? c : i("newsletter.invalid-url-link-for-toaster")
39
- }), i(M), c === i($) && a({
40
- type: l.Alert,
41
- message: i("newsletter.already-in-progress")
23
+ { html: X(e) }
24
+ ), { status: n, message: l } = t.data;
25
+ return n || i({
26
+ type: c.Alert,
27
+ message: n === void 0 ? l : r("newsletter.invalid-url-link-for-toaster")
28
+ }), r(P), l === r(G) && i({
29
+ type: c.Alert,
30
+ message: r("newsletter.already-in-progress")
42
31
  }), n;
43
- }, b = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), w = (e, s) => {
32
+ }, b = (e) => !["if", "endif", "else", "elif", "now"].includes(e.toLowerCase()), S = (e) => ["if", "endif"].includes(e.toLowerCase()), E = (e, s) => {
44
33
  const t = e.match(/({%(.*?)%})/g);
45
34
  let n = !0;
46
- return t !== null && !m && t.forEach((c) => {
47
- const o = c.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
35
+ return t !== null && !p && t.forEach((l) => {
36
+ const o = l.slice(2, -2).trim().match(/(".*?"|[^"\s]+)(?=\s*|\s*$)/g);
48
37
  if (o && o.length > 0) {
49
- const [r] = o;
50
- b(r) && !s.includes(r) && (a({
51
- type: l.Warning,
52
- message: i("custom-fields.invalid-custom-fields")
38
+ const [a] = o;
39
+ b(a) && !s.includes(a) && (i({
40
+ type: c.Warning,
41
+ message: r("custom-fields.invalid-custom-fields")
53
42
  }), n = !1);
54
43
  }
55
44
  }), n;
56
- }, E = async (e, s, t) => {
57
- const n = t ? await u(e) : !0;
58
- return w(e, s) && n;
59
- }, A = (e) => e.length > 0 ? !0 : (a({
60
- type: l.Warning,
61
- message: i("newsletter.html-content-is-empty")
45
+ }, A = async (e, s, t) => {
46
+ const n = t ? await w(e) : !0;
47
+ return E(e, s) && n;
48
+ }, I = (e) => e.length > 0 ? !0 : (i({
49
+ type: c.Warning,
50
+ message: r("newsletter.html-content-is-empty")
62
51
  }), !1), k = (e) => {
63
52
  const s = (e.match(/{/gm) || []).length, t = (e.match(/}/gm) || []).length;
64
- return s > t && a({
65
- type: l.Warning,
66
- message: i("custom-fields.missing-closing-braces")
67
- }), s < t && a({
68
- type: l.Warning,
69
- message: i("custom-fields.missing-opening-braces")
53
+ return s > t && i({
54
+ type: c.Warning,
55
+ message: r("custom-fields.missing-closing-braces")
56
+ }), s < t && i({
57
+ type: c.Warning,
58
+ message: r("custom-fields.missing-opening-braces")
70
59
  }), s === t;
71
60
  }, x = (e) => {
72
61
  const s = e.match(/{{\s*(\w+\s+((\w+\|\w+)|(\w+)))\s*}}/gm) === null;
73
- return s || a({
74
- type: l.Warning,
75
- message: i("custom-fields.invalid-custom-fields")
62
+ return s || i({
63
+ type: c.Warning,
64
+ message: r("custom-fields.invalid-custom-fields")
76
65
  }), s;
77
66
  }, T = (e, s) => {
78
67
  const t = e.match(/{{([a-zA-Z0-9_\s]*)}}/gm);
79
- if (t && !m) {
80
- const n = new Set(s.map((o) => o.toLowerCase())), c = [];
81
- if (t.forEach((o) => {
82
- const r = o.slice(2, -2).trim().toLowerCase();
83
- (!n.has(r) || r === "") && c.push(r);
84
- }), c.length > 0) {
85
- const o = `
68
+ if (t && !p) {
69
+ const n = new Set(s.map((a) => a.toLowerCase())), l = U(e), o = [];
70
+ if (t.forEach((a) => {
71
+ const m = a.slice(2, -2).trim().toLowerCase();
72
+ (!n.has(m) || m === "") && !Y(m, l) && o.push(m);
73
+ }), o.length > 0) {
74
+ const a = `
86
75
  <ul>
87
- ${c.map((r) => `<li>${r}</li>`).join("")}
76
+ ${o.map((m) => `<li>${m}</li>`).join("")}
88
77
  </ul>
89
78
  `;
90
- return a({
91
- type: l.Alert,
92
- message: i("custom-fields.invalid-custom-fields") + o
79
+ return i({
80
+ type: c.Alert,
81
+ message: r("custom-fields.invalid-custom-fields") + a
93
82
  }), !1;
94
83
  }
95
84
  }
96
85
  return !0;
97
- }, I = (e) => {
86
+ }, F = (e) => {
98
87
  const s = e.match(/{%(.*?)%}/g), t = [];
99
88
  let n = !0;
100
- if (s && s.forEach((c) => {
101
- const o = c.match(V), r = c.match(H), B = (o == null ? void 0 : o.join("")) || "";
102
- (!o || c !== B) && !r && (a({
103
- type: l.Alert,
104
- message: i("newsletter.display-conditions-invalid-syntax")
105
- }), n = !1), o && o.forEach((h) => {
106
- h.trim() === "=" && (a({
107
- type: l.Alert,
108
- message: i("custom-conditions.wrong-equality-operators")
89
+ if (s && s.forEach((l) => {
90
+ const o = l.match(_), a = l.match(H), m = (o == null ? void 0 : o.join("")) || "";
91
+ (!o || l !== m) && !a && (i({
92
+ type: c.Alert,
93
+ message: r("newsletter.display-conditions-invalid-syntax")
94
+ }), n = !1), o && o.forEach((f) => {
95
+ f.trim() === "=" && (i({
96
+ type: c.Alert,
97
+ message: r("custom-conditions.wrong-equality-operators")
109
98
  }), n = !1);
110
- const C = h.match(/^[a-zA-Z]*$/g);
111
- C && C.forEach((v) => {
112
- S(v) && t.push(v);
99
+ const v = f.match(/^[a-zA-Z]*$/g);
100
+ v && v.forEach((C) => {
101
+ S(C) && t.push(C);
113
102
  });
114
103
  });
115
104
  }), t.length) {
116
- const c = t.filter((r) => r === "if"), o = t.filter((r) => r === "endif");
117
- c.length !== o.length && (a({
118
- type: l.Alert,
119
- message: i("custom-conditions.missing-if-endif-tag")
105
+ const l = t.filter((a) => a === "if"), o = t.filter((a) => a === "endif");
106
+ l.length !== o.length && (i({
107
+ type: c.Alert,
108
+ message: r("custom-conditions.missing-if-endif-tag")
120
109
  }), n = !1);
121
110
  }
122
111
  return n;
123
- }, F = (e) => {
112
+ }, W = (e) => {
124
113
  const s = (e.match(/{% /gm) || []).length, t = (e.match(/ %}/gm) || []).length, n = s === t;
125
- return n || a({
126
- type: l.Warning,
127
- message: i("custom-conditions.no-space-after-braces")
114
+ return n || i({
115
+ type: c.Warning,
116
+ message: r("custom-conditions.no-space-after-braces")
128
117
  }), n;
129
- }, _ = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (a({
130
- type: l.Warning,
131
- message: i("custom-conditions.no-braces-inside-if-tag")
132
- }), !1) : !0, N = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (a({
133
- type: l.Alert,
134
- message: i("newsletter.fill-all-necessary-fields")
135
- }), !1) : !0, O = (e) => {
118
+ }, N = (e) => (e.match(/({%(.*?)%})/g) || []).filter((t) => t.includes("if")).map((t) => (t.match(/{{.*}}/gm) || []).length).reduce((t, n) => t + n, 0) > 0 ? (i({
119
+ type: c.Warning,
120
+ message: r("custom-conditions.no-braces-inside-if-tag")
121
+ }), !1) : !0, O = () => g.recommendationConfigs && Object.values(g.recommendationConfigs).find((s) => s.filters.find((t) => t.value === "")) !== void 0 ? (i({
122
+ type: c.Alert,
123
+ message: r("newsletter.fill-all-necessary-fields")
124
+ }), !1) : !0, B = (e) => {
136
125
  const s = /src="[^"]*\.(svg|pst)"/gm;
137
- return e.match(s) === null ? !0 : (a({
138
- type: l.Alert,
139
- message: i("newsletter.invalid-image-type")
126
+ return e.match(s) === null ? !0 : (i({
127
+ type: c.Alert,
128
+ message: r("newsletter.invalid-image-type")
140
129
  }), !1);
141
- }, W = (e) => {
130
+ }, R = (e) => {
142
131
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".checkbox-block-v2");
143
132
  return Array.from(n).find((o) => {
144
- var r;
145
- return !((r = o.id) != null && r.trim());
146
- }) ? (a({
147
- type: l.Alert,
148
- message: i("unsubscribe-templates.select-checkbox-groups")
133
+ var a;
134
+ return !((a = o.id) != null && a.trim());
135
+ }) ? (i({
136
+ type: c.Alert,
137
+ message: r("unsubscribe-templates.select-checkbox-groups")
149
138
  }), !1) : !0;
150
- }, R = (e) => {
139
+ }, D = (e) => {
151
140
  const n = new DOMParser().parseFromString(e, "text/html").querySelectorAll(".radio-button-v2");
152
141
  return Array.from(n).find((o) => {
153
- var r;
154
- return !((r = o.id) != null && r.trim());
155
- }) ? (a({
156
- type: l.Alert,
157
- message: i("unsubscribe-templates.select-radio-button-groups")
142
+ var a;
143
+ return !((a = o.id) != null && a.trim());
144
+ }) ? (i({
145
+ type: c.Alert,
146
+ message: r("unsubscribe-templates.select-radio-button-groups")
158
147
  }), !1) : !0;
159
148
  };
160
149
  return { validateHtml: async (e, s, t = !1) => {
161
150
  const n = [
162
151
  ...s.map((o) => o.value),
163
- ...P,
164
- ...Y()
152
+ ...M
165
153
  ];
166
- return await E(e, n, t) && A(e) && k(e) && x(e) && T(e, n) && I(e) && F(e) && _(e) && N() && O(e) && W(e) && R(e);
154
+ return await A(e, n, t) && I(e) && k(e) && x(e) && T(e, n) && F(e) && W(e) && N(e) && O() && B(e) && R(e) && D(e);
167
155
  } };
168
156
  };
169
157
  export {
170
- le as useHtmlValidator
158
+ ce as useHtmlValidator
171
159
  };
@@ -1,17 +1,21 @@
1
- import { useConfig as l } from "./useConfig.js";
2
- import { useSaveStart as m, useSaveComplete as c } from "./useGuidoActions.js";
3
- import { useTemplatePreparation as d } from "../utils/templatePreparation.js";
4
- import { useHtmlValidator as p } from "./useHtmlValidator.js";
5
- const w = () => {
6
- const i = m(), s = c(), { validateHtml: o } = p(), { callbacks: a } = l();
7
- return { save: async (r = !1) => {
1
+ import { useConfig as d } from "./useConfig.js";
2
+ import { useSaveStart as p, useSaveComplete as f } from "./useGuidoActions.js";
3
+ import { useSyncModuleExtractor as v } from "./useSyncModuleExtractor.js";
4
+ import { useStripoApi as S } from "../services/stripoApi.js";
5
+ import { useTemplatePreparation as x } from "../utils/templatePreparation.js";
6
+ import { useHtmlValidator as V } from "./useHtmlValidator.js";
7
+ const g = () => {
8
+ const o = p(), s = f(), { validateHtml: i } = V(), { callbacks: a } = d(), { extractSyncModuleData: r } = v(), { setSyncModuleUnsubscriptionPages: n } = S();
9
+ return { save: async (l = !1) => {
8
10
  var e;
9
- i();
10
- const { prepareTemplateDetails: n } = d(), t = await n();
11
- if (await o(t.compiledHtml, t.dynamicContentList, !0) && !((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)))
12
- return r || s(t), t;
11
+ o();
12
+ const { prepareTemplateDetails: c } = x(), t = await c();
13
+ if (!await i(t.compiledHtml, t.dynamicContentList, !0) || (e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t))
14
+ return;
15
+ const { unsubscribePayload: m, stripoModules: u } = r(t.rawHtml);
16
+ return await n(m), t.modules = u, l || s(t), t;
13
17
  } };
14
18
  };
15
19
  export {
16
- w as useSave
20
+ g as useSave
17
21
  };