@useinsider/guido 3.19.0-beta.cac604e → 3.19.0-beta.cd75ff0

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 (77) hide show
  1. package/README.md +1 -0
  2. package/dist/@types/config/schemas.js +39 -37
  3. package/dist/components/Guido.vue.js +4 -4
  4. package/dist/components/Guido.vue2.js +83 -75
  5. package/dist/components/organisms/AutoSaveController.vue2.js +10 -8
  6. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  7. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  8. package/dist/components/organisms/header/EditorActions.vue.js +5 -5
  9. package/dist/components/organisms/header/EditorActions.vue2.js +83 -46
  10. package/dist/components/organisms/header/LeftSlot.vue.js +5 -5
  11. package/dist/components/organisms/header/LeftSlot.vue2.js +16 -12
  12. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +20 -0
  13. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +50 -0
  14. package/dist/components/wrappers/WpDrawer.vue.js +9 -7
  15. package/dist/components/wrappers/WpDrawer.vue2.js +1 -1
  16. package/dist/components/wrappers/WpModal.vue.js +1 -1
  17. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  18. package/dist/composables/useAuthError.js +52 -0
  19. package/dist/composables/useAutoSave.js +44 -42
  20. package/dist/composables/useHtmlCompiler.js +37 -26
  21. package/dist/composables/useHtmlValidator.js +2 -0
  22. package/dist/composables/useHttp.js +64 -54
  23. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  24. package/dist/composables/useSave.js +92 -45
  25. package/dist/composables/useSaveValidation.js +284 -0
  26. package/dist/composables/useSaveValidationRollout.js +20 -0
  27. package/dist/composables/useStripo.js +24 -20
  28. package/dist/composables/useToaster.js +17 -15
  29. package/dist/composables/validators/useCouponBlockValidator.js +24 -21
  30. package/dist/composables/validators/useLiquidValidator.js +15 -15
  31. package/dist/composables/validators/useUnsubscribeBlockValidator.js +34 -27
  32. package/dist/config/migrator/index.js +14 -13
  33. package/dist/config/migrator/recommendationPartnerMigrator.js +50 -0
  34. package/dist/enums/extensions/recommendationBlock.js +30 -29
  35. package/dist/enums/save-validation.js +4 -0
  36. package/dist/extensions/Blocks/Recommendation/block.js +54 -88
  37. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +32 -51
  38. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +11 -12
  39. package/dist/guido.css +1 -1
  40. package/dist/services/settingsApi.js +11 -0
  41. package/dist/src/@types/config/schemas.d.ts +4 -0
  42. package/dist/src/@types/save-validation.d.ts +19 -0
  43. package/dist/src/components/Guido.vue.d.ts +17 -1
  44. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  45. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +17 -1
  46. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +17 -1
  47. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +17 -1
  48. package/dist/src/components/organisms/validation/ValidationErrorDrawer.vue.d.ts +2 -0
  49. package/dist/src/components/wrappers/WpDrawer.vue.d.ts +4 -3
  50. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  51. package/dist/src/composables/useAuthError.d.ts +12 -0
  52. package/dist/src/composables/useAutoSave.d.ts +4 -1
  53. package/dist/src/composables/useConfig.d.ts +2 -0
  54. package/dist/src/composables/useHtmlValidator.d.ts +21 -0
  55. package/dist/src/composables/useHttp.d.ts +2 -0
  56. package/dist/src/composables/useSave.d.ts +6 -1
  57. package/dist/src/composables/useSaveValidation.d.ts +6 -0
  58. package/dist/src/composables/useSaveValidationRollout.d.ts +4 -0
  59. package/dist/src/composables/validators/useCouponBlockValidator.d.ts +3 -0
  60. package/dist/src/composables/validators/useUnsubscribeBlockValidator.d.ts +10 -0
  61. package/dist/src/config/migrator/index.d.ts +2 -1
  62. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  63. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  64. package/dist/src/enums/save-validation.d.ts +27 -0
  65. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -6
  66. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  67. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +13 -7
  68. package/dist/src/services/settingsApi.d.ts +6 -0
  69. package/dist/src/stores/config.d.ts +32 -0
  70. package/dist/src/stores/save-validation.d.ts +22 -0
  71. package/dist/src/stores/setup-settings.d.ts +4 -0
  72. package/dist/src/utils/templatePreparation.d.ts +30 -0
  73. package/dist/stores/config.js +84 -67
  74. package/dist/stores/save-validation.js +30 -0
  75. package/dist/stores/setup-settings.js +10 -0
  76. package/dist/utils/templatePreparation.js +39 -36
  77. package/package.json +1 -1
