@useinsider/guido 3.19.0-beta.3d545d6 → 3.19.0-beta.400eb14

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 (38) hide show
  1. package/dist/@types/config/schemas.js +104 -91
  2. package/dist/components/Guido.vue.js +1 -1
  3. package/dist/components/Guido.vue2.js +80 -76
  4. package/dist/components/organisms/base/AuthErrorModal.vue.js +5 -5
  5. package/dist/components/organisms/base/AuthErrorModal.vue2.js +29 -16
  6. package/dist/composables/useAuthError.js +1 -0
  7. package/dist/composables/useAutoSave.js +11 -11
  8. package/dist/composables/useHttp.js +34 -31
  9. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  10. package/dist/composables/useStripo.js +24 -20
  11. package/dist/config/migrator/index.js +14 -13
  12. package/dist/config/migrator/recommendationMigrator.js +28 -21
  13. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  14. package/dist/enums/extensions/recommendationBlock.js +30 -29
  15. package/dist/extensions/Blocks/Recommendation/block.js +15 -14
  16. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +45 -38
  17. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  18. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -29
  19. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  20. package/dist/guido.css +1 -1
  21. package/dist/src/@types/config/schemas.d.ts +16 -0
  22. package/dist/src/composables/useAuthError.d.ts +1 -0
  23. package/dist/src/composables/useConfig.d.ts +2 -0
  24. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  25. package/dist/src/config/migrator/index.d.ts +2 -1
  26. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  27. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  28. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  29. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  30. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  31. package/dist/src/stores/config.d.ts +20 -0
  32. package/dist/src/stores/onboarding.d.ts +4 -0
  33. package/dist/src/stores/recommendation.d.ts +5 -0
  34. package/dist/src/utils/dateUtil.d.ts +10 -0
  35. package/dist/src/utils/genericUtil.d.ts +3 -0
  36. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  37. package/dist/stores/onboarding.js +4 -0
  38. package/package.json +2 -2
@@ -1,58 +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";
12
- import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
13
- import ye from "./organisms/AutoSaveController.vue.js";
14
- import ge from "./organisms/base/AuthErrorModal.vue.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
+ import { useRecommendationExtensionStore as h } from "../extensions/Blocks/Recommendation/store/recommendation.js";
13
+ import ge from "./organisms/AutoSaveController.vue.js";
14
+ import Se from "./organisms/base/AuthErrorModal.vue.js";
15
15
  import ve from "./organisms/base/Toaster.vue.js";
16
- import Se from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
16
+ import be from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
17
17
  import he from "./organisms/header/HeaderWrapper.vue.js";
18
- import be from "./organisms/LoadingWrapper.vue.js";
19
- import Ee from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
20
- import we from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
21
- import { useStripoApi as Ce } from "../services/stripoApi.js";
22
- import { useConfigStore as De } from "../stores/config.js";
23
- import { useDynamicContentStore as ke } from "../stores/dynamic-content.js";
24
- import { useEditorStore as H } from "../stores/editor.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
25
  import { usePreviewStore as Me } from "../stores/preview.js";
