@useinsider/guido 3.20.1-beta.d2cba14 → 3.20.1-beta.d6ce0d6

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 (33) hide show
  1. package/dist/components/Guido.vue.js +1 -1
  2. package/dist/components/Guido.vue2.js +69 -69
  3. package/dist/components/organisms/AutoSaveController.vue2.js +10 -9
  4. package/dist/components/organisms/header/EditorActions.vue.js +4 -4
  5. package/dist/components/organisms/header/EditorActions.vue2.js +53 -51
  6. package/dist/components/organisms/validation/ValidationErrorDrawer.vue.js +3 -3
  7. package/dist/components/organisms/validation/ValidationErrorDrawer.vue2.js +23 -22
  8. package/dist/composables/useAutoSave.js +46 -44
  9. package/dist/composables/useLegacyStrategyConversion.js +16 -16
  10. package/dist/composables/useSave.js +26 -23
  11. package/dist/composables/useSaveValidation.js +113 -114
  12. package/dist/composables/useSaveValidationRollout.js +17 -6
  13. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +296 -223
  14. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +219 -205
  15. package/dist/extensions/Blocks/Recommendation/utils/blockRefresh.js +19 -0
  16. package/dist/extensions/Blocks/Recommendation/utils/nodeConfigWriter.js +51 -36
  17. package/dist/extensions/Blocks/Recommendation/utils/strategyCommit.js +31 -35
  18. package/dist/guido.css +1 -1
  19. package/dist/services/settingsApi.js +11 -0
  20. package/dist/src/components/Guido.vue.d.ts +1 -1
  21. package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
  22. package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
  23. package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
  24. package/dist/src/composables/useAutoSave.d.ts +4 -1
  25. package/dist/src/composables/useSaveValidationRollout.d.ts +1 -0
  26. package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +18 -3
  27. package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +8 -1
  28. package/dist/src/extensions/Blocks/Recommendation/utils/blockRefresh.d.ts +17 -0
  29. package/dist/src/extensions/Blocks/Recommendation/utils/nodeConfigWriter.d.ts +7 -0
  30. package/dist/src/services/settingsApi.d.ts +6 -0
  31. package/dist/src/stores/setup-settings.d.ts +4 -0
  32. package/dist/stores/setup-settings.js +10 -0
  33. package/package.json +2 -2
@@ -12,7 +12,7 @@ var t = function() {
12
12
  s,
13
13
  !1,
14
14
  null,
15
- "1b5c844a"
15
+ "d0a8825a"
16
16
  );
17
17
  const v = n.exports;
