@etsoo/appscript 1.5.63 → 1.5.65
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/.github/workflows/main.yml +6 -5
- package/README.md +97 -71
- package/__tests__/app/CoreApp.ts +141 -143
- package/__tests__/app/Culture.ts +23 -23
- package/__tests__/app/TestApp.ts +107 -105
- package/__tests__/business/BusinessUtils.ts +37 -37
- package/__tests__/result/ActionResult.ts +14 -14
- package/__tests__/tsconfig.json +16 -16
- package/babel.config.json +8 -8
- package/lib/cjs/address/AddressAutocomplete.d.ts +1 -1
- package/lib/cjs/address/AddressPlace.d.ts +3 -3
- package/lib/cjs/address/AddressPlaceBase.d.ts +1 -1
- package/lib/cjs/address/AddressRegion.d.ts +2 -2
- package/lib/cjs/address/AddressRegion.js +12 -12
- package/lib/cjs/address/AddressUtils.d.ts +1 -1
- package/lib/cjs/api/AuthApi.d.ts +14 -14
- package/lib/cjs/api/AuthApi.js +17 -17
- package/lib/cjs/api/BaseApi.d.ts +1 -1
- package/lib/cjs/api/EntityApi.d.ts +8 -8
- package/lib/cjs/api/EntityApi.js +4 -4
- package/lib/cjs/api/dto/AuditLineDto.d.ts +24 -0
- package/lib/cjs/api/dto/AuditLineDto.js +2 -0
- package/lib/cjs/api/dto/IdLabelDto.d.ts +1 -1
- package/lib/cjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
- package/lib/cjs/api/dto/PinDto.d.ts +61 -0
- package/lib/cjs/api/dto/PinDto.js +2 -0
- package/lib/cjs/api/dto/ResultPayload.d.ts +2 -2
- package/lib/cjs/api/rq/AuthRequest.d.ts +1 -1
- package/lib/cjs/api/rq/LoginRQ.d.ts +2 -2
- package/lib/cjs/api/rq/MergeRQ.d.ts +1 -1
- package/lib/cjs/api/rq/QueryRQ.d.ts +2 -2
- package/lib/cjs/api/rq/StatusQueryRQ.d.ts +3 -3
- package/lib/cjs/api/rq/UpdateModel.d.ts +2 -2
- package/lib/cjs/api/rq/UpdateStatusRQ.d.ts +2 -2
- package/lib/cjs/app/AppSettings.d.ts +3 -3
- package/lib/cjs/bridges/FlutterHost.d.ts +2 -2
- package/lib/cjs/bridges/FlutterHost.js +11 -11
- package/lib/cjs/business/BusinessTax.js +6 -6
- package/lib/cjs/business/BusinessUtils.d.ts +2 -2
- package/lib/cjs/business/BusinessUtils.js +5 -5
- package/lib/cjs/business/Currency.d.ts +1 -1
- package/lib/cjs/business/Currency.js +10 -10
- package/lib/cjs/business/ProductUnit.d.ts +1 -1
- package/lib/cjs/business/ShoppingCart.d.ts +9 -9
- package/lib/cjs/business/ShoppingCart.js +11 -11
- package/lib/cjs/custom/CustomField.d.ts +1 -1
- package/lib/cjs/custom/CustomFieldData.d.ts +2 -2
- package/lib/cjs/i18n/Culture.d.ts +31 -0
- package/lib/cjs/i18n/Culture.js +51 -0
- package/lib/cjs/index.d.ts +3 -4
- package/lib/cjs/index.js +3 -4
- package/lib/cjs/result/ActionResult.d.ts +1 -1
- package/lib/cjs/result/ActionResultError.d.ts +1 -1
- package/lib/cjs/result/ActionResultError.js +3 -3
- package/lib/cjs/result/InitCallResult.d.ts +1 -1
- package/lib/cjs/state/Culture.d.ts +2 -2
- package/lib/cjs/state/User.d.ts +1 -1
- package/lib/mjs/address/AddressAutocomplete.d.ts +1 -1
- package/lib/mjs/address/AddressPlace.d.ts +3 -3
- package/lib/mjs/address/AddressPlaceBase.d.ts +1 -1
- package/lib/mjs/address/AddressRegion.d.ts +2 -2
- package/lib/mjs/address/AddressRegion.js +13 -13
- package/lib/mjs/address/AddressUtils.d.ts +1 -1
- package/lib/mjs/address/AddressUtils.js +1 -1
- package/lib/mjs/api/AuthApi.d.ts +14 -14
- package/lib/mjs/api/AuthApi.js +19 -19
- package/lib/mjs/api/BaseApi.d.ts +1 -1
- package/lib/mjs/api/EntityApi.d.ts +8 -8
- package/lib/mjs/api/EntityApi.js +5 -5
- package/lib/mjs/api/dto/AuditLineDto.d.ts +24 -0
- package/lib/mjs/api/dto/AuditLineDto.js +1 -0
- package/lib/mjs/api/dto/IdLabelDto.d.ts +1 -1
- package/lib/mjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
- package/lib/mjs/api/dto/PinDto.d.ts +61 -0
- package/lib/mjs/api/dto/PinDto.js +1 -0
- package/lib/mjs/api/dto/ResultPayload.d.ts +2 -2
- package/lib/mjs/api/rq/AuthRequest.d.ts +1 -1
- package/lib/mjs/api/rq/LoginRQ.d.ts +2 -2
- package/lib/mjs/api/rq/MergeRQ.d.ts +1 -1
- package/lib/mjs/api/rq/QueryRQ.d.ts +2 -2
- package/lib/mjs/api/rq/StatusQueryRQ.d.ts +3 -3
- package/lib/mjs/api/rq/UpdateModel.d.ts +2 -2
- package/lib/mjs/api/rq/UpdateStatusRQ.d.ts +2 -2
- package/lib/mjs/app/AppSettings.d.ts +3 -3
- package/lib/mjs/bridges/FlutterHost.d.ts +2 -2
- package/lib/mjs/bridges/FlutterHost.js +13 -13
- package/lib/mjs/business/BusinessTax.js +6 -6
- package/lib/mjs/business/BusinessUtils.d.ts +2 -2
- package/lib/mjs/business/BusinessUtils.js +5 -5
- package/lib/mjs/business/Currency.d.ts +1 -1
- package/lib/mjs/business/Currency.js +10 -10
- package/lib/mjs/business/ProductUnit.d.ts +1 -1
- package/lib/mjs/business/ProductUnit.js +1 -1
- package/lib/mjs/business/ShoppingCart.d.ts +9 -9
- package/lib/mjs/business/ShoppingCart.js +12 -12
- package/lib/mjs/custom/CustomField.d.ts +1 -1
- package/lib/mjs/custom/CustomFieldData.d.ts +2 -2
- package/lib/mjs/i18n/Culture.d.ts +31 -0
- package/lib/mjs/i18n/Culture.js +48 -0
- package/lib/mjs/index.d.ts +3 -4
- package/lib/mjs/index.js +3 -4
- package/lib/mjs/result/ActionResult.d.ts +1 -1
- package/lib/mjs/result/ActionResult.js +1 -1
- package/lib/mjs/result/ActionResultError.d.ts +1 -1
- package/lib/mjs/result/ActionResultError.js +3 -3
- package/lib/mjs/result/InitCallResult.d.ts +1 -1
- package/lib/mjs/state/Culture.d.ts +2 -2
- package/lib/mjs/state/User.d.ts +1 -1
- package/package.json +1 -1
- package/src/address/AddressAutocomplete.ts +16 -16
- package/src/address/AddressCity.ts +12 -12
- package/src/address/AddressContinent.ts +35 -35
- package/src/address/AddressDistrict.ts +12 -12
- package/src/address/AddressLocation.ts +8 -8
- package/src/address/AddressPlace.ts +23 -23
- package/src/address/AddressPlaceBase.ts +31 -31
- package/src/address/AddressRegion.ts +286 -286
- package/src/address/AddressState.ts +12 -12
- package/src/address/AddressUtils.ts +27 -27
- package/src/api/AuthApi.ts +194 -194
- package/src/api/BaseApi.ts +13 -13
- package/src/api/EntityApi.ts +181 -194
- package/src/api/dto/AntiforgeryRequestToken.ts +15 -15
- package/src/api/dto/ApiRefreshTokenDto.ts +16 -16
- package/src/api/dto/AuditLineDto.ts +27 -0
- package/src/api/dto/IdLabelDto.ts +3 -3
- package/src/api/dto/IdLabelPrimaryDto.ts +7 -7
- package/src/api/dto/InitCallDto.ts +12 -12
- package/src/api/dto/PinDto.ts +71 -0
- package/src/api/dto/ResultPayload.ts +6 -6
- package/src/api/rq/ApiRefreshTokenRQ.ts +8 -8
- package/src/api/rq/AuthRequest.ts +40 -40
- package/src/api/rq/GetLogInUrlRQ.ts +8 -8
- package/src/api/rq/LoginIdRQ.ts +12 -12
- package/src/api/rq/LoginRQ.ts +18 -18
- package/src/api/rq/MergeRQ.ts +13 -13
- package/src/api/rq/QueryPagingData.ts +16 -16
- package/src/api/rq/QueryRQ.ts +22 -22
- package/src/api/rq/RefreshTokenRQ.ts +4 -4
- package/src/api/rq/ResetPasswordRQ.ts +20 -20
- package/src/api/rq/SignoutRQ.ts +8 -8
- package/src/api/rq/StatusQueryRQ.ts +11 -11
- package/src/api/rq/SwitchOrgRQ.ts +8 -8
- package/src/api/rq/TokenRQ.ts +4 -4
- package/src/api/rq/UpdateModel.ts +12 -12
- package/src/api/rq/UpdateStatusRQ.ts +10 -10
- package/src/app/AppSettings.ts +27 -27
- package/src/app/UserRole.ts +44 -44
- package/src/bridges/FlutterHost.ts +92 -97
- package/src/bridges/IBridgeHost.ts +49 -51
- package/src/business/ApiService.ts +25 -25
- package/src/business/BusinessTax.ts +63 -63
- package/src/business/BusinessUtils.ts +75 -75
- package/src/business/CultureItem.ts +43 -43
- package/src/business/Currency.ts +11 -11
- package/src/business/DataPrivacy.ts +35 -35
- package/src/business/EntityStatus.ts +44 -44
- package/src/business/ProductUnit.ts +58 -58
- package/src/business/RepeatOption.ts +50 -50
- package/src/business/ShoppingCart.ts +696 -706
- package/src/custom/CustomField.ts +20 -20
- package/src/custom/CustomFieldData.ts +43 -43
- package/src/def/ListItem.ts +12 -12
- package/src/i18n/Culture.ts +60 -0
- package/src/i18n/en.json +244 -244
- package/src/i18n/zh-Hans.json +244 -244
- package/src/i18n/zh-Hant.json +244 -244
- package/src/index.ts +3 -4
- package/src/result/ActionResult.ts +19 -19
- package/src/result/ActionResultError.ts +30 -30
- package/src/result/InitCallResult.ts +21 -21
- package/src/state/Culture.ts +3 -3
- package/src/state/State.ts +5 -5
- package/src/state/User.ts +92 -92
- package/tsconfig.cjs.json +17 -17
- package/tsconfig.json +17 -17
- package/lib/cjs/i18n/CultureUtils.d.ts +0 -13
- package/lib/cjs/i18n/CultureUtils.js +0 -32
- package/lib/cjs/i18n/en.d.ts +0 -6
- package/lib/cjs/i18n/en.js +0 -12
- package/lib/cjs/i18n/zhHans.d.ts +0 -6
- package/lib/cjs/i18n/zhHans.js +0 -12
- package/lib/cjs/i18n/zhHant.d.ts +0 -6
- package/lib/cjs/i18n/zhHant.js +0 -12
- package/lib/mjs/i18n/CultureUtils.d.ts +0 -13
- package/lib/mjs/i18n/CultureUtils.js +0 -29
- package/lib/mjs/i18n/en.d.ts +0 -6
- package/lib/mjs/i18n/en.js +0 -8
- package/lib/mjs/i18n/zhHans.d.ts +0 -6
- package/lib/mjs/i18n/zhHans.js +0 -8
- package/lib/mjs/i18n/zhHant.d.ts +0 -6
- package/lib/mjs/i18n/zhHant.js +0 -8
- package/src/i18n/CultureUtils.ts +0 -36
- package/src/i18n/en.ts +0 -10
- package/src/i18n/zhHans.ts +0 -10
- package/src/i18n/zhHant.ts +0 -10
package/lib/cjs/api/AuthApi.js
CHANGED
|
@@ -14,7 +14,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
14
14
|
* @returns Result
|
|
15
15
|
*/
|
|
16
16
|
apiRefreshToken(rq, payload) {
|
|
17
|
-
return this.api.put(
|
|
17
|
+
return this.api.put("Auth/ApiRefreshToken", rq, payload);
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* Authorization request
|
|
@@ -22,7 +22,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
22
22
|
* @param payload Payload
|
|
23
23
|
*/
|
|
24
24
|
authRequest(auth, payload) {
|
|
25
|
-
return this.api.post(
|
|
25
|
+
return this.api.post("Auth/AuthRequest", auth, payload);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* Exchange token
|
|
@@ -31,7 +31,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
31
31
|
* @returns Result
|
|
32
32
|
*/
|
|
33
33
|
exchangeToken(rq, payload) {
|
|
34
|
-
return this.api.put(
|
|
34
|
+
return this.api.put("Auth/ExchangeToken", rq, payload);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Get log in url
|
|
@@ -40,7 +40,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
40
40
|
* @returns Result
|
|
41
41
|
*/
|
|
42
42
|
getLogInUrl(rq, payload) {
|
|
43
|
-
return this.api.get(
|
|
43
|
+
return this.api.get("Auth/GetLogInUrl", rq, payload);
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Login
|
|
@@ -54,7 +54,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
54
54
|
payload ?? (payload = {});
|
|
55
55
|
tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
|
|
56
56
|
// Call the API
|
|
57
|
-
const result = await this.api.post(
|
|
57
|
+
const result = await this.api.post("Auth/Login", rq, payload);
|
|
58
58
|
// Get the refresh token
|
|
59
59
|
const refreshToken = result?.ok
|
|
60
60
|
? this.app.getResponseToken(payload.response, tokenKey)
|
|
@@ -76,7 +76,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
76
76
|
deviceId,
|
|
77
77
|
region
|
|
78
78
|
};
|
|
79
|
-
return this.api.post(
|
|
79
|
+
return this.api.post("Auth/LoginId", rq, payload);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* Refresh token
|
|
@@ -85,14 +85,14 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
85
85
|
*/
|
|
86
86
|
async refreshToken(props) {
|
|
87
87
|
// Destruct
|
|
88
|
-
const { api =
|
|
88
|
+
const { api = "Auth/RefreshToken", showLoading = false, token, tokenField = AuthApi.HeaderTokenField } = props ?? {};
|
|
89
89
|
// Check the token
|
|
90
90
|
if (!token) {
|
|
91
91
|
return {
|
|
92
92
|
ok: false,
|
|
93
|
-
type:
|
|
94
|
-
field:
|
|
95
|
-
title: this.app.get(
|
|
93
|
+
type: "noData",
|
|
94
|
+
field: "token",
|
|
95
|
+
title: this.app.get("noData")
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
// Reqest data
|
|
@@ -116,9 +116,9 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
116
116
|
? shared_1.ActionResult.create(this.api.lastError)
|
|
117
117
|
: {
|
|
118
118
|
ok: false,
|
|
119
|
-
type:
|
|
120
|
-
field:
|
|
121
|
-
title: this.app.get(
|
|
119
|
+
type: "unknownError",
|
|
120
|
+
field: "result",
|
|
121
|
+
title: this.app.get("unknownError")
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
124
|
// Token
|
|
@@ -133,7 +133,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
133
133
|
* @returns Result
|
|
134
134
|
*/
|
|
135
135
|
resetPassword(rq, payload) {
|
|
136
|
-
return this.api.put(
|
|
136
|
+
return this.api.put("Auth/ResetPassword", rq, payload);
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Signout
|
|
@@ -142,7 +142,7 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
142
142
|
* @returns Result
|
|
143
143
|
*/
|
|
144
144
|
signout(rq, payload) {
|
|
145
|
-
return this.api.put(
|
|
145
|
+
return this.api.put("Auth/Signout", rq, payload);
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Switch organization
|
|
@@ -150,11 +150,11 @@ class AuthApi extends BaseApi_1.BaseApi {
|
|
|
150
150
|
* @param payload Payload
|
|
151
151
|
*/
|
|
152
152
|
switchOrg(rq, payload) {
|
|
153
|
-
return this.app.api.put(
|
|
153
|
+
return this.app.api.put("Auth/SwitchOrg", rq, payload);
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
exports.AuthApi = AuthApi;
|
|
157
157
|
/**
|
|
158
158
|
* Header token field name
|
|
159
159
|
*/
|
|
160
|
-
AuthApi.HeaderTokenField =
|
|
160
|
+
AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
|
package/lib/cjs/api/BaseApi.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IApi, IApiPayload } from
|
|
2
|
-
import { IActionResult, IdType } from
|
|
3
|
-
import { IApp } from
|
|
4
|
-
import { BaseApi } from
|
|
5
|
-
import { ResultPayload } from
|
|
6
|
-
import { MergeRQ } from
|
|
7
|
-
import { QueryRQ } from
|
|
8
|
-
import { UpdateStatusRQ } from
|
|
1
|
+
import { IApi, IApiPayload } from "@etsoo/restclient";
|
|
2
|
+
import { IActionResult, IdType } from "@etsoo/shared";
|
|
3
|
+
import { IApp } from "../app/IApp";
|
|
4
|
+
import { BaseApi } from "./BaseApi";
|
|
5
|
+
import { ResultPayload } from "./dto/ResultPayload";
|
|
6
|
+
import { MergeRQ } from "./rq/MergeRQ";
|
|
7
|
+
import { QueryRQ } from "./rq/QueryRQ";
|
|
8
|
+
import { UpdateStatusRQ } from "./rq/UpdateStatusRQ";
|
|
9
9
|
/**
|
|
10
10
|
* Entity API
|
|
11
11
|
* Follow com.etsoo.CoreFramework.Services.EntityServiceBase
|
package/lib/cjs/api/EntityApi.js
CHANGED
|
@@ -27,7 +27,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
27
27
|
}
|
|
28
28
|
deleteBase(id, payload) {
|
|
29
29
|
const query = Array.isArray(id)
|
|
30
|
-
?
|
|
30
|
+
? "?" + id.map((item) => `ids=${item}`).join("&")
|
|
31
31
|
: id;
|
|
32
32
|
return this.api.delete(`${this.flag}/Delete/${query}`, undefined, payload);
|
|
33
33
|
}
|
|
@@ -39,7 +39,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
39
39
|
*/
|
|
40
40
|
listBase(rq, payload) {
|
|
41
41
|
let { queryPaging, ...rest } = rq;
|
|
42
|
-
if (typeof queryPaging ===
|
|
42
|
+
if (typeof queryPaging === "number") {
|
|
43
43
|
queryPaging = { currentPage: 0, batchSize: queryPaging };
|
|
44
44
|
}
|
|
45
45
|
return this.api.post(`${this.flag}/List`, { queryPaging, ...rest }, payload);
|
|
@@ -60,7 +60,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
60
60
|
* @param queryKey Additional query key
|
|
61
61
|
* @returns Result
|
|
62
62
|
*/
|
|
63
|
-
queryBase(rq, payload, queryKey =
|
|
63
|
+
queryBase(rq, payload, queryKey = "") {
|
|
64
64
|
return this.api.post(`${this.flag}/Query${queryKey}`, rq, payload);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -104,7 +104,7 @@ class EntityApi extends BaseApi_1.BaseApi {
|
|
|
104
104
|
* @param payload Payload
|
|
105
105
|
* @returns Result
|
|
106
106
|
*/
|
|
107
|
-
sortWith(category, items, method =
|
|
107
|
+
sortWith(category, items, method = "Sort", payload) {
|
|
108
108
|
const data = {};
|
|
109
109
|
items.forEach((item, index) => (data[item.id] = index));
|
|
110
110
|
return this.api.put(`${this.flag}/${method}`, { category, data }, payload);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IApiPayload } from "@etsoo/restclient";
|
|
2
|
+
/**
|
|
3
|
+
* Audit line data
|
|
4
|
+
*/
|
|
5
|
+
export type AuditLineDto = {
|
|
6
|
+
id: number;
|
|
7
|
+
creation: Date;
|
|
8
|
+
user: string;
|
|
9
|
+
action: string;
|
|
10
|
+
changes?: AuditLineChangesDto;
|
|
11
|
+
oldData?: Record<string, unknown>;
|
|
12
|
+
newData?: Record<string, unknown>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Audit line changes data
|
|
16
|
+
*/
|
|
17
|
+
export type AuditLineChangesDto = {
|
|
18
|
+
oldData: Record<string, unknown>;
|
|
19
|
+
newData: Record<string, unknown>;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Audit line API payload
|
|
23
|
+
*/
|
|
24
|
+
export type AuditLinePayload = IApiPayload<AuditLineDto[]>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pin data
|
|
3
|
+
* 身份证信息
|
|
4
|
+
*/
|
|
5
|
+
export type PinDto = {
|
|
6
|
+
/**
|
|
7
|
+
* Region id
|
|
8
|
+
* 地区编号
|
|
9
|
+
*/
|
|
10
|
+
regionId?: string;
|
|
11
|
+
/**
|
|
12
|
+
* State or province
|
|
13
|
+
* 州 / 省
|
|
14
|
+
*/
|
|
15
|
+
state?: string;
|
|
16
|
+
/**
|
|
17
|
+
* State or province id
|
|
18
|
+
* 州 / 省编号
|
|
19
|
+
*/
|
|
20
|
+
stateId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* City
|
|
23
|
+
* 城市
|
|
24
|
+
*/
|
|
25
|
+
city?: string;
|
|
26
|
+
/**
|
|
27
|
+
* City id
|
|
28
|
+
* 城市编号
|
|
29
|
+
*/
|
|
30
|
+
cityId?: number;
|
|
31
|
+
/**
|
|
32
|
+
* District
|
|
33
|
+
* 区县
|
|
34
|
+
*/
|
|
35
|
+
district?: string;
|
|
36
|
+
/**
|
|
37
|
+
* District id
|
|
38
|
+
* 区县编号
|
|
39
|
+
*/
|
|
40
|
+
districtId?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Merged previous district
|
|
43
|
+
* 合并的原区县
|
|
44
|
+
*/
|
|
45
|
+
mergedDistrict?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Gender
|
|
48
|
+
* 性别
|
|
49
|
+
*/
|
|
50
|
+
gender?: "F" | "M";
|
|
51
|
+
/**
|
|
52
|
+
* Birthday
|
|
53
|
+
* 生日
|
|
54
|
+
*/
|
|
55
|
+
birthday?: string | Date;
|
|
56
|
+
/**
|
|
57
|
+
* Whether the form is legal
|
|
58
|
+
* 是否形式合法
|
|
59
|
+
*/
|
|
60
|
+
valid: boolean;
|
|
61
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IApiPayload } from
|
|
2
|
-
import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from
|
|
1
|
+
import { IApiPayload } from "@etsoo/restclient";
|
|
2
|
+
import { IActionResult, IdActionResult, IdMsgActionResult, MsgActionResult } from "@etsoo/shared";
|
|
3
3
|
/**
|
|
4
4
|
* Action result payload
|
|
5
5
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { IdType } from
|
|
2
|
-
import { QueryRQ } from
|
|
3
|
-
import { EntityStatus } from
|
|
1
|
+
import { IdType } from "@etsoo/shared";
|
|
2
|
+
import { QueryRQ } from "./QueryRQ";
|
|
3
|
+
import { EntityStatus } from "../../business/EntityStatus";
|
|
4
4
|
/**
|
|
5
5
|
* Query with status request data
|
|
6
6
|
* com.etsoo.CoreFramework.Models.QueryRQ
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IdType } from
|
|
1
|
+
import { IdType } from "@etsoo/shared";
|
|
2
2
|
/**
|
|
3
3
|
* Update model
|
|
4
4
|
* 更新模型
|
|
@@ -14,5 +14,5 @@ export interface UpdateModel<T extends IdType = number> {
|
|
|
14
14
|
* 'Exclude' items from a union type while 'omit' items from an object type.
|
|
15
15
|
* 更改的字段,注意 'Exclude' 用于联合类型,'omit' 用于对象类型。
|
|
16
16
|
*/
|
|
17
|
-
changedFields?: Exclude<keyof this,
|
|
17
|
+
changedFields?: Exclude<keyof this, "changedFields">[];
|
|
18
18
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { DataTypes } from
|
|
2
|
-
import { AddressRegion } from
|
|
3
|
-
import { IExternalSettings } from
|
|
1
|
+
import { DataTypes } from "@etsoo/shared";
|
|
2
|
+
import { AddressRegion } from "../address/AddressRegion";
|
|
3
|
+
import { IExternalSettings } from "./ExternalSettings";
|
|
4
4
|
/**
|
|
5
5
|
* App settings interface
|
|
6
6
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataTypes } from
|
|
2
|
-
import { BridgeHostName, IBridgeHost } from
|
|
1
|
+
import { DataTypes } from "@etsoo/shared";
|
|
2
|
+
import { BridgeHostName, IBridgeHost } from "./IBridgeHost";
|
|
3
3
|
type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<DataTypes.StringRecord | void>;
|
|
4
4
|
/**
|
|
5
5
|
* Flutter JavaScript Host
|
|
@@ -22,7 +22,7 @@ class FlutterHost {
|
|
|
22
22
|
* Cached commands
|
|
23
23
|
*/
|
|
24
24
|
this.cachedCommands = {};
|
|
25
|
-
window.addEventListener(
|
|
25
|
+
window.addEventListener("flutterInAppWebViewPlatformReady", (_event) => {
|
|
26
26
|
if (this.host.callHandler == null)
|
|
27
27
|
return;
|
|
28
28
|
for (const key in this.cachedCommands) {
|
|
@@ -40,18 +40,18 @@ class FlutterHost {
|
|
|
40
40
|
}
|
|
41
41
|
changeCulture(locale) {
|
|
42
42
|
if (this.host.callHandler)
|
|
43
|
-
this.host.callHandler(
|
|
43
|
+
this.host.callHandler("changeCulture", locale);
|
|
44
44
|
else
|
|
45
|
-
this.cacheCommand(
|
|
45
|
+
this.cacheCommand("changeCulture", locale);
|
|
46
46
|
}
|
|
47
47
|
closable() {
|
|
48
48
|
return false;
|
|
49
49
|
}
|
|
50
50
|
exit() {
|
|
51
51
|
if (this.host.callHandler)
|
|
52
|
-
this.host.callHandler(
|
|
52
|
+
this.host.callHandler("exit");
|
|
53
53
|
else
|
|
54
|
-
this.cacheCommand(
|
|
54
|
+
this.cacheCommand("exit");
|
|
55
55
|
}
|
|
56
56
|
async getLabels(...keys) {
|
|
57
57
|
// Try 500 miliseconds
|
|
@@ -65,10 +65,10 @@ class FlutterHost {
|
|
|
65
65
|
const init = {};
|
|
66
66
|
if (this.host.callHandler == null)
|
|
67
67
|
return init;
|
|
68
|
-
const result = (await this.host.callHandler(
|
|
68
|
+
const result = (await this.host.callHandler("getLabels")) ?? {};
|
|
69
69
|
return keys.reduce((a, v) => ({
|
|
70
70
|
...a,
|
|
71
|
-
[v]: result[v] ??
|
|
71
|
+
[v]: result[v] ?? ""
|
|
72
72
|
}), init);
|
|
73
73
|
}
|
|
74
74
|
getStartUrl() {
|
|
@@ -77,15 +77,15 @@ class FlutterHost {
|
|
|
77
77
|
loadApp(name, startUrl) {
|
|
78
78
|
this.startUrl = startUrl;
|
|
79
79
|
if (this.host.callHandler)
|
|
80
|
-
this.host.callHandler(
|
|
80
|
+
this.host.callHandler("loadApp", name, startUrl);
|
|
81
81
|
else
|
|
82
|
-
this.cacheCommand(
|
|
82
|
+
this.cacheCommand("loadApp", name, startUrl);
|
|
83
83
|
}
|
|
84
84
|
userAuthorization(authorized) {
|
|
85
85
|
if (this.host.callHandler)
|
|
86
|
-
this.host.callHandler(
|
|
86
|
+
this.host.callHandler("userAuthorization", authorized);
|
|
87
87
|
else
|
|
88
|
-
this.cacheCommand(
|
|
88
|
+
this.cacheCommand("userAuthorization", authorized);
|
|
89
89
|
}
|
|
90
90
|
onUpdate(func) { }
|
|
91
91
|
setTitle(title) { }
|
|
@@ -23,7 +23,7 @@ class BusinessTax {
|
|
|
23
23
|
* Get label key
|
|
24
24
|
*/
|
|
25
25
|
get labelKey() {
|
|
26
|
-
return
|
|
26
|
+
return "tax" + this.id + this.name;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
exports.BusinessTax = BusinessTax;
|
|
@@ -32,23 +32,23 @@ exports.BusinessTax = BusinessTax;
|
|
|
32
32
|
* Unified Social Credit Code (USCC) / 统一信用代码
|
|
33
33
|
* https://zh.wikisource.org/wiki/GB_32100-2015_%E6%B3%95%E4%BA%BA%E5%92%8C%E5%85%B6%E4%BB%96%E7%BB%84%E7%BB%87%E7%BB%9F%E4%B8%80%E7%A4%BE%E4%BC%9A%E4%BF%A1%E7%94%A8%E4%BB%A3%E7%A0%81%E7%BC%96%E7%A0%81%E8%A7%84%E5%88%99
|
|
34
34
|
*/
|
|
35
|
-
BusinessTax.CN = new BusinessTax(
|
|
35
|
+
BusinessTax.CN = new BusinessTax("CN", "USCC", "*0-000000-**********");
|
|
36
36
|
/**
|
|
37
37
|
* NZ, Inland Revenue (IRD)
|
|
38
38
|
*/
|
|
39
|
-
BusinessTax.NZ = new BusinessTax(
|
|
39
|
+
BusinessTax.NZ = new BusinessTax("NZ", "IRD", "00[0]-000-000");
|
|
40
40
|
/**
|
|
41
41
|
* US, Employer Identification Number (EIN)
|
|
42
42
|
*/
|
|
43
|
-
BusinessTax.US = new BusinessTax(
|
|
43
|
+
BusinessTax.US = new BusinessTax("US", "EIN", "00-0000000");
|
|
44
44
|
/**
|
|
45
45
|
* CA, tax ID number (Business Number, BN)
|
|
46
46
|
*/
|
|
47
|
-
BusinessTax.CA = new BusinessTax(
|
|
47
|
+
BusinessTax.CA = new BusinessTax("CA", "BN", "000000000");
|
|
48
48
|
/**
|
|
49
49
|
* HK, Business Registration Number (BRN)
|
|
50
50
|
*/
|
|
51
|
-
BusinessTax.HK = new BusinessTax(
|
|
51
|
+
BusinessTax.HK = new BusinessTax("HK", "BRN", "00000000");
|
|
52
52
|
/**
|
|
53
53
|
* All countries and regions
|
|
54
54
|
*/
|
|
@@ -13,9 +13,9 @@ var BusinessUtils;
|
|
|
13
13
|
* @param defaultTitle Default title
|
|
14
14
|
* @returns Result
|
|
15
15
|
*/
|
|
16
|
-
function formatAvatarTitle(title, maxChars = 3, defaultTitle =
|
|
16
|
+
function formatAvatarTitle(title, maxChars = 3, defaultTitle = "ME") {
|
|
17
17
|
// Just return for empty cases
|
|
18
|
-
if (title == null || title ===
|
|
18
|
+
if (title == null || title === "")
|
|
19
19
|
return defaultTitle;
|
|
20
20
|
// split with words
|
|
21
21
|
const items = title.trim().split(/\s+/g);
|
|
@@ -30,7 +30,7 @@ var BusinessUtils;
|
|
|
30
30
|
// First letter of each item
|
|
31
31
|
var firstLetters = items
|
|
32
32
|
.map((item) => item[0])
|
|
33
|
-
.join(
|
|
33
|
+
.join("")
|
|
34
34
|
.toUpperCase();
|
|
35
35
|
const flen = firstLetters.length;
|
|
36
36
|
if (flen <= maxChars)
|
|
@@ -48,13 +48,13 @@ var BusinessUtils;
|
|
|
48
48
|
const allCultures = data.cultures ?? [];
|
|
49
49
|
cultures.forEach((culture) => {
|
|
50
50
|
if (!allCultures.some((a) => a.id === culture.id)) {
|
|
51
|
-
allCultures.push({ id: culture.id, title:
|
|
51
|
+
allCultures.push({ id: culture.id, title: "" });
|
|
52
52
|
}
|
|
53
53
|
});
|
|
54
54
|
// Remove the default culture
|
|
55
55
|
allCultures.remove((a) => a.id === cultures[0].id);
|
|
56
56
|
// Sort
|
|
57
|
-
allCultures.sortByProperty(
|
|
57
|
+
allCultures.sortByProperty("id", cultures.map((c) => c.id));
|
|
58
58
|
// Set back
|
|
59
59
|
data.cultures = allCultures;
|
|
60
60
|
}
|
|
@@ -5,14 +5,14 @@ exports.Currencies = void 0;
|
|
|
5
5
|
* Currency array
|
|
6
6
|
*/
|
|
7
7
|
exports.Currencies = [
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
"AUD",
|
|
9
|
+
"CAD",
|
|
10
|
+
"CNY",
|
|
11
|
+
"EUR",
|
|
12
|
+
"GBP",
|
|
13
|
+
"HKD",
|
|
14
|
+
"JPY",
|
|
15
|
+
"NZD",
|
|
16
|
+
"SGD",
|
|
17
|
+
"USD"
|
|
18
18
|
];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataTypes, IStorage, IdType } from
|
|
2
|
-
import { Currency } from
|
|
1
|
+
import { DataTypes, IStorage, IdType } from "@etsoo/shared";
|
|
2
|
+
import { Currency } from "./Currency";
|
|
3
3
|
/**
|
|
4
4
|
* Shopping cart owner
|
|
5
5
|
* 购物篮所有人
|
|
@@ -107,7 +107,7 @@ export type ShoppingCartItem = ShoppingCartItemBase & {
|
|
|
107
107
|
* Shopping cart change reason
|
|
108
108
|
* 购物篮改变原因
|
|
109
109
|
*/
|
|
110
|
-
export type ShoppingCartChangeReason =
|
|
110
|
+
export type ShoppingCartChangeReason = "add" | "clear" | "remove" | "title" | "update";
|
|
111
111
|
/**
|
|
112
112
|
* Shopping cart
|
|
113
113
|
* 购物篮
|
|
@@ -269,7 +269,7 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
|
|
|
269
269
|
* @param price Price
|
|
270
270
|
* @param overrideExisting Override existing price
|
|
271
271
|
*/
|
|
272
|
-
cachePrice(id: T[
|
|
272
|
+
cachePrice(id: T["id"], price: number, overrideExisting?: boolean): void;
|
|
273
273
|
/**
|
|
274
274
|
* Change currency
|
|
275
275
|
* @param currency Currency
|
|
@@ -296,7 +296,7 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
|
|
|
296
296
|
* @param id Item id
|
|
297
297
|
* @returns Result
|
|
298
298
|
*/
|
|
299
|
-
getItem(id: T[
|
|
299
|
+
getItem(id: T["id"]): T | undefined;
|
|
300
300
|
/**
|
|
301
301
|
* Push item
|
|
302
302
|
* 推送项目
|
|
@@ -343,7 +343,7 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
|
|
|
343
343
|
* @param itemCreator New item creator
|
|
344
344
|
* @returns Updated or not
|
|
345
345
|
*/
|
|
346
|
-
updateAssetItem(id: T[
|
|
346
|
+
updateAssetItem(id: T["id"], assetQty: number | undefined, itemCreator?: () => Omit<T, "id" | "price" | "assetQty" | "subtotal" | "discount" | "promotions">): boolean;
|
|
347
347
|
/**
|
|
348
348
|
* Update item
|
|
349
349
|
* 更新项目
|
|
@@ -352,17 +352,17 @@ export declare class ShoppingCart<T extends ShoppingCartItem> {
|
|
|
352
352
|
* @param itemCreator New item creator
|
|
353
353
|
* @returns Updated or not
|
|
354
354
|
*/
|
|
355
|
-
updateItem(id: T[
|
|
355
|
+
updateItem(id: T["id"], qty: number | undefined, itemCreator?: () => Omit<T, "id" | "price" | "qty" | "subtotal" | "discount" | "promotions">): boolean;
|
|
356
356
|
/**
|
|
357
357
|
* Update price
|
|
358
358
|
* @param id Item id
|
|
359
359
|
* @param price New price
|
|
360
360
|
*/
|
|
361
|
-
updatePrice(id: T[
|
|
361
|
+
updatePrice(id: T["id"], price: number): void;
|
|
362
362
|
/**
|
|
363
363
|
* Update title
|
|
364
364
|
* @param id Item id
|
|
365
365
|
* @param title New title
|
|
366
366
|
*/
|
|
367
|
-
updateTitle(id: T[
|
|
367
|
+
updateTitle(id: T["id"], title: string): void;
|
|
368
368
|
}
|