@bigbinary/neeto-commons-frontend 2.0.113 → 2.0.115

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
@@ -190,6 +190,7 @@ them to read more:
190
190
  4. [Web utility functions](./docs/utils/README.md)
191
191
  5. [Default configurations](./docs/configs/README.md)
192
192
  6. [Cypress Utils](./docs/cypress/README.md)
193
+ 7. [Common constants](./docs/constants#common-constants)
193
194
 
194
195
  ## Other references
195
196
 
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var BASE_API_V1_URL = "/api/v1";
6
+ var DEFAULT_PAGE_INDEX = 1;
7
+ var DEFAULT_STALE_TIME = 3600000; // 1 hour
8
+
9
+ // Constants for translation
10
+ var TRANSLATION_SINGULAR = {
11
+ count: 1
12
+ };
13
+ var TRANSLATION_PLURAL = {
14
+ count: 2
15
+ };
16
+
17
+ exports.BASE_API_V1_URL = BASE_API_V1_URL;
18
+ exports.DEFAULT_PAGE_INDEX = DEFAULT_PAGE_INDEX;
19
+ exports.DEFAULT_STALE_TIME = DEFAULT_STALE_TIME;
20
+ exports.TRANSLATION_PLURAL = TRANSLATION_PLURAL;
21
+ exports.TRANSLATION_SINGULAR = TRANSLATION_SINGULAR;
22
+ //# sourceMappingURL=constants.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.cjs.js","sources":["src/constants/index.js"],"sourcesContent":["export const BASE_API_V1_URL = \"/api/v1\";\n\nexport const DEFAULT_PAGE_INDEX = 1;\nexport const DEFAULT_STALE_TIME = 3_600_000; // 1 hour\n\n// Constants for translation\nexport const TRANSLATION_SINGULAR = { count: 1 };\nexport const TRANSLATION_PLURAL = { count: 2 };\n"],"names":["BASE_API_V1_URL","DEFAULT_PAGE_INDEX","DEFAULT_STALE_TIME","TRANSLATION_SINGULAR","count","TRANSLATION_PLURAL"],"mappings":";;;;AAAO,IAAMA,eAAe,GAAG,UAAS;AAEjC,IAAMC,kBAAkB,GAAG,EAAC;AACtBC,IAAAA,kBAAkB,GAAG,QAAU;;AAE5C;AACO,IAAMC,oBAAoB,GAAG;AAAEC,EAAAA,KAAK,EAAE,CAAA;AAAE,EAAC;AACzC,IAAMC,kBAAkB,GAAG;AAAED,EAAAA,KAAK,EAAE,CAAA;AAAE;;;;;;;;"}
package/constants.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export const BASE_API_V1_URL: string;
2
+ export const DEFAULT_PAGE_INDEX: number;
3
+ export const DEFAULT_STALE_TIME: number;
4
+ export const TRANSLATION_SINGULAR: { count: number };
5
+ export const TRANSLATION_PLURAL: { count: number };
package/constants.js ADDED
@@ -0,0 +1,14 @@
1
+ var BASE_API_V1_URL = "/api/v1";
2
+ var DEFAULT_PAGE_INDEX = 1;
3
+ var DEFAULT_STALE_TIME = 3600000; // 1 hour
4
+
5
+ // Constants for translation
6
+ var TRANSLATION_SINGULAR = {
7
+ count: 1
8
+ };
9
+ var TRANSLATION_PLURAL = {
10
+ count: 2
11
+ };
12
+
13
+ export { BASE_API_V1_URL, DEFAULT_PAGE_INDEX, DEFAULT_STALE_TIME, TRANSLATION_PLURAL, TRANSLATION_SINGULAR };
14
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sources":["src/constants/index.js"],"sourcesContent":["export const BASE_API_V1_URL = \"/api/v1\";\n\nexport const DEFAULT_PAGE_INDEX = 1;\nexport const DEFAULT_STALE_TIME = 3_600_000; // 1 hour\n\n// Constants for translation\nexport const TRANSLATION_SINGULAR = { count: 1 };\nexport const TRANSLATION_PLURAL = { count: 2 };\n"],"names":["BASE_API_V1_URL","DEFAULT_PAGE_INDEX","DEFAULT_STALE_TIME","TRANSLATION_SINGULAR","count","TRANSLATION_PLURAL"],"mappings":"AAAO,IAAMA,eAAe,GAAG,UAAS;AAEjC,IAAMC,kBAAkB,GAAG,EAAC;AACtBC,IAAAA,kBAAkB,GAAG,QAAU;;AAE5C;AACO,IAAMC,oBAAoB,GAAG;AAAEC,EAAAA,KAAK,EAAE,CAAA;AAAE,EAAC;AACzC,IAAMC,kBAAkB,GAAG;AAAED,EAAAA,KAAK,EAAE,CAAA;AAAE;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "2.0.113",
3
+ "version": "2.0.115",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",
@@ -29,6 +29,7 @@
29
29
  "cypress-commands.*",
30
30
  "utils.*",
31
31
  "pure.*",
32
+ "constants.*",
32
33
  "configs",
33
34
  "cypress-configs"
34
35
  ],
@@ -63,6 +64,11 @@
63
64
  "require": "./initializers.cjs.js",
64
65
  "types": "./initializers.d.ts"
65
66
  },
67
+ "./constants": {
68
+ "import": "./constants.js",
69
+ "require": "./constants.cjs.js",
70
+ "types": "./constants.d.ts"
71
+ },
66
72
  "./configs/*": "./configs/*",
67
73
  "./cypress-configs/*": "./cypress-configs/*"
68
74
  },
@@ -3542,8 +3542,13 @@ var useKeyboardShortcutsPaneState = function useKeyboardShortcutsPaneState() {
3542
3542
  };
3543
3543
 
3544
3544
  var getStorageValue = function getStorageValue(key, defaultValue) {
3545
- if (key in localStorage) return JSON.parse(localStorage.getItem(key));
3546
- return defaultValue;
3545
+ try {
3546
+ var storedValue = localStorage.getItem(key);
3547
+ return storedValue ? JSON.parse(storedValue) : defaultValue;
3548
+ } catch (error) {
3549
+ logger.error(error);
3550
+ return defaultValue;
3551
+ }
3547
3552
  };
3548
3553
  var useLocalStorage = function useLocalStorage(key, defaultValue) {
3549
3554
  var _useState = React.useState(function () {