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

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 (40) hide show
  1. package/dist/components/Guido.vue.js +8 -8
  2. package/dist/components/Guido.vue2.js +79 -74
  3. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  4. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  5. package/dist/components/wrappers/WpModal.vue.js +1 -1
  6. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  7. package/dist/composables/useAuthError.js +52 -0
  8. package/dist/composables/useAutoSave.js +11 -11
  9. package/dist/composables/useHttp.js +64 -54
  10. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  11. package/dist/composables/useStripo.js +24 -20
  12. package/dist/composables/useToaster.js +17 -15
  13. package/dist/composables/validators/useLiquidValidator.js +15 -15
  14. package/dist/config/migrator/index.js +14 -13
  15. package/dist/config/migrator/recommendationMigrator.js +28 -21
  16. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  17. package/dist/enums/extensions/recommendationBlock.js +30 -29
  18. package/dist/extensions/Blocks/Recommendation/block.js +54 -88
  19. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +32 -51
  20. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +11 -12
  21. package/dist/guido.css +1 -1
  22. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  23. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  24. package/dist/src/composables/useAuthError.d.ts +12 -0
  25. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  26. package/dist/src/composables/useHttp.d.ts +2 -0
  27. package/dist/src/config/migrator/index.d.ts +2 -1
  28. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  29. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  30. package/dist/src/extensions/Blocks/Recommendation/block.d.ts +0 -6
  31. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +0 -5
  32. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +13 -7
  33. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  34. package/dist/src/stores/onboarding.d.ts +4 -0
  35. package/dist/src/stores/recommendation.d.ts +5 -0
  36. package/dist/src/utils/dateUtil.d.ts +10 -0
  37. package/dist/src/utils/genericUtil.d.ts +3 -0
  38. package/dist/static/styles/components/version-history.css.js +2 -6
  39. package/dist/stores/onboarding.js +4 -0
  40. package/package.json +1 -1
@@ -1,20 +1,20 @@
1
1
  import o from "./Guido.vue2.js";
2
2
  /* empty css */
3
- import i from "../_virtual/_plugin-vue2_normalizer.js";
4
- var t = function() {
3
+ import t from "../_virtual/_plugin-vue2_normalizer.js";
4
+ var i = function() {
5
5
  var a = this, r = a._self._c, e = a._self._setupProxy;
6
- return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), r(e.AutoSaveController), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
6
+ return r("div", { ref: "wrapperRef", staticClass: "guido-editor__wrapper", class: { "guido-editor__no-header": e.noHeader } }, [r(e.HeaderWrapper, { ref: "headerWrapperRef" }), r(e.AutoSaveController), e.editorStore.isPreviewModeOpen ? r(e.PreviewContainer) : a._e(), r("div", { directives: [{ name: "show", rawName: "v-show", value: !e.previewStore.isLoaded, expression: "!previewStore.isLoaded" }], staticClass: "guido-editor__container", class: { "guido-editor__no-header": e.noHeader }, attrs: { id: "guido-editor" } }), r(e.Toaster), r(e.AuthErrorModal), r(e.FilterSelectionDrawer), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.AssignStrategyDrawer) : a._e(), e.isRrsEnabled || e.hasAssignedStrategy ? r(e.RemoveStrategyModal) : a._e(), e.isRrsEnabled ? r(e.LegacyStrategyUpdatedModal) : a._e(), r(e.SaveAsTemplateDrawer), e.isTestPartner() ? a._e() : r(e.OnboardingWrapper, { on: { "onboarding-finished": function(_) {
7
7
  return e.emit("onboarding:finished");
8
8
  } } }), r(e.UnsubscribeWrapper), r(e.LoadingWrapper)], 1);
9
- }, s = [], n = /* @__PURE__ */ i(
9
+ }, s = [], n = /* @__PURE__ */ t(
10
10
  o,
11
- t,
11
+ i,
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "36867e2e"
15
+ "926b01f5"
16
16
  );
