@andre1502/react-utilities 0.9.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. package/README.md +61 -12
  2. package/dist/Config/Config.js +4 -3
  3. package/dist/Config/Config.js.map +1 -1
  4. package/dist/EnvironmentEnum-BjXsfSRZ.js +9 -0
  5. package/dist/EnvironmentEnum-BjXsfSRZ.js.map +1 -0
  6. package/dist/EnvironmentEnum-UcQ6Il1O.js +9 -0
  7. package/dist/EnvironmentEnum-UcQ6Il1O.js.map +1 -0
  8. package/dist/I18n/I18n.d.ts +6 -0
  9. package/dist/I18n/I18n.js +104 -0
  10. package/dist/I18n/I18n.js.map +1 -0
  11. package/dist/I18n-CB7SyXYJ.js +3291 -0
  12. package/dist/I18n-CB7SyXYJ.js.map +1 -0
  13. package/dist/I18n-yXLN_hDO.js +3288 -0
  14. package/dist/I18n-yXLN_hDO.js.map +1 -0
  15. package/dist/NumberFormat-CvvBWhHc.js +89 -0
  16. package/dist/NumberFormat-CvvBWhHc.js.map +1 -0
  17. package/dist/NumberFormat-glmpbk7E.js +94 -0
  18. package/dist/NumberFormat-glmpbk7E.js.map +1 -0
  19. package/dist/config-cli.cjs +8 -3
  20. package/dist/config-cli.cjs.map +1 -1
  21. package/dist/config-cli.d.ts +2 -0
  22. package/dist/config-cli.js +8 -0
  23. package/dist/config-cli.js.map +1 -1
  24. package/dist/config-cli.mjs +5 -4
  25. package/dist/config-cli.mjs.map +1 -1
  26. package/dist/enums/EnvironmentEnum.d.ts +5 -0
  27. package/dist/enums/EnvironmentEnum.js +13 -0
  28. package/dist/enums/EnvironmentEnum.js.map +1 -0
  29. package/dist/format.cjs +18 -97
  30. package/dist/format.cjs.map +1 -1
  31. package/dist/format.d.ts +27 -0
  32. package/dist/format.js +27 -27
  33. package/dist/format.js.map +1 -1
  34. package/dist/format.mjs +29 -116
  35. package/dist/format.mjs.map +1 -1
  36. package/dist/i18n.cjs +15 -0
  37. package/dist/i18n.cjs.map +1 -0
  38. package/dist/i18n.d.ts +3 -0
  39. package/dist/i18n.js +28 -0
  40. package/dist/i18n.js.map +1 -0
  41. package/dist/i18n.mjs +4 -0
  42. package/dist/i18n.mjs.map +1 -0
  43. package/dist/index-cli.cjs +5 -0
  44. package/dist/index-cli.cjs.map +1 -1
  45. package/dist/index-cli.mjs +1 -0
  46. package/dist/index-cli.mjs.map +1 -1
  47. package/dist/index-rn.cjs +42 -6
  48. package/dist/index-rn.cjs.map +1 -1
  49. package/dist/index-rn.d.ts +1 -0
  50. package/dist/index-rn.js +11 -0
  51. package/dist/index-rn.js.map +1 -1
  52. package/dist/index-rn.mjs +31 -1
  53. package/dist/index-rn.mjs.map +1 -1
  54. package/dist/index.cjs +42 -6
  55. package/dist/index.cjs.map +1 -1
  56. package/dist/index.d.ts +1 -0
  57. package/dist/index.js +11 -0
  58. package/dist/index.js.map +1 -1
  59. package/dist/index.mjs +31 -1
  60. package/dist/index.mjs.map +1 -1
  61. package/package.json +11 -6
  62. package/src/Config/Config.ts +4 -3
  63. package/src/I18n/I18n.ts +117 -0
  64. package/src/config-cli.ts +2 -0
  65. package/src/enums/EnvironmentEnum.ts +5 -0
  66. package/src/format.ts +34 -34
  67. package/src/i18n.ts +4 -0
  68. package/src/index-rn.ts +1 -0
  69. package/src/index.ts +1 -0
  70. package/dist/index-fmt.cjs +0 -16
  71. package/dist/index-fmt.cjs.map +0 -1
  72. package/dist/index-fmt.d.ts +0 -1
  73. package/dist/index-fmt.js +0 -17
  74. package/dist/index-fmt.js.map +0 -1
  75. package/dist/index-fmt.mjs +0 -3
  76. package/dist/index-fmt.mjs.map +0 -1
  77. package/src/index-fmt.ts +0 -1
package/README.md CHANGED
@@ -32,7 +32,7 @@ const { fetchLocales } = require('@andre1502/react-utilities/cli');
32
32
  // OR
33
33
  const { fetchLocales } = require('@andre1502/react-utilities/config-cli');
