@useinsider/guido 1.0.0-beta.5f67111 → 1.0.0-beta.614e7ff

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 (72) hide show
  1. package/dist/@types/generic.d.ts +4 -4
  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 +38 -54
  5. package/dist/components/organisms/{save-template/SaveTemplateModal.vue.d.ts → design-preview/AmpErrorModal.vue.d.ts} +1 -1
  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 +24 -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 +4 -4
  27. package/dist/components/organisms/header/MiddleSlot.vue2.js +17 -14
  28. package/dist/components/organisms/header/RightSlot.vue.js +5 -5
  29. package/dist/components/organisms/header/RightSlot.vue2.js +17 -19
  30. package/dist/components/organisms/header/ViewOptions.vue.js +6 -6
  31. package/dist/composables/useActionsApi.d.ts +3 -2
  32. package/dist/composables/useActionsApi.js +44 -43
  33. package/dist/composables/useDebounce.d.ts +4 -0
  34. package/dist/composables/useDebounce.js +12 -0
  35. package/dist/composables/useHttp.js +21 -23
  36. package/dist/composables/useMobileGmailFit.d.ts +5 -0
  37. package/dist/composables/useMobileGmailFit.js +69 -0
  38. package/dist/composables/useStripo.js +17 -23
  39. package/dist/enums/emailPreview.d.ts +3 -0
  40. package/dist/enums/emailPreview.js +4 -0
  41. package/dist/enums/gmailMobilePreview.d.ts +7 -0
  42. package/dist/enums/gmailMobilePreview.js +17 -0
  43. package/dist/extensions/DynamicContent/dynamic-content.js +15 -13
  44. package/dist/guido.css +1 -1
  45. package/dist/static/assets/inbox-mockup.svg.js +4 -0
  46. package/dist/static/assets/phone-mockup.svg.js +4 -0
  47. package/dist/stores/editor.d.ts +4 -1
  48. package/dist/stores/editor.js +6 -3
  49. package/package.json +3 -1
  50. package/dist/components/organisms/save-template/SaveTemplateModal.vue.js +0 -20
  51. package/dist/components/organisms/save-template/SaveTemplateModal.vue2.js +0 -78
  52. package/dist/components/wrappers/ModalWrapper.vue.d.ts +0 -72
  53. package/dist/components/wrappers/ModalWrapper.vue.js +0 -19
  54. package/dist/components/wrappers/ModalWrapper.vue2.js +0 -43
  55. package/dist/composables/useSaveAsTemplate.d.ts +0 -7
  56. package/dist/composables/useSaveAsTemplate.js +0 -51
  57. package/dist/composables/useTemplateNameValidation.d.ts +0 -7
  58. package/dist/composables/useTemplateNameValidation.js +0 -33
  59. package/dist/mock/api/template-library.d.ts +0 -2
  60. package/dist/stores/dynamic-content.d.ts +0 -27
  61. package/dist/stores/dynamic-content.js +0 -23
  62. package/dist/stores/template-categories.d.ts +0 -41
  63. package/dist/stores/template-categories.js +0 -91
  64. package/dist/utils/arrayUtil.d.ts +0 -1
  65. package/dist/utils/arrayUtil.js +0 -10
  66. package/dist/utils/base64.d.ts +0 -2
  67. package/dist/utils/base64.js +0 -14
  68. package/dist/utils/generic.d.ts +0 -1
  69. package/dist/utils/generic.js +0 -7
  70. package/dist/utils/genericUtil.d.ts +0 -2
  71. package/dist/utils/genericUtil.js +0 -7
  72. package/dist/utils/textUtil.d.ts +0 -2
@@ -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,8 +1,8 @@
1
1
  import s from "./MiddleSlot.vue2.js";