17
- const g = n.exports;
17
+ const f = n.exports;
18
18
  export {
19
- g as default
19
+ f as default
20
20
  };
@@ -1,57 +1,58 @@
1
- import { defineComponent as re, defineAsyncComponent as m, ref as O, computed as u, watch as x, onMounted as se, onUnmounted as ae } from "vue";
2
- import { useCortexBlueprintBridge as ie } from "../composables/useCortexBlueprintBridge.js";
3
- import { useEditorLock as ce } from "../composables/useEditorLock.js";
4
- import { provideGuidoActions as de } from "../composables/useGuidoActions.js";
5
- import { useGuidoStateBridge as me } from "../composables/useGuidoStateBridge.js";
6
- import { usePartner as le } from "../composables/usePartner.js";
7
- import { useStripo as ue } from "../composables/useStripo.js";
8
- import { useTimerClone as pe } from "../composables/useTimerClone.js";
9
- import { migrate as W } from "../config/migrator/index.js";
10
- import { ModuleFolderDefaults as G } from "../enums/defaults.js";
11
- import { RIBBON_SELECTOR as fe } from "../enums/onboarding.js";
1
+ import { defineComponent as ae, defineAsyncComponent as m, ref as x, computed as u, watch as W, onMounted as se, onUnmounted as ie } from "vue";
2
+ import { useCortexBlueprintBridge as ce } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as de } from "../composables/useEditorLock.js";
4
+ import { provideGuidoActions as me } from "../composables/useGuidoActions.js";
5
+ import { useGuidoStateBridge as le } from "../composables/useGuidoStateBridge.js";
6
+ import { usePartner as ue } from "../composables/usePartner.js";
7
+ import { useStripo as pe } from "../composables/useStripo.js";
8
+ import { useTimerClone as fe } from "../composables/useTimerClone.js";
9
+ import { migrate as G } from "../config/migrator/index.js";
10
+ import { ModuleFolderDefaults as H } from "../enums/defaults.js";
11
+ import { RIBBON_SELECTOR as ye } from "../enums/onboarding.js";
12
12
  import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
