@useinsider/guido 2.1.0-beta.3580d01 → 2.1.0-beta.3889d62

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.
@@ -4,22 +4,21 @@ import { useConfig as v } from "./useConfig.js";
4
4
  import { useCustomInterfaceAppearance as A } from "./useCustomInterfaceAppearance.js";
5
5
  import { useStripoEventHandler as F } from "./useStripoEventHandler.js";
6
6
  import { useToaster as D } from "./useToaster.js";
7
- import { localePatch as I } from "../config/localePatch/index.js";
8
- import { displayConditions as M } from "../enums/displayConditions.js";
9
- import { useStripoApi as U } from "../services/stripoApi.js";
10
- import P from "../static/styles/customEditorStyle.css.js";
11
- import { useEditorStore as R } from "../stores/editor.js";
12
- import { dynamicContentToMergeTags as H } from "../utils/genericUtil.js";
13
- import O from "../package.json.js";
14
- const Z = (c) => {
15
- const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = U(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, r = []) => {
16
- var m, f, g;
17
- const o = R(), { html: n, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((f = l.value) == null ? void 0 : f.modulesDisabled) ?? !1, T = ((g = y.value) == null ? void 0 : g.forceRecreate) ?? !1;
7
+ import { displayConditions as I } from "../enums/displayConditions.js";
8
+ import { useStripoApi as M } from "../services/stripoApi.js";
9
+ import U from "../static/styles/customEditorStyle.css.js";
10
+ import { useEditorStore as P } from "../stores/editor.js";
11
+ import { dynamicContentToMergeTags as R } from "../utils/genericUtil.js";
12
+ import H from "../package.json.js";
13
+ const W = (c) => {
14
+ const { features: l, template: y } = v(), { handleError: u } = D(), { getToken: C, getCustomFonts: S } = M(), { handleEvent: E } = F(), { getStripoBlocksConfig: h } = B(), w = async (i, n = []) => {
15
+ var m, g, f;
16
+ const o = P(), { html: r, css: p } = i, { baseBlocks: s, extensions: t } = await h(), a = ((m = l.value) == null ? void 0 : m.displayConditions) ?? !0, k = ((g = l.value) == null ? void 0 : g.modulesDisabled) ?? !1, T = ((f = y.value) == null ? void 0 : f.forceRecreate) ?? !1;
18
17
  window.UIEditor.initEditor(
19
18
  document.querySelector("#guido-editor"),
20
19
  {
21
20
  metadata: c,
22
- html: n,
21
+ html: r,
23
22
  css: p,
24
23
  forceRecreate: T,
25
24
  locale: "en",
@@ -31,10 +30,10 @@ const Z = (c) => {
31
30
  customAppearanceMergetags: !0,
32
31
  customAppearanceMergetagsBorderColor: "#f1f3fe",
33
32
  customAppearanceMergetagsBackgroundColor: "#f1f3fe",
34
- customViewStyles: P,
33
+ customViewStyles: U,
35
34
  conditionsEnabled: a,
36
35
  customConditionsEnabled: a,
37
- conditionCategories: M,
36
+ conditionCategories: I,
38
37
  enableXSSSecurity: !0,
39
38
  modulesDisabled: k,
40
39
  messageSettingsEnabled: !0,
@@ -47,11 +46,11 @@ const Z = (c) => {
47
46
  editorFonts: {
48
47
  showDefaultStandardFonts: !0,
49
48
  showDefaultNotStandardFonts: !0,
50
- customFonts: r
49
+ customFonts: n
51
50
  },
52
51
  mergeTags: [
53
52
  {
54
- entries: H(c.preselectedDynamicContentList)
53
+ entries: R(c.preselectedDynamicContentList)
55
54
  }
56
55
  ],
57
56
  async onTokenRefreshRequest(e) {
@@ -90,30 +89,29 @@ const Z = (c) => {
90
89
  ".in-on-board-wrapper",
91
90
  ".in-drawer__container"
92
91
  ],
93
- extensions: t,
94
- localePatch: I
92
+ extensions: t
95
93
  }
96
94
  );
97
- }, b = (i) => new Promise((r, o) => {
95
+ }, b = (i) => new Promise((n, o) => {
98
96
  var a;
99
97
  if (document.getElementById("UiEditorScript")) {
100
- i(), r();
98
+ i(), n();
101
99
  return;
102
100
  }
103
- const n = O.guido, s = `https://email-static.useinsider.com/guido/${(a = n == null ? void 0 : n.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
101
+ const r = H.guido, s = `https://email-static.useinsider.com/guido/${(a = r == null ? void 0 : r.stripo) == null ? void 0 : a.version}/UIEditor.js`, t = document.createElement("script");
104
102
  t.id = "UiEditorScript", t.type = "module", t.src = s, t.onload = () => {
105
- i(), r();
103
+ i(), n();
106
104
  }, t.onerror = () => {
107
105
  o(new Error(`Failed to load Stripo UIEditor script from S3: ${s}`));
108
106
  }, document.body.appendChild(t);
109
107
  });
110
108
  return { initPlugin: async (i) => {
111
109
  await b(async () => {
112
- const r = await S();
113
- await w(i, r);
110
+ const n = await S();
111
+ await w(i, n);
114
112
  });
115
113
  } };
116
114
  };
117
115
  export {
118
- Z as useStripo
116
+ W as useStripo
119
117
  };
@@ -1,44 +1,47 @@
1
- import { useHttp as m } from "../composables/useHttp.js";
2
- import { useToaster as i } from "../composables/useToaster.js";
3
- import { MAX_DEFAULT_TEMPLATE_ID as p } from "../enums/defaults.js";
4
- const y = () => {
5
- const { get: r } = m(), { handleError: o } = i();
1
+ import { useHttp as l } from "../composables/useHttp.js";
2
+ import { useToaster as u } from "../composables/useToaster.js";
3
+ import { MAX_DEFAULT_TEMPLATE_ID as d } 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 D = () => {
7
+ const { get: o } = l(), { handleError: a } = u();
6
8
  return {
7
9
  getToken: async () => {
8
10
  try {
9
- const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await r(`/stripo/get-user-token?test=${t}`);
11
+ const t = Number(localStorage.getItem("ins-guido-test-instance")), { data: e } = await o(`/stripo/get-user-token?test=${t}`);
10
12
  return e.body.token;
11
13
  } catch (t) {
12
- return o(t, "Failed to fetch token"), "";
14
+ return a(t, "Failed to fetch token"), "";
13
15
  }
14
16
  },
15
17
  getCustomFonts: async () => {
16
18
  try {
17
- const { data: t = [] } = await r("/stripo/get-partner-custom-fonts");
19
+ const { data: t = [] } = await o("/stripo/get-partner-custom-fonts");
18
20
  return t.map((e) => ({
19
21
  ...e,
20
22
  active: !0
21
23
  }));
22
24
  } catch (t) {
23
- return o(t, "Failed to fetch custom fonts"), [];
25
+ return a(t, "Failed to fetch custom fonts"), [];
24
26
  }
25
27
  },
26
28
  getDefaultTemplate: async () => {
27
29
  const t = {
28
- html: "",
29
- css: ""
30
+ html: f,
31
+ css: g
30
32
  };
31
33
  try {
32
- const c = new URLSearchParams(window.location.search).get("default-template"), s = c ? parseInt(c) : 0, l = s >= 1 && s <= p ? s : 0, { data: n } = await r(
33
- `/stripo/default-template/${l}`
34
- ), a = typeof n == "string" ? JSON.parse(n) : n;
35
- return !a || typeof a != "object" || !("html" in a) || !("css" in a) ? t : a;
34
+ const e = new URLSearchParams(window.location.search), c = e.get("default-template"), p = e.get("master"), s = c ? parseInt(c) : 0, m = s >= 1 && s <= d ? s : 0;
35
+ if (!m && !p)
36
+ return t;
37
+ const i = `/stripo/default-template/${m}`, { data: n } = await o(i), r = typeof n == "string" ? JSON.parse(n) : n;
38
+ return !r || typeof r != "object" || !("html" in r) || !("css" in r) ? t : r;
36
39
  } catch (e) {
37
- return o(e, "Failed to fetch default template"), t;
40
+ return a(e, "Failed to fetch default template"), t;
38
41
  }
39
42
  }
40
43
  };
41
44
  };
42
45
  export {
43
- y as useStripoApi
46
+ D as useStripoApi
44
47
  };
@@ -17,14 +17,6 @@ ue-notifications-container .alert-message-wrapper {
17
17
  padding: 16px 24px;
18
18
  }
19
19
 
20
- ue-notifications-container .info {
21
- background-color: var(--guido-color-background-toaster-info) !important;
22
- }
23
-
24
- ue-block-thumb-hint {
25
- text-align: left;
26
- }
27
-
28
20
  ue-notifications-container .alert-message-wrapper .alert-message-main .alert-message-content {
29
21
  width: calc(100% - 64px);
30
22
  }
@@ -25,7 +25,6 @@ const o = `:host {
25
25
  --guido-color-border-onpage-message-error: var(--guido-color-danger-500);
26
26
  --guido-color-background-toaster-success: #128745;
27
27
  --guido-color-background-toaster-error: var(--guido-color-danger-500);
28
- --guido-color-background-toaster-info: #2C3546;
29
28
  --guido-color-background-toaster-warn: #D37400;
30
29
  }
31
30
  `;
@@ -0,0 +1,74 @@
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
+ };