@jetthai/cuora 1.0.193 → 1.0.195-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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [1.0.195-1](https://github.com/jetthai/cuora-module/compare/v1.0.195...v1.0.195-1) (2022-11-09)
6
+
7
+ ### [1.0.195](https://github.com/jetthai/cuora-module/compare/v1.0.194...v1.0.195) (2022-10-28)
8
+
9
+ ### [1.0.194](https://github.com/jetthai/cuora-module/compare/v1.0.193...v1.0.194) (2022-10-28)
10
+
5
11
  ### [1.0.193](https://github.com/jetthai/cuora-module/compare/v1.0.192...v1.0.193) (2022-10-26)
6
12
 
7
13
  ### [1.0.192](https://github.com/jetthai/cuora-module/compare/v1.0.191...v1.0.192) (2022-10-26)
package/dist/bundle.mjs CHANGED
@@ -7366,7 +7366,6 @@ function sign_in_activity (request) {
7366
7366
  {
7367
7367
  actions: {
7368
7368
  setActivityNo: assign((context, event) => {
7369
- console.log('Event:', event.data);
7370
7369
  return {
7371
7370
  activityNo: event.data,
7372
7371
  }
@@ -7744,42 +7743,33 @@ var urlJoin = {exports: {}};
7744
7743
 
7745
7744
  var urljoin = urlJoin.exports;
7746
7745
 
7747
- // import Cookies from 'universal-cookie'
7746
+ var storage = {
7747
+ get(name, options) {
7748
+ const itemStr = localStorage.getItem(name);
7748
7749
 
7749
- // const cookies = new Cookies()
7750
+ if (!itemStr) {
7751
+ return null
7752
+ }
7750
7753
 
7751
- var storage = {
7752
- get(name, options) {
7753
- //return cookies.get(name, options)
7754
-
7755
- const itemStr = localStorage.getItem(name);
7756
-
7757
- if (!itemStr) {
7758
- return null
7759
- }
7760
-
7761
- const item = JSON.parse(itemStr);
7762
- if (new Date().getTime() > item.expiry) {
7763
- localStorage.removeItem(name);
7764
- return null
7765
- }
7766
-
7767
- return item.value
7768
- },
7769
- set(name, value, options) {
7770
- // cookies.set(name, value, options)
7754
+ const item = JSON.parse(itemStr);
7755
+ if (item.expiry && new Date().getTime() > item.expiry) {
7756
+ localStorage.removeItem(name);
7757
+ return null
7758
+ }
7771
7759
 
7772
- const item = {
7773
- value,
7774
- expiry: new Date().getTime() + (options.maxAge || 0)*1000
7775
- };
7776
- localStorage.setItem(name, JSON.stringify(item));
7777
- },
7778
- remove(name, options) {
7779
- // cookies.remove(name, options)
7780
-
7781
- localStorage.removeItem(name);
7782
- }
7760
+ return item.value
7761
+ },
7762
+ set(name, value, options) {
7763
+ const item = {value};
7764
+
7765
+ if (options?.maxAge) {
7766
+ item.expiry = new Date().getTime() + options.maxAge * 1000;
7767
+ }
7768
+ localStorage.setItem(name, JSON.stringify(item));
7769
+ },
7770
+ remove(name, options) {
7771
+ localStorage.removeItem(name);
7772
+ }
7783
7773
  };
7784
7774
 
7785
7775
  /*! *****************************************************************************
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetthai/cuora",
3
- "version": "1.0.193",
3
+ "version": "1.0.195-1",
4
4
  "description": "",
5
5
  "main": "./src/index.js",
6
6
  "type": "module",
@@ -23,7 +23,7 @@
23
23
  "standard-version": "^9.3.1"
24
24
  },
25
25
  "dependencies": {
26
- "@fingerprintjs/fingerprintjs-pro": "^3.5.7",
26
+ "@fingerprintjs/fingerprintjs-pro": "^3.8.0",
27
27
  "lodash": "^4.17.21",
28
28
  "ua-parser-js": "^0.7.28",
29
29
  "universal-cookie": "^4.0.4",
@@ -1,37 +1,28 @@
1
- // import Cookies from 'universal-cookie'
1
+ export default {
2
+ get(name, options) {
3
+ const itemStr = localStorage.getItem(name)
2
4
 
3
- // const cookies = new Cookies()
5
+ if (!itemStr) {
6
+ return null
7
+ }
4
8
 
5
- export default {
6
- get(name, options) {
7
- //return cookies.get(name, options)
8
-
9
- const itemStr = localStorage.getItem(name)
10
-
11
- if (!itemStr) {
12
- return null
13
- }
14
-
15
- const item = JSON.parse(itemStr)
16
- if (new Date().getTime() > item.expiry) {
17
- localStorage.removeItem(name)
18
- return null
19
- }
20
-
21
- return item.value
22
- },
23
- set(name, value, options) {
24
- // cookies.set(name, value, options)
9
+ const item = JSON.parse(itemStr)
10
+ if (item.expiry && new Date().getTime() > item.expiry) {
11
+ localStorage.removeItem(name)
12
+ return null
13
+ }
14
+
15
+ return item.value
16
+ },
17
+ set(name, value, options) {
18
+ const item = {value}
25
19
 
26
- const item = {
27
- value,
28
- expiry: new Date().getTime() + (options.maxAge || 0)*1000
20
+ if (options?.maxAge) {
21
+ item.expiry = new Date().getTime() + options.maxAge * 1000
22
+ }
23
+ localStorage.setItem(name, JSON.stringify(item))
24
+ },
25
+ remove(name, options) {
26
+ localStorage.removeItem(name)
29
27
  }
30
- localStorage.setItem(name, JSON.stringify(item))
31
- },
32
- remove(name, options) {
33
- // cookies.remove(name, options)
34
-
35
- localStorage.removeItem(name)
36
- }
37
28
  }