@useinsider/guido 3.19.0-beta.3abc7c5 → 3.19.0-beta.3d545d6

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 (58) hide show
  1. package/README.md +0 -1
  2. package/dist/@types/config/schemas.js +31 -33
  3. package/dist/components/Guido.vue.js +9 -9
  4. package/dist/components/Guido.vue2.js +57 -58
  5. package/dist/components/organisms/AutoSaveController.vue2.js +8 -9
  6. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  7. package/dist/components/organisms/base/AuthErrorModal.vue2.js +29 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +5 -5
  9. package/dist/components/organisms/header/EditorActions.vue2.js +55 -85
  10. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +12 -16
  12. package/dist/components/wrappers/WpDrawer.vue.js +7 -9
  13. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  14. package/dist/components/wrappers/WpModal.vue.js +1 -1
  15. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  16. package/dist/composables/useAuthError.js +51 -0
  17. package/dist/composables/useHtmlCompiler.js +26 -37
  18. package/dist/composables/useHtmlValidator.js +0 -2
  19. package/dist/composables/useHttp.js +58 -51
  20. package/dist/composables/useSave.js +45 -90
  21. package/dist/composables/useToaster.js +17 -15
  22. package/dist/composables/validators/useCouponBlockValidator.js +21 -24
  23. package/dist/composables/validators/useLiquidValidator.js +15 -15
  24. package/dist/composables/validators/useUnsubscribeBlockValidator.js +27 -34
  25. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +47 -54
  26. package/dist/guido.css +1 -1
  27. package/dist/src/@types/config/schemas.d.ts +0 -4
  28. package/dist/src/components/Guido.vue.d.ts +1 -17
  29. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -17
  30. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -17
  31. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -17
  32. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +3 -4
  33. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  34. package/dist/src/composables/useAuthError.d.ts +11 -0
  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/useHttp.d.ts +2 -0
  38. package/dist/src/composables/useSave.d.ts +1 -6
  39. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +0 -3
  40. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +0 -10
  41. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  42. package/dist/src/stores/config.d.ts +0 -32
  43. package/dist/src/utils/templatePreparation.d.ts +0 -30
  44. package/dist/stores/config.js +67 -84
  45. package/dist/utils/templatePreparation.js +36 -39
  46. package/package.json +1 -1
  47. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +0 -20
  48. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +0 -48
  49. package/dist/composables/useSaveValidation.js +0 -279
  50. package/dist/composables/useSaveValidationRollout.js +0 -9
  51. package/dist/enums/save-validation.js +0 -4
  52. package/dist/src/@types/save-validation.d.ts +0 -19
  53. package/dist/src/composables/useSaveValidation.d.ts +0 -6
  54. package/dist/src/composables/useSaveValidationRollout.d.ts +0 -3
  55. package/dist/src/enums/save-validation.d.ts +0 -27
  56. package/dist/src/stores/save-validation.d.ts +0 -22
  57. package/dist/stores/save-validation.js +0 -30
  58. /package/dist/src/components/organisms/{validation/ValidationErrorDrawer.vue.d.ts → base/AuthErrorModal.vue.d.ts} +0 -0
