@useinsider/guido 3.19.0-beta.f884c35 → 3.19.0-beta.fcad6e5

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 (60) hide show
  1. package/dist/@types/config/schemas.js +104 -91
  2. package/dist/components/Guido.vue.js +6 -6
  3. package/dist/components/Guido.vue2.js +80 -75
  4. package/dist/components/organisms/base/AuthErrorModal.vue.js +18 -0
  5. package/dist/components/organisms/base/AuthErrorModal.vue2.js +42 -0
  6. package/dist/components/wrappers/WpModal.vue.js +1 -1
  7. package/dist/components/wrappers/WpModal.vue2.js +4 -3
  8. package/dist/composables/useAuthError.js +52 -0
  9. package/dist/composables/useAutoSave.js +11 -11
  10. package/dist/composables/useEmailTemplateApplier.js +38 -33
  11. package/dist/composables/useHttp.js +64 -54
  12. package/dist/composables/useLegacyStrategyConversion.js +23 -19
  13. package/dist/composables/useStripo.js +24 -20
  14. package/dist/composables/useToaster.js +17 -15
  15. package/dist/composables/validators/useLiquidValidator.js +15 -15
  16. package/dist/config/migrator/index.js +14 -13
  17. package/dist/config/migrator/itemsBlockMigrator.js +236 -248
  18. package/dist/config/migrator/recommendationMigrator.js +28 -21
  19. package/dist/config/migrator/recommendationPartnerMigrator.js +56 -0
  20. package/dist/enums/extensions/recommendationBlock.js +30 -29
  21. package/dist/extensions/Blocks/Items/constants/cardLayout.js +20 -0
  22. package/dist/extensions/Blocks/Items/controls/name/trimming.js +18 -17
  23. package/dist/extensions/Blocks/Items/controls/settingsControl.js +114 -105
  24. package/dist/extensions/Blocks/Items/enums/productEnums.js +14 -9
  25. package/dist/extensions/Blocks/Items/layouts/horizontal.html.js +11 -9
  26. package/dist/extensions/Blocks/Items/template.js +219 -204
  27. package/dist/extensions/Blocks/Recommendation/block.js +15 -14
  28. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +249 -199
  29. package/dist/extensions/Blocks/Recommendation/controls/main/strategy.js +72 -49
  30. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +30 -29
  31. package/dist/extensions/Blocks/Recommendation/utils/partnerCustomizations.js +3 -1
  32. package/dist/extensions/Blocks/Recommendation/utils/partnerScope.js +25 -0
  33. package/dist/guido.css +1 -1
  34. package/dist/src/@types/config/schemas.d.ts +16 -0
  35. package/dist/src/components/organisms/base/AuthErrorModal.vue.d.ts +2 -0
  36. package/dist/src/components/wrappers/WpModal.vue.d.ts +5 -1
  37. package/dist/src/composables/useAuthError.d.ts +12 -0
  38. package/dist/src/composables/useConfig.d.ts +2 -0
  39. package/dist/src/composables/useGuidoActions.d.ts +2 -0
  40. package/dist/src/composables/useHttp.d.ts +2 -0
  41. package/dist/src/config/migrator/index.d.ts +2 -1
  42. package/dist/src/config/migrator/recommendationPartnerMigrator.d.ts +19 -0
  43. package/dist/src/enums/extensions/recommendationBlock.d.ts +1 -1
  44. package/dist/src/extensions/Blocks/Items/constants/cardLayout.d.ts +44 -0
  45. package/dist/src/extensions/Blocks/Items/enums/productEnums.d.ts +3 -0
  46. package/dist/src/extensions/Blocks/Items/template.d.ts +19 -0
  47. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +8 -0
  48. package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +6 -0
  49. package/dist/src/extensions/Blocks/Recommendation/utils/partnerScope.d.ts +33 -0
  50. package/dist/src/mock/cortexChatStore.d.ts +12 -0
  51. package/dist/src/stores/config.d.ts +20 -0
  52. package/dist/src/stores/onboarding.d.ts +4 -0
  53. package/dist/src/stores/recommendation.d.ts +5 -0
  54. package/dist/src/utils/dateUtil.d.ts +10 -0
  55. package/dist/src/utils/genericUtil.d.ts +3 -0
  56. package/dist/static/styles/components/recommendation-strategy.css.js +9 -0
  57. package/dist/static/styles/components/version-history.css.js +2 -6
  58. package/dist/stores/onboarding.js +4 -0
  59. package/dist/utils/pairProductVariables.js +71 -71
  60. package/package.json +1 -1
