@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.
Files changed (196) hide show
  1. package/.github/workflows/main.yml +6 -5
  2. package/README.md +97 -71
  3. package/__tests__/app/CoreApp.ts +141 -143
  4. package/__tests__/app/Culture.ts +23 -23
  5. package/__tests__/app/TestApp.ts +107 -105
  6. package/__tests__/business/BusinessUtils.ts +37 -37
  7. package/__tests__/result/ActionResult.ts +14 -14
  8. package/__tests__/tsconfig.json +16 -16
  9. package/babel.config.json +8 -8
  10. package/lib/cjs/address/AddressAutocomplete.d.ts +1 -1
  11. package/lib/cjs/address/AddressPlace.d.ts +3 -3
  12. package/lib/cjs/address/AddressPlaceBase.d.ts +1 -1
  13. package/lib/cjs/address/AddressRegion.d.ts +2 -2
  14. package/lib/cjs/address/AddressRegion.js +12 -12
  15. package/lib/cjs/address/AddressUtils.d.ts +1 -1
  16. package/lib/cjs/api/AuthApi.d.ts +14 -14
  17. package/lib/cjs/api/AuthApi.js +17 -17
  18. package/lib/cjs/api/BaseApi.d.ts +1 -1
  19. package/lib/cjs/api/EntityApi.d.ts +8 -8
  20. package/lib/cjs/api/EntityApi.js +4 -4
  21. package/lib/cjs/api/dto/AuditLineDto.d.ts +24 -0
  22. package/lib/cjs/api/dto/AuditLineDto.js +2 -0
  23. package/lib/cjs/api/dto/IdLabelDto.d.ts +1 -1
  24. package/lib/cjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  25. package/lib/cjs/api/dto/PinDto.d.ts +61 -0
  26. package/lib/cjs/api/dto/PinDto.js +2 -0
  27. package/lib/cjs/api/dto/ResultPayload.d.ts +2 -2
  28. package/lib/cjs/api/rq/AuthRequest.d.ts +1 -1
  29. package/lib/cjs/api/rq/LoginRQ.d.ts +2 -2
  30. package/lib/cjs/api/rq/MergeRQ.d.ts +1 -1
  31. package/lib/cjs/api/rq/QueryRQ.d.ts +2 -2
  32. package/lib/cjs/api/rq/StatusQueryRQ.d.ts +3 -3
  33. package/lib/cjs/api/rq/UpdateModel.d.ts +2 -2
  34. package/lib/cjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  35. package/lib/cjs/app/AppSettings.d.ts +3 -3
  36. package/lib/cjs/bridges/FlutterHost.d.ts +2 -2
  37. package/lib/cjs/bridges/FlutterHost.js +11 -11
  38. package/lib/cjs/business/BusinessTax.js +6 -6
  39. package/lib/cjs/business/BusinessUtils.d.ts +2 -2
  40. package/lib/cjs/business/BusinessUtils.js +5 -5
  41. package/lib/cjs/business/Currency.d.ts +1 -1
  42. package/lib/cjs/business/Currency.js +10 -10
  43. package/lib/cjs/business/ProductUnit.d.ts +1 -1
  44. package/lib/cjs/business/ShoppingCart.d.ts +9 -9
  45. package/lib/cjs/business/ShoppingCart.js +11 -11
  46. package/lib/cjs/custom/CustomField.d.ts +1 -1
  47. package/lib/cjs/custom/CustomFieldData.d.ts +2 -2
  48. package/lib/cjs/i18n/Culture.d.ts +31 -0
  49. package/lib/cjs/i18n/Culture.js +51 -0
  50. package/lib/cjs/index.d.ts +3 -4
  51. package/lib/cjs/index.js +3 -4
  52. package/lib/cjs/result/ActionResult.d.ts +1 -1
  53. package/lib/cjs/result/ActionResultError.d.ts +1 -1
  54. package/lib/cjs/result/ActionResultError.js +3 -3
  55. package/lib/cjs/result/InitCallResult.d.ts +1 -1
  56. package/lib/cjs/state/Culture.d.ts +2 -2
  57. package/lib/cjs/state/User.d.ts +1 -1
  58. package/lib/mjs/address/AddressAutocomplete.d.ts +1 -1
  59. package/lib/mjs/address/AddressPlace.d.ts +3 -3
  60. package/lib/mjs/address/AddressPlaceBase.d.ts +1 -1
  61. package/lib/mjs/address/AddressRegion.d.ts +2 -2
  62. package/lib/mjs/address/AddressRegion.js +13 -13
  63. package/lib/mjs/address/AddressUtils.d.ts +1 -1
  64. package/lib/mjs/address/AddressUtils.js +1 -1
  65. package/lib/mjs/api/AuthApi.d.ts +14 -14
  66. package/lib/mjs/api/AuthApi.js +19 -19
  67. package/lib/mjs/api/BaseApi.d.ts +1 -1
  68. package/lib/mjs/api/EntityApi.d.ts +8 -8
  69. package/lib/mjs/api/EntityApi.js +5 -5
  70. package/lib/mjs/api/dto/AuditLineDto.d.ts +24 -0
  71. package/lib/mjs/api/dto/AuditLineDto.js +1 -0
  72. package/lib/mjs/api/dto/IdLabelDto.d.ts +1 -1
  73. package/lib/mjs/api/dto/IdLabelPrimaryDto.d.ts +1 -1
  74. package/lib/mjs/api/dto/PinDto.d.ts +61 -0
  75. package/lib/mjs/api/dto/PinDto.js +1 -0
  76. package/lib/mjs/api/dto/ResultPayload.d.ts +2 -2
  77. package/lib/mjs/api/rq/AuthRequest.d.ts +1 -1
  78. package/lib/mjs/api/rq/LoginRQ.d.ts +2 -2
  79. package/lib/mjs/api/rq/MergeRQ.d.ts +1 -1
  80. package/lib/mjs/api/rq/QueryRQ.d.ts +2 -2
  81. package/lib/mjs/api/rq/StatusQueryRQ.d.ts +3 -3
  82. package/lib/mjs/api/rq/UpdateModel.d.ts +2 -2
  83. package/lib/mjs/api/rq/UpdateStatusRQ.d.ts +2 -2
  84. package/lib/mjs/app/AppSettings.d.ts +3 -3
  85. package/lib/mjs/bridges/FlutterHost.d.ts +2 -2
  86. package/lib/mjs/bridges/FlutterHost.js +13 -13
  87. package/lib/mjs/business/BusinessTax.js +6 -6
  88. package/lib/mjs/business/BusinessUtils.d.ts +2 -2
  89. package/lib/mjs/business/BusinessUtils.js +5 -5
  90. package/lib/mjs/business/Currency.d.ts +1 -1
  91. package/lib/mjs/business/Currency.js +10 -10
  92. package/lib/mjs/business/ProductUnit.d.ts +1 -1
  93. package/lib/mjs/business/ProductUnit.js +1 -1
  94. package/lib/mjs/business/ShoppingCart.d.ts +9 -9
  95. package/lib/mjs/business/ShoppingCart.js +12 -12
  96. package/lib/mjs/custom/CustomField.d.ts +1 -1
  97. package/lib/mjs/custom/CustomFieldData.d.ts +2 -2
  98. package/lib/mjs/i18n/Culture.d.ts +31 -0
  99. package/lib/mjs/i18n/Culture.js +48 -0
  100. package/lib/mjs/index.d.ts +3 -4
  101. package/lib/mjs/index.js +3 -4
  102. package/lib/mjs/result/ActionResult.d.ts +1 -1
  103. package/lib/mjs/result/ActionResult.js +1 -1
  104. package/lib/mjs/result/ActionResultError.d.ts +1 -1
  105. package/lib/mjs/result/ActionResultError.js +3 -3
  106. package/lib/mjs/result/InitCallResult.d.ts +1 -1
  107. package/lib/mjs/state/Culture.d.ts +2 -2
  108. package/lib/mjs/state/User.d.ts +1 -1
  109. package/package.json +1 -1
  110. package/src/address/AddressAutocomplete.ts +16 -16
  111. package/src/address/AddressCity.ts +12 -12
  112. package/src/address/AddressContinent.ts +35 -35
  113. package/src/address/AddressDistrict.ts +12 -12
  114. package/src/address/AddressLocation.ts +8 -8
  115. package/src/address/AddressPlace.ts +23 -23
  116. package/src/address/AddressPlaceBase.ts +31 -31
  117. package/src/address/AddressRegion.ts +286 -286
  118. package/src/address/AddressState.ts +12 -12
  119. package/src/address/AddressUtils.ts +27 -27
  120. package/src/api/AuthApi.ts +194 -194
  121. package/src/api/BaseApi.ts +13 -13
  122. package/src/api/EntityApi.ts +181 -194
  123. package/src/api/dto/AntiforgeryRequestToken.ts +15 -15
  124. package/src/api/dto/ApiRefreshTokenDto.ts +16 -16
  125. package/src/api/dto/AuditLineDto.ts +27 -0
  126. package/src/api/dto/IdLabelDto.ts +3 -3
  127. package/src/api/dto/IdLabelPrimaryDto.ts +7 -7
  128. package/src/api/dto/InitCallDto.ts +12 -12
  129. package/src/api/dto/PinDto.ts +71 -0
  130. package/src/api/dto/ResultPayload.ts +6 -6
  131. package/src/api/rq/ApiRefreshTokenRQ.ts +8 -8
  132. package/src/api/rq/AuthRequest.ts +40 -40
  133. package/src/api/rq/GetLogInUrlRQ.ts +8 -8
  134. package/src/api/rq/LoginIdRQ.ts +12 -12
  135. package/src/api/rq/LoginRQ.ts +18 -18
  136. package/src/api/rq/MergeRQ.ts +13 -13
  137. package/src/api/rq/QueryPagingData.ts +16 -16
  138. package/src/api/rq/QueryRQ.ts +22 -22
  139. package/src/api/rq/RefreshTokenRQ.ts +4 -4
  140. package/src/api/rq/ResetPasswordRQ.ts +20 -20
  141. package/src/api/rq/SignoutRQ.ts +8 -8
  142. package/src/api/rq/StatusQueryRQ.ts +11 -11
  143. package/src/api/rq/SwitchOrgRQ.ts +8 -8
  144. package/src/api/rq/TokenRQ.ts +4 -4
  145. package/src/api/rq/UpdateModel.ts +12 -12
  146. package/src/api/rq/UpdateStatusRQ.ts +10 -10
  147. package/src/app/AppSettings.ts +27 -27
  148. package/src/app/UserRole.ts +44 -44
  149. package/src/bridges/FlutterHost.ts +92 -97
  150. package/src/bridges/IBridgeHost.ts +49 -51
  151. package/src/business/ApiService.ts +25 -25
  152. package/src/business/BusinessTax.ts +63 -63
  153. package/src/business/BusinessUtils.ts +75 -75
  154. package/src/business/CultureItem.ts +43 -43
  155. package/src/business/Currency.ts +11 -11
  156. package/src/business/DataPrivacy.ts +35 -35
  157. package/src/business/EntityStatus.ts +44 -44
  158. package/src/business/ProductUnit.ts +58 -58
  159. package/src/business/RepeatOption.ts +50 -50
  160. package/src/business/ShoppingCart.ts +696 -706
  161. package/src/custom/CustomField.ts +20 -20
  162. package/src/custom/CustomFieldData.ts +43 -43
  163. package/src/def/ListItem.ts +12 -12
  164. package/src/i18n/Culture.ts +60 -0
  165. package/src/i18n/en.json +244 -244
  166. package/src/i18n/zh-Hans.json +244 -244
  167. package/src/i18n/zh-Hant.json +244 -244
  168. package/src/index.ts +3 -4
  169. package/src/result/ActionResult.ts +19 -19
  170. package/src/result/ActionResultError.ts +30 -30
  171. package/src/result/InitCallResult.ts +21 -21
  172. package/src/state/Culture.ts +3 -3
  173. package/src/state/State.ts +5 -5
  174. package/src/state/User.ts +92 -92
  175. package/tsconfig.cjs.json +17 -17
  176. package/tsconfig.json +17 -17
  177. package/lib/cjs/i18n/CultureUtils.d.ts +0 -13
  178. package/lib/cjs/i18n/CultureUtils.js +0 -32
  179. package/lib/cjs/i18n/en.d.ts +0 -6
  180. package/lib/cjs/i18n/en.js +0 -12
  181. package/lib/cjs/i18n/zhHans.d.ts +0 -6
  182. package/lib/cjs/i18n/zhHans.js +0 -12
  183. package/lib/cjs/i18n/zhHant.d.ts +0 -6
  184. package/lib/cjs/i18n/zhHant.js +0 -12
  185. package/lib/mjs/i18n/CultureUtils.d.ts +0 -13
  186. package/lib/mjs/i18n/CultureUtils.js +0 -29
  187. package/lib/mjs/i18n/en.d.ts +0 -6
  188. package/lib/mjs/i18n/en.js +0 -8
  189. package/lib/mjs/i18n/zhHans.d.ts +0 -6
  190. package/lib/mjs/i18n/zhHans.js +0 -8
  191. package/lib/mjs/i18n/zhHant.d.ts +0 -6
  192. package/lib/mjs/i18n/zhHant.js +0 -8
  193. package/src/i18n/CultureUtils.ts +0 -36
  194. package/src/i18n/en.ts +0 -10
  195. package/src/i18n/zhHans.ts +0 -10
  196. 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 = 'ETSOO-CART-KEYS';
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('amount');
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('add', items);
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('clear', []);
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('remove', removedItems);
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('update', []);
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('amount');
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('update', [item, newItem]);
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('update', [item, newItem]);
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('update', [item, newItem]);
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('title', [item, newItem]);
495
+ this.doChange("title", [item, newItem]);
496
496
  }
