@useinsider/guido 1.0.0-beta.a0d6eee → 1.0.0-beta.a3ed027

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 (59) hide show
  1. package/dist/@types/generic.d.ts +3 -14
  2. package/dist/components/Guido.vue.d.ts +3 -6
  3. package/dist/components/Guido.vue.js +8 -8
  4. package/dist/components/Guido.vue2.js +36 -48
  5. package/dist/components/organisms/design-preview/AmpErrorModal.vue.d.ts +16 -0
  6. package/dist/components/organisms/design-preview/AmpErrorModal.vue.js +21 -0
  7. package/dist/components/organisms/design-preview/AmpErrorModal.vue2.js +30 -0
  8. package/dist/components/organisms/design-preview/DesktopPreview.vue.d.ts +16 -0
  9. package/dist/components/organisms/design-preview/DesktopPreview.vue.js +22 -0
  10. package/dist/components/organisms/design-preview/DesktopPreview.vue2.js +43 -0
  11. package/dist/components/organisms/design-preview/EmailPreview.vue.d.ts +16 -0
  12. package/dist/components/organisms/design-preview/EmailPreview.vue.js +17 -0
  13. package/dist/components/organisms/design-preview/EmailPreview.vue2.js +33 -0
  14. package/dist/components/organisms/design-preview/EmailView.vue.d.ts +18 -0
  15. package/dist/components/organisms/design-preview/EmailView.vue.js +19 -0
  16. package/dist/components/organisms/design-preview/EmailView.vue2.js +24 -0
  17. package/dist/components/organisms/design-preview/InboxView.vue.d.ts +17 -0
  18. package/dist/components/organisms/design-preview/InboxView.vue.js +19 -0
  19. package/dist/components/organisms/design-preview/InboxView.vue2.js +23 -0
  20. package/dist/components/organisms/design-preview/MobilePreview.vue.d.ts +17 -0
  21. package/dist/components/organisms/design-preview/MobilePreview.vue.js +17 -0
  22. package/dist/components/organisms/design-preview/MobilePreview.vue2.js +23 -0
  23. package/dist/components/organisms/header/AmpToggle.vue.d.ts +2 -0
  24. package/dist/components/organisms/header/AmpToggle.vue.js +17 -0
  25. package/dist/components/organisms/header/AmpToggle.vue2.js +48 -0
  26. package/dist/components/organisms/header/MiddleSlot.vue.js +6 -6
  27. package/dist/components/organisms/header/MiddleSlot.vue2.js +20 -15
  28. package/dist/components/organisms/header/RightSlot.vue.js +7 -7
  29. package/dist/components/organisms/header/RightSlot.vue2.js +22 -24
  30. package/dist/components/organisms/header/ViewOptions.vue.js +6 -6
  31. package/dist/components/organisms/header/ViewOptions.vue2.js +10 -29
  32. package/dist/components/organisms/header/version-history/ViewOptions.vue.js +3 -3
  33. package/dist/components/organisms/header/version-history/ViewOptions.vue2.js +16 -34
  34. package/dist/composables/useActionsApi.d.ts +2 -0
  35. package/dist/composables/useActionsApi.js +47 -36
  36. package/dist/composables/useDebounce.d.ts +4 -0
  37. package/dist/composables/useDebounce.js +12 -0
  38. package/dist/composables/useMobileGmailFit.d.ts +5 -0
  39. package/dist/composables/useMobileGmailFit.js +69 -0
  40. package/dist/composables/useStripo.js +17 -23
  41. package/dist/enums/emailPreview.d.ts +3 -0
  42. package/dist/enums/emailPreview.js +6 -0
  43. package/dist/enums/gmailMobilePreview.d.ts +7 -0
  44. package/dist/enums/gmailMobilePreview.js +17 -0
  45. package/dist/extensions/DynamicContent/dynamic-content.js +15 -13
  46. package/dist/guido.css +1 -1
  47. package/dist/inbox-mockup.svg +39 -0
  48. package/dist/phone-mockup.svg +31 -0
  49. package/dist/stores/editor.d.ts +3 -0
  50. package/dist/stores/editor.js +6 -3
  51. package/package.json +1 -1
  52. package/dist/stores/dynamic-content.d.ts +0 -27
  53. package/dist/stores/dynamic-content.js +0 -23
  54. package/dist/utils/arrayUtil.d.ts +0 -1
  55. package/dist/utils/arrayUtil.js +0 -10
  56. package/dist/utils/genericUtil.d.ts +0 -2
  57. package/dist/utils/genericUtil.js +0 -7
  58. package/dist/utils/tooltipUtils.d.ts +0 -2
  59. package/dist/utils/tooltipUtils.js +0 -11
