@useinsider/guido 3.18.2-beta.eedafd2 → 3.18.2-beta.fc246a7

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 (65) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +26 -28
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +51 -53
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/header/EditorActions.vue.js +2 -2
  7. package/dist/components/organisms/header/EditorActions.vue2.js +56 -86
  8. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  9. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  10. package/dist/components/organisms/save-as-template/SaveAsTemplateDrawer.vue2.js +34 -34
  11. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  12. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  13. package/dist/composables/useHtmlCompiler.js +26 -37
  14. package/dist/composables/useHtmlValidator.js +0 -2
  15. package/dist/composables/useHttp.js +22 -24
  16. package/dist/composables/useSave.js +45 -90
  17. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  18. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  19. package/dist/config/migrator/itemsBlockMigrator.js +257 -167
  20. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  21. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  22. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  23. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  24. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  25. package/dist/extensions/Blocks/Items/template.js +219 -204
  26. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +36 -43
  27. package/dist/guido.css +1 -1
  28. package/dist/services/templateLibraryApi.js +14 -17
  29. package/dist/src/@types/config/schemas.d.ts +0 -4
  30. package/dist/src/components/Guido.vue.d.ts +1 -17
  31. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  32. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  33. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  34. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  35. package/dist/src/composables/useConfig.d.ts +0 -2
  36. package/dist/src/composables/useHtmlValidator.d.ts +0 -21
  37. package/dist/src/composables/useSave.d.ts +1 -6
  38. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  39. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  40. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  41. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  42. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  43. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  44. package/dist/src/stores/config.d.ts +0 -30
  45. package/dist/src/utils/genericUtil.d.ts +0 -6
  46. package/dist/src/utils/templatePreparation.d.ts +0 -30
  47. package/dist/stores/config.js +22 -39
  48. package/dist/utils/genericUtil.js +54 -63
  49. package/dist/utils/pairProductVariables.js +71 -71
  50. package/dist/utils/templatePreparation.js +45 -49
  51. package/package.json +1 -1
  52. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  53. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  54. package/dist/composables/useSaveValidation.js +0 -279
  55. package/dist/composables/useSaveValidationRollout.js +0 -9
  56. package/dist/enums/save-validation.js +0 -4
  57. package/dist/src/@types/save-validation.d.ts +0 -19
  58. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +0 -2
  59. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  60. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  61. package/dist/src/enums/save-validation.d.ts +0 -27
  62. package/dist/src/stores/save-validation.d.ts +0 -22
  63. package/dist/src/utils/liquidDynamicContent.d.ts +0 -20
  64. package/dist/stores/save-validation.js +0 -30
  65. package/dist/utils/liquidDynamicContent.js +0 -15
@@ -1,16 +1,16 @@
1
1
  import o from "./LeftSlot.vue2.js";
2
2
  /* empty css */
3
- import n from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
3
+ import a from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var n = function() {
5
5
  var e = this, s = e._self._c, t = e._self._setupProxy;
6
6
  return s("div", { staticClass: "d-f a-i-c" }, [s(t.InButtonV2, { attrs: { id: "guido__back-button", "left-icon": "line-arrow-left", styling: "ghost", type: "secondary", "disabled-status": t.isBackButtonDisabled, "label-text": t.backButtonLabel, "skeleton-sizing": { width: 150, height: 26 }, "skeleton-status": t.editorStore.loadingStatus }, on: { click: t.handleBackClick } })], 1);
7
- }, i = [], r = /* @__PURE__ */ n(
7
+ }, i = [], r = /* @__PURE__ */ a(
8
8
  o,
9
- a,
9
+ n,
10
10
  i,
11
11
  !1,
12
12
  null,
13
- "b8f24f34"
13
+ "73199fa4"
14
14
  );
15
15
  const f = r.exports;
