@etsoo/materialui 1.4.80 → 1.4.82
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/cjs/app/IServiceApp.d.ts +5 -0
- package/lib/cjs/app/ServiceApp.d.ts +5 -0
- package/lib/cjs/app/ServiceApp.js +14 -23
- package/lib/mjs/app/IServiceApp.d.ts +5 -0
- package/lib/mjs/app/ServiceApp.d.ts +5 -0
- package/lib/mjs/app/ServiceApp.js +14 -23
- package/package.json +8 -8
- package/src/app/IServiceApp.ts +6 -0
- package/src/app/ServiceApp.ts +23 -29
|
@@ -19,6 +19,11 @@ export interface IServiceApp extends ReactAppType {
|
|
|
19
19
|
* @param tryLogin Try login or not
|
|
20
20
|
*/
|
|
21
21
|
loadCore(tryLogin?: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* Load URL with core origin
|
|
24
|
+
* @param url URL
|
|
25
|
+
*/
|
|
26
|
+
loadUrlEx(url: string): void;
|
|
22
27
|
/**
|
|
23
28
|
* Switch organization
|
|
24
29
|
* @param organizationId Organization ID
|
|
@@ -41,6 +41,11 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, S extends
|
|
|
41
41
|
* @param data Login parameters
|
|
42
42
|
*/
|
|
43
43
|
toLoginPage(data?: AppLoginParams): void;
|
|
44
|
+
/**
|
|
45
|
+
* Load URL with core origin
|
|
46
|
+
* @param url URL
|
|
47
|
+
*/
|
|
48
|
+
loadUrlEx(url: string): void;
|
|
44
49
|
/**
|
|
45
50
|
* Signout, with userLogout and toLoginPage
|
|
46
51
|
* @param action Callback
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ServiceApp = void 0;
|
|
4
4
|
const appscript_1 = require("@etsoo/appscript");
|
|
5
5
|
const ReactApp_1 = require("./ReactApp");
|
|
6
|
-
const coreName = "core";
|
|
7
6
|
const coreTokenKey = "core-refresh-token";
|
|
8
7
|
const tryLoginKey = "tryLogin";
|
|
9
8
|
/**
|
|
@@ -34,13 +33,14 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
34
33
|
*/
|
|
35
34
|
constructor(settings, name, debug = false) {
|
|
36
35
|
super(settings, name, debug);
|
|
37
|
-
|
|
36
|
+
// Custom core API name can be done with override this.coreName
|
|
37
|
+
const coreEndpoint = this.settings.endpoints?.[this.coreName];
|
|
38
38
|
if (coreEndpoint == null) {
|
|
39
39
|
throw new Error("Core API endpont is required.");
|
|
40
40
|
}
|
|
41
41
|
this.coreEndpoint = coreEndpoint;
|
|
42
42
|
this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
|
|
43
|
-
this.coreApi = this.createApi(coreName, coreEndpoint);
|
|
43
|
+
this.coreApi = this.createApi(this.coreName, coreEndpoint);
|
|
44
44
|
this.keepLogin = true;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
@@ -58,7 +58,7 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
58
58
|
const startUrl = tryLogin
|
|
59
59
|
? undefined
|
|
60
60
|
: "".addUrlParam(tryLoginKey, tryLogin);
|
|
61
|
-
appscript_1.BridgeUtils.host.loadApp(coreName, startUrl);
|
|
61
|
+
appscript_1.BridgeUtils.host.loadApp(this.coreName, startUrl);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
/**
|
|
@@ -71,34 +71,25 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
71
71
|
// Cache current URL
|
|
72
72
|
this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
|
|
73
73
|
// Get the redirect URL
|
|
74
|
-
new appscript_1.AuthApi(this)
|
|
75
|
-
.getLogInUrl({
|
|
76
|
-
region: this.region,
|
|
77
|
-
device: this.deviceId
|
|
78
|
-
})
|
|
79
|
-
.then((url) => {
|
|
74
|
+
new appscript_1.AuthApi(this).getLogInUrl().then((url) => {
|
|
80
75
|
if (!url)
|
|
81
76
|
return;
|
|
82
77
|
// Add try login flag
|
|
83
78
|
if (params != null) {
|
|
84
79
|
url = url.addUrlParams(params);
|
|
85
80
|
}
|
|
86
|
-
|
|
87
|
-
if (this.embedded) {
|
|
88
|
-
globalThis.parent.postMessage(["login", url], this.coreOrigin);
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
if (appscript_1.BridgeUtils.host == null) {
|
|
92
|
-
globalThis.location.href = url;
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
95
|
-
appscript_1.BridgeUtils.host.loadApp(coreName, url);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
81
|
+
this.loadUrlEx(url);
|
|
98
82
|
});
|
|
99
83
|
// Make sure apply new device id for new login
|
|
100
84
|
this.clearDeviceId();
|
|
101
85
|
}
|
|
86
|
+
/**
|
|
87
|
+
* Load URL with core origin
|
|
88
|
+
* @param url URL
|
|
89
|
+
*/
|
|
90
|
+
loadUrlEx(url) {
|
|
91
|
+
super.loadUrl(url, this.coreOrigin);
|
|
92
|
+
}
|
|
102
93
|
/**
|
|
103
94
|
* Signout, with userLogout and toLoginPage
|
|
104
95
|
* @param action Callback
|
|
@@ -151,7 +142,7 @@ class ServiceApp extends ReactApp_1.ReactApp {
|
|
|
151
142
|
// Cache the core system refresh token
|
|
152
143
|
this.storage.setData(coreTokenKey, this.encrypt(data.refreshToken));
|
|
153
144
|
// Exchange tokens
|
|
154
|
-
this.exchangeTokenAll(data
|
|
145
|
+
this.exchangeTokenAll(data);
|
|
155
146
|
}
|
|
156
147
|
/**
|
|
157
148
|
* Switch organization
|
|
@@ -19,6 +19,11 @@ export interface IServiceApp extends ReactAppType {
|
|
|
19
19
|
* @param tryLogin Try login or not
|
|
20
20
|
*/
|
|
21
21
|
loadCore(tryLogin?: boolean): void;
|
|
22
|
+
/**
|
|
23
|
+
* Load URL with core origin
|
|
24
|
+
* @param url URL
|
|
25
|
+
*/
|
|
26
|
+
loadUrlEx(url: string): void;
|
|
22
27
|
/**
|
|
23
28
|
* Switch organization
|
|
24
29
|
* @param organizationId Organization ID
|
|
@@ -41,6 +41,11 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, S extends
|
|
|
41
41
|
* @param data Login parameters
|
|
42
42
|
*/
|
|
43
43
|
toLoginPage(data?: AppLoginParams): void;
|
|
44
|
+
/**
|
|
45
|
+
* Load URL with core origin
|
|
46
|
+
* @param url URL
|
|
47
|
+
*/
|
|
48
|
+
loadUrlEx(url: string): void;
|
|
44
49
|
/**
|
|
45
50
|
* Signout, with userLogout and toLoginPage
|
|
46
51
|
* @param action Callback
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AuthApi, BridgeUtils } from "@etsoo/appscript";
|
|
2
2
|
import { ReactApp } from "./ReactApp";
|
|
3
|
-
const coreName = "core";
|
|
4
3
|
const coreTokenKey = "core-refresh-token";
|
|
5
4
|
const tryLoginKey = "tryLogin";
|
|
6
5
|
/**
|
|
@@ -31,13 +30,14 @@ export class ServiceApp extends ReactApp {
|
|
|
31
30
|
*/
|
|
32
31
|
constructor(settings, name, debug = false) {
|
|
33
32
|
super(settings, name, debug);
|
|
34
|
-
|
|
33
|
+
// Custom core API name can be done with override this.coreName
|
|
34
|
+
const coreEndpoint = this.settings.endpoints?.[this.coreName];
|
|
35
35
|
if (coreEndpoint == null) {
|
|
36
36
|
throw new Error("Core API endpont is required.");
|
|
37
37
|
}
|
|
38
38
|
this.coreEndpoint = coreEndpoint;
|
|
39
39
|
this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
|
|
40
|
-
this.coreApi = this.createApi(coreName, coreEndpoint);
|
|
40
|
+
this.coreApi = this.createApi(this.coreName, coreEndpoint);
|
|
41
41
|
this.keepLogin = true;
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
@@ -55,7 +55,7 @@ export class ServiceApp extends ReactApp {
|
|
|
55
55
|
const startUrl = tryLogin
|
|
56
56
|
? undefined
|
|
57
57
|
: "".addUrlParam(tryLoginKey, tryLogin);
|
|
58
|
-
BridgeUtils.host.loadApp(coreName, startUrl);
|
|
58
|
+
BridgeUtils.host.loadApp(this.coreName, startUrl);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
/**
|
|
@@ -68,34 +68,25 @@ export class ServiceApp extends ReactApp {
|
|
|
68
68
|
// Cache current URL
|
|
69
69
|
this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
|
|
70
70
|
// Get the redirect URL
|
|
71
|
-
new AuthApi(this)
|
|
72
|
-
.getLogInUrl({
|
|
73
|
-
region: this.region,
|
|
74
|
-
device: this.deviceId
|
|
75
|
-
})
|
|
76
|
-
.then((url) => {
|
|
71
|
+
new AuthApi(this).getLogInUrl().then((url) => {
|
|
77
72
|
if (!url)
|
|
78
73
|
return;
|
|
79
74
|
// Add try login flag
|
|
80
75
|
if (params != null) {
|
|
81
76
|
url = url.addUrlParams(params);
|
|
82
77
|
}
|
|
83
|
-
|
|
84
|
-
if (this.embedded) {
|
|
85
|
-
globalThis.parent.postMessage(["login", url], this.coreOrigin);
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
if (BridgeUtils.host == null) {
|
|
89
|
-
globalThis.location.href = url;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
BridgeUtils.host.loadApp(coreName, url);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
78
|
+
this.loadUrlEx(url);
|
|
95
79
|
});
|
|
96
80
|
// Make sure apply new device id for new login
|
|
97
81
|
this.clearDeviceId();
|
|
98
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Load URL with core origin
|
|
85
|
+
* @param url URL
|
|
86
|
+
*/
|
|
87
|
+
loadUrlEx(url) {
|
|
88
|
+
super.loadUrl(url, this.coreOrigin);
|
|
89
|
+
}
|
|
99
90
|
/**
|
|
100
91
|
* Signout, with userLogout and toLoginPage
|
|
101
92
|
* @param action Callback
|
|
@@ -148,7 +139,7 @@ export class ServiceApp extends ReactApp {
|
|
|
148
139
|
// Cache the core system refresh token
|
|
149
140
|
this.storage.setData(coreTokenKey, this.encrypt(data.refreshToken));
|
|
150
141
|
// Exchange tokens
|
|
151
|
-
this.exchangeTokenAll(data
|
|
142
|
+
this.exchangeTokenAll(data);
|
|
152
143
|
}
|
|
153
144
|
/**
|
|
154
145
|
* Switch organization
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/materialui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.82",
|
|
4
4
|
"description": "TypeScript Material-UI Implementation",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
"@dnd-kit/sortable": "^10.0.0",
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
42
|
"@emotion/styled": "^11.14.0",
|
|
43
|
-
"@etsoo/appscript": "^1.6.
|
|
43
|
+
"@etsoo/appscript": "^1.6.6",
|
|
44
44
|
"@etsoo/notificationbase": "^1.1.58",
|
|
45
|
-
"@etsoo/react": "^1.8.
|
|
45
|
+
"@etsoo/react": "^1.8.30",
|
|
46
46
|
"@etsoo/shared": "^1.2.61",
|
|
47
47
|
"@mui/icons-material": "^6.4.4",
|
|
48
48
|
"@mui/material": "^6.4.4",
|
|
49
|
-
"@mui/x-data-grid": "^7.
|
|
49
|
+
"@mui/x-data-grid": "^7.27.0",
|
|
50
50
|
"chart.js": "^4.4.7",
|
|
51
51
|
"chartjs-plugin-datalabels": "^2.2.0",
|
|
52
52
|
"eventemitter3": "^5.0.1",
|
|
@@ -66,12 +66,12 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@babel/cli": "^7.26.4",
|
|
69
|
-
"@babel/core": "^7.26.
|
|
70
|
-
"@babel/plugin-transform-runtime": "^7.26.
|
|
71
|
-
"@babel/preset-env": "^7.26.
|
|
69
|
+
"@babel/core": "^7.26.9",
|
|
70
|
+
"@babel/plugin-transform-runtime": "^7.26.9",
|
|
71
|
+
"@babel/preset-env": "^7.26.9",
|
|
72
72
|
"@babel/preset-react": "^7.26.3",
|
|
73
73
|
"@babel/preset-typescript": "^7.26.0",
|
|
74
|
-
"@babel/runtime-corejs3": "^7.26.
|
|
74
|
+
"@babel/runtime-corejs3": "^7.26.9",
|
|
75
75
|
"@testing-library/react": "^16.2.0",
|
|
76
76
|
"@types/pica": "^9.0.5",
|
|
77
77
|
"@types/pulltorefreshjs": "^0.1.7",
|
package/src/app/IServiceApp.ts
CHANGED
|
@@ -23,6 +23,12 @@ export interface IServiceApp extends ReactAppType {
|
|
|
23
23
|
*/
|
|
24
24
|
loadCore(tryLogin?: boolean): void;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Load URL with core origin
|
|
28
|
+
* @param url URL
|
|
29
|
+
*/
|
|
30
|
+
loadUrlEx(url: string): void;
|
|
31
|
+
|
|
26
32
|
/**
|
|
27
33
|
* Switch organization
|
|
28
34
|
* @param organizationId Organization ID
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -14,7 +14,6 @@ import { IServiceUser, ServiceUserToken } from "./IServiceUser";
|
|
|
14
14
|
import { ReactApp } from "./ReactApp";
|
|
15
15
|
import { IActionResult } from "@etsoo/shared";
|
|
16
16
|
|
|
17
|
-
const coreName = "core";
|
|
18
17
|
const coreTokenKey = "core-refresh-token";
|
|
19
18
|
const tryLoginKey = "tryLogin";
|
|
20
19
|
|
|
@@ -57,13 +56,14 @@ export class ServiceApp<
|
|
|
57
56
|
constructor(settings: S, name: string, debug: boolean = false) {
|
|
58
57
|
super(settings, name, debug);
|
|
59
58
|
|
|
60
|
-
|
|
59
|
+
// Custom core API name can be done with override this.coreName
|
|
60
|
+
const coreEndpoint = this.settings.endpoints?.[this.coreName];
|
|
61
61
|
if (coreEndpoint == null) {
|
|
62
62
|
throw new Error("Core API endpont is required.");
|
|
63
63
|
}
|
|
64
64
|
this.coreEndpoint = coreEndpoint;
|
|
65
65
|
this.coreOrigin = new URL(coreEndpoint.webUrl).origin;
|
|
66
|
-
this.coreApi = this.createApi(coreName, coreEndpoint);
|
|
66
|
+
this.coreApi = this.createApi(this.coreName, coreEndpoint);
|
|
67
67
|
|
|
68
68
|
this.keepLogin = true;
|
|
69
69
|
}
|
|
@@ -81,7 +81,7 @@ export class ServiceApp<
|
|
|
81
81
|
const startUrl = tryLogin
|
|
82
82
|
? undefined
|
|
83
83
|
: "".addUrlParam(tryLoginKey, tryLogin);
|
|
84
|
-
BridgeUtils.host.loadApp(coreName, startUrl);
|
|
84
|
+
BridgeUtils.host.loadApp(this.coreName, startUrl);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
@@ -97,35 +97,29 @@ export class ServiceApp<
|
|
|
97
97
|
this.cachedUrl = removeUrl ? undefined : globalThis.location.href;
|
|
98
98
|
|
|
99
99
|
// Get the redirect URL
|
|
100
|
-
new AuthApi(this)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
url = url.addUrlParams(params);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// Is it embeded?
|
|
114
|
-
if (this.embedded) {
|
|
115
|
-
globalThis.parent.postMessage(["login", url], this.coreOrigin);
|
|
116
|
-
} else {
|
|
117
|
-
if (BridgeUtils.host == null) {
|
|
118
|
-
globalThis.location.href = url;
|
|
119
|
-
} else {
|
|
120
|
-
BridgeUtils.host.loadApp(coreName, url);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
});
|
|
100
|
+
new AuthApi(this).getLogInUrl().then((url) => {
|
|
101
|
+
if (!url) return;
|
|
102
|
+
|
|
103
|
+
// Add try login flag
|
|
104
|
+
if (params != null) {
|
|
105
|
+
url = url.addUrlParams(params);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.loadUrlEx(url);
|
|
109
|
+
});
|
|
124
110
|
|
|
125
111
|
// Make sure apply new device id for new login
|
|
126
112
|
this.clearDeviceId();
|
|
127
113
|
}
|
|
128
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Load URL with core origin
|
|
117
|
+
* @param url URL
|
|
118
|
+
*/
|
|
119
|
+
loadUrlEx(url: string) {
|
|
120
|
+
super.loadUrl(url, this.coreOrigin);
|
|
121
|
+
}
|
|
122
|
+
|
|
129
123
|
/**
|
|
130
124
|
* Signout, with userLogout and toLoginPage
|
|
131
125
|
* @param action Callback
|
|
@@ -194,7 +188,7 @@ export class ServiceApp<
|
|
|
194
188
|
this.storage.setData(coreTokenKey, this.encrypt(data.refreshToken));
|
|
195
189
|
|
|
196
190
|
// Exchange tokens
|
|
197
|
-
this.exchangeTokenAll(data
|
|
191
|
+
this.exchangeTokenAll(data);
|
|
198
192
|
}
|
|
199
193
|
|
|
200
194
|
/**
|