@@ -0,0 +1,17 @@
1
+ import t from "./AmpToggle.vue2.js";
2
+ import s from "../../../_virtual/_plugin-vue2_normalizer.js";
3
+ var a = function() {
4
+ var e = this, o = e._self._c, r = e._self._setupProxy;
5
+ return r.editorStore.isPreviewModeOpen ? o("div", [o("div", { staticClass: "d-f a-i-c ml-3" }, [o(r.InSegments, { attrs: { id: "guido__amp-toggle", "segment-list": r.segmentList, selected: r.editorStore.emailFormat }, on: { click: r.handleFormatChange } }), r.showErrorButton ? o(r.InButtonV2, { staticClass: "ml-2 d-f a-i-c b-c-11 b-c-h-11 t-c-4 t-c-h-4 i-c-4 bor-w-1 bor-s-s bor-c-11 bor-r-2", attrs: { id: "guido__amp-error-button", "left-icon": "line-error-box", type: "danger", "label-text-status": !1 }, on: { click: r.handleErrorClick } }) : e._e()], 1), r.showErrorModal ? o(r.AmpErrorModal, { attrs: { errors: r.editorStore.ampErrors || [] }, on: { close: r.closeErrorModal } }) : e._e()], 1) : e._e();
6
+ }, n = [], l = /* @__PURE__ */ s(
7
+ t,
8
+ a,
9
+ n,
10
+ !1,
11
+ null,
12
+ null
13
+ );
14
+ const d = l.exports;
15
+ export {
16
+ d as default
17
+ };
@@ -0,0 +1,48 @@
1
+ import { defineComponent as h, ref as v, computed as a, watch as E } from "vue";
2
+ import { useActionsApi as g } from "../../../composables/useActionsApi.js";
3
+ import { useToaster as w } from "../../../composables/useToaster.js";
4
+ import { useTranslations as M } from "../../../composables/useTranslations.js";
5
+ import A from "../design-preview/AmpErrorModal.vue.js";
6
+ import { useEditorStore as _ } from "../../../stores/editor.js";
7
+ import { InButtonV2 as P, InSegments as y } from "@useinsider/design-system-vue";
8
+ const D = /* @__PURE__ */ h({
9
+ __name: "AmpToggle",
10
+ setup(F) {
11
+ const t = _(), { getPreviewData: s } = g(), { showToaster: l } = w(), e = M(), r = v(!1), m = a(() => !!t.ampHtml), n = a(() => !!(t.ampErrors && t.ampErrors.length > 0)), p = a(() => [
12
+ { text: e("dynamic-creatives.html"), value: "html" },
13
+ {
14
+ text: e("email.amp-html"),
15
+ value: "amp",
16
+ tooltipText: m.value ? "" : e("email.preview-amp-unavailable-tooltip"),
17
+ position: "bottom",
18
+ align: "center",
19
+ disable: !m.value
20
+ }
21
+ ]), i = async () => {
22
+ try {
23
+ const o = await s();
24
+ t.ampHtml = o.ampHtml ?? null, t.ampErrors = o.ampErrors ?? null, t.emailFormat = o.ampHtml ? "amp" : "html";
25
+ } catch {
26
+ l({
27
+ type: "error",
28
+ message: "Failed to load AMP data. Please try again later."
29
+ });
30
+ }
31
+ };
32
+ E([() => t.editorVisualMode, () => t.isPreviewModeOpen], () => {
33
+ t.isPreviewModeOpen && i();
34
+ }, { immediate: !0 });
35
+ const c = (o) => {
36
+ t.emailFormat = o;
37
+ }, u = () => {
38
+ r.value = !0;
39
+ }, d = a(() => t.emailFormat === "amp" && n.value);
40
+ function f() {
41
+ r.value = !1;
42
+ }
43
+ return { __sfc: !0, editorStore: t, getPreviewData: s, showToaster: l, trans: e, showErrorModal: r, hasAMP: m, hasAMPErrors: n, segmentList: p, updateAmpData: i, handleFormatChange: c, handleErrorClick: u, showErrorButton: d, closeErrorModal: f, AmpErrorModal: A, InSegments: y, InButtonV2: P };
44
+ }
45
+ });
46
+ export {
47
+ D as default
48
+ };
@@ -1,10 +1,10 @@
1
- import i from "./MiddleSlot.vue2.js";
2
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
1
+ import s from "./MiddleSlot.vue2.js";
2
+ import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var n = function() {
4
- var e = this, o = e._self._c, t = e._self._setupProxy;
5
- return t.editorStore.isVersionHistoryOpen ? o("div", { staticClass: "d-f" }, [o(t.VersionHistory), o(t.VersionHistoryViewOptions)], 1) : o("div", { staticClass: "d-f" }, [o(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__undo-button"), "tooltip-text": t.trans("action-builder.undo") } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__redo-button"), "tooltip-text": t.trans("action-builder.redo") } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button"), "tooltip-text": t.codeEditorTooltipText } }), o(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isPreviewModeOpen, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.previewTooltipText }, on: { click: t.handlePreview } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
6
- }, l = [], r = /* @__PURE__ */ s(
7
- i,
4
+ var o = this, e = o._self._c, t = o._self._setupProxy;
5
+ return t.editorStore.isVersionHistoryOpen ? e("div", { staticClass: "d-f" }, [e(t.VersionHistory), e(t.VersionHistoryViewOptions)], 1) : e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__undo-button", "left-icon": "line-undo", styling: "ghost", type: "secondary", "disabled-status": t.isPreviewModeOpen, "label-text-status": !1 } }), e(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "disabled-status": t.isPreviewModeOpen, "label-text-status": !1 } }), e(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", "tooltip-text": "Code Editor", type: "secondary", "disabled-status": t.isPreviewModeOpen, "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button") } }), e(t.InButtonV2, { attrs: { id: "guido__preview-button", "left-icon": "line-show-on", styling: "ghost", type: "secondary", "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__preview-button"), "tooltip-text": t.isPreviewModeOpen ? t.trans("newsletter.close-email-preview") : t.trans("newsletter.email-preview") }, on: { click: t.handlePreviewClick } }), e(t.ViewOptions, { staticClass: "ml-3" }), e(t.AmpToggle)], 1);
6
+ }, l = [], r = /* @__PURE__ */ i(
7
+ s,
8
8
  n,
9
9
  l,
10
10
  !1,
@@ -1,20 +1,25 @@
1
- import { defineComponent as s, computed as t } from "vue";
2
- import { useTranslations as n } from "../../../composables/useTranslations.js";
3
- import { useEditorStore as p } from "../../../stores/editor.js";
4
- import { getTooltipOptions as m } from "../../../utils/tooltipUtils.js";
5
- import { InButtonV2 as l } from "@useinsider/design-system-vue";
6
- import d from "./version-history/VersionHistory.vue.js";
7
- import w from "./version-history/ViewOptions.vue.js";
8
- import c from "./ViewOptions.vue.js";
9
- const M = /* @__PURE__ */ s({
1
+ import { defineComponent as s, computed as n } from "vue";
2
+ import { useTranslations as p } from "../../../composables/useTranslations.js";
3
+ import { useEditorStore as m } from "../../../stores/editor.js";
4
+ import { InButtonV2 as c } from "@useinsider/design-system-vue";
5
+ import d from "./AmpToggle.vue.js";
6
+ import f from "./version-history/VersionHistory.vue.js";
7
+ import a from "./version-history/ViewOptions.vue.js";
8
+ import l from "./ViewOptions.vue.js";
9
+ const T = /* @__PURE__ */ s({
10
10
  __name: "MiddleSlot",
11
- setup(f) {
12
- const e = p(), o = n(), r = t(() => e.isCodeEditorOpen ? o("newsletter.close-html-editor") : o("newsletter.html-editor")), i = t(() => e.isPreviewModeOpen ? o("newsletter.close-email-preview") : o("newsletter.email-preview"));
13
- return { __sfc: !0, editorStore: e, trans: o, codeEditorTooltipText: r, previewTooltipText: i, handlePreview: () => {
14
- e.isPreviewModeOpen = !e.isPreviewModeOpen;
15
- }, getTooltipOptions: m, InButtonV2: l, VersionHistory: d, VersionHistoryViewOptions: w, ViewOptions: c };
11
+ setup(u) {
12
+ const o = m(), t = p(), e = () => {
13
+ o.isPreviewModeOpen = !o.isPreviewModeOpen;
14
+ }, i = n(() => o.isPreviewModeOpen);
15
+ return { __sfc: !0, editorStore: o, trans: t, handlePreviewClick: e, isPreviewModeOpen: i, getTooltipOptions: (r) => ({
16
+ id: `${r}-tooltip`,
17
+ dynamicPosition: !1,
18
+ staticPosition: "bottom center",
19
+ iconStatus: !1
20
+ }), InButtonV2: c, AmpToggle: d, VersionHistory: f, VersionHistoryViewOptions: a, ViewOptions: l };
16
21
  }
17
22
  });
18
23
  export {
19
- M as default
24
+ T as default
20
25
  };
@@ -1,17 +1,17 @@
1
- import s from "./RightSlot.vue2.js";
1
+ import o from "./RightSlot.vue2.js";
2
2
  import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var n = function() {
4
- var o = this, e = o._self._c, t = o._self._setupProxy;
5
- return e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen, "tooltip-options": t.getTooltipOptions("guido__history-button"), "tooltip-text": t.versionHistoryTooltipText }, on: { click: t.handleVersionHistory } }), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__export-button"), "tooltip-text": t.trans("newsletter.export") }, on: { click: t.exportHtml } }), e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__save-as-button"), "tooltip-text": t.trans("newsletter.save-templates") } }), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1, "tooltip-options": t.getTooltipOptions("guido__test-button"), "tooltip-text": t.trans("newsletter.test-email") } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen }, on: { click: t.handleSave } })], 1);
6
- }, r = [], l = /* @__PURE__ */ i(
7
- s,
4
+ var s = this, e = s._self._c, t = s._self._setupProxy;
5
+ return e("div", { staticClass: "d-f" }, [e(t.InButtonV2, { attrs: { id: "guido__history-button", "left-icon": "line-architect-version-history", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isPreviewModeOpen, "label-text-status": !1, "selected-status": t.editorStore.isVersionHistoryOpen }, on: { click: t.handleVersionHistory } }), e(t.InButtonV2, { attrs: { id: "guido__export-button", "left-icon": "line-export", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 }, on: { click: t.exportHtml } }), e(t.InButtonV2, { attrs: { id: "guido__save-as-button", "left-icon": "line-newsletter-save-as-template", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 } }), e(t.InButtonV2, { attrs: { id: "guido__test-button", "left-icon": "line-architect-test-journey", styling: "ghost", type: "secondary", "disabled-status": t.editorStore.isVersionHistoryOpen, "label-text-status": !1 } }), e(t.InButtonV2, { staticClass: "ml-3", attrs: { id: "guido__save-button", "label-text": "Save", "disabled-status": t.editorStore.isVersionHistoryOpen || t.editorStore.isPreviewModeOpen }, on: { click: t.handleSave } })], 1);
6
+ }, r = [], a = /* @__PURE__ */ i(
7
+ o,
8
8
  n,
9
9
  r,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const u = l.exports;
14
+ const c = a.exports;
15
15
  export {
16
- u as default
16
+ c as default
17
17
  };
@@ -1,37 +1,35 @@
1
- import { defineComponent as l, computed as f } from "vue";
2
- import { useActionsApi as u } from "../../../composables/useActionsApi.js";
3
- import { useExport as d } from "../../../composables/useExport.js";
4
- import { useSaveStart as y, useSaveComplete as v } from "../../../composables/useGuidoActions.js";
5
- import { useTranslations as h } from "../../../composables/useTranslations.js";
6
- import { useVersionHistoryApi as S } from "../../../composables/useVersionHistoryApi.js";
7
- import { useEditorStore as H } from "../../../stores/editor.js";
8
- import { getTooltipOptions as _ } from "../../../utils/tooltipUtils.js";
9
- import { InButtonV2 as V } from "@useinsider/design-system-vue";
10
- const R = /* @__PURE__ */ l({
1
+ import { defineComponent as m } from "vue";
2
+ import { useActionsApi as p } from "../../../composables/useActionsApi.js";
3
+ import { useExport as c } from "../../../composables/useExport.js";
4
+ import { useSaveStart as l, useSaveComplete as f } from "../../../composables/useGuidoActions.js";
5
+ import { useVersionHistoryApi as u } from "../../../composables/useVersionHistoryApi.js";
6
+ import { useEditorStore as d } from "../../../stores/editor.js";
7
+ import { InButtonV2 as S } from "@useinsider/design-system-vue";
8
+ const E = /* @__PURE__ */ m({
11
9
  __name: "RightSlot",
12
- setup(g) {
13
- const { exportHtml: p } = d(), { getCompiledEmail: r } = u(), s = y(), i = v(), { openVersionHistory: n, closeVersionHistory: m } = S(), o = H(), t = h(), a = () => {
14
- if (o.isVersionHistoryOpen) {
15
- m();
10
+ setup(h) {
11
+ const { exportHtml: a } = c(), { getCompiledEmail: t } = p(), e = l(), r = f(), { openVersionHistory: s, closeVersionHistory: n } = u(), i = d();
12
+ return { __sfc: !0, exportHtml: a, getCompiledEmail: t, saveStart: e, saveComplete: r, openVersionHistory: s, closeVersionHistory: n, editorStore: i, handleVersionHistory: () => {
13
+ if (i.isVersionHistoryOpen) {
14
+ n();
16
15
  return;
17
16
  }
18
- n();
19
- }, c = f(() => o.isVersionHistoryOpen ? t("newsletter.close-version-history") : t("newsletter.version-history"));
20
- return { __sfc: !0, exportHtml: p, getCompiledEmail: r, saveStart: s, saveComplete: i, openVersionHistory: n, closeVersionHistory: m, editorStore: o, trans: t, handleVersionHistory: a, versionHistoryTooltipText: c, handleSave: async () => {
21
17
  s();
18
+ }, handleSave: async () => {
19
+ e();
22
20
  try {
23
- const { html: e } = await r();
24
- i({
25
- html: e || "",
21
+ const { html: o } = await t();
22
+ r({
23
+ html: o || "",
26
24
  css: ""
27
25
  // CSS is embedded in HTML from Stripo
28
26
  });
29
- } catch (e) {
30
- console.error("Failed to get template data for save:", e);
27
+ } catch (o) {
28
+ console.error("Failed to get template data for save:", o);
31
29
  }
32
- }, getTooltipOptions: _, InButtonV2: V };
30
+ }, InButtonV2: S };
33
31
  }
34
32
  });
35
33
  export {
36
- R as default
34
+ E as default
37
35
  };
@@ -1,16 +1,16 @@
1
1
  import r from "./ViewOptions.vue2.js";
2
2
  /* empty css */
3
- import s from "../../../_virtual/_plugin-vue2_normalizer.js";
4
- var n = function() {
3
+ import i from "../../../_virtual/_plugin-vue2_normalizer.js";
4
+ var s = function() {
5
5
  var t = this, o = t._self._c, e = t._self._setupProxy;
6
- return o(e.InSegments, { attrs: { id: "guido__view-option-selection", "with-icon": "", "segment-list": e.segmentList, selected: e.editorStore.editorVisualMode } });
7
- }, i = [], _ = /* @__PURE__ */ s(
6
+ return o(e.InSegments, { attrs: { id: "guido__view-option-selection", "with-icon": "", disable: e.editorStore.isPreviewModeOpen, "segment-list": e.segmentList, selected: e.editorStore.editorVisualMode } });
7
+ }, n = [], _ = /* @__PURE__ */ i(
8
8
  r,
9
+ s,
9
10
  n,
10
- i,
11
11
  !1,
12
12
  null,
13
- "93dadc5a"
13
+ "f90d31ea"
14
14
  );
15
15
  const l = _.exports;
16
16
  export {
@@ -1,34 +1,15 @@
1
- import { defineComponent as n } from "vue";
2
- import { useTranslations as p } from "../../../composables/useTranslations.js";
3
- import { useEditorStore as s } from "../../../stores/editor.js";
4
- import { getTooltipOptions as o } from "../../../utils/tooltipUtils.js";
5
- import { InSegments as r } from "@useinsider/design-system-vue";
6
- const d = /* @__PURE__ */ n({
1
+ import { defineComponent as e } from "vue";
2
+ import { useEditorStore as t } from "../../../stores/editor.js";
3
+ import { InSegments as o } from "@useinsider/design-system-vue";
4
+ const u = /* @__PURE__ */ e({
7
5
  __name: "ViewOptions",
8
- setup(m) {
9
- const e = s(), t = p(), i = [
10
- {
11
- text: "",
12
- icon: "line-desktop",
13
- value: "desktop",
14
- position: "bottom",
15
- align: "center",
16
- tooltipText: t("newsletter.desktop"),
17
- tooltipOptions: o("guido__view-option-desktop")
18
- },
19
- {
20
- text: "",
21
- icon: "line-menu-mobileapp",
22
- value: "mobile",
23
- position: "bottom",
24
- align: "center",
25
- tooltipText: t("newsletter.mobile"),
26
- tooltipOptions: o("guido__view-option-mobile")
27
- }
28
- ];
29
- return { __sfc: !0, editorStore: e, trans: t, segmentList: i, InSegments: r };
6
+ setup(n) {
7
+ return { __sfc: !0, editorStore: t(), segmentList: [
8
+ { text: "", icon: "line-desktop", value: "desktop" },
9
+ { text: "", icon: "line-menu-mobileapp", value: "mobile" }
10
+ ], InSegments: o };
30
11
  }
31
12
  });
32
13
  export {
33
- d as default
14
+ u as default
34
15
  };
@@ -10,9 +10,9 @@ var r = function() {
10
10
  n,
11
11
  !1,
12
12
  null,
13
- "421ffc13"
13
+ "6a2bde67"
14
14
  );
15
- const f = _.exports;
15
+ const d = _.exports;
16
16
  export {
17
- f as default
17
+ d as default
18
18
  };
@@ -1,41 +1,23 @@
1
- import { defineComponent as p } from "vue";
2
- import { useTranslations as m } from "../../../../composables/useTranslations.js";
3
- import { useVersionHistoryApi as l } from "../../../../composables/useVersionHistoryApi.js";
4
- import { useVersionHistoryStore as a } from "../../../../stores/version-history.js";
5
- import { getTooltipOptions as n } from "../../../../utils/tooltipUtils.js";
6
- import { InSegments as c } from "@useinsider/design-system-vue";
7
- const h = /* @__PURE__ */ p({
1
+ import { defineComponent as s } from "vue";
2
+ import { useVersionHistoryApi as n } from "../../../../composables/useVersionHistoryApi.js";
3
+ import { useVersionHistoryStore as r } from "../../../../stores/version-history.js";
4
+ import { InSegments as m } from "@useinsider/design-system-vue";
5
+ const d = /* @__PURE__ */ s({
8
6
  __name: "ViewOptions",
9
- setup(u) {
10
- const t = a(), { switchToDesktopPreview: e, switchToMobilePreview: i } = l(), o = m(), r = [
11
- {
12
- text: "",
13
- icon: "line-desktop",
14
- value: "desktop",
15
- position: "bottom",
16
- align: "center",
17
- tooltipText: o("newsletter.desktop"),
18
- tooltipOptions: n("guido__version-history-view-option-desktop")
19
- },
20
- {
21
- text: "",
22
- icon: "line-menu-mobileapp",
23
- value: "mobile",
24
- position: "bottom",
25
- align: "center",
26
- tooltipText: o("newsletter.mobile"),
27
- tooltipOptions: n("guido__version-history-view-option-mobile")
28
- }
29
- ];
30
- return { __sfc: !0, versionHistoryStore: t, switchToDesktopPreview: e, switchToMobilePreview: i, trans: o, segmentList: r, changeVisualMode: (s) => {
31
- if (t.editorVisualMode = s, s === "mobile") {
32
- i();
7
+ setup(p) {
8
+ const e = r(), { switchToDesktopPreview: o, switchToMobilePreview: t } = n();
9
+ return { __sfc: !0, versionHistoryStore: e, switchToDesktopPreview: o, switchToMobilePreview: t, segmentList: [
10
+ { text: "", icon: "line-desktop", value: "desktop" },
11
+ { text: "", icon: "line-menu-mobileapp", value: "mobile" }
12
+ ], changeVisualMode: (i) => {
13
+ if (e.editorVisualMode = i, i === "mobile") {
14
+ t();
33
15
  return;
34
16
  }
35
- e();
36
- }, InSegments: c };
17
+ o();
18
+ }, InSegments: m };
37
19
  }
38
20
  });
39
21
  export {
40
- h as default
22
+ d as default
41
23
  };
@@ -1,5 +1,7 @@
1
+ import type { CompileEmailOptions } from '@@/Types/stripo';
1
2
  import { GetCompiledEmailOptions, CompiledEmailResult } from '@@/Types/actions-api';
2
3
  export declare const useActionsApi: () => {
3
4
  getCompiledEmail: (options?: GetCompiledEmailOptions) => Promise<CompiledEmailResult>;
4
5
  activateCustomViewStyles: (isActive?: boolean) => void;
6
+ getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
5
7
  };
@@ -1,38 +1,49 @@
1
- const g = () => ({ getCompiledEmail: (t = {}) => new Promise((i, a) => {
2
- const s = { ...{
3
- minimize: !0,
4
- utmEntity: {
5
- utmSource: "",
6
- utmMedium: "",
7
- utmCampaign: "",
8
- utmContent: "",
9
- utmTerm: "",
10
- customUtms: [
11
- {
12
- name1: "val1",
13
- name2: "val2"
14
- }
15
- ]
16
- },
17
- mergeTags: ["Tag1", "Tag2"],
18
- forseAmp: !1,
19
- resetDataSavedFlag: !1,
20
- disableLineHeightsReplace: !0
21
- }, ...t }, o = {
22
- callback: (e, m, l, n, c) => {
23
- e ? a(e) : i({
24
- html: m,
25
- ampHtml: l,
26
- ampErrors: n,
27
- displayConditions: c
28
- });
29
- },
30
- ...s
31
- };
32
- window.StripoEditorApi.actionsApi.compileEmail(o);
33
- }), activateCustomViewStyles: (t = !0) => {
34
- window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
35
- } });
1
+ const w = () => {
2
+ const a = (e = {}) => new Promise((t, s) => {
3
+ const m = { ...{
4
+ minimize: !0,
5
+ utmEntity: {
6
+ utmSource: "",
7
+ utmMedium: "",
8
+ utmCampaign: "",
9
+ utmContent: "",
10
+ utmTerm: "",
11
+ customUtms: [
12
+ {
13
+ name1: "val1",
14
+ name2: "val2"
15
+ }
16
+ ]
17
+ },
18
+ mergeTags: ["Tag1", "Tag2"],
19
+ forseAmp: !1,
20
+ resetDataSavedFlag: !1,
21
+ disableLineHeightsReplace: !0
22
+ }, ...e }, o = {
23
+ callback: (i, n, l, r, c) => {
24
+ i ? s(i) : t({
25
+ html: n,
26
+ ampHtml: l,
27
+ ampErrors: r,
28
+ displayConditions: c
29
+ });
30
+ },
31
+ ...m
32
+ };
33
+ window.StripoEditorApi.actionsApi.compileEmail(o);
34
+ });
35
+ return { getCompiledEmail: a, activateCustomViewStyles: (e = !0) => {
36
+ window.StripoEditorApi.actionsApi.activateCustomViewStyles(e);
37
+ }, getPreviewData: async (e) => {
38
+ const t = await a({ minimize: !1, resetDataSavedFlag: !1, ...e });
39
+ return {
40
+ html: t.html,
41
+ ampHtml: t.ampHtml ?? "",
42
+ ampErrors: t.ampErrors ?? null,
43
+ displayConditions: t.displayConditions
44
+ };
45
+ } };
46
+ };
36
47
  export {
37
- g as useActionsApi
48
+ w as useActionsApi
38
49
  };
@@ -0,0 +1,4 @@
1
+ export declare const useDebounce: () => {
2
+ debounce: (fn: () => void, ms?: number) => void;
3
+ clearDebounce: () => void;
4
+ };
@@ -0,0 +1,12 @@
1
+ import { ref as c } from "vue";
2
+ const r = () => {
3
+ const e = c(void 0);
4
+ return { debounce: (o, u = 150) => {
5
+ e.value && window.clearTimeout(e.value), e.value = window.setTimeout(o, u);
6
+ }, clearDebounce: () => {
7
+ e.value && (window.clearTimeout(e.value), e.value = void 0);
8
+ } };
9
+ };
10
+ export {
11
+ r as useDebounce
12
+ };
@@ -0,0 +1,5 @@
1
+ export declare const useMobileGmailFit: () => {
2
+ setupMobileGmailFit: (iframe: HTMLIFrameElement) => void;
3
+ tearDownMobileGmailFit: (iframe: HTMLIFrameElement) => void;
4
+ hasResponsiveMetaViewport: (doc: Document) => boolean;
5
+ };
@@ -0,0 +1,69 @@
1
+ import { useDebounce as p } from "./useDebounce.js";
2
+ import { META_VIEWPORT_REGEX as h, INLINE_WIDTH_REGEX as w, EMAIL_CONTAINER_SELECTORS as f, DEFAULT_EMAIL_WIDTH as b, MIN_SCALE as v, TABLE_WIDTH_REGEX as A, RESIZE_DEBOUNCE_MS as u } from "../enums/gmailMobilePreview.js";
3
+ let a = null, c = null;
4
+ const { debounce: y } = p(), M = (t) => {
5
+ if (!t)
6
+ return null;
7
+ const e = t.match(A);
8
+ if (!e)
9
+ return null;
10
+ const r = Number(e[1]);
11
+ return Number.isNaN(r) ? null : r;
12
+ }, g = (t) => {
13
+ const e = Array.from(t.querySelectorAll("table[width]")).reduce(
14
+ (n, i) => {
15
+ const o = M(i.getAttribute("width"));
16
+ return o && o > n ? o : n;
17
+ },
18
+ 0
19
+ ), r = Array.from(t.querySelectorAll('[style*="width"]')).reduce(
20
+ (n, i) => {
21
+ const l = (i.getAttribute("style") || "").match(w);
22
+ if (!l)
23
+ return n;
24
+ const m = Number(l[1]);
25
+ return !Number.isNaN(m) && m > n ? m : n;
26
+ },
27
+ 0
28
+ ), s = f.reduce((n, i) => {
29
+ const o = t.querySelector(i);
30
+ if (!o)
31
+ return n;
32
+ const l = Math.max(o.offsetWidth, o.scrollWidth);
33
+ return l > n ? l : n;
34
+ }, 0);
35
+ return Math.max(e, r, s) || b;
36
+ }, N = (t) => {
37
+ t.documentElement.style.setProperty("overflow-x", "visible", "important"), t.body.style.setProperty("visibility", "visible", "important");
38
+ }, S = (t) => {
39
+ t.documentElement.style.removeProperty("transform"), t.documentElement.style.removeProperty("transform-origin"), t.documentElement.style.removeProperty("height"), t.body.style.removeProperty("overflow-x");
40
+ }, d = (t) => {
41
+ const e = t.querySelector('meta[name="viewport"]');
42
+ if (!e)
43
+ return !1;
44
+ const r = e.getAttribute("content") || "";
45
+ return h.test(r);
46
+ }, W = (t, e) => {
47
+ const r = g(t), s = e / r, n = Math.min(Math.max(s, v), 1);
48
+ t.documentElement.style.setProperty("height", "100%", "important"), t.documentElement.style.setProperty("transform", `scale(${n})`, "important"), t.documentElement.style.setProperty("transform-origin", "top left", "important"), t.body.style.setProperty("overflow-x", "hidden", "important");
49
+ }, E = (t) => {
50
+ const e = t.contentWindow;
51
+ c && e && e.removeEventListener("resize", c), a && window.removeEventListener("resize", a), c = null, a = null;
52
+ }, P = () => ({ setupMobileGmailFit: (e) => {
53
+ const r = e.contentDocument, s = e.contentWindow;
54
+ if (!r || !s)
55
+ return;
56
+ N(r);
57
+ const n = () => {
58
+ const i = e.clientWidth || e.getBoundingClientRect().width || 375;
59
+ if (d(r)) {
60
+ S(r);
61
+ return;
62
+ }
63
+ W(r, i);
64
+ };
65
+ n(), E(e), c = () => y(n, u), s.addEventListener("resize", c), a = () => y(n, u), window.addEventListener("resize", a);
66
+ }, tearDownMobileGmailFit: E, hasResponsiveMetaViewport: d });
67
+ export {
68
+ P as useMobileGmailFit
69
+ };