34
34
 
35
- https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
35
+ // https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
36
36
  const optionLocales = {
37
37
  spreadsheetId: '', // Google Sheet Id
38
38
  spreadsheetTab: '', // Google Sheet Tab for locales
@@ -56,7 +56,7 @@ const { fetchConfig } = require('@andre1502/react-utilities/cli');
56
56
  // OR
57
57
  const { fetchConfig } = require('@andre1502/react-utilities/config-cli');
58
58
 
59
- https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
59
+ // https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
60
60
  const optionConfig = {
61
61
  spreadsheetId: '', // Google Sheet Id
62
62
  spreadsheetTab: '', // Google Sheet Tab for config;
@@ -88,6 +88,20 @@ module.exports = {
88
88
  };
89
89
  ```
90
90
 
91
+ ```json
92
+ {
93
+ "params": {
94
+ "<app-brand>": {
95
+ "API_MAIN_URL": {
96
+ "dev": "<api-dev>",
97
+ "stag": "<api-staging>",
98
+ "prod": "<api-production>"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
91
105
  ### Fetch All
92
106
 
93
107
  To fetch both locales and config.
@@ -97,10 +111,10 @@ const { fetchAll } = require('@andre1502/react-utilities/cli');
97
111
  // OR
98
112
  const { fetchAll } = require('@andre1502/react-utilities/config-cli');
99
113
 
100
- https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
114
+ // https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
101
115
  const spreadsheetId = ''; // Google Sheet Id
102
116
  const spreadsheetLocalesTab = ''; // Google Sheet Tab for locales
103
- const spreadsheetConfigTab = '' // Google Sheet Tab for config;
117
+ const spreadsheetConfigTab = ''; // Google Sheet Tab for config;
104
118
 
105
119
  const optionLocales = {
106
120
  spreadsheetId: spreadsheetId,
@@ -274,8 +288,6 @@ initSentry({
274
288
  ```js
275
289
  import { formatAccountNumber } from '@andre1502/react-utilities';
276
290
  // OR
277
- import { formatAccountNumber } from '@andre1502/react-utilities/fmt';
278
- // OR
279
291
  import { formatAccountNumber } from '@andre1502/react-utilities/format';
280
292
 
281
293
  const accountNumber = '1234567890123456';
@@ -291,8 +303,6 @@ console.log(`result: ${result}`);
291
303
  ```js
292
304
  import { formatNumber } from '@andre1502/react-utilities';
293
305
  // OR
294
- import { formatNumber } from '@andre1502/react-utilities/fmt';
295
- // OR
296
306
  import { formatNumber } from '@andre1502/react-utilities/format';
297
307
 
298
308
  const result = formatNumber({
@@ -315,8 +325,6 @@ console.log(`result: ${result}`);
315
325
  ```js
316
326
  import { getCurrencySymbol } from '@andre1502/react-utilities';
317
327
  // OR
318
- import { getCurrencySymbol } from '@andre1502/react-utilities/fmt';
319
- // OR
320
328
  import { getCurrencySymbol } from '@andre1502/react-utilities/format';
321
329
 
322
330
  const currency = 'TWD';
@@ -333,8 +341,6 @@ console.log(`result: ${result}`);
333
341
  ```js
334
342
  import { parseFormatNumber } from '@andre1502/react-utilities';
335
343
  // OR
336
- import { parseFormatNumber } from '@andre1502/react-utilities/fmt';
337
- // OR
338
344
  import { parseFormatNumber } from '@andre1502/react-utilities/format';
339
345
 
340
346
  const lang = 'zh-TW';
@@ -344,3 +350,46 @@ const result = parseFormatNumber(lang, value);
344
350
  console.log(`result: ${result}`);
345
351
  // output: 1000
346
352
  ```
353
+
354
+ ## I18n
355
+
356
+ ```js
357
+ import { initReactI18next } from 'react-i18next';
358
+ import { version } from './package.json';
359
+ import enUS from './en-US.json';
360
+ // ---
361
+ import { EnvironmentEnum, initI18n } from '@andre1502/react-utilities';
362
+ // OR
363
+ import { EnvironmentEnum, initI18n } from '@andre1502/react-utilities/i18n';
364
+
365
+ const localLang = 'en-US';
366
+ const fallbackLang = 'en-US';
367
+ const langCacheExpiredTimeMs = 60 * 60 * 1000;
368
+
369
+ // translation language from json file.
370
+ const resources = {
371
+ 'en-US': { translation: enUS },
372
+ };
373
+
374
+ // optional, if false or undefined will use resources value
375
+ const withLocalstorageBackend = false;
376
+
377
+ // change this to real CDN url or cloud storage with direct access like AWS S3 or GCP cloud storage.
378
+ // optional, if empty, false or undefined will use resources value
379
+ const cdnUrl = 'http://cdnurl.com';
380
+
381
+ // optional, if false or undefined disable debug mode
382
+ const debug = false;
383
+
384
+ initI18n(
385
+ initReactI18next,
386
+ localLang,
387
+ fallbackLang,
388
+ langCacheExpiredTimeMs,
389
+ resources,
390
+ version,
391
+ withLocalstorageBackend,
392
+ cdnUrl,
393
+ debug,
394
+ );
395
+ ```
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.transformConfig = exports.processConfig = exports.exportConfig = void 0;
7
7
  var lodash = _interopRequireWildcard(require("lodash"));
8
+ var _EnvironmentEnum = require("../enums/EnvironmentEnum");
8
9
  var _Output = require("./Output");
9
10
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10
11
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
@@ -124,17 +125,17 @@ var envMap = function envMap(env) {
124
125
  case 'dev':
125
126
  case 'develop':
126
127
  case 'development':
127
- result = 'dev';
128
+ result = _EnvironmentEnum.EnvironmentEnum.DEV;
128
129
  break;
129
130
  case 'stg':
130
131
  case 'stag':
131
132
  case 'staging':
132
- result = 'staging';
133
+ result = _EnvironmentEnum.EnvironmentEnum.STAGING;
133
134
  break;
134
135
  case 'prd':
135
136
  case 'prod':
136
137
  case 'production':
137
- result = 'production';
138
+ result = _EnvironmentEnum.EnvironmentEnum.PRODUCTION;
138
139
  break;
139
140
  default:
140
141
  throw new Error("env ".concat(env, " not supported."));
@@ -1 +1 @@
1
- {"version":3,"file":"Config.js","names":["lodash","_interopRequireWildcard","require","_Output","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","o","Symbol","iterator","constructor","prototype","processConfig","exports","rows","versionConfig","params","map","key","forEach","row","index","processRow","data","versionName","paramsName","undefined","paramsTypeHandler","isJsonString","str","JSON","parse","booleanText","includes","toUpperCase","exportConfig","options","config","content","exportAs","stringify","filename","concat","Error","outputToFile","envMap","env","result","contentMap","value","isNull","transformConfig","configKeyPrefix","envKey","keys","newConfigKey","extensionFile","join","Array","isArray"],"sources":["../../src/Config/Config.ts"],"sourcesContent":["import * as lodash from 'lodash';\nimport { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { outputToFile } from './Output';\n\n/**\n * Process config data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processConfig = (rows: any[][]): OutputMap => {\n let versionConfig: OutputMap = {};\n\n let params = rows[0].map((key) => {\n return key;\n });\n\n rows.forEach((row: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n versionConfig = processRow(row, params, versionConfig);\n });\n\n return versionConfig;\n};\n\n/**\n * Process config item\n *\n * @param {string[]} data\n * @param {string[]} params\n * @param {OutputMap} versionConfig\n * @return {OutputMap}\n */\nconst processRow = (\n data: string[],\n params: string[],\n versionConfig: OutputMap,\n): OutputMap => {\n const versionName = data[0];\n versionConfig[versionName] = {};\n\n params.forEach((paramsName, index) => {\n if (index === 0 || data[index] === undefined || data[index] === '') {\n return;\n }\n\n versionConfig[versionName][paramsName] = paramsTypeHandler(data[index]);\n });\n\n return versionConfig;\n};\n\n/**\n * Check is JSON value\n *\n * @param {string} str\n * @return {boolean}\n */\nconst isJsonString = (str: string): boolean => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Handling config value type\n *\n * @param {string} params\n * @return {any}\n */\nconst paramsTypeHandler = (params: string): any => {\n const booleanText = ['TRUE', 'FALSE'];\n\n if (booleanText.includes(params.toUpperCase())) {\n return params === 'TRUE';\n }\n\n if (isJsonString(params)) {\n return JSON.parse(params);\n }\n\n return params;\n};\n\n/**\n * Export config data into js file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportConfig = (data: OutputMap, options: OutputOptions): void => {\n const config = {\n params: data,\n };\n\n let content = '';\n\n switch (options.exportAs) {\n case 'ts':\n content = 'export default ' + JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.ts`;\n break;\n case 'json':\n content = JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.json`;\n break;\n case 'js':\n content = `module.exports = ${JSON.stringify(config, null, 2)}`;\n options.filename = `${options.filename}.js`;\n break;\n default:\n throw new Error(`exportAs ${options.exportAs} not supported.`);\n }\n\n outputToFile(content, options);\n};\n\n/**\n * Handling env map value\n *\n * @param {string} env\n * @return {string}\n */\nconst envMap = (env: string): string => {\n let result;\n\n switch (env) {\n case 'dev':\n case 'develop':\n case 'development':\n result = 'dev';\n break;\n case 'stg':\n case 'stag':\n case 'staging':\n result = 'staging';\n break;\n case 'prd':\n case 'prod':\n case 'production':\n result = 'production';\n break;\n default:\n throw new Error(`env ${env} not supported.`);\n }\n\n return result;\n};\n\n/**\n * Mapping content to exportAs value\n *\n * @param {string} key\n * @param {any} value\n * @param {string} exportAs\n * @return {string}\n */\nconst contentMap = (key: string, value: any, exportAs: string): string => {\n let content = '';\n\n switch (exportAs) {\n case 'ts':\n if (lodash.isNull(value)) {\n content += `export const ${key}: string | null = ${value};\\n`;\n } else if (typeof value === 'boolean') {\n content += `export const ${key}: boolean = ${value};\\n`;\n } else {\n content += `export const ${key} = '${value}';\\n`;\n }\n break;\n case 'js':\n content += `export const ${key} = \"${value}\";\\n`;\n break;\n case 'env':\n content += `${key} = \"${value}\"\\n`;\n break;\n default:\n throw new Error(`exportAs ${exportAs} not supported.`);\n }\n\n return content;\n};\n\n/**\n * Transform config\n *\n * @param {OutputMap} data\n * @param {string} env\n * @param {string} configKeyPrefix\n * @param {OutputOptions} options\n * @return {void}\n */\nconst transformConfig = (\n data: OutputMap,\n env: string,\n configKeyPrefix: string,\n options: OutputOptions,\n): void => {\n const envKey = configKeyPrefix ? `${configKeyPrefix}ENV` : 'ENV';\n\n let content = contentMap(envKey, envMap(env), options.exportAs!);\n\n Object.keys(data).forEach((key) => {\n const newConfigKey = configKeyPrefix ? `${configKeyPrefix}${key}` : key;\n\n if (key === 'BASE_PROJECT') {\n const extensionFile = [\n `.${data[key]}.js`,\n `.${data[key]}.jsx`,\n `.${data[key]}.ts`,\n `.${data[key]}.tsx`,\n `.${data[key]}.css`,\n `.${data[key]}.json`,\n `.${data[key]}.scss`,\n ];\n\n content += contentMap(\n newConfigKey,\n extensionFile.join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (key === 'SITEMAP') {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n\n return;\n }\n\n if (Array.isArray(data[key])) {\n content += contentMap(\n newConfigKey,\n data[key].join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (typeof data[key] === 'object') {\n if (data[key].hasOwnProperty(env)) {\n content += contentMap(newConfigKey, data[key][env], options.exportAs!);\n } else {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n }\n\n return;\n }\n\n content += contentMap(newConfigKey, data[key], options.exportAs!);\n });\n\n outputToFile(content, options);\n};\n\nexport { exportConfig, processConfig, transformConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAAwC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,W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,IAAI,CAACL,GAAG,CAAC,WACd;MAEDoB,OAAO,IAAIU,UAAU,CACnBO,YAAY,EACZC,aAAa,CAACC,IAAI,CAAC,GAAG,CAAC,EACvBrB,OAAO,CAACG,QACV,CAAC;MAED;IACF;IAEA,IAAIrB,GAAG,KAAK,SAAS,EAAE;MACrBoB,OAAO,IAAIU,UAAU,CACnBO,YAAY,EACZzB,IAAI,CAACU,SAAS,CAACjB,IAAI,CAACL,GAAG,CAAC,CAAC,EACzBkB,OAAO,CAACG,QACV,CAAC;MAED;IACF;IAEA,IAAImB,KAAK,CAACC,OAAO,CAACpC,IAAI,CAACL,GAAG,CAAC,CAAC,EAAE;MAC5BoB,OAAO,IAAIU,UAAU,CACnBO,YAAY,EACZhC,IAAI,CAACL,GAAG,CAAC,CAACuC,IAAI,CAAC,GAAG,CAAC,EACnBrB,OAAO,CAACG,QACV,CAAC;MAED;IACF;IAEA,IAAI9C,OAAA,CAAO8B,IAAI,CAACL,GAAG,CAAC,MAAK,QAAQ,EAAE;MACjC,IAAIK,IAAI,CAACL,GAAG,CAAC,CAACf,cAAc,CAAC2C,GAAG,CAAC,EAAE;QACjCR,OAAO,IAAIU,UAAU,CAACO,YAAY,EAAEhC,IAAI,CAACL,GAAG,CAAC,CAAC4B,GAAG,CAAC,EAAEV,OAAO,CAACG,QAAS,CAAC;MACxE,CAAC,MAAM;QACLD,OAAO,IAAIU,UAAU,CACnBO,YAAY,EACZzB,IAAI,CAACU,SAAS,CAACjB,IAAI,CAACL,GAAG,CAAC,CAAC,EACzBkB,OAAO,CAACG,QACV,CAAC;MACH;MAEA;IACF;IAEAD,OAAO,IAAIU,UAAU,CAACO,YAAY,EAAEhC,IAAI,CAACL,GAAG,CAAC,EAAEkB,OAAO,CAACG,QAAS,CAAC;EACnE,CAAC,CAAC;EAEF,IAAAK,oBAAY,EAACN,OAAO,EAAEF,OAAO,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Config.js","names":["lodash","_interopRequireWildcard","require","_EnvironmentEnum","_Output","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","o","Symbol","iterator","constructor","prototype","processConfig","exports","rows","versionConfig","params","map","key","forEach","row","index","processRow","data","versionName","paramsName","undefined","paramsTypeHandler","isJsonString","str","JSON","parse","booleanText","includes","toUpperCase","exportConfig","options","config","content","exportAs","stringify","filename","concat","Error","outputToFile","envMap","env","result","EnvironmentEnum","DEV","STAGING","PRODUCTION","contentMap","value","isNull","transformConfig","configKeyPrefix","envKey","keys","newConfigKey","extensionFile","join","Array","isArray"],"sources":["../../src/Config/Config.ts"],"sourcesContent":["import * as lodash from 'lodash';\nimport { EnvironmentEnum } from '../enums/EnvironmentEnum';\nimport { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { outputToFile } from './Output';\n\n/**\n * Process config data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processConfig = (rows: any[][]): OutputMap => {\n let versionConfig: OutputMap = {};\n\n let params = rows[0].map((key) => {\n return key;\n });\n\n rows.forEach((row: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n versionConfig = processRow(row, params, versionConfig);\n });\n\n return versionConfig;\n};\n\n/**\n * Process config item\n *\n * @param {string[]} data\n * @param {string[]} params\n * @param {OutputMap} versionConfig\n * @return {OutputMap}\n */\nconst processRow = (\n data: string[],\n params: string[],\n versionConfig: OutputMap,\n): OutputMap => {\n const versionName = data[0];\n versionConfig[versionName] = {};\n\n params.forEach((paramsName, index) => {\n if (index === 0 || data[index] === undefined || data[index] === '') {\n return;\n }\n\n versionConfig[versionName][paramsName] = paramsTypeHandler(data[index]);\n });\n\n return versionConfig;\n};\n\n/**\n * Check is JSON value\n *\n * @param {string} str\n * @return {boolean}\n */\nconst isJsonString = (str: string): boolean => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Handling config value type\n *\n * @param {string} params\n * @return {any}\n */\nconst paramsTypeHandler = (params: string): any => {\n const booleanText = ['TRUE', 'FALSE'];\n\n if (booleanText.includes(params.toUpperCase())) {\n return params === 'TRUE';\n }\n\n if (isJsonString(params)) {\n return JSON.parse(params);\n }\n\n return params;\n};\n\n/**\n * Export config data into js file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportConfig = (data: OutputMap, options: OutputOptions): void => {\n const config = {\n params: data,\n };\n\n let content = '';\n\n switch (options.exportAs) {\n case 'ts':\n content = 'export default ' + JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.ts`;\n break;\n case 'json':\n content = JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.json`;\n break;\n case 'js':\n content = `module.exports = ${JSON.stringify(config, null, 2)}`;\n options.filename = `${options.filename}.js`;\n break;\n default:\n throw new Error(`exportAs ${options.exportAs} not supported.`);\n }\n\n outputToFile(content, options);\n};\n\n/**\n * Handling env map value\n *\n * @param {string} env\n * @return {string}\n */\nconst envMap = (env: string): string => {\n let result;\n\n switch (env) {\n case 'dev':\n case 'develop':\n case 'development':\n result = EnvironmentEnum.DEV;\n break;\n case 'stg':\n case 'stag':\n case 'staging':\n result = EnvironmentEnum.STAGING;\n break;\n case 'prd':\n case 'prod':\n case 'production':\n result = EnvironmentEnum.PRODUCTION;\n break;\n default:\n throw new Error(`env ${env} not supported.`);\n }\n\n return result;\n};\n\n/**\n * Mapping content to exportAs value\n *\n * @param {string} key\n * @param {any} value\n * @param {string} exportAs\n * @return {string}\n */\nconst contentMap = (key: string, value: any, exportAs: string): string => {\n let content = '';\n\n switch (exportAs) {\n case 'ts':\n if (lodash.isNull(value)) {\n content += `export const ${key}: string | null = ${value};\\n`;\n } else if (typeof value === 'boolean') {\n content += `export const ${key}: boolean = ${value};\\n`;\n } else {\n content += `export const ${key} = '${value}';\\n`;\n }\n break;\n case 'js':\n content += `export const ${key} = \"${value}\";\\n`;\n break;\n case 'env':\n content += `${key} = \"${value}\"\\n`;\n break;\n default:\n throw new Error(`exportAs ${exportAs} not supported.`);\n }\n\n return content;\n};\n\n/**\n * Transform config\n *\n * @param {OutputMap} data\n * @param {string} env\n * @param {string} configKeyPrefix\n * @param {OutputOptions} options\n * @return {void}\n */\nconst transformConfig = (\n data: OutputMap,\n env: string,\n configKeyPrefix: string,\n options: OutputOptions,\n): void => {\n const envKey = configKeyPrefix ? `${configKeyPrefix}ENV` : 'ENV';\n\n let content = contentMap(envKey, envMap(env), options.exportAs!);\n\n Object.keys(data).forEach((key) => {\n const newConfigKey = configKeyPrefix ? `${configKeyPrefix}${key}` : key;\n\n if (key === 'BASE_PROJECT') {\n const extensionFile = [\n `.${data[key]}.js`,\n `.${data[key]}.jsx`,\n `.${data[key]}.ts`,\n `.${data[key]}.tsx`,\n `.${data[key]}.css`,\n `.${data[key]}.json`,\n `.${data[key]}.scss`,\n ];\n\n content += contentMap(\n newConfigKey,\n extensionFile.join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (key === 'SITEMAP') {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n\n return;\n }\n\n if (Array.isArray(data[key])) {\n content += contentMap(\n newConfigKey,\n data[key].join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (typeof data[key] === 'object') {\n if (data[key].hasOwnProperty(env)) {\n content += contentMap(newConfigKey, data[key][env], options.exportAs!);\n } else {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n }\n\n return;\n }\n\n content += contentMap(newConfigKey, data[key], options.exportAs!);\n });\n\n outputToFile(content, options);\n};\n\nexport { exportConfig, processConfig, transformConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAGA,IAAAE,OAAA,GAAAF,OAAA;AAAwC,SAAAG,yBAAAC,CAAA,6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,OAAO,CAACG,QAAS,CAAC;EACnE,CAAC,CAAC;EAEF,IAAAK,oBAAY,EAACN,OAAO,EAAEF,OAAO,CAAC;AAChC,CAAC","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ exports.EnvironmentEnum = void 0;
4
+ (function (EnvironmentEnum) {
5
+ EnvironmentEnum["DEV"] = "dev";
6
+ EnvironmentEnum["STAGING"] = "staging";
7
+ EnvironmentEnum["PRODUCTION"] = "production";
8
+ })(exports.EnvironmentEnum || (exports.EnvironmentEnum = {}));
9
+ //# sourceMappingURL=EnvironmentEnum-BjXsfSRZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentEnum-BjXsfSRZ.js","sources":["../src/enums/EnvironmentEnum.ts"],"sourcesContent":[null],"names":["EnvironmentEnum"],"mappings":";;AAAYA,iCAIX;AAJD,CAAA,UAAYA,eAAe,EAAA;AACzBA,EAAAA,eAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACXA,EAAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,eAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AAC3B,CAAC,EAJWA,uBAAe,KAAfA,uBAAe,GAI1B,EAAA,CAAA,CAAA;;"}
@@ -0,0 +1,9 @@
1
+ var EnvironmentEnum;
2
+ (function (EnvironmentEnum) {
3
+ EnvironmentEnum["DEV"] = "dev";
4
+ EnvironmentEnum["STAGING"] = "staging";
5
+ EnvironmentEnum["PRODUCTION"] = "production";
6
+ })(EnvironmentEnum || (EnvironmentEnum = {}));
7
+
8
+ export { EnvironmentEnum as E };
9
+ //# sourceMappingURL=EnvironmentEnum-UcQ6Il1O.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnvironmentEnum-UcQ6Il1O.js","sources":["../src/enums/EnvironmentEnum.ts"],"sourcesContent":[null],"names":["EnvironmentEnum"],"mappings":"IAAYA,gBAIX;AAJD,CAAA,UAAYA,eAAe,EAAA;AACzBA,EAAAA,eAAA,CAAA,KAAA,CAAA,GAAA,KAAW,CAAA;AACXA,EAAAA,eAAA,CAAA,SAAA,CAAA,GAAA,SAAmB,CAAA;AACnBA,EAAAA,eAAA,CAAA,YAAA,CAAA,GAAA,YAAyB,CAAA;AAC3B,CAAC,EAJWA,eAAe,KAAfA,eAAe,GAI1B,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,6 @@
1
+ import { ThirdPartyModule } from 'i18next';
2
+ declare const getV: (divider: number) => number;
3
+ declare const initI18n: (initReactI18next: ThirdPartyModule, lang: string, fallbackLang: string, langCacheExpiredTimeMs: number, resources: {
4
+ [key: string]: any;
5
+ }, version: string, withLocalstorageBackend?: boolean, cdnUrl?: string, debug?: boolean) => void;
6
+ export { getV, initI18n };
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.initI18n = exports.getV = void 0;
7
+ var _i18next = _interopRequireDefault(require("i18next"));
8
+ var _i18nextChainedBackend = _interopRequireDefault(require("i18next-chained-backend"));
9
+ var _i18nextHttpBackend = _interopRequireDefault(require("i18next-http-backend"));
10
+ var _i18nextLocalstorageBackend = _interopRequireDefault(require("i18next-localstorage-backend"));
11
+ var _i18nextResourcesToBackend = _interopRequireDefault(require("i18next-resources-to-backend"));
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
13
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
14
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
15
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
16
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
17
+ var getV = exports.getV = function getV(divider) {
18
+ return Math.floor(Date.now() / divider);
19
+ };
20
+ var initI18n = exports.initI18n = function initI18n(initReactI18next, lang, fallbackLang, langCacheExpiredTimeMs, resources, version, withLocalstorageBackend, cdnUrl, debug) {
21
+ var backends = [];
22
+ var backendOptions = [];
23
+ var langs = Object.keys(resources);
24
+
25
+ // https://www.i18next.com/how-to/backend-fallback
26
+ if (withLocalstorageBackend) {
27
+ var versions = {};
28
+ langs.forEach(function (value) {
29
+ return Object.assign(versions, _defineProperty({}, value, version));
30
+ });
31
+ backends.push(_i18nextLocalstorageBackend["default"]);
32
+ backendOptions.push({
33
+ // prefix for stored languages
34
+ prefix: "i18next_res_",
35
+ // expiration
36
+ expirationTime: langCacheExpiredTimeMs,
37
+ // language versions
38
+ versions: versions
39
+ });
40
+ }
41
+ if (cdnUrl) {
42
+ backends.push(_i18nextHttpBackend["default"]);
43
+ backendOptions.push({
44
+ // load resources from url path
45
+ loadPath: "".concat(cdnUrl, "/locales/{{lng}}.json"),
46
+ // adds parameters to resource URL. 'example.com' -> 'example.com?v=1.3.5'
47
+ queryStringParams: {
48
+ v: "".concat(version, ".").concat(getV(langCacheExpiredTimeMs))
49
+ },
50
+ reloadInterval: langCacheExpiredTimeMs // can be used to reload resources in a specific interval (milliseconds) (useful in server environments)
51
+ });
52
+ }
53
+ backends.push((0, _i18nextResourcesToBackend["default"])(resources));
54
+
55
+ // https://www.i18next.com/misc/creating-own-plugins#languagedetector
56
+ var languageDetector = {
57
+ type: 'languageDetector',
58
+ name: 'customDetector',
59
+ async: false,
60
+ init: function init() {
61
+ /* use services and options */
62
+ },
63
+ detect: function detect(callback) {
64
+ return lang;
65
+ }
66
+ };
67
+ var config = {
68
+ debug: debug !== null && debug !== void 0 ? debug : false,
69
+ compatibilityJSON: 'v4',
70
+ ns: ['translation'],
71
+ defaultNS: 'translation',
72
+ lng: lang,
73
+ fallbackLng: fallbackLang,
74
+ load: 'currentOnly',
75
+ keySeparator: false,
76
+ nonExplicitSupportedLngs: true,
77
+ backend: {
78
+ backends: backends,
79
+ backendOptions: backendOptions,
80
+ cacheHitMode: 'refreshAndUpdateStore',
81
+ reloadInterval: langCacheExpiredTimeMs,
82
+ refreshExpirationTime: langCacheExpiredTimeMs // only after determined time it should trigger a refresh if necessary
83
+ },
84
+ react: {
85
+ bindI18nStore: 'added' // this way, when the HttpBackend delivers new translations (thanks to refreshAndUpdateStore), the UI gets updated
86
+ },
87
+ interpolation: {
88
+ escapeValue: false // react already safes from xss
89
+ }
90
+ };
91
+ if (!_i18next["default"].isInitialized) {
92
+ _i18next["default"].use(_i18nextChainedBackend["default"]).use(languageDetector).use(initReactI18next) // passes i18n down to react-i18next
93
+ .init(config, function (ex, t) {
94
+ if (ex) {
95
+ console.error("Error when i18n init", ex);
96
+ return;
97
+ }
98
+ setInterval(function () {
99
+ _i18next["default"].reloadResources();
100
+ }, langCacheExpiredTimeMs);
101
+ });
102
+ }
103
+ };
104
+ //# sourceMappingURL=I18n.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"I18n.js","names":["_i18next","_interopRequireDefault","require","_i18nextChainedBackend","_i18nextHttpBackend","_i18nextLocalstorageBackend","_i18nextResourcesToBackend","e","__esModule","_typeof","o","Symbol","iterator","constructor","prototype","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","toPrimitive","call","TypeError","String","Number","getV","exports","divider","Math","floor","Date","now","initI18n","initReactI18next","lang","fallbackLang","langCacheExpiredTimeMs","resources","version","withLocalstorageBackend","cdnUrl","debug","backends","backendOptions","langs","keys","versions","forEach","assign","push","LocalStorageBackend","prefix","expirationTime","HttpBackend","loadPath","concat","queryStringParams","v","reloadInterval","ResourcesToBackend","languageDetector","type","name","async","init","detect","callback","config","compatibilityJSON","ns","defaultNS","lng","fallbackLng","load","keySeparator","nonExplicitSupportedLngs","backend","cacheHitMode","refreshExpirationTime","react","bindI18nStore","interpolation","escapeValue","i18next","isInitialized","use","ChainedBackend","ex","console","error","setInterval","reloadResources"],"sources":["../../src/I18n/I18n.ts"],"sourcesContent":["import i18next, { InitOptions, ThirdPartyModule } from 'i18next';\nimport ChainedBackend from 'i18next-chained-backend';\nimport HttpBackend from 'i18next-http-backend';\nimport LocalStorageBackend from 'i18next-localstorage-backend';\nimport ResourcesToBackend from 'i18next-resources-to-backend';\n\nconst getV = (divider: number): number => {\n return Math.floor(Date.now() / divider);\n};\n\nconst initI18n = (\n initReactI18next: ThirdPartyModule,\n lang: string,\n fallbackLang: string,\n langCacheExpiredTimeMs: number,\n resources: { [key: string]: any },\n version: string,\n withLocalstorageBackend?: boolean,\n cdnUrl?: string,\n debug?: boolean,\n) => {\n let backends: Array<any> = [];\n let backendOptions: Array<any> = [];\n const langs = Object.keys(resources);\n\n // https://www.i18next.com/how-to/backend-fallback\n if (withLocalstorageBackend) {\n const versions: { [key: string]: string } = {};\n\n langs.forEach((value) => Object.assign(versions, { [value]: version }));\n\n backends.push(LocalStorageBackend);\n backendOptions.push({\n // prefix for stored languages\n prefix: `i18next_res_`,\n\n // expiration\n expirationTime: langCacheExpiredTimeMs,\n\n // language versions\n versions: versions,\n });\n }\n\n if (cdnUrl) {\n backends.push(HttpBackend);\n backendOptions.push({\n // load resources from url path\n loadPath: `${cdnUrl}/locales/{{lng}}.json`,\n // adds parameters to resource URL. 'example.com' -> 'example.com?v=1.3.5'\n queryStringParams: {\n v: `${version}.${getV(langCacheExpiredTimeMs)}`,\n },\n\n reloadInterval: langCacheExpiredTimeMs, // can be used to reload resources in a specific interval (milliseconds) (useful in server environments)\n });\n }\n\n backends.push(ResourcesToBackend(resources));\n\n // https://www.i18next.com/misc/creating-own-plugins#languagedetector\n const languageDetector: any = {\n type: 'languageDetector',\n name: 'customDetector',\n async: false,\n init: () => {\n /* use services and options */\n },\n detect: (callback: any) => {\n return lang;\n },\n };\n\n const config: InitOptions = {\n debug: debug ?? false,\n compatibilityJSON: 'v4',\n ns: ['translation'],\n defaultNS: 'translation',\n lng: lang,\n fallbackLng: fallbackLang,\n load: 'currentOnly',\n keySeparator: false,\n nonExplicitSupportedLngs: true,\n backend: {\n backends: backends,\n backendOptions: backendOptions,\n cacheHitMode: 'refreshAndUpdateStore',\n reloadInterval: langCacheExpiredTimeMs,\n refreshExpirationTime: langCacheExpiredTimeMs, // only after determined time it should trigger a refresh if necessary\n },\n react: {\n bindI18nStore: 'added', // this way, when the HttpBackend delivers new translations (thanks to refreshAndUpdateStore), the UI gets updated\n },\n interpolation: {\n escapeValue: false, // react already safes from xss\n },\n };\n\n if (!i18next.isInitialized) {\n i18next\n .use(ChainedBackend)\n .use(languageDetector)\n .use(initReactI18next) // passes i18n down to react-i18next\n .init(config, (ex, t) => {\n if (ex) {\n console.error(`Error when i18n init`, ex);\n return;\n }\n\n setInterval(() => {\n i18next.reloadResources();\n }, langCacheExpiredTimeMs);\n });\n }\n};\n\nexport { getV, initI18n };\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,mBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,2BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,0BAAA,GAAAL,sBAAA,CAAAC,OAAA;AAA8D,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,gBAAAA,CAAA;AAAA,SAAAE,QAAAC,CAAA,sCAAAD,OAAA,wBAAAE,MAAA,uBAAAA,MAAA,CAAAC,QAAA,aAAAF,CAAA,kBAAAA,CAAA,gBAAAA,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