@useinsider/guido 1.0.0-beta.462f217 → 1.0.0-beta.4694612

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/@types/generic.d.ts +4 -0
  2. package/dist/components/Guido.vue.d.ts +5 -1
  3. package/dist/components/Guido.vue.js +1 -1
  4. package/dist/components/Guido.vue2.js +52 -37
  5. package/dist/components/organisms/email-preview/amp/AmpErrorModal.vue.js +1 -1
  6. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue.js +3 -3
  7. package/dist/components/organisms/email-preview/desktop-preview/DesktopPreview.vue2.js +16 -15
  8. package/dist/components/organisms/email-preview/desktop-preview/EmailHeaderInfo.vue2.js +8 -8
  9. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue.js +1 -1
  10. package/dist/components/organisms/email-preview/desktop-preview/EmailSizeIndicator.vue2.js +8 -5
  11. package/dist/components/organisms/email-preview/mobile-preview/ContentView.vue2.js +4 -4
  12. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue.js +7 -7
  13. package/dist/components/organisms/email-preview/mobile-preview/InboxView.vue2.js +8 -8
  14. package/dist/components/organisms/header/MiddleSlot.vue2.js +6 -8
  15. package/dist/components/wrappers/WpModal.vue.d.ts +1 -12
  16. package/dist/composables/useActionsApi.js +29 -19
  17. package/dist/composables/useConfig.d.ts +0 -1
  18. package/dist/composables/useConfig.js +4 -8
  19. package/dist/composables/usePreviewMode.js +15 -15
  20. package/dist/composables/useResponsivePreview.d.ts +1 -1
  21. package/dist/composables/useResponsivePreview.js +9 -9
  22. package/dist/composables/useStripo.js +23 -17
  23. package/dist/extensions/DynamicContent/dynamic-content.js +13 -15
  24. package/dist/guido.css +1 -1
  25. package/dist/stores/dynamic-content.d.ts +27 -0
  26. package/dist/stores/dynamic-content.js +23 -0
  27. package/dist/stores/preview.d.ts +4 -47
  28. package/dist/stores/preview.js +18 -28
  29. package/dist/utils/arrayUtil.d.ts +1 -0
  30. package/dist/utils/arrayUtil.js +10 -0
  31. package/dist/utils/genericUtil.d.ts +2 -0
  32. package/dist/utils/genericUtil.js +7 -0
  33. package/package.json +1 -1
@@ -14,3 +14,7 @@ export interface EmailHeader {
14
14
  senderName: string;
15
15
  subject: string;
16
16
  }
17
+ export type MergeTag = {
18
+ label: string;
19
+ value: string;
20
+ };
@@ -8,6 +8,7 @@ type __VLS_Props = {
8
8
  username?: string;
9
9
  html?: string;
10
10
  css?: string;
11
+ preselectedDynamicContentList: DynamicContent[];
11
12
  guidoConfig: GuidoConfig;
12
13
  };
13
14
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__VLS_Props>, {
@@ -19,7 +20,10 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<__
19
20
  "dynamic-content:open": (detail: DynamicContent | null) => void;
20
21
  back: () => void;
21
22
  "save:start": () => void;
22
- "save:complete": (template: Omit<Template, "forceRecreate">) => void;
23
+ "save:complete": (data: {
24
+ template: Omit<Template, "forceRecreate">;
25
+ dynamicContentList: DynamicContent[];
26
+ }) => void;
23
27
  }, string, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<__VLS_Props>>>, {}>;
24
28
  export default _default;
25
29
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -10,7 +10,7 @@ var s = function() {
10
10
  a,
11
11
  !1,
12
12
  null,
13
- "5fe1cbdf"
13
+ "4083db95"
14
14
  );
15
15
  const c = n.exports;