18
18
  export {
@@ -1,61 +1,61 @@
1
- import { defineComponent as se, defineAsyncComponent as m, ref as W, computed as p, watch as G, onMounted as ie, onUnmounted as ce } from "vue";
2
- import { useCortexBlueprintBridge as de } from "../composables/useCortexBlueprintBridge.js";
3
- import { useEditorLock as me } from "../composables/useEditorLock.js";
4
- import { provideGuidoActions as le } from "../composables/useGuidoActions.js";
5
- import { useGuidoStateBridge as ue } from "../composables/useGuidoStateBridge.js";
6
- import { usePartner as pe } from "../composables/usePartner.js";
7
- import { useSaveValidationRollout as fe } from "../composables/useSaveValidationRollout.js";
8
- import { useStripo as ye } from "../composables/useStripo.js";
9
- import { useTimerClone as ge } from "../composables/useTimerClone.js";
10
- import { migrate as V } from "../config/migrator/index.js";
11
- import { ModuleFolderDefaults as $ } from "../enums/defaults.js";
12
- import { RIBBON_SELECTOR as Se } from "../enums/onboarding.js";
1
+ import { defineComponent as ie, defineAsyncComponent as m, ref as G, computed as p, watch as V, onMounted as ce, onUnmounted as de } from "vue";
2
+ import { useCortexBlueprintBridge as me } from "../composables/useCortexBlueprintBridge.js";
3
+ import { useEditorLock as le } from "../composables/useEditorLock.js";
4
+ import { provideGuidoActions as ue } from "../composables/useGuidoActions.js";
5
+ import { useGuidoStateBridge as pe } from "../composables/useGuidoStateBridge.js";
6
+ import { usePartner as fe } from "../composables/usePartner.js";
7
+ import { useSaveValidationRollout as ye } from "../composables/useSaveValidationRollout.js";
8
+ import { useStripo as ge } from "../composables/useStripo.js";
9
+ import { useTimerClone as Se } from "../composables/useTimerClone.js";
10
+ import { migrate as $ } from "../config/migrator/index.js";
11
+ import { ModuleFolderDefaults as z } from "../enums/defaults.js";
12
+ import { RIBBON_SELECTOR as ve } from "../enums/onboarding.js";
13
13
  import { useRecommendationExtensionStore as E } from "../extensions/Blocks/Recommendation/store/recommendation.js";
14
- import ve from "./organisms/AutoSaveController.vue.js";
15
- import be from "./organisms/base/AuthErrorModal.vue.js";
16
- import he from "./organisms/base/Toaster.vue.js";
17
- import Ee from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
18
- import we from "./organisms/header/HeaderWrapper.vue.js";
19
- import De from "./organisms/LoadingWrapper.vue.js";
20
- import Ce from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
21
- import ke from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
14
+ import be from "./organisms/AutoSaveController.vue.js";
15
+ import he from "./organisms/base/AuthErrorModal.vue.js";
16
+ import Ee from "./organisms/base/Toaster.vue.js";
17
+ import we from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
18
+ import De from "./organisms/header/HeaderWrapper.vue.js";
19
+ import Ce from "./organisms/LoadingWrapper.vue.js";
20
+ import ke from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
21
+ import Re from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
22
22
  import Fe from "./organisms/validation/ValidationErrorDrawer.vue.js";
23
- import { useStripoApi as Re } from "../services/stripoApi.js";
24
- import { useConfigStore as Me } from "../stores/config.js";
25
- import { useDynamicContentStore as Te } from "../stores/dynamic-content.js";
23
+ import { useStripoApi as Me } from "../services/stripoApi.js";
24
+ import { useConfigStore as Te } from "../stores/config.js";
25
+ import { useDynamicContentStore as Ie } from "../stores/dynamic-content.js";
26
26
  import { useEditorStore as w } from "../stores/editor.js";
27
- import { usePreviewStore as Ie } from "../stores/preview.js";
28
- import { useSaveValidationStore as Le } from "../stores/save-validation.js";
29
- import { useTemplateStore as Ue } from "../stores/template.js";
30
- import { useUnsubscribeStore as Ae } from "../stores/unsubscribe.js";
31
- import { readTrackFloor as z } from "../utils/linkTrackingIds.js";
32
- const lt = /* @__PURE__ */ se({
27
+ import { usePreviewStore as Le } from "../stores/preview.js";
28
+ import { useSaveValidationStore as Ue } from "../stores/save-validation.js";
29
+ import { useTemplateStore as Ae } from "../stores/template.js";
30
+ import { useUnsubscribeStore as Be } from "../stores/unsubscribe.js";
31
+ import { readTrackFloor as H } from "../utils/linkTrackingIds.js";
32
+ const ut = /* @__PURE__ */ ie({
33
33
  __name: "Guido",
34
34
  props: {
35
35
  config: null,
36
36
  ready: { type: Boolean, default: !0 }
37
37
  },
38
38
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
39
- setup(H, { expose: q, emit: r }) {
40
- const s = H, K = m(
39
+ setup(q, { expose: K, emit: r }) {
40
+ const s = q, j = m(
41
41
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
42
- ), j = m(
43
- () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
44
42
  ), J = m(
45
- () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
43
+ () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
46
44
  ), Q = m(
47
- () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
45
+ () => import("./organisms/extensions/recommendation/AssignStrategyDrawer.vue.js")
48
46
  ), X = m(
47
+ () => import("./organisms/extensions/recommendation/RemoveStrategyModal.vue.js")
48
+ ), Y = m(
49
49
  () => import("./organisms/extensions/recommendation/LegacyStrategyUpdatedModal.vue.js")
50
- ), D = W(), f = W(), y = Te(), C = Ae(), o = Me();
50
+ ), D = G(), f = G(), y = Ie(), C = Be(), o = Te();
51
51
  s.ready && o.init(s.config);
52
- const c = w(), Y = Ie(), l = p(() => c.hasChanges), { isTestPartner: Z } = pe(), { isEnabled: ee } = fe(), k = () => {
52
+ const c = w(), Z = Le(), l = p(() => c.hasChanges), { isTestPartner: ee } = fe(), { isEnabled: te, loadRollout: k } = ye(), R = () => {
53
53
  var t;
54
54
  return (t = D.value) == null ? void 0 : t.handleSave(!0);
55
55
  }, F = (t) => {
56
56
  c.loadingStatus = t;
57
57
  };
58
- de(), ue();
58
+ me(), pe();
59
59
  const g = () => {
60
60
  var t, e;
61
61
  return {
@@ -63,18 +63,18 @@ const lt = /* @__PURE__ */ se({
63
63
  userId: o.userId,
64
64
  username: o.username,
65
65
  partnerName: o.partnerName,
66
- savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || $.SAVED_MODULES,
67
- defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || $.DEFAULT_MODULES
66
+ savedModulesFolderName: ((t = o.editor) == null ? void 0 : t.savedModulesFolderName) || z.SAVED_MODULES,
67
+ defaultModulesFolderName: ((e = o.editor) == null ? void 0 : e.defaultModulesFolderName) || z.DEFAULT_MODULES
68
68
  };
69
- }, { initPlugin: R, preloadRuntime: M } = ye(), { runExclusive: T, beginMount: I, isCurrentMount: S } = me();
69
+ }, { initPlugin: M, preloadRuntime: T } = ge(), { runExclusive: I, beginMount: L, isCurrentMount: S } = le();
70
70
  let u = 0;
71
- const { getDefaultTemplate: L } = Re(), { cloneTimersOnSave: U, hasTimerBlocks: A } = ge(), te = p(() => {
71
+ const { getDefaultTemplate: U } = Me(), { cloneTimersOnSave: A, hasTimerBlocks: B } = Se(), oe = p(() => {
72
72
  var t;
73
73
  return !((t = o.ui) != null && t.showHeader);
74
- }), oe = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), ne = p(
74
+ }), ne = p(() => o.isFeatureEnabled("reusableRecommendationStrategy")), re = p(
75
75
  () => !!E().recommendationConfigs.strategyId
76
76
  );
77
- le({
77
+ ue({
78
78
  onBack: () => {
79
79
  console.debug("guido:back"), r("back");
80
80
  },
@@ -89,12 +89,12 @@ const lt = /* @__PURE__ */ se({
89
89
  console.debug("guido:test-email:click"), r("test-email:click");
90
90
  }
91
91
  });
92
- const B = (t) => {
92
+ const N = (t) => {
93
93
  console.debug("dynamic-content:close", t), y.setSelectedDynamicContent(t), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: t }));
94
- }, N = () => {
94
+ }, P = () => {
95
95
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
96
96
  };
97
- G(() => l.value, () => {
97
+ V(() => l.value, () => {
98
98
  r("on-change", l.value);
99
99
  });
100
100
  const v = (t) => {
@@ -104,57 +104,57 @@ const lt = /* @__PURE__ */ se({
104
104
  let i = null;
105
105
  const b = () => {
106
106
  var e;
107
- const t = document.querySelector(Se);
107
+ const t = document.querySelector(ve);
108
108
  (e = f.value) == null || e.style.setProperty("--ribbon-offset", `${(t == null ? void 0 : t.offsetHeight) ?? 0}px`);
109
109
  }, h = async () => {
110
110
  var t;
111
111
  try {
112
112
  o.initialized || o.init(s.config), c.templateId = o.templateId;
113
- 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) || [];
113
+ const e = o.template, a = (e == null ? void 0 : e.html) || "", d = (e == null ? void 0 : e.css) || "", _ = (e == null ? void 0 : e.preselectedDynamicContent) || [];
114
114
  C.selectedUnsubscribePages = (e == null ? void 0 : e.selectedUnsubscribePages) || [];
115
- const _ = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, O = o.isFeatureEnabled("linkTrackingIds"), x = {
115
+ const O = ((t = e == null ? void 0 : e.migration) == null ? void 0 : t.recommendationConfigs) ?? {}, x = o.isFeatureEnabled("linkTrackingIds"), W = {
116
116
  partnerName: o.partnerName,
117
117
  campaignUrls: e == null ? void 0 : e.recommendationCampaignUrls,
118
118
  rrsEnabled: o.isFeatureEnabled("reusableRecommendationStrategy")
119
119
  };
120
120
  let n = {
121
- html: a && await V(a, _, x),
121
+ html: a && await $(a, O, W),
122
122
  css: d
123
123
  };
124
- n.html || (n = await L(), n.html = await V(n.html, _, x));
125
- const re = O ? z(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
126
- A(n.html) && (n.html = await U(n.html)), O && (c.trackIdSessionFloor = Math.max(re, z(n.html)));
127
- const ae = {
128
- preselectedDynamicContentList: P,
124
+ n.html || (n = await U(), n.html = await $(n.html, O, W));
125
+ const ae = x ? H(n.html, (e == null ? void 0 : e.trackIdCounter) || 0) : 0;
126
+ B(n.html) && (n.html = await A(n.html)), x && (c.trackIdSessionFloor = Math.max(ae, H(n.html)));
127
+ const se = {
128
+ preselectedDynamicContentList: _,
129
129
  onReady: () => {
130
130
  console.debug("guido:ready"), r("ready");
131
131
  }
132
132
  };
133
- u = I(), await R(n, g(), ae), y.selectedDynamicContentList = P;
133
+ u = L(), await M(n, g(), se), y.selectedDynamicContentList = _;
134
134
  } catch (e) {
135
135
  console.error("Failed to initialize Stripo editor:", e);
136
136
  }
137
137
  };
138
- return ie(async () => {
138
+ return ce(async () => {
139
139
  var e;
140
- console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), E().$reset(), w().$reset(), Ue().$reset(), Le().$reset(), b();
140
+ console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow"), E().$reset(), w().$reset(), Ae().$reset(), Ue().$reset(), k(), b();
141
141
  const t = (e = f.value) == null ? void 0 : e.parentElement;
142
- if (t && (i = new ResizeObserver(b), i.observe(t)), M(), s.ready)
142
+ if (t && (i = new ResizeObserver(b), i.observe(t)), T(), s.ready)
143
143
  await h();
144
144
  else {
145
- const a = G(() => s.ready, (d) => {
145
+ const a = V(() => s.ready, (d) => {
146
146
  d && (a(), h());
147
147
  });
148
148
  }
149
149
  document.addEventListener("dynamic-content:open", v);
150
- }), ce(() => {
150
+ }), de(() => {
151
151
  if (i == null || i.disconnect(), document.removeEventListener("dynamic-content:open", v), E().disposeStrategyPageReturn(), S(u))
152
152
  try {
153
153
  w().isStripoInitialized = !1;
154
154
  } catch (t) {
155
155
  console.debug("Failed to close the editor readiness gate on unmount", t);
156
156
  }
157
- T(async () => {
157
+ I(async () => {
158
158
  if (S(u))
159
159
  try {
160
160
  window.UIEditor.removeEditor();
@@ -162,17 +162,17 @@ const lt = /* @__PURE__ */ se({
162
162
  console.debug("Failed to remove Stripo editor: No editor found");
163
163
  }
164
164
  }), o.reset();
165
- }), q({
165
+ }), K({
166
166
  dynamicContent: {
167
- insert: B,
168
- close: N
167
+ insert: N,
168
+ close: P
169
169
  },
170
170
  hasChanges: l,
171
- saveSilent: k,
171
+ saveSilent: R,
172
172
  setLoading: F
173
- }), { __sfc: !0, PreviewContainer: K, OnboardingWrapper: j, AssignStrategyDrawer: J, RemoveStrategyModal: Q, LegacyStrategyUpdatedModal: X, headerWrapperRef: D, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: C, props: s, configStore: o, editorStore: c, previewStore: Y, hasChanges: l, isTestPartner: Z, isSaveValidationEnabled: ee, saveSilent: k, setLoading: F, emit: r, buildMetadata: g, initPlugin: R, preloadRuntime: M, runExclusive: T, beginMount: I, isCurrentMount: S, mountGeneration: u, getDefaultTemplate: L, cloneTimersOnSave: U, hasTimerBlocks: A, noHeader: te, isRrsEnabled: oe, hasAssignedStrategy: ne, insertDynamicContent: B, closeDynamicContent: N, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: ve, AuthErrorModal: be, Toaster: he, FilterSelectionDrawer: Ee, HeaderWrapper: we, LoadingWrapper: De, SaveAsTemplateDrawer: Ce, UnsubscribeWrapper: ke, ValidationErrorDrawer: Fe };
173
+ }), { __sfc: !0, PreviewContainer: j, OnboardingWrapper: J, AssignStrategyDrawer: Q, RemoveStrategyModal: X, LegacyStrategyUpdatedModal: Y, headerWrapperRef: D, wrapperRef: f, dynamicContentStore: y, unsubscribeStore: C, props: s, configStore: o, editorStore: c, previewStore: Z, hasChanges: l, isTestPartner: ee, isSaveValidationEnabled: te, loadRollout: k, saveSilent: R, setLoading: F, emit: r, buildMetadata: g, initPlugin: M, preloadRuntime: T, runExclusive: I, beginMount: L, isCurrentMount: S, mountGeneration: u, getDefaultTemplate: U, cloneTimersOnSave: A, hasTimerBlocks: B, noHeader: oe, isRrsEnabled: ne, hasAssignedStrategy: re, insertDynamicContent: N, closeDynamicContent: P, handleDynamicContentOpen: v, ribbonObserver: i, updateRibbonOffset: b, startEditor: h, AutoSaveController: be, AuthErrorModal: he, Toaster: Ee, FilterSelectionDrawer: we, HeaderWrapper: De, LoadingWrapper: Ce, SaveAsTemplateDrawer: ke, UnsubscribeWrapper: Re, ValidationErrorDrawer: Fe };
174
174
  }
175
175
  });
176
176
  export {
177
- lt as default
177
+ ut as default
178
178
  };
@@ -1,14 +1,15 @@
1
- import { defineComponent as r } from "vue";
2
- import { useAutoSave as s } from "../../composables/useAutoSave.js";
3
- import { useSave as n } from "../../composables/useSave.js";
4
- import { useSaveValidationRollout as u } from "../../composables/useSaveValidationRollout.js";
5
- const v = /* @__PURE__ */ r({
1
+ import { defineComponent as n } from "vue";
2
+ import { useAutoSave as u } from "../../composables/useAutoSave.js";
3
+ import { useSave as i } from "../../composables/useSave.js";
4
+ import { useSaveValidationRollout as l } from "../../composables/useSaveValidationRollout.js";
5
+ import { useConfigStore as m } from "../../stores/config.js";
6
+ const d = /* @__PURE__ */ n({
6
7
  __name: "AutoSaveController",
7
- setup(m) {
8
- const { save: e, saveRawOnly: o } = n(), { isEnabled: t } = u(), a = () => t.value ? o() : e(!1, !0);
9
- return s(a), { __sfc: !0, save: e, saveRawOnly: o, isEnabled: t, backgroundSave: a };
8
+ setup(f) {
9
+ const { save: e, saveRawOnly: t } = i(), { isEnabled: r } = l(), a = m(), o = () => r.value && a.allowSaveWithErrors, s = () => o() ? t() : e(!1, !0);
10
+ return u(s, { clearsChanges: () => !o() }), { __sfc: !0, save: e, saveRawOnly: t, isEnabled: r, configStore: a, isRawAutosave: o, backgroundSave: s };
10
11
  }
11
12
  });
12
13
  export {
13
- v as default
14
+ d as default
14
15
  };
@@ -9,15 +9,15 @@ var u = function() {
9
9
  } } }), e(t.MigrationConfirmModal, { ref: "migrationModalRef", on: { confirm: function(r) {
10
10
  return t.executeSave(!1);
11
11
  } } })], 1);
12
- }, c = [], p = /* @__PURE__ */ d(
12
+ }, p = [], c = /* @__PURE__ */ d(
13
13
  l,
14
14
  u,
15
- c,
15
+ p,
16
16
  !1,
17
17
  null,
18
- "2cccbd44"
18
+ "baf7a5dd"
19
19
  );
20
- const v = p.exports;
20
+ const v = c.exports;
21
21
  export {
22
22
  v as default
23
23
  };
@@ -1,83 +1,85 @@
1
- import { defineComponent as I, computed as c, ref as u } from "vue";
1
+ import { defineComponent as I, computed as u, ref as c } from "vue";
2
2
  import { useActionsApi as P } from "../../../composables/useActionsApi.js";
3
- import { useConfig as W } from "../../../composables/useConfig.js";
4
- import { useExport as j } from "../../../composables/useExport.js";
5
- import { useTestEmailClick as G } from "../../../composables/useGuidoActions.js";
6
- import { useHtmlCompiler as J } from "../../../composables/useHtmlCompiler.js";
7
- import { useSave as K } from "../../../composables/useSave.js";
8
- import { useSaveValidation as N } from "../../../composables/useSaveValidation.js";
9
- import { useSaveValidationRollout as Q } from "../../../composables/useSaveValidationRollout.js";
10
- import { useToaster as U } from "../../../composables/useToaster.js";
3
+ import { useConfig as j } from "../../../composables/useConfig.js";
4
+ import { useExport as G } from "../../../composables/useExport.js";
5
+ import { useTestEmailClick as J } from "../../../composables/useGuidoActions.js";
6
+ import { useHtmlCompiler as K } from "../../../composables/useHtmlCompiler.js";
7
+ import { useSave as N } from "../../../composables/useSave.js";
8
+ import { useSaveValidation as Q } from "../../../composables/useSaveValidation.js";
9
+ import { useSaveValidationRollout as U } from "../../../composables/useSaveValidationRollout.js";
10
+ import { useToaster as W } from "../../../composables/useToaster.js";
11
11
  import { useTranslations as X } from "../../../composables/useTranslations.js";
12
12
  import { useVersionHistoryApi as Y } from "../../../composables/useVersionHistoryApi.js";
13
13
  import { useLiquidValidator as Z } from "../../../composables/validators/useLiquidValidator.js";
14
14
  import { ToasterTypeOptions as $ } from "../../../enums/toaster.js";
15
- import { useConfigStore as tt } from "../../../stores/config.js";
16
- import { useEditorStore as ot } from "../../../stores/editor.js";
15
+ import { useEditorStore as tt } from "../../../stores/editor.js";
17
16
  import { useSaveValidationStore as et } from "../../../stores/save-validation.js";
18
- import { useTemplateStore as rt } from "../../../stores/template.js";
19
- import { getTooltipOptions as it } from "../../../utils/tooltipUtils.js";
20
- import { InButtonV2 as st } from "@useinsider/design-system-vue";
21
- import { storeToRefs as at } from "pinia";
22
- import nt from "./MigrationConfirmModal.vue.js";
23
- const bt = /* @__PURE__ */ I({
17
+ import { useTemplateStore as ot } from "../../../stores/template.js";
18
+ import { getTooltipOptions as rt } from "../../../utils/tooltipUtils.js";
19
+ import { InButtonV2 as it } from "@useinsider/design-system-vue";
20
+ import { storeToRefs as st } from "pinia";
21
+ import at from "./MigrationConfirmModal.vue.js";
22
+ const Ot = /* @__PURE__ */ I({
24
23
  __name: "EditorActions",
25
- setup(lt, { expose: k }) {
26
- const { config: p, isFeatureEnabled: f } = W(), { exportHtml: d } = j(), { save: v } = K(), { validateCurrentTemplate: y } = N(), { isEnabled: i } = Q(), { showToaster: S, handleError: s } = U(), { openVersionHistory: g, closeVersionHistory: h } = Y(), { getCompiledEmail: T } = P(), { compileHtml: w } = J(), { validateLiquidSyntax: E } = Z(), V = tt(), o = ot(), H = et(), x = rt(), { hasMigrations: C } = at(x), r = X(), F = c(() => i.value && V.allowSaveWithErrors ? r("email-editor.save-and-continue") : "Save"), a = u(!1), n = u(!1), _ = u(), l = G(), q = () => {
27
- if (o.isVersionHistoryOpen) {
28
- h();
24
+ setup(nt, { expose: b }) {
25
+ const { config: p, isFeatureEnabled: f } = j(), { exportHtml: d } = G(), { save: v } = N(), { validateCurrentTemplate: y } = Q(), { isEnabled: s } = U(), { showToaster: S, hideToaster: g, handleError: i } = W(), { openVersionHistory: h, closeVersionHistory: T } = Y(), { getCompiledEmail: V } = P(), { compileHtml: E } = K(), { validateLiquidSyntax: H } = Z(), e = tt(), w = et(), x = ot(), { hasMigrations: C } = st(x), r = X(), k = u(() => s.value ? r("email-editor.save-and-continue") : "Save"), a = c(!1), n = c(!1), _ = c(), l = J(), q = () => {
26
+ if (e.isVersionHistoryOpen) {
27
+ T();
29
28
  return;
30
29
  }
31
- g();
30
+ h();
32
31
  }, B = async () => {
33
32
  a.value = !0, await d(), a.value = !1;
34
33
  }, L = () => {
35
- o.isSaveAsTemplateDrawerOpen = !0;
36
- }, R = c(() => o.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), D = c(
34
+ e.isSaveAsTemplateDrawerOpen = !0;
35
+ }, R = u(() => e.isVersionHistoryOpen ? r("newsletter.close-version-history") : r("newsletter.version-history")), D = u(
37
36
  () => {
38
- var t, e;
39
- return ((e = (t = p.value) == null ? void 0 : t.features) == null ? void 0 : e.versionHistory) && !o.isPreviewModeOpen;
37
+ var t, o;
38
+ return ((o = (t = p.value) == null ? void 0 : t.features) == null ? void 0 : o.versionHistory) && !e.isPreviewModeOpen;
40
39
  }
41
40
  ), A = async (t) => {
42
- n.value = !0, t || (o.loadingStatus = !0);
43
- let e;
41
+ n.value = !0, t || (e.loadingStatus = !0);
42
+ let o;
44
43
  try {
45
- e = await v(t);
46
- } catch (b) {
47
- s(b, "Failed to save template");
44
+ o = await v(t);
45
+ } catch (M) {
46
+ i(M, "Failed to save template");
48
47
  } finally {
49
- n.value = !1, !t && !e && (o.loadingStatus = !1);
48
+ n.value = !1, !t && !o && (e.loadingStatus = !1);
50
49
  }
51
- return e;
50
+ return o;
52
51
  }, O = (t) => {
53
- var e;
52
+ var o;
54
53
  if (!t && C.value) {
55
- (e = _.value) == null || e.open();
54
+ (o = _.value) == null || o.open();
56
55
  return;
57
56
  }
58
57
  return A(t);
59
58
  }, m = async () => {
60
- o.loadingStatus = !0;
59
+ e.loadingStatus = !0;
61
60
  try {
62
61
  return await y();
63
62
  } catch (t) {
64
- return console.warn("Test-path validation failed; sending without the drawer.", t), [];
63
+ return i(t, "Failed to prepare test email"), null;
65
64
  } finally {
66
- o.loadingStatus = !1;
65
+ e.loadingStatus = !1;
67
66
  }
68
- }, M = async () => {
67
+ }, F = async () => {
69
68
  const t = await m();
70
- t.length && H.open(t, "test");
69
+ t != null && t.length ? w.open(t, "test") : t && g();
71
70
  }, z = async () => {
72
- if (i.value) {
73
- if ((await m()).length) {
71
+ if (s.value) {
72
+ const t = await m();
73
+ if (!t)
74
+ return;
75
+ if (t.length) {
74
76
  S({
75
77
  type: $.Error,
76
78
  message: r("email-editor.validation-errors-found"),
77
79
  actionButton: {
78
80
  text: r("email-editor.check-errors"),
79
81
  onClick: () => {
80
- M();
82
+ F();
81
83
  }
82
84
  },
83
85
  autoHide: !1
@@ -88,25 +90,25 @@ const bt = /* @__PURE__ */ I({
88
90
  return;
89
91
  }
90
92
  if (f("liquidSyntax")) {
91
- o.loadingStatus = !0;
93
+ e.loadingStatus = !0;
92
94
  try {
93
- const { html: t } = await T({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: e } = w(t);
94
- if (!await E(e))
95
+ const { html: t } = await V({ minimize: !0, resetDataSavedFlag: !1 }), { compiledHtml: o } = E(t);
96
+ if (!await H(o))
95
97
  return;
96
98
  } catch (t) {
97
- s(t, "Failed to prepare test email");
99
+ i(t, "Failed to prepare test email");
98
100
  return;
99
101
  } finally {
100
- o.loadingStatus = !1;
102
+ e.loadingStatus = !1;
101
103
  }
102
104
  }
103
105
  l();
104
106
  };
105
- return k({
107
+ return b({
106
108
  handleSave: O
107
- }), { __sfc: !0, config: p, isFeatureEnabled: f, exportHtml: d, save: v, validateCurrentTemplate: y, isEnabled: i, showToaster: S, handleError: s, openVersionHistory: g, closeVersionHistory: h, getCompiledEmail: T, compileHtml: w, validateLiquidSyntax: E, configStore: V, editorStore: o, saveValidationStore: H, templateStore: x, hasMigrations: C, trans: r, saveLabel: F, isExporting: a, isSaving: n, migrationModalRef: _, testEmailClick: l, handleVersionHistory: q, handleExport: B, handleSaveAs: L, versionHistoryTooltipText: R, isVersionHistoryButtonVisible: D, executeSave: A, handleSave: O, collectTestErrors: m, openTestErrors: M, handleTestEmail: z, getTooltipOptions: it, InButtonV2: st, MigrationConfirmModal: nt };
109
+ }), { __sfc: !0, config: p, isFeatureEnabled: f, exportHtml: d, save: v, validateCurrentTemplate: y, isEnabled: s, showToaster: S, hideToaster: g, handleError: i, openVersionHistory: h, closeVersionHistory: T, getCompiledEmail: V, compileHtml: E, validateLiquidSyntax: H, editorStore: e, saveValidationStore: w, templateStore: x, hasMigrations: C, trans: r, saveLabel: k, isExporting: a, isSaving: n, migrationModalRef: _, testEmailClick: l, handleVersionHistory: q, handleExport: B, handleSaveAs: L, versionHistoryTooltipText: R, isVersionHistoryButtonVisible: D, executeSave: A, handleSave: O, collectTestErrors: m, openTestErrors: F, handleTestEmail: z, getTooltipOptions: rt, InButtonV2: it, MigrationConfirmModal: at };
108
110
  }
109
111
  });
110
112
  export {
111
- bt as default
113
+ Ot as default
112
114
  };
@@ -12,9 +12,9 @@ var i = function() {
12
12
  l,
13
13
  !1,
14
14
  null,
15
- "c5ff3804"
15
+ "e48cebe9"
16
16
  );
17
- const u = d.exports;
17
+ const f = d.exports;
18
18
  export {
19
- u as default
19
+ f as default
20
20
  };
@@ -1,16 +1,17 @@
1
- import { defineComponent as p, ref as c, computed as a } from "vue";
2
- import f from "../../wrappers/WpDrawer.vue.js";
1
+ import { defineComponent as c, ref as f, computed as s } from "vue";
2
+ import v from "../../wrappers/WpDrawer.vue.js";
3
3
  import { useSave as S } from "../../../composables/useSave.js";
4
- import { useTranslations as v } from "../../../composables/useTranslations.js";
5
- import { useConfigStore as g } from "../../../stores/config.js";
6
- import { useEditorStore as y } from "../../../stores/editor.js";
7
- import { useSaveValidationStore as h } from "../../../stores/save-validation.js";
8
- import { escapeHtml as w } from "../../../utils/htmlEscape.js";
9
- import { InIcons as _ } from "@useinsider/design-system-vue";
10
- const V = /* @__PURE__ */ p({
4
+ import { useToaster as g } from "../../../composables/useToaster.js";
5
+ import { useTranslations as y } from "../../../composables/useTranslations.js";
6
+ import { useConfigStore as h } from "../../../stores/config.js";
7
+ import { useEditorStore as _ } from "../../../stores/editor.js";
8
+ import { useSaveValidationStore as w } from "../../../stores/save-validation.js";
9
+ import { escapeHtml as C } from "../../../utils/htmlEscape.js";
10
+ import { InIcons as E } from "@useinsider/design-system-vue";
11
+ const H = /* @__PURE__ */ c({
11
12
  __name: "ValidationErrorDrawer",
12
- setup(C) {
13
- const r = v(), e = h(), n = y(), s = g(), { saveWithErrors: i } = S(), o = c(!1), l = a(() => `${r("email-editor.validation-errors")} (${e.errorCount})`), u = a(() => {
13
+ setup(T) {
14
+ const r = y(), e = w(), a = _(), n = h(), { saveWithErrors: i } = S(), { handleError: l } = g(), o = f(!1), m = s(() => {
14
15
  const t = {
15
16
  primaryButton: {
16
17
  styling: "solid",
@@ -18,32 +19,32 @@ const V = /* @__PURE__ */ p({
18
19
  labelText: r("email-editor.update-design")
19
20
  }
20
21
  };
21
- return s.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
22
+ return n.allowSaveWithErrors && e.intent !== "test" && (t.secondaryButton = {
22
23
  styling: "solid",
23
24
  type: "subtle-primary",
24
25
  labelText: r("email-editor.save-and-continue"),
25
26
  loadingStatus: o.value
26
27
  }), t;
27
- }), d = a(() => e.errors.map((t) => {
28
- const m = t.detail ? ` (${w(t.detail)})` : "";
29
- return `${t.message}${m}`;
30
- }));
31
- return { __sfc: !0, trans: r, store: e, editorStore: n, configStore: s, saveWithErrors: i, isSaving: o, titleText: l, footerButtonGroupOptions: u, rows: d, handleClose: () => {
28
+ }), u = s(() => e.errors.map((t) => {
29
+ const p = t.detail ? ` (${C(t.detail)})` : "";
30
+ return `${t.message}${p}`;
31
+ })), d = s(() => `${r("email-editor.validation-errors")} (${u.value.length})`);
32
+ return { __sfc: !0, trans: r, store: e, editorStore: a, configStore: n, saveWithErrors: i, handleError: l, isSaving: o, footerButtonGroupOptions: m, rows: u, titleText: d, handleClose: () => {
32
33
  e.isDrawerOpen && e.close();
33
34
  }, handleSaveAndContinue: async () => {
34
35
  if (!o.value) {
35
- o.value = !0, n.loadingStatus = !0;
36
+ o.value = !0, a.loadingStatus = !0;
36
37
  try {
37
- await i() ? e.close() : n.loadingStatus = !1;
38
+ await i() ? e.close() : a.loadingStatus = !1;
38
39
  } catch (t) {
39
- console.warn("Soft-save failed; keeping the drawer open.", t), n.loadingStatus = !1;
40
+ l(t, "Failed to save template"), a.loadingStatus = !1;
40
41
  } finally {
41
42
  o.value = !1;
42
43
  }
43
44
  }
44
- }, WpDrawer: f, InIcons: _ };
45
+ }, WpDrawer: v, InIcons: E };
45
46
  }
46
47
  });
47
48
  export {
48
- V as default
49
+ H as default
49
50
  };