@yusr_systems/core 2.4.0 → 6.0.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.
Files changed (2) hide show
  1. package/dist/yusr-core.js +39 -23
  2. package/package.json +1 -1
package/dist/yusr-core.js CHANGED
@@ -6,28 +6,29 @@ var n = class {
6
6
  static AuthCheckStorageItemName = "IsLoggedIn";
7
7
  static SettingStorageItemName = "Setting";
8
8
  static UnauthorizedEventName = "ApiUnauthorized";
9
- }, r = new class {
10
- getItem(e) {
11
- if (typeof window > "u") return null;
12
- let t = localStorage.getItem(e);
13
- return t ? JSON.parse(t) : null;
14
- }
15
- setItem(e, t) {
16
- typeof window > "u" || localStorage.setItem(e, JSON.stringify(t));
17
- }
18
- removeItem(e) {
19
- typeof window > "u" || localStorage.removeItem(e);
20
- }
21
- exists(e) {
22
- return typeof window > "u" ? !1 : localStorage.getItem(e) !== null;
23
- }
24
- }(), i = () => {
9
+ }, r = {
10
+ getItem: (e) => typeof window > "u" ? null : localStorage.getItem(e),
11
+ setItem: (e, t) => {
12
+ typeof window < "u" && localStorage.setItem(e, t);
13
+ },
14
+ removeItem: (e) => {
15
+ typeof window < "u" && localStorage.removeItem(e);
16
+ }
17
+ }, i = () => {
25
18
  let e = r.getItem(n.AuthCheckStorageItemName) === "true", t = r.getItem(n.LoggedInUserStorageItemName), i = r.getItem(n.SettingStorageItemName);
26
- return {
27
- isAuthenticated: e,
28
- loggedInUser: t ? JSON.parse(t) : void 0,
29
- setting: i ? JSON.parse(i) : void 0
30
- };
19
+ try {
20
+ return {
21
+ isAuthenticated: e,
22
+ loggedInUser: t ? JSON.parse(t) : void 0,
23
+ setting: i ? JSON.parse(i) : void 0
24
+ };
25
+ } catch {
26
+ return {
27
+ isAuthenticated: !1,
28
+ loggedInUser: void 0,
29
+ setting: void 0
30
+ };
31
+ }
31
32
  }, a = () => e({
32
33
  name: "auth",
33
34
  initialState: i(),
@@ -343,6 +344,21 @@ var n = class {
343
344
  static custom(e, t) {
344
345
  return (n, r) => e(n, r) ? null : t;
345
346
  }
346
- };
347
+ }, P = new class {
348
+ getItem(e) {
349
+ if (typeof window > "u") return null;
350
+ let t = localStorage.getItem(e);
351
+ return t ? JSON.parse(t) : null;
352
+ }
353
+ setItem(e, t) {
354
+ typeof window > "u" || localStorage.setItem(e, JSON.stringify(t));
355
+ }
356
+ removeItem(e) {
357
+ typeof window > "u" || localStorage.removeItem(e);
358
+ }
359
+ exists(e) {
360
+ return typeof window > "u" ? !1 : localStorage.getItem(e) !== null;
361
+ }
362
+ }();
347
363
  //#endregion
348
- export { C as ApiConstants, n as AuthConstants, E as BaseApiService, s as BaseEntity, T as BaseFilterableApiService, _ as Branch, v as BranchFilterColumns, D as BranchesApiService, O as CitiesApiService, c as City, l as CityFilterColumns, k as CountriesApiService, u as Country, d as CountryFilterColumns, A as CurrenciesApiService, f as Currency, p as FilterCondition, m as LoginRequest, y as Role, b as RoleFilterColumns, j as RolesApiService, h as StorageFile, g as StorageFileStatus, o as SystemPermissions, x as User, S as UserFilterColumns, M as UsersApiService, N as Validators, w as YusrApiHelper, a as createAuthSlice, r as localStorageService };
364
+ export { C as ApiConstants, n as AuthConstants, E as BaseApiService, s as BaseEntity, T as BaseFilterableApiService, _ as Branch, v as BranchFilterColumns, D as BranchesApiService, O as CitiesApiService, c as City, l as CityFilterColumns, k as CountriesApiService, u as Country, d as CountryFilterColumns, A as CurrenciesApiService, f as Currency, p as FilterCondition, m as LoginRequest, y as Role, b as RoleFilterColumns, j as RolesApiService, h as StorageFile, g as StorageFileStatus, o as SystemPermissions, x as User, S as UserFilterColumns, M as UsersApiService, N as Validators, w as YusrApiHelper, a as createAuthSlice, P as localStorageService };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yusr_systems/core",
3
- "version": "2.4.0",
3
+ "version": "6.0.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "publishConfig": {