@useinsider/guido 1.4.4-beta.c341e0d → 1.4.4-beta.c77b465

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
- "86b0275b"
15
+ "282ca4d1"
16
16
  );
17
17
  const v = s.exports;
18
18
  export {
@@ -1,50 +1,54 @@
1
- import { defineComponent as R, defineAsyncComponent as k, ref as x, computed as P, watch as N, onMounted as O, onUnmounted as z } from "vue";
2
- import { provideGuidoActions as B } from "../composables/useGuidoActions.js";
3
- import { usePartner as K } from "../composables/usePartner.js";
4
- import { useStripo as M } from "../composables/useStripo.js";
5
- import { migrate as T } from "../config/migrator/index.js";
6
- import j from "./organisms/base/Toaster.vue.js";
7
- import q from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
8
- import J from "./organisms/header/HeaderWrapper.vue.js";
9
- import Q from "./organisms/LoadingWrapper.vue.js";
10
- import V from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
11
- import X from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
12
- import { useStripoApi as Y } from "../services/stripoApi.js";
13
- import { useConfigStore as Z } from "../stores/config.js";
14
- import { useDynamicContentStore as $ } from "../stores/dynamic-content.js";
15
- import { useEditorStore as ee } from "../stores/editor.js";
16
- import { usePreviewStore as oe } from "../stores/preview.js";
17
- import { useUnsubscribeStore as te } from "../stores/unsubscribe.js";
18
- const Se = /* @__PURE__ */ R({
1
+ import { defineComponent as x, defineAsyncComponent as P, ref as B, computed as U, watch as N, onMounted as z, onUnmounted as K } from "vue";
2
+ import { provideGuidoActions as M } from "../composables/useGuidoActions.js";
3
+ import { usePartner as j } from "../composables/usePartner.js";
4
+ import { useStripo as q } from "../composables/useStripo.js";
5
+ import { useTimerClone as J } from "../composables/useTimerClone.js";
6
+ import { migrate as W } from "../config/migrator/index.js";
7
+ import Q from "./organisms/base/Toaster.vue.js";
8
+ import V from "./organisms/extensions/recommendation/FilterSelectionDrawer.vue.js";
9
+ import X from "./organisms/header/HeaderWrapper.vue.js";
10
+ import Y from "./organisms/LoadingWrapper.vue.js";
11
+ import Z from "./organisms/save-as-template/SaveAsTemplateDrawer.vue.js";
12
+ import $ from "./organisms/unsubscribe/UnsubscribeWrapper.vue.js";
13
+ import { useStripoApi as ee } from "../services/stripoApi.js";
14
+ import { useConfigStore as oe } from "../stores/config.js";
15
+ import { useDynamicContentStore as te } from "../stores/dynamic-content.js";
16
+ import { useEditorStore as ne } from "../stores/editor.js";
17
+ import { usePreviewStore as re } from "../stores/preview.js";
18
+ import { useUnsubscribeStore as ce } from "../stores/unsubscribe.js";
19
+ const Ee = /* @__PURE__ */ x({
19
20
  __name: "Guido",
20
21
  props: {
21
22
  config: null
22
23
  },
23
24
  emits: ["dynamic-content:open", "back", "save:start", "save:complete", "on-change", "ready", "onboarding:finished", "test-email:click"],
24
- setup(U, { expose: W, emit: t }) {
25
- const l = U, _ = k(
25
+ setup(_, { expose: I, emit: t }) {
26
+ const l = _, L = P(
26
27
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
27
- ), I = k(
28
+ ), A = P(
28
29
  () => import("./organisms/onboarding/OnboardingWrapper.vue.js")
29
- ), p = x(), s = $(), u = te(), n = Z();
30
+ ), p = B(), s = te(), u = ce(), n = oe();
30
31
  n.init(l.config);
31
- const i = ee(), L = oe(), r = P(() => i.hasChanges), { isTestPartner: A } = K(), y = () => {
32
+ const i = ne(), F = re(), r = U(() => i.hasChanges), { isTestPartner: G } = j(), v = () => {
32
33
  var e;
33
34
  return (e = p.value) == null ? void 0 : e.handleSave(!0);
34
- }, { templateId: a, userId: v, partnerName: b, productType: f, username: g, template: o } = n, c = (o == null ? void 0 : o.html) || "", h = (o == null ? void 0 : o.css) || "", d = (o == null ? void 0 : o.preselectedDynamicContent) || [];
35
+ }, { templateId: a, userId: y, partnerName: h, productType: f, username: b, template: o } = n, c = (o == null ? void 0 : o.html) || "", g = (o == null ? void 0 : o.css) || "", m = (o == null ? void 0 : o.preselectedDynamicContent) || [];
35
36
  i.templateId = a;
36
- const { initPlugin: S } = M({
37
+ const { initPlugin: S } = q({
37
38
  emailId: a,
38
- userId: v,
39
- username: g,
40
- partnerName: b,
39
+ userId: y,
40
+ username: b,
41
+ partnerName: h,
41
42
  productType: f,
42
- preselectedDynamicContentList: d,
43
+ preselectedDynamicContentList: m,
43
44
  onReady: () => {
44
45
  console.debug("guido:ready"), t("ready");
45
46
  }
46
- }), { getDefaultTemplate: w } = Y(), F = P(() => !n.showHeader);
47
- B({
47
+ }), { getDefaultTemplate: w } = ee(), { cloneTimersOnSave: C, hasTimerBlocks: D } = J(), H = U(() => {
48
+ var e;
49
+ return !((e = n.ui) != null && e.showHeader);
50
+ });
51
+ M({
48
52
  onBack: () => {
49
53
  console.debug("guido:back"), t("back");
50
54
  },
@@ -58,51 +62,51 @@ const Se = /* @__PURE__ */ R({
58
62
  console.debug("guido:test-email:click"), t("test-email:click");
59
63
  }
60
64
  });
61
- const C = (e) => {
65
+ const E = (e) => {
62
66
  console.debug("dynamic-content:close", e), s.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
63
- }, D = () => {
67
+ }, k = () => {
64
68
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
65
69
  };
66
70
  N(() => r.value, () => {
67
71
  t("on-change", r.value);
68
72
  });
69
- const m = (e) => {
70
- const E = e, { attribute: G, position: H } = E.detail;
71
- console.debug("dynamic-content:open", E.detail), t("dynamic-content:open", G, H);
73
+ const d = (e) => {
74
+ const T = e, { attribute: O, position: R } = T.detail;
75
+ console.debug("dynamic-content:open", T.detail), t("dynamic-content:open", O, R);
72
76
  };
73
- return O(async () => {
77
+ return z(async () => {
74
78
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
75
79
  try {
76
80
  u.selectedUnsubscribePages = (o == null ? void 0 : o.selectedUnsubscribePages) || [];
77
81
  let e = {
78
- html: c && await T(c),
79
- css: h,
82
+ html: c && await W(c),
83
+ css: g,
80
84
  forceRecreate: !0
81
85
  // TODO: It should be false for old templates. We will communicate with Stripo
82
86
  };
83
- e.html || (e = await w(), e.html = await T(e.html)), await S(e), s.selectedDynamicContentList = d;
87
+ e.html || (e = await w(), e.html = await W(e.html)), D(e.html) && (e.html = await C(e.html)), await S(e), s.selectedDynamicContentList = m;
84
88
  } catch (e) {
85
89
  console.error("Failed to initialize Stripo editor:", e);
86
90
  }
87
- document.addEventListener("dynamic-content:open", m);
88
- }), z(() => {
89
- document.removeEventListener("dynamic-content:open", m);
91
+ document.addEventListener("dynamic-content:open", d);
92
+ }), K(() => {
93
+ document.removeEventListener("dynamic-content:open", d);
90
94
  try {
91
95
  window.UIEditor.removeEditor();
92
96
  } catch {
93
97
  console.debug("Failed to remove Stripo editor: No editor found");
94
98
  }
95
99
  n.reset();
96
- }), W({
100
+ }), I({
97
101
  dynamicContent: {
98
- insert: C,
99
- close: D
102
+ insert: E,
103
+ close: k
100
104
  },
101
105
  hasChanges: r,
102
- saveSilent: y
103
- }), { __sfc: !0, PreviewContainer: _, OnboardingWrapper: I, headerWrapperRef: p, dynamicContentStore: s, unsubscribeStore: u, props: l, configStore: n, editorStore: i, previewStore: L, hasChanges: r, isTestPartner: A, saveSilent: y, templateId: a, userId: v, partnerName: b, productType: f, username: g, templateConfig: o, html: c, css: h, preselectedDynamicContentList: d, emit: t, initPlugin: S, getDefaultTemplate: w, noHeader: F, insertDynamicContent: C, closeDynamicContent: D, handleDynamicContentOpen: m, Toaster: j, FilterSelectionDrawer: q, HeaderWrapper: J, LoadingWrapper: Q, SaveAsTemplateDrawer: V, UnsubscribeWrapper: X };
106
+ saveSilent: v
107
+ }), { __sfc: !0, PreviewContainer: L, OnboardingWrapper: A, headerWrapperRef: p, dynamicContentStore: s, unsubscribeStore: u, props: l, configStore: n, editorStore: i, previewStore: F, hasChanges: r, isTestPartner: G, saveSilent: v, templateId: a, userId: y, partnerName: h, productType: f, username: b, templateConfig: o, html: c, css: g, preselectedDynamicContentList: m, emit: t, initPlugin: S, getDefaultTemplate: w, cloneTimersOnSave: C, hasTimerBlocks: D, noHeader: H, insertDynamicContent: E, closeDynamicContent: k, handleDynamicContentOpen: d, Toaster: Q, FilterSelectionDrawer: V, HeaderWrapper: X, LoadingWrapper: Y, SaveAsTemplateDrawer: Z, UnsubscribeWrapper: $ };
104
108
  }
105
109
  });
106
110
  export {
107
- Se as default
111
+ Ee as default
108
112
  };
@@ -1,7 +1,7 @@
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 = { ...{
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 = { ...{
5
5
  minimize: !0,
6
6
  utmEntity: {
7
7
  utmSource: "",
@@ -21,28 +21,28 @@ const A = () => {
21
21
  resetDataSavedFlag: !1,
22
22
  disableLineHeightsReplace: !0
23
23
  }, ...t }, m = {
24
- callback: (s, c, p, u, d) => {
25
- s ? a(s) : e({
26
- html: c,
27
- ampHtml: p,
28
- ampErrors: u,
29
- displayConditions: d
24
+ callback: (o, p, d, c, u) => {
25
+ o ? i(o) : e({
26
+ html: p,
27
+ ampHtml: d,
28
+ ampErrors: c,
29
+ displayConditions: u
30
30
  });
31
31
  },
32
- ...i
32
+ ...n
33
33
  };
34
34
  window.StripoEditorApi.actionsApi.compileEmail(m);
35
35
  });
36
36
  return {
37
- getCompiledEmail: n,
37
+ getCompiledEmail: s,
38
38
  getTemplateData: () => new Promise((t) => {
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,
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,
43
43
  height: r,
44
44
  utmParams: m,
45
- syncModulesIds: s
45
+ syncModulesIds: o
46
46
  });
47
47
  window.StripoEditorApi.actionsApi.getTemplateData(e);
48
48
  }),
@@ -53,15 +53,15 @@ const A = () => {
53
53
  try {
54
54
  const {
55
55
  html: e,
56
- displayConditions: a,
57
- ampHtml: o = "",
58
- ampErrors: i = []
59
- } = await n({ minimize: !1, resetDataSavedFlag: !1, ...t });
56
+ displayConditions: i,
57
+ ampHtml: a = "",
58
+ ampErrors: n = []
59
+ } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
60
60
  return {
61
61
  html: e,
62
- ampHtml: o,
63
- ampErrors: i,
64
- displayConditions: a
62
+ ampHtml: a,
63
+ ampErrors: n,
64
+ displayConditions: i
65
65
  };
66
66
  } catch (e) {
67
67
  return l(e, "Error loading preview"), {
@@ -71,9 +71,26 @@ const A = () => {
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);
74
91
  }
75
92
  };
76
93
  };
77
94
  export {
78
- A as useActionsApi
95
+ S as useActionsApi
79
96
  };
@@ -1,19 +1,19 @@
1
- import { useActionsApi as w } from "./useActionsApi.js";
2
- import { useBlocksConfig as b } from "./useBlocksConfig.js";
3
- import { useConfig as k } from "./useConfig.js";
1
+ import { useActionsApi as b } from "./useActionsApi.js";
2
+ import { useBlocksConfig as k } from "./useBlocksConfig.js";
3
+ import { useConfig as T } 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 T } from "../enums/displayConditions.js";
8
- import { useStripoApi as A } from "../services/stripoApi.js";
7
+ import { displayConditions as A } from "../enums/displayConditions.js";
8
+ import { useStripoApi as v } from "../services/stripoApi.js";
9
9
  import F from "../static/styles/customEditorStyle.css.js";
10
- import { useEditorStore as v } from "../stores/editor.js";
10
+ import { useEditorStore as I } from "../stores/editor.js";
11
11
  import { dynamicContentToMergeTags as M } from "../utils/genericUtil.js";
12
12
  import U from "../package.json.js";
13
- const J = (c) => {
14
- const { features: g } = k(), { handleError: l } = B(), { getToken: f, getCustomFonts: y } = A(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = b(), E = async (i, r = []) => {
13
+ const N = (c) => {
14
+ const { features: g } = T(), { handleError: l } = B(), { getToken: f, getCustomFonts: y } = v(), { handleEvent: S } = _(), { getStripoBlocksConfig: C } = k(), E = async (i, r = []) => {
15
15
  var m;
16
- const t = v(), { html: n, css: u, forceRecreate: a } = i, { baseBlocks: e, extensions: d } = await C(), p = ((m = g.value) == null ? void 0 : m.displayConditions) ?? !0;
16
+ const e = I(), { html: n, css: u, forceRecreate: a } = i, { baseBlocks: t, extensions: d } = await C(), p = ((m = g.value) == null ? void 0 : m.displayConditions) ?? !0;
17
17
  window.UIEditor.initEditor(
18
18
  document.querySelector("#guido-editor"),
19
19
  {
@@ -33,7 +33,7 @@ const J = (c) => {
33
33
  customViewStyles: F,
34
34
  conditionsEnabled: p,
35
35
  customConditionsEnabled: p,
36
- conditionCategories: T,
36
+ conditionCategories: A,
37
37
  enableXSSSecurity: !0,
38
38
  messageSettingsEnabled: !0,
39
39
  displayGmailAnnotations: !0,
@@ -41,7 +41,7 @@ const J = (c) => {
41
41
  displayTitle: !1,
42
42
  displayUTM: !1,
43
43
  selectElementAfterDrop: !0,
44
- ...e ? { baseBlocks: e } : {},
44
+ ...t ? { baseBlocks: t } : {},
45
45
  editorFonts: {
46
46
  showDefaultStandardFonts: !0,
47
47
  showDefaultNotStandardFonts: !0,
@@ -62,25 +62,25 @@ const J = (c) => {
62
62
  },
63
63
  onTemplateLoaded() {
64
64
  try {
65
- const { importCss: o } = V(), { activateCustomViewStyles: s } = w();
66
- o(), s(), c.onReady(), t.isStripoInitialized = !0, t.loadingStatus = !1, setTimeout(() => {
67
- t.hasChanges = !1;
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;
68
68
  }, 1e3);
69
69
  } catch (o) {
70
70
  l(o, "Failed to load custom interface appearance");
71
71
  }
72
72
  },
73
73
  onCodeEditorVisibilityChanged(o) {
74
- t.isCodeEditorOpen = o;
74
+ e.isCodeEditorOpen = o;
75
75
  },
76
76
  onEditorVisualModeChanged(o) {
77
- t.editorVisualMode = o.toLowerCase();
77
+ e.editorVisualMode = o.toLowerCase();
78
78
  },
79
79
  onVersionHistoryVisibilityChanged(o) {
80
- t.isVersionHistoryOpen = o;
80
+ e.isVersionHistoryOpen = o;
81
81
  },
82
82
  onDataChanged() {
83
- t.hasChanges = !0;
83
+ e.hasChanges = !0;
84
84
  },
85
85
  onEvent: S,
86
86
  ignoreClickOutsideSelectors: [
@@ -91,18 +91,18 @@ const J = (c) => {
91
91
  extensions: d
92
92
  }
93
93
  );
94
- }, h = (i) => new Promise((r, t) => {
94
+ }, h = (i) => new Promise((r, e) => {
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`, e = document.createElement("script");
101
- e.id = "UiEditorScript", e.type = "module", e.src = a, e.onload = () => {
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 = () => {
102
102
  i(), r();
103
- }, e.onerror = () => {
104
- t(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
- }, document.body.appendChild(e);
103
+ }, t.onerror = () => {
104
+ e(new Error(`Failed to load Stripo UIEditor script from S3: ${a}`));
105
+ }, document.body.appendChild(t);
106
106
  });
107
107
  return { initPlugin: async (i) => {
108
108
  await h(async () => {
@@ -112,5 +112,5 @@ const J = (c) => {
112
112
  } };
113
113
  };
114
114
  export {
115
- J as useStripo
115
+ N as useStripo
116
116
  };
@@ -0,0 +1,53 @@
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,7 +1,8 @@
1
1
  const t = {
2
2
  transactional: 2
3
- }, e = 2;
3
+ }, o = 2, T = 13;
4
4
  export {
5
- e as EditorType,
5
+ o as EditorType,
6
+ T as MAX_DEFAULT_TEMPLATE_ID,
6
7
  t as TemplateTypes
7
8
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .gap-16[data-v-6562e38c],.gap-16[data-v-1ccb6d4a]{gap:16px}[data-v-06e6f7a7] .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-86b0275b]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-86b0275b]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-86b0275b]{height:calc(100vh - 75px)}[data-v-293f1c47] .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-bb3bb07c] .guido__verion-history-view-option-selection-desktop svg,[data-v-bb3bb07c] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-bb3bb07c] .in-segments-wrapper__button_selected,[data-v-bb3bb07c] .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-4b876c1b]{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-06e6f7a7] .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-282ca4d1]{position:relative;width:100%;height:calc(100vh - 128px)}.guido-editor__container[data-v-282ca4d1]{width:100%;height:calc(100vh - 128px)}.guido-editor__no-header[data-v-282ca4d1]{height:calc(100vh - 75px)}[data-v-293f1c47] .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-bb3bb07c] .guido__verion-history-view-option-selection-desktop svg,[data-v-bb3bb07c] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-bb3bb07c] .in-segments-wrapper__button_selected,[data-v-bb3bb07c] .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-4b876c1b]{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,7 +1,8 @@
1
- import { useHttp as a } from "../composables/useHttp.js";
2
- import { useToaster as s } from "../composables/useToaster.js";
3
- const m = () => {
4
- const { get: r } = a(), { handleError: o } = s();
1
+ import { useHttp as m } from "../composables/useHttp.js";
2
+ import { useToaster as u } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as i } from "../enums/defaults.js";
4
+ const y = () => {
5
+ const { get: r } = m(), { handleError: o } = u();
5
6
  return {
6
7
  getToken: async () => {
7
8
  try {
@@ -29,15 +30,13 @@ const m = () => {
29
30
  forceRecreate: !0
30
31
  };
31
32
  try {
32
- const { data: e } = await r("/stripo/default-template/0");
33
- try {
34
- return {
35
- ...JSON.parse(e),
36
- forceRecreate: !0
37
- };
38
- } catch {
39
- return t;
40
- }
33
+ const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= i ? s : 0, { data: n } = await r(
34
+ `/stripo/default-template/${l}`
35
+ ), a = typeof n == "string" ? JSON.parse(n) : n;
36
+ return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : {
37
+ ...a,
38
+ forceRecreate: !0
39
+ };
41
40
  } catch (e) {
42
41
  return o(e, "Failed to fetch default template"), t;
43
42
  }
@@ -45,5 +44,5 @@ const m = () => {
45
44
  };
46
45
  };
47
46
  export {
48
- m as useStripoApi
47
+ y as useStripoApi
49
48
  };
@@ -5,4 +5,6 @@ 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;
8
10
  };
@@ -0,0 +1,6 @@
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
+ };
@@ -7,4 +7,5 @@ export declare const TemplateTypes: {
7
7
  transactional: number;
8
8
  };
9
9
  export declare const EditorType: number;
10
+ export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
10
11
  export declare const ProductIds: Record<string, number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.4.4-beta.c341e0d",
3
+ "version": "1.4.4-beta.c77b465",
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",