@etsoo/materialui 1.6.85 → 1.6.87

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.
@@ -180,7 +180,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
180
180
  * @param refreshToken Refresh token
181
181
  * @param dispatch User state dispatch
182
182
  */
183
- userLogin(user: D, refreshToken: string, dispatch?: boolean): void;
183
+ userLogin(user: D, refreshToken: string, dispatch?: boolean): Promise<void>;
184
184
  /**
185
185
  * User login callback
186
186
  * @param user New user
@@ -190,7 +190,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
190
190
  * User login dispatch
191
191
  * @param user New user
192
192
  */
193
- protected doLoginDispatch(user: D): void;
193
+ protected doLoginDispatch(user: D): Promise<void>;
194
194
  /**
195
195
  * User logout
196
196
  * @param clearToken Clear refresh token or not
@@ -307,12 +307,12 @@ class ReactApp extends appscript_1.CoreApp {
307
307
  * @param refreshToken Refresh token
308
308
  * @param dispatch User state dispatch
309
309
  */
310
- userLogin(user, refreshToken, dispatch) {
310
+ async userLogin(user, refreshToken, dispatch) {
311
311
  // Super call, set token
312
- super.userLogin(user, refreshToken);
312
+ await super.userLogin(user, refreshToken);
313
313
  // Dispatch action
314
314
  if (dispatch !== false) {
315
- this.doLoginDispatch(user);
315
+ await this.doLoginDispatch(user);
316
316
  }
317
317
  }
318
318
  /**
@@ -326,14 +326,13 @@ class ReactApp extends appscript_1.CoreApp {
326
326
  * User login dispatch
327
327
  * @param user New user
328
328
  */
329
- doLoginDispatch(user) {
330
- this.onUserLogin(user).then(() => {
331
- if (this.userStateDispatch != null)
332
- this.userStateDispatch({
333
- type: react_2.UserActionType.Login,
334
- user
335
- });
336
- });
329
+ async doLoginDispatch(user) {
330
+ await this.onUserLogin(user);
331
+ if (this.userStateDispatch != null)
332
+ this.userStateDispatch({
333
+ type: react_2.UserActionType.Login,
334
+ user
335
+ });
337
336
  }
338
337
  /**
339
338
  * User logout
@@ -69,7 +69,7 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, S extends
69
69
  * Save core system data
70
70
  * @param data Data
71
71
  */
72
- protected saveCoreToken(data: ApiRefreshTokenDto): void;
72
+ protected saveCoreToken(data: ApiRefreshTokenDto): Promise<void>;
73
73
  /**
74
74
  * On switch organization handler
75
75
  * This method is called when the organization is switched successfully
@@ -141,21 +141,21 @@ class ServiceApp extends ReactApp_1.ReactApp {
141
141
  expiresIn: user.seconds
142
142
  };
143
143
  // Cache the core system data
144
- this.saveCoreToken(core);
144
+ await this.saveCoreToken(core);
145
145
  // User login and trigger the dispatch at last
146
- this.userLogin(user, refreshToken, dispatch);
146
+ await this.userLogin(user, refreshToken, dispatch);
147
147
  }
148
148
  /**
149
149
  * Save core system data
150
150
  * @param data Data
151
151
  */
152
- saveCoreToken(data) {
152
+ async saveCoreToken(data) {
153
153
  // Hold the core system access token
154
154
  this.coreAccessToken = data.accessToken;
155
155
  // Cache the core system refresh token
156
- this.storage.setData(coreTokenKey, this.encrypt(data.refreshToken));
156
+ this.storage.setData(coreTokenKey, await this.encrypt(data.refreshToken));
157
157
  // Exchange tokens
158
- this.exchangeTokenAll(data);
158
+ await this.exchangeTokenAll(data);
159
159
  }
160
160
  /**
161
161
  * On switch organization handler
@@ -189,11 +189,11 @@ class ServiceApp extends ReactApp_1.ReactApp {
189
189
  // Override the user data's refresh token
190
190
  const user = refreshToken ? { ...result.data, refreshToken } : result.data;
191
191
  // User login without dispatch
192
- this.userLoginEx(user, core, false);
192
+ await this.userLoginEx(user, core, false);
193
193
  // Handle the switch organization
194
194
  await this.onSwitchOrg();
195
195
  // Trigger the dispatch at last
196
- this.doLoginDispatch(user);
196
+ await this.doLoginDispatch(user);
197
197
  return result;
198
198
  }
199
199
  async refreshTokenSucceed(user, token, callback) {
@@ -221,7 +221,7 @@ class ServiceApp extends ReactApp_1.ReactApp {
221
221
  return;
222
222
  // Cache the core system refresh token
223
223
  // Follow similar logic in userLoginEx
224
- this.saveCoreToken(data);
224
+ await this.saveCoreToken(data);
225
225
  // Call the super
226
226
  await super.refreshTokenSucceed(user, token, callback);
227
227
  }
@@ -180,7 +180,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
180
180
  * @param refreshToken Refresh token
181
181
  * @param dispatch User state dispatch
182
182
  */
183
- userLogin(user: D, refreshToken: string, dispatch?: boolean): void;
183
+ userLogin(user: D, refreshToken: string, dispatch?: boolean): Promise<void>;
184
184
  /**
185
185
  * User login callback
186
186
  * @param user New user
@@ -190,7 +190,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser> extends C
190
190
  * User login dispatch
191
191
  * @param user New user
192
192
  */
193
- protected doLoginDispatch(user: D): void;
193
+ protected doLoginDispatch(user: D): Promise<void>;
194
194
  /**
195
195
  * User logout
196
196
  * @param clearToken Clear refresh token or not
@@ -299,12 +299,12 @@ export class ReactApp extends CoreApp {
299
299
  * @param refreshToken Refresh token
300
300
  * @param dispatch User state dispatch
301
301
  */
302
- userLogin(user, refreshToken, dispatch) {
302
+ async userLogin(user, refreshToken, dispatch) {
303
303
  // Super call, set token
304
- super.userLogin(user, refreshToken);
304
+ await super.userLogin(user, refreshToken);
305
305
  // Dispatch action
306
306
  if (dispatch !== false) {
307
- this.doLoginDispatch(user);
307
+ await this.doLoginDispatch(user);
308
308
  }
309
309
  }
310
310
  /**
@@ -318,14 +318,13 @@ export class ReactApp extends CoreApp {
318
318
  * User login dispatch
319
319
  * @param user New user
320
320
  */
321
- doLoginDispatch(user) {
322
- this.onUserLogin(user).then(() => {
323
- if (this.userStateDispatch != null)
324
- this.userStateDispatch({
325
- type: UserActionType.Login,
326
- user
327
- });
328
- });
321
+ async doLoginDispatch(user) {
322
+ await this.onUserLogin(user);
323
+ if (this.userStateDispatch != null)
324
+ this.userStateDispatch({
325
+ type: UserActionType.Login,
326
+ user
327
+ });
329
328
  }
330
329
  /**
331
330
  * User logout
@@ -69,7 +69,7 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, S extends
69
69
  * Save core system data
70
70
  * @param data Data
71
71
  */
72
- protected saveCoreToken(data: ApiRefreshTokenDto): void;
72
+ protected saveCoreToken(data: ApiRefreshTokenDto): Promise<void>;
73
73
  /**
74
74
  * On switch organization handler
75
75
  * This method is called when the organization is switched successfully
@@ -138,21 +138,21 @@ export class ServiceApp extends ReactApp {
138
138
  expiresIn: user.seconds
139
139
  };
140
140
  // Cache the core system data
141
- this.saveCoreToken(core);
141
+ await this.saveCoreToken(core);
142
142
  // User login and trigger the dispatch at last
143
- this.userLogin(user, refreshToken, dispatch);
143
+ await this.userLogin(user, refreshToken, dispatch);
144
144
  }
145
145
  /**
146
146
  * Save core system data
147
147
  * @param data Data
148
148
  */
149
- saveCoreToken(data) {
149
+ async saveCoreToken(data) {
150
150
  // Hold the core system access token
151
151
  this.coreAccessToken = data.accessToken;
152
152
  // Cache the core system refresh token
153
- this.storage.setData(coreTokenKey, this.encrypt(data.refreshToken));
153
+ this.storage.setData(coreTokenKey, await this.encrypt(data.refreshToken));
154
154
  // Exchange tokens
155
- this.exchangeTokenAll(data);
155
+ await this.exchangeTokenAll(data);
156
156
  }
157
157
  /**
158
158
  * On switch organization handler
@@ -186,11 +186,11 @@ export class ServiceApp extends ReactApp {
186
186
  // Override the user data's refresh token
187
187
  const user = refreshToken ? { ...result.data, refreshToken } : result.data;
188
188
  // User login without dispatch
189
- this.userLoginEx(user, core, false);
189
+ await this.userLoginEx(user, core, false);
190
190
  // Handle the switch organization
191
191
  await this.onSwitchOrg();
192
192
  // Trigger the dispatch at last
193
- this.doLoginDispatch(user);
193
+ await this.doLoginDispatch(user);
194
194
  return result;
195
195
  }
196
196
  async refreshTokenSucceed(user, token, callback) {
@@ -218,7 +218,7 @@ export class ServiceApp extends ReactApp {
218
218
  return;
219
219
  // Cache the core system refresh token
220
220
  // Follow similar logic in userLoginEx
221
- this.saveCoreToken(data);
221
+ await this.saveCoreToken(data);
222
222
  // Call the super
223
223
  await super.refreshTokenSucceed(user, token, callback);
224
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.6.85",
3
+ "version": "1.6.87",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -36,17 +36,17 @@
36
36
  },
37
37
  "homepage": "https://github.com/ETSOO/ReactMU#readme",
38
38
  "dependencies": {
39
- "@base-ui/react": "^1.7.0",
39
+ "@base-ui/react": "^1.8.0",
40
40
  "@dnd-kit/react": "^0.5.0",
41
41
  "@emotion/react": "^11.14.0",
42
42
  "@emotion/styled": "^11.14.1",
43
- "@etsoo/appscript": "^1.6.76",
43
+ "@etsoo/appscript": "^1.6.78",
44
44
  "@etsoo/notificationbase": "^1.1.75",
45
- "@etsoo/react": "^1.9.1",
45
+ "@etsoo/react": "^1.9.3",
46
46
  "@etsoo/shared": "^1.2.91",
47
47
  "@mui/icons-material": "^9.4.0",
48
48
  "@mui/material": "^9.4.0",
49
- "@mui/x-data-grid": "^9.12.0",
49
+ "@mui/x-data-grid": "^9.13.0",
50
50
  "chart.js": "^4.5.1",
51
51
  "chartjs-plugin-datalabels": "^2.2.0",
52
52
  "dompurify": "^3.4.14",
@@ -113,7 +113,8 @@ export interface IReactAppBase {
113
113
  * Core application interface
114
114
  */
115
115
  export interface IReactApp<S extends IAppSettings, D extends IUser>
116
- extends ICoreApp<D, S, React.ReactNode, NotificationReactCallProps>,
116
+ extends
117
+ ICoreApp<D, S, React.ReactNode, NotificationReactCallProps>,
117
118
  Omit<IReactAppBase, "userState"> {
118
119
  /**
119
120
  * User state
@@ -478,13 +479,17 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
478
479
  * @param refreshToken Refresh token
479
480
  * @param dispatch User state dispatch
480
481
  */
481
- override userLogin(user: D, refreshToken: string, dispatch?: boolean): void {
482
+ override async userLogin(
483
+ user: D,
484
+ refreshToken: string,
485
+ dispatch?: boolean
486
+ ): Promise<void> {
482
487
  // Super call, set token
483
- super.userLogin(user, refreshToken);
488
+ await super.userLogin(user, refreshToken);
484
489
 
485
490
  // Dispatch action
486
491
  if (dispatch !== false) {
487
- this.doLoginDispatch(user);
492
+ await this.doLoginDispatch(user);
488
493
  }
489
494
  }
490
495
 
@@ -500,14 +505,14 @@ export class ReactApp<S extends IAppSettings, D extends IUser>
500
505
  * User login dispatch
501
506
  * @param user New user
502
507
  */
503
- protected doLoginDispatch(user: D) {
504
- this.onUserLogin(user).then(() => {
505
- if (this.userStateDispatch != null)
506
- this.userStateDispatch({
507
- type: UserActionType.Login,
508
- user
509
- });
510
- });
508
+ protected async doLoginDispatch(user: D) {
509
+ await this.onUserLogin(user);
510
+
511
+ if (this.userStateDispatch != null)
512
+ this.userStateDispatch({
513
+ type: UserActionType.Login,
514
+ user
515
+ });
511
516
  }
512
517
 
513
518
  /**
@@ -188,25 +188,25 @@ export class ServiceApp<
188
188
  };
189
189
 
190
190
  // Cache the core system data
191
- this.saveCoreToken(core);
191
+ await this.saveCoreToken(core);
192
192
 
193
193
  // User login and trigger the dispatch at last
194
- this.userLogin(user, refreshToken, dispatch);
194
+ await this.userLogin(user, refreshToken, dispatch);
195
195
  }
196
196
 
197
197
  /**
198
198
  * Save core system data
199
199
  * @param data Data
200
200
  */
201
- protected saveCoreToken(data: ApiRefreshTokenDto) {
201
+ protected async saveCoreToken(data: ApiRefreshTokenDto) {
202
202
  // Hold the core system access token
203
203
  this.coreAccessToken = data.accessToken;
204
204
 
205
205
  // Cache the core system refresh token
206
- this.storage.setData(coreTokenKey, this.encrypt(data.refreshToken));
206
+ this.storage.setData(coreTokenKey, await this.encrypt(data.refreshToken));
207
207
 
208
208
  // Exchange tokens
209
- this.exchangeTokenAll(data);
209
+ await this.exchangeTokenAll(data);
210
210
  }
211
211
 
212
212
  /**
@@ -255,13 +255,13 @@ export class ServiceApp<
255
255
  const user = refreshToken ? { ...result.data, refreshToken } : result.data;
256
256
 
257
257
  // User login without dispatch
258
- this.userLoginEx(user, core, false);
258
+ await this.userLoginEx(user, core, false);
259
259
 
260
260
  // Handle the switch organization
261
261
  await this.onSwitchOrg();
262
262
 
263
263
  // Trigger the dispatch at last
264
- this.doLoginDispatch(user);
264
+ await this.doLoginDispatch(user);
265
265
 
266
266
  return result;
267
267
  }
@@ -298,7 +298,7 @@ export class ServiceApp<
298
298
 
299
299
  // Cache the core system refresh token
300
300
  // Follow similar logic in userLoginEx
301
- this.saveCoreToken(data);
301
+ await this.saveCoreToken(data);
302
302
 
303
303
  // Call the super
304
304
  await super.refreshTokenSucceed(user, token, callback);