@etsoo/react 1.5.54 → 1.5.57
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/app/CommonApp.d.ts +0 -1
- package/lib/app/CommonApp.js +1 -16
- package/lib/app/ReactApp.d.ts +6 -6
- package/lib/app/ReactApp.js +1 -1
- package/lib/app/ServiceApp.d.ts +0 -1
- package/lib/app/ServiceApp.js +1 -19
- package/package.json +10 -10
- package/src/app/CommonApp.ts +1 -18
- package/src/app/ReactApp.ts +10 -8
- package/src/app/ServiceApp.ts +1 -22
package/lib/app/CommonApp.d.ts
CHANGED
|
@@ -29,7 +29,6 @@ export declare abstract class CommonApp<U extends IUser = IUser, P extends IPage
|
|
|
29
29
|
* @param props Props
|
|
30
30
|
*/
|
|
31
31
|
refreshToken<D = RefreshTokenRQ>(props?: RefreshTokenProps<D>): Promise<boolean>;
|
|
32
|
-
private loginFailed;
|
|
33
32
|
/**
|
|
34
33
|
* Try login
|
|
35
34
|
* @param data Additional data
|
package/lib/app/CommonApp.js
CHANGED
|
@@ -127,10 +127,6 @@ export class CommonApp extends ReactApp {
|
|
|
127
127
|
}
|
|
128
128
|
return success(result, callback);
|
|
129
129
|
}
|
|
130
|
-
loginFailed() {
|
|
131
|
-
this.userUnauthorized();
|
|
132
|
-
this.toLoginPage();
|
|
133
|
-
}
|
|
134
130
|
/**
|
|
135
131
|
* Try login
|
|
136
132
|
* @param data Additional data
|
|
@@ -144,18 +140,7 @@ export class CommonApp extends ReactApp {
|
|
|
144
140
|
return false;
|
|
145
141
|
// Refresh token
|
|
146
142
|
return await this.refreshToken({
|
|
147
|
-
callback: (result) =>
|
|
148
|
-
if (result === true)
|
|
149
|
-
return;
|
|
150
|
-
const message = this.formatRefreshTokenResult(result);
|
|
151
|
-
if (message == null) {
|
|
152
|
-
this.loginFailed();
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
this.notifier.alert(message, () => {
|
|
156
|
-
this.loginFailed();
|
|
157
|
-
});
|
|
158
|
-
},
|
|
143
|
+
callback: (result) => this.doRefreshTokenResult(result),
|
|
159
144
|
data,
|
|
160
145
|
showLoading,
|
|
161
146
|
relogin: true
|
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CoreApp, IActionResult, IAppSettings, ICoreApp, IUser
|
|
1
|
+
import { CoreApp, IActionResult, IAppSettings, ICoreApp, IUser } from '@etsoo/appscript';
|
|
2
2
|
import { NotificationRenderProps, NotificationReturn } from '@etsoo/notificationbase';
|
|
3
3
|
import { DataTypes } from '@etsoo/shared';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { NotificationReactCallProps } from '../notifier/Notifier';
|
|
5
|
+
import { INotificationReact, NotificationReactCallProps } from '../notifier/Notifier';
|
|
6
6
|
import { CultureAction, CultureState } from '../states/CultureState';
|
|
7
7
|
import { IStateProps } from '../states/IState';
|
|
8
8
|
import { IPageData, PageAction, PageState } from '../states/PageState';
|
|
@@ -28,7 +28,7 @@ export declare function ReactAppStateDetector(props: IStateProps): React.Functio
|
|
|
28
28
|
/**
|
|
29
29
|
* Core application interface
|
|
30
30
|
*/
|
|
31
|
-
export interface IReactApp<S extends IAppSettings, D extends IUser, P extends IPageData> extends ICoreApp<S, React.ReactNode, NotificationReactCallProps> {
|
|
31
|
+
export interface IReactApp<S extends IAppSettings, D extends IUser, P extends IPageData> extends ICoreApp<D, S, React.ReactNode, NotificationReactCallProps> {
|
|
32
32
|
/**
|
|
33
33
|
* User state
|
|
34
34
|
*/
|
|
@@ -64,7 +64,7 @@ export interface IReactApp<S extends IAppSettings, D extends IUser, P extends IP
|
|
|
64
64
|
/**
|
|
65
65
|
* React application
|
|
66
66
|
*/
|
|
67
|
-
export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends IPageData> extends CoreApp<S, React.ReactNode, NotificationReactCallProps> implements IReactApp<S, D, P> {
|
|
67
|
+
export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends IPageData> extends CoreApp<D, S, React.ReactNode, NotificationReactCallProps> implements IReactApp<S, D, P> {
|
|
68
68
|
private static _notifierProvider;
|
|
69
69
|
/**
|
|
70
70
|
* Get notifier provider
|
|
@@ -173,7 +173,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
173
173
|
* Show input dialog
|
|
174
174
|
* @param props Props
|
|
175
175
|
*/
|
|
176
|
-
showInputDialog({ title, message, callback, ...rest }: InputDialogProps):
|
|
176
|
+
showInputDialog({ title, message, callback, ...rest }: InputDialogProps): INotificationReact;
|
|
177
177
|
/**
|
|
178
178
|
* User login extended
|
|
179
179
|
* @param user New user
|
|
@@ -181,7 +181,7 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
181
181
|
* @param keep Keep in local storage or not
|
|
182
182
|
* @param dispatch User state dispatch
|
|
183
183
|
*/
|
|
184
|
-
userLogin(user:
|
|
184
|
+
userLogin(user: D, refreshToken: string, keep?: boolean, dispatch?: boolean): void;
|
|
185
185
|
/**
|
|
186
186
|
* User logout
|
|
187
187
|
* @param clearToken Clear refresh token or not
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -250,7 +250,7 @@ export class ReactApp extends CoreApp {
|
|
|
250
250
|
* @param props Props
|
|
251
251
|
*/
|
|
252
252
|
showInputDialog({ title, message, callback, ...rest }) {
|
|
253
|
-
this.notifier.prompt(message, callback, title, rest);
|
|
253
|
+
return this.notifier.prompt(message, callback, title, rest);
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* User login extended
|
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -46,7 +46,6 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
|
|
|
46
46
|
* @param props Props
|
|
47
47
|
*/
|
|
48
48
|
refreshToken<D = RefreshTokenRQ>(props?: RefreshTokenProps<D>): Promise<boolean>;
|
|
49
|
-
private loginFailed;
|
|
50
49
|
/**
|
|
51
50
|
* Service decrypt message
|
|
52
51
|
* @param messageEncrypted Encrypted message
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -184,10 +184,6 @@ export class ServiceApp extends ReactApp {
|
|
|
184
184
|
}
|
|
185
185
|
return await success(result, callback);
|
|
186
186
|
}
|
|
187
|
-
loginFailed() {
|
|
188
|
-
this.userUnauthorized();
|
|
189
|
-
this.toLoginPage();
|
|
190
|
-
}
|
|
191
187
|
/**
|
|
192
188
|
* Service decrypt message
|
|
193
189
|
* @param messageEncrypted Encrypted message
|
|
@@ -220,21 +216,7 @@ export class ServiceApp extends ReactApp {
|
|
|
220
216
|
return false;
|
|
221
217
|
// Refresh token
|
|
222
218
|
return await this.refreshToken({
|
|
223
|
-
callback: (result) =>
|
|
224
|
-
// Success
|
|
225
|
-
if (result === true)
|
|
226
|
-
return;
|
|
227
|
-
// Clear cache
|
|
228
|
-
this.clearCacheData();
|
|
229
|
-
const message = this.formatRefreshTokenResult(result);
|
|
230
|
-
if (message == null) {
|
|
231
|
-
this.loginFailed();
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
this.notifier.alert(message, () => {
|
|
235
|
-
this.loginFailed();
|
|
236
|
-
});
|
|
237
|
-
},
|
|
219
|
+
callback: (result) => this.doRefreshTokenResult(result),
|
|
238
220
|
data,
|
|
239
221
|
showLoading,
|
|
240
222
|
relogin: true
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.57",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -49,11 +49,11 @@
|
|
|
49
49
|
"@emotion/css": "^11.10.0",
|
|
50
50
|
"@emotion/react": "^11.10.0",
|
|
51
51
|
"@emotion/styled": "^11.10.0",
|
|
52
|
-
"@etsoo/appscript": "^1.2.
|
|
52
|
+
"@etsoo/appscript": "^1.2.71",
|
|
53
53
|
"@etsoo/notificationbase": "^1.1.4",
|
|
54
54
|
"@etsoo/shared": "^1.1.40",
|
|
55
55
|
"@mui/icons-material": "^5.8.4",
|
|
56
|
-
"@mui/material": "^5.9.
|
|
56
|
+
"@mui/material": "^5.9.3",
|
|
57
57
|
"@types/pica": "^9.0.1",
|
|
58
58
|
"@types/pulltorefreshjs": "^0.1.5",
|
|
59
59
|
"@types/react": "^18.0.15",
|
|
@@ -74,16 +74,16 @@
|
|
|
74
74
|
"react-window": "^1.8.7"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@babel/cli": "^7.18.
|
|
78
|
-
"@babel/core": "^7.18.
|
|
79
|
-
"@babel/plugin-transform-runtime": "^7.18.
|
|
80
|
-
"@babel/preset-env": "^7.18.
|
|
77
|
+
"@babel/cli": "^7.18.10",
|
|
78
|
+
"@babel/core": "^7.18.10",
|
|
79
|
+
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
80
|
+
"@babel/preset-env": "^7.18.10",
|
|
81
81
|
"@babel/runtime-corejs3": "^7.18.9",
|
|
82
82
|
"@types/jest": "^28.1.6",
|
|
83
83
|
"@types/react-test-renderer": "^18.0.0",
|
|
84
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
85
|
-
"@typescript-eslint/parser": "^5.
|
|
86
|
-
"eslint": "^8.
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^5.32.0",
|
|
85
|
+
"@typescript-eslint/parser": "^5.32.0",
|
|
86
|
+
"eslint": "^8.21.0",
|
|
87
87
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
88
88
|
"eslint-plugin-import": "^2.26.0",
|
|
89
89
|
"eslint-plugin-react": "^7.30.1",
|
package/src/app/CommonApp.ts
CHANGED
|
@@ -200,11 +200,6 @@ export abstract class CommonApp<
|
|
|
200
200
|
return success(result, callback);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
private loginFailed() {
|
|
204
|
-
this.userUnauthorized();
|
|
205
|
-
this.toLoginPage();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
203
|
/**
|
|
209
204
|
* Try login
|
|
210
205
|
* @param data Additional data
|
|
@@ -221,19 +216,7 @@ export abstract class CommonApp<
|
|
|
221
216
|
|
|
222
217
|
// Refresh token
|
|
223
218
|
return await this.refreshToken({
|
|
224
|
-
callback: (result) =>
|
|
225
|
-
if (result === true) return;
|
|
226
|
-
|
|
227
|
-
const message = this.formatRefreshTokenResult(result);
|
|
228
|
-
if (message == null) {
|
|
229
|
-
this.loginFailed();
|
|
230
|
-
return;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
this.notifier.alert(message, () => {
|
|
234
|
-
this.loginFailed();
|
|
235
|
-
});
|
|
236
|
-
},
|
|
219
|
+
callback: (result) => this.doRefreshTokenResult(result),
|
|
237
220
|
data,
|
|
238
221
|
showLoading,
|
|
239
222
|
relogin: true
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -6,8 +6,7 @@ import {
|
|
|
6
6
|
IActionResult,
|
|
7
7
|
IAppSettings,
|
|
8
8
|
ICoreApp,
|
|
9
|
-
IUser
|
|
10
|
-
IUserData
|
|
9
|
+
IUser
|
|
11
10
|
} from '@etsoo/appscript';
|
|
12
11
|
import {
|
|
13
12
|
NotificationMessageType,
|
|
@@ -18,7 +17,10 @@ import { DataTypes, WindowStorage } from '@etsoo/shared';
|
|
|
18
17
|
import React from 'react';
|
|
19
18
|
import { NotifierMU } from '../mu/NotifierMU';
|
|
20
19
|
import { ProgressCount } from '../mu/ProgressCount';
|
|
21
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
INotificationReact,
|
|
22
|
+
NotificationReactCallProps
|
|
23
|
+
} from '../notifier/Notifier';
|
|
22
24
|
import { CultureAction, CultureState } from '../states/CultureState';
|
|
23
25
|
import { IStateProps } from '../states/IState';
|
|
24
26
|
import {
|
|
@@ -91,7 +93,7 @@ export interface IReactApp<
|
|
|
91
93
|
S extends IAppSettings,
|
|
92
94
|
D extends IUser,
|
|
93
95
|
P extends IPageData
|
|
94
|
-
> extends ICoreApp<S, React.ReactNode, NotificationReactCallProps> {
|
|
96
|
+
> extends ICoreApp<D, S, React.ReactNode, NotificationReactCallProps> {
|
|
95
97
|
/**
|
|
96
98
|
* User state
|
|
97
99
|
*/
|
|
@@ -139,7 +141,7 @@ export class ReactApp<
|
|
|
139
141
|
D extends IUser,
|
|
140
142
|
P extends IPageData
|
|
141
143
|
>
|
|
142
|
-
extends CoreApp<S, React.ReactNode, NotificationReactCallProps>
|
|
144
|
+
extends CoreApp<D, S, React.ReactNode, NotificationReactCallProps>
|
|
143
145
|
implements IReactApp<S, D, P>
|
|
144
146
|
{
|
|
145
147
|
private static _notifierProvider: React.FunctionComponent<NotificationRenderProps>;
|
|
@@ -433,8 +435,8 @@ export class ReactApp<
|
|
|
433
435
|
message,
|
|
434
436
|
callback,
|
|
435
437
|
...rest
|
|
436
|
-
}: InputDialogProps):
|
|
437
|
-
this.notifier.prompt<HTMLFormElement | undefined>(
|
|
438
|
+
}: InputDialogProps): INotificationReact {
|
|
439
|
+
return this.notifier.prompt<HTMLFormElement | undefined>(
|
|
438
440
|
message,
|
|
439
441
|
callback,
|
|
440
442
|
title,
|
|
@@ -450,7 +452,7 @@ export class ReactApp<
|
|
|
450
452
|
* @param dispatch User state dispatch
|
|
451
453
|
*/
|
|
452
454
|
override userLogin(
|
|
453
|
-
user:
|
|
455
|
+
user: D,
|
|
454
456
|
refreshToken: string,
|
|
455
457
|
keep?: boolean,
|
|
456
458
|
dispatch?: boolean
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -271,11 +271,6 @@ export class ServiceApp<
|
|
|
271
271
|
return await success(result, callback);
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
private loginFailed() {
|
|
275
|
-
this.userUnauthorized();
|
|
276
|
-
this.toLoginPage();
|
|
277
|
-
}
|
|
278
|
-
|
|
279
274
|
/**
|
|
280
275
|
* Service decrypt message
|
|
281
276
|
* @param messageEncrypted Encrypted message
|
|
@@ -320,23 +315,7 @@ export class ServiceApp<
|
|
|
320
315
|
|
|
321
316
|
// Refresh token
|
|
322
317
|
return await this.refreshToken({
|
|
323
|
-
callback: (result) =>
|
|
324
|
-
// Success
|
|
325
|
-
if (result === true) return;
|
|
326
|
-
|
|
327
|
-
// Clear cache
|
|
328
|
-
this.clearCacheData();
|
|
329
|
-
|
|
330
|
-
const message = this.formatRefreshTokenResult(result);
|
|
331
|
-
if (message == null) {
|
|
332
|
-
this.loginFailed();
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
this.notifier.alert(message, () => {
|
|
337
|
-
this.loginFailed();
|
|
338
|
-
});
|
|
339
|
-
},
|
|
318
|
+
callback: (result) => this.doRefreshTokenResult(result),
|
|
340
319
|
data,
|
|
341
320
|
showLoading,
|
|
342
321
|
relogin: true
|