@useinsider/guido 3.13.0 → 3.13.1

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.
package/README.md CHANGED
@@ -134,7 +134,7 @@ const config: GuidoConfigInput = {
134
134
  // Optional: Editor settings
135
135
  editor?: {
136
136
  locale?: string, // Default: 'en'
137
- translationsPath?: string, // Default: 'window.trans.en'
137
+ translationsPath?: string, // Default: first locale registered on window.trans
138
138
  migrationDate?: number, // Stripo migration timestamp
139
139
  emailHeader?: {
140
140
  senderName?: string,
@@ -1,4 +1,7 @@
1
1
  import { ProductType as a, MessageType as o } from "./schemas.js";
2
+ const i = {
3
+ translationsPath: "window.trans[Object.keys(window.trans)[0]]"
4
+ };
2
5
  a.EMAIL;
3
6
  o.PROMOTIONAL;
4
7
  const e = [
@@ -33,12 +36,13 @@ const e = [
33
36
  "vikingsankara",
34
37
  "stripoeditorlivetest"
35
38
  ];
36
- function n(t) {
39
+ function s(t) {
37
40
  return e.includes(t);
38
41
  }
39
42
  export {
43
+ i as DEFAULT_EDITOR,
40
44
  o as MessageType,
41
45
  a as ProductType,
42
46
  e as TEST_PARTNERS,
43
- n as isTestPartner
47
+ s as isTestPartner
44
48
  };
@@ -1,18 +1,20 @@
1
+ import "../@types/config/schemas.js";
2
+ import { DEFAULT_EDITOR } from "../@types/config/defaults.js";
1
3
  import memoize from "../node_modules/lodash-es/memoize.js";
2
4
  import { ref } from "vue";
3
5
  import { useConfig } from "./useConfig.js";
4
6
  const useTranslations = () => {
5
7
  var o, e;
6
- const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || "window.trans.en", translations = ref(eval(translationsPath)), trans = (n, t) => {
7
- const r = translations.value[n];
8
- return r ? t ? Object.entries(t).reduce(
8
+ const { config } = useConfig(), translationsPath = ((e = (o = config.value) == null ? void 0 : o.editor) == null ? void 0 : e.translationsPath) || DEFAULT_EDITOR.translationsPath, translations = ref(eval(translationsPath)), trans = (t, n) => {
9
+ const r = translations.value[t];
10
+ return r ? n ? Object.entries(n).reduce(
9
11
  (s, [i, a]) => s.replace(new RegExp(`{${i}}`, "g"), String(a)),
10
12
  r
11
- ) : r : (console.warn(`Translation key not found: ${n}`), n);
13
+ ) : r : (console.warn(`Translation key not found: ${t}`), t);
12
14
  };
13
15
  return memoize(
14
16
  trans,
15
- (n, t) => !t || Object.keys(t).length === 0 ? n : JSON.stringify({ key: n, params: t })
17
+ (t, n) => !n || Object.keys(n).length === 0 ? t : JSON.stringify({ key: t, params: n })
16
18
  );
17
19
  };
18
20
  export {
@@ -1,4 +1,4 @@
1
- const c = `
1
+ const r = `
2
2
  <!--[if gte mso 9]>
3
3
  <xml>
4
4
  <o:OfficeDocumentSettings>
@@ -6,15 +6,21 @@ const c = `
6
6
  <o:PixelsPerInch>96</o:PixelsPerInch>
7
7
  </o:OfficeDocumentSettings>
8
8
  </xml>
9
- <![endif]-->`, s = {
9
+ <![endif]-->`, n = {
10
10
  xmlns: "http://www.w3.org/1999/xhtml",
11
11
  "xmlns:o": "urn:schemas-microsoft-com:office:office"
12
- }, r = [
12
+ }, p = `
13
+ <style type="text/css">
14
+ ul, ol { padding: 0px 0px 0px 40px; }
15
+ li p { mso-margin-bottom-alt: 15px; }
16
+ .es-text-ltr ul, .es-text-ltr ol { padding: 0px 0px 0px 40px; }
17
+ .es-text-rtl ol, .es-text-rtl ul { padding: 0px 40px 0px 0px; }
18
+ </style>`, l = [
13
19
  {
14
20
  id: "append-office-xml",
15
21
  description: "Appending office XML into the head if it does not exist.",
16
22
  type: "custom",
17
- processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${c}</head>`),
23
+ processor: (e) => e.includes("<o:OfficeDocumentSettings>") ? e : e.replace("</head>", `${r}</head>`),
18
24
  priority: 70
19
25
  },
20
26
  {
@@ -23,14 +29,21 @@ const c = `
23
29
  type: "custom",
24
30
  processor: (e) => {
25
31
  let t = e;
26
- return Object.entries(s).forEach(([o, i]) => {
27
- const n = new RegExp(`${o}="[^"]*"`);
28
- t.search(n) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
32
+ return Object.entries(n).forEach(([o, i]) => {
33
+ const s = new RegExp(`${o}="[^"]*"`);
34
+ t.search(s) === -1 && (t = t.replace("<html", `<html ${o}="${i}"`));
29
35
  }), t;
30
36
  },
31
37
  priority: 71
38
+ },
39
+ {
40
+ id: "append-outlook-list-css",
41
+ description: "Appending Outlook list rules into the head if the base CSS does not already carry them.",
42
+ type: "custom",
43
+ processor: (e) => e.includes("mso-margin-bottom-alt") ? e : e.replace("</head>", `${p}</head>`),
44
+ priority: 73
32
45
  }
33
46
  ];
34
47
  export {
35
- r as outlookCompilerRules
48
+ l as outlookCompilerRules
36
49
  };
@@ -1,9 +1,4 @@
1
1
  import type { ModuleAddData, ModuleModifier } from '@@/Types/stripo';
2
- /**
3
- * Host-registered translation key for the "some attributes could not be
4
- * converted" toaster. Guido resolves it against the host's `window.trans.en`;
5
- * the copy is registered host-side.
6
- */
7
2
  export declare const UNRESOLVED_DYNAMIC_CONTENT_ON_DROP_KEY = "dynamic-content.unresolved-attributes-on-drop";
8
3
  /**
9
4
  * Repairs label-form dynamic-content tokens in saved modules as they are dropped
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@useinsider/guido",
3
- "version": "3.13.0",
3
+ "version": "3.13.1",
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",