@etsoo/smarterp-core 1.0.4 → 1.0.5
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/AppApi.d.ts +2 -1
- package/lib/cjs/CoreApp.d.ts +5 -2
- package/lib/cjs/UserApi.d.ts +1 -1
- package/lib/cjs/components/app/AppSwitchPopover.js +7 -1
- package/lib/cjs/dto/app/AppData.d.ts +24 -6
- package/lib/cjs/dto/app/AppQueryData.d.ts +0 -10
- package/lib/cjs/dto/app/AppReadDto.d.ts +3 -10
- package/lib/cjs/dto/app/AppUpdateReadDto.d.ts +3 -10
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/rq/app/AppUpdateRQ.d.ts +3 -12
- package/lib/mjs/AppApi.d.ts +2 -1
- package/lib/mjs/CoreApp.d.ts +5 -2
- package/lib/mjs/UserApi.d.ts +1 -1
- package/lib/mjs/components/app/AppSwitchPopover.js +7 -1
- package/lib/mjs/dto/app/AppData.d.ts +24 -6
- package/lib/mjs/dto/app/AppQueryData.d.ts +0 -10
- package/lib/mjs/dto/app/AppReadDto.d.ts +3 -10
- package/lib/mjs/dto/app/AppUpdateReadDto.d.ts +3 -10
- package/lib/mjs/index.d.ts +1 -0
- package/lib/mjs/index.js +1 -0
- package/lib/mjs/rq/app/AppUpdateRQ.d.ts +3 -12
- package/package.json +3 -3
- package/src/AppApi.ts +2 -1
- package/src/CoreApp.ts +1 -2
- package/src/UserApi.ts +1 -1
- package/src/components/app/AppSwitchPopover.tsx +13 -3
- package/src/dto/app/AppData.ts +27 -6
- package/src/dto/app/AppQueryData.ts +0 -12
- package/src/dto/app/AppReadDto.ts +3 -12
- package/src/dto/app/AppUpdateReadDto.ts +3 -12
- package/src/index.ts +2 -0
- package/src/rq/app/AppUpdateRQ.ts +3 -14
package/lib/cjs/AppApi.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { AppReadDto } from "./dto/app/AppReadDto";
|
|
|
16
16
|
import { CreateApiKeyData } from "./dto/app/CreateApiKeyData";
|
|
17
17
|
import { IActionResult } from "@etsoo/shared";
|
|
18
18
|
import { AppCreateApiKeyRQ } from "./rq/app/AppCreateApiKeyRQ";
|
|
19
|
+
import { AppData } from "./dto/app/AppData";
|
|
19
20
|
/**
|
|
20
21
|
* Application API
|
|
21
22
|
*/
|
|
@@ -53,7 +54,7 @@ export declare class AppApi extends EntityApi {
|
|
|
53
54
|
* @param payload Payload
|
|
54
55
|
* @returns Result
|
|
55
56
|
*/
|
|
56
|
-
getMy(rq: AppGetMyRQ, payload?: IApiPayload<
|
|
57
|
+
getMy(rq: AppGetMyRQ, payload?: IApiPayload<AppData[]>): Promise<AppData[] | undefined>;
|
|
57
58
|
/**
|
|
58
59
|
* List
|
|
59
60
|
* @param rq Request data
|
package/lib/cjs/CoreApp.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { UserApi } from "./UserApi";
|
|
|
7
7
|
import { AuthApi, IApp, UserIdentifierType } from "@etsoo/appscript";
|
|
8
8
|
import { IdentityType } from "./dto/IdentityType";
|
|
9
9
|
import { AuthCodeApi } from "./AuthCodeApi";
|
|
10
|
-
import { AppQueryData } from "./dto/app/AppQueryData";
|
|
11
10
|
import { ListType } from "@etsoo/shared";
|
|
12
11
|
/**
|
|
13
12
|
* Core application interface
|
|
@@ -48,7 +47,11 @@ export interface ICoreApp {
|
|
|
48
47
|
* @param data App data
|
|
49
48
|
* @returns Name
|
|
50
49
|
*/
|
|
51
|
-
getAppName(data:
|
|
50
|
+
getAppName(data: {
|
|
51
|
+
id: number;
|
|
52
|
+
name: string;
|
|
53
|
+
localName?: string;
|
|
54
|
+
}): string;
|
|
52
55
|
/**
|
|
53
56
|
* Get user identifier type label
|
|
54
57
|
* 获取用户标识类型标签
|
package/lib/cjs/UserApi.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export declare class UserApi extends EntityApi {
|
|
|
71
71
|
* @param payload Payload
|
|
72
72
|
* @returns Result
|
|
73
73
|
*/
|
|
74
|
-
getLatestApp(payload?: IApiPayload<
|
|
74
|
+
getLatestApp(payload?: IApiPayload<AppData>): Promise<AppData | undefined>;
|
|
75
75
|
/**
|
|
76
76
|
* Update avatar
|
|
77
77
|
* @param data Avatar form data
|
|
@@ -38,6 +38,12 @@ function AppSwitchPopover(props) {
|
|
|
38
38
|
const index = data.findIndex((a) => a.id === currentApp);
|
|
39
39
|
if (index >= 0)
|
|
40
40
|
data.splice(index, 1);
|
|
41
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "column", margin: 2, children: [data.map((appData) => ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: async () => {
|
|
41
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Stack, { direction: "column", margin: 2, children: [data.map((appData) => ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: async () => {
|
|
42
|
+
const tasks = appData.urls.map((u) => app.core.authApi.getLogInUrl({ showLoading: false }, u.api));
|
|
43
|
+
const url = await Promise.any(tasks);
|
|
44
|
+
if (url == null)
|
|
45
|
+
return;
|
|
46
|
+
app.loadUrlEx(url);
|
|
47
|
+
}, children: app.core.getAppName(appData) }, appData.id))), (data.length === 0 || data.length === maxItems) && ((0, jsx_runtime_1.jsxs)(material_1.Button, { onClick: () => navigate("./app/my"), children: [labels.more, "..."] }))] }));
|
|
42
48
|
} }));
|
|
43
49
|
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application URL
|
|
3
|
+
* 应用网址
|
|
4
|
+
*/
|
|
5
|
+
export type AppUrl = {
|
|
6
|
+
/**
|
|
7
|
+
* Web URL
|
|
8
|
+
*/
|
|
9
|
+
web: string;
|
|
10
|
+
/**
|
|
11
|
+
* API URL
|
|
12
|
+
*/
|
|
13
|
+
api: string;
|
|
14
|
+
/**
|
|
15
|
+
* Help URL
|
|
16
|
+
*/
|
|
17
|
+
help?: string;
|
|
18
|
+
};
|
|
1
19
|
/**
|
|
2
20
|
* Application data
|
|
3
21
|
* 程序数据
|
|
@@ -14,15 +32,15 @@ export type AppData = {
|
|
|
14
32
|
*/
|
|
15
33
|
name: string;
|
|
16
34
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
35
|
+
* Local name
|
|
36
|
+
* 本地名称
|
|
19
37
|
*/
|
|
20
|
-
|
|
38
|
+
localName?: string;
|
|
21
39
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
40
|
+
* Application URLs
|
|
41
|
+
* 程序网址
|
|
24
42
|
*/
|
|
25
|
-
|
|
43
|
+
urls: AppUrl[];
|
|
26
44
|
/**
|
|
27
45
|
* Logo
|
|
28
46
|
* 图标
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityStatus } from "@etsoo/appscript";
|
|
2
2
|
import { IdentityType } from "../IdentityType";
|
|
3
|
+
import { AppUrl } from "./AppData";
|
|
3
4
|
/**
|
|
4
5
|
* App read data
|
|
5
6
|
* 应用读取数据
|
|
@@ -26,17 +27,9 @@ export type AppReadDto = {
|
|
|
26
27
|
*/
|
|
27
28
|
localName?: string;
|
|
28
29
|
/**
|
|
29
|
-
* Local
|
|
30
|
+
* Local URLs
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Local help URL
|
|
34
|
-
*/
|
|
35
|
-
localHelpUrl?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Local APIs
|
|
38
|
-
*/
|
|
39
|
-
localApis?: string[];
|
|
32
|
+
localUrls?: AppUrl[];
|
|
40
33
|
/**
|
|
41
34
|
* Expiry
|
|
42
35
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityStatus } from "@etsoo/appscript";
|
|
2
|
+
import { AppUrl } from "./AppData";
|
|
2
3
|
/**
|
|
3
4
|
* App read for update data
|
|
4
5
|
* 应用更新数据
|
|
@@ -17,17 +18,9 @@ export type AppUpdateReadDto = {
|
|
|
17
18
|
*/
|
|
18
19
|
localName?: string;
|
|
19
20
|
/**
|
|
20
|
-
* Local
|
|
21
|
+
* Local URLs
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Local help URL
|
|
25
|
-
*/
|
|
26
|
-
localHelpUrl?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Local APIs
|
|
29
|
-
*/
|
|
30
|
-
localApis?: string[];
|
|
23
|
+
localUrls?: AppUrl[];
|
|
31
24
|
/**
|
|
32
25
|
* Status
|
|
33
26
|
*/
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./dto/public/RegionData";
|
|
|
23
23
|
export * from "./dto/user/AuditHistoryDto";
|
|
24
24
|
export * from "./dto/user/DeviceListDto";
|
|
25
25
|
export * from "./dto/user/UserIdentifierData";
|
|
26
|
+
export * from "./dto/IdentityType";
|
|
26
27
|
export * from "./i18n/CoreCulture";
|
|
27
28
|
export * from "./rq/app/AppBuyNewRQ";
|
|
28
29
|
export * from "./rq/app/AppBuyRQ";
|
package/lib/cjs/index.js
CHANGED
|
@@ -40,6 +40,7 @@ __exportStar(require("./dto/public/RegionData"), exports);
|
|
|
40
40
|
__exportStar(require("./dto/user/AuditHistoryDto"), exports);
|
|
41
41
|
__exportStar(require("./dto/user/DeviceListDto"), exports);
|
|
42
42
|
__exportStar(require("./dto/user/UserIdentifierData"), exports);
|
|
43
|
+
__exportStar(require("./dto/IdentityType"), exports);
|
|
43
44
|
// i18n
|
|
44
45
|
__exportStar(require("./i18n/CoreCulture"), exports);
|
|
45
46
|
// RQ
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityStatus, UpdateModel } from "@etsoo/appscript";
|
|
2
|
+
import { AppUrl } from "../../dto/app/AppData";
|
|
2
3
|
/**
|
|
3
4
|
* App update request data
|
|
4
5
|
* 应用更新请求数据
|
|
@@ -10,20 +11,10 @@ export interface AppUpdateRQ extends UpdateModel {
|
|
|
10
11
|
*/
|
|
11
12
|
localName?: string;
|
|
12
13
|
/**
|
|
13
|
-
* Local
|
|
14
|
+
* Local URLs
|
|
14
15
|
* 本地网址
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Local help URL
|
|
19
|
-
* 本地帮助网址
|
|
20
|
-
*/
|
|
21
|
-
localHelpUrl?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Local APIs
|
|
24
|
-
* 本地接口
|
|
25
|
-
*/
|
|
26
|
-
localApis?: string[];
|
|
17
|
+
localUrls?: AppUrl[];
|
|
27
18
|
/**
|
|
28
19
|
* Status
|
|
29
20
|
*/
|
package/lib/mjs/AppApi.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { AppReadDto } from "./dto/app/AppReadDto";
|
|
|
16
16
|
import { CreateApiKeyData } from "./dto/app/CreateApiKeyData";
|
|
17
17
|
import { IActionResult } from "@etsoo/shared";
|
|
18
18
|
import { AppCreateApiKeyRQ } from "./rq/app/AppCreateApiKeyRQ";
|
|
19
|
+
import { AppData } from "./dto/app/AppData";
|
|
19
20
|
/**
|
|
20
21
|
* Application API
|
|
21
22
|
*/
|
|
@@ -53,7 +54,7 @@ export declare class AppApi extends EntityApi {
|
|
|
53
54
|
* @param payload Payload
|
|
54
55
|
* @returns Result
|
|
55
56
|
*/
|
|
56
|
-
getMy(rq: AppGetMyRQ, payload?: IApiPayload<
|
|
57
|
+
getMy(rq: AppGetMyRQ, payload?: IApiPayload<AppData[]>): Promise<AppData[] | undefined>;
|
|
57
58
|
/**
|
|
58
59
|
* List
|
|
59
60
|
* @param rq Request data
|
package/lib/mjs/CoreApp.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { UserApi } from "./UserApi";
|
|
|
7
7
|
import { AuthApi, IApp, UserIdentifierType } from "@etsoo/appscript";
|
|
8
8
|
import { IdentityType } from "./dto/IdentityType";
|
|
9
9
|
import { AuthCodeApi } from "./AuthCodeApi";
|
|
10
|
-
import { AppQueryData } from "./dto/app/AppQueryData";
|
|
11
10
|
import { ListType } from "@etsoo/shared";
|
|
12
11
|
/**
|
|
13
12
|
* Core application interface
|
|
@@ -48,7 +47,11 @@ export interface ICoreApp {
|
|
|
48
47
|
* @param data App data
|
|
49
48
|
* @returns Name
|
|
50
49
|
*/
|
|
51
|
-
getAppName(data:
|
|
50
|
+
getAppName(data: {
|
|
51
|
+
id: number;
|
|
52
|
+
name: string;
|
|
53
|
+
localName?: string;
|
|
54
|
+
}): string;
|
|
52
55
|
/**
|
|
53
56
|
* Get user identifier type label
|
|
54
57
|
* 获取用户标识类型标签
|
package/lib/mjs/UserApi.d.ts
CHANGED
|
@@ -71,7 +71,7 @@ export declare class UserApi extends EntityApi {
|
|
|
71
71
|
* @param payload Payload
|
|
72
72
|
* @returns Result
|
|
73
73
|
*/
|
|
74
|
-
getLatestApp(payload?: IApiPayload<
|
|
74
|
+
getLatestApp(payload?: IApiPayload<AppData>): Promise<AppData | undefined>;
|
|
75
75
|
/**
|
|
76
76
|
* Update avatar
|
|
77
77
|
* @param data Avatar form data
|
|
@@ -32,6 +32,12 @@ export function AppSwitchPopover(props) {
|
|
|
32
32
|
const index = data.findIndex((a) => a.id === currentApp);
|
|
33
33
|
if (index >= 0)
|
|
34
34
|
data.splice(index, 1);
|
|
35
|
-
return (_jsxs(Stack, { direction: "column", margin: 2, children: [data.map((appData) => (_jsx(Button, { onClick: async () => {
|
|
35
|
+
return (_jsxs(Stack, { direction: "column", margin: 2, children: [data.map((appData) => (_jsx(Button, { onClick: async () => {
|
|
36
|
+
const tasks = appData.urls.map((u) => app.core.authApi.getLogInUrl({ showLoading: false }, u.api));
|
|
37
|
+
const url = await Promise.any(tasks);
|
|
38
|
+
if (url == null)
|
|
39
|
+
return;
|
|
40
|
+
app.loadUrlEx(url);
|
|
41
|
+
}, children: app.core.getAppName(appData) }, appData.id))), (data.length === 0 || data.length === maxItems) && (_jsxs(Button, { onClick: () => navigate("./app/my"), children: [labels.more, "..."] }))] }));
|
|
36
42
|
} }));
|
|
37
43
|
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application URL
|
|
3
|
+
* 应用网址
|
|
4
|
+
*/
|
|
5
|
+
export type AppUrl = {
|
|
6
|
+
/**
|
|
7
|
+
* Web URL
|
|
8
|
+
*/
|
|
9
|
+
web: string;
|
|
10
|
+
/**
|
|
11
|
+
* API URL
|
|
12
|
+
*/
|
|
13
|
+
api: string;
|
|
14
|
+
/**
|
|
15
|
+
* Help URL
|
|
16
|
+
*/
|
|
17
|
+
help?: string;
|
|
18
|
+
};
|
|
1
19
|
/**
|
|
2
20
|
* Application data
|
|
3
21
|
* 程序数据
|
|
@@ -14,15 +32,15 @@ export type AppData = {
|
|
|
14
32
|
*/
|
|
15
33
|
name: string;
|
|
16
34
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
35
|
+
* Local name
|
|
36
|
+
* 本地名称
|
|
19
37
|
*/
|
|
20
|
-
|
|
38
|
+
localName?: string;
|
|
21
39
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
40
|
+
* Application URLs
|
|
41
|
+
* 程序网址
|
|
24
42
|
*/
|
|
25
|
-
|
|
43
|
+
urls: AppUrl[];
|
|
26
44
|
/**
|
|
27
45
|
* Logo
|
|
28
46
|
* 图标
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityStatus } from "@etsoo/appscript";
|
|
2
2
|
import { IdentityType } from "../IdentityType";
|
|
3
|
+
import { AppUrl } from "./AppData";
|
|
3
4
|
/**
|
|
4
5
|
* App read data
|
|
5
6
|
* 应用读取数据
|
|
@@ -26,17 +27,9 @@ export type AppReadDto = {
|
|
|
26
27
|
*/
|
|
27
28
|
localName?: string;
|
|
28
29
|
/**
|
|
29
|
-
* Local
|
|
30
|
+
* Local URLs
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Local help URL
|
|
34
|
-
*/
|
|
35
|
-
localHelpUrl?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Local APIs
|
|
38
|
-
*/
|
|
39
|
-
localApis?: string[];
|
|
32
|
+
localUrls?: AppUrl[];
|
|
40
33
|
/**
|
|
41
34
|
* Expiry
|
|
42
35
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityStatus } from "@etsoo/appscript";
|
|
2
|
+
import { AppUrl } from "./AppData";
|
|
2
3
|
/**
|
|
3
4
|
* App read for update data
|
|
4
5
|
* 应用更新数据
|
|
@@ -17,17 +18,9 @@ export type AppUpdateReadDto = {
|
|
|
17
18
|
*/
|
|
18
19
|
localName?: string;
|
|
19
20
|
/**
|
|
20
|
-
* Local
|
|
21
|
+
* Local URLs
|
|
21
22
|
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Local help URL
|
|
25
|
-
*/
|
|
26
|
-
localHelpUrl?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Local APIs
|
|
29
|
-
*/
|
|
30
|
-
localApis?: string[];
|
|
23
|
+
localUrls?: AppUrl[];
|
|
31
24
|
/**
|
|
32
25
|
* Status
|
|
33
26
|
*/
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./dto/public/RegionData";
|
|
|
23
23
|
export * from "./dto/user/AuditHistoryDto";
|
|
24
24
|
export * from "./dto/user/DeviceListDto";
|
|
25
25
|
export * from "./dto/user/UserIdentifierData";
|
|
26
|
+
export * from "./dto/IdentityType";
|
|
26
27
|
export * from "./i18n/CoreCulture";
|
|
27
28
|
export * from "./rq/app/AppBuyNewRQ";
|
|
28
29
|
export * from "./rq/app/AppBuyRQ";
|
package/lib/mjs/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export * from "./dto/public/RegionData";
|
|
|
24
24
|
export * from "./dto/user/AuditHistoryDto";
|
|
25
25
|
export * from "./dto/user/DeviceListDto";
|
|
26
26
|
export * from "./dto/user/UserIdentifierData";
|
|
27
|
+
export * from "./dto/IdentityType";
|
|
27
28
|
// i18n
|
|
28
29
|
export * from "./i18n/CoreCulture";
|
|
29
30
|
// RQ
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityStatus, UpdateModel } from "@etsoo/appscript";
|
|
2
|
+
import { AppUrl } from "../../dto/app/AppData";
|
|
2
3
|
/**
|
|
3
4
|
* App update request data
|
|
4
5
|
* 应用更新请求数据
|
|
@@ -10,20 +11,10 @@ export interface AppUpdateRQ extends UpdateModel {
|
|
|
10
11
|
*/
|
|
11
12
|
localName?: string;
|
|
12
13
|
/**
|
|
13
|
-
* Local
|
|
14
|
+
* Local URLs
|
|
14
15
|
* 本地网址
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Local help URL
|
|
19
|
-
* 本地帮助网址
|
|
20
|
-
*/
|
|
21
|
-
localHelpUrl?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Local APIs
|
|
24
|
-
* 本地接口
|
|
25
|
-
*/
|
|
26
|
-
localApis?: string[];
|
|
17
|
+
localUrls?: AppUrl[];
|
|
27
18
|
/**
|
|
28
19
|
* Status
|
|
29
20
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/smarterp-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "TypeScript APIs for SmartERP Core",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"vitest": "^3.0.5"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@etsoo/appscript": "^1.6.
|
|
57
|
-
"@etsoo/materialui": "^1.4.
|
|
56
|
+
"@etsoo/appscript": "^1.6.6",
|
|
57
|
+
"@etsoo/materialui": "^1.4.82",
|
|
58
58
|
"@etsoo/react": "^1.8.30",
|
|
59
59
|
"@etsoo/shared": "^1.2.61",
|
|
60
60
|
"@etsoo/toolpad": "^1.0.15",
|
package/src/AppApi.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { AppReadDto } from "./dto/app/AppReadDto";
|
|
|
21
21
|
import { CreateApiKeyData } from "./dto/app/CreateApiKeyData";
|
|
22
22
|
import { IActionResult } from "@etsoo/shared";
|
|
23
23
|
import { AppCreateApiKeyRQ } from "./rq/app/AppCreateApiKeyRQ";
|
|
24
|
+
import { AppData } from "./dto/app/AppData";
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* Application API
|
|
@@ -74,7 +75,7 @@ export class AppApi extends EntityApi {
|
|
|
74
75
|
* @param payload Payload
|
|
75
76
|
* @returns Result
|
|
76
77
|
*/
|
|
77
|
-
getMy(rq: AppGetMyRQ, payload?: IApiPayload<
|
|
78
|
+
getMy(rq: AppGetMyRQ, payload?: IApiPayload<AppData[]>) {
|
|
78
79
|
return this.api.post(`${this.flag}/GetMy`, rq, payload);
|
|
79
80
|
}
|
|
80
81
|
|
package/src/CoreApp.ts
CHANGED
|
@@ -7,7 +7,6 @@ import { UserApi } from "./UserApi";
|
|
|
7
7
|
import { AuthApi, IApp, UserIdentifierType } from "@etsoo/appscript";
|
|
8
8
|
import { IdentityType } from "./dto/IdentityType";
|
|
9
9
|
import { AuthCodeApi } from "./AuthCodeApi";
|
|
10
|
-
import { AppQueryData } from "./dto/app/AppQueryData";
|
|
11
10
|
import { DataTypes, ListType } from "@etsoo/shared";
|
|
12
11
|
|
|
13
12
|
/**
|
|
@@ -56,7 +55,7 @@ export interface ICoreApp {
|
|
|
56
55
|
* @param data App data
|
|
57
56
|
* @returns Name
|
|
58
57
|
*/
|
|
59
|
-
getAppName(data:
|
|
58
|
+
getAppName(data: { id: number; name: string; localName?: string }): string;
|
|
60
59
|
|
|
61
60
|
/**
|
|
62
61
|
* Get user identifier type label
|
package/src/UserApi.ts
CHANGED
|
@@ -107,7 +107,7 @@ export class UserApi extends EntityApi {
|
|
|
107
107
|
* @param payload Payload
|
|
108
108
|
* @returns Result
|
|
109
109
|
*/
|
|
110
|
-
getLatestApp(payload?: IApiPayload<
|
|
110
|
+
getLatestApp(payload?: IApiPayload<AppData>) {
|
|
111
111
|
return this.api.get("User/GetLatestApp", undefined, payload);
|
|
112
112
|
}
|
|
113
113
|
|
|
@@ -2,9 +2,9 @@ import React from "react";
|
|
|
2
2
|
import { Button, Stack, Typography } from "@mui/material";
|
|
3
3
|
import { useNavigate } from "react-router-dom";
|
|
4
4
|
import { ButtonPopover } from "@etsoo/materialui";
|
|
5
|
-
import { AppQueryData } from "../../dto/app/AppQueryData";
|
|
6
5
|
import { useRequiredAppContext } from "../../ICoreServiceApp";
|
|
7
6
|
import { IdentityType } from "../../dto/IdentityType";
|
|
7
|
+
import { AppData } from "../../dto/app/AppData";
|
|
8
8
|
|
|
9
9
|
export type AppSwitchPopoverProps = {
|
|
10
10
|
appName: string;
|
|
@@ -31,7 +31,7 @@ export function AppSwitchPopover(props: AppSwitchPopoverProps) {
|
|
|
31
31
|
|
|
32
32
|
// Layout
|
|
33
33
|
return (
|
|
34
|
-
<ButtonPopover<
|
|
34
|
+
<ButtonPopover<AppData[]>
|
|
35
35
|
button={(callback) => (
|
|
36
36
|
<Typography
|
|
37
37
|
variant="h6"
|
|
@@ -66,7 +66,17 @@ export function AppSwitchPopover(props: AppSwitchPopoverProps) {
|
|
|
66
66
|
return (
|
|
67
67
|
<Stack direction="column" margin={2}>
|
|
68
68
|
{data.map((appData) => (
|
|
69
|
-
<Button
|
|
69
|
+
<Button
|
|
70
|
+
key={appData.id}
|
|
71
|
+
onClick={async () => {
|
|
72
|
+
const tasks = appData.urls.map((u) =>
|
|
73
|
+
app.core.authApi.getLogInUrl({ showLoading: false }, u.api)
|
|
74
|
+
);
|
|
75
|
+
const url = await Promise.any(tasks);
|
|
76
|
+
if (url == null) return;
|
|
77
|
+
app.loadUrlEx(url);
|
|
78
|
+
}}
|
|
79
|
+
>
|
|
70
80
|
{app.core.getAppName(appData)}
|
|
71
81
|
</Button>
|
|
72
82
|
))}
|
package/src/dto/app/AppData.ts
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Application URL
|
|
3
|
+
* 应用网址
|
|
4
|
+
*/
|
|
5
|
+
export type AppUrl = {
|
|
6
|
+
/**
|
|
7
|
+
* Web URL
|
|
8
|
+
*/
|
|
9
|
+
web: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* API URL
|
|
13
|
+
*/
|
|
14
|
+
api: string;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Help URL
|
|
18
|
+
*/
|
|
19
|
+
help?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
1
22
|
/**
|
|
2
23
|
* Application data
|
|
3
24
|
* 程序数据
|
|
@@ -16,16 +37,16 @@ export type AppData = {
|
|
|
16
37
|
name: string;
|
|
17
38
|
|
|
18
39
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
40
|
+
* Local name
|
|
41
|
+
* 本地名称
|
|
21
42
|
*/
|
|
22
|
-
|
|
43
|
+
localName?: string;
|
|
23
44
|
|
|
24
45
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
46
|
+
* Application URLs
|
|
47
|
+
* 程序网址
|
|
27
48
|
*/
|
|
28
|
-
|
|
49
|
+
urls: AppUrl[];
|
|
29
50
|
|
|
30
51
|
/**
|
|
31
52
|
* Logo
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EntityStatus } from "@etsoo/appscript";
|
|
2
2
|
import { IdentityType } from "../IdentityType";
|
|
3
|
+
import { AppUrl } from "./AppData";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* App read data
|
|
@@ -32,19 +33,9 @@ export type AppReadDto = {
|
|
|
32
33
|
localName?: string;
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
* Local
|
|
36
|
+
* Local URLs
|
|
36
37
|
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Local help URL
|
|
41
|
-
*/
|
|
42
|
-
localHelpUrl?: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Local APIs
|
|
46
|
-
*/
|
|
47
|
-
localApis?: string[];
|
|
38
|
+
localUrls?: AppUrl[];
|
|
48
39
|
|
|
49
40
|
/**
|
|
50
41
|
* Expiry
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityStatus } from "@etsoo/appscript";
|
|
2
|
+
import { AppUrl } from "./AppData";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* App read for update data
|
|
@@ -21,19 +22,9 @@ export type AppUpdateReadDto = {
|
|
|
21
22
|
localName?: string;
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
|
-
* Local
|
|
25
|
+
* Local URLs
|
|
25
26
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Local help URL
|
|
30
|
-
*/
|
|
31
|
-
localHelpUrl?: string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Local APIs
|
|
35
|
-
*/
|
|
36
|
-
localApis?: string[];
|
|
27
|
+
localUrls?: AppUrl[];
|
|
37
28
|
|
|
38
29
|
/**
|
|
39
30
|
* Status
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EntityStatus, UpdateModel } from "@etsoo/appscript";
|
|
2
|
+
import { AppUrl } from "../../dto/app/AppData";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* App update request data
|
|
@@ -12,22 +13,10 @@ export interface AppUpdateRQ extends UpdateModel {
|
|
|
12
13
|
localName?: string;
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
|
-
* Local
|
|
16
|
+
* Local URLs
|
|
16
17
|
* 本地网址
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Local help URL
|
|
22
|
-
* 本地帮助网址
|
|
23
|
-
*/
|
|
24
|
-
localHelpUrl?: string;
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Local APIs
|
|
28
|
-
* 本地接口
|
|
29
|
-
*/
|
|
30
|
-
localApis?: string[];
|
|
19
|
+
localUrls?: AppUrl[];
|
|
31
20
|
|
|
32
21
|
/**
|
|
33
22
|
* Status
|