@etsoo/appscript 1.6.58 → 1.6.60

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.
@@ -3,6 +3,92 @@ import { AddressContinent } from "./AddressContinent";
3
3
  * Address or region
4
4
  */
5
5
  export class AddressRegion {
6
+ id;
7
+ id3;
8
+ nid;
9
+ continent;
10
+ exitCode;
11
+ idd;
12
+ nationalPrefix;
13
+ currency;
14
+ languages;
15
+ label;
16
+ /**
17
+ * CN - China
18
+ */
19
+ static CN = new AddressRegion("CN", "CHN", "156", AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
20
+ /**
21
+ * HK - HK, China
22
+ * 中国香港
23
+ */
24
+ static HK = new AddressRegion("HK", "HKG", "344", AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
25
+ /**
26
+ * SG - Singapore
27
+ * 新加坡
28
+ */
29
+ static SG = new AddressRegion("SG", "SGP", "702", AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
30
+ /**
31
+ * JP - Japan
32
+ * 日本
33
+ */
34
+ static JP = new AddressRegion("JP", "JPN", "392", AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
35
+ /**
36
+ * US - United States
37
+ * 美国
38
+ */
39
+ static US = new AddressRegion("US", "USA", "840", AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
40
+ /**
41
+ * CA - Canada
42
+ * 加拿大
43
+ */
44
+ static CA = new AddressRegion("CA", "CAN", "124", AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
45
+ /**
46
+ * AU - Australia
47
+ * 澳大利亚
48
+ */
49
+ static AU = new AddressRegion("AU", "AUS", "036", AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
50
+ /**
51
+ * NZ - New Zealand
52
+ * 新西兰
53
+ */
54
+ static NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
55
+ /**
56
+ * GB - Great Britain
57
+ * 英国
58
+ */
59
+ static GB = new AddressRegion("GB", "GBR", "826", AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
60
+ /**
61
+ * IE - Ireland
62
+ * 爱尔兰
63
+ */
64
+ static IE = new AddressRegion("IE", "IRL", "372", AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
65
+ /**
66
+ * DE - Germany
67
+ * 德国
68
+ */
69
+ static DE = new AddressRegion("DE", "DEU", "276", AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
70
+ /**
71
+ * FR - France
72
+ * 法国
73
+ */
74
+ static FR = new AddressRegion("FR", "FRA", "250", AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
75
+ /**
76
+ * All countries and regions
77
+ */
78
+ static all = [
79
+ AddressRegion.CN,
80
+ AddressRegion.HK,
81
+ AddressRegion.SG,
82
+ AddressRegion.JP,
83
+ AddressRegion.US,
84
+ AddressRegion.CA,
85
+ AddressRegion.AU,
86
+ AddressRegion.NZ,
87
+ AddressRegion.GB,
88
+ AddressRegion.IE,
89
+ AddressRegion.DE,
90
+ AddressRegion.FR
91
+ ];
6
92
  /**
7
93
  * Get country or region by id
8
94
  * @param id Country id
@@ -10,6 +96,11 @@ export class AddressRegion {
10
96
  static getById(id) {
11
97
  return AddressRegion.all.find((c) => c.id === id);
12
98
  }
99
+ /**
100
+ * Continent id
101
+ * 洲编号
102
+ */
103
+ continentId;
13
104
  // Typescript constructor shorthand
14
105
  constructor(id, id3, nid, continent, exitCode, idd, nationalPrefix, currency, languages, label = id) {
15
106
  this.id = id;
@@ -25,79 +116,3 @@ export class AddressRegion {
25
116
  this.continentId = AddressContinent[continent];
26
117
  }
27
118
  }
28
- /**
29
- * CN - China
30
- */
31
- AddressRegion.CN = new AddressRegion("CN", "CHN", "156", AddressContinent.AS, "00", "+86", "0", "CNY", ["zh-Hans-CN", "zh-CN"]);
32
- /**
33
- * HK - HK, China
34
- * 中国香港
35
- */
36
- AddressRegion.HK = new AddressRegion("HK", "HKG", "344", AddressContinent.AS, "001", "+852", undefined, "HKD", ["zh-Hant-HK", "zh-HK", "en-HK"]);
37
- /**
38
- * SG - Singapore
39
- * 新加坡
40
- */
41
- AddressRegion.SG = new AddressRegion("SG", "SGP", "702", AddressContinent.AS, "000", "+65", undefined, "SGD", ["zh-Hans-SG", "zh-SG", "en-SG"]);
42
- /**
43
- * JP - Japan
44
- * 日本
45
- */
46
- AddressRegion.JP = new AddressRegion("JP", "JPN", "392", AddressContinent.AS, "010", "+81", "0", "JPY", ["ja-JP"]);
47
- /**
48
- * US - United States
49
- * 美国
50
- */
51
- AddressRegion.US = new AddressRegion("US", "USA", "840", AddressContinent.NA, "011", "+1", "1", "USD", ["en-US"]);
52
- /**
53
- * CA - Canada
54
- * 加拿大
55
- */
56
- AddressRegion.CA = new AddressRegion("CA", "CAN", "124", AddressContinent.NA, "011", "+1", "1", "CAD", ["en-CA", "fr-CA"]);
57
- /**
58
- * AU - Australia
59
- * 澳大利亚
60
- */
61
- AddressRegion.AU = new AddressRegion("AU", "AUS", "036", AddressContinent.OC, "0011", "+61", "0", "AUD", ["en-AU"]);
62
- /**
63
- * NZ - New Zealand
64
- * 新西兰
65
- */
66
- AddressRegion.NZ = new AddressRegion("NZ", "NZL", "554", AddressContinent.OC, "00", "+64", "0", "NZD", ["en-NZ", "mi-NZ"]);
67
- /**
68
- * GB - Great Britain
69
- * 英国
70
- */
71
- AddressRegion.GB = new AddressRegion("GB", "GBR", "826", AddressContinent.EU, "00", "+44", "0", "GBP", ["en-GB"]);
72
- /**
73
- * IE - Ireland
74
- * 爱尔兰
75
- */
76
- AddressRegion.IE = new AddressRegion("IE", "IRL", "372", AddressContinent.EU, "00", "+353", "0", "EUR", ["en-IE"]);
77
- /**
78
- * DE - Germany
79
- * 德国
80
- */
81
- AddressRegion.DE = new AddressRegion("DE", "DEU", "276", AddressContinent.EU, "00", "+49", "0", "EUR", ["de-DE"]);
82
- /**
83
- * FR - France
84
- * 法国
85
- */
86
- AddressRegion.FR = new AddressRegion("FR", "FRA", "250", AddressContinent.EU, "00", "+33", "0", "EUR", ["fr-FR"]);
87
- /**
88
- * All countries and regions
89
- */
90
- AddressRegion.all = [
91
- AddressRegion.CN,
92
- AddressRegion.HK,
93
- AddressRegion.SG,
94
- AddressRegion.JP,
95
- AddressRegion.US,
96
- AddressRegion.CA,
97
- AddressRegion.AU,
98
- AddressRegion.NZ,
99
- AddressRegion.GB,
100
- AddressRegion.IE,
101
- AddressRegion.DE,
102
- AddressRegion.FR
103
- ];
@@ -4,6 +4,10 @@ import { ActionResult } from "@etsoo/shared";
4
4
  * Authentication API
5
5
  */
6
6
  export class AuthApi extends BaseApi {
7
+ /**
8
+ * Header token field name
9
+ */
10
+ static HeaderTokenField = "Etsoo-Refresh-Token";
7
11
  /**
8
12
  * Admin support
9
13
  * @param rq Request data
@@ -110,8 +114,8 @@ export class AuthApi extends BaseApi {
110
114
  */
111
115
  async login(rq, payload, tokenKey) {
112
116
  // Default values
113
- payload ?? (payload = {});
114
- tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
117
+ payload ??= {};
118
+ tokenKey ??= AuthApi.HeaderTokenField;
115
119
  const data = {
116
120
  ...rq,
117
121
  deviceId: this.app.deviceId,
@@ -225,8 +229,8 @@ export class AuthApi extends BaseApi {
225
229
  */
226
230
  async switchOrg(rq, payload, tokenKey) {
227
231
  // Default values
228
- payload ?? (payload = {});
229
- tokenKey ?? (tokenKey = AuthApi.HeaderTokenField);
232
+ payload ??= {};
233
+ tokenKey ??= AuthApi.HeaderTokenField;
230
234
  // Call the API
231
235
  const result = await this.api.put("Auth/SwitchOrg", rq, payload);
232
236
  // Get the refresh token
@@ -237,7 +241,3 @@ export class AuthApi extends BaseApi {
237
241
  return [result, refreshToken];
238
242
  }
239
243
  }
240
- /**
241
- * Header token field name
242
- */
243
- AuthApi.HeaderTokenField = "Etsoo-Refresh-Token";
@@ -2,6 +2,8 @@
2
2
  * SmartERP base API
3
3
  */
4
4
  export class BaseApi {
5
+ app;
6
+ api;
5
7
  /**
6
8
  * API Last error
7
9
  */
@@ -5,6 +5,7 @@ import { BusinessUtils } from "../business/BusinessUtils";
5
5
  * Follow com.etsoo.CoreFramework.Services.EntityServiceBase
6
6
  */
7
7
  export class EntityApi extends BaseApi {
8
+ flag;
8
9
  /**
9
10
  * Constructor
10
11
  * @param flag Identity flag, like 'Product' for product APIs
@@ -62,7 +63,7 @@ export class EntityApi extends BaseApi {
62
63
  * @returns Result
63
64
  */
64
65
  async queryFavoredCountryIdsBase(api) {
65
- api ?? (api = `${this.flag}/QueryFavoredCountryIds`);
66
+ api ??= `${this.flag}/QueryFavoredCountryIds`;
66
67
  const result = await this.api.get(api, undefined, {
67
68
  showLoading: false
68
69
  });
@@ -18,24 +18,64 @@ const systemApi = "system";
18
18
  * Core application
19
19
  */
20
20
  export class CoreApp {
21
+ /**
22
+ * Settings
23
+ */
24
+ settings;
25
+ /**
26
+ * Default region
27
+ */
28
+ defaultRegion;
29
+ /**
30
+ * Fields
31
+ */
32
+ fields;
33
+ /**
34
+ * API, not recommend to use it directly in code, wrap to separate methods
35
+ */
36
+ api;
37
+ /**
38
+ * Application name
39
+ */
40
+ name;
41
+ /**
42
+ * Notifier
43
+ */
44
+ notifier;
45
+ /**
46
+ * Storage
47
+ */
48
+ storage;
49
+ /**
50
+ * Pending actions
51
+ */
52
+ pendings = [];
53
+ /**
54
+ * Debug mode
55
+ */
56
+ debug;
57
+ _culture;
21
58
  /**
22
59
  * Culture, like zh-CN
23
60
  */
24
61
  get culture() {
25
62
  return this._culture;
26
63
  }
64
+ _currency;
27
65
  /**
28
66
  * Currency, like USD for US dollar
29
67
  */
30
68
  get currency() {
31
69
  return this._currency;
32
70
  }
71
+ _region;
33
72
  /**
34
73
  * Country or region, like CN
35
74
  */
36
75
  get region() {
37
76
  return this._region;
38
77
  }
78
+ _deviceId;
39
79
  /**
40
80
  * Device id, randome string from ServiceBase.InitCallAsync
41
81
  */
@@ -52,6 +92,7 @@ export class CoreApp {
52
92
  get labelDelegate() {
53
93
  return this.get.bind(this);
54
94
  }
95
+ _ipData;
55
96
  /**
56
97
  * IP data
57
98
  */
@@ -61,6 +102,7 @@ export class CoreApp {
61
102
  set ipData(value) {
62
103
  this._ipData = value;
63
104
  }
105
+ _userData;
64
106
  /**
65
107
  * User data
66
108
  */
@@ -70,6 +112,13 @@ export class CoreApp {
70
112
  set userData(value) {
71
113
  this._userData = value;
72
114
  }
115
+ // IP detect ready callbacks
116
+ ipDetectCallbacks;
117
+ /**
118
+ * Search input element
119
+ */
120
+ searchInput;
121
+ _authorized = false;
73
122
  /**
74
123
  * Is current authorized
75
124
  */
@@ -79,6 +128,7 @@ export class CoreApp {
79
128
  set authorized(value) {
80
129
  this._authorized = value;
81
130
  }
131
+ _isReady = false;
82
132
  /**
83
133
  * Is the app ready
84
134
  */
@@ -116,12 +166,14 @@ export class CoreApp {
116
166
  }
117
167
  this.storage.setData(this.fields.keepLogin, value);
118
168
  }
169
+ _embedded;
119
170
  /**
120
171
  * Is embedded
121
172
  */
122
173
  get embedded() {
123
174
  return this._embedded;
124
175
  }
176
+ _isTryingLogin = false;
125
177
  /**
126
178
  * Is trying login
127
179
  */
@@ -137,6 +189,25 @@ export class CoreApp {
137
189
  get coreName() {
138
190
  return "core";
139
191
  }
192
+ /**
193
+ * Last called with token refresh
194
+ */
195
+ lastCalled = false;
196
+ /**
197
+ * Init call Api URL
198
+ */
199
+ initCallApi = "Auth/WebInitCall";
200
+ /**
201
+ * Passphrase for encryption
202
+ */
203
+ passphrase = "";
204
+ apis = {};
205
+ tasks = [];
206
+ clearInterval;
207
+ /**
208
+ * Get persisted fields
209
+ */
210
+ persistedFields;
140
211
  /**
141
212
  * Protected constructor
142
213
  * @param settings Settings
@@ -147,27 +218,6 @@ export class CoreApp {
147
218
  * @param debug Debug mode
148
219
  */
149
220
  constructor(settings, api, notifier, storage, name, debug = false) {
150
- /**
151
- * Pending actions
152
- */
153
- this.pendings = [];
154
- this._authorized = false;
155
- this._isReady = false;
156
- this._isTryingLogin = false;
157
- /**
158
- * Last called with token refresh
159
- */
160
- this.lastCalled = false;
161
- /**
162
- * Init call Api URL
163
- */
164
- this.initCallApi = "Auth/WebInitCall";
165
- /**
166
- * Passphrase for encryption
167
- */
168
- this.passphrase = "";
169
- this.apis = {};
170
- this.tasks = [];
171
221
  // Format settings
172
222
  this.settings = this.formatSettings(settings);
173
223
  // Current region
@@ -456,7 +506,7 @@ export class CoreApp {
456
506
  // Global API error handler
457
507
  this.setApiErrorHandler(api);
458
508
  // Setup API countdown
459
- refresh ?? (refresh = this.apiRefreshToken.bind(this));
509
+ refresh ??= this.apiRefreshToken.bind(this);
460
510
  this.apis[api.name] = [api, -1, -1, refresh];
461
511
  }
462
512
  /**
@@ -538,7 +588,7 @@ export class CoreApp {
538
588
  * @param preventDefault Is prevent default action
539
589
  */
540
590
  setupLogging(action, preventDefault) {
541
- action ?? (action = (data) => {
591
+ action ??= (data) => {
542
592
  this.api.post("Auth/LogFrontendError", data, {
543
593
  onError: (error) => {
544
594
  // Use 'debug' to avoid infinite loop
@@ -547,7 +597,7 @@ export class CoreApp {
547
597
  return false;
548
598
  }
549
599
  });
550
- });
600
+ };
551
601
  DomUtils.setupLogging(action, preventDefault);
552
602
  }
553
603
  /**
@@ -737,7 +787,7 @@ export class CoreApp {
737
787
  // State, when token is null, means logout
738
788
  const authorized = token != null;
739
789
  // Token
740
- schema ?? (schema = "Bearer");
790
+ schema ??= "Bearer";
741
791
  this.api.authorize(schema, token);
742
792
  // Overwrite the current value
743
793
  if (refreshToken !== "") {
@@ -1018,7 +1068,7 @@ export class CoreApp {
1018
1068
  */
1019
1069
  encrypt(message, passphrase, iterations) {
1020
1070
  // Default 1 * 1000
1021
- iterations ?? (iterations = 1);
1071
+ iterations ??= 1;
1022
1072
  const { lib, PBKDF2, algo, enc, AES, pad, mode } = CJ;
1023
1073
  const bits = 16; // 128 / 8
1024
1074
  const salt = lib.WordArray.random(bits);
@@ -1083,7 +1133,7 @@ export class CoreApp {
1083
1133
  */
1084
1134
  formatDate(input, options, timeZone) {
1085
1135
  const { currentCulture } = this.settings;
1086
- timeZone ?? (timeZone = this.getTimeZone());
1136
+ timeZone ??= this.getTimeZone();
1087
1137
  return DateUtils.format(input, currentCulture.name, options, timeZone);
1088
1138
  }
1089
1139
  /**
@@ -1307,7 +1357,7 @@ export class CoreApp {
1307
1357
  getRoleLabel(role, joinChar) {
1308
1358
  if (role == null)
1309
1359
  return "";
1310
- joinChar ?? (joinChar = ", ");
1360
+ joinChar ??= ", ";
1311
1361
  const roles = this.getRoles(role);
1312
1362
  return roles.map((r) => r.label).join(joinChar);
1313
1363
  }
@@ -1508,7 +1558,7 @@ export class CoreApp {
1508
1558
  * @param message Success message
1509
1559
  */
1510
1560
  ok(callback, message) {
1511
- message ?? (message = this.get("operationSucceeded"));
1561
+ message ??= this.get("operationSucceeded");
1512
1562
  this.notifier.succeed(message, undefined, callback);
1513
1563
  }
1514
1564
  /**
@@ -1525,8 +1575,8 @@ export class CoreApp {
1525
1575
  */
1526
1576
  async refreshToken(props, callback) {
1527
1577
  // Check props
1528
- props ?? (props = {});
1529
- props.token ?? (props.token = this.getCacheToken());
1578
+ props ??= {};
1579
+ props.token ??= this.getCacheToken();
1530
1580
  // Call refresh token API
1531
1581
  let data = await this.createAuthApi().refreshToken(props);
1532
1582
  let r;
@@ -1676,7 +1726,7 @@ export class CoreApp {
1676
1726
  */
1677
1727
  async apiRefreshTokenData(api, rq) {
1678
1728
  // Default appId
1679
- rq.appId ?? (rq.appId = this.settings.appId);
1729
+ rq.appId ??= this.settings.appId;
1680
1730
  // Call the API quietly, no loading bar and no error popup
1681
1731
  return this.createAuthApi(api).apiRefreshToken(rq, {
1682
1732
  showLoading: false,
@@ -1882,6 +1932,7 @@ export class CoreApp {
1882
1932
  userUnauthorized() {
1883
1933
  this.authorize(undefined, undefined);
1884
1934
  }
1935
+ lastWarning;
1885
1936
  /**
1886
1937
  * Show warning message
1887
1938
  * @param message Message
@@ -14,7 +14,7 @@ export var ExternalSettings;
14
14
  */
15
15
  function create(settings, hostname) {
16
16
  // Default settings reading from globalThis
17
- settings ?? (settings = Reflect.get(globalThis, "settings"));
17
+ settings ??= Reflect.get(globalThis, "settings");
18
18
  if (settings) {
19
19
  if (typeof settings === "string") {
20
20
  settings = JSON.parse(settings);
@@ -45,7 +45,7 @@ export var ExternalSettings;
45
45
  ExternalSettings.formatApp = formatApp;
46
46
  function formatHost(setting, hostname) {
47
47
  // Default hostname
48
- hostname ?? (hostname = globalThis.location.hostname);
48
+ hostname ??= globalThis.location.hostname;
49
49
  if (typeof setting === "string") {
50
50
  return setting.replace("{hostname}", hostname);
51
51
  }
@@ -5,20 +5,25 @@ import { BridgeHostName } from "./IBridgeHost";
5
5
  * https://inappwebview.dev/docs/javascript/communication/
6
6
  */
7
7
  export class FlutterHost {
8
+ host;
9
+ /**
10
+ * Name
11
+ */
12
+ name = BridgeHostName.Flutter;
13
+ /**
14
+ * Start Url
15
+ */
16
+ startUrl;
17
+ /**
18
+ * Cached commands
19
+ */
20
+ cachedCommands = {};
8
21
  /**
9
22
  * Constructor
10
23
  * @param callHandler Call handler
11
24
  */
12
25
  constructor(host) {
13
26
  this.host = host;
14
- /**
15
- * Name
16
- */
17
- this.name = BridgeHostName.Flutter;
18
- /**
19
- * Cached commands
20
- */
21
- this.cachedCommands = {};
22
27
  window.addEventListener("flutterInAppWebViewPlatformReady", (_event) => {
23
28
  if (this.host.callHandler == null)
24
29
  return;
@@ -3,6 +3,41 @@
3
3
  * https://imask.js.org/
4
4
  */
5
5
  export class BusinessTax {
6
+ id;
7
+ name;
8
+ mask;
9
+ /**
10
+ * CN
11
+ * Unified Social Credit Code (USCC) / 统一信用代码
12
+ * https://zh.wikisource.org/wiki/GB_32100-2015_%E6%B3%95%E4%BA%BA%E5%92%8C%E5%85%B6%E4%BB%96%E7%BB%84%E7%BB%87%E7%BB%9F%E4%B8%80%E7%A4%BE%E4%BC%9A%E4%BF%A1%E7%94%A8%E4%BB%A3%E7%A0%81%E7%BC%96%E7%A0%81%E8%A7%84%E5%88%99
13
+ */
14
+ static CN = new BusinessTax("CN", "USCC", "*0-000000-**********");
15
+ /**
16
+ * NZ, Inland Revenue (IRD)
17
+ */
18
+ static NZ = new BusinessTax("NZ", "IRD", "00[0]-000-000");
19
+ /**
20
+ * US, Employer Identification Number (EIN)
21
+ */
22
+ static US = new BusinessTax("US", "EIN", "00-0000000");
23
+ /**
24
+ * CA, tax ID number (Business Number, BN)
25
+ */
26
+ static CA = new BusinessTax("CA", "BN", "000000000");
27
+ /**
28
+ * HK, Business Registration Number (BRN)
29
+ */
30
+ static HK = new BusinessTax("HK", "BRN", "00000000");
31
+ /**
32
+ * All countries and regions
33
+ */
34
+ static all = [
35
+ BusinessTax.CN,
36
+ BusinessTax.NZ,
37
+ BusinessTax.US,
38
+ BusinessTax.CA,
39
+ BusinessTax.HK
40
+ ];
6
41
  /**
7
42
  * Get country or region by id
8
43
  * @param id Country id
@@ -23,35 +58,3 @@ export class BusinessTax {
23
58
  return "tax" + this.id + this.name;
24
59
  }
25
60
  }
26
- /**
27
- * CN
28
- * Unified Social Credit Code (USCC) / 统一信用代码
29
- * https://zh.wikisource.org/wiki/GB_32100-2015_%E6%B3%95%E4%BA%BA%E5%92%8C%E5%85%B6%E4%BB%96%E7%BB%84%E7%BB%87%E7%BB%9F%E4%B8%80%E7%A4%BE%E4%BC%9A%E4%BF%A1%E7%94%A8%E4%BB%A3%E7%A0%81%E7%BC%96%E7%A0%81%E8%A7%84%E5%88%99
30
- */
31
- BusinessTax.CN = new BusinessTax("CN", "USCC", "*0-000000-**********");
32
- /**
33
- * NZ, Inland Revenue (IRD)
34
- */
35
- BusinessTax.NZ = new BusinessTax("NZ", "IRD", "00[0]-000-000");
36
- /**
37
- * US, Employer Identification Number (EIN)
38
- */
39
- BusinessTax.US = new BusinessTax("US", "EIN", "00-0000000");
40
- /**
41
- * CA, tax ID number (Business Number, BN)
42
- */
43
- BusinessTax.CA = new BusinessTax("CA", "BN", "000000000");
44
- /**
45
- * HK, Business Registration Number (BRN)
46
- */
47
- BusinessTax.HK = new BusinessTax("HK", "BRN", "00000000");
48
- /**
49
- * All countries and regions
50
- */
51
- BusinessTax.all = [
52
- BusinessTax.CN,
53
- BusinessTax.NZ,
54
- BusinessTax.US,
55
- BusinessTax.CA,
56
- BusinessTax.HK
57
- ];
@@ -140,10 +140,9 @@ export var BusinessUtils;
140
140
  * @param fields Fields map
141
141
  */
142
142
  function setupPagingKeysets(data, lastItem, idField, fields) {
143
- var _a;
144
143
  // If the id field is not set for ordering, add it with descending
145
144
  if (typeof data.queryPaging === "object") {
146
- const orderBy = ((_a = data.queryPaging).orderBy ?? (_a.orderBy = []));
145
+ const orderBy = (data.queryPaging.orderBy ??= []);
147
146
  const idUpper = idField.toUpperCase();
148
147
  if (!orderBy.find((o) => o.field.toUpperCase() === idUpper)) {
149
148
  orderBy.push({ field: idField, desc: true, unique: true });
@@ -18,6 +18,10 @@ export class ActionResultError extends Error {
18
18
  const add = addtions.length > 0 ? ` (${addtions.join(", ")})` : "";
19
19
  return `${result.title || "Error"}${add}`;
20
20
  }
21
+ /**
22
+ * Related result
23
+ */
24
+ result;
21
25
  /**
22
26
  * Constructor
23
27
  * @param result Result