16
16
  export {
@@ -1,19 +1,19 @@
1
- import { defineComponent as m, computed as p, ref as d } from "vue";
1
+ import { defineComponent as l, computed as p, ref as d } from "vue";
2
2
  import { useConfig as k } from "../../../composables/useConfig.js";
3
3
  import { useBack as B } from "../../../composables/useGuidoActions.js";
4
4
  import { usePreviewMode as b } from "../../../composables/usePreviewMode.js";
5
5
  import { useTranslations as v } from "../../../composables/useTranslations.js";
6
6
  import { useVersionHistoryApi as _ } from "../../../composables/useVersionHistoryApi.js";
7
- import { useEditorStore as y } from "../../../stores/editor.js";
7
+ import { useEditorStore as V } from "../../../stores/editor.js";
8
8
  import { InButtonV2 as w } from "@useinsider/design-system-vue";
9
- import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.js";
10
- const D = /* @__PURE__ */ m({
9
+ import { useDebounceFn as y } from "../../../node_modules/@vueuse/shared/index.js";
10
+ const D = /* @__PURE__ */ l({
11
11
  __name: "LeftSlot",
12
12
  setup(C) {
13
- const e = y(), i = B(), { closeVersionHistory: n } = _(), { closePreviewMode: s } = b(), o = v(), { config: t } = k(), l = p(() => {
14
- var u, f;
15
- return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (f = (u = t.value) == null ? void 0 : u.ui) != null && f.backButtonLabel ? t.value.ui.backButtonLabel : o("email-editor.back-to-design");
16
- }), r = d(!1), a = () => {
13
+ const e = V(), i = B(), { closeVersionHistory: n } = _(), { closePreviewMode: s } = b(), o = v(), { config: t } = k(), f = p(() => {
14
+ var u, m;
15
+ return e.isVersionHistoryOpen || e.isPreviewModeOpen ? o("email-editor.back-to-editor") : (m = (u = t.value) == null ? void 0 : u.ui) != null && m.backButtonLabel ? t.value.ui.backButtonLabel : o("email-editor.back-to-design");
16
+ }), r = d(!1), c = () => {
17
17
  if (e.isVersionHistoryOpen) {
18
18
  n();
19
19
  return;
@@ -23,15 +23,11 @@ const D = /* @__PURE__ */ m({
23
23
  return;
24
24
  }
25
25
  i();
26
- }, c = V(async () => {
27
- try {
28
- await a();
29
- } finally {
30
- r.value = !1;
31
- }
26
+ }, a = y(() => {
27
+ c(), r.value = !1;
32
28
  }, 500);
33
- return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel: l, isBackButtonDisabled: r, executeBackAction: a, debouncedBackAction: c, handleBackClick: () => {
34
- r.value = !0, c();
29
+ return { __sfc: !0, editorStore: e, handleBack: i, closeVersionHistory: n, closePreviewMode: s, trans: o, config: t, backButtonLabel: f, isBackButtonDisabled: r, executeBackAction: c, debouncedBackAction: a, handleBackClick: () => {
30
+ r.value = !0, a();
35
31
  }, InButtonV2: w };
36
32
  }
37
33
  });
@@ -1,64 +1,64 @@
1
- import { defineComponent as _, ref as c, computed as h, watch as C, toRef as N, nextTick as O } from "vue";
2
- import b from "../../wrappers/WpDrawer.vue.js";
3
- import { useTranslations as D } from "../../../composables/useTranslations.js";
1
+ import { defineComponent as A, ref as c, computed as b, toRef as h, nextTick as C } from "vue";
2
+ import N from "../../wrappers/WpDrawer.vue.js";
3
+ import { useTranslations as O } from "../../../composables/useTranslations.js";
4
4
  import { useTemplateNameValidator as x } from "../../../composables/validators/saveAsTemplate.js";
5
5
  import { useTemplateLibraryApi as B } from "../../../services/templateLibraryApi.js";
6
- import { useEditorStore as k } from "../../../stores/editor.js";
7
- import { useSaveAsTemplateStore as I } from "../../../stores/save-as-template.js";
8
- import { InMultiSelect as M, InBasicTextInput as V } from "@useinsider/design-system-vue";
9
- import { useDebounceFn as E } from "../../../node_modules/@vueuse/shared/index.js";
10
- const J = /* @__PURE__ */ _({
6
+ import { useEditorStore as D } from "../../../stores/editor.js";
7
+ import { useSaveAsTemplateStore as k } from "../../../stores/save-as-template.js";
8
+ import { InMultiSelect as I, InBasicTextInput as M } from "@useinsider/design-system-vue";
9
+ import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.js";
10
+ const H = /* @__PURE__ */ A({
11
11
  __name: "SaveAsTemplateDrawer",
12
- setup(R) {
13
- const s = D(), o = k(), t = I(), { createTemplate: m } = B(), a = c(!1), n = c(!1), r = c(""), f = h(() => ({
12
+ setup(E) {
13
+ const o = O(), n = D(), t = k(), { createTemplate: m } = B(), a = c(!1), r = c(!1), l = c(""), f = b(() => ({
14
14
  primaryButton: {
15
15
  styling: "solid",
16
16
  type: "primary",
17
- labelText: s(a.value ? "newsletter.saving" : "products.save"),
17
+ labelText: o(a.value ? "newsletter.saving" : "products.save"),
18
18
  loadingStatus: a.value,
19
19
  disabledStatus: t.skeletonStatus
20
20
  },
21
21
  cancelOrBackButton: {
22
22
  styling: "ghost",
23
23
  type: "secondary",
24
- labelText: s("products.cancel"),
24
+ labelText: o("products.cancel"),
25
25
  disabledStatus: a.value
26
26
  }
27
- })), p = () => {
28
- r.value = "", o.isSaveAsTemplateDrawerOpen = !1;
29
- }, l = async () => {
30
- const e = N(t, "templateName"), { success: i, errorMessage: A } = await x(e).validate();
31
- return r.value = A, i;
32
- }, v = E(async (e) => {
33
- t.templateName = e, await l();
34
- }, 500), S = async (e) => {
35
- n.value = !0, await t.addCategory(e), n.value = !1;
36
- }, T = (e) => {
27
+ })), u = () => {
28
+ l.value = "", n.isSaveAsTemplateDrawerOpen = !1;
29
+ }, i = async () => {
30
+ const e = h(t, "templateName"), { success: s, errorMessage: _ } = await x(e).validate();
31
+ return l.value = _, s;
32
+ }, v = V(async (e) => {
33
+ t.templateName = e, await i();
34
+ }, 500), g = async (e) => {
35
+ r.value = !0, await t.addCategory(e), r.value = !1;
36
+ }, y = (e) => {
37
37
  t.selectedCategories = e;
38
- }, g = (e) => {
38
+ }, S = (e) => {
39
39
  e && (t.selectedCategories = e);
40
- }, y = () => {
40
+ }, T = () => {
41
41
  t.selectedCategories = [];
42
42
  }, w = async () => {
43
- if (a.value = !0, !await l()) {
43
+ if (a.value = !0, !await i()) {
44
44
  a.value = !1;
45
45
  return;
46
46
  }
47
- const i = await m();
48
- a.value = !1, i && p();
49
- }, u = () => {
50
- O(() => {
47
+ const s = await m();
48
+ a.value = !1, s && u();
49
+ }, p = () => {
50
+ C(() => {
51
51
  const e = document.querySelector("input#guido__template-name-input");
52
52
  e == null || e.focus();
53
53
  });
54
54
  }, d = async () => {
55
- t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1, u();
55
+ t.$reset(), await t.fetchCategories(), t.skeletonStatus = !1, p();
56
56
  };
57
- return C(() => o.isSaveAsTemplateDrawerOpen, (e) => {
58
- e && d();
59
- }), { __sfc: !0, trans: s, editorStore: o, saveAsTemplateStore: t, createTemplate: m, isSaving: a, isAddingOption: n, templateNameError: r, footerButtonGroupOptions: f, closeModal: p, validateTemplateName: l, handleTemplateName: v, handleAddOption: S, handleCategoryChange: T, handleSelectAllOptions: g, handleResetAllOptions: y, saveTemplate: w, focusToInput: u, initializeDrawer: d, WpDrawer: b, InBasicTextInput: V, InMultiSelect: M };
57
+ return n.$subscribe((e, { isSaveAsTemplateDrawerOpen: s }) => {
58
+ s && d();
59
+ }), { __sfc: !0, trans: o, editorStore: n, saveAsTemplateStore: t, createTemplate: m, isSaving: a, isAddingOption: r, templateNameError: l, footerButtonGroupOptions: f, closeModal: u, validateTemplateName: i, handleTemplateName: v, handleAddOption: g, handleCategoryChange: y, handleSelectAllOptions: S, handleResetAllOptions: T, saveTemplate: w, focusToInput: p, initializeDrawer: d, WpDrawer: N, InBasicTextInput: M, InMultiSelect: I };
60
60
  }
61
61
  });
62
62
  export {
63
- J as default
63
+ H as default
64
64
  };
@@ -1,19 +1,17 @@
1
1
  import r from "./WpDrawer.vue2.js";
2
2
  import s from "../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var u = function() {
4
- var t = this, o = t._self._c, e = t._self._setupProxy;
5
- return o(e.InDrawer, { class: t.className, attrs: { id: t.id, "footer-status": "", "close-on-outside-click": t.closeOnOutsideClick, "description-status": t.descriptionStatus, "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, size: t.size, status: t.status, "title-text": t.titleText }, on: { cancelOrBackButtonEvent: function(n) {
4
+ var t = this, n = t._self._c, e = t._self._setupProxy;
5
+ return n(e.InDrawer, { class: t.className, attrs: { id: t.id, "footer-status": "", "close-on-outside-click": t.closeOnOutsideClick, "description-status": t.descriptionStatus, "description-text": t.descriptionText, "footer-button-group-options": t.footerButtonGroupOptions, size: t.size, status: t.status, "title-text": t.titleText }, on: { cancelOrBackButtonEvent: function(o) {
6
6
  return e.emit("cancelOrBackButtonEvent");
7
- }, onCloseEvent: function(n) {
7
+ }, onCloseEvent: function(o) {
8
8
  return e.emit("onCloseEvent");
9
- }, primaryButtonEvent: function(n) {
9
+ }, primaryButtonEvent: function(o) {
10
10
  return e.emit("primaryButtonEvent");
11
- }, secondaryButtonEvent: function(n) {
12
- return e.emit("secondaryButtonEvent");
13
11
  } }, scopedSlots: t._u([t.$slots.headerBottomSlot ? { key: "headerBottomSlot", fn: function() {
14
12
  return [t._t("headerBottomSlot")];
15
13
  }, proxy: !0 } : null, { key: "contentSlot", fn: function() {
16
- return [o("div", [t._t("default")], 2)];
14
+ return [n("div", [t._t("default")], 2)];
17
15
  }, proxy: !0 }], null, !0) });
18
16
  }, i = [], c = /* @__PURE__ */ s(
19
17
  r,
@@ -23,7 +21,7 @@ var u = function() {
23
21
  null,
24
22
  null
25
23
  );
26
- const p = c.exports;
24
+ const f = c.exports;
27
25
  export {
28
- p as default
26
+ f as default
29
27
  };
@@ -13,7 +13,7 @@ const r = /* @__PURE__ */ e({
13
13
  status: { type: Boolean },
14
14
  titleText: null
15
15
  },
16
- emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent", "secondaryButtonEvent"],
16
+ emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent"],
17
17
  setup(n, { emit: t }) {
18
18
  return { __sfc: !0, emit: t, InDrawer: o };
19
19
  }
@@ -1,14 +1,13 @@
1
- import { defaultHtmlCompilerRules as d } from "../config/compiler/htmlCompilerRules.js";
2
- import { itemsCompilerRules as f } from "../config/compiler/itemsCompilerRules.js";
3
- import { liquidCompilerRules as g } from "../config/compiler/liquidCompilerRules.js";
4
- import { outlookCompilerRules as R } from "../config/compiler/outlookCompilerRules.js";
1
+ import { defaultHtmlCompilerRules as R } from "../config/compiler/htmlCompilerRules.js";
2
+ import { itemsCompilerRules as g } from "../config/compiler/itemsCompilerRules.js";
3
+ import { liquidCompilerRules as C } from "../config/compiler/liquidCompilerRules.js";
4
+ import { outlookCompilerRules as b } from "../config/compiler/outlookCompilerRules.js";
5
5
  import { recommendationCompilerRules as v } from "../config/compiler/recommendationCompilerRules.js";
6
6
  import { socialCompilerRules as H } from "../config/compiler/socialCompilerRules.js";
7
- import { unsubscribeCompilerRules as b } from "../config/compiler/unsubscribeCompilerRules.js";
8
- import { createHtmlCompiler as n } from "../utils/htmlCompiler.js";
9
- import { computed as p } from "vue";
10
- import { useConfig as C } from "./useConfig.js";
11
- const x = /* @__PURE__ */ new Set([
7
+ import { unsubscribeCompilerRules as x } from "../config/compiler/unsubscribeCompilerRules.js";
8
+ import { createHtmlCompiler as s } from "../utils/htmlCompiler.js";
9
+ import { useConfig as k } from "./useConfig.js";
10
+ const y = /* @__PURE__ */ new Set([
12
11
  // URL/tag encoding fixes — keep merge-tag and placeholder integrity intact.
13
12
  "fix-url-encoding-start",
14
13
  "fix-url-encoding-end",
@@ -31,34 +30,24 @@ const x = /* @__PURE__ */ new Set([
31
30
  // Editor-only attribute strip — AMP4EMAIL has no `contenteditable`, so leaving
32
31
  // it in narrows/breaks rendering. Pure attribute removal, emits nothing.
33
32
  "remove-contenteditable"
34
- ]), I = () => {
35
- const { compiler: i, isFeatureEnabled: u, partner: a } = C(), c = p(() => {
36
- var m, l;
37
- const e = ((m = i.value) == null ? void 0 : m.customRules) || [];
38
- return [
39
- ...!!((l = i.value) != null && l.ignoreDefaultRules) ? [] : d,
40
- ...v,
41
- ...b,
42
- ...f,
43
- ...R,
44
- ...H,
45
- ...u("liquidSyntax") ? g : [],
46
- ...e.map((t, o) => ({
47
- ...t,
48
- priority: t.priority + 1e3 + o
49
- // Ensure additional rules run after default rules
50
- }))
51
- ];
52
- }), r = p(() => {
53
- var t;
54
- const e = c.value, s = n(e), m = n(e.filter((o) => x.has(o.id))), l = (t = a.value) == null ? void 0 : t.fallbackFont;
55
- return {
56
- compileHtml: (o) => s.compile(o, void 0, l),
57
- compileAmpHtml: (o) => m.compile(o, void 0, l)
58
- };
59
- });
60
- return { compileHtml: (e) => r.value.compileHtml(e), compileAmpHtml: (e) => r.value.compileAmpHtml(e) };
33
+ ]), M = () => {
34
+ var i, m, r;
35
+ const { compiler: o, isFeatureEnabled: n, partner: a } = k(), p = ((i = o.value) == null ? void 0 : i.customRules) || [], l = [
36
+ ...!!((m = o.value) != null && m.ignoreDefaultRules) ? [] : R,
37
+ ...v,
38
+ ...x,
39
+ ...g,
40
+ ...b,
41
+ ...H,
42
+ ...n("liquidSyntax") ? C : [],
43
+ ...p.map((e, f) => ({
44
+ ...e,
45
+ priority: e.priority + 1e3 + f
46
+ // Ensure additional rules run after default rules
47
+ }))
48
+ ], u = s(l), c = l.filter((e) => y.has(e.id)), d = s(c), t = (r = a.value) == null ? void 0 : r.fallbackFont;
49
+ return { compileHtml: (e) => u.compile(e, void 0, t), compileAmpHtml: (e) => d.compile(e, void 0, t) };
61
50
  };
62
51
  export {
63
- I as useHtmlCompiler
52
+ M as useHtmlCompiler
64
53
  };
@@ -221,8 +221,6 @@ const De = () => {
221
221
  export {
222
222
  de as buildPartnerAttributeNameSet,
223
223
  fe as findInvalidCustomFields,
224
- pe as getInvalidDynamicContentTags,
225
- ce as getRecommendationBlockIds,
226
224
  ue as parseRecommendationVariable,
227
225
  De as useHtmlValidator
228
226
  };
@@ -1,16 +1,14 @@
1
- import { getCsrfToken as O } from "../utils/genericUtil.js";
2
- import { ref as m, computed as T } from "vue";
3
- const X = (b = {}) => {
4
- const p = m(!1), a = m(null), u = m(null), g = T(() => p.value), y = T(() => a.value !== null), v = {
1
+ import { getCsrfToken as H } from "../utils/genericUtil.js";
2
+ import { ref as p, computed as T } from "vue";
3
+ const k = (b = {}) => {
4
+ const h = p(!1), a = p(null), u = p(null), g = T(() => h.value), y = T(() => a.value !== null), v = {
5
5
  baseURL: "",
6
6
  timeout: 1e4,
7
7
  retry: 0,
8
8
  retryDelay: 1e3,
9
9
  headers: {
10
10
  "Content-Type": "application/json",
11
- "X-CSRF-TOKEN": O(),
12
- Accept: "application/json",
13
- "X-Requested-With": "XMLHttpRequest"
11
+ "X-CSRF-TOKEN": H()
14
12
  },
15
13
  ...b
16
14
  }, w = (e, s) => {
@@ -24,22 +22,22 @@ const X = (b = {}) => {
24
22
  }, e);
25
23
  }), x = (e) => new Promise((s) => {
26
24
  setTimeout(s, e);
27
- }), i = async (e, s, t, L = {}) => {
28
- a.value = null, p.value = !0, u.value = new AbortController();
29
- const n = { ...v, ...L }, D = w(s, n.baseURL), c = {
25
+ }), i = async (e, s, t, D = {}) => {
26
+ a.value = null, h.value = !0, u.value = new AbortController();
27
+ const n = { ...v, ...D }, L = w(s, n.baseURL), c = {
30
28
  method: e,
31
29
  headers: { ...n.headers },
32
30
  signal: u.value.signal,
33
31
  ...n
34
32
  };
35
33
  t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
36
- const E = async (h = 0) => {
34
+ const E = async (m = 0) => {
37
35
  try {
38
- const o = [fetch(D, c)];
36
+ const o = [fetch(L, c)];
39
37
  n.timeout && o.push(P(n.timeout));
40
38
  const r = await Promise.race(o);
41
39
  if (!r.ok) {
42
- const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
40
+ const O = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(O);
43
41
  throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
44
42
  }
45
43
  let f;
@@ -52,19 +50,19 @@ const X = (b = {}) => {
52
50
  };
53
51
  } catch (o) {
54
52
  const r = o instanceof Error && o.name === "AbortError";
55
- if (h < (n.retry || 0) && !r)
56
- return await x(n.retryDelay || 1e3), E(h + 1);
53
+ if (m < (n.retry || 0) && !r)
54
+ return await x(n.retryDelay || 1e3), E(m + 1);
57
55
  throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
58
56
  }
59
57
  };
60
58
  try {
61
59
  return await E();
62
60
  } finally {
63
- p.value = !1, u.value = null;
61
+ h.value = !1, u.value = null;
64
62
  }
65
- }, C = (e, s) => i("GET", e, void 0, s), R = (e, s, t) => i("POST", e, s, t), $ = (e, s, t) => i("PUT", e, s, t), q = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), U = (e) => {
63
+ }, C = (e, s) => i("GET", e, void 0, s), $ = (e, s, t) => i("POST", e, s, t), R = (e, s, t) => i("PUT", e, s, t), U = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), W = (e) => {
66
64
  u.value && u.value.abort(e);
67
- }, W = () => {
65
+ }, q = () => {
68
66
  a.value = null;
69
67
  };
70
68
  return {
@@ -75,14 +73,14 @@ const X = (b = {}) => {
75
73
  // Methods
76
74
  request: i,
77
75
  get: C,
78
- post: R,
79
- put: $,
80
- patch: q,
76
+ post: $,
77
+ put: R,
78
+ patch: U,
81
79
  delete: A,
82
- cancel: U,
83
- clearError: W
80
+ cancel: W,
81
+ clearError: q
84
82
  };
85
83
  };
86
84
  export {
87
- X as useHttp
85
+ k as useHttp
88
86
  };
@@ -1,100 +1,55 @@
1
- import { useActionsApi as W } from "./useActionsApi.js";
1
+ import { useActionsApi as T } from "./useActionsApi.js";
2
2
  import { useConfig as q } from "./useConfig.js";
3
- import { useEditorLock as O } from "./useEditorLock.js";
4
- import { useSaveStart as D, useSaveComplete as F } from "./useGuidoActions.js";
5
- import { useSaveValidation as j } from "./useSaveValidation.js";
6
- import { useSaveValidationRollout as z } from "./useSaveValidationRollout.js";
7
- import { useSyncModuleExtractor as G } from "./useSyncModuleExtractor.js";
8
- import { ToasterTypeOptions as I } from "../enums/toaster.js";
9
- import { useStripoApi as J } from "../services/stripoApi.js";
10
- import { useConfigStore as K } from "../stores/config.js";
11
- import { useDynamicContentStore as N } from "../stores/dynamic-content.js";
12
- import { useSaveValidationStore as Q } from "../stores/save-validation.js";
13
- import { useTemplatePreparation as X, getHtmlReferencedUnsubscribePages as Y } from "../utils/templatePreparation.js";
14
- import { useAllowlist as Z } from "./useAllowlist.js";
15
- import { useHtmlValidator as _ } from "./useHtmlValidator.js";
16
- import { useToaster as $ } from "./useToaster.js";
17
- import { useCouponBlockValidator as tt } from "./validators/useCouponBlockValidator.js";
18
- import { useLiquidValidator as et } from "./validators/useLiquidValidator.js";
19
- import { useSyncModuleBlockValidator as ot } from "./validators/useSyncModuleBlockValidator.js";
20
- import { useUnsubscribeBlockValidator as st } from "./validators/useUnsubscribeBlockValidator.js";
21
- const Bt = () => {
22
- const r = D(), f = F(), { validateHtml: p } = _(), { validateLiquidSyntax: v } = et(), { validateCouponBlockTags: y } = tt(), { validateUnsubscribeBlockUniqueness: S, validateUnsubscribeBlockHasTemplate: w } = st(), { validateSyncModuleBlocks: u } = ot(), { callbacks: a, isFeatureEnabled: m } = q(), { extractSyncModuleData: b } = G(), { setSyncModuleUnsubscriptionPages: g } = J(), { editorSave: E, getTemplateData: H } = W(), { showToaster: V } = $(), { getBlockedDomains: x, resolveToast: k } = Z(), { prepareTemplateDetails: d } = X(), { collectSaveValidationErrors: C } = j(), { isEnabled: B } = z(), T = Q(), h = N(), P = K(), { runExclusive: n } = O(), l = async (t, e, o) => {
23
- if (!m("allowlistEnabled"))
24
- return !1;
25
- const i = await x(t, e);
26
- if (!i.length)
27
- return !1;
28
- if (!o) {
29
- const s = await k(i);
30
- s != null && s.message && V({
31
- type: I.Warning,
32
- message: s.message,
33
- actionButton: s.actionButton
34
- });
35
- }
36
- return !0;
37
- }, L = async (t) => !y(t.compiledHtml) || !S(t.compiledHtml) || !w(t.compiledHtml) ? !1 : m("liquidSyntax") ? v(t.compiledHtml) : p(t.compiledHtml, t.dynamicContentList, !0), c = async (t, e) => {
38
- if (!await E())
3
+ import { useEditorLock as C } from "./useEditorLock.js";
4
+ import { useSaveStart as L, useSaveComplete as M } from "./useGuidoActions.js";
5
+ import { useSyncModuleExtractor as D } from "./useSyncModuleExtractor.js";
6
+ import { ToasterTypeOptions as P } from "../enums/toaster.js";
7
+ import { useStripoApi as U } from "../services/stripoApi.js";
8
+ import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
9
+ import { useAllowlist as h } from "./useAllowlist.js";
10
+ import { useHtmlValidator as F } from "./useHtmlValidator.js";
11
+ import { useToaster as O } from "./useToaster.js";
12
+ import { useCouponBlockValidator as W } from "./validators/useCouponBlockValidator.js";
13
+ import { useLiquidValidator as j } from "./validators/useLiquidValidator.js";
14
+ import { useSyncModuleBlockValidator as z } from "./validators/useSyncModuleBlockValidator.js";
15
+ import { useUnsubscribeBlockValidator as G } from "./validators/useUnsubscribeBlockValidator.js";
16
+ const rt = () => {
17
+ const n = L(), c = M(), { validateHtml: d } = F(), { validateLiquidSyntax: m } = j(), { validateCouponBlockTags: u } = W(), { validateUnsubscribeBlockUniqueness: p, validateUnsubscribeBlockHasTemplate: f } = G(), { validateSyncModuleBlocks: v } = z(), { callbacks: s, isFeatureEnabled: r } = q(), { extractSyncModuleData: S } = D(), { setSyncModuleUnsubscriptionPages: b } = U(), { editorSave: w } = T(), { showToaster: V } = O(), { getBlockedDomains: y, resolveToast: k } = h(), { runExclusive: x } = C(), H = async (a, o) => {
18
+ var l;
19
+ n();
20
+ const { prepareTemplateDetails: B } = A(), t = await B();
21
+ if (!v(t.rawHtml, o) || !u(t.compiledHtml) || !p(t.compiledHtml) || !f(t.compiledHtml))
39
22
  return;
40
- const { unsubscribePayload: i, stripoModules: s } = b(t.rawHtml);
41
- if (await g(i), t.modules = s, !e.suppress) {
42
- const R = e.blankCompiled ? { compiledHtml: "", ampHtml: "" } : {};
43
- f({ ...t, ...R, silent: e.silent });
44
- }
45
- return t;
46
- }, U = async (t, e) => {
47
- var i;
48
- r();
49
- const o = await d();
50
- if (u(o.rawHtml, e)) {
51
- if (B.value && !e) {
52
- const s = await C(
53
- o.compiledHtml,
54
- o.dynamicContentList
55
- );
56
- if (s.length) {
57
- T.open(s, "save");
58
- return;
59
- }
60
- } else if (!await L(o))
23
+ if (r("liquidSyntax")) {
24
+ if (!await m(t.compiledHtml))
61
25
  return;
62
- if (!((i = a.value) != null && i.externalValidation && !await a.value.externalValidation(o)) && !await l(o.compiledHtml, o.css, e))
63
- return c(o, { silent: e, suppress: t });
64
- }
65
- }, A = async () => {
66
- var e;
67
- if (!P.allowSaveWithErrors)
26
+ } else if (!await d(t.compiledHtml, t.dynamicContentList, !0))
68
27
  return;
69
- r();
70
- const t = await d();
71
- if (!((e = a.value) != null && e.externalValidation && !await a.value.externalValidation(t)) && !await l(t.compiledHtml, t.css, !1))
72
- return c(t, { silent: !1, blankCompiled: !0 });
73
- }, M = async () => {
74
- r();
75
- const { html: t, css: e } = await H();
76
- if (!u(t, !0) || await l(t, e, !0))
28
+ if ((l = s.value) != null && l.externalValidation && !await s.value.externalValidation(t))
77
29
  return;
78
- const o = Y(t), i = {
79
- dynamicContentList: h.getSelectedDynamicContentList,
80
- compiledHtml: "",
81
- rawHtml: t,
82
- css: e,
83
- ampHtml: "",
84
- ampErrors: [],
85
- modules: [],
86
- recommendation: { campaignUrls: {}, configs: {} },
87
- unsubscribe: {
88
- status: o.length > 0,
89
- config: o
30
+ if (r("allowlistEnabled")) {
31
+ const i = await y(t.compiledHtml, t.css);
32
+ if (i.length) {
33
+ if (!o) {
34
+ const e = await k(i);
35
+ e != null && e.message && V({
36
+ type: P.Warning,
37
+ message: e.message,
38
+ actionButton: e.actionButton
39
+ });
40
+ }
41
+ return;
90
42
  }
91
- };
92
- return c(i, { silent: !0 });
43
+ }
44
+ if (!await w())
45
+ return;
46
+ const { unsubscribePayload: E, stripoModules: g } = S(t.rawHtml);
47
+ return await b(E), t.modules = g, a || c({ ...t, silent: o }), t;
93
48
  };
94
- return { save: (t = !1, e = !1) => n(
95
- () => U(t, e)
96
- ), saveWithErrors: () => n(A), saveRawOnly: () => n(M) };
49
+ return { save: (a = !1, o = !1) => x(
50
+ () => H(a, o)
51
+ ) };
97
52
  };
98
53
  export {
99
- Bt as useSave
54
+ rt as useSave
100
55
  };
@@ -1,27 +1,24 @@
1
- import { ToasterTypeOptions as n } from "../../enums/toaster.js";
2
- import { COUPON_PLACEHOLDER_DEFAULT as s, COUPON_PLACEHOLDER_LIQUID as a } from "../../extensions/Blocks/CouponBlock/template.js";
3
- import { useToaster as i } from "../useToaster.js";
4
- import { useTranslations as l } from "../useTranslations.js";
5
- const c = /* @__PURE__ */ new Set([
6
- s,
7
- a
8
- ]), p = "newsletter.coupon-tag-modified";
9
- function u(r) {
10
- const e = new DOMParser().parseFromString(r, "text/html");
11
- return Array.from(e.querySelectorAll(".coupon-block")).map((o) => {
12
- var t;
13
- return ((t = o.textContent) == null ? void 0 : t.trim()) ?? "";
14
- }).filter((o) => !c.has(o));
15
- }
16
- const T = () => {
17
- const { showToaster: r } = i(), e = l();
18
- return { validateCouponBlockTags: (t) => u(t).length > 0 ? (r({
19
- type: n.Warning,
20
- message: e(p)
21
- }), !1) : !0 };
1
+ import { ToasterTypeOptions as c } from "../../enums/toaster.js";
2
+ import { COUPON_PLACEHOLDER_DEFAULT as i, COUPON_PLACEHOLDER_LIQUID as l } from "../../extensions/Blocks/CouponBlock/template.js";
3
+ import { useToaster as m } from "../useToaster.js";
4
+ import { useTranslations as p } from "../useTranslations.js";
5
+ const u = /* @__PURE__ */ new Set([
6
+ i,
7
+ l
8
+ ]), A = () => {
9
+ const { showToaster: t } = m(), r = p();
10
+ return { validateCouponBlockTags: (e) => {
11
+ const n = new DOMParser().parseFromString(e, "text/html");
12
+ return Array.from(n.querySelectorAll(".coupon-block")).find((s) => {
13
+ var o;
14
+ const a = ((o = s.textContent) == null ? void 0 : o.trim()) ?? "";
15
+ return !u.has(a);
16
+ }) ? (t({
17
+ type: c.Warning,
18
+ message: r("newsletter.coupon-tag-modified")
19
+ }), !1) : !0;
20
+ } };
22
21
  };
23
22
  export {
24
- p as COUPON_TAG_MODIFIED_KEY,
25
- u as findInvalidCouponBlocks,
26
- T as useCouponBlockValidator
23
+ A as useCouponBlockValidator
27
24
  };