@vocollege/app 0.0.58 → 0.0.59

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 (102) hide show
  1. package/dist/{types.d.ts → global.d.ts} +4 -0
  2. package/dist/{types.js → global.js} +0 -0
  3. package/dist/index.d.ts +3 -2
  4. package/dist/index.js +9 -3
  5. package/dist/interceptor.js +14 -9
  6. package/dist/modules/Services/I18n/I18n.js +1 -1
  7. package/dist/modules/Services/I18n/strings.json +506 -25
  8. package/dist/modules/Services/Vapor/Vapor.js +3 -1
  9. package/dist/modules/VoApi/GraphClient.d.ts +3 -2
  10. package/dist/modules/VoApi/GraphClient.js +51 -13
  11. package/dist/modules/VoApi/VoApi.d.ts +4 -1
  12. package/dist/modules/VoApi/VoApi.js +18 -2
  13. package/dist/modules/VoApi/graphql.d.ts +5 -0
  14. package/dist/modules/VoApi/graphql.js +12 -3
  15. package/dist/modules/VoApi/index.js +5 -1
  16. package/dist/modules/VoApi/mutations/acl.js +5 -5
  17. package/dist/modules/VoApi/mutations/applications.d.ts +3 -0
  18. package/dist/modules/VoApi/mutations/applications.js +12 -0
  19. package/dist/modules/VoApi/mutations/articles.js +3 -3
  20. package/dist/modules/VoApi/mutations/books.d.ts +3 -0
  21. package/dist/modules/VoApi/mutations/books.js +12 -0
  22. package/dist/modules/VoApi/mutations/cards.js +3 -3
  23. package/dist/modules/VoApi/mutations/events.js +3 -3
  24. package/dist/modules/VoApi/mutations/navigation.js +3 -3
  25. package/dist/modules/VoApi/mutations/pages.js +3 -3
  26. package/dist/modules/VoApi/mutations/queues.js +3 -3
  27. package/dist/modules/VoApi/mutations/sections.js +3 -3
  28. package/dist/modules/VoApi/mutations/settings.js +1 -1
  29. package/dist/modules/VoApi/mutations/users.js +3 -3
  30. package/dist/modules/VoApi/mutations/vodocs.js +9 -9
  31. package/dist/modules/VoApi/mutations/vogroups.d.ts +1 -0
  32. package/dist/modules/VoApi/mutations/vogroups.js +10 -9
  33. package/dist/modules/VoApi/queries/acl.js +4 -4
  34. package/dist/modules/VoApi/queries/applications.d.ts +2 -0
  35. package/dist/modules/VoApi/queries/applications.js +11 -0
  36. package/dist/modules/VoApi/queries/articles.js +2 -2
  37. package/dist/modules/VoApi/queries/books.d.ts +4 -0
  38. package/dist/modules/VoApi/queries/books.js +13 -0
  39. package/dist/modules/VoApi/queries/cards.js +2 -2
  40. package/dist/modules/VoApi/queries/events.js +2 -2
  41. package/dist/modules/VoApi/queries/help.d.ts +1 -0
  42. package/dist/modules/VoApi/queries/help.js +11 -0
  43. package/dist/modules/VoApi/queries/navigation.js +4 -4
  44. package/dist/modules/VoApi/queries/pages.js +2 -2
  45. package/dist/modules/VoApi/queries/queues.js +2 -2
  46. package/dist/modules/VoApi/queries/search.d.ts +2 -0
  47. package/dist/modules/VoApi/queries/search.js +5 -3
  48. package/dist/modules/VoApi/queries/sections.js +2 -2
  49. package/dist/modules/VoApi/queries/settings.js +1 -1
  50. package/dist/modules/VoApi/queries/users.d.ts +1 -0
  51. package/dist/modules/VoApi/queries/users.js +5 -4
  52. package/dist/modules/VoApi/queries/vodocs.js +3 -3
  53. package/dist/modules/VoApi/queries/vogroups.js +7 -7
  54. package/dist/modules/VoApp.d.ts +1 -0
  55. package/dist/modules/VoApp.js +17 -0
  56. package/dist/modules/VoAuth.d.ts +2 -1
  57. package/dist/modules/VoAuth.js +119 -38
  58. package/dist/modules/VoBase.js +2 -2
  59. package/dist/modules/VoConfig.js +9 -0
  60. package/dist/modules/VoDocs/VoDocs.js +7 -2
  61. package/dist/modules/VoGroups.d.ts +7 -0
  62. package/dist/modules/VoGroups.js +39 -0
  63. package/dist/modules/VoHelpers.d.ts +36 -1
  64. package/dist/modules/VoHelpers.js +320 -48
  65. package/dist/modules/VoRouter.js +10 -2
  66. package/dist/modules/VoUtils_REMOVE.js +9 -5
  67. package/package.json +17 -9
  68. package/src/global.ts +44 -0
  69. package/src/index.ts +3 -2
  70. package/src/interceptor.ts +15 -8
  71. package/src/modules/Services/I18n/strings.json +505 -24
  72. package/src/modules/Services/Vapor/Vapor.ts +2 -1
  73. package/src/modules/VoApi/GraphClient.ts +66 -8
  74. package/src/modules/VoApi/VoApi.ts +23 -3
  75. package/src/modules/VoApi/graphql.ts +5 -0
  76. package/src/modules/VoApi/mutations/applications.ts +27 -0
  77. package/src/modules/VoApi/mutations/books.ts +27 -0
  78. package/src/modules/VoApi/mutations/users.ts +5 -0
  79. package/src/modules/VoApi/mutations/vodocs.ts +2 -0
  80. package/src/modules/VoApi/mutations/vogroups.ts +21 -7
  81. package/src/modules/VoApi/queries/applications.ts +71 -0
  82. package/src/modules/VoApi/queries/articles.ts +1 -1
  83. package/src/modules/VoApi/queries/books.ts +101 -0
  84. package/src/modules/VoApi/queries/cards.ts +14 -1
  85. package/src/modules/VoApi/queries/events.ts +1 -1
  86. package/src/modules/VoApi/queries/help.ts +12 -0
  87. package/src/modules/VoApi/queries/navigation.ts +3 -4
  88. package/src/modules/VoApi/queries/pages.ts +1 -1
  89. package/src/modules/VoApi/queries/queues.ts +18 -1
  90. package/src/modules/VoApi/queries/search.ts +98 -1
  91. package/src/modules/VoApi/queries/sections.ts +1 -1
  92. package/src/modules/VoApi/queries/users.ts +74 -8
  93. package/src/modules/VoApi/queries/vodocs.ts +8 -4
  94. package/src/modules/VoApi/queries/vogroups.ts +40 -11
  95. package/src/modules/VoApp.ts +25 -8
  96. package/src/modules/VoAuth.ts +134 -37
  97. package/src/modules/VoConfig.ts +11 -0
  98. package/src/modules/VoDocs/VoDocs.ts +5 -0
  99. package/src/modules/VoGroups.ts +33 -0
  100. package/src/modules/VoHelpers.ts +254 -42
  101. package/src/modules/VoRouter.ts +10 -3
  102. package/src/types.ts +0 -38