497
497
  }
498
498
  }
@@ -1,4 +1,4 @@
1
- import { CustomFieldData } from './CustomFieldData';
1
+ import { CustomFieldData } from "./CustomFieldData";
2
2
  /**
3
3
  * Custom field reference
4
4
  * 自定义字段引用
@@ -1,9 +1,9 @@
1
- import { IdType, ListType2 } from '@etsoo/shared';
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 = 'quater' | 'half' | 'half1' | 'full' | 'five' | 'seven';
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 = {}));
@@ -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/CultureUtils";
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/CultureUtils"), exports);
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; } });
@@ -1,4 +1,4 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
  /**
3
3
  * Action result
4
4
  */
@@ -1,4 +1,4 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
  /**
3
3
  * Action result error
4
4
  */
@@ -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 || 'Error'}${add}`;
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 = 'ActionResultError';
32
+ this.name = "ActionResultError";
33
33
  // Hold the result
34
34
  this.result = result;
35
35
  }
@@ -1,4 +1,4 @@
1
- import { IActionResult } from '@etsoo/shared';
1
+ import { IActionResult } from "@etsoo/shared";
2
2
  /**
3
3
  * Init call result data
4
4
  */
@@ -1,5 +1,5 @@
1
- import { DataTypes } from '@etsoo/shared';
2
- import { IState } from './State';
1
+ import { DataTypes } from "@etsoo/shared";
2
+ import { IState } from "./State";
3
3
  /**
4
4
  * Culture resources state, simple i18n solution
5
5
  * For premium solution: https://www.i18next.com/
@@ -1,4 +1,4 @@
1
- import { IState } from './State';
1
+ import { IState } from "./State";
2
2
  /**
3
3
  * User data interface
4
4
  */
@@ -1,4 +1,4 @@
1
- import { AddressPlaceBase } from './AddressPlaceBase';
1
+ import { AddressPlaceBase } from "./AddressPlaceBase";
2
2
  /**
3
3
  * Address autocomplete
4
4
  * 地点自动填充
@@ -1,10 +1,10 @@
1
- import { AddressLocation } from './AddressLocation';
2
- import { AddressPlaceBase } from './AddressPlaceBase';
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, 'location'> & {
7
+ export type AddressPlace = Omit<AddressPlaceBase, "location"> & {
8
8
  /**
9
9
  * Place id
10
10
  * 地点编号
@@ -1,4 +1,4 @@
1
- import { AddressLocation } from './AddressLocation';
1
+ import { AddressLocation } from "./AddressLocation";
2
2
  /**
3
3
  * Address place base
4
4
  * 基础地点
@@ -1,5 +1,5 @@
1
- import { Currency } from '../business/Currency';
2
- import { AddressContinent, AddressContinentId } from './AddressContinent';
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 './AddressContinent';
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('CN', 'CHN', '156', AddressContinent.AS, '00', '+86', '0', 'CNY', ['zh-Hans-CN', 'zh-CN']);
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('HK', 'HKG', '344', AddressContinent.AS, '001', '+852', undefined, 'HKD', ['zh-Hant-HK', 'zh-HK', 'en-HK']);
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('SG', 'SGP', '702', AddressContinent.AS, '000', '+65', undefined, 'SGD', ['zh-Hans-SG', 'zh-SG', 'en-SG']);
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('JP', 'JPN', '392', AddressContinent.AS, '010', '+81', '0', 'JPY', ['ja-JP']);
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('US', 'USA', '840', AddressContinent.NA, '011', '+1', '1', 'USD', ['en-US']);
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('CA', 'CAN', '124', AddressContinent.NA, '011', '+1', '1', 'CAD', ['en-CA', 'fr-CA']);
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('AU', 'AUS', '036', AddressContinent.OC, '0011', '+61', '0', 'AUD', ['en-AU']);
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('NZ', 'NZL', '554', AddressContinent.OC, '00', '+64', '0', 'NZD', ['en-NZ', 'mi-NZ']);
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('GB', 'GBR', '826', AddressContinent.EU, '00', '+44', '0', 'GBP', ['en-GB']);
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('IE', 'IRL', '372', AddressContinent.EU, '00', '+353', '0', 'EUR', ['en-IE']);
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('DE', 'DEU', '276', AddressContinent.EU, '00', '+49', '0', 'EUR', ['de-DE']);
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('FR', 'FRA', '250', AddressContinent.EU, '00', '+33', '0', 'EUR', ['fr-FR']);
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
  */
@@ -1,4 +1,4 @@
1
- import { AddressRegion } from './AddressRegion';
1
+ import { AddressRegion } from "./AddressRegion";
2
2
  /**
3
3
  * Address utils
4
4
  */
@@ -1,4 +1,4 @@
1
- import { AddressRegion } from './AddressRegion';
1
+ import { AddressRegion } from "./AddressRegion";
2
2
  /**
3
3
  * Address utils
4
4
  */
@@ -1,17 +1,17 @@
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';
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
  */
@@ -1,5 +1,5 @@
1
- import { BaseApi } from './BaseApi';
2
- import { ActionResult } from '@etsoo/shared';
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('Auth/ApiRefreshToken', rq, payload);
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('Auth/AuthRequest', auth, payload);
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('Auth/ExchangeToken', rq, payload);
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('Auth/GetLogInUrl', rq, payload);
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('Auth/Login', rq, payload);
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('Auth/LoginId', rq, payload);
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 = 'Auth/RefreshToken', showLoading = false, token, tokenField = AuthApi.HeaderTokenField } = props ?? {};
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: 'noData',
91
- field: 'token',
92
- title: this.app.get('noData')
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: 'unknownError',
117
- field: 'result',
118
- title: this.app.get('unknownError')
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('Auth/ResetPassword', rq, payload);
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('Auth/Signout', rq, payload);
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('Auth/SwitchOrg', rq, payload);
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 = 'Etsoo-Refresh-Token';
156
+ AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
@@ -1,4 +1,4 @@
1
- import { IApp } from '../app/IApp';
1
+ import { IApp } from "../app/IApp";
2
2
  /**
3
3
  * SmartERP base API
4
4
  */
@@ -1,11 +1,11 @@
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';
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