@useinsider/guido 3.13.0 → 3.13.1-beta.ec37c2c

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,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-beta.ec37c2c",
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",