@@ -5,8 +5,16 @@ export const SEARCH_CONTENT = gql`
5
5
  $search: String!
6
6
  $types: [String]
7
7
  $primaryField: String
8
+ $limit: Int
9
+ $entity: Boolean
8
10
  ) {
9
- searchContent(search: $search, types: $types, primaryField: $primaryField) {
11
+ searchContent(
12
+ search: $search
13
+ types: $types
14
+ primaryField: $primaryField
15
+ limit: $limit
16
+ entity: $entity
17
+ ) {
10
18
  id
11
19
  title
12
20
  type
@@ -19,3 +27,92 @@ export const SEARCH_CONTENT = gql`
19
27
  }
20
28
  }
21
29
  `;
30
+
31
+ export const SEARCH_USER = gql`
32
+ query SearchUser(
33
+ $search: String!
34
+ $roles: [String]
35
+ $limit: Int
36
+ $entity: Boolean
37
+ ) {
38
+ searchUser(search: $search, roles: $roles, limit: $limit, entity: $entity) {
39
+ id
40
+ name
41
+ email
42
+ firstname
43
+ lastname
44
+ type
45
+ }
46
+ }
47
+ `;
48
+
49
+ export const SEARCH_GROUP = gql`
50
+ query SearchGroup($categories: [String], $search: String!, $limit: Int) {
51
+ searchGroup(categories: $categories, search: $search, limit: $limit) {
52
+ id
53
+ name
54
+ title
55
+ category
56
+ certified
57
+ type
58
+ logo {
59
+ id
60
+ title
61
+ filename
62
+ filesize
63
+ filetype
64
+ url
65
+ }
66
+ logo2 {
67
+ id
68
+ title
69
+ filename
70
+ filesize
71
+ filetype
72
+ url
73
+ }
74
+ parentGroups {
75
+ id
76
+ name
77
+ title
78
+ logo {
79
+ id
80
+ title
81
+ filename
82
+ filesize
83
+ filetype
84
+ url
85
+ }
86
+ logo2 {
87
+ id
88
+ title
89
+ filename
90
+ filesize
91
+ filetype
92
+ url
93
+ }
94
+ parentGroups {
95
+ id
96
+ name
97
+ title
98
+ logo {
99
+ id
100
+ title
101
+ filename
102
+ filesize
103
+ filetype
104
+ url
105
+ }
106
+ logo2 {
107
+ id
108
+ title
109
+ filename
110
+ filesize
111
+ filetype
112
+ url
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+ `;
@@ -35,7 +35,7 @@ export const GET_SECTIONS = gql`
35
35
  $search: String
36
36
  $page: Int
37
37
  $limit: Int
38
- $orderBy: [GetSectionsOrderByOrderByClause]
38
+ $orderBy: [GetSectionsOrderByClause]
39
39
  ) {
40
40
  sections(search: $search, page: $page, limit: $limit, orderBy: $orderBy) {
41
41
  paginatorInfo {
@@ -12,13 +12,16 @@ export const GET_USER = gql`
12
12
  personal_number
13
13
  address1
14
14
  address2
15
- zip
16
- county
15
+ postalcode
16
+ town
17
17
  country
18
18
  phone1
19
19
  profession
20
20
  status
21
+ gdpr
21
22
  description
23
+ updated_at
24
+ created_at
22
25
  images {
23
26
  id
24
27
  title
@@ -27,18 +30,21 @@ export const GET_USER = gql`
27
30
  filetype
28
31
  url
29
32
  }
30
- updated_at
31
- created_at
32
- groups {
33
+ roles {
33
34
  id
34
- title
35
+ label
35
36
  type
36
37
  }
37
- roles {
38
+ groupRoles {
38
39
  id
39
40
  label
40
41
  type
41
42
  }
43
+ groups {
44
+ id
45
+ title
46
+ type
47
+ }
42
48
  }
43
49
  }
44
50
  `;
@@ -62,7 +68,7 @@ export const GET_USERS = gql`
62
68
  $search: String
63
69
  $page: Int
64
70
  $limit: Int
65
- $orderBy: [GetUsersOrderByOrderByClause]
71
+ $orderBy: [GetUsersOrderByClause]
66
72
  ) {
67
73
  users(search: $search, page: $page, limit: $limit, orderBy: $orderBy) {
68
74
  paginatorInfo {
@@ -76,6 +82,66 @@ export const GET_USERS = gql`
76
82
  email
77
83
  active
78
84
  status
85
+ updated_at
86
+ created_at
87
+ roles {
88
+ id
89
+ label
90
+ type
91
+ }
92
+ groupRoles {
93
+ id
94
+ label
95
+ type
96
+ }
97
+ groups {
98
+ id
99
+ name
100
+ title
101
+ }
102
+ validig {
103
+ id
104
+ }
105
+ }
106
+ }
107
+ }
108
+ `;
109
+
110
+ export const GET_ACCOUNT = gql`
111
+ query Account($id: ID!) {
112
+ user(id: $id) {
113
+ id
114
+ name
115
+ email
116
+ firstname
117
+ lastname
118
+ active
119
+ personal_number
120
+ address1
121
+ address2
122
+ postalcode
123
+ town
124
+ country
125
+ phone1
126
+ profession
127
+ status
128
+ description
129
+ workplace
130
+ gdpr
131
+ images {
132
+ id
133
+ title
134
+ filename
135
+ filesize
136
+ filetype
137
+ url
138
+ }
139
+ }
140
+ userSettings {
141
+ publicDefaultPortfolio {
142
+ id
143
+ name
144
+ disk
79
145
  }
80
146
  }
81
147
  }
@@ -5,12 +5,13 @@ export const GET_PORTFOLIO = gql`
5
5
  portfolio(id: $id) {
6
6
  id
7
7
  disk
8
+ status
8
9
  name
9
- disk
10
10
  title
11
11
  description
12
12
  created_at
13
13
  updated_at
14
+ type
14
15
  }
15
16
  }
16
17
  `;
@@ -20,7 +21,7 @@ export const GET_PORTFOLIOS = gql`
20
21
  $search: String
21
22
  $page: Int
22
23
  $limit: Int
23
- $orderBy: [GetPortfoliosOrderByOrderByClause]
24
+ $orderBy: [GetPortfoliosOrderByClause]
24
25
  ) {
25
26
  portfolios(search: $search, page: $page, limit: $limit, orderBy: $orderBy) {
26
27
  # paginatorInfo {
@@ -31,12 +32,13 @@ export const GET_PORTFOLIOS = gql`
31
32
  data {
32
33
  id
33
34
  disk
35
+ status
34
36
  name
35
- disk
36
37
  title
37
38
  description
38
39
  created_at
39
40
  updated_at
41
+ type
40
42
  }
41
43
  }
42
44
  }
@@ -49,7 +51,7 @@ export const GET_FOLDER_ELEMENTS = gql`
49
51
  $search: String
50
52
  $page: Int
51
53
  $limit: Int
52
- $orderBy: [GetFolderElementsOrderByOrderByClause]
54
+ $orderBy: [GetFolderElementsOrderByClause]
53
55
  $filetypes: [String]
54
56
  ) {
55
57
  folderElements(
@@ -97,6 +99,7 @@ export const GET_FOLDER_ELEMENTS = gql`
97
99
  description
98
100
  created_at
99
101
  updated_at
102
+ type
100
103
  }
101
104
  ... on File {
102
105
  id
@@ -112,6 +115,7 @@ export const GET_FOLDER_ELEMENTS = gql`
112
115
  updated_at
113
116
  url
114
117
  previewUrl
118
+ type
115
119
  }
116
120
  }
117
121
  }
@@ -11,6 +11,7 @@ export const GET_GROUP = gql`
11
11
  category
12
12
  docs
13
13
  website
14
+ educator_category
14
15
  certified
15
16
  status
16
17
  url
@@ -30,26 +31,51 @@ export const GET_GROUP = gql`
30
31
  filetype
31
32
  url
32
33
  }
33
- # images {
34
- # id
35
- # title
36
- # filename
37
- # filesize
38
- # filetype
39
- # url
40
- # }
34
+ logo2 {
35
+ id
36
+ title
37
+ filename
38
+ filesize
39
+ filetype
40
+ url
41
+ }
42
+ logo3 {
43
+ id
44
+ title
45
+ filename
46
+ filesize
47
+ filetype
48
+ url
49
+ }
41
50
  users {
42
51
  id
43
52
  name
44
53
  email
45
54
  firstname
46
55
  lastname
56
+ type
57
+ groupRoles {
58
+ id
59
+ label
60
+ type
61
+ }
47
62
  }
48
63
  contacts {
49
64
  id
50
65
  title
51
66
  type
52
67
  }
68
+ vopage
69
+ front_title
70
+ front_body
71
+ images {
72
+ id
73
+ title
74
+ filename
75
+ filesize
76
+ filetype
77
+ url
78
+ }
53
79
  }
54
80
  allGroups(categories: $categories) {
55
81
  id
@@ -59,10 +85,11 @@ export const GET_GROUP = gql`
59
85
  `;
60
86
 
61
87
  export const GET_AVAILABLE_GROUPS = gql`
62
- query Group($categories: [String]) {
63
- allGroups(categories: $categories) {
88
+ query Group($categories: [String], $byPassMembership: Boolean) {
89
+ allGroups(categories: $categories, byPassMembership: $byPassMembership) {
64
90
  id
65
91
  title
92
+ category
66
93
  }
67
94
  }
68
95
  `;
@@ -72,7 +99,7 @@ export const GET_GROUPS = gql`
72
99
  $search: String
73
100
  $page: Int
74
101
  $limit: Int
75
- $orderBy: [GetGroupsOrderByOrderByClause]
102
+ $orderBy: [GetGroupsOrderByClause]
76
103
  ) {
77
104
  groups(search: $search, page: $page, limit: $limit, orderBy: $orderBy) {
78
105
  paginatorInfo {
@@ -84,7 +111,9 @@ export const GET_GROUPS = gql`
84
111
  id
85
112
  name
86
113
  title
114
+ category
87
115
  status
116
+ vopage
88
117
  created_at
89
118
  updated_at
90
119
  }
@@ -1,12 +1,29 @@
1
- import VoApi from './VoApi';
2
- import VoConfig from './VoConfig';
3
- import VoRouter from './VoRouter';
1
+ import VoApi from "./VoApi";
2
+ import VoConfig from "./VoConfig";
3
+ import VoRouter from "./VoRouter";
4
+ import { localStorage } from "./VoHelpers";
5
+ import { toast } from "react-toastify";
6
+ import I18n from "./Services/I18n";
4
7
 
5
8
  class VoApp {
6
- configure(config: any, routes: any) {
7
- VoConfig.setConfig(config);
8
- VoRouter.setRoutes(routes);
9
- VoApi.init();
9
+ configure(config: any, routes: any) {
10
+ VoConfig.setConfig(config);
11
+ VoRouter.setRoutes(routes);
12
+ VoApi.init();
13
+ }
14
+ checkVersion() {
15
+ let storedVersion: any = localStorage.get("vo_app_version");
16
+ if (storedVersion) {
17
+ storedVersion = parseFloat(storedVersion);
10
18
  }
19
+ let currentVersion = parseFloat(VoConfig.get.APP_VERSION);
20
+ if (currentVersion && currentVersion !== storedVersion) {
21
+ toast.warning(I18n.get.messages.newVersionAvailable, {
22
+ autoClose: false,
23
+ });
24
+ localStorage.set("vo_app_version", `${currentVersion}`);
25
+ window.location.reload();
26
+ }
27
+ }
11
28
  }
12
- export default new VoApp();
29
+ export default new VoApp();
@@ -7,7 +7,9 @@ import VoBase from "./VoBase";
7
7
  import VoApi from "./VoApi";
8
8
  import VoRouter from "./VoRouter";
9
9
  import VoConfig from "./VoConfig";
10
- import { VoTokenType } from "../types";
10
+ import { VoTokenType } from "../global";
11
+ import VoGroups from "./VoGroups";
12
+ import JsCookies from "js-cookie";
11
13
 
12
14
  class VoAuth extends VoBase {
13
15
  state: string;
@@ -15,6 +17,7 @@ class VoAuth extends VoBase {
15
17
  challenge: string;
16
18
  user: any = null;
17
19
  ability: AnyMongoAbility;
20
+ globalAbility: AnyMongoAbility;
18
21
 
19
22
  constructor(key: string) {
20
23
  super(key);
@@ -22,6 +25,7 @@ class VoAuth extends VoBase {
22
25
  this.verifier = "";
23
26
  this.challenge = "";
24
27
  this.ability = new Ability();
28
+ this.globalAbility = new Ability();
25
29
  }
26
30
 
27
31
  get getAppLoginUrl() {
@@ -45,25 +49,39 @@ class VoAuth extends VoBase {
45
49
  const code = urlParams.get("code");
46
50
  const state = urlParams.get("state");
47
51
  const initiatedAuth = this.getInitiatedAuth();
48
- if (code && state && state === initiatedAuth.state) {
49
- let params = {
50
- grant_type: "authorization_code",
51
- client_id: VoConfig.get.AUTH_CLIENT_ID,
52
- redirect_uri: this.getAuthUrl,
53
- code_verifier: initiatedAuth.verifier,
54
- code,
55
- };
56
- const url = this.getUrl + "/token";
57
- const response = await axios.post(url, params);
58
- let state = VoConfig.get.AUTH_STORAGE_STATE || "";
59
- Helpers.localStorage.remove(state);
60
- let verifier = VoConfig.get.AUTH_STORAGE_VERIFIER || "";
61
- Helpers.localStorage.remove(verifier);
62
- this.setSession(response.data);
63
- await this.loadUser(true);
64
- resolve(true);
65
- } else {
66
- reject("Authorization failed");
52
+ try {
53
+ if (code && state && state === initiatedAuth.state) {
54
+ let params = {
55
+ grant_type: "authorization_code",
56
+ client_id: VoConfig.get.AUTH_CLIENT_ID,
57
+ redirect_uri: this.getAuthUrl,
58
+ code_verifier: initiatedAuth.verifier,
59
+ code,
60
+ };
61
+ const url = this.getUrl + "/token";
62
+ const response = await axios.post(url, params);
63
+ let state = VoConfig.get.AUTH_STORAGE_STATE || "";
64
+ // Helpers.localStorage.remove(state);
65
+ JsCookies.remove(state, {
66
+ domain: VoConfig.get.AUTH_DOMAIN,
67
+ sameSite: "Lax",
68
+ });
69
+
70
+ let verifier = VoConfig.get.AUTH_STORAGE_VERIFIER || "";
71
+ // Helpers.localStorage.remove(verifier);
72
+ JsCookies.remove(verifier, {
73
+ domain: VoConfig.get.AUTH_DOMAIN,
74
+ sameSite: "Lax",
75
+ });
76
+
77
+ this.setSession(response.data);
78
+ await this.loadUser(true);
79
+ resolve(true);
80
+ } else {
81
+ reject("Authorization failed");
82
+ }
83
+ } catch (error) {
84
+ reject(error);
67
85
  }
68
86
  });
69
87
  }
@@ -82,26 +100,72 @@ class VoAuth extends VoBase {
82
100
 
83
101
  setSession(token: any) {
84
102
  const { token_type, access_token, refresh_token, expires_in } = token;
103
+
85
104
  let refreshTokenKey = VoConfig.get.AUTH_STORAGE_REFRESH_TOKEN || "";
86
- Helpers.localStorage.set(refreshTokenKey, refresh_token);
105
+ // Helpers.localStorage.set(refreshTokenKey, refresh_token);
106
+ JsCookies.set(refreshTokenKey, refresh_token, {
107
+ expires: 20,
108
+ sameSite: "Lax",
109
+ domain: VoConfig.get.AUTH_DOMAIN,
110
+ });
111
+
87
112
  let accessTokenKey = VoConfig.get.AUTH_STORAGE_ACCESS_TOKEN || "";
88
- Helpers.localStorage.set(accessTokenKey, access_token);
113
+ // Helpers.localStorage.set(accessTokenKey, access_token);
114
+ JsCookies.set(accessTokenKey, access_token, {
115
+ expires: 20,
116
+ sameSite: "Lax",
117
+ domain: VoConfig.get.AUTH_DOMAIN,
118
+ });
119
+
89
120
  let tokenTypeKey = VoConfig.get.AUTH_STORAGE_TOKEN_TYPE || "";
90
- Helpers.localStorage.set(tokenTypeKey, token_type);
121
+ // Helpers.localStorage.set(tokenTypeKey, token_type);
122
+ JsCookies.set(tokenTypeKey, token_type, {
123
+ expires: 20,
124
+ sameSite: "Lax",
125
+ domain: VoConfig.get.AUTH_DOMAIN,
126
+ });
127
+
91
128
  let expiresInKey = VoConfig.get.AUTH_STORAGE_EXPIRES_IN || "";
92
- Helpers.localStorage.set(expiresInKey, expires_in);
129
+ // Helpers.localStorage.set(expiresInKey, expires_in);
130
+ JsCookies.set(expiresInKey, expires_in, {
131
+ expires: 20,
132
+ sameSite: "Lax",
133
+ domain: VoConfig.get.AUTH_DOMAIN,
134
+ });
135
+
93
136
  axios.defaults.headers.common["Authorization"] =
94
137
  token_type + " " + access_token;
138
+ let currentGroup = VoGroups.getCurrent(true);
139
+ axios.defaults.headers.common["VoGroup"] = currentGroup
140
+ ? currentGroup.id
141
+ : "";
95
142
  }
96
143
  resetSession() {
97
144
  let refreshTokenKey = VoConfig.get.AUTH_STORAGE_REFRESH_TOKEN || "";
98
145
  Helpers.localStorage.remove(refreshTokenKey);
146
+ JsCookies.remove(refreshTokenKey, { domain: VoConfig.get.AUTH_DOMAIN });
147
+
99
148
  let accessTokenKey = VoConfig.get.AUTH_STORAGE_ACCESS_TOKEN || "";
100
149
  Helpers.localStorage.remove(accessTokenKey);
150
+ JsCookies.remove(accessTokenKey, {
151
+ domain: VoConfig.get.AUTH_DOMAIN,
152
+ sameSite: "Lax",
153
+ });
154
+
101
155
  let tokenTypeKey = VoConfig.get.AUTH_STORAGE_TOKEN_TYPE || "";
102
156
  Helpers.localStorage.remove(tokenTypeKey);
157
+ JsCookies.remove(tokenTypeKey, {
158
+ domain: VoConfig.get.AUTH_DOMAIN,
159
+ sameSite: "Lax",
160
+ });
161
+
103
162
  let expiresInKey = VoConfig.get.AUTH_STORAGE_EXPIRES_IN || "";
104
163
  Helpers.localStorage.remove(expiresInKey);
164
+ JsCookies.remove(expiresInKey, {
165
+ domain: VoConfig.get.AUTH_DOMAIN,
166
+ sameSite: "Lax",
167
+ });
168
+
105
169
  delete axios.defaults.headers.common["Authorization"];
106
170
  }
107
171
  async refreshToken() {
@@ -136,12 +200,7 @@ class VoAuth extends VoBase {
136
200
  if (token) {
137
201
  try {
138
202
  this.setSession(token);
139
-
140
- // const response = await VoApi.getUser();
141
- // this.user = response.data.data;
142
- // this.ability.update(this.user.permissions);
143
203
  await this.loadUser(forceLoad);
144
-
145
204
  resolve(this.user);
146
205
  } catch (error) {
147
206
  reject(error);
@@ -162,6 +221,9 @@ class VoAuth extends VoBase {
162
221
  const response = await VoApi.getUser();
163
222
  this.user = response.data.data;
164
223
  this.ability.update(this.user.permissions);
224
+ if (VoGroups.getCurrent(true)) {
225
+ this.globalAbility.update(this.user.globalPermissions);
226
+ }
165
227
  }
166
228
  resolve(this.user);
167
229
  } catch (error) {
@@ -176,13 +238,21 @@ class VoAuth extends VoBase {
176
238
  getToken(): VoTokenType | void {
177
239
  try {
178
240
  let refreshTokenKey = VoConfig.get.AUTH_STORAGE_REFRESH_TOKEN || "";
179
- const refreshToken = Helpers.localStorage.get(refreshTokenKey);
241
+ // const refreshToken = Helpers.localStorage.get(refreshTokenKey);
242
+ const refreshToken = JsCookies.get(refreshTokenKey);
243
+
180
244
  let accessTokenKey = VoConfig.get.AUTH_STORAGE_ACCESS_TOKEN || "";
181
- const accessToken = Helpers.localStorage.get(accessTokenKey);
245
+ // const accessToken = Helpers.localStorage.get(accessTokenKey);
246
+ const accessToken = JsCookies.get(accessTokenKey);
247
+
182
248
  let tokenTypeKey = VoConfig.get.AUTH_STORAGE_TOKEN_TYPE || "";
183
- const tokenType = Helpers.localStorage.get(tokenTypeKey);
249
+ // const tokenType = Helpers.localStorage.get(tokenTypeKey);
250
+ const tokenType = JsCookies.get(tokenTypeKey);
251
+
184
252
  let expiresInKey = VoConfig.get.AUTH_STORAGE_EXPIRES_IN || "";
185
- const expiresIn = Helpers.localStorage.get(expiresInKey);
253
+ // const expiresIn = Helpers.localStorage.get(expiresInKey);
254
+ const expiresIn = JsCookies.get(expiresInKey);
255
+
186
256
  if (refreshToken && accessToken && tokenType && expiresIn) {
187
257
  return {
188
258
  refresh_token: refreshToken,
@@ -205,14 +275,37 @@ class VoAuth extends VoBase {
205
275
  let state = Helpers.createRandomString(40);
206
276
  let verifier = Helpers.createRandomString(128);
207
277
  let challenge = Helpers.base64Url(crypto.SHA256(verifier));
278
+
208
279
  let stateKey = VoConfig.get.AUTH_STORAGE_STATE || "";
209
- Helpers.localStorage.set(stateKey, state);
280
+ Helpers.localStorage.remove(stateKey);
281
+ JsCookies.set(stateKey, state, {
282
+ expires: 1,
283
+ sameSite: "Lax",
284
+ domain: VoConfig.get.AUTH_DOMAIN,
285
+ });
286
+
210
287
  let verifierKey = VoConfig.get.AUTH_STORAGE_VERIFIER || "";
211
- Helpers.localStorage.set(verifierKey, verifier);
288
+ Helpers.localStorage.remove(verifierKey);
289
+ JsCookies.set(verifierKey, verifier, {
290
+ expires: 1,
291
+ sameSite: "Lax",
292
+ domain: VoConfig.get.AUTH_DOMAIN,
293
+ });
294
+
212
295
  let accessTokenKey = VoConfig.get.AUTH_STORAGE_ACCESS_TOKEN || "";
213
296
  Helpers.localStorage.remove(accessTokenKey);
297
+ JsCookies.remove(accessTokenKey, {
298
+ domain: VoConfig.get.AUTH_DOMAIN,
299
+ sameSite: "Lax",
300
+ });
301
+
214
302
  let tokenTypeKey = VoConfig.get.AUTH_STORAGE_TOKEN_TYPE || "";
215
303
  Helpers.localStorage.remove(tokenTypeKey);
304
+ JsCookies.remove(tokenTypeKey, {
305
+ domain: VoConfig.get.AUTH_DOMAIN,
306
+ sameSite: "Lax",
307
+ });
308
+
216
309
  return {
217
310
  state,
218
311
  challenge,
@@ -223,9 +316,13 @@ class VoAuth extends VoBase {
223
316
  }
224
317
  getInitiatedAuth(): { state: string; verifier: string } {
225
318
  let stateKey = VoConfig.get.AUTH_STORAGE_STATE || "";
226
- const state = Helpers.localStorage.get(stateKey);
319
+ // const state = Helpers.localStorage.get(stateKey);
320
+ const state = JsCookies.get(stateKey);
321
+
227
322
  let verifierKey = VoConfig.get.AUTH_STORAGE_VERIFIER || "";
228
- const verifier = Helpers.localStorage.get(verifierKey);
323
+ // const verifier = Helpers.localStorage.get(verifierKey);
324
+ const verifier = JsCookies.get(verifierKey);
325
+
229
326
  return {
230
327
  state: state || "",
231
328
  verifier: verifier || "",