codenotch-react 1.0.56 → 1.0.57

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/dist/index.d.ts CHANGED
@@ -4,15 +4,15 @@ import CodeEditor from "./components/CodeEditor";
4
4
  declare const env: ICodenotchEnv;
5
5
  /**
6
6
  * Setup Codenotch environment from the given object
7
- * @param env An object containing the Codenotch environment variables as key-value pairs. This can be obtained from URL parameters or any other source.
7
+ * @param envVariables An object containing the Codenotch environment variables as key-value pairs. This can be obtained from URL parameters or any other source.
8
8
  * @returns {void}
9
9
  */
10
- declare function setupCodenotchEnv(env: any): void;
10
+ declare function init(envVariables: any): void;
11
11
  declare function i18n(key: string, ...args: any[]): string;
12
12
  /**
13
13
  * Return Codenotch API
14
14
  * @returns {ICodenotchApi} Codenotch API
15
15
  */
16
16
  declare function useCodenotch(): ICodenotchApi;
17
- export { env as CODENOTCH_ENV, i18n, useCodenotch, setupCodenotchEnv, ICodenotchEnv, ICodenotchApi, ICodenotchDialog, Auml, CodeEditor };
17
+ export { env, i18n, useCodenotch, init, ICodenotchEnv, ICodenotchApi, ICodenotchDialog, Auml, CodeEditor };
18
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAIjD,QAAA,MAAM,GAAG,EAAE,aAAkB,CAAC;AAO9B;;;;GAIG;AACH,iBAAS,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAgDzC;AAED,iBAAS,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAoCjD;AAED;;;GAGG;AACH,iBAAS,YAAY,IAAI,aAAa,CAsKrC;AAED,OAAO,EACH,GAAG,IAAI,aAAa,EACpB,IAAI,EACJ,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACb,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEpF,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAIjD,QAAA,MAAM,GAAG,EAAE,aAAkB,CAAC;AAO9B;;;;GAIG;AACH,iBAAS,IAAI,CAAC,YAAY,EAAE,GAAG,GAAG,IAAI,CAiDrC;AAED,iBAAS,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,MAAM,CAoCjD;AAED;;;GAGG;AACH,iBAAS,YAAY,IAAI,aAAa,CAsKrC;AAED,OAAO,EACH,GAAG,EACH,IAAI,EACJ,YAAY,EACZ,IAAI,EACJ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,IAAI,EACJ,UAAU,EACb,CAAC"}
package/dist/index.js CHANGED
@@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CodeEditor = exports.Auml = exports.CODENOTCH_ENV = void 0;
6
+ exports.CodeEditor = exports.Auml = exports.env = void 0;
7
7
  exports.i18n = i18n;
8
8
  exports.useCodenotch = useCodenotch;
9
- exports.setupCodenotchEnv = setupCodenotchEnv;
9
+ exports.init = init;
10
10
  const react_dom_1 = __importDefault(require("react-dom"));
11
11
  const SignalR_1 = require("./core/SignalR");
12
12
  const ProcessUtils_1 = __importDefault(require("./core/ProcessUtils"));
@@ -17,30 +17,30 @@ const CodeEditor_1 = __importDefault(require("./components/CodeEditor"));
17
17
  exports.CodeEditor = CodeEditor_1.default;
18
18
  var signalR = undefined;
19
19
  const env = {};
20
- exports.CODENOTCH_ENV = env;
20
+ exports.env = env;
21
21
  const MISSING_CLUSTER_URL_ERROR = "Codenotch cluster URL is not defined. Please set it in the Codenotch configuration.";
22
22
  const MISSING_SERVICE_NAME_ERROR = "Codenotch service name is not defined. Please set it in the Codenotch configuration.";
23
23
  const MISSING_TENANT_NAME_ERROR = "Codenotch tenant name is not defined. Please set it in the Codenotch configuration.";
24
24
  /**
25
25
  * Setup Codenotch environment from the given object
26
- * @param env An object containing the Codenotch environment variables as key-value pairs. This can be obtained from URL parameters or any other source.
26
+ * @param envVariables An object containing the Codenotch environment variables as key-value pairs. This can be obtained from URL parameters or any other source.
27
27
  * @returns {void}
28
28
  */
29
- function setupCodenotchEnv(env) {
30
- if (env === undefined || env === null) {
29
+ function init(envVariables) {
30
+ if (envVariables === undefined || envVariables === null) {
31
31
  console.warn("Codenotch environment is not defined. Please set it in the Codenotch configuration.");
32
32
  return;
33
33
  }
34
34
  // i18n.fr.somekey=some value
35
35
  let i18nLanguages = new Set();
36
- Object.keys(env).forEach((key) => {
36
+ Object.keys(envVariables).forEach((key) => {
37
37
  if (key.startsWith("i18n.")) {
38
38
  // Special case
39
39
  let parts = key.split(".");
40
40
  let language = parts[1];
41
41
  let keyName = parts.slice(2).join(".");
42
42
  i18nLanguages.add(language);
43
- let keyValue = `${env[key]}`.trim();
43
+ let keyValue = `${envVariables[key]}`.trim();
44
44
  if (keyValue.startsWith('"') && keyValue.endsWith('"')) {
45
45
  // Parse like json
46
46
  try {
@@ -55,7 +55,7 @@ function setupCodenotchEnv(env) {
55
55
  env.i18n[language][keyName] = keyValue;
56
56
  }
57
57
  else {
58
- env[key] = env[key];
58
+ env[key] = envVariables[key];
59
59
  console.log(`Codenotch environment variable ${key} set to ${env[key]}`);
60
60
  }
61
61
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codenotch-react",
3
- "version": "1.0.56",
3
+ "version": "1.0.57",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "author": "Codenotch SA",