13
- import ye from "./organisms/AutoSaveController.vue.js";
14
- import ge from "./organisms/base/Toaster.vue.js";
15
- import ve from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
16
- import Se from "./organisms/header/HeaderWrapper.vue.js";
17
- import be from "./organisms/LoadingWrapper.vue.js";
18
- import he from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
19
- import Ee from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
20
- import { useStripoApi as we } from "../services/stripoApi.js";
21
- import { useConfigStore as Ce } from "../stores/config.js";
22
- import { useDynamicContentStore as De } from "../stores/dynamic-content.js";
23
- import { useEditorStore as H } from "../stores/editor.js";
24
- import { usePreviewStore as ke } from "../stores/preview.js";
25
- import { useTemplateStore as Te } from "../stores/template.js";
26
- import { useUnsubscribeStore as Fe } from "../stores/unsubscribe.js";
27
- import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
28
- const tt = /* @__PURE__ */ re({
13
+ import ge from "./organisms/AutoSaveController.vue.js";
14
+ import Se from "./organisms/base/AuthErrorModal.vue.js";
15
+ import ve from "./organisms/base/Toaster.vue.js";
16
+ import be from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
17
+ import he from "./organisms/header/HeaderWrapper.vue.js";
18
+ import Ee from "./organisms/LoadingWrapper.vue.js";
19
+ import we from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
20
+ import Ce from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
21
+ import { useStripoApi as De } from "../services/stripoApi.js";
22
+ import { useConfigStore as ke } from "../stores/config.js";
23
+ import { useDynamicContentStore as Fe } from "../stores/dynamic-content.js";
24
+ import { useEditorStore as $ } from "../stores/editor.js";
25
+ import { usePreviewStore as Me } from "../stores/preview.js";
26
+ import { useTemplateStore as Re } from "../stores/template.js";
27
+ import { useUnsubscribeStore as Te } from "../stores/unsubscribe.js";
28
+ import { readTrackFloor as z } from "../utils/linkTrackingIds.js";
29
+ const rt = /* @__PURE__ */ ae({
29
30
  __name: "Guido",
30
31
  props: {
31
32
  config: null,
32
33
  ready: { type: Boolean, default: !0 }
33
34
  },
34
35
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
35
- setup(z, { expose: q, emit: r }) {
36
- const a = z, K = m(
36
+ setup(q, { expose: K, emit: r }) {
37
+ const s = q, V = m(
37
38
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
38
- ), V = m(
39
- () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
40
39
  ), j = m(
41
- () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
40
+ () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
42
41
  ), J = m(
43
- () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
42
+ () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
44
43
  ), Q = m(
44
+ () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
45
+ ), X = m(
45
46
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
46
- ), E = O(), p = O(), f = De(), w = Fe(), o = Ce();
47
- a.ready && o.init(a.config);
48
- const c = H(), X = ke(), l = u(() => c.hasChanges), { isTestPartner: Y } = le(), C = () => {
47
+ ), E = x(), p = x(), f = Fe(), w = Te(), o = ke();
48
+ s.ready && o.init(s.config);
49
+ const c = $(), Y = Me(), l = u(() => c.hasChanges), { isTestPartner: Z } = ue(), C = () => {
49
50
  var t;
50
51
  return (t = E.value) == null ? void 0 : t.handleSave(!0);
51
52
  }, D = (t) => {
52
53
  c.loadingStatus = t;
53
54
  };
54
- ie(), me();
55
+ ce(), le();
55
56
  const y = () => {
56
57
  var t, e;
57
58
  return {
@@ -59,18 +60,18 @@ const tt = /* @__PURE__ */ re({
59
60
  userId: o.userId,
60
61
  username: o.username,
61
62
  partnerName: o.partnerName,
62
- savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
63
- defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || G.DEFAULT_MODULES
63
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || H.SAVED_MODULES,
64
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || H.DEFAULT_MODULES
64
65
  };
65
- }, { initPlugin: k, preloadRuntime: T } = ue(), { runExclusive: F, beginMount: M, isCurrentMount: R } = ce();
66
+ }, { initPlugin: k, preloadRuntime: F } = pe(), { runExclusive: M, beginMount: R, isCurrentMount: T } = de();
66
67
  let g = 0;
67
- const { getDefaultTemplate: I } = we(), { cloneTimersOnSave: L, hasTimerBlocks: B } = pe(), Z = u(() => {
68
+ const { getDefaultTemplate: I } = De(), { cloneTimersOnSave: L, hasTimerBlocks: U } = fe(), ee = u(() => {
68
69
  var t;
69
70
  return !((t = o.ui) != null && t.showHeader);
70
- }), ee = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), te = u(
71
+ }), te = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), oe = u(
71
72
  () => !!h().recommendationConfigs.strategyId
72
73
  );
73
- de({
74
+ me({
74
75
  onBack: () => {
75
76
  console.debug("guido:back"), r("back");
76
77
  },
@@ -85,80 +86,84 @@ const tt = /* @__PURE__ */ re({
85
86
  console.debug("guido:test-email:click"), r("test-email:click");
86
87
  }
87
88
  });
88
- const U = (t) => {
89
+ const A = (t) => {
89
90
  console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
90
- }, A = () => {
91
+ }, B = () => {
91
92
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
92
93
  };
93
- x(() => l.value, () => {
94
+ W(() => l.value, () => {
94
95
  r("on-change", l.value);
95
96
  });
96
- const v = (t) => {
97
- const e = t, { attribute: s, position: d } = e.detail;
98
- console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", s, d);
97
+ const S = (t) => {
98
+ const e = t, { attribute: a, position: d } = e.detail;
99
+ console.debug("dynamic-content:open", e.detail), r("dynamic-content:open", a, d);
99
100
  };
100
101
  let i = null;
101
- const S = () => {
102
+ const v = () => {
102
103
  var e;
103
- const t = document.querySelector(fe);
104
+ const t = document.querySelector(ye);
104
105
  (e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
105
106
  }, b = async () => {
106
107
  var t;
107
108
  try {
108
- o.initialized || o.init(a.config), c.templateId = o.templateId;
109
- const e = o.template, s = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
109
+ o.initialized || o.init(s.config), c.templateId = o.templateId;
110
+ const e = o.template, a = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", N = (e == null ? void 0 : e.preselectedDynamicContent) || [];
110
111
  w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
111
- const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, N = o.isFeatureEnabled("linkTrackingIds");
112
+ const P = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, _ = o.isFeatureEnabled("linkTrackingIds"), O = {
113
+ partnerName: o.partnerName,
114
+ campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
115
+ rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
116
+ };
112
117
  let n = {
113
- html: s && await W(s, _),
118
+ html: a && await G(a, P, O),
114
119
  css: d
115
120
  };
116
- n.html || (n = await I(), n.html = await W(n.html, _));
117
- const oe = N ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
118
- B(n.html) && (n.html = await L(n.html)), N && (c.trackIdSessionFloor = Math.max(oe, $(n.html)));
119
- const ne = {
120
- preselectedDynamicContentList: P,
121
+ n.html || (n = await I(), n.html = await G(n.html, P, O));
122
+ const ne = _ ? z(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
123
+ U(n.html) && (n.html = await L(n.html)), _ && (c.trackIdSessionFloor = Math.max(ne, z(n.html)));
124
+ const re = {
125
+ preselectedDynamicContentList: N,
121
126
  onReady: () => {
122
127
  console.debug("guido:ready"), r("ready");
123
128
  }
124
129
  };
125
- g = M(), await k(n, y(), ne), f.selectedDynamicContentList = P;
130
+ g = R(), await k(n, y(), re), f.selectedDynamicContentList = N;
126
131
  } catch (e) {
127
132
  console.error("Failed to initialize Stripo editor:", e);
128
133
  }
129
134
  };
130
135
  return se(async () => {
131
136
  var e;
132
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), H().$reset(), Te().$reset(), S();
137
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), $().$reset(), Re().$reset(), v();
133
138
  const t = (e = p.value) == null ? void 0 : e.parentElement;
134
- if (t && (i = new ResizeObserver(S), i.observe(t)), T(), a.ready)
139
+ if (t && (i = new ResizeObserver(v), i.observe(t)), F(), s.ready)
135
140
  await b();
136
141
  else {
137
- const s = x(() => a.ready, (d) => {
138
- d && (s(), b());
142
+ const a = W(() => s.ready, (d) => {
143
+ d && (a(), b());
139
144
  });
140
145
  }
141
- document.addEventListener("dynamic-content:open", v);
142
- }), ae(() => {
143
- i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), h().disposeStrategyPageReturn(), F(async () => {
144
- if (R(g))
146
+ document.addEventListener("dynamic-content:open", S);
147
+ }), ie(() => {
148
+ i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", S), h().disposeStrategyPageReturn(), M(async () => {
149
+ if (T(g))
145
150
  try {
146
151
  window.UIEditor.removeEditor();
147
152
  } catch {
148
153
  console.debug("Failed to remove Stripo editor: No editor found");
149
154
  }
150
155
  }), o.reset();
151
- }), q({
156
+ }), K({
152
157
  dynamicContent: {
153
- insert: U,
154
- close: A
158
+ insert: A,
159
+ close: B
155
160
  },
156
161
  hasChanges: l,
157
162
  saveSilent: C,
158
163
  setLoading: D
159
- }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, LegacyStrategyUpdatedModal: Q, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: a, configStore: o, editorStore: c, previewStore: X, hasChanges: l, isTestPartner: Y, saveSilent: C, setLoading: D, emit: r, buildMetadata: y, initPlugin: k, preloadRuntime: T, runExclusive: F, beginMount: M, isCurrentMount: R, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: B, noHeader: Z, isRrsEnabled: ee, hasAssignedStrategy: te, insertDynamicContent: U, closeDynamicContent: A, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: b, AutoSaveController: ye, Toaster: ge, FilterSelectionDrawer: ve, HeaderWrapper: Se, LoadingWrapper: be, SaveAsTemplateDrawer: he, UnsubscribeWrapper: Ee };
164
+ }), { __sfc: !0, PreviewContainer: V, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: E, wrapperRef: p, dynamicContentStore: f, unsubscribeStore: w, props: s, configStore: o, editorStore: c, previewStore: Y, hasChanges: l, isTestPartner: Z, saveSilent: C, setLoading: D, emit: r, buildMetadata: y, initPlugin: k, preloadRuntime: F, runExclusive: M, beginMount: R, isCurrentMount: T, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: U, noHeader: ee, isRrsEnabled: te, hasAssignedStrategy: oe, insertDynamicContent: A, closeDynamicContent: B, handleDynamicContentOpen: S, ribbonObserver: i, updateRibbonOffset: v, startEditor: b, AutoSaveController: ge, AuthErrorModal: Se, Toaster: ve, FilterSelectionDrawer: be, HeaderWrapper: he, LoadingWrapper: Ee, SaveAsTemplateDrawer: we, UnsubscribeWrapper: Ce };
160
165
  }
161
166
  });
162
167
  export {
163
- tt as default
168
+ rt as default
164
169
  };
@@ -0,0 +1,18 @@
1
+ import e from "./AuthErrorModal.vue2.js";
2
+ /* empty css */
3
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var a = function() {
5
+ var o = this, r = o._self._c, t = o._self._setupProxy;
6
+ return t.authError ? r("div", { staticClass: "auth-error-modal" }, [r(t.WpModal, { attrs: { id: "guido__auth-error-modal", state: "warning", "close-button-status": !1, "close-on-outside-click": !1, "footer-button-options": t.footerButtonOptions, title: t.title }, on: { close: t.dismiss, "primary-action": t.recover } }, [r("p", [o._v(o._s(t.message))])])], 1) : o._e();
7
+ }, n = [], i = /* @__PURE__ */ s(
8
+ e,
9
+ a,
10
+ n,
11
+ !1,
12
+ null,
13
+ "b4d7ae51"
14
+ );
15
+ const m = i.exports;
16
+ export {
17
+ m as default
18
+ };
@@ -0,0 +1,42 @@
1
+ import { defineComponent as c, computed as n } from "vue";
2
+ import p from "../../wrappers/WpModal.vue.js";
3
+ import { useAuthError as d } from "../../../composables/useAuthError.js";
4
+ import { useTranslations as m } from "../../../composables/useTranslations.js";
5
+ const _ = /* @__PURE__ */ c({
6
+ __name: "AuthErrorModal",
7
+ setup(v) {
8
+ const e = m(), { authError: t } = d(), r = n(() => {
9
+ var o;
10
+ return ((o = t.value) == null ? void 0 : o.status) === 419 && t.value.data !== null;
11
+ }), s = n(() => {
12
+ var o;
13
+ return ((o = t.value) == null ? void 0 : o.status) === 419 && t.value.data === null;
14
+ }), i = n(() => r.value ? e("integration-hub.reload-this-page") : e("action-builder.session-expired")), u = n(() => r.value ? e("auth.error-occurred-refresh") : s.value ? e("settings.session-on-another-device") : e("journey-builder.login-session-expired")), l = n(() => ({
15
+ primaryButton: {
16
+ type: "primary",
17
+ labelText: r.value ? e("integration-hub.reload") : e("journey-builder.login-popup-button")
18
+ },
19
+ cancelOrBackButton: {
20
+ type: "secondary",
21
+ styling: "ghost",
22
+ labelText: e("settings.cancel")
23
+ }
24
+ })), a = () => {
25
+ if (r.value) {
26
+ window.location.reload();
27
+ return;
28
+ }
29
+ window.location.replace("/");
30
+ };
31
+ return { __sfc: !0, trans: e, authError: t, isPageExpired: r, isTakenOver: s, title: i, message: u, footerButtonOptions: l, recover: a, dismiss: () => {
32
+ if (r.value) {
33
+ t.value = null;
34
+ return;
35
+ }
36
+ a();
37
+ }, WpModal: p };
38
+ }
39
+ });
40
+ export {
41
+ _ as default
42
+ };
@@ -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,17 +1,17 @@
1
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";
2
+ import { useEditorLock as f } from "./useEditorLock.js";
3
+ import { useAutosaveStore as p, AUTOSAVE_STATUS as s } from "../stores/autosave.js";
4
+ import { useEditorStore as A } from "../stores/editor.js";
5
5
  import { computed as y, watch as I, onUnmounted as L } from "vue";
6
6
  const w = 18e4, v = 6e4, R = (b) => {
7
- const { isFeatureEnabled: S } = E(), o = f(), t = A(), { isEditorBusy: g } = p();
7
+ const { isFeatureEnabled: S } = E(), o = A(), t = p(), { isEditorBusy: g } = f();
8
8
  let i = null, c = 0;
9
9
  const u = y(
10
10
  () => S("autosave") && t.isOn
11
11
  ), m = () => o.hasChanges && o.isInSaveableState, h = () => ({
12
12
  hasChanges: o.hasChanges,
13
13
  isInSaveableState: o.isInSaveableState
14
- }), r = async (e) => {
14
+ }), l = async (e) => {
15
15
  if (!u.value) {
16
16
  console.debug("guido:autosave:skipped", { trigger: e, reason: "not-active" });
17
17
  return;
@@ -28,7 +28,7 @@ const w = 18e4, v = 6e4, R = (b) => {
28
28
  console.debug("guido:autosave:skipped", { trigger: e, reason: "editor-busy" });
29
29
  return;
30
30
  }
31
- console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
31
+ e === "visibility" && (c = Date.now()), console.debug("guido:autosave:save-start", { trigger: e }), t.status = s.SAVING;
32
32
  try {
33
33
  if (await b() === void 0) {
34
34
  console.debug("guido:autosave:blocked", { trigger: e, reason: "save-returned-undefined" }), t.status = s.ERROR;
@@ -53,22 +53,22 @@ const w = 18e4, v = 6e4, R = (b) => {
53
53
  });
54
54
  return;
55
55
  }
56
- c = Date.now(), r("visibility");
56
+ l("visibility");
57
57
  }, d = () => {
58
58
  i && (clearInterval(i), i = null);
59
- }, l = () => {
59
+ }, r = () => {
60
60
  document.removeEventListener("visibilitychange", n), window.removeEventListener("pagehide", n);
61
61
  };
62
62
  I(
63
63
  u,
64
64
  (e) => {
65
65
  console.debug("guido:autosave:active-changed", { active: e }), e ? (d(), i = setInterval(() => {
66
- console.debug("guido:autosave:interval-tick"), r("interval");
67
- }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), l(), t.status = s.IDLE);
66
+ console.debug("guido:autosave:interval-tick"), l("interval");
67
+ }, w), document.addEventListener("visibilitychange", n), window.addEventListener("pagehide", n)) : (d(), r(), t.status = s.IDLE);
68
68
  },
69
69
  { immediate: !0 }
70
70
  ), L(() => {
71
- d(), l(), t.status = s.IDLE, t.lastSavedAt = null;
71
+ d(), r(), t.status = s.IDLE, t.lastSavedAt = null;
72
72
  });
73
73
  };
74
74
  export {