@etsoo/materialui 1.3.96 → 1.3.98
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 -8
- package/lib/app/CommonApp.js +2 -13
- package/lib/app/IServiceApp.d.ts +4 -0
- package/lib/app/ServiceApp.d.ts +4 -0
- package/lib/app/ServiceApp.js +10 -3
- package/package.json +5 -5
- package/src/app/CommonApp.ts +3 -19
- package/src/app/IServiceApp.ts +5 -0
- package/src/app/ServiceApp.ts +14 -4
package/lib/app/CommonApp.d.ts
CHANGED
|
@@ -15,14 +15,6 @@ export declare abstract class CommonApp<U extends IUser = IUser, P extends IPage
|
|
|
15
15
|
* @returns Fields
|
|
16
16
|
*/
|
|
17
17
|
protected initCallEncryptedUpdateFields(): string[];
|
|
18
|
-
/**
|
|
19
|
-
* Do user login
|
|
20
|
-
* @param data User data
|
|
21
|
-
* @param refreshToken Refresh token
|
|
22
|
-
* @param keep Keep login
|
|
23
|
-
* @returns Success data
|
|
24
|
-
*/
|
|
25
|
-
protected doUserLogin(data: U, refreshToken: string, keep: boolean): string | undefined;
|
|
26
18
|
/**
|
|
27
19
|
* Refresh token
|
|
28
20
|
* @param props Props
|
package/lib/app/CommonApp.js
CHANGED
|
@@ -20,17 +20,6 @@ export class CommonApp extends ReactApp {
|
|
|
20
20
|
fields.push(CoreConstants.FieldUserIdSaved);
|
|
21
21
|
return fields;
|
|
22
22
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Do user login
|
|
25
|
-
* @param data User data
|
|
26
|
-
* @param refreshToken Refresh token
|
|
27
|
-
* @param keep Keep login
|
|
28
|
-
* @returns Success data
|
|
29
|
-
*/
|
|
30
|
-
doUserLogin(data, refreshToken, keep) {
|
|
31
|
-
this.userLogin(data, refreshToken, keep);
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
23
|
/**
|
|
35
24
|
* Refresh token
|
|
36
25
|
* @param props Props
|
|
@@ -73,10 +62,10 @@ export class CommonApp extends ReactApp {
|
|
|
73
62
|
// Keep
|
|
74
63
|
const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
|
|
75
64
|
// User login
|
|
76
|
-
|
|
65
|
+
this.userLogin(result.data, refreshToken, keep);
|
|
77
66
|
// Callback
|
|
78
67
|
if (failCallback)
|
|
79
|
-
failCallback(true
|
|
68
|
+
failCallback(true);
|
|
80
69
|
return true;
|
|
81
70
|
};
|
|
82
71
|
// Call API
|
package/lib/app/IServiceApp.d.ts
CHANGED
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
|
|
|
19
19
|
* Core system API
|
|
20
20
|
*/
|
|
21
21
|
readonly coreApi: IApi;
|
|
22
|
+
/**
|
|
23
|
+
* Core system origin
|
|
24
|
+
*/
|
|
25
|
+
readonly coreOrigin: string;
|
|
22
26
|
/**
|
|
23
27
|
* Constructor
|
|
24
28
|
* @param settings Settings
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -21,6 +21,7 @@ export class ServiceApp extends ReactApp {
|
|
|
21
21
|
throw new Error("Core API endpont is required.");
|
|
22
22
|
}
|
|
23
23
|
this.coreEndpoint = coreEndpoint;
|
|
24
|
+
this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
|
|
24
25
|
this.coreApi = this.createApi(coreName, coreEndpoint);
|
|
25
26
|
}
|
|
26
27
|
/**
|
|
@@ -53,11 +54,17 @@ export class ServiceApp extends ReactApp {
|
|
|
53
54
|
return;
|
|
54
55
|
// Add try login flag
|
|
55
56
|
url = url.addUrlParam("tryLogin", tryLogin ?? false);
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
// Is it inside an iframe?
|
|
58
|
+
if (globalThis.self !== globalThis.parent) {
|
|
59
|
+
globalThis.parent.postMessage(["login", url], this.coreOrigin);
|
|
58
60
|
}
|
|
59
61
|
else {
|
|
60
|
-
BridgeUtils.host
|
|
62
|
+
if (BridgeUtils.host == null) {
|
|
63
|
+
globalThis.location.href = url;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
BridgeUtils.host.loadApp(coreName, url);
|
|
67
|
+
}
|
|
61
68
|
}
|
|
62
69
|
});
|
|
63
70
|
// Make sure apply new device id for new login
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.98",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,13 +50,13 @@
|
|
|
50
50
|
"@emotion/css": "^11.13.4",
|
|
51
51
|
"@emotion/react": "^11.13.3",
|
|
52
52
|
"@emotion/styled": "^11.13.0",
|
|
53
|
-
"@etsoo/appscript": "^1.5.
|
|
53
|
+
"@etsoo/appscript": "^1.5.30",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.49",
|
|
55
55
|
"@etsoo/react": "^1.7.69",
|
|
56
56
|
"@etsoo/shared": "^1.2.48",
|
|
57
57
|
"@mui/icons-material": "^6.1.3",
|
|
58
58
|
"@mui/material": "^6.1.3",
|
|
59
|
-
"@mui/x-data-grid": "^7.
|
|
59
|
+
"@mui/x-data-grid": "^7.20.0",
|
|
60
60
|
"chart.js": "^4.4.4",
|
|
61
61
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
62
62
|
"eventemitter3": "^5.0.1",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@babel/cli": "^7.25.7",
|
|
74
|
-
"@babel/core": "^7.25.
|
|
74
|
+
"@babel/core": "^7.25.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.25.7",
|
|
76
|
-
"@babel/preset-env": "^7.25.
|
|
76
|
+
"@babel/preset-env": "^7.25.8",
|
|
77
77
|
"@babel/preset-react": "^7.25.7",
|
|
78
78
|
"@babel/preset-typescript": "^7.25.7",
|
|
79
79
|
"@babel/runtime-corejs3": "^7.25.7",
|
package/src/app/CommonApp.ts
CHANGED
|
@@ -36,22 +36,6 @@ export abstract class CommonApp<
|
|
|
36
36
|
return fields;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* Do user login
|
|
41
|
-
* @param data User data
|
|
42
|
-
* @param refreshToken Refresh token
|
|
43
|
-
* @param keep Keep login
|
|
44
|
-
* @returns Success data
|
|
45
|
-
*/
|
|
46
|
-
protected doUserLogin(
|
|
47
|
-
data: U,
|
|
48
|
-
refreshToken: string,
|
|
49
|
-
keep: boolean
|
|
50
|
-
): string | undefined {
|
|
51
|
-
this.userLogin(data, refreshToken, keep);
|
|
52
|
-
return undefined;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
39
|
/**
|
|
56
40
|
* Refresh token
|
|
57
41
|
* @param props Props
|
|
@@ -91,7 +75,7 @@ export abstract class CommonApp<
|
|
|
91
75
|
// Success callback
|
|
92
76
|
const success = (
|
|
93
77
|
result: LoginResult,
|
|
94
|
-
failCallback?: (result: RefreshTokenResult
|
|
78
|
+
failCallback?: (result: RefreshTokenResult) => void
|
|
95
79
|
) => {
|
|
96
80
|
// Token
|
|
97
81
|
const refreshToken = this.getResponseToken(payload.response);
|
|
@@ -104,10 +88,10 @@ export abstract class CommonApp<
|
|
|
104
88
|
const keep = this.storage.getData(CoreConstants.FieldLoginKeep, false);
|
|
105
89
|
|
|
106
90
|
// User login
|
|
107
|
-
|
|
91
|
+
this.userLogin(result.data, refreshToken, keep);
|
|
108
92
|
|
|
109
93
|
// Callback
|
|
110
|
-
if (failCallback) failCallback(true
|
|
94
|
+
if (failCallback) failCallback(true);
|
|
111
95
|
|
|
112
96
|
return true;
|
|
113
97
|
};
|
package/src/app/IServiceApp.ts
CHANGED
package/src/app/ServiceApp.ts
CHANGED
|
@@ -36,6 +36,11 @@ export class ServiceApp<
|
|
|
36
36
|
*/
|
|
37
37
|
readonly coreApi: IApi;
|
|
38
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Core system origin
|
|
41
|
+
*/
|
|
42
|
+
readonly coreOrigin: string;
|
|
43
|
+
|
|
39
44
|
/**
|
|
40
45
|
* Constructor
|
|
41
46
|
* @param settings Settings
|
|
@@ -50,7 +55,7 @@ export class ServiceApp<
|
|
|
50
55
|
throw new Error("Core API endpont is required.");
|
|
51
56
|
}
|
|
52
57
|
this.coreEndpoint = coreEndpoint;
|
|
53
|
-
|
|
58
|
+
this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
|
|
54
59
|
this.coreApi = this.createApi(coreName, coreEndpoint);
|
|
55
60
|
}
|
|
56
61
|
|
|
@@ -86,10 +91,15 @@ export class ServiceApp<
|
|
|
86
91
|
// Add try login flag
|
|
87
92
|
url = url.addUrlParam("tryLogin", tryLogin ?? false);
|
|
88
93
|
|
|
89
|
-
|
|
90
|
-
|
|
94
|
+
// Is it inside an iframe?
|
|
95
|
+
if (globalThis.self !== globalThis.parent) {
|
|
96
|
+
globalThis.parent.postMessage(["login", url], this.coreOrigin);
|
|
91
97
|
} else {
|
|
92
|
-
BridgeUtils.host
|
|
98
|
+
if (BridgeUtils.host == null) {
|
|
99
|
+
globalThis.location.href = url;
|
|
100
|
+
} else {
|
|
101
|
+
BridgeUtils.host.loadApp(coreName, url);
|
|
102
|
+
}
|
|
93
103
|
}
|
|
94
104
|
});
|
|
95
105
|
|