@@ -1,107 +1,77 @@
1
- import { defineComponent as D, computed as m, ref as u } from "vue";
2
- import { useActionsApi as z } from "../../../composables/useActionsApi.js";
3
- import { useConfig as I } from "../../../composables/useConfig.js";
4
- import { useExport as P } from "../../../composables/useExport.js";
5
- import { useTestEmailClick as W } from "../../../composables/useGuidoActions.js";
6
- import { useHtmlCompiler as j } from "../../../composables/useHtmlCompiler.js";
7
- import { useSave as G } from "../../../composables/useSave.js";
8
- import { useSaveValidation as J } from "../../../composables/useSaveValidation.js";
9
- import { useSaveValidationRollout as K } from "../../../composables/useSaveValidationRollout.js";
10
- import { useToaster as N } from "../../../composables/useToaster.js";
11
- import { useTranslations as Q } from "../../../composables/useTranslations.js";
12
- import { useVersionHistoryApi as U } from "../../../composables/useVersionHistoryApi.js";
13
- import { useLiquidValidator as X } from "../../../composables/validators/useLiquidValidator.js";
14
- import { ToasterTypeOptions as Y } from "../../../enums/toaster.js";
15
- import { useConfigStore as Z } from "../../../stores/config.js";
16
- import { useEditorStore as $ } from "../../../stores/editor.js";
17
- import { useSaveValidationStore as tt } from "../../../stores/save-validation.js";
18
- import { useTemplateStore as et } from "../../../stores/template.js";
19
- import { getTooltipOptions as ot } from "../../../utils/tooltipUtils.js";
20
- import { InButtonV2 as rt } from "@useinsider/design-system-vue";
21
- import { storeToRefs as it } from "pinia";
22
- import at from "./MigrationConfirmModal.vue.js";
23
- const Ot = /* @__PURE__ */ D({
1
+ import { defineComponent as q, ref as n, computed as x } from "vue";
2
+ import { useActionsApi as b } from "../../../composables/useActionsApi.js";
3
+ import { useConfig as k } from "../../../composables/useConfig.js";
4
+ import { useExport as B } from "../../../composables/useExport.js";
5
+ import { useTestEmailClick as D } from "../../../composables/useGuidoActions.js";
6
+ import { useHtmlCompiler as L } from "../../../composables/useHtmlCompiler.js";
7
+ import { useSave as R } from "../../../composables/useSave.js";
8
+ import { useToaster as z } from "../../../composables/useToaster.js";
9
+ import { useTranslations as I } from "../../../composables/useTranslations.js";
10
+ import { useVersionHistoryApi as P } from "../../../composables/useVersionHistoryApi.js";
11
+ import { useLiquidValidator as j } from "../../../composables/validators/useLiquidValidator.js";
12
+ import { useEditorStore as G } from "../../../stores/editor.js";
13
+ import { useTemplateStore as J } from "../../../stores/template.js";
14
+ import { getTooltipOptions as K } from "../../../utils/tooltipUtils.js";
15
+ import { InButtonV2 as N } from "@useinsider/design-system-vue";
16
+ import { storeToRefs as Q } from "pinia";
17
+ import U from "./MigrationConfirmModal.vue.js";
18
+ const ft = /* @__PURE__ */ q({
24
19
  __name: "EditorActions",
25
- setup(st, { expose: M }) {
26
- const { config: c, isFeatureEnabled: p } = I(), { exportHtml: f } = P(), { save: d } = G(), { validateCurrentTemplate: v } = J(), { isEnabled: i } = K(), { showToaster: S, handleError: a } = N(), { openVersionHistory: y, closeVersionHistory: g } = U(), { getCompiledEmail: h } = z(), { compileHtml: V } = j(), { validateLiquidSyntax: T } = X(), w = Z(), o = $(), E = tt(), H = et(), { hasMigrations: x } = it(H), r = Q(), b = m(() => i.value && w.allowSaveWithErrors ? r("email-editor.save-and-continue") : "Save"), s = u(!1), n = u(!1), C = u(), l = W(), k = () => {
27
- if (o.isVersionHistoryOpen) {
28
- g();
20
+ setup(W, { expose: w }) {
21
+ const { config: l, isFeatureEnabled: m } = k(), { exportHtml: c } = B(), { save: p } = R(), { openVersionHistory: u, closeVersionHistory: f } = P(), { getCompiledEmail: d } = b(), { compileHtml: v } = L(), { validateLiquidSyntax: y } = j(), { handleError: r } = z(), e = G(), g = J(), { hasMigrations: S } = Q(g), s = I(), i = n(!1), a = n(!1), H = n(), h = D(), _ = () => {
22
+ if (e.isVersionHistoryOpen) {
23
+ f();
29
24
  return;
30
25
  }
31
- y();
32
- }, F = async () => {
33
- s.value = !0, await f(), s.value = !1;
34
- }, q = () => {
35
- o.isSaveAsTemplateDrawerOpen = !0;
36
- }, B = m(() => o.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), L = m(
26
+ u();
27
+ }, C = async () => {
28
+ i.value = !0, await c(), i.value = !1;
29
+ }, A = () => {
30
+ e.isSaveAsTemplateDrawerOpen = !0;
31
+ }, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
37
32
  () => {
38
- var t, e;
39
- return ((e = (t = c.value) == null ? void 0 : t.features) == null ? void 0 : e.versionHistory) && !o.isPreviewModeOpen;
33
+ var t, o;
34
+ return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
40
35
  }
41
- ), _ = async (t) => {
42
- n.value = !0, t || (o.loadingStatus = !0);
43
- let e;
36
+ ), V = async (t) => {
37
+ a.value = !0, t || (e.loadingStatus = !0);
38
+ let o;
44
39
  try {
45
- e = await d(t);
46
- } catch (O) {
47
- a(O, "Failed to save template");
40
+ o = await p(t);
41
+ } catch (T) {
42
+ r(T, "Failed to save template");
48
43
  } finally {
49
- n.value = !1, !t && !e && (o.loadingStatus = !1);
44
+ a.value = !1, !t && !o && (e.loadingStatus = !1);
50
45
  }
51
- return e;
52
- }, A = (t) => {
53
- var e;
54
- if (!t && x.value) {
55
- (e = C.value) == null || e.open();
46
+ return o;
47
+ }, E = (t) => {
48
+ var o;
49
+ if (!t && S.value) {
50
+ (o = H.value) == null || o.open();
56
51
  return;
57
52
  }
58
- return _(t);
59
- }, R = async () => {
60
- if (i.value) {
61
- o.loadingStatus = !0;
62
- let t = [];
63
- try {
64
- t = await v();
65
- } catch (e) {
66
- console.warn("Test-path validation failed; sending without the drawer.", e);
67
- } finally {
68
- o.loadingStatus = !1;
69
- }
70
- if (t.length) {
71
- S({
72
- type: Y.Error,
73
- message: r("email-editor.validation-errors-found"),
74
- actionButton: {
75
- text: r("email-editor.check-errors"),
76
- onClick: () => E.open(t, "test")
77
- },
78
- autoHide: !1
79
- });
80
- return;
81
- }
82
- l();
83
- return;
84
- }
85
- if (p("liquidSyntax")) {
86
- o.loadingStatus = !0;
53
+ return V(t);
54
+ }, F = async () => {
55
+ if (m("liquidSyntax")) {
56
+ e.loadingStatus = !0;
87
57
  try {
88
- const { html: t } = await h({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: e } = V(t);
89
- if (!await T(e))
58
+ const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
59
+ if (!await y(o))
90
60
  return;
91
61
  } catch (t) {
92
- a(t, "Failed to prepare test email");
62
+ r(t, "Failed to prepare test email");
93
63
  return;
94
64
  } finally {
95
- o.loadingStatus = !1;
65
+ e.loadingStatus = !1;
96
66
  }
97
67
  }
98
- l();
68
+ h();
99
69
  };
100
- return M({
101
- handleSave: A
102
- }), { __sfc: !0, config: c, isFeatureEnabled: p, exportHtml: f, save: d, validateCurrentTemplate: v, isEnabled: i, showToaster: S, handleError: a, openVersionHistory: y, closeVersionHistory: g, getCompiledEmail: h, compileHtml: V, validateLiquidSyntax: T, configStore: w, editorStore: o, saveValidationStore: E, templateStore: H, hasMigrations: x, trans: r, saveLabel: b, isExporting: s, isSaving: n, migrationModalRef: C, testEmailClick: l, handleVersionHistory: k, handleExport: F, handleSaveAs: q, versionHistoryTooltipText: B, isVersionHistoryButtonVisible: L, executeSave: _, handleSave: A, handleTestEmail: R, getTooltipOptions: ot, InButtonV2: rt, MigrationConfirmModal: at };
70
+ return w({
71
+ handleSave: E
72
+ }), { __sfc: !0, config: l, isFeatureEnabled: m, exportHtml: c, save: p, openVersionHistory: u, closeVersionHistory: f, getCompiledEmail: d, compileHtml: v, validateLiquidSyntax: y, handleError: r, editorStore: e, templateStore: g, hasMigrations: S, trans: s, isExporting: i, isSaving: a, migrationModalRef: H, testEmailClick: h, handleVersionHistory: _, handleExport: C, handleSaveAs: A, versionHistoryTooltipText: M, isVersionHistoryButtonVisible: O, executeSave: V, handleSave: E, handleTestEmail: F, getTooltipOptions: K, InButtonV2: N, MigrationConfirmModal: U };
103
73
  }
104
74
  });
105
75
  export {
106
- Ot as default
76
+ ft as default
107
77
  };
@@ -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,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
  }
@@ -2,7 +2,7 @@ import r from "./WpModal.vue2.js";
2
2
  import s from "../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var i = function() {
4
4
  var t = this, o = t._self._c, e = t._self._setupProxy;
5
- return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
5
+ return o(e.InModalV2, { attrs: { id: t.id, "description-status": "", status: "", "close-button-status": t.closeButtonStatus, "close-on-outside-click": t.closeOnOutsideClick, "description-text": t.description, "footer-button-group-options": t.footerButtonOptions, "footer-status": t.footerStatus, size: t.size, state: t.state, "title-text": t.title }, on: { cancelOrBackButtonEvent: function(n) {
6
6
  return e.emit("close");
7
7
  }, onCloseEvent: function(n) {
8
8
  return e.emit("close");
@@ -1,11 +1,12 @@
1
1
  import { defineComponent as e } from "vue";
2
2
  import { InModalV2 as o } from "@useinsider/design-system-vue";
3
- const u = /* @__PURE__ */ e({
3
+ const n = /* @__PURE__ */ e({
4
4
  __name: "WpModal",
5
5
  props: {
6
6
  id: null,
7
7
  title: null,
8
8
  description: { default: "" },
9
+ state: { default: "default" },
9
10
  size: { default: "small" },
10
11
  footerButtonOptions: { default: void 0 },
11
12
  closeButtonStatus: { type: Boolean, default: !0 },
@@ -13,10 +14,10 @@ const u = /* @__PURE__ */ e({
13
14
  footerStatus: { type: Boolean, default: !0 }
14
15
  },
15
16
  emits: ["close", "primary-action", "secondary-action"],
16
- setup(l, { emit: t }) {
17
+ setup(a, { emit: t }) {
17
18
  return { __sfc: !0, emit: t, InModalV2: o };
18
19
  }
19
20
  });
20
21
  export {
21
- u as default
22
+ n as default
22
23
  };
@@ -0,0 +1,51 @@
1
+ import { ToasterTypeOptions as l } from "../enums/toaster.js";
2
+ import { ref as p } from "vue";
3
+ import { useToaster as u } from "./useToaster.js";
4
+ import { useTranslations as f } from "./useTranslations.js";
5
+ const d = ["accessExpired", "domainRestricted", "ipRestricted", "insiderAccessRestricted"], n = p(null), a = (e) => {
6
+ try {
7
+ return new URL(e, window.location.href).origin === window.location.origin;
8
+ } catch {
9
+ return !0;
10
+ }
11
+ }, g = (e) => {
12
+ try {
13
+ const o = new URL(e, window.location.href);
14
+ return o.origin === window.location.origin ? o.href : "";
15
+ } catch {
16
+ return "";
17
+ }
18
+ }, w = (e) => {
19
+ try {
20
+ const o = JSON.parse(e);
21
+ return o && typeof o == "object" && Object.keys(o).length ? o : null;
22
+ } catch {
23
+ return null;
24
+ }
25
+ }, y = (e) => typeof (e == null ? void 0 : e.message) == "string" ? e.message : "", s = (e) => y(e) || f()("user-management.collaborate-forbidden-action"), c = (e) => {
26
+ u().showToaster({ type: l.Error, message: e });
27
+ }, R = (e, o, t) => {
28
+ if (t && !a(t))
29
+ return;
30
+ const r = w(o);
31
+ if (e === 403) {
32
+ c(s(r));
33
+ return;
34
+ }
35
+ if (e === 401 && (r == null ? void 0 : r.type) === "groupLevelAccess") {
36
+ c(s(r));
37
+ return;
38
+ }
39
+ if (e === 401 && typeof (r == null ? void 0 : r.type) == "string" && d.includes(r.type)) {
40
+ const i = typeof r.redirect == "string" ? g(r.redirect) : "";
41
+ if (i) {
42
+ window.location.replace(i);
43
+ return;
44
+ }
45
+ }
46
+ e !== 401 && e !== 419 || n.value || (window.isSessionExpired = !0, n.value = { status: e, data: r });
47
+ }, T = () => ({ authError: n });
48
+ export {
49
+ R as reportAuthError,
50
+ T as useAuthError
51
+ };
@@ -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
  };
@@ -226,8 +226,6 @@ const ke = () => {
226
226
  export {
227
227
  ge as buildPartnerAttributeNameSet,
228
228
  pe as findInvalidCustomFields,
229
- Ee as getInvalidDynamicContentTags,
230
- me as getRecommendationBlockIds,
231
229
  fe as parseRecommendationVariable,
232
230
  ke as useHtmlValidator
233
231
  };
@@ -1,7 +1,8 @@
1
1
  import { getCsrfToken as O } from "../utils/genericUtil.js";
2
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 = {
3
+ import { reportAuthError as j } from "./useAuthError.js";
4
+ const X = [401, 403, 419], N = (g = {}) => {
5
+ const h = m(!1), n = m(null), c = m(null), b = T(() => h.value), y = T(() => n.value !== null), w = {
5
6
  baseURL: "",
6
7
  timeout: 1e4,
7
8
  retry: 0,
@@ -10,79 +11,85 @@ const X = (b = {}) => {
10
11
  "Content-Type": "application/json",
11
12
  "X-CSRF-TOKEN": O(),
12
13
  Accept: "application/json",
14
+ // Without this a guest fetch gets a 302 to the login page, never an auth status.
13
15
  "X-Requested-With": "XMLHttpRequest"
14
16
  },
15
- ...b
16
- }, w = (e, s) => {
17
+ ...g
18
+ }, x = (e, r) => {
17
19
  if (e.startsWith("http://") || e.startsWith("https://"))
18
20
  return e;
19
- const t = s || v.baseURL || "";
21
+ const t = r || w.baseURL || "";
20
22
  return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
21
- }, P = (e) => new Promise((s, t) => {
23
+ }, P = (e) => new Promise((r, t) => {
22
24
  setTimeout(() => {
23
25
  t(new Error("Request timeout"));
24
26
  }, e);
25
- }), x = (e) => new Promise((s) => {
26
- 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 = {
27
+ }), R = (e) => new Promise((r) => {
28
+ setTimeout(r, e);
29
+ }), i = async (e, r, t, W = {}) => {
30
+ n.value = null, h.value = !0, c.value = new AbortController();
31
+ const a = { ...w, ...W }, E = x(r, a.baseURL), f = {
30
32
  method: e,
31
- headers: { ...n.headers },
32
- signal: u.value.signal,
33
- ...n
33
+ headers: { ...a.headers },
34
+ signal: c.value.signal,
35
+ ...a
34
36
  };
35
- 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) => {
37
+ t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete f.headers["Content-Type"], f.body = t) : f.body = JSON.stringify(t));
38
+ const v = async (p = 0) => {
39
+ if (window.isSessionExpired)
40
+ throw n.value = { message: "Session expired" }, new Error("Session expired");
37
41
  try {
38
- const o = [fetch(D, c)];
39
- n.timeout && o.push(P(n.timeout));
40
- const r = await Promise.race(o);
41
- if (!r.ok) {
42
- const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
43
- throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
42
+ const o = [fetch(E, f)];
43
+ a.timeout && o.push(P(a.timeout));
44
+ const s = await Promise.race(o);
45
+ if (!s.ok) {
46
+ const H = `HTTP Error: ${s.status} ${s.statusText}`, u = new Error(H);
47
+ throw u.status = s.status, u.statusText = s.statusText, u.response = s, u.authReported = X.includes(s.status), u.authReported && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((D) => j(
48
+ s.status,
49
+ D,
50
+ new URL(E, window.location.href).href
51
+ )).catch(() => {
52
+ }), u;
44
53
  }
45
- let f;
46
- const l = r.headers.get("content-type");
47
- return l != null && l.includes("application/json") ? f = await r.json() : l != null && l.includes("text/") ? f = await r.text() : f = await r.blob(), {
48
- data: f,
49
- status: r.status,
50
- statusText: r.statusText,
51
- headers: r.headers
54
+ let d;
55
+ const l = s.headers.get("content-type");
56
+ return l != null && l.includes("application/json") ? d = await s.json() : l != null && l.includes("text/") ? d = await s.text() : d = await s.blob(), {
57
+ data: d,
58
+ status: s.status,
59
+ statusText: s.statusText,
60
+ headers: s.headers
52
61
  };
53
62
  } catch (o) {
54
- 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);
57
- throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
63
+ const s = o instanceof Error && o.name === "AbortError";
64
+ if (p < (a.retry || 0) && !s)
65
+ return await R(a.retryDelay || 1e3), v(p + 1);
66
+ throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
58
67
  }
59
68
  };
60
69
  try {
61
- return await E();
70
+ return await v();
62
71
  } finally {
63
- p.value = !1, u.value = null;
72
+ h.value = !1, c.value = null;
64
73
  }
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) => {
66
- u.value && u.value.abort(e);
67
- }, W = () => {
68
- a.value = null;
74
+ }, A = (e, r) => i("GET", e, void 0, r), S = (e, r, t) => i("POST", e, r, t), U = (e, r, t) => i("PUT", e, r, t), C = (e, r, t) => i("PATCH", e, r, t), $ = (e, r) => i("DELETE", e, void 0, r), q = (e) => {
75
+ c.value && c.value.abort(e);
76
+ }, L = () => {
77
+ n.value = null;
69
78
  };
70
79
  return {
71
- // State
72
- loading: g,
73
- error: T(() => a.value),
80
+ loading: b,
81
+ error: T(() => n.value),
74
82
  hasError: y,
75
- // Methods
76
83
  request: i,
77
- get: C,
78
- post: R,
79
- put: $,
80
- patch: q,
81
- delete: A,
82
- cancel: U,
83
- clearError: W
84
+ get: A,
85
+ post: S,
86
+ put: U,
87
+ patch: C,
88
+ delete: $,
89
+ cancel: q,
90
+ clearError: L
84
91
  };
85
92
  };
86
93
  export {
87
- X as useHttp
94
+ N as useHttp
88
95
  };