@@ -1,57 +1,58 @@
1
- import { defineComponent as re, defineAsyncComponent as m, ref as x, computed as p, watch as W, 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 G } from "../config/migrator/index.js";
10
- import { ModuleFolderDefaults as z } from "../enums/defaults.js";
11
- import { RIBBON_SELECTOR as fe } from "../enums/onboarding.js";
1
+ import { defineComponent as ae, defineAsyncComponent as m, ref as W, computed as p, watch as G, 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 z } 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 E } 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 he from "./organisms/LoadingWrapper.vue.js";
18
- import be 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";
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";
23
24
  import { useEditorStore as w } from "../stores/editor.js";
24
- import { usePreviewStore as ke } from "../stores/preview.js";
25
- import { useTemplateStore as Fe } from "../stores/template.js";
25
+ import { usePreviewStore as Me } from "../stores/preview.js";
26
+ import { useTemplateStore as Re } from "../stores/template.js";
26
27
  import { useUnsubscribeStore as Te } from "../stores/unsubscribe.js";
27
- import { readTrackFloor as H } from "../utils/linkTrackingIds.js";
28
- const tt = /* @__PURE__ */ re({
28
+ import { readTrackFloor as $ } 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($, { expose: q, emit: r }) {
36
- const a = $, 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
- ), C = x(), f = x(), y = De(), D = Te(), o = Ce();
47
- a.ready && o.init(a.config);
48
- const c = w(), X = ke(), l = p(() => c.hasChanges), { isTestPartner: Y } = le(), k = () => {
47
+ ), C = W(), f = W(), y = Fe(), D = Te(), o = ke();
48
+ s.ready && o.init(s.config);
49
+ const c = w(), Y = Me(), l = p(() => c.hasChanges), { isTestPartner: Z } = ue(), k = () => {
49
50
  var t;
50
51
  return (t = C.value) == null ? void 0 : t.handleSave(!0);
51
52
  }, F = (t) => {
52
53
  c.loadingStatus = t;
53
54
  };
54
- ie(), me();
55
+ ce(), le();
55
56
  const g = () => {
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) || z.SAVED_MODULES,
63
- defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || z.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: T, preloadRuntime: I } = ue(), { runExclusive: M, beginMount: R, isCurrentMount: v } = ce();
66
+ }, { initPlugin: M, preloadRuntime: R } = pe(), { runExclusive: T, beginMount: I, isCurrentMount: S } = de();
66
67
  let u = 0;
67
- const { getDefaultTemplate: L } = we(), { cloneTimersOnSave: B, hasTimerBlocks: U } = pe(), Z = p(() => {
68
+ const { getDefaultTemplate: L } = De(), { cloneTimersOnSave: U, hasTimerBlocks: A } = fe(), ee = p(() => {
68
69
  var t;
69
70
  return !((t = o.ui) != null && t.showHeader);
70
- }), ee = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), te = p(
71
+ }), te = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), oe = p(
71
72
  () => !!E().recommendationConfigs.strategyId
72
73
  );
