@useinsider/guido 3.9.0-beta.551c1df → 3.9.0-beta.7583926

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.
@@ -1,58 +1,77 @@
1
- import { useHttp as d } from "../composables/useHttp.js";
2
- import { useToaster as m } from "../composables/useToaster.js";
3
- import { MAX_DEFAULT_TEMPLATE_ID as y } from "../enums/defaults.js";
4
- import f from "../static/templates/empty/index.html.js";
5
- import g from "../static/templates/empty/style.css.js";
6
- const E = () => {
7
- const { get: s, post: c } = d(), { handleError: r } = m();
1
+ import { useHttp as y } from "../composables/useHttp.js";
2
+ import { useToaster as g } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as w, BLANK_TEMPLATE_HTML_URL as T, BLANK_TEMPLATE_CSS_URL as M } from "../enums/defaults.js";
4
+ const S = {
5
+ html: '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body><div class="es-wrapper"></div></body></html>',
6
+ css: ""
7
+ };
8
+ let o = null;
9
+ const A = () => {
10
+ const { get: s, post: i } = y(), { handleError: a } = g(), p = async () => {
11
+ try {
12
+ const { data: t } = await s("/stripo/get-user-token");
13
+ return t.body.token;
14
+ } catch (t) {
15
+ return a(t, "Failed to fetch token"), "";
16
+ }
17
+ }, m = async () => {
18
+ try {
19
+ const { data: t = [] } = await s("/stripo/get-partner-custom-fonts");
20
+ return t.map((e) => ({
21
+ ...e,
22
+ active: !0
23
+ }));
24
+ } catch (t) {
25
+ return a(t, "Failed to fetch custom fonts"), [];
26
+ }
27
+ }, f = async () => {
28
+ try {
29
+ const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
30
+ return t.status;
31
+ } catch (t) {
32
+ return a(t, "Failed to fetch sync modules status"), !1;
33
+ }
34
+ }, c = async () => {
35
+ if (o)
36
+ return o;
37
+ try {
38
+ const [t, e] = await Promise.all([
39
+ fetch(T).then((r) => {
40
+ if (!r.ok)
41
+ throw new Error(`Blank template HTML request failed: ${r.status}`);
42
+ return r.text();
43
+ }),
44
+ fetch(M).then((r) => {
45
+ if (!r.ok)
46
+ throw new Error(`Blank template CSS request failed: ${r.status}`);
47
+ return r.text();
48
+ })
49
+ ]);
50
+ return o = { html: t, css: e }, o;
51
+ } catch (t) {
52
+ return a(t, "Failed to fetch blank template"), S;
53
+ }
54
+ };
8
55
  return {
9
- getToken: async () => {
10
- try {
11
- const { data: t } = await s("/stripo/get-user-token");
12
- return t.body.token;
13
- } catch (t) {
14
- return r(t, "Failed to fetch token"), "";
15
- }
16
- },
17
- getCustomFonts: async () => {
18
- try {
19
- const { data: t = [] } = await s("/stripo/get-partner-custom-fonts");
20
- return t.map((e) => ({
21
- ...e,
22
- active: !0
23
- }));
24
- } catch (t) {
25
- return r(t, "Failed to fetch custom fonts"), [];
26
- }
27
- },
56
+ getToken: p,
57
+ getCustomFonts: m,
28
58
  getDefaultTemplate: async () => {
29
- const t = {
30
- html: f,
31
- css: g
32
- };
33
- try {
34
- const e = new URLSearchParams(window.location.search), u = e.get("default-template"), p = e.get("master"), a = u ? parseInt(u) : 0, i = a >= 1 && a <= y ? a : 0;
35
- if (!i && !p)
36
- return t;
37
- const l = `/stripo/default-template/${i}`, { data: n } = await s(l), o = typeof n == "string" ? JSON.parse(n) : n;
38
- return !o || typeof o != "object" || !("html" in o) || !("css" in o) ? t : o;
39
- } catch (e) {
40
- return r(e, "Failed to fetch default template"), t;
41
- }
42
- },
43
- getSyncModulesStatus: async () => {
44
59
  try {
45
- const { data: t } = await s("/newsletter/settings/synchronisation-in-modules-status");
46
- return t.status;
60
+ const t = new URLSearchParams(window.location.search), e = t.get("default-template"), r = t.get("master"), u = e ? parseInt(e) : 0, d = u >= 1 && u <= w ? u : 0;
61
+ if (!d && !r)
62
+ return await c();
63
+ const h = `/stripo/default-template/${d}`, { data: l } = await s(h), n = typeof l == "string" ? JSON.parse(l) : l;
64
+ return !n || typeof n != "object" || !("html" in n) || !("css" in n) ? await c() : n;
47
65
  } catch (t) {
48
- return r(t, "Failed to fetch sync modules status"), !1;
66
+ return a(t, "Failed to fetch default template"), c();
49
67
  }
50
68
  },
69
+ getSyncModulesStatus: f,
51
70
  updateSyncModule: async (t) => {
52
71
  try {
53
- return await c(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
72
+ return await i(`/stripo/stripo-modules/${t.moduleId}/update`), !0;
54
73
  } catch (e) {
55
- return r(e, "Failed to update sync module"), !1;
74
+ return a(e, "Failed to update sync module"), !1;
56
75
  }
57
76
  },
58
77
  getSyncModule: async (t) => {
@@ -60,7 +79,7 @@ const E = () => {
60
79
  const { data: e } = await s(`/stripo/stripo-modules/${t}/get`);
61
80
  return e;
62
81
  } catch (e) {
63
- return r(e, "Failed to get sync module"), {
82
+ return a(e, "Failed to get sync module"), {
64
83
  id: 0,
65
84
  stripoId: 0,
66
85
  unsubscriptionPreferencePages: []
@@ -71,13 +90,13 @@ const E = () => {
71
90
  if (t.length === 0)
72
91
  return !0;
73
92
  try {
74
- return await c("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
93
+ return await i("/stripo/stripo-modules/set-unsubscription-preference-pages", t), !0;
75
94
  } catch (e) {
76
- return r(e, "Failed to set unsubscription preference pages"), !1;
95
+ return a(e, "Failed to set unsubscription preference pages"), !1;
77
96
  }
78
97
  }
79
98
  };
80
99
  };
81
100
  export {
82
- E as useStripoApi
101
+ A as useStripoApi
83
102
  };
@@ -4,12 +4,11 @@ import { useToaster as C } from "../composables/useToaster.js";
4
4
  import { useTranslations as h } from "../composables/useTranslations.js";
5
5
  import { useLiquidValidator as S } from "../composables/validators/useLiquidValidator.js";
6
6
  import { EditorType as v } from "../enums/defaults.js";
7
- import { ToasterTypeOptions as N } from "../enums/toaster.js";
8
- import { useRecommendationExtensionStore as x } from "../extensions/Blocks/Recommendation/store/recommendation.js";
9
- import { useSaveAsTemplateStore as A } from "../stores/save-as-template.js";
7
+ import { useRecommendationExtensionStore as N } from "../extensions/Blocks/Recommendation/store/recommendation.js";
8
+ import { useSaveAsTemplateStore as x } from "../stores/save-as-template.js";
10
9
  import { base64EncodeWithSpecialChars as r } from "../utils/base64.js";
11
- import { useTemplatePreparation as E } from "../utils/templatePreparation.js";
12
- const j = () => {
10
+ import { useTemplatePreparation as A } from "../utils/templatePreparation.js";
11
+ const $ = () => {
13
12
  const { get: n, post: m } = b(), { handleError: o, showToaster: l } = C(), { config: c, isFeatureEnabled: p } = w(), { validateLiquidSyntax: g } = S(), u = h();
14
13
  return {
15
14
  getCategories: async () => {
@@ -40,7 +39,7 @@ const j = () => {
40
39
  createTemplate: async () => {
41
40
  var e, t, d, y;
42
41
  try {
43
- const { prepareTemplateDetails: i } = E(), s = A(), a = await i();
42
+ const { prepareTemplateDetails: i } = A(), s = x(), a = await i();
44
43
  if (p("liquidSyntax") && !await g(a.compiledHtml))
45
44
  return !1;
46
45
  const f = {
@@ -54,7 +53,7 @@ const j = () => {
54
53
  unsubscriptionPreferencePageStatus: !1,
55
54
  unsubscriptionPreferencePages: [],
56
55
  recommendationCampaignUrls: r(
57
- x().recommendationCampaignUrls
56
+ N().recommendationCampaignUrls
58
57
  ),
59
58
  recommendationConfigs: r({}),
60
59
  isGuido: !0,
@@ -75,7 +74,7 @@ const j = () => {
75
74
  "newsletter.template-library-save-alert",
76
75
  { templateName: s.getTemplateName }
77
76
  ),
78
- type: N.Alert
77
+ type: "alert"
79
78
  }), !1) : (l({
80
79
  message: u(
81
80
  "newsletter.template-library-save-success",
@@ -90,5 +89,5 @@ const j = () => {
90
89
  };
91
90
  };
92
91
  export {
93
- j as useTemplateLibraryApi
92
+ $ as useTemplateLibraryApi
94
93
  };
@@ -8,6 +8,9 @@ export declare const TemplateTypes: {
8
8
  };
9
9
  export declare const EditorType: number;
10
10
  export declare const MAX_DEFAULT_TEMPLATE_ID = 13;
11
+ export declare const EMAIL_STATIC_BASE_URL = "https://email-static.useinsider.com";
12
+ export declare const BLANK_TEMPLATE_HTML_URL = "https://email-static.useinsider.com/templates/campaign/default.html";
13
+ export declare const BLANK_TEMPLATE_CSS_URL = "https://email-static.useinsider.com/templates/campaign/default.css";
11
14
  export declare const ProductIds: Record<string, number>;
12
15
  export declare const ModuleFolderDefaults: {
13
16
  readonly SAVED_MODULES: "savedModules";
@@ -1,6 +1,6 @@
1
1
  export declare enum ToasterTypeOptions {
2
2
  Success = "success",
3
3
  Warning = "warning",
4
- Alert = "error",
5
- Info = "information"
4
+ Alert = "alert",
5
+ Dark = "dark"
6
6
  }
@@ -4,14 +4,15 @@ export declare const useToasterStore: import("pinia").StoreDefinition<"guidoToas
4
4
  status: boolean;
5
5
  type: import("@@/Types/toaster").ToasterType;
6
6
  text: string;
7
+ icon: string;
8
+ withIcon: boolean;
7
9
  withoutLeftMargin: boolean;
8
- autoHide: boolean;
9
10
  actionButton?: {
10
11
  text: string;
11
12
  onClick: () => void;
12
13
  } | undefined;
13
14
  } & import("pinia").PiniaCustomStateProperties<ToasterState>) => boolean;
14
15
  }, {
15
- showToaster(this: ToasterState, { type, message, actionButton, autoHide }: ToasterOptions): void;
16
+ showToaster(this: ToasterState, { type, message, actionButton }: ToasterOptions): void;
16
17
  hideToaster(this: ToasterState): void;
17
18
  }>;
@@ -0,0 +1,74 @@
1
+ const n = `ue-notifications-container {
2
+ left: 96px;
3
+ margin: 0;
4
+ bottom: 32px;
5
+ top: unset;
6
+ width: unset;
7
+ position: fixed;
8
+ }
9
+
10
+ ue-notifications-container ue-message + ue-message {
11
+ margin-bottom: 24px;
12
+ }
13
+
14
+ ue-notifications-container .alert-message-wrapper {
15
+ box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.07);
16
+ border: none;
17
+ padding: 16px 24px;
18
+ }
19
+
20
+ ue-notifications-container .alert-message-wrapper.info,
21
+ ue-notifications-container .alert-message-wrapper.loader {
22
+ background-color: var(--guido-color-background-toaster-info) !important;
23
+ color: inherit;
24
+ }
25
+
26
+ .alert-message-wrapper .alert-message-main {
27
+ align-items: center;
28
+ }
29
+
30
+ ue-notifications-container ue-caption .caption {
31
+ color: var(--guido-color-white) !important;
32
+ }
33
+
34
+ ue-block-thumb-hint {
35
+ text-align: left;
36
+ }
37
+
38
+ ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
39
+ width: calc(100% - 64px);
40
+ }
41
+
42
+ ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-text {
43
+ font-size: 15px;
44
+ font-weight: 600;
45
+ }
46
+
47
+ ue-notifications-container .alert-message-text,
48
+ ue-notifications-container .alert-message-wrapper ue-icon-component.icon,
49
+ ue-notifications-container .alert-message-wrapper ue-icon-component.icon-button {
50
+ color: var(--guido-color-white);
51
+ }
52
+
53
+ ue-notifications-container ue-message ue-button.close {
54
+ margin: 0 0 0 16px;
55
+ }
56
+
57
+ ue-notifications-container .alert-message-wrapper.success {
58
+ background: var(--guido-color-background-toaster-success);
59
+ color: inherit;
60
+ }
61
+
62
+ ue-notifications-container .alert-message-wrapper.error {
63
+ background: var(--guido-color-background-toaster-error);
64
+ color: inherit;
65
+ }
66
+
67
+ ue-notifications-container .alert-message-wrapper.warn {
68
+ background: var(--guido-color-background-toaster-warn);
69
+ color: inherit;
70
+ }
71
+ `;
72
+ export {
73
+ n as default
74
+ };
@@ -1,21 +1,21 @@
1
1
  import { ToasterTypeOptions as e } from "../enums/toaster.js";
2
- import { defineStore as a } from "pinia";
3
- const u = () => ({
2
+ import { defineStore as i } from "pinia";
3
+ const a = () => ({
4
4
  status: !1,
5
5
  type: e.Success,
6
6
  text: "",
7
+ icon: "",
8
+ withIcon: !0,
7
9
  withoutLeftMargin: !1,
8
- autoHide: !0,
9
10
  actionButton: void 0
10
- }), h = a("guidoToaster", {
11
- state: () => u(),
11
+ }), n = i("guidoToaster", {
12
+ state: () => a(),
12
13
  getters: {
13
- // A toast without auto-hide (e.g. Stripo `loader`) stays until hideToaster.
14
- shouldAutoHide: (t) => t.status && !!t.text && t.autoHide
14
+ shouldAutoHide: (t) => t.status && !!t.text
15
15
  },
16
16
  actions: {
17
- showToaster({ type: t = e.Success, message: s, actionButton: o, autoHide: i = !0 }) {
18
- this.status = !0, this.text = s, this.type = t, this.actionButton = o, this.autoHide = i;
17
+ showToaster({ type: t = e.Success, message: s, actionButton: o }) {
18
+ this.status = !0, this.text = s, this.type = t, this.actionButton = o;
19
19
  },
20
20
  hideToaster() {
21
21
  this.status = !1;
@@ -23,5 +23,5 @@ const u = () => ({
23
23
  }
24
24
  });
25
25
  export {
26
- h as useToasterStore
26
+ n as useToasterStore
27
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.9.0-beta.551c1df",
3
+ "version": "3.9.0-beta.7583926",
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",
@@ -37,7 +37,7 @@
37
37
  "license": "ISC",
38
38
  "dependencies": {
39
39
  "@stripoinc/ui-editor-extensions": "3.8.0",
40
- "@useinsider/design-system-vue": "1.3.0",
40
+ "@useinsider/design-system-vue": "1.1.0-beta.73ec2fa",
41
41
  "@vueuse/core": "11.3.0",
42
42
  "lodash-es": "4.17.21",
43
43
  "pinia": "2.3.1",
@@ -1,26 +0,0 @@
1
- import { useToaster as d } from "./useToaster.js";
2
- import { ToasterTypeOptions as c } from "../enums/toaster.js";
3
- const g = () => {
4
- const { showToaster: l, hideToaster: u } = d();
5
- let s = null;
6
- const n = (o, t, i, e, f = !0) => {
7
- s = i;
8
- const r = e != null && e.action ? { text: e.action.label, onClick: e.action.func } : void 0;
9
- l({ type: o, message: t, actionButton: r, autoHide: (e == null ? void 0 : e.autoClose) ?? f });
10
- };
11
- return { getStripoNotifications: () => ({
12
- info: (o, t, i) => n(c.Info, o, t, i),
13
- success: (o, t, i) => n(c.Success, o, t, i),
14
- warn: (o, t, i) => n(c.Warning, o, t, i),
15
- error: (o, t, i) => n(c.Alert, o, t, i),
16
- // A loader marks an in-progress operation; Stripo dismisses it via hide(id)
17
- // when finished, so it must not auto-hide.
18
- loader: (o, t, i) => n(c.Info, o, t, i, !1),
19
- hide: (o) => {
20
- s === o && (u(), s = null);
21
- }
22
- }) };
23
- };
24
- export {
25
- g as useStripoNotifications
26
- };
@@ -1,10 +0,0 @@
1
- import type { StripoNotifications } from '@@/Types/stripo';
2
- /**
3
- * Adapter that routes Stripo's in-editor notifications through Guido's own
4
- * InToasts-based toaster, so the editor only ever shows one toaster style.
5
- * Passed to `initEditor` as the `notifications` config (Stripo then delegates
6
- * rendering to us instead of drawing its native <ue-notifications-container>).
7
- */
8
- export declare const useStripoNotifications: () => {
9
- getStripoNotifications: () => StripoNotifications;
10
- };
@@ -1,74 +0,0 @@
1
- const t = `<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html>
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta content="width=device-width, initial-scale=1" name="viewport">
7
- <meta name="x-apple-disable-message-reformatting">
8
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
9
- <meta content="telephone=no" name="format-detection">
10
- <title></title>
11
- <!--[if (mso 16)]><style type="text/css">a{text-decoration:none}</style><![endif]-->
12
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
13
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
14
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
15
- <!--[if gte mso 9]><style>sup{font-size:100% !important}</style><![endif]-->
16
- <!--[if gte mso 9]><style>sup { font-size: 100% !important; }</style><![endif]-->
17
- </head>
18
-
19
- <body>
20
- <div class="es-wrapper-color">
21
- <!--[if gte mso 9]>
22
- <v:background xmlns:v="urn:schemas-microsoft-com:vml" fill="t">
23
- <v:fill type="tile" color="#f6f6f6"></v:fill>
24
- </v:background>
25
- <![endif]-->
26
- <table class="es-wrapper" width="100%" cellspacing="0" cellpadding="0">
27
- <tbody>
28
- <tr>
29
- <td class="esd-email-paddings" valign="top">
30
- <table class="es-content esd-footer-popover" cellspacing="0" cellpadding="0" align="center">
31
- <tbody>
32
- <tr>
33
- <td class="esd-stripe" align="center">
34
- <table class="es-content-body" width="600" cellspacing="0" cellpadding="0" bgcolor="#ffffff" align="center">
35
- <tbody>
36
- <tr>
37
- <td class="esd-structure es-p20" align="left">
38
- <table cellpadding="0" cellspacing="0" width="100%">
39
- <tbody>
40
- <tr>
41
- <td width="560" class="esd-container-frame" align="center" valign="top">
42
- <table cellpadding="0" cellspacing="0" width="100%">
43
- <tbody>
44
- <tr>
45
- <td align="center" class="esd-empty-container" style="display: none;"></td>
46
- </tr>
47
- </tbody>
48
- </table>
49
- </td>
50
- </tr>
51
- </tbody>
52
- </table>
53
- </td>
54
- </tr>
55
- </tbody>
56
- </table>
57
- </td>
58
- </tr>
59
- </tbody>
60
- </table>
61
- </td>
62
- </tr>
63
- </tbody>
64
- </table>
65
- </div>
66
- <div style="position: absolute; left: -9999px; top: -9999px; margin: 0px;"></div>
67
- <div style="position: absolute; left: -9999px; top: -9999px; margin: 0px; padding: 0px; border: 0px none; width: 1px;"></div>
68
- </body>
69
-
70
- </html>
71
- `;
72
- export {
73
- t as default
74
- };