@etsoo/appscript 1.3.32 → 1.3.34

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 (98) hide show
  1. package/__tests__/app/CoreApp.ts +27 -4
  2. package/lib/cjs/address/AddressContinent.d.ts +1 -1
  3. package/lib/cjs/address/AddressRegion.d.ts +7 -1
  4. package/lib/cjs/address/AddressRegion.js +21 -20
  5. package/lib/cjs/address/AddressState.d.ts +1 -1
  6. package/lib/cjs/app/CoreApp.d.ts +13 -2
  7. package/lib/cjs/app/CoreApp.js +45 -49
  8. package/lib/cjs/app/IApp.d.ts +2 -17
  9. package/lib/cjs/bridges/FlutterHost.d.ts +2 -1
  10. package/lib/cjs/bridges/FlutterHost.js +1 -0
  11. package/lib/cjs/bridges/IBridgeHost.d.ts +5 -0
  12. package/lib/cjs/business/BusinessTax.js +6 -6
  13. package/lib/cjs/business/Currency.d.ts +1 -1
  14. package/lib/cjs/business/ProductUnit.d.ts +1 -1
  15. package/lib/cjs/def/ListItem.d.ts +1 -1
  16. package/lib/cjs/erp/AddressApi.d.ts +16 -2
  17. package/lib/cjs/erp/AddressApi.js +43 -12
  18. package/lib/cjs/erp/BaseApi.js +6 -6
  19. package/lib/cjs/erp/dto/AuditLineDto.d.ts +3 -3
  20. package/lib/cjs/erp/dto/CurrencyDto.d.ts +1 -1
  21. package/lib/cjs/erp/dto/ExchangeRateDto.d.ts +1 -1
  22. package/lib/cjs/erp/dto/ExchangeRateHistoryDto.d.ts +1 -1
  23. package/lib/cjs/erp/dto/IdLabelDto.d.ts +1 -1
  24. package/lib/cjs/erp/dto/IdLabelPrimaryDto.d.ts +1 -1
  25. package/lib/cjs/erp/dto/InitCallDto.d.ts +1 -1
  26. package/lib/cjs/erp/dto/OrgDto.d.ts +1 -1
  27. package/lib/cjs/erp/dto/OrgQueryDto.d.ts +1 -1
  28. package/lib/cjs/erp/dto/PublicProductDto.d.ts +2 -2
  29. package/lib/cjs/erp/dto/ResultPayload.d.ts +3 -3
  30. package/lib/cjs/erp/rq/MemberListRQ.d.ts +1 -1
  31. package/lib/cjs/erp/rq/OrgListRQ.d.ts +1 -1
  32. package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +1 -1
  33. package/lib/cjs/erp/rq/QueryRQ.d.ts +1 -1
  34. package/lib/cjs/erp/rq/RefreshTokenRQ.d.ts +1 -1
  35. package/lib/cjs/erp/rq/RegionsRQ.d.ts +14 -0
  36. package/lib/cjs/erp/rq/RegionsRQ.js +2 -0
  37. package/lib/cjs/erp/rq/TiplistRQ.d.ts +1 -1
  38. package/lib/cjs/i18n/en-US.json +1 -0
  39. package/lib/cjs/i18n/zh-CN.json +1 -0
  40. package/lib/cjs/i18n/zh-HK.json +1 -0
  41. package/lib/cjs/result/ActionResultError.js +12 -12
  42. package/lib/cjs/result/IActionResult.d.ts +2 -2
  43. package/lib/cjs/result/InitCallResult.d.ts +1 -1
  44. package/lib/cjs/state/User.d.ts +1 -1
  45. package/lib/mjs/address/AddressContinent.d.ts +1 -1
  46. package/lib/mjs/address/AddressRegion.d.ts +7 -1
  47. package/lib/mjs/address/AddressRegion.js +21 -20
  48. package/lib/mjs/address/AddressState.d.ts +1 -1
  49. package/lib/mjs/app/CoreApp.d.ts +13 -2
  50. package/lib/mjs/app/CoreApp.js +45 -49
  51. package/lib/mjs/app/IApp.d.ts +2 -17
  52. package/lib/mjs/bridges/FlutterHost.d.ts +2 -1
  53. package/lib/mjs/bridges/FlutterHost.js +1 -0
  54. package/lib/mjs/bridges/IBridgeHost.d.ts +5 -0
  55. package/lib/mjs/business/BusinessTax.js +6 -6
  56. package/lib/mjs/business/Currency.d.ts +1 -1
  57. package/lib/mjs/business/ProductUnit.d.ts +1 -1
  58. package/lib/mjs/def/ListItem.d.ts +1 -1
  59. package/lib/mjs/erp/AddressApi.d.ts +16 -2
  60. package/lib/mjs/erp/AddressApi.js +43 -12
  61. package/lib/mjs/erp/BaseApi.js +6 -6
  62. package/lib/mjs/erp/dto/AuditLineDto.d.ts +3 -3
  63. package/lib/mjs/erp/dto/CurrencyDto.d.ts +1 -1
  64. package/lib/mjs/erp/dto/ExchangeRateDto.d.ts +1 -1
  65. package/lib/mjs/erp/dto/ExchangeRateHistoryDto.d.ts +1 -1
  66. package/lib/mjs/erp/dto/IdLabelDto.d.ts +1 -1
  67. package/lib/mjs/erp/dto/IdLabelPrimaryDto.d.ts +1 -1
  68. package/lib/mjs/erp/dto/InitCallDto.d.ts +1 -1
  69. package/lib/mjs/erp/dto/OrgDto.d.ts +1 -1
  70. package/lib/mjs/erp/dto/OrgQueryDto.d.ts +1 -1
  71. package/lib/mjs/erp/dto/PublicProductDto.d.ts +2 -2
  72. package/lib/mjs/erp/dto/ResultPayload.d.ts +3 -3
  73. package/lib/mjs/erp/rq/MemberListRQ.d.ts +1 -1
  74. package/lib/mjs/erp/rq/OrgListRQ.d.ts +1 -1
  75. package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +1 -1
  76. package/lib/mjs/erp/rq/QueryRQ.d.ts +1 -1
  77. package/lib/mjs/erp/rq/RefreshTokenRQ.d.ts +1 -1
  78. package/lib/mjs/erp/rq/RegionsRQ.d.ts +14 -0
  79. package/lib/mjs/erp/rq/RegionsRQ.js +1 -0
  80. package/lib/mjs/erp/rq/TiplistRQ.d.ts +1 -1
  81. package/lib/mjs/i18n/en-US.json +1 -0
  82. package/lib/mjs/i18n/zh-CN.json +1 -0
  83. package/lib/mjs/i18n/zh-HK.json +1 -0
  84. package/lib/mjs/result/ActionResultError.js +12 -12
  85. package/lib/mjs/result/IActionResult.d.ts +2 -2
  86. package/lib/mjs/result/InitCallResult.d.ts +1 -1
  87. package/lib/mjs/state/User.d.ts +1 -1
  88. package/package.json +8 -8
  89. package/src/address/AddressRegion.ts +29 -10
  90. package/src/app/CoreApp.ts +2 -26
  91. package/src/app/IApp.ts +0 -25
  92. package/src/bridges/FlutterHost.ts +2 -0
  93. package/src/bridges/IBridgeHost.ts +6 -0
  94. package/src/erp/AddressApi.ts +72 -25
  95. package/src/erp/rq/RegionsRQ.ts +16 -0
  96. package/src/i18n/en-US.json +1 -0
  97. package/src/i18n/zh-CN.json +1 -0
  98. package/src/i18n/zh-HK.json +1 -0
