@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ShoppingCart = void 0;
|
|
4
4
|
const shared_1 = require("@etsoo/shared");
|
|
5
|
-
const ShoppingCartKeyField =
|
|
5
|
+
const ShoppingCartKeyField = "ETSOO-CART-KEYS";
|
|
6
6
|
/**
|
|
7
7
|
* Shopping cart
|
|
8
8
|
* 购物篮
|
|
@@ -140,7 +140,7 @@ class ShoppingCart {
|
|
|
140
140
|
const subtotal = this.items
|
|
141
141
|
.map((item) => item.subtotal - item.discount)
|
|
142
142
|
.sum();
|
|
143
|
-
const discount = this.promotions.sum(
|
|
143
|
+
const discount = this.promotions.sum("amount");
|
|
144
144
|
return subtotal - discount;
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
@@ -206,7 +206,7 @@ class ShoppingCart {
|
|
|
206
206
|
*/
|
|
207
207
|
addItems(items) {
|
|
208
208
|
this.items.push(...items);
|
|
209
|
-
this.doChange(
|
|
209
|
+
this.doChange("add", items);
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
212
|
* Cache price
|
|
@@ -249,7 +249,7 @@ class ShoppingCart {
|
|
|
249
249
|
ShoppingCart.clear(this.identifier, this.storage);
|
|
250
250
|
this.keys.remove(this.identifier);
|
|
251
251
|
}
|
|
252
|
-
this.doChange(
|
|
252
|
+
this.doChange("clear", []);
|
|
253
253
|
}
|
|
254
254
|
/**
|
|
255
255
|
* Format amount
|
|
@@ -298,7 +298,7 @@ class ShoppingCart {
|
|
|
298
298
|
*/
|
|
299
299
|
removeItem(index) {
|
|
300
300
|
const removedItems = this.items.splice(index, 1);
|
|
301
|
-
this.doChange(
|
|
301
|
+
this.doChange("remove", removedItems);
|
|
302
302
|
}
|
|
303
303
|
/**
|
|
304
304
|
* Reset item
|
|
@@ -349,14 +349,14 @@ class ShoppingCart {
|
|
|
349
349
|
* 触发更新
|
|
350
350
|
*/
|
|
351
351
|
update() {
|
|
352
|
-
this.doChange(
|
|
352
|
+
this.doChange("update", []);
|
|
353
353
|
}
|
|
354
354
|
/**
|
|
355
355
|
* Update discount
|
|
356
356
|
* @param item Shopping cart item
|
|
357
357
|
*/
|
|
358
358
|
updateDiscount(item) {
|
|
359
|
-
item.discount = item.promotions.sum(
|
|
359
|
+
item.discount = item.promotions.sum("amount");
|
|
360
360
|
}
|
|
361
361
|
/**
|
|
362
362
|
* Update asset item
|
|
@@ -403,7 +403,7 @@ class ShoppingCart {
|
|
|
403
403
|
discount: 0
|
|
404
404
|
};
|
|
405
405
|
this.items.splice(index, 1, newItem);
|
|
406
|
-
this.doChange(
|
|
406
|
+
this.doChange("update", [item, newItem]);
|
|
407
407
|
}
|
|
408
408
|
return true;
|
|
409
409
|
}
|
|
@@ -454,7 +454,7 @@ class ShoppingCart {
|
|
|
454
454
|
discount: 0
|
|
455
455
|
};
|
|
456
456
|
this.items.splice(index, 1, newItem);
|
|
457
|
-
this.doChange(
|
|
457
|
+
this.doChange("update", [item, newItem]);
|
|
458
458
|
}
|
|
459
459
|
return true;
|
|
460
460
|
}
|
|
@@ -476,7 +476,7 @@ class ShoppingCart {
|
|
|
476
476
|
subtotal: price * qty * assetQty
|
|
477
477
|
};
|
|
478
478
|
this.items.splice(index, 1, newItem);
|
|
479
|
-
this.doChange(
|
|
479
|
+
this.doChange("update", [item, newItem]);
|
|
480
480
|
}
|
|
481
481
|
}
|
|
482
482
|
/**
|
|
@@ -492,7 +492,7 @@ class ShoppingCart {
|
|
|
492
492
|
if (newItem.name === newItem.title)
|
|
493
493
|
newItem.title = undefined;
|
|
494
494
|
this.items.splice(index, 1, newItem);
|
|
495
|
-
this.doChange(
|
|
495
|
+
this.doChange("title", [item, newItem]);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
498
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IdType, ListType2 } from
|
|
1
|
+
import { IdType, ListType2 } from "@etsoo/shared";
|
|
2
2
|
/**
|
|
3
3
|
* Custom field space (12 columns)
|
|
4
4
|
* 自定义字段空间(12列)
|
|
5
5
|
*/
|
|
6
|
-
export type CustomFieldSpace =
|
|
6
|
+
export type CustomFieldSpace = "quater" | "half" | "half1" | "full" | "five" | "seven";
|
|
7
7
|
/**
|
|
8
8
|
* Custom field data
|
|
9
9
|
* 自定义字段数据
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { DataTypes, DomUtils } from "@etsoo/shared";
|
|
2
|
+
/**
|
|
3
|
+
* Culture namespace
|
|
4
|
+
*/
|
|
5
|
+
export declare namespace Culture {
|
|
6
|
+
/**
|
|
7
|
+
* Make culture
|
|
8
|
+
* @param cultureMaker Culture maker
|
|
9
|
+
* @param resources Resources
|
|
10
|
+
* @returns Culture
|
|
11
|
+
*/
|
|
12
|
+
function make(cultureMaker: typeof DomUtils.zhHans, ...resources: (object | (() => Promise<object>))[]): DataTypes.CultureDefinition<DataTypes.StringRecord>;
|
|
13
|
+
/**
|
|
14
|
+
* Get en neutral culture
|
|
15
|
+
* @param localResources Local resources
|
|
16
|
+
* @returns Full culture
|
|
17
|
+
*/
|
|
18
|
+
const en: (...resources: (object | (() => Promise<object>))[]) => DataTypes.CultureDefinition<DataTypes.StringRecord>;
|
|
19
|
+
/**
|
|
20
|
+
* Get zh-Hans neutral cultrue
|
|
21
|
+
* @param localResources Local resources
|
|
22
|
+
* @returns Full culture
|
|
23
|
+
*/
|
|
24
|
+
const zhHans: (...resources: (object | (() => Promise<object>))[]) => DataTypes.CultureDefinition<DataTypes.StringRecord>;
|
|
25
|
+
/**
|
|
26
|
+
* Get zh-Hant neutral cultrue
|
|
27
|
+
* @param localResources Local resources
|
|
28
|
+
* @returns Full culture
|
|
29
|
+
*/
|
|
30
|
+
const zhHant: (...resources: (object | (() => Promise<object>))[]) => DataTypes.CultureDefinition<DataTypes.StringRecord>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Culture = void 0;
|
|
4
|
+
const shared_1 = require("@etsoo/shared");
|
|
5
|
+
/**
|
|
6
|
+
* Culture namespace
|
|
7
|
+
*/
|
|
8
|
+
var Culture;
|
|
9
|
+
(function (Culture) {
|
|
10
|
+
/**
|
|
11
|
+
* Make culture
|
|
12
|
+
* @param cultureMaker Culture maker
|
|
13
|
+
* @param resources Resources
|
|
14
|
+
* @returns Culture
|
|
15
|
+
*/
|
|
16
|
+
function make(cultureMaker, ...resources) {
|
|
17
|
+
return cultureMaker(async () => {
|
|
18
|
+
const rs = await Promise.all(resources.map((resource) => new Promise((resolve) => {
|
|
19
|
+
if (typeof resource === "object") {
|
|
20
|
+
resolve(resource);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
resource().then((result) => resolve(result));
|
|
24
|
+
}
|
|
25
|
+
})));
|
|
26
|
+
return rs.reduce((prev, curr) => ({
|
|
27
|
+
...prev,
|
|
28
|
+
...curr
|
|
29
|
+
}));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
Culture.make = make;
|
|
33
|
+
/**
|
|
34
|
+
* Get en neutral culture
|
|
35
|
+
* @param localResources Local resources
|
|
36
|
+
* @returns Full culture
|
|
37
|
+
*/
|
|
38
|
+
Culture.en = (...resources) => make(shared_1.DomUtils.en, import("./en.json"), ...resources);
|
|
39
|
+
/**
|
|
40
|
+
* Get zh-Hans neutral cultrue
|
|
41
|
+
* @param localResources Local resources
|
|
42
|
+
* @returns Full culture
|
|
43
|
+
*/
|
|
44
|
+
Culture.zhHans = (...resources) => make(shared_1.DomUtils.zhHans, import("./zh-Hans.json"), ...resources);
|
|
45
|
+
/**
|
|
46
|
+
* Get zh-Hant neutral cultrue
|
|
47
|
+
* @param localResources Local resources
|
|
48
|
+
* @returns Full culture
|
|
49
|
+
*/
|
|
50
|
+
Culture.zhHant = (...resources) => make(shared_1.DomUtils.zhHant, import("./zh-Hant.json"), ...resources);
|
|
51
|
+
})(Culture || (exports.Culture = Culture = {}));
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -10,9 +10,11 @@ export * from "./address/AddressState";
|
|
|
10
10
|
export * from "./address/AddressUtils";
|
|
11
11
|
export * from "./api/dto/AntiforgeryRequestToken";
|
|
12
12
|
export * from "./api/dto/ApiRefreshTokenDto";
|
|
13
|
+
export * from "./api/dto/AuditLineDto";
|
|
13
14
|
export * from "./api/dto/IdLabelDto";
|
|
14
15
|
export * from "./api/dto/IdLabelPrimaryDto";
|
|
15
16
|
export * from "./api/dto/InitCallDto";
|
|
17
|
+
export * from "./api/dto/PinDto";
|
|
16
18
|
export * from "./api/dto/ResultPayload";
|
|
17
19
|
export * from "./api/rq/ApiRefreshTokenRQ";
|
|
18
20
|
export * from "./api/rq/AuthRequest";
|
|
@@ -53,10 +55,7 @@ export * from "./business/ShoppingCart";
|
|
|
53
55
|
export * from "./custom/CustomField";
|
|
54
56
|
export * from "./custom/CustomFieldData";
|
|
55
57
|
export * from "./def/ListItem";
|
|
56
|
-
export * from "./i18n/
|
|
57
|
-
export * from "./i18n/en";
|
|
58
|
-
export * from "./i18n/zhHans";
|
|
59
|
-
export * from "./i18n/zhHant";
|
|
58
|
+
export * from "./i18n/Culture";
|
|
60
59
|
export { ApiAuthorizationScheme, ApiDataError, ApiMethod, ApiResponseType, createClient, createClientAsync } from "@etsoo/restclient";
|
|
61
60
|
export type { IApi, IApiPayload } from "@etsoo/restclient";
|
|
62
61
|
export * from "./result/ActionResult";
|
package/lib/cjs/index.js
CHANGED
|
@@ -29,9 +29,11 @@ __exportStar(require("./address/AddressUtils"), exports);
|
|
|
29
29
|
// api
|
|
30
30
|
__exportStar(require("./api/dto/AntiforgeryRequestToken"), exports);
|
|
31
31
|
__exportStar(require("./api/dto/ApiRefreshTokenDto"), exports);
|
|
32
|
+
__exportStar(require("./api/dto/AuditLineDto"), exports);
|
|
32
33
|
__exportStar(require("./api/dto/IdLabelDto"), exports);
|
|
33
34
|
__exportStar(require("./api/dto/IdLabelPrimaryDto"), exports);
|
|
34
35
|
__exportStar(require("./api/dto/InitCallDto"), exports);
|
|
36
|
+
__exportStar(require("./api/dto/PinDto"), exports);
|
|
35
37
|
__exportStar(require("./api/dto/ResultPayload"), exports);
|
|
36
38
|
__exportStar(require("./api/rq/ApiRefreshTokenRQ"), exports);
|
|
37
39
|
__exportStar(require("./api/rq/AuthRequest"), exports);
|
|
@@ -78,10 +80,7 @@ __exportStar(require("./custom/CustomFieldData"), exports);
|
|
|
78
80
|
// def
|
|
79
81
|
__exportStar(require("./def/ListItem"), exports);
|
|
80
82
|
// i18n
|
|
81
|
-
__exportStar(require("./i18n/
|
|
82
|
-
__exportStar(require("./i18n/en"), exports);
|
|
83
|
-
__exportStar(require("./i18n/zhHans"), exports);
|
|
84
|
-
__exportStar(require("./i18n/zhHant"), exports);
|
|
83
|
+
__exportStar(require("./i18n/Culture"), exports);
|
|
85
84
|
// @etsoo/restclient
|
|
86
85
|
var restclient_1 = require("@etsoo/restclient");
|
|
87
86
|
Object.defineProperty(exports, "ApiAuthorizationScheme", { enumerable: true, get: function () { return restclient_1.ApiAuthorizationScheme; } });
|
|
@@ -18,8 +18,8 @@ class ActionResultError extends Error {
|
|
|
18
18
|
addtions.push(result.type);
|
|
19
19
|
if (result.field)
|
|
20
20
|
addtions.push(result.field);
|
|
21
|
-
const add = addtions.length > 0 ? ` (${addtions.join(
|
|
22
|
-
return `${result.title ||
|
|
21
|
+
const add = addtions.length > 0 ? ` (${addtions.join(", ")})` : "";
|
|
22
|
+
return `${result.title || "Error"}${add}`;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Constructor
|
|
@@ -29,7 +29,7 @@ class ActionResultError extends Error {
|
|
|
29
29
|
// Super
|
|
30
30
|
super(ActionResultError.format(result));
|
|
31
31
|
// Name
|
|
32
|
-
this.name =
|
|
32
|
+
this.name = "ActionResultError";
|
|
33
33
|
// Hold the result
|
|
34
34
|
this.result = result;
|
|
35
35
|
}
|
package/lib/cjs/state/User.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AddressLocation } from
|
|
2
|
-
import { AddressPlaceBase } from
|
|
1
|
+
import { AddressLocation } from "./AddressLocation";
|
|
2
|
+
import { AddressPlaceBase } from "./AddressPlaceBase";
|
|
3
3
|
/**
|
|
4
4
|
* Address place
|
|
5
5
|
* 地点
|
|
6
6
|
*/
|
|
7
|
-
export type AddressPlace = Omit<AddressPlaceBase,
|
|
7
|
+
export type AddressPlace = Omit<AddressPlaceBase, "location"> & {
|
|
8
8
|
/**
|
|
9
9
|
* Place id
|
|
10
10
|
* 地点编号
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Currency } from
|
|
2
|
-
import { AddressContinent, AddressContinentId } from
|
|
1
|
+
import { Currency } from "../business/Currency";
|
|
2
|
+
import { AddressContinent, AddressContinentId } from "./AddressContinent";
|
|
3
3
|
/**
|
|
4
4
|
* Address region in database
|
|
5
5
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddressContinent } from
|
|
1
|
+
import { AddressContinent } from "./AddressContinent";
|
|
2
2
|
/**
|
|
3
3
|
* Address or region
|
|
4
4
|
*/
|
|
@@ -28,62 +28,62 @@ export class AddressRegion {
|
|
|
28
28
|
/**
|
|
29
29
|
* CN - China
|
|
30
30
|
*/
|
|
31
|
-
AddressRegion.CN = new AddressRegion(
|
|
31
|
+
AddressRegion.CN = new AddressRegion("CN", "CHN", "156", AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
|
|
32
32
|
/**
|
|
33
33
|
* HK - HK, China
|
|
34
34
|
* 中国香港
|
|
35
35
|
*/
|
|
36
|
-
AddressRegion.HK = new AddressRegion(
|
|
36
|
+
AddressRegion.HK = new AddressRegion("HK", "HKG", "344", AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
|
|
37
37
|
/**
|
|
38
38
|
* SG - Singapore
|
|
39
39
|
* 新加坡
|
|
40
40
|
*/
|
|
41
|
-
AddressRegion.SG = new AddressRegion(
|
|
41
|
+
AddressRegion.SG = new AddressRegion("SG", "SGP", "702", AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
|
|
42
42
|
/**
|
|
43
43
|
* JP - Japan
|
|
44
44
|
* 日本
|
|
45
45
|
*/
|
|
46
|
-
AddressRegion.JP = new AddressRegion(
|
|
46
|
+
AddressRegion.JP = new AddressRegion("JP", "JPN", "392", AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
|
|
47
47
|
/**
|
|
48
48
|
* US - United States
|
|
49
49
|
* 美国
|
|
50
50
|
*/
|
|
51
|
-
AddressRegion.US = new AddressRegion(
|
|
51
|
+
AddressRegion.US = new AddressRegion("US", "USA", "840", AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
|
|
52
52
|
/**
|
|
53
53
|
* CA - Canada
|
|
54
54
|
* 加拿大
|
|
55
55
|
*/
|
|
56
|
-
AddressRegion.CA = new AddressRegion(
|
|
56
|
+
AddressRegion.CA = new AddressRegion("CA", "CAN", "124", AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
|
|
57
57
|
/**
|
|
58
58
|
* AU - Australia
|
|
59
59
|
* 澳大利亚
|
|
60
60
|
*/
|
|
61
|
-
AddressRegion.AU = new AddressRegion(
|
|
61
|
+
AddressRegion.AU = new AddressRegion("AU", "AUS", "036", AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
|
|
62
62
|
/**
|
|
63
63
|
* NZ - New Zealand
|
|
64
64
|
* 新西兰
|
|
65
65
|
*/
|
|
66
|
-
AddressRegion.NZ = new AddressRegion(
|
|
66
|
+
AddressRegion.NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
|
|
67
67
|
/**
|
|
68
68
|
* GB - Great Britain
|
|
69
69
|
* 英国
|
|
70
70
|
*/
|
|
71
|
-
AddressRegion.GB = new AddressRegion(
|
|
71
|
+
AddressRegion.GB = new AddressRegion("GB", "GBR", "826", AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
|
|
72
72
|
/**
|
|
73
73
|
* IE - Ireland
|
|
74
74
|
* 爱尔兰
|
|
75
75
|
*/
|
|
76
|
-
AddressRegion.IE = new AddressRegion(
|
|
76
|
+
AddressRegion.IE = new AddressRegion("IE", "IRL", "372", AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
|
|
77
77
|
/**
|
|
78
78
|
* DE - Germany
|
|
79
79
|
* 德国
|
|
80
80
|
*/
|
|
81
|
-
AddressRegion.DE = new AddressRegion(
|
|
81
|
+
AddressRegion.DE = new AddressRegion("DE", "DEU", "276", AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
|
|
82
82
|
/**
|
|
83
83
|
* FR - France
|
|
84
84
|
* 法国
|
|
85
85
|
*/
|
|
86
|
-
AddressRegion.FR = new AddressRegion(
|
|
86
|
+
AddressRegion.FR = new AddressRegion("FR", "FRA", "250", AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
|
|
87
87
|
/**
|
|
88
88
|
* All countries and regions
|
|
89
89
|
*/
|
package/lib/mjs/api/AuthApi.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { IApiPayload } from
|
|
2
|
-
import { IUser } from
|
|
3
|
-
import { BaseApi } from
|
|
4
|
-
import { ResultPayload } from
|
|
5
|
-
import { IActionResult } from
|
|
6
|
-
import { RefreshTokenProps, RefreshTokenResult } from
|
|
7
|
-
import { TokenRQ } from
|
|
8
|
-
import { ApiRefreshTokenDto } from
|
|
9
|
-
import { GetLogInUrlRQ } from
|
|
10
|
-
import { LoginRQ } from
|
|
11
|
-
import { ResetPasswordRQ } from
|
|
12
|
-
import { SignoutRQ } from
|
|
13
|
-
import { SwitchOrgRQ } from
|
|
14
|
-
import { AuthRequest } from
|
|
1
|
+
import { IApiPayload } from "@etsoo/restclient";
|
|
2
|
+
import { IUser } from "../state/User";
|
|
3
|
+
import { BaseApi } from "./BaseApi";
|
|
4
|
+
import { ResultPayload } from "./dto/ResultPayload";
|
|
5
|
+
import { IActionResult } from "@etsoo/shared";
|
|
6
|
+
import { RefreshTokenProps, RefreshTokenResult } from "../app/IApp";
|
|
7
|
+
import { TokenRQ } from "./rq/TokenRQ";
|
|
8
|
+
import { ApiRefreshTokenDto } from "./dto/ApiRefreshTokenDto";
|
|
9
|
+
import { GetLogInUrlRQ } from "./rq/GetLogInUrlRQ";
|
|
10
|
+
import { LoginRQ } from "./rq/LoginRQ";
|
|
11
|
+
import { ResetPasswordRQ } from "./rq/ResetPasswordRQ";
|
|
12
|
+
import { SignoutRQ } from "./rq/SignoutRQ";
|
|
13
|
+
import { SwitchOrgRQ } from "./rq/SwitchOrgRQ";
|
|
14
|
+
import { AuthRequest } from "./rq/AuthRequest";
|
|
15
15
|
/**
|
|
16
16
|
* Authentication API
|
|
17
17
|
*/
|
package/lib/mjs/api/AuthApi.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BaseApi } from
|
|
2
|
-
import { ActionResult } from
|
|
1
|
+
import { BaseApi } from "./BaseApi";
|
|
2
|
+
import { ActionResult } from "@etsoo/shared";
|
|
3
3
|
/**
|
|
4
4
|
* Authentication API
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ export class AuthApi extends BaseApi {
|
|
|
11
11
|
* @returns Result
|
|
12
12
|
*/
|
|
13
13
|
apiRefreshToken(rq, payload) {
|
|
14
|
-
return this.api.put(
|
|
14
|
+
return this.api.put("Auth/ApiRefreshToken", rq, payload);
|
|
15
15
|
}
|
|
16
16
|
/**
|
|
17
17
|
* Authorization request
|
|
@@ -19,7 +19,7 @@ export class AuthApi extends BaseApi {
|
|
|
19
19
|
* @param payload Payload
|
|
20
20
|
*/
|
|
21
21
|
authRequest(auth, payload) {
|
|
22
|
-
return this.api.post(
|
|
22
|
+
return this.api.post("Auth/AuthRequest", auth, payload);
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Exchange token
|
|
@@ -28,7 +28,7 @@ export class AuthApi extends BaseApi {
|
|
|
28
28
|
* @returns Result
|
|
29
29
|
*/
|
|
30
30
|
exchangeToken(rq, payload) {
|
|
31
|
-
return this.api.put(
|
|
31
|
+
return this.api.put("Auth/ExchangeToken", rq, payload);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
* Get log in url
|
|
@@ -37,7 +37,7 @@ export class AuthApi extends BaseApi {
|
|
|
37
37
|
* @returns Result
|
|
38
38
|
*/
|
|
39
39
|
getLogInUrl(rq, payload) {
|
|
40
|
-
return this.api.get(
|
|
40
|
+
return this.api.get("Auth/GetLogInUrl", rq, payload);
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* Login
|
|
@@ -51,7 +51,7 @@ export class AuthApi extends BaseApi {
|
|
|
51
51
|
payload ?? (payload = {});
|
|
52
52
|
tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
|
|
53
53
|
// Call the API
|
|
54
|
-
const result = await this.api.post(
|
|
54
|
+
const result = await this.api.post("Auth/Login", rq, payload);
|
|
55
55
|
// Get the refresh token
|
|
56
56
|
const refreshToken = result?.ok
|
|
57
57
|
? this.app.getResponseToken(payload.response, tokenKey)
|
|
@@ -73,7 +73,7 @@ export class AuthApi extends BaseApi {
|
|
|
73
73
|
deviceId,
|
|
74
74
|
region
|
|
75
75
|
};
|
|
76
|
-
return this.api.post(
|
|
76
|
+
return this.api.post("Auth/LoginId", rq, payload);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
79
|
* Refresh token
|
|
@@ -82,14 +82,14 @@ export class AuthApi extends BaseApi {
|
|
|
82
82
|
*/
|
|
83
83
|
async refreshToken(props) {
|
|
84
84
|
// Destruct
|
|
85
|
-
const { api =
|
|
85
|
+
const { api = "Auth/RefreshToken", showLoading = false, token, tokenField = AuthApi.HeaderTokenField } = props ?? {};
|
|
86
86
|
// Check the token
|
|
87
87
|
if (!token) {
|
|
88
88
|
return {
|
|
89
89
|
ok: false,
|
|
90
|
-
type:
|
|
91
|
-
field:
|
|
92
|
-
title: this.app.get(
|
|
90
|
+
type: "noData",
|
|
91
|
+
field: "token",
|
|
92
|
+
title: this.app.get("noData")
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
// Reqest data
|
|
@@ -113,9 +113,9 @@ export class AuthApi extends BaseApi {
|
|
|
113
113
|
? ActionResult.create(this.api.lastError)
|
|
114
114
|
: {
|
|
115
115
|
ok: false,
|
|
116
|
-
type:
|
|
117
|
-
field:
|
|
118
|
-
title: this.app.get(
|
|
116
|
+
type: "unknownError",
|
|
117
|
+
field: "result",
|
|
118
|
+
title: this.app.get("unknownError")
|
|
119
119
|
};
|
|
120
120
|
}
|
|
121
121
|
// Token
|
|
@@ -130,7 +130,7 @@ export class AuthApi extends BaseApi {
|
|
|
130
130
|
* @returns Result
|
|
131
131
|
*/
|
|
132
132
|
resetPassword(rq, payload) {
|
|
133
|
-
return this.api.put(
|
|
133
|
+
return this.api.put("Auth/ResetPassword", rq, payload);
|
|
134
134
|
}
|
|
135
135
|
/**
|
|
136
136
|
* Signout
|
|
@@ -139,7 +139,7 @@ export class AuthApi extends BaseApi {
|
|
|
139
139
|
* @returns Result
|
|
140
140
|
*/
|
|
141
141
|
signout(rq, payload) {
|
|
142
|
-
return this.api.put(
|
|
142
|
+
return this.api.put("Auth/Signout", rq, payload);
|
|
143
143
|
}
|
|
144
144
|
/**
|
|
145
145
|
* Switch organization
|
|
@@ -147,10 +147,10 @@ export class AuthApi extends BaseApi {
|
|
|
147
147
|
* @param payload Payload
|
|
148
148
|
*/
|
|
149
149
|
switchOrg(rq, payload) {
|
|
150
|
-
return this.app.api.put(
|
|
150
|
+
return this.app.api.put("Auth/SwitchOrg", rq, payload);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
154
|
* Header token field name
|
|
155
155
|
*/
|
|
156
|
-
AuthApi.HeaderTokenField =
|
|
156
|
+
AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
|
package/lib/mjs/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
|