@@ -1,77 +1,114 @@
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({
1
+ import { defineComponent as I, computed as u, ref as c } from "vue";
2
+ import { useActionsApi as P } from "../../../composables/useActionsApi.js";
3
+ import { useConfig as j } from "../../../composables/useConfig.js";
4
+ import { useExport as G } from "../../../composables/useExport.js";
5
+ import { useTestEmailClick as J } from "../../../composables/useGuidoActions.js";
6
+ import { useHtmlCompiler as K } from "../../../composables/useHtmlCompiler.js";
7
+ import { useSave as N } from "../../../composables/useSave.js";
8
+ import { useSaveValidation as Q } from "../../../composables/useSaveValidation.js";
9
+ import { useSaveValidationRollout as U } from "../../../composables/useSaveValidationRollout.js";
10
+ import { useToaster as W } from "../../../composables/useToaster.js";
11
+ import { useTranslations as X } from "../../../composables/useTranslations.js";
12
+ import { useVersionHistoryApi as Y } from "../../../composables/useVersionHistoryApi.js";
13
+ import { useLiquidValidator as Z } from "../../../composables/validators/useLiquidValidator.js";
14
+ import { ToasterTypeOptions as $ } from "../../../enums/toaster.js";
15
+ import { useEditorStore as tt } from "../../../stores/editor.js";
16
+ import { useSaveValidationStore as et } from "../../../stores/save-validation.js";
17
+ import { useTemplateStore as ot } from "../../../stores/template.js";
18
+ import { getTooltipOptions as rt } from "../../../utils/tooltipUtils.js";
19
+ import { InButtonV2 as it } from "@useinsider/design-system-vue";
20
+ import { storeToRefs as st } from "pinia";
21
+ import at from "./MigrationConfirmModal.vue.js";
22
+ const Ot = /* @__PURE__ */ I({
19
23
  __name: "EditorActions",
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(), _ = () => {
24
+ setup(nt, { expose: b }) {
25
+ const { config: p, isFeatureEnabled: f } = j(), { exportHtml: d } = G(), { save: v } = N(), { validateCurrentTemplate: y } = Q(), { isEnabled: s } = U(), { showToaster: S, hideToaster: g, handleError: i } = W(), { openVersionHistory: h, closeVersionHistory: T } = Y(), { getCompiledEmail: V } = P(), { compileHtml: E } = K(), { validateLiquidSyntax: H } = Z(), e = tt(), w = et(), x = ot(), { hasMigrations: C } = st(x), r = X(), k = u(() => s.value ? r("email-editor.save-and-continue") : "Save"), a = c(!1), n = c(!1), _ = c(), l = J(), q = () => {
22
26
  if (e.isVersionHistoryOpen) {
23
- f();
27
+ T();
24
28
  return;
25
29
  }
26
- u();
27
- }, C = async () => {
28
- i.value = !0, await c(), i.value = !1;
29
- }, A = () => {
30
+ h();
31
+ }, B = async () => {
32
+ a.value = !0, await d(), a.value = !1;
33
+ }, L = () => {
30
34
  e.isSaveAsTemplateDrawerOpen = !0;
31
- }, M = x(() => e.isVersionHistoryOpen ? s("newsletter.close-version-history") : s("newsletter.version-history")), O = x(
35
+ }, R = u(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), D = u(
32
36
  () => {
33
37
  var t, o;
34
- return ((o = (t = l.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
38
+ return ((o = (t = p.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
35
39
  }
36
- ), V = async (t) => {
37
- a.value = !0, t || (e.loadingStatus = !0);
40
+ ), A = async (t) => {
41
+ n.value = !0, t || (e.loadingStatus = !0);
38
42
  let o;
39
43
  try {
40
- o = await p(t);
41
- } catch (T) {
42
- r(T, "Failed to save template");
44
+ o = await v(t);
45
+ } catch (M) {
46
+ i(M, "Failed to save template");
43
47
  } finally {
44
- a.value = !1, !t && !o && (e.loadingStatus = !1);
48
+ n.value = !1, !t && !o && (e.loadingStatus = !1);
45
49
  }
46
50
  return o;
47
- }, E = (t) => {
51
+ }, O = (t) => {
48
52
  var o;
49
- if (!t && S.value) {
50
- (o = H.value) == null || o.open();
53
+ if (!t && C.value) {
54
+ (o = _.value) == null || o.open();
51
55
  return;
52
56
  }
53
- return V(t);
57
+ return A(t);
58
+ }, m = async () => {
59
+ e.loadingStatus = !0;
60
+ try {
61
+ return await y();
62
+ } catch (t) {
63
+ return i(t, "Failed to prepare test email"), null;
64
+ } finally {
65
+ e.loadingStatus = !1;
66
+ }
54
67
  }, F = async () => {
55
- if (m("liquidSyntax")) {
68
+ const t = await m();
69
+ t != null && t.length ? w.open(t, "test") : t && g();
70
+ }, z = async () => {
71
+ if (s.value) {
72
+ const t = await m();
73
+ if (!t)
74
+ return;
75
+ if (t.length) {
76
+ S({
77
+ type: $.Error,
78
+ message: r("email-editor.validation-errors-found"),
79
+ actionButton: {
80
+ text: r("email-editor.check-errors"),
81
+ onClick: () => {
82
+ F();
83
+ }
84
+ },
85
+ autoHide: !1
86
+ });
87
+ return;
88
+ }
89
+ l();
90
+ return;
91
+ }
92
+ if (f("liquidSyntax")) {
56
93
  e.loadingStatus = !0;
57
94
  try {
58
- const { html: t } = await d({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = v(t);
59
- if (!await y(o))
95
+ const { html: t } = await V({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = E(t);
96
+ if (!await H(o))
60
97
  return;
61
98
  } catch (t) {
62
- r(t, "Failed to prepare test email");
99
+ i(t, "Failed to prepare test email");
63
100
  return;
64
101
  } finally {
65
102
  e.loadingStatus = !1;
66
103
  }
67
104
  }
68
- h();
105
+ l();
69
106
  };
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 };
107
+ return b({
108
+ handleSave: O
109
+ }), { __sfc: !0, config: p, isFeatureEnabled: f, exportHtml: d, save: v, validateCurrentTemplate: y, isEnabled: s, showToaster: S, hideToaster: g, handleError: i, openVersionHistory: h, closeVersionHistory: T, getCompiledEmail: V, compileHtml: E, validateLiquidSyntax: H, editorStore: e, saveValidationStore: w, templateStore: x, hasMigrations: C, trans: r, saveLabel: k, isExporting: a, isSaving: n, migrationModalRef: _, testEmailClick: l, handleVersionHistory: q, handleExport: B, handleSaveAs: L, versionHistoryTooltipText: R, isVersionHistoryButtonVisible: D, executeSave: A, handleSave: O, collectTestErrors: m, openTestErrors: F, handleTestEmail: z, getTooltipOptions: rt, InButtonV2: it, MigrationConfirmModal: at };
73
110
  }
74
111
  });
75
112
  export {
76
- ft as default
113
+ Ot as default
77
114
  };
@@ -1,16 +1,16 @@
1
1
  import o from "./LeftSlot.vue2.js";
2
2
  /* empty css */
3
- import a from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
3
+ import n from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var a = 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__ */ a(
7
+ }, i = [], r = /* @__PURE__ */ n(
8
8
  o,
9
- n,
9
+ a,
10
10
  i,
11
11
  !1,
12
12
  null,
13
- "73199fa4"
13
+ "b8f24f34"
14
14
  );
15
15
  const f = r.exports;
16
16
  export {
@@ -1,19 +1,19 @@
1
- import { defineComponent as l, computed as p, ref as d } from "vue";
1
+ import { defineComponent as m, 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 V } from "../../../stores/editor.js";
7
+ import { useEditorStore as y } from "../../../stores/editor.js";
8
8
  import { InButtonV2 as w } from "@useinsider/design-system-vue";
9
- import { useDebounceFn as y } from "../../../node_modules/@vueuse/shared/index.js";
10
- const D = /* @__PURE__ */ l({
9
+ import { useDebounceFn as V } from "../../../node_modules/@vueuse/shared/index.js";
10
+ const D = /* @__PURE__ */ m({
11
11
  __name: "LeftSlot",
12
12
  setup(C) {
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 = () => {
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 = () => {
17
17
  if (e.isVersionHistoryOpen) {
18
18
  n();
19
19
  return;
@@ -23,11 +23,15 @@ const D = /* @__PURE__ */ l({
23
23
  return;
24
24
  }
25
25
  i();
26
- }, a = y(() => {
27
- c(), r.value = !1;
26
+ }, c = V(async () => {
27
+ try {
28
+ await a();
29
+ } finally {
30
+ r.value = !1;
31
+ }
28
32
  }, 500);
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();
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();
31
35
  }, InButtonV2: w };
32
36
  }
33
37
  });
@@ -0,0 +1,20 @@
1
+ import a from "./ValidationErrorDrawer.vue2.js";
2
+ /* empty css */
3
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var i = function() {
5
+ var o = this, r = o._self._c, t = o._self._setupProxy;
6
+ return r(t.WpDrawer, { attrs: { id: "guido__validation-error-drawer", size: "small", "footer-button-group-options": t.footerButtonGroupOptions, status: t.store.isDrawerOpen, "title-text": t.titleText }, on: { onCloseEvent: t.handleClose, primaryButtonEvent: t.handleClose, secondaryButtonEvent: t.handleSaveAndContinue } }, [r("div", { staticClass: "d-f f-d-c validation-error-list" }, o._l(t.rows, function(e, n) {
7
+ return r("div", { key: n, staticClass: "d-f a-i-c validation-error-row" }, [r(t.InIcons, { staticClass: "validation-error-row__icon i-c-12", attrs: { name: "filled-caution-triangle" } }), r("span", { staticClass: "validation-error-row__text", domProps: { innerHTML: o._s(e) } })], 1);
8
+ }), 0)]);
9
+ }, l = [], d = /* @__PURE__ */ s(
10
+ a,
11
+ i,
12
+ l,
13
+ !1,
14
+ null,
15
+ "e48cebe9"
16
+ );
17
+ const f = d.exports;
18
+ export {
19
+ f as default
20
+ };
@@ -0,0 +1,50 @@
1
+ import { defineComponent as c, ref as f, computed as s } from "vue";
2
+ import v from "../../wrappers/WpDrawer.vue.js";
3
+ import { useSave as S } from "../../../composables/useSave.js";
4
+ import { useToaster as g } from "../../../composables/useToaster.js";
5
+ import { useTranslations as y } from "../../../composables/useTranslations.js";
6
+ import { useConfigStore as h } from "../../../stores/config.js";
7
+ import { useEditorStore as _ } from "../../../stores/editor.js";
8
+ import { useSaveValidationStore as w } from "../../../stores/save-validation.js";
9
+ import { escapeHtml as C } from "../../../utils/htmlEscape.js";
10
+ import { InIcons as E } from "@useinsider/design-system-vue";
11
+ const H = /* @__PURE__ */ c({
12
+ __name: "ValidationErrorDrawer",
13
+ setup(T) {
14
+ const r = y(), e = w(), a = _(), n = h(), { saveWithErrors: i } = S(), { handleError: l } = g(), o = f(!1), m = s(() => {
15
+ const t = {
16
+ primaryButton: {
17
+ styling: "solid",
18
+ type: "primary",
19
+ labelText: r("email-editor.update-design")
20
+ }
21
+ };
22
+ return n.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
23
+ styling: "solid",
24
+ type: "subtle-primary",
25
+ labelText: r("email-editor.save-and-continue"),
26
+ loadingStatus: o.value
27
+ }), t;
28
+ }), u = s(() => e.errors.map((t) => {
29
+ const p = t.detail ? ` (${C(t.detail)})` : "";
30
+ return `${t.message}${p}`;
31
+ })), d = s(() => `${r("email-editor.validation-errors")} (${u.value.length})`);
32
+ return { __sfc: !0, trans: r, store: e, editorStore: a, configStore: n, saveWithErrors: i, handleError: l, isSaving: o, footerButtonGroupOptions: m, rows: u, titleText: d, handleClose: () => {
33
+ e.isDrawerOpen && e.close();
34
+ }, handleSaveAndContinue: async () => {
35
+ if (!o.value) {
36
+ o.value = !0, a.loadingStatus = !0;
37
+ try {
38
+ await i() ? e.close() : a.loadingStatus = !1;
39
+ } catch (t) {
40
+ l(t, "Failed to save template"), a.loadingStatus = !1;
41
+ } finally {
42
+ o.value = !1;
43
+ }
44
+ }
45
+ }, WpDrawer: v, InIcons: E };
46
+ }
47
+ });
48
+ export {
49
+ H as default
50
+ };
@@ -1,17 +1,19 @@
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, 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) {
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) {
6
6
  return e.emit("cancelOrBackButtonEvent");
7
- }, onCloseEvent: function(o) {
7
+ }, onCloseEvent: function(n) {
8
8
  return e.emit("onCloseEvent");
9
- }, primaryButtonEvent: function(o) {
9
+ }, primaryButtonEvent: function(n) {
10
10
  return e.emit("primaryButtonEvent");
11
+ }, secondaryButtonEvent: function(n) {
12
+ return e.emit("secondaryButtonEvent");
11
13
  } }, scopedSlots: t._u([t.$slots.headerBottomSlot ? { key: "headerBottomSlot", fn: function() {
12
14
  return [t._t("headerBottomSlot")];
13
15
  }, proxy: !0 } : null, { key: "contentSlot", fn: function() {
14
- return [n("div", [t._t("default")], 2)];
16
+ return [o("div", [t._t("default")], 2)];
15
17
  }, proxy: !0 }], null, !0) });
16
18
  }, i = [], c = /* @__PURE__ */ s(
17
19
  r,
@@ -21,7 +23,7 @@ var u = function() {
21
23
  null,
22
24
  null
23
25
  );
24
- const f = c.exports;
26
+ const p = c.exports;
25
27
  export {
26
- f as default
28
+ p as default
27
29
  };
@@ -13,7 +13,7 @@ const r = /* @__PURE__ */ e({
13
13
  status: { type: Boolean },
14
14
  titleText: null
15
15
  },
16
- emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent"],
16
+ emits: ["cancelOrBackButtonEvent", "onCloseEvent", "primaryButtonEvent", "secondaryButtonEvent"],
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,52 @@
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
+ a as isPanelOrigin,
50
+ R as reportAuthError,
51
+ T as useAuthError
52
+ };
@@ -1,76 +1,78 @@
1
- import { useConfig as E } from "./useConfig.js";
2
- import { useEditorLock as p } from "./useEditorLock.js";
3
- import { useAutosaveStore as A, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
4
- import { useEditorStore as f } from "../stores/editor.js";
5
- import { computed as y, watch as I, onUnmounted as L } from "vue";
6
- const w = 18e4, v = 6e4, R = (b) => {
7
- const { isFeatureEnabled: S } = E(), o = f(), t = A(), { isEditorBusy: g } = p();
8
- let i = null, c = 0;
9
- const u = y(
10
- () => S("autosave") && t.isOn
11
- ), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
12
- hasChanges: o.hasChanges,
13
- isInSaveableState: o.isInSaveableState
1
+ import { useConfig as p } from "./useConfig.js";
2
+ import { useEditorLock as y } from "./useEditorLock.js";
3
+ import { useAutosaveStore as I, AUTOSAVE_STATUS as a } from "../stores/autosave.js";
4
+ import { useEditorStore as L } from "../stores/editor.js";
5
+ import { computed as w, watch as V, onUnmounted as k } from "vue";
6
+ const D = 18e4, b = 6e4, _ = (g, { clearsChanges: h = () => !0 } = {}) => {
7
+ const { isFeatureEnabled: m } = p(), s = L(), t = I(), { isEditorBusy: f } = y();
8
+ let o = null, l = 0, u = -1;
9
+ const d = w(
10
+ () => m("autosave") && t.isOn
11
+ ), A = () => s.hasChanges && s.isInSaveableState && s.changeSeq !== u, E = () => ({
12
+ hasChanges: s.hasChanges,
13
+ isInSaveableState: s.isInSaveableState,
14
+ isUnchangedSinceLastSave: s.changeSeq === u
14
15
  }), r = async (e) => {
15
- if (!u.value) {
16
+ if (!d.value) {
16
17
  console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
17
18
  return;
18
19
  }
19
- if (!m()) {
20
- console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: h() });
20
+ if (!A()) {
21
+ console.debug("guido:autosave:skipped", { trigger: e, reason: "gates-blocked", gates: E() });
21
22
  return;
22
23
  }
23
- if (t.status === s.SAVING) {
24
+ if (t.status === a.SAVING) {
24
25
  console.debug("guido:autosave:skipped", { trigger: e, reason: "already-saving" });
25
26
  return;
26
27
  }
27
- if (g()) {
28
+ if (f()) {
28
29
  console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
29
30
  return;
30
31
  }
31
- console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
32
+ console.debug("guido:autosave:save-start", { trigger: e }), t.status = a.SAVING, e === "visibility" && (l = Date.now());
33
+ const n = s.changeSeq;
32
34
  try {
33
- if (await b() === void 0) {
34
- console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
35
+ if (await g() === void 0) {
36
+ console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = a.ERROR;
35
37
  return;
36
38
  }
37
- o.hasChanges = !1, t.status = s.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
38
- } catch (a) {
39
- console.debug("guido:autosave:error", { trigger: e, error: a }), t.status = s.ERROR;
39
+ u = n, h() && (s.hasChanges = !1), t.status = a.SAVED, t.lastSavedAt = /* @__PURE__ */ new Date(), console.debug("guido:autosave:save-complete", { trigger: e, at: t.lastSavedAt });
40
+ } catch (S) {
41
+ console.debug("guido:autosave:error", { trigger: e, error: S }), t.status = a.ERROR;
40
42
  }
41
- }, n = () => {
43
+ }, i = () => {
42
44
  const { visibilityState: e } = document;
43
45
  if (console.debug("guido:autosave:visibility-change", {
44
46
  visibilityState: e,
45
- isActive: u.value
47
+ isActive: d.value
46
48
  }), e !== "hidden")
47
49
  return;
48
- const a = Date.now() - c;
49
- if (a < v) {
50
+ const n = Date.now() - l;
51
+ if (n < b) {
50
52
  console.debug("guido:autosave:visibility-debounced", {
51
- sinceLastMs: a,
52
- debounceMs: v
53
+ sinceLastMs: n,
54
+ debounceMs: b
53
55
  });
54
56
  return;
55
57
  }
56
- c = Date.now(), r("visibility");
57
- }, d = () => {
58
- i && (clearInterval(i), i = null);
59
- }, l = () => {
60
- document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
58
+ r("visibility");
59
+ }, c = () => {
60
+ o && (clearInterval(o), o = null);
61
+ }, v = () => {
62
+ document.removeEventListener("visibilitychange", i), window.removeEventListener("pagehide", i);
61
63
  };
62
- I(
63
- u,
64
+ V(
65
+ d,
64
66
  (e) => {
65
- console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
67
+ console.debug("guido:autosave:active-changed", { active: e }), e ? (c(), o = setInterval(() => {
66
68
  console.debug("guido:autosave:interval-tick"), r("interval");
67
- }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
69
+ }, D), document.addEventListener("visibilitychange", i), window.addEventListener("pagehide", i)) : (c(), v(), t.status = a.IDLE);
68
70
  },
69
71
  { immediate: !0 }
70
- ), L(() => {
71
- d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
72
+ ), k(() => {
73
+ c(), v(), t.status = a.IDLE, t.lastSavedAt = null;
72
74
  });
73
75
  };
74
76
  export {
75
- R as useAutoSave
77
+ _ as useAutoSave
76
78
  };