@janiscommerce/app-tracking-shift 1.4.0-beta.4 → 1.4.0

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/lib/Shift.js CHANGED
@@ -184,7 +184,6 @@ class Shift {
184
184
  const {id: shiftId = ''} = shift || {};
185
185
  const endDate = date || new Date().toISOString();
186
186
 
187
- this.status = 'closed';
188
187
  this.data = {
189
188
  ...this.data,
190
189
  endDate,
@@ -6,13 +6,13 @@ import errorParser from '../../utils/errorParser';
6
6
  export const useStorageValue = (key, defaultValue = null) => {
7
7
  const readValue = useCallback(() => {
8
8
  try {
9
- return Storage.get(key) || defaultValue;
9
+ return Storage.get(key) ?? defaultValue;
10
10
  } catch (error) {
11
11
  const parsedError = errorParser(error);
12
12
  Crashlytics.recordError(parsedError, `[useStorageValue] Error with key: ${key}`);
13
13
  return defaultValue;
14
14
  }
15
- }, [key]);
15
+ }, [key, defaultValue]);
16
16
 
17
17
  const [value, setValue] = useState(readValue);
18
18
 
@@ -9,7 +9,7 @@ const getStaffAuthorizationData = () => {
9
9
  hasStaffAuthorization = false,
10
10
  expirationTime = 0,
11
11
  isExpired = false,
12
- } = Storage.get(STAFF_AUTH);
12
+ } = Storage.get(STAFF_AUTH) || {};
13
13
 
14
14
  return {
15
15
  hasStaffAuthorization,
@@ -16,12 +16,12 @@ import errorParser from '../../errorParser';
16
16
  const getWorkLogTypesData = () => {
17
17
  try {
18
18
  Crashlytics.log('getWorkLogTypesData');
19
- const {workLogTypes = [], expirationTime = 0} = Storage.get(WORKLOG_TYPES_DATA);
19
+ const {workLogTypes = [], expirationTime = 0} = Storage.get(WORKLOG_TYPES_DATA) || {};
20
20
 
21
21
  return {
22
22
  workLogTypes,
23
23
  expirationTime,
24
- isExpired: expirationTime <= Date.now() || !workLogTypes.length,
24
+ isExpired: expirationTime <= Date.now() || !workLogTypes?.length,
25
25
  };
26
26
  } catch (error) {
27
27
  const parsedError = errorParser(error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@janiscommerce/app-tracking-shift",
3
- "version": "1.4.0-beta.4",
3
+ "version": "1.4.0",
4
4
  "main": "lib/index.js",
5
5
  "module": "lib/index.js",
6
6
  "exports": {