73
- de({
74
+ me({
74
75
  onBack: () => {
75
76
  console.debug("guido:back"), r("back");
76
77
  },
@@ -85,86 +86,90 @@ const tt = /* @__PURE__ */ re({
85
86
  console.debug("guido:test-email:click"), r("test-email:click");
86
87
  }
87
88
  });
88
- const A = (t) => {
89
+ const B = (t) => {
89
90
  console.debug("dynamic-content:close", t), y.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
90
- }, P = () => {
91
+ }, N = () => {
91
92
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
92
93
  };
93
- W(() => l.value, () => {
94
+ G(() => l.value, () => {
94
95
  r("on-change", l.value);
95
96
  });
96
- const S = (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 v = (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 h = () => {
102
+ const b = () => {
102
103
  var e;
103
- const t = document.querySelector(fe);
104
+ const t = document.querySelector(ye);
104
105
  (e = f.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
105
- }, b = async () => {
106
+ }, h = 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) || "", _ = (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) || "", P = (e == null ? void 0 : e.preselectedDynamicContent) || [];
110
111
  D.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
111
- const N = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, O = o.isFeatureEnabled("linkTrackingIds");
112
+ const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, O = o.isFeatureEnabled("linkTrackingIds"), x = {
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 G(s, N),
118
+ html: a && await z(a, _, x),
114
119
  css: d
115
120
  };
116
- n.html || (n = await L(), n.html = await G(n.html, N));
117
- const oe = O ? H(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
118
- U(n.html) && (n.html = await B(n.html)), O && (c.trackIdSessionFloor = Math.max(oe, H(n.html)));
119
- const ne = {
120
- preselectedDynamicContentList: _,
121
+ n.html || (n = await L(), n.html = await z(n.html, _, x));
122
+ const ne = O ? $(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
123
+ A(n.html) && (n.html = await U(n.html)), O && (c.trackIdSessionFloor = Math.max(ne, $(n.html)));
124
+ const re = {
125
+ preselectedDynamicContentList: P,
121
126
  onReady: () => {
122
127
  console.debug("guido:ready"), r("ready");
123
128
  }
124
129
  };
125
- u = R(), await T(n, g(), ne), y.selectedDynamicContentList = _;
130
+ u = I(), await M(n, g(), re), y.selectedDynamicContentList = P;
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"), E().$reset(), w().$reset(), Fe().$reset(), h();
137
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), E().$reset(), w().$reset(), Re().$reset(), b();
133
138
  const t = (e = f.value) == null ? void 0 : e.parentElement;
134
- if (t && (i = new ResizeObserver(h), i.observe(t)), I(), a.ready)
135
- await b();
139
+ if (t && (i = new ResizeObserver(b), i.observe(t)), R(), s.ready)
140
+ await h();
136
141
  else {
137
- const s = W(() => a.ready, (d) => {
138
- d && (s(), b());
142
+ const a = G(() => s.ready, (d) => {
143
+ d && (a(), h());
139
144
  });
140
145
  }
141
- document.addEventListener("dynamic-content:open", S);
142
- }), ae(() => {
143
- if (i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", S), E().disposeStrategyPageReturn(), v(u))
146
+ document.addEventListener("dynamic-content:open", v);
147
+ }), ie(() => {
148
+ if (i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), E().disposeStrategyPageReturn(), S(u))
144
149
  try {
145
150
  w().isStripoInitialized = !1;
146
151
  } catch (t) {
147
152
  console.debug("Failed to close the editor readiness gate on unmount", t);
148
153
  }
149
- M(async () => {
150
- if (v(u))
154
+ T(async () => {
155
+ if (S(u))
151
156
  try {
152
157
  window.UIEditor.removeEditor();
153
158
  } catch {
154
159
  console.debug("Failed to remove Stripo editor: No editor found");
155
160
  }
156
161
  }), o.reset();
157
- }), q({
162
+ }), K({
158
163
  dynamicContent: {
159
- insert: A,
160
- close: P
164
+ insert: B,
165
+ close: N
161
166
  },
162
167
  hasChanges: l,
163
168
  saveSilent: k,
164
169
  setLoading: F
165
- }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: V, AssignStrategyDrawer: j, RemoveStrategyModal: J, LegacyStrategyUpdatedModal: Q, headerWrapperRef: C, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: D, props: a, configStore: o, editorStore: c, previewStore: X, hasChanges: l, isTestPartner: Y, saveSilent: k, setLoading: F, emit: r, buildMetadata: g, initPlugin: T, preloadRuntime: I, runExclusive: M, beginMount: R, isCurrentMount: v, mountGeneration: u, getDefaultTemplate: L, cloneTimersOnSave: B, hasTimerBlocks: U, noHeader: Z, isRrsEnabled: ee, hasAssignedStrategy: te, insertDynamicContent: A, closeDynamicContent: P, handleDynamicContentOpen: S, ribbonObserver: i, updateRibbonOffset: h, startEditor: b, AutoSaveController: ye, Toaster: ge, FilterSelectionDrawer: ve, HeaderWrapper: Se, LoadingWrapper: he, SaveAsTemplateDrawer: be, UnsubscribeWrapper: Ee };
170
+ }), { __sfc: !0, PreviewContainer: V, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: C, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: D, props: s, configStore: o, editorStore: c, previewStore: Y, hasChanges: l, isTestPartner: Z, saveSilent: k, setLoading: F, emit: r, buildMetadata: g, initPlugin: M, preloadRuntime: R, runExclusive: T, beginMount: I, isCurrentMount: S, mountGeneration: u, getDefaultTemplate: L, cloneTimersOnSave: U, hasTimerBlocks: A, noHeader: ee, isRrsEnabled: te, hasAssignedStrategy: oe, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: ge, AuthErrorModal: Se, Toaster: ve, FilterSelectionDrawer: be, HeaderWrapper: he, LoadingWrapper: Ee, SaveAsTemplateDrawer: we, UnsubscribeWrapper: Ce };
166
171
  }
167
172
  });
168
173
  export {
169
- tt as default
174
+ rt as default
170
175
  };
@@ -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 {
@@ -1,4 +1,4 @@
1
- import { useActionsApi as z } from "./useActionsApi.js";
1
+ import { useActionsApi as x } from "./useActionsApi.js";
2
2
  import { useConfig as N } from "./useConfig.js";
3
3
  import { useEditorLock as K } from "./useEditorLock.js";
4
4
  import { useToaster as R } from "./useToaster.js";
@@ -11,20 +11,20 @@ import { extractUsedDynamicContent as J } from "../utils/registerUsedDynamicCont
11
11
  import { ref as V, watch as W } from "vue";
12
12
  const X = 250, U = 12e4, Y = 1e3, p = { status: "superseded" }, M = { status: "failed", error: new Error("Blueprint has no html to apply") }, a = V({}), A = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
13
13
  let d = null;
14
- const E = () => {
14
+ const T = () => {
15
15
  d && (clearInterval(d), d = null);
16
16
  }, me = () => {
17
- const { updateHtmlAndCss: i } = z(), { runExclusive: O } = K(), { showToaster: P } = R(), _ = F(), { template: b } = N(), L = G(), T = $(), w = (e, t) => {
17
+ const { updateHtmlAndCss: i } = x(), { runExclusive: O } = K(), { showToaster: P } = R(), _ = F(), { template: b } = N(), L = G(), w = $(), g = (e, t) => {
18
18
  try {
19
19
  P({ type: e, message: _(t) });
20
20
  } catch (o) {
21
21
  console.error("[guido:apply] could not show the apply toast", o);
22
22
  }
23
- }, g = (e, t) => {
24
- m.get(e) !== t && (m.set(e, t), w(v.Error, "newsletter.ai-template-failed-apply"));
25
- }, y = () => {
23
+ }, y = (e, t) => {
24
+ m.get(e) !== t && (m.set(e, t), g(v.Error, "newsletter.ai-template-failed-apply"));
25
+ }, h = () => {
26
26
  var e, t;
27
- return T.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
27
+ return w.isStripoInitialized && typeof ((t = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : t.updateHtmlAndCss) == "function";
28
28
  }, Q = (e) => {
29
29
  a.value[e] === void 0 && (a.value = { ...a.value, [e]: "pending" });
30
30
  }, l = (e, t) => {
@@ -37,69 +37,74 @@ const E = () => {
37
37
  } catch {
38
38
  }
39
39
  }, I = (e, t) => {
40
- m.delete(e), A.get(e) !== t && (A.set(e, t), w(v.Success, "newsletter.ai-template-applied"));
41
- }, h = async (e, t, o) => {
40
+ m.delete(e), A.get(e) !== t && (A.set(e, t), g(v.Success, "newsletter.ai-template-applied"));
41
+ }, C = async (e, t, o) => {
42
42
  const r = (u.get(e) ?? 0) + 1;
43
43
  u.set(e, r), l(e, "applying");
44
44
  try {
45
45
  await O(() => i(t, o));
46
46
  } catch (n) {
47
- return u.get(e) !== r ? p : (console.error("[guido:apply] editor did not acknowledge the template apply", n), l(e, "failed"), g(e, t), { status: "failed", error: n });
47
+ return u.get(e) !== r ? p : (console.error("[guido:apply] editor did not acknowledge the template apply", n), l(e, "failed"), y(e, t), { status: "failed", error: n });
48
48
  }
49
49
  return u.get(e) !== r ? p : (l(e, "applied"), H(t), I(e, t), { status: "applied" });
50
- }, B = (e) => {
50
+ }, z = (e) => {
51
51
  const t = s.get(e);
52
52
  t && (clearTimeout(t.timer), s.delete(e), t.settle(p));
53
- }, C = (e) => {
53
+ }, D = (e) => {
54
54
  const t = c.get(e);
55
55
  t && (clearTimeout(t.timer), c.delete(e), t.settle(p));
56
- }, q = () => {
57
- [...c.keys()].forEach(C);
58
- }, D = async () => {
56
+ }, B = () => {
57
+ [...c.keys()].forEach(D);
58
+ }, f = async () => {
59
59
  if (s.size === 0) {
60
- E();
60
+ T();
61
61
  return;
62
62
  }
63
- if (!y())
63
+ if (!h())
64
64
  return;
65
- E();
65
+ T();
66
66
  const e = [...s.entries()];
67
67
  s.clear(), e.forEach(([, n]) => clearTimeout(n.timer));
68
68
  const t = e.pop();
69
- if (e.forEach(([n, f]) => {
70
- l(n, "failed"), f.settle({ status: "failed", error: new Error("Displaced by a newer apply") });
69
+ if (e.forEach(([n, E]) => {
70
+ l(n, "failed"), E.settle({ status: "failed", error: new Error("Displaced by a newer apply") });
71
71
  }), !t)
72
72
  return;
73
73
  const [o, r] = t;
74
- r.settle(await h(o, r.html, r.css));
75
- }, x = (e, t, o) => new Promise((r) => {
76
- B(e);
74
+ r.settle(await C(o, r.html, r.css));
75
+ }, q = (e, t, o) => new Promise((r) => {
76
+ z(e);
77
77
  const n = setTimeout(() => {
78
- s.delete(e), l(e, "failed"), g(e, t), r({
78
+ s.delete(e), l(e, "failed"), y(e, t), r({
79
79
  status: "failed",
80
80
  error: new Error(`Editor did not become ready within ${U}ms`)
81
81
  });
82
82
  }, U);
83
83
  s.set(e, { html: t, css: o, timer: n, settle: r }), l(e, "applying"), d ?? (d = setInterval(() => {
84
- D();
84
+ f();
85
85
  }, Y));
86
- }), S = (e, t, o) => y() ? h(e, t, o) : x(e, t, o);
87
- return W(() => T.isStripoInitialized, (e) => {
88
- e && D();
86
+ }), S = (e, t, o) => {
87
+ if (h() && s.size === 0)
88
+ return C(e, t, o);
89
+ const r = q(e, t, o);
90
+ return f(), r;
91
+ };
92
+ return W(() => w.isStripoInitialized, (e) => {
93
+ e && f();
89
94
  }, { immediate: !0 }), { applyStatus: a, markPending: Q, applyTemplate: (e, t) => {
90
95
  const { html: o } = t;
91
- return o ? (q(), S(e, o, t.css ?? "")) : Promise.resolve(M);
96
+ return o ? (B(), S(e, o, t.css ?? "")) : Promise.resolve(M);
92
97
  }, applyTemplateDebounced: (e, t) => {
93
98
  const { html: o } = t;
94
99
  if (!o)
95
100
  return Promise.resolve(M);
96
101
  const r = t.css ?? "";
97
102
  return new Promise((n) => {
98
- C(e);
99
- const f = setTimeout(() => {
103
+ D(e);
104
+ const E = setTimeout(() => {
100
105
  c.delete(e), S(e, o, r).then(n);
101
106
  }, X);
102
- c.set(e, { timer: f, settle: n });
107
+ c.set(e, { timer: E, settle: n });
103
108
  });
104
109
  } };
105
110
  }, de = () => {
@@ -107,7 +112,7 @@ const E = () => {
107
112
  clearTimeout(i.timer), i.settle(p);
108
113
  }), c.clear(), s.forEach((i) => {
109
114
  clearTimeout(i.timer), i.settle(p);
110
- }), s.clear(), E(), m.clear(), a.value = {};
115
+ }), s.clear(), T(), m.clear(), a.value = {};
111
116
  };
112
117
  export {
113
118
  de as resetEmailTemplateApplier,