@useinsider/guido 1.4.4-beta.db9794f → 1.4.4-beta.dc62a4d

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.
@@ -12,7 +12,7 @@ var t = function() {
12
12
  n,
13
13
  !1,
14
14
  null,
15
- "e2f12ef7"
15
+ "7f89e9ff"
16
16
  );
17
17
  const u = s.exports;
18
18
  export {
@@ -1,24 +1,23 @@
1
- import { defineComponent as z, defineAsyncComponent as L, ref as K, computed as W, watch as j, onMounted as q, onUnmounted as J } from "vue";
2
- import { provideGuidoActions as Q } from "../composables/useGuidoActions.js";
3
- import { usePartner as V } from "../composables/usePartner.js";
4
- import { useStripo as X } from "../composables/useStripo.js";
5
- import { useTimerClone as Y } from "../composables/useTimerClone.js";
6
- import { migrate as _ } from "../config/migrator/index.js";
7
- import { DefaultUsername as Z, DefaultMessageType as $, DefaultGuidoConfig as ee } from "../enums/defaults.js";
8
- import oe from "./organisms/base/Toaster.vue.js";
9
- import te from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
10
- import ne from "./organisms/header/HeaderWrapper.vue.js";
11
- import re from "./organisms/LoadingWrapper.vue.js";
12
- import ie from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
13
- import se from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
14
- import { useStripoApi as ae } from "../services/stripoApi.js";
15
- import { useConfigStore as ce } from "../stores/config.js";
16
- import { useDynamicContentStore as me } from "../stores/dynamic-content.js";
17
- import { useEditorStore as de } from "../stores/editor.js";
18
- import { usePreviewStore as le } from "../stores/preview.js";
19
- import { useUnsubscribeStore as ue } from "../stores/unsubscribe.js";
20
- import pe from "../node_modules/lodash-es/merge.js";
21
- const Ae = /* @__PURE__ */ z({
1
+ import { defineComponent as M, defineAsyncComponent as I, ref as O, computed as U, watch as z, onMounted as K, onUnmounted as j } from "vue";
2
+ import { provideGuidoActions as q } from "../composables/useGuidoActions.js";
3
+ import { usePartner as J } from "../composables/usePartner.js";
4
+ import { useStripo as Q } from "../composables/useStripo.js";
5
+ import { migrate as L } from "../config/migrator/index.js";
6
+ import { DefaultUsername as V, DefaultMessageType as X, DefaultGuidoConfig as Y } from "../enums/defaults.js";
7
+ import Z from "./organisms/base/Toaster.vue.js";
8
+ import $ from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
9
+ import ee from "./organisms/header/HeaderWrapper.vue.js";
10
+ import oe from "./organisms/LoadingWrapper.vue.js";
11
+ import te from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
12
+ import ne from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
13
+ import { useStripoApi as re } from "../services/stripoApi.js";
14
+ import { useConfigStore as ie } from "../stores/config.js";
15
+ import { useDynamicContentStore as ae } from "../stores/dynamic-content.js";
16
+ import { useEditorStore as se } from "../stores/editor.js";
17
+ import { usePreviewStore as ce } from "../stores/preview.js";
18
+ import { useUnsubscribeStore as de } from "../stores/unsubscribe.js";
19
+ import me from "../node_modules/lodash-es/merge.js";
20
+ const Ue = /* @__PURE__ */ M({
22
21
  __name: "Guido",
23
22
  props: {
24
23
  templateId: null,
@@ -30,52 +29,54 @@ const Ae = /* @__PURE__ */ z({
30
29
  html: null,
31
30
  css: null,
32
31
  guidoConfig: null,
33
- templateConfig: null
32
+ templateConfig: null,
33
+ onSaveBefore: null
34
34
  },
35
35
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
36
- setup(A, { expose: N, emit: o }) {
37
- const u = A, F = L(
36
+ setup(W, { expose: _, emit: o }) {
37
+ const i = W, A = I(
38
38
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
39
- ), H = L(
39
+ ), B = I(
40
40
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
41
- ), p = K(), i = me(), g = ue(), f = ce(), s = de(), O = le(), n = W(() => s.hasChanges), { getPartnerName: y, getProductType: v, isTestPartner: R } = V(), h = () => {
41
+ ), p = O(), a = ae(), g = de(), f = ie(), s = se(), N = ce(), n = U(() => s.hasChanges), { getPartnerName: y, getProductType: v, isTestPartner: F } = J(), b = () => {
42
42
  var e;
43
43
  return (e = p.value) == null ? void 0 : e.handleSave(!0);
44
44
  }, {
45
- templateId: a,
46
- userId: b,
47
- guidoConfig: C,
45
+ templateId: c,
46
+ userId: C,
47
+ guidoConfig: S,
48
48
  templateConfig: t,
49
49
  html: r = "",
50
- css: S = "",
51
- partnerName: c = y(),
50
+ css: h = "",
51
+ partnerName: d = y(),
52
52
  productType: m = v(),
53
- messageType: w = $,
54
- username: D = Z
55
- } = u, d = (t == null ? void 0 : t.preselectedDynamicContentList) || [];
56
- s.templateId = a, window.GuidoConfig = pe(ee, C), window.GuidoConfig.partner = {
57
- partnerName: c,
53
+ messageType: w = X,
54
+ username: D = V
55
+ } = i, l = (t == null ? void 0 : t.preselectedDynamicContentList) || [];
56
+ s.templateId = c, window.GuidoConfig = me(Y, S), window.GuidoConfig.partner = {
57
+ partnerName: d,
58
58
  productType: m,
59
59
  messageType: w
60
60
  }, f.templateConfig = t;
61
- const { initPlugin: T } = X({
62
- emailId: a,
63
- userId: b,
61
+ const { initPlugin: E } = Q({
62
+ emailId: c,
63
+ userId: C,
64
64
  username: D,
65
- partnerName: c,
65
+ partnerName: d,
66
66
  productType: m,
67
- preselectedDynamicContentList: d,
67
+ preselectedDynamicContentList: l,
68
68
  onReady: () => {
69
69
  console.debug("guido:ready"), o("ready");
70
70
  }
71
- }), { getDefaultTemplate: E } = ae(), { cloneTimersOnSave: k, hasTimerBlocks: P } = Y(), x = W(() => {
71
+ }), { getDefaultTemplate: T } = re(), H = U(() => {
72
72
  var e;
73
73
  return !((e = window.GuidoConfig) != null && e.useHeader);
74
74
  });
75
- Q({
75
+ q({
76
76
  onBack: () => {
77
77
  console.debug("guido:back"), o("back");
78
78
  },
79
+ onSaveBefore: i.onSaveBefore ?? (async () => (console.debug("guido:save:before"), !0)),
79
80
  onSaveStart: () => {
80
81
  console.debug("guido:save:start"), o("save:start");
81
82
  },
@@ -86,50 +87,50 @@ const Ae = /* @__PURE__ */ z({
86
87
  console.debug("guido:test-email:click"), o("test-email:click");
87
88
  }
88
89
  });
89
- const G = (e) => {
90
- console.debug("dynamic-content:close", e), i.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
91
- }, I = () => {
90
+ const P = (e) => {
91
+ console.debug("dynamic-content:close", e), a.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
92
+ }, k = () => {
92
93
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
93
94
  };
94
- j(() => n.value, () => {
95
+ z(() => n.value, () => {
95
96
  o("on-change", n.value);
96
97
  });
97
- const l = (e) => {
98
- const U = e, { attribute: B, position: M } = U.detail;
99
- console.debug("dynamic-content:open", U.detail), o("dynamic-content:open", B, M);
98
+ const u = (e) => {
99
+ const G = e, { attribute: R, position: x } = G.detail;
100
+ console.debug("dynamic-content:open", G.detail), o("dynamic-content:open", R, x);
100
101
  };
101
- return q(async () => {
102
+ return K(async () => {
102
103
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
103
104
  try {
104
105
  g.selectedUnsubscribePages = (t == null ? void 0 : t.selectedUnsubscribePages) || [];
105
106
  let e = {
106
- html: r && await _(r),
107
- css: S,
107
+ html: r && await L(r),
108
+ css: h,
108
109
  forceRecreate: !0
109
110
  // TODO: It should be false for old templates. We will communicate with Stripo
110
111
  };
111
- e.html || (e = await E(), e.html = await _(e.html)), P(e.html) && (e.html = await k(e.html)), await T(e), i.selectedDynamicContentList = d;
112
+ e.html || (e = await T(), e.html = await L(e.html)), await E(e), a.selectedDynamicContentList = l;
112
113
  } catch (e) {
113
114
  console.error("Failed to initialize Stripo editor:", e);
114
115
  }
115
- document.addEventListener("dynamic-content:open", l);
116
- }), J(() => {
117
- document.removeEventListener("dynamic-content:open", l);
116
+ document.addEventListener("dynamic-content:open", u);
117
+ }), j(() => {
118
+ document.removeEventListener("dynamic-content:open", u);
118
119
  try {
119
120
  window.UIEditor.removeEditor();
120
121
  } catch {
121
122
  console.debug("Failed to remove Stripo editor: No editor found");
122
123
  }
123
- }), N({
124
+ }), _({
124
125
  dynamicContent: {
125
- insert: G,
126
- close: I
126
+ insert: P,
127
+ close: k
127
128
  },
128
129
  hasChanges: n,
129
- saveSilent: h
130
- }), { __sfc: !0, PreviewContainer: F, OnboardingWrapper: H, headerWrapperRef: p, dynamicContentStore: i, unsubscribeStore: g, props: u, configStore: f, editorStore: s, previewStore: O, hasChanges: n, getPartnerName: y, getProductType: v, isTestPartner: R, saveSilent: h, templateId: a, userId: b, guidoConfig: C, templateConfig: t, html: r, css: S, partnerName: c, productType: m, messageType: w, username: D, preselectedDynamicContentList: d, emit: o, initPlugin: T, getDefaultTemplate: E, cloneTimersOnSave: k, hasTimerBlocks: P, noHeader: x, insertDynamicContent: G, closeDynamicContent: I, handleDynamicContentOpen: l, Toaster: oe, FilterSelectionDrawer: te, HeaderWrapper: ne, LoadingWrapper: re, SaveAsTemplateDrawer: ie, UnsubscribeWrapper: se };
130
+ saveSilent: b
131
+ }), { __sfc: !0, PreviewContainer: A, OnboardingWrapper: B, headerWrapperRef: p, dynamicContentStore: a, unsubscribeStore: g, props: i, configStore: f, editorStore: s, previewStore: N, hasChanges: n, getPartnerName: y, getProductType: v, isTestPartner: F, saveSilent: b, templateId: c, userId: C, guidoConfig: S, templateConfig: t, html: r, css: h, partnerName: d, productType: m, messageType: w, username: D, preselectedDynamicContentList: l, emit: o, initPlugin: E, getDefaultTemplate: T, noHeader: H, insertDynamicContent: P, closeDynamicContent: k, handleDynamicContentOpen: u, Toaster: Z, FilterSelectionDrawer: $, HeaderWrapper: ee, LoadingWrapper: oe, SaveAsTemplateDrawer: te, UnsubscribeWrapper: ne };
131
132
  }
132
133
  });
133
134
  export {
134
- Ae as default
135
+ Ue as default
135
136
  };
@@ -1,36 +1,39 @@
1
- import { defineComponent as H, ref as m, computed as _ } from "vue";
2
- import { useConfig as h } from "../../../composables/useConfig.js";
1
+ import { defineComponent as H, ref as f, computed as _ } from "vue";
2
+ import { useConfig as x } from "../../../composables/useConfig.js";
3
3
  import { useExport as V } from "../../../composables/useExport.js";
4
- import { useTestEmailClick as x } from "../../../composables/useGuidoActions.js";
5
- import { useSave as E } from "../../../composables/useSave.js";
6
- import { useTranslations as T } from "../../../composables/useTranslations.js";
7
- import { useVersionHistoryApi as w } from "../../../composables/useVersionHistoryApi.js";
8
- import { useEditorStore as C } from "../../../stores/editor.js";
9
- import { getTooltipOptions as O } from "../../../utils/tooltipUtils.js";
10
- import { InButtonV2 as A } from "@useinsider/design-system-vue";
11
- const J = /* @__PURE__ */ H({
4
+ import { useSaveBefore as w, useTestEmailClick as E } from "../../../composables/useGuidoActions.js";
5
+ import { useSave as T } from "../../../composables/useSave.js";
6
+ import { useTranslations as C } from "../../../composables/useTranslations.js";
7
+ import { useVersionHistoryApi as O } from "../../../composables/useVersionHistoryApi.js";
8
+ import { useEditorStore as b } from "../../../stores/editor.js";
9
+ import { getTooltipOptions as A } from "../../../utils/tooltipUtils.js";
10
+ import { InButtonV2 as B } from "@useinsider/design-system-vue";
11
+ const L = /* @__PURE__ */ H({
12
12
  __name: "RightSlot",
13
- setup(k, { expose: c }) {
14
- const { config: u } = h(), { exportHtml: r } = V(), { save: n } = E(), { openVersionHistory: i, closeVersionHistory: a } = w(), o = C(), t = T(), e = m(!1), s = m(!1), f = x(), v = () => {
15
- if (o.isVersionHistoryOpen) {
13
+ setup(k, { expose: p }) {
14
+ const { config: m } = x(), { exportHtml: r } = V(), { save: n } = T(), { openVersionHistory: i, closeVersionHistory: a } = O(), e = b(), t = C(), s = f(!1), o = f(!1), l = w(), d = E(), v = () => {
15
+ if (e.isVersionHistoryOpen) {
16
16
  a();
17
17
  return;
18
18
  }
19
19
  i();
20
- }, d = async () => {
21
- e.value = !0, await r(), e.value = !1;
22
- }, y = () => {
23
- o.isSaveAsTemplateDrawerOpen = !0;
24
- }, S = _(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), l = async (p) => {
25
- s.value = !0, o.loadingStatus = !0;
26
- const g = await n(p);
27
- return s.value = !1, p && (o.loadingStatus = !1), g;
20
+ }, y = async () => {
21
+ s.value = !0, await r(), s.value = !1;
22
+ }, g = () => {
23
+ e.isSaveAsTemplateDrawerOpen = !0;
24
+ }, S = _(() => e.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history")), c = async (u) => {
25
+ if (o.value = !0, e.loadingStatus = !0, !await l()) {
26
+ console.debug("guido:save:before - cancelled by external validation"), o.value = !1, e.loadingStatus = !1;
27
+ return;
28
+ }
29
+ const h = await n(u);
30
+ return o.value = !1, u && (e.loadingStatus = !1), h;
28
31
  };
29
- return c({
30
- handleSave: l
31
- }), { __sfc: !0, config: u, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: o, trans: t, isExporting: e, isSaving: s, testEmailClick: f, handleVersionHistory: v, handleExport: d, handleSaveAs: y, versionHistoryTooltipText: S, handleSave: l, getTooltipOptions: O, InButtonV2: A };
32
+ return p({
33
+ handleSave: c
34
+ }), { __sfc: !0, config: m, exportHtml: r, save: n, openVersionHistory: i, closeVersionHistory: a, editorStore: e, trans: t, isExporting: s, isSaving: o, saveBefore: l, testEmailClick: d, handleVersionHistory: v, handleExport: y, handleSaveAs: g, versionHistoryTooltipText: S, handleSave: c, getTooltipOptions: A, InButtonV2: B };
32
35
  }
33
36
  });
34
37
  export {
35
- J as default
38
+ L as default
36
39
  };
@@ -1,7 +1,7 @@
1
- import { useToaster as w } from "./useToaster.js";
2
- const S = () => {
3
- const { handleError: l } = w(), s = (t = {}) => new Promise((e, i) => {
4
- const n = { ...{
1
+ import { useToaster as g } from "./useToaster.js";
2
+ const A = () => {
3
+ const { handleError: l } = g(), n = (t = {}) => new Promise((e, a) => {
4
+ const i = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
7
7
  utmSource: "",
@@ -21,28 +21,28 @@ const S = () => {
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
23
  }, ...t }, m = {
24
- callback: (o, p, d, c, u) => {
25
- o ? i(o) : e({
26
- html: p,
27
- ampHtml: d,
28
- ampErrors: c,
29
- displayConditions: u
24
+ callback: (s, c, p, u, d) => {
25
+ s ? a(s) : e({
26
+ html: c,
27
+ ampHtml: p,
28
+ ampErrors: u,
29
+ displayConditions: d
30
30
  });
31
31
  },
32
- ...n
32
+ ...i
33
33
  };
34
34
  window.StripoEditorApi.actionsApi.compileEmail(m);
35
35
  });
36
36
  return {
37
- getCompiledEmail: s,
37
+ getCompiledEmail: n,
38
38
  getTemplateData: () => new Promise((t) => {
39
- const e = ({ html: i, css: a, width: n, height: r, utmParams: m, syncModulesIds: o }) => t({
40
- html: i,
41
- css: a,
42
- width: n,
39
+ const e = ({ html: a, css: o, width: i, height: r, utmParams: m, syncModulesIds: s }) => t({
40
+ html: a,
41
+ css: o,
42
+ width: i,
43
43
  height: r,
44
44
  utmParams: m,
45
- syncModulesIds: o
45
+ syncModulesIds: s
46
46
  });
47
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
48
  }),
@@ -53,15 +53,15 @@ const S = () => {
53
53
  try {
54
54
  const {
55
55
  html: e,
56
- displayConditions: i,
57
- ampHtml: a = "",
58
- ampErrors: n = []
59
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
56
+ displayConditions: a,
57
+ ampHtml: o = "",
58
+ ampErrors: i = []
59
+ } = await n({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
60
  return {
61
61
  html: e,
62
- ampHtml: a,
63
- ampErrors: n,
64
- displayConditions: i
62
+ ampHtml: o,
63
+ ampErrors: i,
64
+ displayConditions: a
65
65
  };
66
66
  } catch (e) {
67
67
  return l(e, "Error loading preview"), {
@@ -71,26 +71,9 @@ const S = () => {
71
71
  displayConditions: []
72
72
  };
73
73
  }
74
- },
75
- updateTimerInClonedTemplate: () => new Promise((t) => {
76
- var e, i;
77
- if (typeof ((i = (e = window.StripoEditorApi) == null ? void 0 : e.actionsApi) == null ? void 0 : i.updateTimerInClonedTemplate) != "function") {
78
- t(null);
79
- return;
80
- }
81
- try {
82
- window.StripoEditorApi.actionsApi.updateTimerInClonedTemplate((a, n) => {
83
- a ? (l(a, "Failed to update timer in cloned template"), t(null)) : t(n || null);
84
- });
85
- } catch (a) {
86
- l(a, "Failed to call updateTimerInClonedTemplate"), t(null);
87
- }
88
- }),
89
- updateHtmlAndCss: (t, e) => {
90
- window.StripoEditorApi.actionsApi.updateHtmlAndCss(t, e);
91
74
  }
92
75
  };
93
76
  };
94
77
  export {
95
- S as useActionsApi
78
+ A as useActionsApi
96
79
  };
@@ -1,9 +1,9 @@
1
- import { provideValue as o, useInjectedValue as t } from "./useProvideInject.js";
2
- const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), c = Symbol.for("guido.save.complete"), a = Symbol.for("guido.test.email.click"), i = (e) => {
3
- o(r, e.onBack), o(n, e.onSaveStart), o(c, e.onSaveComplete), o(a, e.onTestEmailClick);
4
- }, u = () => {
1
+ import { provideValue as o, useInjectedValue as r } from "./useProvideInject.js";
2
+ const t = Symbol.for("guido.back"), n = Symbol.for("guido.save.before"), a = Symbol.for("guido.save.start"), c = Symbol.for("guido.save.complete"), s = Symbol.for("guido.test.email.click"), u = (e) => {
3
+ o(t, e.onBack), o(n, e.onSaveBefore), o(a, e.onSaveStart), o(c, e.onSaveComplete), o(s, e.onTestEmailClick);
4
+ }, d = () => {
5
5
  try {
6
- return t(r);
6
+ return r(t);
7
7
  } catch {
8
8
  throw new Error(
9
9
  "useBack: No back handler provided. Make sure Guido component is in the component tree."
@@ -11,23 +11,31 @@ const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), c = Symb
11
11
  }
12
12
  }, l = () => {
13
13
  try {
14
- return t(n);
14
+ return r(n);
15
+ } catch {
16
+ throw new Error(
17
+ "useSaveBefore: No save before handler provided. Make sure Guido component is in the component tree."
18
+ );
19
+ }
20
+ }, m = () => {
21
+ try {
22
+ return r(a);
15
23
  } catch {
16
24
  throw new Error(
17
25
  "useSaveStart: No save start handler provided. Make sure Guido component is in the component tree."
18
26
  );
19
27
  }
20
- }, d = () => {
28
+ }, p = () => {
21
29
  try {
22
- return t(c);
30
+ return r(c);
23
31
  } catch {
24
32
  throw new Error(
25
33
  "useSaveComplete: No save complete handler provided. Make sure Guido component is in the component tree."
26
34
  );
27
35
  }
28
- }, m = () => {
36
+ }, v = () => {
29
37
  try {
30
- return t(a);
38
+ return r(s);
31
39
  } catch {
32
40
  throw new Error(
33
41
  "useTestEmailClick: No test email click handler provided. Make sure Guido component is in the component tree."
@@ -35,13 +43,15 @@ const r = Symbol.for("guido.back"), n = Symbol.for("guido.save.start"), c = Symb
35
43
  }
36
44
  };
37
45
  export {
38
- r as BACK_KEY,
46
+ t as BACK_KEY,
47
+ n as SAVE_BEFORE_KEY,
39
48
  c as SAVE_COMPLETE_KEY,
40
- n as SAVE_START_KEY,
41
- a as TEST_EMAIL_CLICK_KEY,
42
- i as provideGuidoActions,
43
- u as useBack,
44
- d as useSaveComplete,
45
- l as useSaveStart,
46
- m as useTestEmailClick
49
+ a as SAVE_START_KEY,
50
+ s as TEST_EMAIL_CLICK_KEY,
51
+ u as provideGuidoActions,
52
+ d as useBack,
53
+ l as useSaveBefore,
54
+ p as useSaveComplete,
55
+ m as useSaveStart,
56
+ v as useTestEmailClick
47
57
  };
@@ -1,19 +1,19 @@
1
- import { useActionsApi as b } from "./useActionsApi.js";
2
- import { useBlocksConfig as k } from "./useBlocksConfig.js";
3
- import { useConfig as T } from "./useConfig.js";
1
+ import { useActionsApi as w } from "./useActionsApi.js";
2
+ import { useBlocksConfig as b } from "./useBlocksConfig.js";
3
+ import { useConfig as k } from "./useConfig.js";
4
4
  import { useCustomInterfaceAppearance as V } from "./useCustomInterfaceAppearance.js";
5
5
  import { useStripoEventHandler as _ } from "./useStripoEventHandler.js";
6
6
  import { useToaster as B } from "./useToaster.js";
7
- import { displayConditions as A } from "../enums/displayConditions.js";
8
- import { useStripoApi as F } from "../services/stripoApi.js";
9
- import v from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as I } from "../stores/editor.js";
11
- import { dynamicContentToMergeTags as M } from "../utils/genericUtil.js";
12
- import U from "../package.json.js";
13
- const N = (c) => {
14
- const { config: l } = T(), { handleError: u } = B(), { getToken: f, getCustomFonts: y } = F(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = k(), E = async (i, r = []) => {
7
+ import { displayConditions as T } from "../enums/displayConditions.js";
8
+ import { useStripoApi as A } from "../services/stripoApi.js";
9
+ import F from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as M } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as U } from "../utils/genericUtil.js";
12
+ import v from "../package.json.js";
13
+ const J = (c) => {
14
+ const { config: u } = k(), { handleError: l } = B(), { getToken: f, getCustomFonts: y } = A(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = b(), E = async (i, r = []) => {
15
15
  var m, g;
16
- const e = I(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await C();
16
+ const t = M(), { html: n, css: p, forceRecreate: a } = i, { baseBlocks: e, extensions: d } = await C();
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
@@ -30,10 +30,10 @@ const N = (c) => {
30
30
  customAppearanceMergetags: !0,
31
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
32
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
33
- customViewStyles: v,
34
- conditionsEnabled: ((m = l.features) == null ? void 0 : m.displayConditions) ?? !0,
35
- customConditionsEnabled: ((g = l.features) == null ? void 0 : g.displayConditions) ?? !0,
36
- conditionCategories: A,
33
+ customViewStyles: F,
34
+ conditionsEnabled: ((m = u.features) == null ? void 0 : m.displayConditions) ?? !0,
35
+ customConditionsEnabled: ((g = u.features) == null ? void 0 : g.displayConditions) ?? !0,
36
+ conditionCategories: T,
37
37
  enableXSSSecurity: !0,
38
38
  messageSettingsEnabled: !0,
39
39
  displayGmailAnnotations: !0,
@@ -41,7 +41,7 @@ const N = (c) => {
41
41
  displayTitle: !1,
42
42
  displayUTM: !1,
43
43
  selectElementAfterDrop: !0,
44
- ...t ? { baseBlocks: t } : {},
44
+ ...e ? { baseBlocks: e } : {},
45
45
  editorFonts: {
46
46
  showDefaultStandardFonts: !0,
47
47
  showDefaultNotStandardFonts: !0,
@@ -49,7 +49,7 @@ const N = (c) => {
49
49
  },
50
50
  mergeTags: [
51
51
  {
52
- entries: M(c.preselectedDynamicContentList)
52
+ entries: U(c.preselectedDynamicContentList)
53
53
  }
54
54
  ],
55
55
  async onTokenRefreshRequest(o) {
@@ -57,30 +57,30 @@ const N = (c) => {
57
57
  const s = await f();
58
58
  o(s);
59
59
  } catch (s) {
60
- u(s, "Failed to refresh token");
60
+ l(s, "Failed to refresh token");
61
61
  }
62
62
  },
63
63
  onTemplateLoaded() {
64
64
  try {
65
- const { importCss: o } = V(), { activateCustomViewStyles: s, updateTimerInClonedTemplate: w } = b();
66
- o(), s(), w(), c.onReady(), e.isStripoInitialized = !0, e.loadingStatus = !1, setTimeout(() => {
67
- e.hasChanges = !1;
65
+ const { importCss: o } = V(), { activateCustomViewStyles: s } = w();
66
+ o(), s(), c.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
67
+ t.hasChanges = !1;
68
68
  }, 1e3);
69
69
  } catch (o) {
70
- u(o, "Failed to load custom interface appearance");
70
+ l(o, "Failed to load custom interface appearance");
71
71
  }
72
72
  },
73
73
  onCodeEditorVisibilityChanged(o) {
74
- e.isCodeEditorOpen = o;
74
+ t.isCodeEditorOpen = o;
75
75
  },
76
76
  onEditorVisualModeChanged(o) {
77
- e.editorVisualMode = o.toLowerCase();
77
+ t.editorVisualMode = o.toLowerCase();
78
78
  },
79
79
  onVersionHistoryVisibilityChanged(o) {
80
- e.isVersionHistoryOpen = o;
80
+ t.isVersionHistoryOpen = o;
81
81
  },
82
82
  onDataChanged() {
83
- e.hasChanges = !0;
83
+ t.hasChanges = !0;
84
84
  },
85
85
  onEvent: S,
86
86
  ignoreClickOutsideSelectors: [
@@ -91,18 +91,18 @@ const N = (c) => {
91
91
  extensions: d
92
92
  }
93
93
  );
94
- }, h = (i) => new Promise((r, e) => {
94
+ }, h = (i) => new Promise((r, t) => {
95
95
  var d;
96
96
  if (document.getElementById("UiEditorScript")) {
97
97
  i(), r();
98
98
  return;
99
99
  }
100
- const n = U.guido, a = `https://email-static.useinsider.com/guido/${(d = n == null ? void 0 : n.stripo) == null ? void 0 : d.version}/UIEditor.js`, t = document.createElement("script");
101
- t.id = "UiEditorScript", t.type = "module", t.src = a, t.onload = () => {
100
+ const n = v.guido, a = `https://email-static.useinsider.com/guido/${(d = n == null ? void 0 : n.stripo) == null ? void 0 : d.version}/UIEditor.js`, e = document.createElement("script");
101
+ e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
102
102
  i(), r();
103
- }, t.onerror = () => {
104
- e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
- }, document.body.appendChild(t);
103
+ }, e.onerror = () => {
104
+ t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
+ }, document.body.appendChild(e);
106
106
  });
107
107
  return { initPlugin: async (i) => {
108
108
  await h(async () => {
@@ -112,5 +112,5 @@ const N = (c) => {
112
112
  } };
113
113
  };
114
114
  export {
115
- N as useStripo
115
+ J as useStripo
116
116
  };
@@ -1,21 +1,21 @@
1
1
  import { ExtensionBuilder as e } from "../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
2
2
  import { UnsubscribeBlock as i } from "./block.js";
3
3
  import { UnsubscribeControl as t } from "./control.js";
4
- import { PreviewUIElement as o } from "./elements/preview.js";
5
- import { UnsubscribeIconsRegistry as r } from "./iconsRegistry.js";
6
- import { SettingsPanel as s } from "./settingsPanel.js";
4
+ import { PreviewUIElement as s } from "./elements/preview.js";
5
+ import { UnsubscribeIconsRegistry as o } from "./iconsRegistry.js";
6
+ import { SettingsPanel as r } from "./settingsPanel.js";
7
7
  import n from "./styles.css.js";
8
- import { UnsubscribeTagRegistry as l } from "./tagRegistry.js";
9
- const f = new e().addBlock(i).withSettingsPanelRegistry(s).addControl(t).addUiElement(o).addStyles(n).withLocalization({
8
+ import { UnsubscribeTagRegistry as c } from "./tagRegistry.js";
9
+ const g = new e().addBlock(i).withSettingsPanelRegistry(r).addControl(t).addUiElement(s).addStyles(n).withLocalization({
10
10
  en: {
11
- "Unsubscribe Block": "Unsubscribe Block",
12
- "Unsubscribe Block Description": "Add an unsubscribe link to your email",
11
+ "Unsubscribe Block": "Unsubscribe",
12
+ "Unsubscribe Block Description": "Unsubscribe lets you add an Unsubscribe Link to direct users to opt out of receiving your messages.",
13
13
  "Select Template": "Select Template",
14
14
  "Unsubscribe Template": "Unsubscribe Template",
15
15
  Showing: "Showing",
16
16
  of: "of"
17
17
  }
18
- }).withUiElementTagRegistry(l).withIconsRegistry(r).build();
18
+ }).withUiElementTagRegistry(c).withIconsRegistry(o).build();
19
19
  export {
20
- f as default
20
+ g as default
21
21
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-e2f12ef7]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-e2f12ef7]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-e2f12ef7]{height:calc(100vh - 75px)}[data-v-70835920] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
1
+ .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-0502bceb] .in-button-v2__wrapper{line-height:0}[data-v-b5997368] .in-segments-wrapper .in-tooltip-wrapper__box{text-align:left}.version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}.view-options-wrapper[data-v-d405ca59]{position:relative;display:inline-block}.new-tag[data-v-d405ca59]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-d405ca59] .guido__verion-history-view-option-selection-desktop svg,[data-v-d405ca59] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-d405ca59] .in-segments-wrapper__button_selected,[data-v-d405ca59] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-d405ca59] .in-tooltip-wrapper__icon{cursor:pointer}.view-options-wrapper[data-v-195ab6d4]{position:relative;display:inline-block}.new-tag[data-v-195ab6d4]{position:absolute;top:-8px;right:-16px;z-index:10}[data-v-195ab6d4] .guido__view-option-selection-desktop svg,[data-v-195ab6d4] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-195ab6d4] .in-segments-wrapper__button_selected,[data-v-195ab6d4] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-195ab6d4] .in-tooltip-wrapper__icon{cursor:pointer}.guido-loading__wrapper[data-v-07c4b2d8]{height:100%;top:75px!important;bottom:0!important}.guido-editor__wrapper[data-v-7f89e9ff]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-7f89e9ff]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-7f89e9ff]{height:calc(100vh - 75px)}[data-v-70835920] .in-breadcrumb-wrapper__links{cursor:pointer}.templates-wrapper[data-v-a86fc486]{gap:16px;grid-template-columns:repeat(3,1fr)}.templates-wrapper .template-wrapper[data-v-a86fc486]{cursor:pointer}.templates-wrapper .template-wrapper .template-container[data-v-a86fc486]{height:274px;padding:2px;transition:none}.templates-wrapper .template-wrapper .template-container.selected[data-v-a86fc486]{padding:1px}.templates-wrapper .template-wrapper .template-container .thumbnail[data-v-a86fc486]{object-fit:cover;transform:scale(1)}[data-v-dd57102d] .guido__verion-history-view-option-selection-desktop svg,[data-v-dd57102d] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-dd57102d] .in-segments-wrapper__button_selected,[data-v-dd57102d] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.error-list[data-v-7a09985c]{gap:16px}[data-v-c2adc57d] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-2dd60b0c],[data-v-2dd60b0c] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-f20b3a9b]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}[data-v-d3c52b44] .vueperslides__bullets,[data-v-dd1a237a] .vueperslides__bullets{pointer-events:none!important}[data-v-dd1a237a] .vueperslides__parallax-wrapper{height:110px!important}[data-v-a408dcea] .vueperslides__bullets{pointer-events:none!important}[data-v-a408dcea] .vueperslides__parallax-wrapper{height:110px!important}
@@ -11,6 +11,7 @@ type __VLS_Props = {
11
11
  css?: string;
12
12
  guidoConfig: GuidoConfig;
13
13
  templateConfig?: TemplateConfig;
14
+ onSaveBefore?: () => Promise<boolean>;
14
15
  };
15
16
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
16
17
  dynamicContent: {
@@ -5,6 +5,4 @@ export declare const useActionsApi: () => {
5
5
  getTemplateData: () => Promise<TemplateData>;
6
6
  activateCustomViewStyles: (isActive?: boolean) => void;
7
7
  getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
8
- updateTimerInClonedTemplate: () => Promise<string | null>;
9
- updateHtmlAndCss: (html: string, css: string) => void;
10
8
  };
@@ -1,10 +1,12 @@
1
1
  import type { SavedTemplateDetails } from '@@/Types/stripo';
2
2
  import type { InjectionKey } from 'vue';
3
3
  export type BackHandler = () => void;
4
+ export type SaveBeforeHandler = () => Promise<boolean>;
4
5
  export type SaveStartHandler = () => void;
5
6
  export type SaveCompleteHandler = (template: Omit<SavedTemplateDetails, 'forceRecreate'>) => void;
6
7
  export type TestEmailClickHandler = () => void;
7
8
  export declare const BACK_KEY: InjectionKey<BackHandler>;
9
+ export declare const SAVE_BEFORE_KEY: InjectionKey<SaveBeforeHandler>;
8
10
  export declare const SAVE_START_KEY: InjectionKey<SaveStartHandler>;
9
11
  export declare const SAVE_COMPLETE_KEY: InjectionKey<SaveCompleteHandler>;
10
12
  export declare const TEST_EMAIL_CLICK_KEY: InjectionKey<TestEmailClickHandler>;
@@ -13,6 +15,7 @@ export declare const TEST_EMAIL_CLICK_KEY: InjectionKey<TestEmailClickHandler>;
13
15
  */
14
16
  export declare const provideGuidoActions: (actions: {
15
17
  onBack: BackHandler;
18
+ onSaveBefore: SaveBeforeHandler;
16
19
  onSaveStart: SaveStartHandler;
17
20
  onSaveComplete: SaveCompleteHandler;
18
21
  onTestEmailClick: TestEmailClickHandler;
@@ -21,6 +24,7 @@ export declare const provideGuidoActions: (actions: {
21
24
  * Provides individual Guido action handlers
22
25
  */
23
26
  export declare const provideBackHandler: (handler: BackHandler) => void;
27
+ export declare const provideSaveBeforeHandler: (handler: SaveBeforeHandler) => void;
24
28
  export declare const provideSaveStartHandler: (handler: SaveStartHandler) => void;
25
29
  export declare const provideSaveCompleteHandler: (handler: SaveCompleteHandler) => void;
26
30
  /**
@@ -28,6 +32,11 @@ export declare const provideSaveCompleteHandler: (handler: SaveCompleteHandler)
28
32
  * @returns Back navigation function
29
33
  */
30
34
  export declare const useBack: () => BackHandler;
35
+ /**
36
+ * Hook to use the save before handler
37
+ * @returns Save before function that returns Promise<boolean>
38
+ */
39
+ export declare const useSaveBefore: () => SaveBeforeHandler;
31
40
  /**
32
41
  * Hook to use the save start handler
33
42
  * @returns Save start function
@@ -49,6 +58,7 @@ export declare const useTestEmailClick: () => TestEmailClickHandler;
49
58
  */
50
59
  export declare const useGuidoActions: () => {
51
60
  back: BackHandler;
61
+ saveBefore: SaveBeforeHandler;
52
62
  saveStart: SaveStartHandler;
53
63
  saveComplete: SaveCompleteHandler;
54
64
  testEmailClick: TestEmailClickHandler;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.4.4-beta.db9794f",
3
+ "version": "1.4.4-beta.dc62a4d",
4
4
  "description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
5
5
  "main": "./dist/guido.umd.cjs",
6
6
  "module": "./dist/library.js",
@@ -1,53 +0,0 @@
1
- import { useActionsApi as f } from "./useActionsApi.js";
2
- import { useHttp as w } from "./useHttp.js";
3
- import { useToaster as H } from "./useToaster.js";
4
- import { useStripoApi as y } from "../services/stripoApi.js";
5
- const O = () => {
6
- const { handleError: c } = H(), { getToken: u } = y(), { post: d } = w(), { updateHtmlAndCss: l } = f(), s = (t) => /esd-timer-id="(\d+)"/.test(t), i = async (t, e) => {
7
- try {
8
- return (await d(
9
- "https://plugins.stripo.email/api/v1/timers/clone",
10
- { html: t },
11
- {
12
- headers: {
13
- "ES-PLUGIN-AUTH": `Bearer ${e}`,
14
- "Content-Type": "application/json"
15
- }
16
- }
17
- )).data.html;
18
- } catch (r) {
19
- return c(r, "Failed to clone timer IDs"), null;
20
- }
21
- };
22
- return {
23
- hasTimerBlocks: s,
24
- cloneTimersInHtml: i,
25
- cloneTimersOnSave: async (t) => {
26
- if (!s(t))
27
- return t;
28
- const e = await u();
29
- return e && await i(t, e) || t;
30
- },
31
- updateTimersOnLoad: async (t) => {
32
- var e, r, o, m;
33
- try {
34
- const n = (r = (e = window.UIEditor) == null ? void 0 : e.getHtml) == null ? void 0 : r.call(e);
35
- if (!n || !s(n))
36
- return;
37
- const p = await t();
38
- if (!p)
39
- return;
40
- const a = await i(n, p);
41
- if (!a || a === n)
42
- return;
43
- const T = ((m = (o = window.UIEditor) == null ? void 0 : o.getCss) == null ? void 0 : m.call(o)) || "";
44
- l(a, T);
45
- } catch (n) {
46
- c(n, "Failed to update timer blocks");
47
- }
48
- }
49
- };
50
- };
51
- export {
52
- O as useTimerClone
53
- };
@@ -1,6 +0,0 @@
1
- export declare const useTimerClone: () => {
2
- hasTimerBlocks: (html: string) => boolean;
3
- cloneTimersInHtml: (html: string, authToken: string) => Promise<string | null>;
4
- cloneTimersOnSave: (html: string) => Promise<string>;
5
- updateTimersOnLoad: (getTokenFn: () => Promise<string>) => Promise<void>;
6
- };