@etsoo/appscript 1.3.33 → 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.
- package/__tests__/app/CoreApp.ts +27 -4
- package/lib/cjs/address/AddressContinent.d.ts +1 -1
- package/lib/cjs/address/AddressRegion.d.ts +7 -1
- package/lib/cjs/address/AddressRegion.js +21 -20
- package/lib/cjs/address/AddressState.d.ts +1 -1
- package/lib/cjs/app/CoreApp.js +45 -45
- package/lib/cjs/app/IApp.d.ts +2 -2
- package/lib/cjs/bridges/FlutterHost.d.ts +2 -1
- package/lib/cjs/bridges/FlutterHost.js +1 -0
- package/lib/cjs/bridges/IBridgeHost.d.ts +5 -0
- package/lib/cjs/business/BusinessTax.js +6 -6
- package/lib/cjs/business/Currency.d.ts +1 -1
- package/lib/cjs/business/ProductUnit.d.ts +1 -1
- package/lib/cjs/def/ListItem.d.ts +1 -1
- package/lib/cjs/erp/AddressApi.d.ts +16 -2
- package/lib/cjs/erp/AddressApi.js +43 -12
- package/lib/cjs/erp/BaseApi.js +6 -6
- package/lib/cjs/erp/dto/AuditLineDto.d.ts +3 -3
- package/lib/cjs/erp/dto/CurrencyDto.d.ts +1 -1
- package/lib/cjs/erp/dto/ExchangeRateDto.d.ts +1 -1
- package/lib/cjs/erp/dto/ExchangeRateHistoryDto.d.ts +1 -1
- package/lib/cjs/erp/dto/IdLabelDto.d.ts +1 -1
- package/lib/cjs/erp/dto/IdLabelPrimaryDto.d.ts +1 -1
- package/lib/cjs/erp/dto/InitCallDto.d.ts +1 -1
- package/lib/cjs/erp/dto/OrgDto.d.ts +1 -1
- package/lib/cjs/erp/dto/OrgQueryDto.d.ts +1 -1
- package/lib/cjs/erp/dto/PublicProductDto.d.ts +2 -2
- package/lib/cjs/erp/dto/ResultPayload.d.ts +3 -3
- package/lib/cjs/erp/rq/MemberListRQ.d.ts +1 -1
- package/lib/cjs/erp/rq/OrgListRQ.d.ts +1 -1
- package/lib/cjs/erp/rq/OrgQueryRQ.d.ts +1 -1
- package/lib/cjs/erp/rq/QueryRQ.d.ts +1 -1
- package/lib/cjs/erp/rq/RefreshTokenRQ.d.ts +1 -1
- package/lib/cjs/erp/rq/RegionsRQ.d.ts +14 -0
- package/lib/cjs/erp/rq/RegionsRQ.js +2 -0
- package/lib/cjs/erp/rq/TiplistRQ.d.ts +1 -1
- package/lib/cjs/i18n/en-US.json +1 -0
- package/lib/cjs/i18n/zh-CN.json +1 -0
- package/lib/cjs/i18n/zh-HK.json +1 -0
- package/lib/cjs/result/ActionResultError.js +12 -12
- package/lib/cjs/result/IActionResult.d.ts +2 -2
- package/lib/cjs/result/InitCallResult.d.ts +1 -1
- package/lib/cjs/state/User.d.ts +1 -1
- package/lib/mjs/address/AddressContinent.d.ts +1 -1
- package/lib/mjs/address/AddressRegion.d.ts +7 -1
- package/lib/mjs/address/AddressRegion.js +21 -20
- package/lib/mjs/address/AddressState.d.ts +1 -1
- package/lib/mjs/app/CoreApp.js +45 -45
- package/lib/mjs/app/IApp.d.ts +2 -2
- package/lib/mjs/bridges/FlutterHost.d.ts +2 -1
- package/lib/mjs/bridges/FlutterHost.js +1 -0
- package/lib/mjs/bridges/IBridgeHost.d.ts +5 -0
- package/lib/mjs/business/BusinessTax.js +6 -6
- package/lib/mjs/business/Currency.d.ts +1 -1
- package/lib/mjs/business/ProductUnit.d.ts +1 -1
- package/lib/mjs/def/ListItem.d.ts +1 -1
- package/lib/mjs/erp/AddressApi.d.ts +16 -2
- package/lib/mjs/erp/AddressApi.js +43 -12
- package/lib/mjs/erp/BaseApi.js +6 -6
- package/lib/mjs/erp/dto/AuditLineDto.d.ts +3 -3
- package/lib/mjs/erp/dto/CurrencyDto.d.ts +1 -1
- package/lib/mjs/erp/dto/ExchangeRateDto.d.ts +1 -1
- package/lib/mjs/erp/dto/ExchangeRateHistoryDto.d.ts +1 -1
- package/lib/mjs/erp/dto/IdLabelDto.d.ts +1 -1
- package/lib/mjs/erp/dto/IdLabelPrimaryDto.d.ts +1 -1
- package/lib/mjs/erp/dto/InitCallDto.d.ts +1 -1
- package/lib/mjs/erp/dto/OrgDto.d.ts +1 -1
- package/lib/mjs/erp/dto/OrgQueryDto.d.ts +1 -1
- package/lib/mjs/erp/dto/PublicProductDto.d.ts +2 -2
- package/lib/mjs/erp/dto/ResultPayload.d.ts +3 -3
- package/lib/mjs/erp/rq/MemberListRQ.d.ts +1 -1
- package/lib/mjs/erp/rq/OrgListRQ.d.ts +1 -1
- package/lib/mjs/erp/rq/OrgQueryRQ.d.ts +1 -1
- package/lib/mjs/erp/rq/QueryRQ.d.ts +1 -1
- package/lib/mjs/erp/rq/RefreshTokenRQ.d.ts +1 -1
- package/lib/mjs/erp/rq/RegionsRQ.d.ts +14 -0
- package/lib/mjs/erp/rq/RegionsRQ.js +1 -0
- package/lib/mjs/erp/rq/TiplistRQ.d.ts +1 -1
- package/lib/mjs/i18n/en-US.json +1 -0
- package/lib/mjs/i18n/zh-CN.json +1 -0
- package/lib/mjs/i18n/zh-HK.json +1 -0
- package/lib/mjs/result/ActionResultError.js +12 -12
- package/lib/mjs/result/IActionResult.d.ts +2 -2
- package/lib/mjs/result/InitCallResult.d.ts +1 -1
- package/lib/mjs/state/User.d.ts +1 -1
- package/package.json +8 -8
- package/src/address/AddressRegion.ts +29 -10
- package/src/bridges/FlutterHost.ts +2 -0
- package/src/bridges/IBridgeHost.ts +6 -0
- package/src/erp/AddressApi.ts +72 -25
- package/src/erp/rq/RegionsRQ.ts +16 -0
- package/src/i18n/en-US.json +1 -0
- package/src/i18n/zh-CN.json +1 -0
- package/src/i18n/zh-HK.json +1 -0
|
@@ -3,7 +3,7 @@ import { EntityStatus } from '../../business/EntityStatus';
|
|
|
3
3
|
/**
|
|
4
4
|
* Public product data
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
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
|
|
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
|
|
6
|
+
export type ResultPayload = IApiPayload<IActionResult>;
|
|
7
7
|
/**
|
|
8
8
|
* Number id action result payload
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export type IdResultPayload = IApiPayload<IdActionResult>;
|
|
11
11
|
/**
|
|
12
12
|
* String id action result payload
|
|
13
13
|
*/
|
|
14
|
-
export
|
|
14
|
+
export type StringIdResultPayload = IApiPayload<IdActionResult<string>>;
|
|
@@ -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
|
|
6
|
+
export type QueryRQ<T extends DataTypes.IdType = number> = {
|
|
7
7
|
/**
|
|
8
8
|
* Number id
|
|
9
9
|
*/
|
|
@@ -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
|
|
6
|
+
export type TiplistRQ<T extends DataTypes.IdType = number> = {
|
|
7
7
|
/**
|
|
8
8
|
* number id
|
|
9
9
|
*/
|
package/lib/cjs/i18n/en-US.json
CHANGED
package/lib/cjs/i18n/zh-CN.json
CHANGED
package/lib/cjs/i18n/zh-HK.json
CHANGED
|
@@ -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
|
|
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
|
|
59
|
+
export type DynamicActionResult = IActionResult<Record<string, any>>;
|
package/lib/cjs/state/User.d.ts
CHANGED
|
@@ -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
|
*/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -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
|
}
|
package/lib/mjs/app/IApp.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
56
|
+
export type IAppFields = {
|
|
57
57
|
[key in typeof appFields[number]]: string;
|
|
58
58
|
};
|
|
59
59
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
2
|
import { IBridgeHost } from './IBridgeHost';
|
|
3
|
-
|
|
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 {};
|
|
@@ -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
|
*/
|
|
@@ -4,6 +4,7 @@ import { AddressState } from '../address/AddressState';
|
|
|
4
4
|
import { IdLabelConditional } from './dto/IdLabelDto';
|
|
5
5
|
import { BaseApi } from './BaseApi';
|
|
6
6
|
import { IApiPayload } from '@etsoo/restclient';
|
|
7
|
+
import { RegionsRQ } from './rq/RegionsRQ';
|
|
7
8
|
/**
|
|
8
9
|
* Address Api
|
|
9
10
|
*/
|
|
@@ -11,17 +12,30 @@ export declare class AddressApi extends BaseApi {
|
|
|
11
12
|
/**
|
|
12
13
|
* Get all continents
|
|
13
14
|
* @param isNumberKey Is number key or key as id
|
|
15
|
+
* @param includeAntarctica Include Antarctica or not
|
|
14
16
|
* @returns Continents
|
|
15
17
|
*/
|
|
16
|
-
continents<T extends boolean>(isNumberKey?: T):
|
|
18
|
+
continents<T extends boolean>(isNumberKey?: T, includeAntarctica?: boolean): IdLabelConditional<T>;
|
|
17
19
|
/**
|
|
18
20
|
* Get continent label
|
|
19
21
|
* @param id Region id
|
|
20
22
|
* @returns Label
|
|
21
23
|
*/
|
|
22
24
|
getContinentLabel(id: AddressContinent | string): string;
|
|
23
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Get all regions
|
|
27
|
+
* @param rq Rquest data
|
|
28
|
+
*/
|
|
29
|
+
getRegions(rq?: RegionsRQ): Promise<AddressRegionDb[] | undefined>;
|
|
30
|
+
/**
|
|
31
|
+
* Get all local regions
|
|
32
|
+
*/
|
|
24
33
|
regions(): AddressRegion[];
|
|
34
|
+
/**
|
|
35
|
+
* Get all local regions limited to favored ids
|
|
36
|
+
* @param favoredIds Favored ids
|
|
37
|
+
*/
|
|
38
|
+
regions(favoredIds: string[]): AddressRegion[];
|
|
25
39
|
/**
|
|
26
40
|
* Get state list
|
|
27
41
|
* @param regionId Region id
|