@@ -2,4 +2,4 @@ import { ListType, ListType1 } from '@etsoo/shared';
2
2
  /**
3
3
  * Conditional IdLabel type
4
4
  */
5
- export declare type IdLabelConditional<T extends boolean> = T extends true ? ListType[] : ListType1[];
5
+ export type IdLabelConditional<T extends boolean> = T extends true ? ListType[] : ListType1[];
@@ -2,7 +2,7 @@ import { DataTypes } from '@etsoo/shared';
2
2
  /**
3
3
  * Dto with id, label and primary field
4
4
  */
5
- export declare type IdLabelPrimaryDto<T extends DataTypes.IdType = number> = DataTypes.IdLabelItem<T> & {
5
+ export type IdLabelPrimaryDto<T extends DataTypes.IdType = number> = DataTypes.IdLabelItem<T> & {
6
6
  /**
7
7
  * Is primary
8
8
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Init call dto
3
3
  */
4
- export declare type InitCallDto = {
4
+ export type InitCallDto = {
5
5
  /**
6
6
  * Device id
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Organization data
3
3
  */
4
- export declare type OrgDto = {
4
+ export type OrgDto = {
5
5
  /**
6
6
  * Id
7
7
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Organization query data
3
3
  */
4
- export declare type OrgQueryDto = {
4
+ export type OrgQueryDto = {
5
5
  /**
6
6
  * Id
7
7
  */
@@ -3,7 +3,7 @@ import { EntityStatus } from '../../business/EntityStatus';
3
3
  /**
4
4
  * Public product data
5
5
  */
6
- export declare type PublicProductDto = {
6
+ export type PublicProductDto = {
7
7
  /**
8
8
  * Id
9
9
  */
@@ -28,7 +28,7 @@ export declare type PublicProductDto = {
28
28
  /**
29
29
  * Public product with organization data
30
30
  */
31
- export declare type PublicOrgProductDto = PublicProductDto & {
31
+ export type PublicOrgProductDto = PublicProductDto & {
32
32
  /**
33
33
  * Purchased service status
34
34
  */
@@ -3,12 +3,12 @@ import { IActionResult, IdActionResult } from '../../result/IActionResult';
3
3
  /**
4
4
  * Action result payload
5
5
  */
6
- export declare type ResultPayload = IApiPayload<IActionResult>;
6
+ export type ResultPayload = IApiPayload<IActionResult>;
7
7
  /**
8
8
  * Number id action result payload
9
9
  */
10
- export declare type IdResultPayload = IApiPayload<IdActionResult>;
10
+ export type IdResultPayload = IApiPayload<IdActionResult>;
11
11
  /**
12
12
  * String id action result payload
13
13
  */
14
- export declare type StringIdResultPayload = IApiPayload<IdActionResult<string>>;
14
+ export type StringIdResultPayload = IApiPayload<IdActionResult<string>>;
@@ -2,4 +2,4 @@ import { TiplistRQ } from './TiplistRQ';
2
2
  /**
3
3
  * Member list request data
4
4
  */
5
- export declare type MemberListRQ = TiplistRQ<string> & {};
5
+ export type MemberListRQ = TiplistRQ<string> & {};
@@ -2,7 +2,7 @@ import { TiplistRQ } from './TiplistRQ';
2
2
  /**
3
3
  * Organization list request data
4
4
  */
5
- export declare type OrgListRQ = TiplistRQ & {
5
+ export type OrgListRQ = TiplistRQ & {
6
6
  /**
7
7
  * Service id
8
8
  */
@@ -2,7 +2,7 @@ import { QueryRQ } from './QueryRQ';
2
2
  /**
3
3
  * Organization query request data
4
4
  */
5
- export declare type OrgQueryRQ = QueryRQ & {
5
+ export type OrgQueryRQ = QueryRQ & {
6
6
  /**
7
7
  * Name
8
8
  */
@@ -3,7 +3,7 @@ import { DataTypes } from '@etsoo/shared';
3
3
  * Query request data
4
4
  * com.etsoo.CoreFramework.Models.QueryRQ
5
5
  */
6
- export declare type QueryRQ<T extends DataTypes.IdType = number> = {
6
+ export type QueryRQ<T extends DataTypes.IdType = number> = {
7
7
  /**
8
8
  * Number id
9
9
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Refresh token request data
3
3
  */
4
- export declare type RefreshTokenRQ = {
4
+ export type RefreshTokenRQ = {
5
5
  /**
6
6
  * Device id
7
7
  */
@@ -0,0 +1,14 @@
1
+ export type RegionsRQ = {
2
+ /**
3
+ * Favored country ids from top to bottom
4
+ */
5
+ favoredIds?: string[];
6
+ /**
7
+ * Items count to query
8
+ */
9
+ items?: number;
10
+ /**
11
+ * Filter keyword
12
+ */
13
+ keyword?: string;
14
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,7 +3,7 @@ import { DataTypes } from '@etsoo/shared';
3
3
  * Tiplist request data
4
4
  * com.etsoo.CoreFramework.Models.TiplistRQ
5
5
  */
6
- export declare type TiplistRQ<T extends DataTypes.IdType = number> = {
6
+ export type TiplistRQ<T extends DataTypes.IdType = number> = {
7
7
  /**
8
8
  * number id
9
9
  */
@@ -2,6 +2,7 @@
2
2
  "accountant": "Accountant",
3
3
  "actions": "Actions",
4
4
  "add": "Add",
5
+ "assignedId": "Assigned ID",
5
6
  "audits": "Audits",
6
7
  "author": "Author",
7
8
  "authorizer": "Authorizer",
@@ -2,6 +2,7 @@
2
2
  "accountant": "会计",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
+ "assignedId": "分配的编号",
5
6
  "audits": "操作历史",
6
7
  "author": "作者",
7
8
  "authorizer": "授权人",
@@ -2,6 +2,7 @@
2
2
  "accountant": "會計",
3
3
  "actions": "操作",
4
4
  "add": "添加",
5
+ "assignedId": "分配的編號",
5
6
  "audits": "操作歷史",
6
7
  "author": "作者",
7
8
  "authorizer": "授權人",
@@ -5,18 +5,6 @@ exports.ActionResultError = void 0;
5
5
  * Action result error
6
6
  */
7
7
  class ActionResultError extends Error {
8
- /**
9
- * Constructor
10
- * @param result Result
11
- */
12
- constructor(result) {
13
- // Super
14
- super(ActionResultError.format(result));
15
- // Name
16
- this.name = 'ActionResultError';
17
- // Hold the result
18
- this.result = result;
19
- }
20
8
  /**
21
9
  * Format the result to a meaningful string
22
10
  * @param result Result
@@ -33,5 +21,17 @@ class ActionResultError extends Error {
33
21
  var add = addtions.length > 0 ? ` (${addtions.join(', ')})` : '';
34
22
  return `${result.title || 'Error'}${add}`;
35
23
  }
24
+ /**
25
+ * Constructor
26
+ * @param result Result
27
+ */
28
+ constructor(result) {
29
+ // Super
30
+ super(ActionResultError.format(result));
31
+ // Name
32
+ this.name = 'ActionResultError';
33
+ // Hold the result
34
+ this.result = result;
35
+ }
36
36
  }
37
37
  exports.ActionResultError = ActionResultError;
@@ -50,10 +50,10 @@ export interface IActionResult<D extends object = {}> {
50
50
  /**
51
51
  * Action result with id data
52
52
  */
53
- export declare type IdActionResult<T extends DataTypes.IdType = number> = IActionResult<{
53
+ export type IdActionResult<T extends DataTypes.IdType = number> = IActionResult<{
54
54
  id: T;
55
55
  }>;
56
56
  /**
57
57
  * Action result with dynamic data
58
58
  */
59
- export declare type DynamicActionResult = IActionResult<Record<string, any>>;
59
+ export type DynamicActionResult = IActionResult<Record<string, any>>;
@@ -27,4 +27,4 @@ export interface InitCallResultData {
27
27
  /**
28
28
  * Init call result
29
29
  */
30
- export declare type InitCallResult = IActionResult<InitCallResultData>;
30
+ export type InitCallResult = IActionResult<InitCallResultData>;
@@ -35,7 +35,7 @@ export interface IUserData {
35
35
  /**
36
36
  * User data property keys
37
37
  */
38
- export declare type UserKey = keyof IUserData;
38
+ export type UserKey = keyof IUserData;
39
39
  /**
40
40
  * User interface
41
41
  */
@@ -13,4 +13,4 @@ export declare enum AddressContinent {
13
13
  /**
14
14
  * Address continent ids
15
15
  */
16
- export declare type AddressContinentId = keyof typeof AddressContinent;
16
+ export type AddressContinentId = keyof typeof AddressContinent;
@@ -30,6 +30,11 @@ export interface AddressRegionDb {
30
30
  * 国际拨号的电话退出代码
31
31
  */
32
32
  readonly exitCode: string;
33
+ /**
34
+ * National (truck) prefix
35
+ * 国内呼叫的拨号
36
+ */
37
+ readonly nationalPrefix?: string;
33
38
  /**
34
39
  * Area code for international dial, like 86 for China
35
40
  * 国际电话区号
@@ -71,6 +76,7 @@ export declare class AddressRegion implements IAddressRegion {
71
76
  continent: AddressContinent;
72
77
  exitCode: string;
73
78
  idd: string;
79
+ nationalPrefix: string | undefined;
74
80
  currency: Currency;
75
81
  languages: string[];
76
82
  label: string;
@@ -147,5 +153,5 @@ export declare class AddressRegion implements IAddressRegion {
147
153
  * 洲编号
148
154
  */
149
155
  readonly continentId: AddressContinentId;
150
- constructor(id: string, id3: string, nid: string, continent: AddressContinent, exitCode: string, idd: string, currency: Currency, languages: string[], label?: string);
156
+ constructor(id: string, id3: string, nid: string, continent: AddressContinent, exitCode: string, idd: string, nationalPrefix: string | undefined, currency: Currency, languages: string[], label?: string);
151
157
  }
@@ -3,86 +3,87 @@ import { AddressContinent } from './AddressContinent';
3
3
  * Address or region
4
4
  */
5
5
  export class AddressRegion {
6
+ /**
7
+ * Get country or region by id
8
+ * @param id Country id
9
+ */
10
+ static getById(id) {
11
+ return AddressRegion.all.find((c) => c.id === id);
12
+ }
6
13
  // Typescript constructor shorthand
7
- constructor(id, id3, nid, continent, exitCode, idd, currency, languages, label = id) {
14
+ constructor(id, id3, nid, continent, exitCode, idd, nationalPrefix, currency, languages, label = id) {
8
15
  this.id = id;
9
16
  this.id3 = id3;
10
17
  this.nid = nid;
11
18
  this.continent = continent;
12
19
  this.exitCode = exitCode;
13
20
  this.idd = idd;
21
+ this.nationalPrefix = nationalPrefix;
14
22
  this.currency = currency;
15
23
  this.languages = languages;
16
24
  this.label = label;
17
25
  this.continentId = AddressContinent[continent];
18
26
  }
19
- /**
20
- * Get country or region by id
21
- * @param id Country id
22
- */
23
- static getById(id) {
24
- return AddressRegion.all.find((c) => c.id === id);
25
- }
26
27
  }
27
28
  /**
28
29
  * CN - China
29
30
  */
30
- AddressRegion.CN = new AddressRegion('CN', 'CHN', '156', AddressContinent.AS, '00', '86', 'CNY', ['zh-CN']);
31
+ AddressRegion.CN = new AddressRegion('CN', 'CHN', '156', AddressContinent.AS, '00', '+86', '0', 'CNY', ['zh-CN']);
31
32
  /**
32
33
  * HK - HK, China
33
34
  * 中国香港
34
35
  */
35
- AddressRegion.HK = new AddressRegion('HK', 'HKG', '344', AddressContinent.AS, '001', '852', 'HKD', ['zh-HK', 'en-HK']);
36
+ AddressRegion.HK = new AddressRegion('HK', 'HKG', '344', AddressContinent.AS, '001', '+852', undefined, 'HKD', ['zh-HK', 'en-HK']);
36
37
  /**
37
38
  * SG - Singapore
38
39
  * 新加坡
39
40
  */
40
- AddressRegion.SG = new AddressRegion('SG', 'SGP', '702', AddressContinent.AS, '000', '65', 'SGD', ['zh-SG', 'en-SG']);
41
+ AddressRegion.SG = new AddressRegion('SG', 'SGP', '702', AddressContinent.AS, '000', '+65', undefined, 'SGD', ['zh-SG', 'en-SG']);
41
42
  /**
42
43
  * JP - Japan
43
44
  * 日本
44
45
  */
45
- AddressRegion.JP = new AddressRegion('JP', 'JPN', '392', AddressContinent.AS, '010', '81', 'JPY', ['ja-JP']);
46
+ AddressRegion.JP = new AddressRegion('JP', 'JPN', '392', AddressContinent.AS, '010', '+81', '0', 'JPY', ['ja-JP']);
46
47
  /**
47
48
  * US - United States
48
49
  * 美国
49
50
  */
50
- AddressRegion.US = new AddressRegion('US', 'USA', '840', AddressContinent.NA, '011', '1', 'USD', ['en-US']);
51
+ AddressRegion.US = new AddressRegion('US', 'USA', '840', AddressContinent.NA, '011', '+1', '1', 'USD', ['en-US']);
51
52
  /**
52
53
  * CA - Canada
53
54
  * 加拿大
54
55
  */
55
- AddressRegion.CA = new AddressRegion('CA', 'CAN', '124', AddressContinent.NA, '011', '1', 'CAD', ['en-CA', 'fr-CA']);
56
+ AddressRegion.CA = new AddressRegion('CA', 'CAN', '124', AddressContinent.NA, '011', '+1', '1', 'CAD', ['en-CA', 'fr-CA']);
56
57
  /**
57
58
  * AU - Australia
58
59
  * 澳大利亚
59
60
  */
60
- AddressRegion.AU = new AddressRegion('AU', 'AUS', '036', AddressContinent.OC, '0011', '61', 'AUD', ['en-AU']);
61
+ AddressRegion.AU = new AddressRegion('AU', 'AUS', '036', AddressContinent.OC, '0011', '+61', '0', 'AUD', ['en-AU']);
61
62
  /**
62
63
  * NZ - New Zealand
63
64
  * 新西兰
64
65
  */
65
- AddressRegion.NZ = new AddressRegion('NZ', 'NZL', '554', AddressContinent.OC, '00', '64', 'NZD', ['en-NZ', 'mi-NZ']);
66
+ AddressRegion.NZ = new AddressRegion('NZ', 'NZL', '554', AddressContinent.OC, '00', '+64', '0', 'NZD', ['en-NZ', 'mi-NZ']);
66
67
  /**
67
68
  * GB - Great Britain
68
69
  * 英国
69
70
  */
70
- AddressRegion.GB = new AddressRegion('GB', 'GBR', '826', AddressContinent.EU, '00', '44', 'GBP', ['en-GB']);
71
+ AddressRegion.GB = new AddressRegion('GB', 'GBR', '826', AddressContinent.EU, '00', '+44', '0', 'GBP', ['en-GB']);
71
72
  /**
72
73
  * IE - Ireland
73
74
  * 爱尔兰
74
75
  */
75
- AddressRegion.IE = new AddressRegion('IE', 'IRL', '372', AddressContinent.EU, '00', '353', 'EUR', ['en-IE']);
76
+ AddressRegion.IE = new AddressRegion('IE', 'IRL', '372', AddressContinent.EU, '00', '+353', '0', 'EUR', ['en-IE']);
76
77
  /**
77
78
  * DE - Germany
78
79
  * 德国
79
80
  */
80
- AddressRegion.DE = new AddressRegion('DE', 'DEU', '276', AddressContinent.EU, '00', '49', 'EUR', ['de-DE']);
81
+ AddressRegion.DE = new AddressRegion('DE', 'DEU', '276', AddressContinent.EU, '00', '+49', '0', 'EUR', ['de-DE']);
81
82
  /**
82
83
  * FR - France
83
84
  * 法国
84
85
  */
85
- AddressRegion.FR = new AddressRegion('FR', 'FRA', '250', AddressContinent.EU, '00', '33', 'EUR', ['fr-FR']);
86
+ AddressRegion.FR = new AddressRegion('FR', 'FRA', '250', AddressContinent.EU, '00', '+33', '0', 'EUR', ['fr-FR']);
86
87
  /**
87
88
  * All countries and regions
88
89
  */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Address state
3
3
  */
4
- export declare type AddressState = {
4
+ export type AddressState = {
5
5
  /**
6
6
  * Id
7
7
  */
@@ -286,9 +286,20 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
286
286
  * @returns string
287
287
  */
288
288
  formatDate(input?: Date | string, options?: DateUtils.FormatOptions, timeZone?: string): string | undefined;
289
- formatMoney(input: null | undefined, isInteger?: boolean, options?: Intl.NumberFormatOptions): undefined;
289
+ /**
290
+ * Format money number
291
+ * @param input Input money number
292
+ * @param isInteger Is integer
293
+ * @param options Options
294
+ * @returns Result
295
+ */
290
296
  formatMoney(input: number | bigint, isInteger?: boolean, options?: Intl.NumberFormatOptions): string;
291
- formatNumber(input: null | undefined, options?: Intl.NumberFormatOptions): undefined;
297
+ /**
298
+ * Format number
299
+ * @param input Input number
300
+ * @param options Options
301
+ * @returns Result
302
+ */
292
303
  formatNumber(input: number | bigint, options?: Intl.NumberFormatOptions): string;
293
304
  /**
294
305
  * Format error
@@ -12,51 +12,6 @@ import { UserRole } from './UserRole';
12
12
  * Core application
13
13
  */
14
14
  export class CoreApp {
15
- /**
16
- * Protected constructor
17
- * @param settings Settings
18
- * @param api API
19
- * @param notifier Notifier
20
- * @param storage Storage
21
- * @param name Application name
22
- */
23
- constructor(settings, api, notifier, storage, name) {
24
- this._authorized = false;
25
- this._isTryingLogin = false;
26
- /**
27
- * Last called with token refresh
28
- */
29
- this.lastCalled = false;
30
- /**
31
- * Token refresh count down seed
32
- */
33
- this.refreshCountdownSeed = 0;
34
- /**
35
- * Init call Api URL
36
- */
37
- this.initCallApi = 'Auth/WebInitCall';
38
- /**
39
- * Passphrase for encryption
40
- */
41
- this.passphrase = '';
42
- this.settings = settings;
43
- this.api = api;
44
- this.notifier = notifier;
45
- this.storage = storage;
46
- this.name = name;
47
- // Fields, attach with the name identifier
48
- this.fields = appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
49
- // Device id
50
- this._deviceId = storage.getData(this.fields.deviceId, '');
51
- // Restore
52
- this.restore();
53
- this.setApi(api);
54
- const { currentCulture, currentRegion } = settings;
55
- this.changeCulture(currentCulture);
56
- this.changeRegion(currentRegion);
57
- // Setup callback
58
- this.setup();
59
- }
60
15
  /**
61
16
  * Culture, like zh-CN
62
17
  */
@@ -125,6 +80,51 @@ export class CoreApp {
125
80
  this.fields.headerToken
126
81
  ];
127
82
  }
83
+ /**
84
+ * Protected constructor
85
+ * @param settings Settings
86
+ * @param api API
87
+ * @param notifier Notifier
88
+ * @param storage Storage
89
+ * @param name Application name
90
+ */
91
+ constructor(settings, api, notifier, storage, name) {
92
+ this._authorized = false;
93
+ this._isTryingLogin = false;
94
+ /**
95
+ * Last called with token refresh
96
+ */
97
+ this.lastCalled = false;
98
+ /**
99
+ * Token refresh count down seed
100
+ */
101
+ this.refreshCountdownSeed = 0;
102
+ /**
103
+ * Init call Api URL
104
+ */
105
+ this.initCallApi = 'Auth/WebInitCall';
106
+ /**
107
+ * Passphrase for encryption
108
+ */
109
+ this.passphrase = '';
110
+ this.settings = settings;
111
+ this.api = api;
112
+ this.notifier = notifier;
113
+ this.storage = storage;
114
+ this.name = name;
115
+ // Fields, attach with the name identifier
116
+ this.fields = appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
117
+ // Device id
118
+ this._deviceId = storage.getData(this.fields.deviceId, '');
119
+ // Restore
120
+ this.restore();
121
+ this.setApi(api);
122
+ const { currentCulture, currentRegion } = settings;
123
+ this.changeCulture(currentCulture);
124
+ this.changeRegion(currentRegion);
125
+ // Setup callback
126
+ this.setup();
127
+ }
128
128
  getDeviceId() {
129
129
  return this.deviceId.substring(0, 15);
130
130
  }
@@ -714,8 +714,6 @@ export class CoreApp {
714
714
  * @returns Result
715
715
  */
716
716
  formatMoney(input, isInteger = false, options) {
717
- if (input == null)
718
- return undefined;
719
717
  return NumberUtils.formatMoney(input, this.currency, this.culture, isInteger, options);
720
718
  }
721
719
  /**
@@ -725,8 +723,6 @@ export class CoreApp {
725
723
  * @returns Result
726
724
  */
727
725
  formatNumber(input, options) {
728
- if (input == null)
729
- return undefined;
730
726
  return NumberUtils.format(input, this.culture, options);
731
727
  }
732
728
  /**
@@ -24,7 +24,7 @@ export interface NavigateOptions {
24
24
  * true means success, false means failed but no any message
25
25
  * other cases means failed with differnet message
26
26
  */
27
- export declare type RefreshTokenResult = boolean | string | ApiDataError | IActionResult;
27
+ export type RefreshTokenResult = boolean | string | ApiDataError | IActionResult;
28
28
  /**
29
29
  * Refresh token props
30
30
  */
@@ -53,7 +53,7 @@ export declare const appFields: readonly ["headerToken", "serversideDeviceId", "
53
53
  /**
54
54
  * Basic type template
55
55
  */
56
- export declare type IAppFields = {
56
+ export type IAppFields = {
57
57
  [key in typeof appFields[number]]: string;
58
58
  };
59
59
  /**
@@ -226,14 +226,6 @@ export interface IApp {
226
226
  * @returns Error message
227
227
  */
228
228
  formatError(error: ApiDataError): string;
229
- /**
230
- * Format money number
231
- * @param input Input money number
232
- * @param isInteger Is integer
233
- * @param options Options
234
- * @returns Result
235
- */
236
- formatMoney(input: null | undefined, isInteger?: boolean, options?: Intl.NumberFormatOptions): undefined;
237
229
  /**
238
230
  * Format money number
239
231
  * @param input Input money number
@@ -242,13 +234,6 @@ export interface IApp {
242
234
  * @returns Result
243
235
  */
244
236
  formatMoney(input: number | bigint, isInteger?: boolean, options?: Intl.NumberFormatOptions): string;
245
- /**
246
- * Format number
247
- * @param input Input number
248
- * @param options Options
249
- * @returns Result
250
- */
251
- formatNumber(input: null | undefined, options?: Intl.NumberFormatOptions): undefined;
252
237
  /**
253
238
  * Format number
254
239
  * @param input Input number
@@ -1,6 +1,6 @@
1
1
  import { DataTypes } from '@etsoo/shared';
2
2
  import { IBridgeHost } from './IBridgeHost';
3
- declare type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<DataTypes.StringRecord | void>;
3
+ type CallHandlerType = (name: string, ...args: unknown[]) => PromiseLike<DataTypes.StringRecord | void>;
4
4
  /**
5
5
  * Flutter JavaScript Host
6
6
  * https://inappwebview.dev/docs/javascript/communication/
@@ -31,5 +31,6 @@ export declare class FlutterHost implements IBridgeHost {
31
31
  loadApp(name: string, startUrl?: string): void;
32
32
  userAuthorization(authorized: boolean): void;
33
33
  onUpdate(func: (app: string, version: string) => void): void;
34
+ setTitle(title: string): void;
34
35
  }
35
36
  export {};
@@ -84,4 +84,5 @@ export class FlutterHost {
84
84
  this.cacheCommand('userAuthorization', authorized);
85
85
  }
86
86
  onUpdate(func) { }
87
+ setTitle(title) { }
87
88
  }
@@ -42,4 +42,9 @@ export interface IBridgeHost {
42
42
  * @param func Callback function
43
43
  */
44
44
  onUpdate(func: (app: string, version: string) => void): void;
45
+ /**
46
+ * Set window title
47
+ * @param title Title
48
+ */
49
+ setTitle(title: string): void;
45
50
  }
@@ -3,12 +3,6 @@
3
3
  * https://imask.js.org/
4
4
  */
5
5
  export class BusinessTax {
6
- // Typescript constructor shorthand
7
- constructor(id, name, mask) {
8
- this.id = id;
9
- this.name = name;
10
- this.mask = mask;
11
- }
12
6
  /**
13
7
  * Get country or region by id
14
8
  * @param id Country id
@@ -16,6 +10,12 @@ export class BusinessTax {
16
10
  static getById(id) {
17
11
  return BusinessTax.all.find((c) => c.id === id);
18
12
  }
13
+ // Typescript constructor shorthand
14
+ constructor(id, name, mask) {
15
+ this.id = id;
16
+ this.name = name;
17
+ this.mask = mask;
18
+ }
19
19
  /**
20
20
  * Get label key
21
21
  */