2
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 } }), o(t.InButtonV2, { attrs: { id: "guido__redo-button", "left-icon": "line-redo", styling: "ghost", type: "secondary", "label-text-status": !1 } }), o(t.InButtonV2, { attrs: { id: "guido__code-button", "data-testid": "Code Editor", "left-icon": "line-code", styling: "ghost", "tooltip-text": "Code Editor", type: "secondary", "label-text-status": !1, "selected-status": t.editorStore.isCodeEditorOpen, "tooltip-options": t.getTooltipOptions("guido__code-button") } }), o(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.trans("newsletter.email-preview") } }), o(t.ViewOptions, { staticClass: "ml-3" })], 1);
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
6
  }, l = [], r = /* @__PURE__ */ i(
7
7
  s,
8
8
  n,
@@ -11,7 +11,7 @@ var n = function() {
11
11
  null,
12
12
  null
13
13
  );
14
- const p = r.exports;
14
+ const u = r.exports;
15
15
  export {
16
- p as default
16
+ u as default
17
17
  };
@@ -1,22 +1,25 @@
1
- import { defineComponent as r } from "vue";
2
- import { useTranslations as s } from "../../../composables/useTranslations.js";
3
- import { useEditorStore as n } from "../../../stores/editor.js";
4
- import { InButtonV2 as e } from "@useinsider/design-system-vue";
5
- import m from "./version-history/VersionHistory.vue.js";
6
- import p from "./version-history/ViewOptions.vue.js";
7
- import f from "./ViewOptions.vue.js";
8
- const y = /* @__PURE__ */ r({
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({
9
10
  __name: "MiddleSlot",
10
- setup(a) {
11
- const o = n(), t = s();
12
- return { __sfc: !0, editorStore: o, trans: t, getTooltipOptions: (i) => ({
13
- id: `${i}-tooltip`,
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`,
14
17
  dynamicPosition: !1,
15
18
  staticPosition: "bottom center",
16
19
  iconStatus: !1
17
- }), InButtonV2: e, VersionHistory: m, VersionHistoryViewOptions: p, ViewOptions: f };
20
+ }), InButtonV2: c, AmpToggle: d, VersionHistory: f, VersionHistoryViewOptions: a, ViewOptions: l };
18
21
  }
19
22
  });
20
23
  export {
21
- y as default
24
+ T as default
22
25
  };
@@ -2,16 +2,16 @@ import o from "./RightSlot.vue2.js";
2
2
  import i from "../../../_virtual/_plugin-vue2_normalizer.js";
3
3
  var n = function() {
4
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", "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 }, on: { click: t.handleSaveAsTemplate } }), 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 }, on: { click: t.handleSave } })], 1);
6
- }, a = [], r = /* @__PURE__ */ i(
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
7
  o,
8
8
  n,
9
- a,
9
+ r,
10
10
  !1,
11
11
  null,
12
12
  null
13
13
  );
14
- const u = r.exports;
14
+ const c = a.exports;
15
15
  export {
16
- u as default
16
+ c as default
17
17
  };
@@ -1,37 +1,35 @@
1
1
  import { defineComponent as m } from "vue";
2
2
  import { useActionsApi as p } from "../../../composables/useActionsApi.js";
3
- import { useExport as l } from "../../../composables/useExport.js";
4
- import { useSaveStart as c, useSaveComplete as d } from "../../../composables/useGuidoActions.js";
5
- import { useVersionHistoryApi as f } from "../../../composables/useVersionHistoryApi.js";
6
- import { useEditorStore as u } from "../../../stores/editor.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
7
  import { InButtonV2 as S } from "@useinsider/design-system-vue";
8
- const T = /* @__PURE__ */ m({
8
+ const E = /* @__PURE__ */ m({
9
9
  __name: "RightSlot",
10
10
  setup(h) {
11
- const { exportHtml: i } = l(), { getCompiledEmail: o } = p(), r = c(), s = d(), { openVersionHistory: n, closeVersionHistory: a } = f(), e = u();
12
- return { __sfc: !0, exportHtml: i, getCompiledEmail: o, saveStart: r, saveComplete: s, openVersionHistory: n, closeVersionHistory: a, editorStore: e, handleVersionHistory: () => {
13
- if (e.isVersionHistoryOpen) {
14
- a();
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();
15
15
  return;
16
16
  }
17
- n();
18
- }, handleSaveAsTemplate: async () => {
19
- e.isSaveTemplateModalOpen = !0;
17
+ s();
20
18
  }, handleSave: async () => {
21
- r();
19
+ e();
22
20
  try {
23
- const { html: t } = await o();
24
- s({
25
- html: t || "",
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 (t) {
30
- console.error("Failed to get template data for save:", t);
27
+ } catch (o) {
28
+ console.error("Failed to get template data for save:", o);
31
29
  }
32
30
  }, InButtonV2: S };
33
31
  }
34
32
  });
35
33
  export {
36
- T 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
- "0fff376c"
13
+ "f90d31ea"
14
14
  );
15
15
  const l = _.exports;
16
16
  export {
@@ -1,6 +1,7 @@
1
- import { GetCompiledEmailOptions, CompiledEmailResult, TemplateDataResult } from '@@/Types/actions-api';
1
+ import type { CompileEmailOptions } from '@@/Types/stripo';
2
+ import { GetCompiledEmailOptions, CompiledEmailResult } from '@@/Types/actions-api';
2
3
  export declare const useActionsApi: () => {
3
4
  getCompiledEmail: (options?: GetCompiledEmailOptions) => Promise<CompiledEmailResult>;
4
- getRawTemplateData: () => Promise<TemplateDataResult>;
5
5
  activateCustomViewStyles: (isActive?: boolean) => void;
6
+ getPreviewData: (options?: CompileEmailOptions) => Promise<CompiledEmailResult>;
6
7
  };
@@ -1,48 +1,49 @@
1
- const g = () => ({
2
- getCompiledEmail: (t = {}) => new Promise((e, a) => {
3
- const o = {
4
- ...{ ...{
5
- minimize: !0,
6
- utmEntity: {
7
- utmSource: "",
8
- utmMedium: "",
9
- utmCampaign: "",
10
- utmContent: "",
11
- utmTerm: "",
12
- customUtms: [
13
- {
14
- name1: "val1",
15
- name2: "val2"
16
- }
17
- ]
18
- },
19
- mergeTags: ["Tag1", "Tag2"],
20
- forseAmp: !1,
21
- resetDataSavedFlag: !1,
22
- disableLineHeightsReplace: !0
23
- }, ...t },
24
- callback: (i, s, m, n, l) => {
25
- i ? a(i) : e({
26
- html: s,
27
- ampHtml: m,
28
- ampErrors: n,
29
- displayConditions: l
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
30
29
  });
31
- }
30
+ },
31
+ ...m
32
32
  };
33
33
  window.StripoEditorApi.actionsApi.compileEmail(o);
34
- }),
35
- getRawTemplateData: () => new Promise((t) => {
36
- window.StripoEditorApi.actionsApi.getTemplateData(
37
- (e) => {
38
- t(e);
39
- }
40
- );
41
- }),
42
- activateCustomViewStyles: (t = !0) => {
43
- window.StripoEditorApi.actionsApi.activateCustomViewStyles(t);
44
- }
45
- });
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
+ };
46
47
  export {
47
- g as useActionsApi
48
+ w as useActionsApi
48
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
+ };
@@ -1,20 +1,18 @@
1
- import { ref as p, computed as T } from "vue";
2
- import { getCsrfToken as H } from "../utils/generic.js";
3
- const k = (b = {}) => {
4
- const h = p(!1), a = p(null), u = p(null), g = T(() => h.value), y = T(() => a.value !== null), v = {
1
+ import { ref as p, computed as v } from "vue";
2
+ const j = (y = {}) => {
3
+ const h = p(!1), a = p(null), u = p(null), E = v(() => h.value), g = v(() => a.value !== null), T = {
5
4
  baseURL: "",
6
5
  timeout: 1e4,
7
6
  retry: 0,
8
7
  retryDelay: 1e3,
9
8
  headers: {
10
- "Content-Type": "application/json",
11
- "X-CSRF-TOKEN": H()
9
+ "Content-Type": "application/json"
12
10
  },
13
- ...b
11
+ ...y
14
12
  }, w = (e, s) => {
15
13
  if (e.startsWith("http://") || e.startsWith("https://"))
16
14
  return e;
17
- const t = s || v.baseURL || "";
15
+ const t = s || T.baseURL || "";
18
16
  return t.endsWith("/") && e.startsWith("/") ? `${t}${e.slice(1)}` : t.endsWith("/") || e.startsWith("/") ? `${t}${e}` : `${t}/${e}`;
19
17
  }, P = (e) => new Promise((s, t) => {
20
18
  setTimeout(() => {
@@ -24,20 +22,20 @@ const k = (b = {}) => {
24
22
  setTimeout(s, e);
25
23
  }), i = async (e, s, t, D = {}) => {
26
24
  a.value = null, h.value = !0, u.value = new AbortController();
27
- const n = { ...v, ...D }, L = w(s, n.baseURL), c = {
25
+ const n = { ...T, ...D }, L = w(s, n.baseURL), c = {
28
26
  method: e,
29
27
  headers: { ...n.headers },
30
28
  signal: u.value.signal,
31
29
  ...n
32
30
  };
33
31
  t && ["POST", "PUT", "PATCH"].includes(e) && (t instanceof FormData ? (delete c.headers["Content-Type"], c.body = t) : c.body = JSON.stringify(t));
34
- const E = async (m = 0) => {
32
+ const b = async (m = 0) => {
35
33
  try {
36
34
  const o = [fetch(L, c)];
37
35
  n.timeout && o.push(P(n.timeout));
38
36
  const r = await Promise.race(o);
39
37
  if (!r.ok) {
40
- const O = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(O);
38
+ const H = `HTTP Error: ${r.status} ${r.statusText}`, d = new Error(H);
41
39
  throw d.status = r.status, d.statusText = r.statusText, d.response = r, d;
42
40
  }
43
41
  let f;
@@ -51,36 +49,36 @@ const k = (b = {}) => {
51
49
  } catch (o) {
52
50
  const r = o instanceof Error && o.name === "AbortError";
53
51
  if (m < (n.retry || 0) && !r)
54
- return await x(n.retryDelay || 1e3), E(m + 1);
52
+ return await x(n.retryDelay || 1e3), b(m + 1);
55
53
  throw o instanceof Error ? o.name === "AbortError" ? a.value = { message: "Request was cancelled" } : a.value = { message: o.message } : a.value = o, o;
56
54
  }
57
55
  };
58
56
  try {
59
- return await E();
57
+ return await b();
60
58
  } finally {
61
59
  h.value = !1, u.value = null;
62
60
  }
63
- }, C = (e, s) => i("GET", e, void 0, s), $ = (e, s, t) => i("POST", e, s, t), R = (e, s, t) => i("PUT", e, s, t), U = (e, s, t) => i("PATCH", e, s, t), A = (e, s) => i("DELETE", e, void 0, s), W = (e) => {
61
+ }, $ = (e, s) => i("GET", e, void 0, s), C = (e, s, t) => i("POST", e, s, t), U = (e, s, t) => i("PUT", e, s, t), A = (e, s, t) => i("PATCH", e, s, t), R = (e, s) => i("DELETE", e, void 0, s), W = (e) => {
64
62
  u.value && u.value.abort(e);
65
63
  }, q = () => {
66
64
  a.value = null;
67
65
  };
68
66
  return {
69
67
  // State
70
- loading: g,
71
- error: T(() => a.value),
72
- hasError: y,
68
+ loading: E,
69
+ error: v(() => a.value),
70
+ hasError: g,
73
71
  // Methods
74
72
  request: i,
75
- get: C,
76
- post: $,
77
- put: R,
78
- patch: U,
79
- delete: A,
73
+ get: $,
74
+ post: C,
75
+ put: U,
76
+ patch: A,
77
+ delete: R,
80
78
  cancel: W,
81
79
  clearError: q
82
80
  };
83
81
  };
84
82
  export {
85
- k as useHttp
83
+ j as useHttp
86
84
  };
@@ -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
+ };
@@ -1,21 +1,20 @@
1
1
  import { useActionsApi as g } from "./useActionsApi.js";
2
2
  import { useCustomInterfaceAppearance as f } from "./useCustomInterfaceAppearance.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";
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";
7
7
  import { useEditorStore as w } from "../stores/editor.js";
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;
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;
12
11
  window.UIEditor.initEditor(
13
12
  document.querySelector("#guido-editor"),
14
13
  {
15
- metadata: d,
14
+ metadata: a,
16
15
  html: t,
17
16
  css: s,
18
- forceRecreate: p,
17
+ forceRecreate: m,
19
18
  locale: "en",
20
19
  undoButtonSelector: "#guido__undo-button",
21
20
  redoButtonSelector: "#guido__redo-button",
@@ -31,24 +30,19 @@ const M = (d) => {
31
30
  `,
32
31
  conditionsEnabled: !0,
33
32
  customConditionsEnabled: !0,
34
- conditionCategories: C,
33
+ conditionCategories: S,
35
34
  messageSettingsEnabled: !1,
36
35
  editorFonts: {
37
36
  showDefaultStandardFonts: !0,
38
37
  showDefaultNotStandardFonts: !0,
39
38
  customFonts: r
40
39
  },
41
- mergeTags: [
42
- {
43
- entries: b(d.preselectedDynamicContentList)
44
- }
45
- ],
46
40
  async onTokenRefreshRequest(o) {
47
41
  try {
48
- const n = await a();
42
+ const n = await c();
49
43
  o(n);
50
44
  } catch (n) {
51
- c(n, "Failed to refresh token");
45
+ d(n, "Failed to refresh token");
52
46
  }
53
47
  },
54
48
  onTemplateLoaded() {
@@ -56,7 +50,7 @@ const M = (d) => {
56
50
  const { importCss: o } = f(), { activateCustomViewStyles: n } = g();
57
51
  o(), n();
58
52
  } catch (o) {
59
- c(o, "Failed to load custom interface appearance");
53
+ d(o, "Failed to load custom interface appearance");
60
54
  }
61
55
  },
62
56
  onCodeEditorVisibilityChanged(o) {
@@ -69,10 +63,10 @@ const M = (d) => {
69
63
  i.isVersionHistoryOpen = o;
70
64
  },
71
65
  ignoreClickOutsideSelectors: ["#guido-dynamic-content-modal"],
72
- extensions: [E]
66
+ extensions: [y]
73
67
  }
74
68
  );
75
- }, m = (e) => new Promise((r, i) => {
69
+ }, p = (e) => new Promise((r, i) => {
76
70
  if (document.getElementById("UiEditorScript")) {
77
71
  e(), r();
78
72
  return;
@@ -86,12 +80,12 @@ const M = (d) => {
86
80
  }, document.body.appendChild(t);
87
81
  });
88
82
  return { initPlugin: async (e) => {
89
- await m(async () => {
83
+ await p(async () => {
90
84
  const r = await u();
91
85
  l(e, r);
92
86
  });
93
87
  } };
94
88
  };
95
89
  export {
96
- M as useStripo
90
+ A as useStripo
97
91
  };
@@ -0,0 +1,3 @@
1
+ export declare const MAX_EMAIL_WEIGHT = 102;
2
+ export declare const INBOX_PREVIEW_PATH = "./public/inbox-mockup.svg";
3
+ export declare const PHONE_PREVIEW_PATH = "./public/phone-mockup.svg";