16
16
  export {
@@ -1,12 +1,13 @@
1
- import { defineComponent as S, defineAsyncComponent as D, onMounted as E } from "vue";
2
- import { provideGuidoActions as P } from "../composables/useGuidoActions.js";
3
- import { usePartner as _ } from "../composables/usePartner.js";
4
- import { useStripo as G } from "../composables/useStripo.js";
5
- import { DefaultUsername as I, DefaultGuidoConfig as k } from "../enums/defaults.js";
6
- import T from "./organisms/header/HeaderWrapper.vue.js";
7
- import { useStripoApi as A } from "../services/stripoApi.js";
8
- import { usePreviewStore as N } from "../stores/preview.js";
9
- const M = /* @__PURE__ */ S({
1
+ import { defineComponent as L, defineAsyncComponent as E, onMounted as P } from "vue";
2
+ import { provideGuidoActions as _ } from "../composables/useGuidoActions.js";
3
+ import { usePartner as G } from "../composables/usePartner.js";
4
+ import { useStripo as I } from "../composables/useStripo.js";
5
+ import { DefaultUsername as k, DefaultGuidoConfig as T } from "../enums/defaults.js";
6
+ import A from "./organisms/header/HeaderWrapper.vue.js";
7
+ import { useStripoApi as N } from "../services/stripoApi.js";
8
+ import { useDynamicContentStore as x } from "../stores/dynamic-content.js";
9
+ import { usePreviewStore as W } from "../stores/preview.js";
10
+ const q = /* @__PURE__ */ L({
10
11
  __name: "Guido",
11
12
  props: {
12
13
  templateId: null,
@@ -16,68 +17,82 @@ const M = /* @__PURE__ */ S({
16
17
  username: null,
17
18
  html: null,
18
19
  css: null,
20
+ preselectedDynamicContentList: null,
19
21
  guidoConfig: null
20
22
  },
21
23
  emits: ["dynamic-content:open", "back", "save:start", "save:complete"],
22
- setup(C, { expose: b, emit: o }) {
23
- const t = C, w = D(
24
+ setup(S, { expose: b, emit: t }) {
25
+ const o = S, w = E(
24
26
  () => import("./organisms/email-preview/PreviewContainer.vue.js")
25
- ), { getPartnerName: n, getProductType: c } = _(), h = N(), {
27
+ ), n = x(), c = o.preselectedDynamicContentList || [], { getPartnerName: i, getProductType: s } = G(), h = W(), {
26
28
  templateId: a,
27
29
  userId: r,
28
- guidoConfig: i,
29
- html: s = "",
30
- css: d = "",
31
- partnerName: l = n(),
32
- productType: u = c(),
33
- username: m = I
34
- } = t;
30
+ guidoConfig: m,
31
+ html: d = "",
32
+ css: l = "",
33
+ partnerName: u = i(),
34
+ productType: p = s(),
35
+ username: y = k
36
+ } = o;
35
37
  window.GuidoConfig = {
36
- ...k,
37
- ...i
38
+ ...T,
39
+ ...m
38
40
  };
39
- const { initPlugin: p } = G({ emailId: a, userId: r, username: m, partnerName: l, productType: u }), { getDefaultTemplate: f } = A();
40
- P({
41
+ const { initPlugin: C } = I({
42
+ emailId: a,
43
+ userId: r,
44
+ username: y,
45
+ partnerName: u,
46
+ productType: p,
47
+ preselectedDynamicContentList: c
48
+ }), { getDefaultTemplate: g } = N();
49
+ _({
41
50
  onBack: () => {
42
- console.debug("guido:back"), o("back");
51
+ console.debug("guido:back"), t("back");
43
52
  },
44
53
  onSaveStart: () => {
45
- console.debug("guido:save:start"), o("save:start");
54
+ console.debug("guido:save:start"), t("save:start");
46
55
  },
47
56
  onSaveComplete: (e) => {
48
- console.debug("guido:save:complete", e), o("save:complete", e);
57
+ console.debug("guido:save:complete", {
58
+ template: e,
59
+ dynamicContentList: n.getSelectedDynamicContentList
60
+ }), t("save:complete", {
61
+ template: e,
62
+ dynamicContentList: n.getSelectedDynamicContentList
63
+ });
49
64
  }
50
65
  });
51
- const g = (e) => {
52
- console.debug("dynamic-content:close", e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
66
+ const f = (e) => {
67
+ console.debug("dynamic-content:close", e), n.setSelectedDynamicContent(e), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: e }));
53
68
  }, v = () => {
54
69
  console.debug("dynamic-content:close", "Without Data"), document.dispatchEvent(new CustomEvent("dynamic-content:close", { detail: { text: "", value: "" } }));
55
70
  };
56
- return E(async () => {
71
+ return P(async () => {
57
72
  console.debug("Guido says happy coding 🎉"), console.debug("🚗 Ka-Chow");
58
73
  try {
59
74
  let e = {
60
- html: s,
61
- css: d,
75
+ html: d,
76
+ css: l,
62
77
  forceRecreate: !0
63
78
  // TODO: It should be false for old templates. We will communicate with Stripo
64
79
  };
65
- e.html || (e = await f()), await p(e);
80
+ e.html || (e = await g()), await C(e), n.selectedDynamicContentList = c;
66
81
  } catch (e) {
67
82
  console.error("Failed to initialize Stripo editor:", e);
68
83
  }
69
84
  document.addEventListener("dynamic-content:open", (e) => {
70
- const y = e;
71
- console.debug("dynamic-content:open", y.detail), o("dynamic-content:open", y.detail);
85
+ const D = e;
86
+ console.debug("dynamic-content:open", D.detail), t("dynamic-content:open", D.detail);
72
87
  });
73
88
  }), b({
74
89
  dynamicContent: {
75
- insert: g,
90
+ insert: f,
76
91
  close: v
77
92
  }
78
- }), { __sfc: !0, PreviewContainer: w, props: t, getPartnerName: n, getProductType: c, previewStore: h, templateId: a, userId: r, guidoConfig: i, html: s, css: d, partnerName: l, productType: u, username: m, emit: o, initPlugin: p, getDefaultTemplate: f, insertDynamicContent: g, closeDynamicContent: v, HeaderWrapper: T };
93
+ }), { __sfc: !0, PreviewContainer: w, dynamicContentStore: n, props: o, preselectedDynamicContentList: c, getPartnerName: i, getProductType: s, previewStore: h, templateId: a, userId: r, guidoConfig: m, html: d, css: l, partnerName: u, productType: p, username: y, emit: t, initPlugin: C, getDefaultTemplate: g, insertDynamicContent: f, closeDynamicContent: v, HeaderWrapper: A };
79
94
  }
80
95
  });
81
96
  export {
82
- M as default
97
+ q as default
83
98
  };
@@ -14,7 +14,7 @@ var n = function() {
14
14
  l,
15
15
  !1,
16
16
  null,
17
- "cfb613b7"
17
+ "7a09985c"
18
18
  );
19
19
  const _ = d.exports;
20
20
  export {
@@ -14,9 +14,9 @@ var s = function() {
14
14
  i,
15
15
  !1,
16
16
  null,
17
- "9c6e7ff0"
17
+ "2dd60b0c"
18
18
  );
19
- const m = n.exports;
19
+ const d = n.exports;
20
20
  export {
21
- m as default
21
+ d as default
22
22
  };
@@ -1,30 +1,31 @@
1
- import { defineComponent as f, ref as r, onMounted as p, nextTick as d, onBeforeUnmount as h } from "vue";
2
- import { usePreviewStore as v } from "../../../../stores/preview.js";
3
- import { InContainer as g } from "@useinsider/design-system-vue";
4
- import _ from "./EmailHeaderInfo.vue.js";
5
- import R from "./EmailSizeIndicator.vue.js";
6
- const I = /* @__PURE__ */ f({
1
+ import { defineComponent as d, ref as r, onMounted as h, onBeforeUnmount as v, nextTick as g } from "vue";
2
+ import { usePreviewStore as _ } from "../../../../stores/preview.js";
3
+ import { InContainer as I } from "@useinsider/design-system-vue";
4
+ import R from "./EmailHeaderInfo.vue.js";
5
+ import C from "./EmailSizeIndicator.vue.js";
6
+ const B = /* @__PURE__ */ d({
7
7
  __name: "DesktopPreview",
8
- setup(C) {
9
- const t = r(), i = r("400px"), a = r(!1), l = v(), n = () => {
8
+ setup(H) {
9
+ const t = r(), i = r("400px"), a = r(!1), m = _(), n = () => {
10
10
  if (!t.value)
11
11
  return;
12
12
  const o = t.value.querySelector(".in-container");
13
13
  if (!o)
14
14
  return;
15
- const s = o.getBoundingClientRect(), c = o.querySelector(".in-container__header"), u = c ? c.getBoundingClientRect().height : 0, m = s.height - u;
16
- i.value = `${m}px`;
15
+ const u = o.getBoundingClientRect(), s = o.querySelector(".in-container__header"), f = s ? s.getBoundingClientRect().height : 0, p = u.height - f;
16
+ i.value = `${p}px`;
17
17
  };
18
18
  let e = null;
19
- return p(() => {
20
- n(), t.value && (e = new ResizeObserver(n), e.observe(t.value), d(() => {
19
+ const c = () => {
20
+ n(), t.value && (e = new ResizeObserver(n), e.observe(t.value), g(() => {
21
21
  a.value = !0;
22
22
  }));
23
- }), h(() => {
23
+ }, l = () => {
24
24
  e == null || e.disconnect();
25
- }), { __sfc: !0, containerRef: t, iframeHeight: i, isContainerReady: a, previewStore: l, calculateIframeHeight: n, resizeObserver: e, InContainer: g, EmailHeaderInfo: _, EmailSizeIndicator: R };
25
+ };
26
+ return h(c), v(l), { __sfc: !0, containerRef: t, iframeHeight: i, isContainerReady: a, previewStore: m, calculateIframeHeight: n, resizeObserver: e, initIframe: c, cleanIframe: l, InContainer: I, EmailHeaderInfo: R, EmailSizeIndicator: C };
26
27
  }
27
28
  });
28
29
  export {
29
- I as default
30
+ B as default
30
31
  };
@@ -1,18 +1,18 @@
1
- import { defineComponent as m, computed as t } from "vue";
1
+ import { defineComponent as m, computed as o } from "vue";
2
2
  import { useConfig as a } from "../../../../composables/useConfig.js";
3
- import { useTranslations as c } from "../../../../composables/useTranslations.js";
4
- import { InIcons as i } from "@useinsider/design-system-vue";
3
+ import { useTranslations as i } from "../../../../composables/useTranslations.js";
4
+ import { InIcons as c } from "@useinsider/design-system-vue";
5
5
  const l = /* @__PURE__ */ m({
6
6
  __name: "EmailHeaderInfo",
7
7
  setup(f) {
8
- const { config: n } = a(), s = c(), o = t(() => {
8
+ const { config: t } = a(), n = i(), s = o(() => {
9
9
  var e;
10
- return ((e = n.emailHeader) == null ? void 0 : e.senderName) || `(${s("settings.sender-name")})`;
11
- }), r = t(() => {
10
+ return ((e = t.emailHeader) == null ? void 0 : e.senderName) || n("settings.sender-name");
11
+ }), r = o(() => {
12
12
  var e;
13
- return ((e = n.emailHeader) == null ? void 0 : e.subject) || s("newsletter.subject");
13
+ return ((e = t.emailHeader) == null ? void 0 : e.subject) || n("email-editor.default-subject");
14
14
  });
15
- return { __sfc: !0, config: n, trans: s, senderName: o, subject: r, InIcons: i };
15
+ return { __sfc: !0, config: t, trans: n, senderName: s, subject: r, InIcons: c };
16
16
  }
17
17
  });
18
18
  export {
@@ -10,7 +10,7 @@ var o = function() {
10
10
  a,
11
11
  !1,
12
12
  null,
13
- "bd212ce2"
13
+ "c2adc57d"
14
14
  );
15
15
  const m = n.exports;
16
16
  export {
@@ -1,20 +1,23 @@
1
1
  import { defineComponent as c, ref as n, computed as l, watch as u } from "vue";
2
2
  import { useTranslations as p } from "../../../../composables/useTranslations.js";
3
- import { usePreviewStore as v } from "../../../../stores/preview.js";
4
- import { InTooltip as _, InProgress as f } from "@useinsider/design-system-vue";
3
+ import { usePreviewStore as _ } from "../../../../stores/preview.js";
4
+ import { InTooltip as v, InProgress as f } from "@useinsider/design-system-vue";
5
5
  const S = /* @__PURE__ */ c({
6
6
  __name: "EmailSizeIndicator",
7
7
  setup(w) {
8
- const t = v(), o = 102, e = n(0), s = n({
8
+ const t = _(), o = 102, e = n(0), s = n({
9
9
  type: "success",
10
10
  value: 0
11
11
  }), a = l(() => `~${e.value} KB`), r = () => {
12
12
  const m = new Blob([t.previewHtml]).size;
13
- e.value = Math.round(m / 1024), s.value.value = Math.min(e.value, o), s.value.type = e.value < o ? "success" : "warning";
13
+ e.value = Math.round(m / 1024), s.value = {
14
+ type: e.value < o ? "success" : "warning",
15
+ value: Math.min(e.value, o)
16
+ };
14
17
  }, i = p();
15
18
  return u(() => t.previewHtml, () => {
16
19
  r();
17
- }, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltip: _ };
20
+ }, { immediate: !0 }), { __sfc: !0, previewStore: t, MAX_EMAIL_SIZE_IN_KB: o, htmlKB: e, progress: s, htmlSize: a, calculateProgress: r, trans: i, InProgress: f, InTooltip: v };
18
21
  }
19
22
  });
20
23
  export {
@@ -1,18 +1,18 @@
1
1
  import { defineComponent as m, ref as c } from "vue";
2
- import { useResponsivePreview as a } from "../../../../composables/useResponsivePreview.js";
3
- import { useTranslations as f } from "../../../../composables/useTranslations.js";
2
+ import { useResponsivePreview as f } from "../../../../composables/useResponsivePreview.js";
3
+ import { useTranslations as a } from "../../../../composables/useTranslations.js";
4
4
  import { usePreviewStore as p } from "../../../../stores/preview.js";
5
5
  import { InIcons as u } from "@useinsider/design-system-vue";
6
6
  const h = /* @__PURE__ */ m({
7
7
  __name: "ContentView",
8
8
  emits: ["back-to-inbox"],
9
9
  setup(v) {
10
- const i = f(), t = p(), n = c(), { setupEmailResponsiveFit: r } = a(), s = (o) => {
10
+ const i = a(), t = p(), n = c(), { setupResponsivePreview: r } = f(), s = (o) => {
11
11
  ["transform", "transform-origin", "height"].forEach((e) => {
12
12
  o.documentElement.style.removeProperty(e);
13
13
  });
14
14
  };
15
- return { __sfc: !0, trans: i, previewStore: t, iframeRef: n, setupEmailResponsiveFit: r, clearAMPTransforms: s, onLoad: () => {
15
+ return { __sfc: !0, trans: i, previewStore: t, iframeRef: n, setupResponsivePreview: r, clearAMPTransforms: s, onLoad: () => {
16
16
  const o = n.value, e = o == null ? void 0 : o.contentDocument;
17
17
  e && (r(o), t.isAMPResponsive && s(e));
18
18
  }, InIcons: u };
@@ -1,20 +1,20 @@
1
1
  import e from "./InboxView.vue2.js";
2
2
  /* empty css */
3
- import r from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
- var a = function() {
3
+ import a from "../../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var r = function() {
5
5
  var s = this, t = s._self._c, c = s._self._setupProxy;
6
6
  return t("div", { staticClass: "p-y-13 p-x-3 bor-b-w-1 bor-b-s-s bor-b-c-50 cur-p b-c-4 b-c-h-5 p-3", on: { click: function(_) {
7
7
  return c.emit("open-email");
8
8
  } } }, [t("div", { staticClass: "d-f j-c-s-b a-i-c w-1" }, [t("div", { staticClass: "f-g-1 min-w-0-s" }, [t("div", { staticClass: "f-s-1 f-w-600 t-c-53 l-h-1 mb-12 cropped-text" }, [s._v(" " + s._s(c.senderName) + " ")]), t("div", { staticClass: "f-s-12 f-w-400 t-c-55 l-h-1 cropped-text" }, [s._v(" " + s._s(c.subject) + " ")])]), t("div", { staticClass: "f-sh-0 ml-2 f-s-12 f-w-400 t-c-55 l-h-1" }, [s._v(" " + s._s(c.trans("product-catalog.today")) + " ")]), t(c.InIcons, { staticClass: "i-c-52", attrs: { name: "line-chevron-right" } })], 1)]);
9
- }, i = [], n = /* @__PURE__ */ r(
9
+ }, i = [], n = /* @__PURE__ */ a(
10
10
  e,
11
- a,
11
+ r,
12
12
  i,
13
13
  !1,
14
14
  null,
15
- "d3bb77b4"
15
+ "f20b3a9b"
16
16
  );
17
- const d = n.exports;
17
+ const m = n.exports;
18
18
  export {
19
- d as default
19
+ m as default
20
20
  };
@@ -1,19 +1,19 @@
1
- import { defineComponent as a, computed as t } from "vue";
1
+ import { defineComponent as a, computed as o } from "vue";
2
2
  import { useConfig as i } from "../../../../composables/useConfig.js";
3
3
  import { useTranslations as c } from "../../../../composables/useTranslations.js";
4
- import { InIcons as p } from "@useinsider/design-system-vue";
4
+ import { InIcons as f } from "@useinsider/design-system-vue";
5
5
  const b = /* @__PURE__ */ a({
6
6
  __name: "InboxView",
7
7
  emits: ["open-email"],
8
- setup(f, { emit: o }) {
9
- const n = c(), { config: s } = i(), r = t(() => {
8
+ setup(p, { emit: s }) {
9
+ const t = c(), { config: n } = i(), r = o(() => {
10
10
  var e;
11
- return ((e = s.emailHeader) == null ? void 0 : e.senderName) || `(${n("settings.sender-name")})`;
12
- }), m = t(() => {
11
+ return ((e = n.emailHeader) == null ? void 0 : e.senderName) || t("settings.sender-name");
12
+ }), m = o(() => {
13
13
  var e;
14
- return ((e = s.emailHeader) == null ? void 0 : e.subject) || n("newsletter.subject");
14
+ return ((e = n.emailHeader) == null ? void 0 : e.subject) || t("email-editor.default-subject");
15
15
  });
16
- return { __sfc: !0, emit: o, trans: n, config: s, senderName: r, subject: m, InIcons: p };
16
+ return { __sfc: !0, emit: s, trans: t, config: n, senderName: r, subject: m, InIcons: f };
17
17
  }
18
18
  });
19
19
  export {
@@ -1,9 +1,9 @@
1
1
  import { defineComponent as p, computed as m } from "vue";
2
2
  import { usePreviewMode as l } from "../../../composables/usePreviewMode.js";
3
3
  import { useTranslations as c } from "../../../composables/useTranslations.js";
4
- import f from "../email-preview/amp/AmpToggle.vue.js";
5
- import { useEditorStore as a } from "../../../stores/editor.js";
6
- import { usePreviewStore as d } from "../../../stores/preview.js";
4
+ import a from "../email-preview/amp/AmpToggle.vue.js";
5
+ import { useEditorStore as d } from "../../../stores/editor.js";
6
+ import { usePreviewStore as f } from "../../../stores/preview.js";
7
7
  import { InButtonV2 as w } from "@useinsider/design-system-vue";
8
8
  import v from "./version-history/VersionHistory.vue.js";
9
9
  import u from "./version-history/ViewOptions.vue.js";
@@ -11,15 +11,13 @@ import P from "./ViewOptions.vue.js";
11
11
  const B = /* @__PURE__ */ p({
12
12
  __name: "MiddleSlot",
13
13
  setup(g) {
14
- const r = a(), o = c(), e = d(), { openPreviewMode: t, closePreviewMode: i } = l(), s = m(() => o(e.isPreviewModeOpen ? "newsletter.close-email-preview" : "newsletter.email-preview"));
15
- return { __sfc: !0, editorStore: r, trans: o, previewStore: e, openPreviewMode: t, closePreviewMode: i, previewTooltipText: s, getTooltipOptions: (n) => ({
14
+ const r = d(), e = c(), o = f(), { openPreviewMode: t, closePreviewMode: i } = l(), s = m(() => o.isPreviewModeOpen ? e("newsletter.close-email-preview") : e("newsletter.email-preview"));
15
+ return { __sfc: !0, editorStore: r, trans: e, previewStore: o, openPreviewMode: t, closePreviewMode: i, previewTooltipText: s, getTooltipOptions: (n) => ({
16
16
  id: `${n}-tooltip`,
17
17
  dynamicPosition: !1,
18
18
  staticPosition: "bottom center",
19
19
  iconStatus: !1
20
- }), handlePreviewToggle: () => {
21
- e.isPreviewModeOpen ? i() : t();
22
- }, AmpToggle: f, InButtonV2: w, VersionHistory: v, VersionHistoryViewOptions: u, ViewOptions: P };
20
+ }), handlePreviewToggle: () => o.isPreviewModeOpen ? i() : t(), AmpToggle: a, InButtonV2: w, VersionHistory: v, VersionHistoryViewOptions: u, ViewOptions: P };
23
21
  }
24
22
  });
25
23
  export {
@@ -1,15 +1,4 @@
1
- interface FooterButtonGroup {
2
- primaryButton?: {
3
- type: string;
4
- labelText: string;
5
- disabledStatus?: boolean;
6
- };
7
- cancelOrBackButton?: {
8
- type: string;
9
- labelText: string;
10
- styling: string;
11
- };
12
- }
1
+ import type { FooterButtonGroup } from '@@/Types/preview';
13
2
  type __VLS_Props = {
14
3
  id: string;
15
4
  title: string;
@@ -1,5 +1,6 @@
1
- const w = () => {
2
- const s = (t = {}) => new Promise((e, a) => {
1
+ import { useToaster as d } from "./useToaster.js";
2
+ const E = () => {
3
+ const { handleError: m } = d(), s = (t = {}) => new Promise((e, a) => {
3
4
  const i = { ...{
4
5
  minimize: !0,
5
6
  utmEntity: {
@@ -20,12 +21,12 @@ const w = () => {
20
21
  resetDataSavedFlag: !1,
21
22
  disableLineHeightsReplace: !0
22
23
  }, ...t }, n = {
23
- callback: (m, l, c, r, p) => {
24
- m ? a(m) : e({
24
+ callback: (r, l, c, p, u) => {
25
+ r ? a(r) : e({
25
26
  html: l,
26
27
  ampHtml: c,
27
- ampErrors: r,
28
- displayConditions: p
28
+ ampErrors: p,
29
+ displayConditions: u
29
30
  });
30
31
  },
31
32
  ...i
@@ -35,20 +36,29 @@ const w = () => {
35
36
  return { getCompiledEmail: s, activateCustomViewStyles: (t = !0) => {
36
37
  window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
37
38
  }, getPreviewData: async (t) => {
38
- const {
39
- html: e,
40
- displayConditions: a,
41
- ampHtml: o = "",
42
- ampErrors: i = []
43
- } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
44
- return {
45
- html: e,
46
- ampHtml: o,
47
- ampErrors: i,
48
- displayConditions: a
49
- };
39
+ try {
40
+ const {
41
+ html: e,
42
+ displayConditions: a,
43
+ ampHtml: o = "",
44
+ ampErrors: i = []
45
+ } = await s({ minimize: !1, resetDataSavedFlag: !1, ...t });
46
+ return {
47
+ html: e,
48
+ ampHtml: o,
49
+ ampErrors: i,
50
+ displayConditions: a
51
+ };
52
+ } catch (e) {
53
+ return m(e, "Error loading preview"), {
54
+ html: "",
55
+ ampHtml: "",
56
+ ampErrors: [],
57
+ displayConditions: []
58
+ };
59
+ }
50
60
  } };
51
61
  };
52
62
  export {
53
- w as useActionsApi
63
+ E as useActionsApi
54
64
  };
@@ -1,5 +1,4 @@
1
1
  import type { GuidoConfig } from '@@/Types/generic';
2
2
  export declare const useConfig: () => {
3
3
  config: GuidoConfig;
4
- getConfig: () => GuidoConfig;
5
4
  };
@@ -1,11 +1,7 @@
1
- import { DefaultGuidoConfig as n } from "../enums/defaults.js";
2
- const t = () => {
3
- const o = () => typeof window > "u" ? n : window.GuidoConfig || n;
4
- return {
5
- config: o(),
6
- getConfig: o
7
- };
8
- };
1
+ import { DefaultGuidoConfig as o } from "../enums/defaults.js";
2
+ const t = () => ({
3
+ config: typeof window > "u" ? o : window.GuidoConfig || o
4
+ });
9
5
  export {
10
6
  t as useConfig
11
7
  };
@@ -1,31 +1,31 @@
1
- import { useEditorStore as d } from "../stores/editor.js";
2
- import { usePreviewStore as n } from "../stores/preview.js";
3
- import { useActionsApi as m } from "./useActionsApi.js";
1
+ import { useEditorStore as n } from "../stores/editor.js";
2
+ import { usePreviewStore as m } from "../stores/preview.js";
3
+ import { useActionsApi as p } from "./useActionsApi.js";
4
4
  import { useCodeEditorApi as l } from "./useCodeEditorApi.js";
5
- const M = () => {
6
- const r = d(), e = n(), { closeCodeEditor: i } = l(), { getPreviewData: s } = m();
5
+ const E = () => {
6
+ const i = n(), e = m(), { closeCodeEditor: s } = l(), { getPreviewData: a } = p(), r = () => {
7
+ e.isPreviewModeOpen = !1, e.$reset();
8
+ };
7
9
  return {
8
- closePreviewMode: () => {
9
- e.isPreviewModeOpen = !1, e.resetState();
10
- },
10
+ closePreviewMode: r,
11
11
  openPreviewMode: () => {
12
- r.isCodeEditorOpen && i(), e.isPreviewModeOpen = !0;
12
+ i.isCodeEditorOpen && s(), e.isPreviewModeOpen = !0;
13
13
  },
14
14
  loadPreviewData: async () => {
15
15
  if (!(e.isLoading || e.isLoaded)) {
16
- e.setLoading(!0);
16
+ e.isLoading = !0;
17
17
  try {
18
- const { html: o, ampHtml: t, ampErrors: a } = await s();
19
- e.setTemplateHtml(o || ""), e.setAmpHtml(t || ""), e.setAmpErrors(a || []), e.setEmailFormat(t ? "AMP" : "html"), e.setLoaded(!0);
18
+ const { html: o, ampHtml: t, ampErrors: d } = await a();
19
+ e.templateHtml = o || "", e.ampHtml = t || "", e.ampErrors = d || [], e.setEmailFormat(t ? "AMP" : "html"), e.isLoaded = !0;
20
20
  } catch (o) {
21
- console.error("Failed to load preview data:", o);
21
+ console.error("Failed to load preview data:", o), r();
22
22
  } finally {
23
- e.setLoading(!1);
23
+ e.isLoading = !1;
24
24
  }
25
25
  }
26
26
  }
27
27
  };
28
28
  };
29
29
  export {
30
- M as usePreviewMode
30
+ E as usePreviewMode
31
31
  };
@@ -1,5 +1,5 @@
1
1
  export declare const useResponsivePreview: () => {
2
- setupEmailResponsiveFit: (iframe: HTMLIFrameElement) => void;
2
+ setupResponsivePreview: (iframe: HTMLIFrameElement) => void;
3
3
  tearDownEmailResponsiveFit: (iframe: HTMLIFrameElement) => void;
4
4
  hasResponsiveMetaViewport: (doc: Document) => boolean;
5
5
  };
@@ -40,7 +40,7 @@ const { debounce: y } = p(), h = (t) => {
40
40
  }, S = (t) => {
41
41
  const { targetWidth: e, deviceWidth: n, minScale: o, maxScale: r } = t, s = n / e;
42
42
  return Math.min(Math.max(s, o), r);
43
- }, R = (t, e) => {
43
+ }, P = (t, e) => {
44
44
  const n = E(t), o = S({
45
45
  targetWidth: n,
46
46
  deviceWidth: e,
@@ -54,30 +54,30 @@ const { debounce: y } = p(), h = (t) => {
54
54
  return !1;
55
55
  const n = e.getAttribute("content") || "";
56
56
  return c.META_VIEWPORT.test(n);
57
- }, x = (t) => t.clientWidth || t.getBoundingClientRect().width || 375, m = (t) => {
57
+ }, R = (t) => t.clientWidth || t.getBoundingClientRect().width || 375, d = (t) => {
58
58
  const e = t.contentWindow;
59
59
  l && e && e.removeEventListener("resize", l), i && window.removeEventListener("resize", i), l = null, i = null;
60
- }, P = (t, e) => {
60
+ }, x = (t, e) => {
61
61
  const n = t.contentWindow;
62
62
  if (!n)
63
63
  return;
64
- m(t);
64
+ d(t);
65
65
  const o = () => y(e, a.RESIZE_DEBOUNCE_MS);
66
66
  l = o, n.addEventListener("resize", l), i = o, window.addEventListener("resize", i);
67
67
  }, M = () => ({
68
- setupEmailResponsiveFit: (n) => {
68
+ setupResponsivePreview: (n) => {
69
69
  const o = n.contentDocument, r = n.contentWindow;
70
70
  if (!o || !r)
71
71
  return;
72
72
  b(o);
73
73
  const s = () => {
74
- const d = x(n);
75
- u(o) ? g(o) : R(o, d);
74
+ const m = R(n);
75
+ u(o) ? g(o) : P(o, m);
76
76
  };
77
- s(), P(n, s);
77
+ s(), x(n, s);
78
78
  },
79
79
  tearDownEmailResponsiveFit: (n) => {
80
- m(n);
80
+ d(n);
81
81
  },
82
82
  hasResponsiveMetaViewport: u
83
83
  });
@@ -1,20 +1,21 @@
1
1
  import { useActionsApi as g } from "./useActionsApi.js";
2
2
  import { useCustomInterfaceAppearance as f } from "./useCustomInterfaceAppearance.js";
3
- import { useToaster as E } from "./useToaster.js";
4
- import { displayConditions as S } from "../enums/displayConditions.js";
5
- import y from "../extensions/DynamicContent/extension.js";
6
- import { useStripoApi as C } from "../services/stripoApi.js";
3
+ import { useToaster as y } from "./useToaster.js";
4
+ import { displayConditions as C } from "../enums/displayConditions.js";
5
+ import E from "../extensions/DynamicContent/extension.js";
6
+ import { useStripoApi as S } from "../services/stripoApi.js";
7
7
  import { useEditorStore as w } from "../stores/editor.js";
8
- const A = (a) => {
9
- const { handleError: d } = E(), { getToken: c, getCustomFonts: u } = C(), l = (e, r = []) => {
10
- const i = w(), { html: t, css: s, forceRecreate: m } = e;
8
+ import { dynamicContentToMergeTags as b } from "../utils/genericUtil.js";
9
+ const M = (d) => {
10
+ const { handleError: c } = y(), { getToken: a, getCustomFonts: u } = S(), l = (e, r = []) => {
11
+ const i = w(), { html: t, css: s, forceRecreate: p } = e;
11
12
  window.UIEditor.initEditor(
12
13
  document.querySelector("#guido-editor"),
13
14
  {
14
- metadata: a,
15
+ metadata: d,
15
16
  html: t,
16
17
  css: s,
17
- forceRecreate: m,
18
+ forceRecreate: p,
18
19
  locale: "en",
19
20
  undoButtonSelector: "#guido__undo-button",
20
21
  redoButtonSelector: "#guido__redo-button",
@@ -30,19 +31,24 @@ const A = (a) => {
30
31
  `,
31
32
  conditionsEnabled: !0,
32
33
  customConditionsEnabled: !0,
33
- conditionCategories: S,
34
+ conditionCategories: C,
34
35
  messageSettingsEnabled: !1,
35
36
  editorFonts: {
36
37
  showDefaultStandardFonts: !0,
37
38
  showDefaultNotStandardFonts: !0,
38
39
  customFonts: r
39
40
  },
41
+ mergeTags: [
42
+ {
43
+ entries: b(d.preselectedDynamicContentList)
44
+ }
45
+ ],
40
46
  async onTokenRefreshRequest(o) {
41
47
  try {
42
- const n = await c();
48
+ const n = await a();
43
49
  o(n);
44
50
  } catch (n) {
45
- d(n, "Failed to refresh token");
51
+ c(n, "Failed to refresh token");
46
52
  }
47
53
  },
48
54
  onTemplateLoaded() {
@@ -50,7 +56,7 @@ const A = (a) => {
50
56
  const { importCss: o } = f(), { activateCustomViewStyles: n } = g();
51
57
  o(), n();
52
58
  } catch (o) {
53
- d(o, "Failed to load custom interface appearance");
59
+ c(o, "Failed to load custom interface appearance");
54
60
  }
55
61
  },
56
62
  onCodeEditorVisibilityChanged(o) {
@@ -63,10 +69,10 @@ const A = (a) => {
63
69
  i.isVersionHistoryOpen = o;
64
70
  },
65
71
  ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
66
- extensions: [y]
72
+ extensions: [E]
67
73
  }
68
74
  );
69
- }, p = (e) => new Promise((r, i) => {
75
+ }, m = (e) => new Promise((r, i) => {
70
76
  if (document.getElementById("UiEditorScript")) {
71
77
  e(), r();
72
78
  return;
@@ -80,12 +86,12 @@ const A = (a) => {
80
86
  }, document.body.appendChild(t);
81
87
  });
82
88
  return { initPlugin: async (e) => {
83
- await p(async () => {
89
+ await m(async () => {
84
90
  const r = await u();
85
91
  l(e, r);
86
92
  });
87
93
  } };
88
94
  };
89
95
  export {
90
- A as useStripo
96
+ M as useStripo
91
97
  };
@@ -1,15 +1,16 @@
1
- var l = Object.defineProperty;
2
- var o = (i, t, e) => t in i ? l(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
- var r = (i, t, e) => o(i, typeof t != "symbol" ? t + "" : t, e);
1
+ var o = Object.defineProperty;
2
+ var m = (i, t, e) => t in i ? o(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
3
+ var r = (i, t, e) => m(i, typeof t != "symbol" ? t + "" : t, e);
4
+ import { dynamicContentToMergeTags as l } from "../../utils/genericUtil.js";
4
5
  import { d as n } from "../../_virtual/index.js";
5
- import { ExternalMergeTagsLibrary as c } from "./dynamic-content-modal.js";
6
- const a = "external-dynamic-content-ui-element", m = "button-add-dynamic-content";
7
- class d extends n.UIElementTagRegistry {
6
+ import { ExternalMergeTagsLibrary as g } from "./dynamic-content-modal.js";
7
+ const a = "external-dynamic-content-ui-element", c = "button-add-dynamic-content";
8
+ class p extends n.UIElementTagRegistry {
8
9
  registerUiElements(t) {
9
10
  t[n.UIElementType.MERGETAGS] = a;
10
11
  }
11
12
  }
12
- class b extends n.UIElement {
13
+ class u extends n.UIElement {
13
14
  constructor() {
14
15
  super(...arguments);
15
16
  r(this, "mergeTagsButton", null);
@@ -33,13 +34,10 @@ class b extends n.UIElement {
33
34
  this.openMergeTagLibrary();
34
35
  }
35
36
  openMergeTagLibrary() {
36
- this.mergeTagsLibrary || (this.mergeTagsLibrary = new c()), this.mergeTagsLibrary.openMergeTagsLibrary(
37
+ this.mergeTagsLibrary || (this.mergeTagsLibrary = new g()), this.mergeTagsLibrary.openMergeTagsLibrary(
37
38
  this.selectedDynamicContent,
38
39
  (e) => {
39
- this.api.onValueChanged({
40
- label: e.fallback ? `${e.text} | ${e.fallback}` : e.text,
41
- value: e.fallback ? `{{${e.value}|${e.fallback}}}` : `{{${e.value}}}`
42
- });
40
+ this.api.onValueChanged(l([e])[0]);
43
41
  }
44
42
  );
45
43
  }
@@ -49,7 +47,7 @@ class b extends n.UIElement {
49
47
  <${n.UIElementType.BUTTON}
50
48
  id="guido__btn-add-dynamic-content"
51
49
  class="btn btn-primary"
52
- ${n.UEAttr.BUTTON.name}="${m}">
50
+ ${n.UEAttr.BUTTON.name}="${c}">
53
51
  <${n.UIElementType.ICON} src="plus" class="icon icon-button color-primary">
54
52
  </${n.UIElementType.ICON}>
55
53
  ${this.api.translate("Add Dynamic Content")}
@@ -58,6 +56,6 @@ class b extends n.UIElement {
58
56
  }
59
57
  }
60
58
  export {
61
- d as DynamicContentTagRegistry,
62
- b as DynamicContentUiElementExtension
59
+ p as DynamicContentTagRegistry,
60
+ u as DynamicContentUiElementExtension
63
61
  };
package/dist/guido.css CHANGED
@@ -1 +1 @@
1
- .version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-c4fe2637] .guido__view-option-selection-desktop svg,[data-v-c4fe2637] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-c4fe2637] .in-segments-wrapper__button_selected,[data-v-c4fe2637] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-5fe1cbdf],.guido-editor__container[data-v-5fe1cbdf]{width:100%;height:calc(100vh - 75px)}.error-list[data-v-cfb613b7]{gap:16px}[data-v-bd212ce2] .in-progress-wrapper__progress p span:last-child{display:none!important}.desktop-preview-container[data-v-9c6e7ff0],[data-v-9c6e7ff0] .desktop-preview-container .in-container{min-height:720px!important;height:100%}.cropped-text[data-v-d3bb77b4]{width:220px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
1
+ .version-history-item[data-v-ee4b9c3f]{flex-basis:200px}.version-history-wrapper[data-v-52a77eec]{gap:8px}[data-v-6a2bde67] .guido__verion-history-view-option-selection-desktop svg,[data-v-6a2bde67] .guido__verion-history-view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-6a2bde67] .in-segments-wrapper__button_selected,[data-v-6a2bde67] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}[data-v-c4fe2637] .guido__view-option-selection-desktop svg,[data-v-c4fe2637] .guido__view-option-selection-mobile svg{margin:0 0 0 2px}[data-v-c4fe2637] .in-segments-wrapper__button_selected,[data-v-c4fe2637] .in-segments-wrapper__button_selected:hover{background-color:#dae1fb}.guido-editor__wrapper[data-v-4083db95],.guido-editor__container[data-v-4083db95]{width:100%;height:calc(100vh - 75px)}.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}
@@ -0,0 +1,27 @@
1
+ import type { DynamicContent } from '@@/Types/generic';
2
+ export declare const useDynamicContentStore: import("pinia").StoreDefinition<"dynamicContent", {
3
+ selectedDynamicContent: DynamicContent;
4
+ selectedDynamicContentList: DynamicContent[];
5
+ }, {
6
+ getSelectedDynamicContentList: (state: {
7
+ selectedDynamicContent: {
8
+ value: string;
9
+ text: string;
10
+ fallback?: string | undefined;
11
+ };
12
+ selectedDynamicContentList: {
13
+ value: string;
14
+ text: string;
15
+ fallback?: string | undefined;
16
+ }[];
17
+ } & import("pinia").PiniaCustomStateProperties<{
18
+ selectedDynamicContent: DynamicContent;
19
+ selectedDynamicContentList: DynamicContent[];
20
+ }>) => {
21
+ text: string;
22
+ value: string;
23
+ fallback: string | undefined;
24
+ }[];
25
+ }, {
26
+ setSelectedDynamicContent(dynamicContent: DynamicContent): void;
27
+ }>;
@@ -0,0 +1,23 @@
1
+ import { removeDuplicatesFromArray as n } from "../utils/arrayUtil.js";
2
+ import { defineStore as a } from "pinia";
3
+ const s = a("dynamicContent", {
4
+ state: () => ({
5
+ selectedDynamicContent: { text: "", value: "", fallback: "" },
6
+ selectedDynamicContentList: []
7
+ }),
8
+ actions: {
9
+ setSelectedDynamicContent(e) {
10
+ this.selectedDynamicContent = e, this.selectedDynamicContentList.push(e);
11
+ }
12
+ },
13
+ getters: {
14
+ getSelectedDynamicContentList: (e) => n(e.selectedDynamicContentList).map((t) => ({
15
+ text: t.text,
16
+ value: t.value,
17
+ fallback: t.fallback
18
+ })) || []
19
+ }
20
+ });
21
+ export {
22
+ s as useDynamicContentStore
23
+ };
@@ -1,14 +1,4 @@
1
- export type EmailFormat = 'html' | 'AMP';
2
- export interface PreviewState {
3
- emailFormat: EmailFormat;
4
- ampHtml: string;
5
- ampErrors: string[];
6
- templateHtml: string;
7
- isLoading: boolean;
8
- isLoaded: boolean;
9
- isAMPErrorModalVisible: boolean;
10
- isPreviewModeOpen: boolean;
11
- }
1
+ import type { PreviewState, EmailFormat } from '@@/Types/preview';
12
2
  export declare const usePreviewStore: import("pinia").StoreDefinition<"preview", PreviewState, {
13
3
  isAMPModeEnabled: (state: {
14
4
  emailFormat: EmailFormat;
@@ -20,16 +10,7 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"preview",
20
10
  isAMPErrorModalVisible: boolean;
21
11
  isPreviewModeOpen: boolean;
22
12
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
23
- previewHtml: (state: {
24
- emailFormat: EmailFormat;
25
- ampHtml: string;
26
- ampErrors: string[];
27
- templateHtml: string;
28
- isLoading: boolean;
29
- isLoaded: boolean;
30
- isAMPErrorModalVisible: boolean;
31
- isPreviewModeOpen: boolean;
32
- } & import("pinia").PiniaCustomStateProperties<PreviewState>) => string;
13
+ previewHtml(): string;
33
14
  hasAMP: (state: {
34
15
  emailFormat: EmailFormat;
35
16
  ampHtml: string;
@@ -50,38 +31,14 @@ export declare const usePreviewStore: import("pinia").StoreDefinition<"preview",
50
31
  isAMPErrorModalVisible: boolean;
51
32
  isPreviewModeOpen: boolean;
52
33
  } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
53
- showAMPErrorButton: (state: {
54
- emailFormat: EmailFormat;
55
- ampHtml: string;
56
- ampErrors: string[];
57
- templateHtml: string;
58
- isLoading: boolean;
59
- isLoaded: boolean;
60
- isAMPErrorModalVisible: boolean;
61
- isPreviewModeOpen: boolean;
62
- } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
63
- isAMPResponsive: (state: {
64
- emailFormat: EmailFormat;
65
- ampHtml: string;
66
- ampErrors: string[];
67
- templateHtml: string;
68
- isLoading: boolean;
69
- isLoaded: boolean;
70
- isAMPErrorModalVisible: boolean;
71
- isPreviewModeOpen: boolean;
72
- } & import("pinia").PiniaCustomStateProperties<PreviewState>) => boolean;
34
+ showAMPErrorButton(): boolean;
35
+ isAMPResponsive(): boolean;
73
36
  }, {
74
37
  updateAMPData(ampData: {
75
38
  ampHtml?: string;
76
39
  ampErrors?: string[];
77
40
  }): void;
78
41
  setEmailFormat(format: EmailFormat): void;
79
- setTemplateHtml(html: string): void;
80
- setAmpHtml(html: string): void;
81
- setAmpErrors(errors: string[]): void;
82
- setLoading(loading: boolean): void;
83
- setLoaded(loaded: boolean): void;
84
- resetState(): void;
85
42
  closeErrorModal(): void;
86
43
  openErrorModal(): void;
87
44
  openPreviewMode(): void;
@@ -1,5 +1,5 @@
1
- import { defineStore as r } from "pinia";
2
- const t = () => ({
1
+ import { defineStore as t } from "pinia";
2
+ const s = () => ({
3
3
  emailFormat: "html",
4
4
  ampHtml: "",
5
5
  ampErrors: [],
@@ -8,15 +8,24 @@ const t = () => ({
8
8
  isLoaded: !1,
9
9
  isAMPErrorModalVisible: !1,
10
10
  isPreviewModeOpen: !1
11
- }), s = r("preview", {
12
- state: () => t(),
11
+ }), o = t("preview", {
12
+ state: () => s(),
13
13
  getters: {
14
14
  isAMPModeEnabled: (e) => e.emailFormat === "AMP",
15
- previewHtml: (e) => e.emailFormat === "AMP" ? e.ampHtml : e.templateHtml,
16
- hasAMP: (e) => !!e.ampHtml,
15
+ previewHtml() {
16
+ return this.isAMPModeEnabled ? this.ampHtml : this.templateHtml;
17
+ },
18
+ hasAMP: (e) => {
19
+ var r;
20
+ return !!((r = e.ampHtml) != null && r.trim());
21
+ },
17
22
  hasAMPErrors: (e) => e.ampErrors.length > 0,
18
- showAMPErrorButton: (e) => e.emailFormat === "AMP" && e.ampErrors.length > 0,
19
- isAMPResponsive: (e) => e.emailFormat === "AMP" && e.ampHtml.includes("@media") && e.ampHtml.includes(".adapt-img")
23
+ showAMPErrorButton() {
24
+ return this.isAMPModeEnabled && this.hasAMPErrors;
25
+ },
26
+ isAMPResponsive() {
27
+ return this.isAMPModeEnabled && this.ampHtml.includes("@media") && this.ampHtml.includes(".adapt-img");
28
+ }
20
29
  },
21
30
  actions: {
22
31
  updateAMPData(e) {
@@ -25,25 +34,6 @@ const t = () => ({
25
34
  setEmailFormat(e) {
26
35
  this.emailFormat = e;
27
36
  },
28
- setTemplateHtml(e) {
29
- this.templateHtml = e;
30
- },
31
- setAmpHtml(e) {
32
- this.ampHtml = e;
33
- },
34
- setAmpErrors(e) {
35
- this.ampErrors = e;
36
- },
37
- setLoading(e) {
38
- this.isLoading = e;
39
- },
40
- setLoaded(e) {
41
- this.isLoaded = e;
42
- },
43
- resetState() {
44
- const e = t();
45
- this.$patch(e);
46
- },
47
37
  closeErrorModal() {
48
38
  this.isAMPErrorModalVisible = !1;
49
39
  },
@@ -59,5 +49,5 @@ const t = () => ({
59
49
  }
60
50
  });
61
51
  export {
62
- s as usePreviewStore
52
+ o as usePreviewStore
63
53
  };
@@ -0,0 +1 @@
1
+ export declare const removeDuplicatesFromArray: <T>(arr?: T[]) => T[];
@@ -0,0 +1,10 @@
1
+ const s = (t = []) => {
2
+ const e = /* @__PURE__ */ new Set();
3
+ return t.filter((n) => {
4
+ const r = JSON.stringify(n);
5
+ return e.has(r) ? !1 : (e.add(r), !0);
6
+ });
7
+ };
8
+ export {
9
+ s as removeDuplicatesFromArray
10
+ };
@@ -0,0 +1,2 @@
1
+ import type { DynamicContent, MergeTag } from '@@/Types/generic';
2
+ export declare const dynamicContentToMergeTags: (dynamicContentList: DynamicContent[]) => MergeTag[];
@@ -0,0 +1,7 @@
1
+ const c = (l) => l.map((a) => ({
2
+ label: a.fallback ? `${a.text} | ${a.fallback}` : a.text,
3
+ value: a.fallback ? `{{${a.value}|${a.fallback}}}` : `{{${a.value}}}`
4
+ }));
5
+ export {
6
+ c as dynamicContentToMergeTags
7
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "1.0.0-beta.462f217",
3
+ "version": "1.0.0-beta.4694612",
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",