26
- import { useTemplateStore as Te } from "../stores/template.js";
27
- import { useUnsubscribeStore as Fe } from "../stores/unsubscribe.js";
28
- import { readTrackFloor as $ } from "../utils/linkTrackingIds.js";
29
- const nt = /* @__PURE__ */ re({
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({
30
30
  __name: "Guido",
31
31
  props: {
32
32
  config: null,
33
33
  ready: { type: Boolean, default: !0 }
34
34
  },
35
35
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
36
- setup(z, { expose: q, emit: r }) {
37
- const a = z, K = m(
36
+ setup(q, { expose: K, emit: r }) {
37
+ const s = q, V = m(
38
38
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
39
- ), V = m(
40
- () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
41
39
  ), j = m(
42
- () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
40
+ () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
43
41
  ), J = m(
44
- () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
42
+ () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
45
43
  ), Q = m(
44
+ () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
45
+ ), X = m(
46
46
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
47
- ), E = O(), p = O(), f = ke(), w = Fe(), o = De();
48
- a.ready && o.init(a.config);
49
- const c = H(), X = Me(), 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 = () => {
50
50
  var t;
51
51
  return (t = E.value) == null ? void 0 : t.handleSave(!0);
52
52
  }, D = (t) => {
53
53
  c.loadingStatus = t;
54
54
  };
55
- ie(), me();
55
+ ce(), le();
56
56
  const y = () => {
57
57
  var t, e;
58
58
  return {
@@ -60,18 +60,18 @@ const nt = /* @__PURE__ */ re({
60
60
  userId: o.userId,
61
61
  username: o.username,
62
62
  partnerName: o.partnerName,
63
- savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || G.SAVED_MODULES,
64
- 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
65
65
  };
66
- }, { initPlugin: k, preloadRuntime: M } = ue(), { runExclusive: T, beginMount: F, isCurrentMount: R } = ce();
66
+ }, { initPlugin: k, preloadRuntime: F } = pe(), { runExclusive: M, beginMount: R, isCurrentMount: T } = de();
67
67
  let g = 0;
68
- const { getDefaultTemplate: I } = Ce(), { cloneTimersOnSave: L, hasTimerBlocks: A } = pe(), Z = u(() => {
68
+ const { getDefaultTemplate: I } = De(), { cloneTimersOnSave: L, hasTimerBlocks: U } = fe(), ee = u(() => {
69
69
  var t;
70
70
  return !((t = o.ui) != null && t.showHeader);
71
- }), ee = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), te = u(
72
- () => !!b().recommendationConfigs.strategyId
71
+ }), te = u(() => o.isFeatureEnabled("reusableRecommendationStrategy")), oe = u(
72
+ () => !!h().recommendationConfigs.strategyId
73
73
  );
74
- de({
74
+ me({
75
75
  onBack: () => {
76
76
  console.debug("guido:back"), r("back");
77
77
  },
@@ -86,80 +86,84 @@ const nt = /* @__PURE__ */ re({
86
86
  console.debug("guido:test-email:click"), r("test-email:click");
87
87
  }
88
88
  });
89
- const B = (t) => {
89
+ const A = (t) => {
90
90
  console.debug("dynamic-content:close", t), f.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
91
- }, U = () => {
91
+ }, B = () => {
92
92
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
93
93
  };
94
- x(() => l.value, () => {
94
+ W(() => l.value, () => {
95
95
  r("on-change", l.value);
96
96
  });
97
- const v = (t) => {
98
- const e = t, { attribute: s, position: d } = e.detail;
99
- 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);
100
100
  };
101
101
  let i = null;
102
- const S = () => {
102
+ const v = () => {
103
103
  var e;
104
- const t = document.querySelector(fe);
104
+ const t = document.querySelector(ye);
105
105
  (e = p.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
106
- }, h = async () => {
106
+ }, b = async () => {
107
107
  var t;
108
108
  try {
109
- o.initialized || o.init(a.config), c.templateId = o.templateId;
110
- 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) || [];
111
111
  w.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
112
- 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
+ };
113
117
  let n = {
114
- html: s && await W(s, _),
118
+ html: a && await G(a, P, O),
115
119
  css: d
116
120
  };
117
- n.html || (n = await I(), n.html = await W(n.html, _));
118
- const oe = N ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
119
- A(n.html) && (n.html = await L(n.html)), N && (c.trackIdSessionFloor = Math.max(oe, $(n.html)));
120
- const ne = {
121
- 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,
122
126
  onReady: () => {
123
127
  console.debug("guido:ready"), r("ready");
124
128
  }
125
129
  };
126
- g = F(), await k(n, y(), ne), f.selectedDynamicContentList = P;
130
+ g = R(), await k(n, y(), re), f.selectedDynamicContentList = N;
127
131
  } catch (e) {
128
132
  console.error("Failed to initialize Stripo editor:", e);
129
133
  }
130
134
  };
131
135
  return se(async () => {
132
136
  var e;
133
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), b().$reset(), H().$reset(), Te().$reset(), S();
137
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), h().$reset(), $().$reset(), Re().$reset(), v();
134
138
  const t = (e = p.value) == null ? void 0 : e.parentElement;
135
- if (t && (i = new ResizeObserver(S), i.observe(t)), M(), a.ready)
136
- await h();
139
+ if (t && (i = new ResizeObserver(v), i.observe(t)), F(), s.ready)
140
+ await b();
137
141
  else {
138
- const s = x(() => a.ready, (d) => {
139
- d && (s(), h());
142
+ const a = W(() => s.ready, (d) => {
143
+ d && (a(), b());
140
144
  });
141
145
  }
142
- document.addEventListener("dynamic-content:open", v);
143
- }), ae(() => {
144
- i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), b().disposeStrategyPageReturn(), T(async () => {
145
- 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))
146
150
  try {
147
151
  window.UIEditor.removeEditor();
148
152
  } catch {
149
153
  console.debug("Failed to remove Stripo editor: No editor found");
150
154
  }
151
155
  }), o.reset();
152
- }), q({
156
+ }), K({
153
157
  dynamicContent: {
154
- insert: B,
155
- close: U
158
+ insert: A,
159
+ close: B
156
160
  },
157
161
  hasChanges: l,
158
162
  saveSilent: C,
159
163
  setLoading: D
160
- }), { __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: M, runExclusive: T, beginMount: F, isCurrentMount: R, mountGeneration: g, getDefaultTemplate: I, cloneTimersOnSave: L, hasTimerBlocks: A, noHeader: Z, isRrsEnabled: ee, hasAssignedStrategy: te, insertDynamicContent: B, closeDynamicContent: U, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: S, startEditor: h, AutoSaveController: ye, AuthErrorModal: ge, Toaster: ve, FilterSelectionDrawer: Se, HeaderWrapper: he, LoadingWrapper: be, SaveAsTemplateDrawer: Ee, UnsubscribeWrapper: we };
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 };
161
165
  }
162
166
  });
163
167
  export {
164
- nt as default
168
+ rt as default
165
169
  };
@@ -2,17 +2,17 @@ import e from "./AuthErrorModal.vue2.js";
2
2
  /* empty css */
3
3
  import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
4
  var a = function() {
5
- var r = this, t = r._self._c, o = r._self._setupProxy;
6
- return o.authError ? t("div", { staticClass: "auth-error-modal" }, [t(o.WpModal, { attrs: { id: "guido__auth-error-modal", state: "warning", "close-button-status": !1, "close-on-outside-click": !1, "footer-button-options": o.footerButtonOptions, title: o.trans("action-builder.session-expired") }, on: { close: o.recover, "primary-action": o.recover } }, [t("p", [r._v(r._s(o.message))])])], 1) : r._e();
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
7
  }, n = [], i = /* @__PURE__ */ s(
8
8
  e,
9
9
  a,
10
10
  n,
11
11
  !1,
12
12
  null,
13
- "4f4ce4cc"
13
+ "b4d7ae51"
14
14
  );
15
- const f = i.exports;
15
+ const m = i.exports;
16
16
  export {
17
- f as default
17
+ m as default
18
18
  };
@@ -1,27 +1,40 @@
1
- import { defineComponent as i, computed as e } from "vue";
2
- import u from "../../wrappers/WpModal.vue.js";
3
- import { useAuthError as c } from "../../../composables/useAuthError.js";
4
- import { useTranslations as p } from "../../../composables/useTranslations.js";
5
- const _ = /* @__PURE__ */ i({
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
6
  __name: "AuthErrorModal",
7
- setup(l) {
8
- const o = p(), { authError: t } = c(), r = e(() => {
9
- var n;
10
- return ((n = t.value) == null ? void 0 : n.status) === 419;
11
- }), s = e(() => r.value ? o("settings.session-on-another-device") : o("journey-builder.login-session-expired")), a = e(() => ({
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(() => ({
12
15
  primaryButton: {
13
16
  type: "primary",
14
- labelText: o("journey-builder.login-popup-button")
17
+ labelText: r.value ? e("integration-hub.reload") : e("journey-builder.login-popup-button")
15
18
  },
16
19
  cancelOrBackButton: {
17
20
  type: "secondary",
18
21
  styling: "ghost",
19
- labelText: o("settings.cancel")
22
+ labelText: e("settings.cancel")
20
23
  }
21
- }));
22
- return { __sfc: !0, trans: o, authError: t, isTakenOver: r, message: s, footerButtonOptions: a, recover: () => {
23
- window.location.replace("/login");
24
- }, WpModal: u };
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 };
25
38
  }
26
39
  });
27
40
  export {
@@ -46,6 +46,7 @@ const d = ["accessExpired", "domainRestricted", "ipRestricted", "insiderAccessRe
46
46
  e !== 401 && e !== 419 || n.value || (window.isSessionExpired = !0, n.value = { status: e, data: r });
47
47
  }, T = () => ({ authError: n });
48
48
  export {
49
+ a as isPanelOrigin,
49
50
  R as reportAuthError,
50
51
  T as useAuthError
51
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 {
@@ -1,15 +1,15 @@
1
- import { getCsrfToken as O } from "../utils/genericUtil.js";
2
- import { ref as m, computed as T } from "vue";
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 = {
1
+ import { getCsrfToken as D } from "../utils/genericUtil.js";
2
+ import { ref as T, computed as w } from "vue";
3
+ import { isPanelOrigin as j, reportAuthError as X } from "./useAuthError.js";
4
+ const k = [401, 403, 419], _ = (g = {}) => {
5
+ const f = T(!1), n = T(null), c = T(null), b = w(() => f.value), y = w(() => n.value !== null), E = {
6
6
  baseURL: "",
7
7
  timeout: 1e4,
8
8
  retry: 0,
9
9
  retryDelay: 1e3,
10
10
  headers: {
11
11
  "Content-Type": "application/json",
12
- "X-CSRF-TOKEN": O(),
12
+ "X-CSRF-TOKEN": D(),
13
13
  Accept: "application/json",
14
14
  // Without this a guest fetch gets a 302 to the login page, never an auth status.
15
15
  "X-Requested-With": "XMLHttpRequest"
@@ -18,58 +18,61 @@ const X = [401, 403, 419], N = (g = {}) => {
18
18
  }, x = (e, r) => {
19
19
  if (e.startsWith("http://") || e.startsWith("https://"))
20
20
  return e;
21
- const t = r || w.baseURL || "";
21
+ const t = r || E.baseURL || "";
22
22
  return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
23
- }, P = (e) => new Promise((r, t) => {
23
+ }, R = (e) => new Promise((r, t) => {
24
24
  setTimeout(() => {
25
25
  t(new Error("Request timeout"));
26
26
  }, e);
27
- }), R = (e) => new Promise((r) => {
27
+ }), P = (e) => new Promise((r) => {
28
28
  setTimeout(r, e);
29
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
+ n.value = null, f.value = !0, c.value = new AbortController();
31
+ const a = { ...E, ...W }, p = x(r, a.baseURL), d = {
32
32
  method: e,
33
33
  headers: { ...a.headers },
34
34
  signal: c.value.signal,
35
35
  ...a
36
36
  };
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
+ t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete d.headers["Content-Type"], d.body = t) : d.body = JSON.stringify(t));
38
+ const v = async (m = 0) => {
39
+ if (window.isSessionExpired) {
40
+ n.value = { message: "Session expired", authReported: !0 };
41
+ const o = new Error("Session expired");
42
+ throw o.authReported = !0, o;
43
+ }
41
44
  try {
42
- const o = [fetch(E, f)];
43
- a.timeout && o.push(P(a.timeout));
45
+ const o = [fetch(p, d)];
46
+ a.timeout && o.push(R(a.timeout));
44
47
  const s = await Promise.race(o);
45
48
  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(
49
+ const H = `HTTP Error: ${s.status} ${s.statusText}`, l = new Error(H);
50
+ throw l.status = s.status, l.statusText = s.statusText, l.response = s, l.authReported = k.includes(s.status) && j(p), l.authReported && Promise.resolve().then(() => s.clone().text().catch(() => "")).then((O) => X(
48
51
  s.status,
49
- D,
50
- new URL(E, window.location.href).href
52
+ O,
53
+ new URL(p, window.location.href).href
51
54
  )).catch(() => {
52
- }), u;
55
+ }), l;
53
56
  }
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,
57
+ let h;
58
+ const u = s.headers.get("content-type");
59
+ return u != null && u.includes("application/json") ? h = await s.json() : u != null && u.includes("text/") ? h = await s.text() : h = await s.blob(), {
60
+ data: h,
58
61
  status: s.status,
59
62
  statusText: s.statusText,
60
63
  headers: s.headers
61
64
  };
62
65
  } catch (o) {
63
66
  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);
67
+ if (m < (a.retry || 0) && !s)
68
+ return await P(a.retryDelay || 1e3), v(m + 1);
66
69
  throw o instanceof Error ? o.name === "AbortError" ? n.value = { message: "Request was cancelled" } : n.value = { message: o.message } : n.value = o, o;
67
70
  }
68
71
  };
69
72
  try {
70
73
  return await v();
71
74
  } finally {
72
- h.value = !1, c.value = null;
75
+ f.value = !1, c.value = null;
73
76
  }
74
77
  }, 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
78
  c.value && c.value.abort(e);
@@ -78,7 +81,7 @@ const X = [401, 403, 419], N = (g = {}) => {
78
81
  };
79
82
  return {
80
83
  loading: b,
81
- error: T(() => n.value),
84
+ error: w(() => n.value),
82
85
  hasError: y,
83
86
  request: i,
84
87
  get: A,
@@ -91,5 +94,5 @@ const X = [401, 403, 419], N = (g = {}) => {
91
94
  };
92
95
  };
93
96
  export {
94
- N as useHttp
97
+ _ as useHttp
95
98
  };
@@ -1,23 +1,23 @@
1
- import { useRecommendation as I } from "./useRecommendation.js";
2
- import { useToaster as C } from "./useToaster.js";
1
+ import { useRecommendation as C } from "./useRecommendation.js";
2
+ import { useToaster as I } from "./useToaster.js";
3
3
  import { useTranslations as v } from "./useTranslations.js";
4
4
  import { ToasterTypeOptions as g } from "../enums/toaster.js";
5
5
  import "../extensions/Blocks/Recommendation/constants/selectors.js";
6
6
  import { CURRENT_CONFIG_VERSION as L } from "../extensions/Blocks/Recommendation/constants/defaultConfig.js";
7
7
  import { useRecommendationExtensionStore as b } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
- import { resolveMigrationTarget as R, buildLegacyMigrationPayload as T } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
- import { commitBlockChangeOutsidePanel as h } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
- import { useConfigStore as k } from "../stores/config.js";
8
+ import { resolveMigrationTarget as k, buildLegacyMigrationPayload as R } from "../extensions/Blocks/Recommendation/utils/legacyStrategyMigration.js";
9
+ import { commitBlockChangeOutsidePanel as T } from "../extensions/Blocks/Recommendation/utils/nodeConfigWriter.js";
10
+ import { useConfigStore as h } from "../stores/config.js";
11
11
  const F = () => {
12
- const e = b(), r = k(), { buildCampaignUrl: m } = I(), { showToaster: i } = C(), c = v();
12
+ const e = b(), r = h(), { buildCampaignUrl: m } = C(), { showToaster: c } = I(), a = v();
13
13
  return { convertLegacyStrategy: async () => {
14
14
  const t = e.currentRecommendationId;
15
15
  if (t === null || !e.isLegacyStrategyBlock || e.legacyConversionLoading)
16
16
  return "";
17
- const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = R({
17
+ const { strategy: d, productIds: y, size: l, strategyId: p, nodeConfigVersion: u } = e.recommendationConfigs, f = { strategyId: p, size: l, nodeConfigVersion: u }, s = k({
18
18
  campaignId: r.campaignId,
19
19
  templateLibraryId: r.templateLibraryId
20
- }), S = T({
20
+ }), S = R({
21
21
  blockId: t,
22
22
  url: m(String(t)),
23
23
  campaignId: r.campaignId,
@@ -29,30 +29,34 @@ const F = () => {
29
29
  let o;
30
30
  try {
31
31
  o = await e.convertLegacyStrategy(S, s);
32
- } catch (n) {
33
- return console.error("[useLegacyStrategyConversion] migration failed", n), i({
32
+ } catch (i) {
33
+ return console.error("[useLegacyStrategyConversion] migration failed", i), c({
34
34
  type: g.Error,
35
- message: c("email-editor.legacy-strategy-update-failed")
35
+ message: a("email-editor.legacy-strategy-migration-failed"),
36
+ actionButton: {
37
+ text: a("ds-steps.create-recommendation-strategy"),
38
+ onClick: () => e.openStrategyCreation()
39
+ }
36
40
  }), "";
37
41
  }
38
42
  try {
39
43
  await e.fetchStrategyProductsForBlock(t);
40
- } catch (n) {
41
- console.error("[useLegacyStrategyConversion] product refetch failed", n);
44
+ } catch (i) {
45
+ console.error("[useLegacyStrategyConversion] product refetch failed", i);
42
46
  }
43
- const a = e.blockStates[t];
44
- return a ? h(
47
+ const n = e.blockStates[t];
48
+ return n ? T(
45
49
  t,
46
50
  {
47
51
  strategyId: o,
48
- size: a.recommendationConfigs.size,
52
+ size: n.recommendationConfigs.size,
49
53
  configVersion: L
50
54
  },
51
- a.recommendationProducts,
55
+ n.recommendationProducts,
52
56
  "Converted legacy recommendation strategy"
53
- ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), i({
57
+ ) ? (e.currentRecommendationId === t && e.openLegacyStrategyUpdatedModal(), o) : (console.error("[useLegacyStrategyConversion] node write failed", t), e.revertLegacyConversion(t, f), c({
54
58
  type: g.Error,
55
- message: c("email-editor.legacy-strategy-update-failed")
59
+ message: a("email-editor.legacy-strategy-update-failed")
56
60
  }), "") : o;
57
61
  } };
58
62
  };