@etsoo/appscript 1.4.76 → 1.4.78

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.
@@ -70,7 +70,7 @@ export class EntityApi extends BaseApi {
70
70
  * @returns Result
71
71
  */
72
72
  async queryFavoredCountryIdsBase(api) {
73
- api !== null && api !== void 0 ? api : (api = `${this.flag}/QueryFavoredCountryIds`);
73
+ api ?? (api = `${this.flag}/QueryFavoredCountryIds`);
74
74
  const result = await this.api.get(api, undefined, {
75
75
  showLoading: false
76
76
  });
@@ -18,7 +18,7 @@ export class OrgApi extends EntityApi {
18
18
  * @returns Result
19
19
  */
20
20
  checkApiService(api, payload) {
21
- payload !== null && payload !== void 0 ? payload : (payload = { showLoading: false });
21
+ payload ?? (payload = { showLoading: false });
22
22
  return this.api.get(`${this.flag}/CheckApiService`, { api }, payload);
23
23
  }
24
24
  list(items, serviceId) {
@@ -66,7 +66,7 @@ export class OrgApi extends EntityApi {
66
66
  */
67
67
  sendActionMessage(rq, payload) {
68
68
  const appId = 'serviceId' in this.app.settings ? this.app.settings.serviceId : 0;
69
- payload !== null && payload !== void 0 ? payload : (payload = { showLoading: false });
69
+ payload ?? (payload = { showLoading: false });
70
70
  return this.api.post('System/SendActionMessage', { ...rq, appId }, payload);
71
71
  }
72
72
  /**
@@ -39,22 +39,16 @@ export class PublicApi extends BaseApi {
39
39
  }
40
40
  currencies(names) {
41
41
  if (typeof names === 'boolean' && names) {
42
- return Currencies.map((name) => {
43
- var _a;
44
- return ({
45
- id: name,
46
- label: (_a = this.app.get(`currency${name}`)) !== null && _a !== void 0 ? _a : name
47
- });
48
- });
42
+ return Currencies.map((name) => ({
43
+ id: name,
44
+ label: this.app.get(`currency${name}`) ?? name
45
+ }));
49
46
  }
50
47
  if (Array.isArray(names)) {
51
- return names.map((name) => {
52
- var _a;
53
- return ({
54
- id: name,
55
- label: (_a = this.app.get(`currency${name}`)) !== null && _a !== void 0 ? _a : name
56
- });
57
- });
48
+ return names.map((name) => ({
49
+ id: name,
50
+ label: this.app.get(`currency${name}`) ?? name
51
+ }));
58
52
  }
59
53
  return this.api.get('Public/GetCurrencies', undefined, {
60
54
  defaultValue: [],
@@ -69,7 +63,7 @@ export class PublicApi extends BaseApi {
69
63
  * @returns Result
70
64
  */
71
65
  async exchangeAmount(amount, sourceCurrency, targetCurrency) {
72
- targetCurrency !== null && targetCurrency !== void 0 ? targetCurrency : (targetCurrency = this.app.defaultRegion.currency);
66
+ targetCurrency ?? (targetCurrency = this.app.defaultRegion.currency);
73
67
  const [sourceRate, targetRate] = await Promise.all([
74
68
  this.exchangeRate(sourceCurrency, {
75
69
  showLoading: false
@@ -112,7 +106,7 @@ export class PublicApi extends BaseApi {
112
106
  * @returns Result
113
107
  */
114
108
  exchangeRateHistory(currencies, months, payload) {
115
- payload !== null && payload !== void 0 ? payload : (payload = { defaultValue: [] });
109
+ payload ?? (payload = { defaultValue: [] });
116
110
  return this.api.post('Public/ExchangeRateHistory', { currencies, months }, payload);
117
111
  }
118
112
  /**
@@ -129,9 +123,8 @@ export class PublicApi extends BaseApi {
129
123
  * @returns Label
130
124
  */
131
125
  getCurrencyLabel(currency) {
132
- var _a;
133
126
  const c = `currency${currency}`;
134
- return (_a = this.app.get(c)) !== null && _a !== void 0 ? _a : c;
127
+ return this.app.get(c) ?? c;
135
128
  }
136
129
  /**
137
130
  * Get product unit's label
@@ -141,9 +134,8 @@ export class PublicApi extends BaseApi {
141
134
  * @returns Label
142
135
  */
143
136
  getUnitLabel(unit, isJoined) {
144
- var _a;
145
137
  const key = ProductUnit[unit];
146
- const label = (_a = this.app.get(unitPrefix + key)) !== null && _a !== void 0 ? _a : key;
138
+ const label = this.app.get(unitPrefix + key) ?? key;
147
139
  const join = this.getUnitJoin(isJoined);
148
140
  if (join) {
149
141
  return join.format(label);
@@ -151,9 +143,8 @@ export class PublicApi extends BaseApi {
151
143
  return label;
152
144
  }
153
145
  getUnitJoin(isJoined) {
154
- var _a;
155
146
  return typeof isJoined === 'string'
156
- ? (_a = this.app.get(isJoined)) !== null && _a !== void 0 ? _a : isJoined
147
+ ? this.app.get(isJoined) ?? isJoined
157
148
  : isJoined
158
149
  ? this.app.get('unitJoin')
159
150
  : undefined;
@@ -174,9 +165,8 @@ export class PublicApi extends BaseApi {
174
165
  * @returns Result
175
166
  */
176
167
  parsePin(input, payload) {
177
- var _a;
178
168
  const rq = typeof input === 'string' ? { pin: input } : input;
179
- (_a = rq.language) !== null && _a !== void 0 ? _a : (rq.language = this.app.culture);
169
+ rq.language ?? (rq.language = this.app.culture);
180
170
  return this.api.post('Public/ParsePin', rq, payload);
181
171
  }
182
172
  /**
@@ -198,7 +188,7 @@ export class PublicApi extends BaseApi {
198
188
  * @returns Units
199
189
  */
200
190
  repeatOptions(options, isJoined = true) {
201
- options !== null && options !== void 0 ? options : (options = DataTypes.getEnumKeys(RepeatOption));
191
+ options ?? (options = DataTypes.getEnumKeys(RepeatOption));
202
192
  return this.units(options, isJoined);
203
193
  }
204
194
  /**
@@ -217,7 +207,7 @@ export class PublicApi extends BaseApi {
217
207
  * @returns Units
218
208
  */
219
209
  units(options, isJoined) {
220
- options !== null && options !== void 0 ? options : (options = DataTypes.getEnumKeys(ProductUnit));
210
+ options ?? (options = DataTypes.getEnumKeys(ProductUnit));
221
211
  return options.map((key) => {
222
212
  const id = DataTypes.getEnumByKey(ProductUnit, key);
223
213
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.4.76",
3
+ "version": "1.4.78",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -52,9 +52,9 @@
52
52
  },
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
- "@etsoo/notificationbase": "^1.1.35",
56
- "@etsoo/restclient": "^1.0.98",
57
- "@etsoo/shared": "^1.2.26",
55
+ "@etsoo/notificationbase": "^1.1.39",
56
+ "@etsoo/restclient": "^1.0.99",
57
+ "@etsoo/shared": "^1.2.28",
58
58
  "crypto-js": "^4.2.0"
59
59
  },
60
60
  "devDependencies": {
@@ -45,6 +45,8 @@ import { Currency } from '../business/Currency';
45
45
  type CJType = typeof CryptoJS;
46
46
  let CJ: CJType;
47
47
 
48
+ const loadCrypto = () => import('crypto-js');
49
+
48
50
  /**
49
51
  * Core application interface
50
52
  */
@@ -294,13 +296,12 @@ export abstract class CoreApp<
294
296
  const { currentCulture, currentRegion } = settings;
295
297
 
296
298
  // Load resources
297
- Promise.all([
298
- import('crypto-js'),
299
- this.changeCulture(currentCulture)
300
- ]).then(([cj, _resources]) => {
301
- (CJ = cj), this.changeRegion(currentRegion);
302
- this.setup();
303
- });
299
+ Promise.all([loadCrypto(), this.changeCulture(currentCulture)]).then(
300
+ ([cj, _resources]) => {
301
+ (CJ = cj), this.changeRegion(currentRegion);
302
+ this.setup();
303
+ }
304
+ );
304
305
  }
305
306
 
306
307
  private getDeviceId() {
package/tsconfig.cjs.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2019",
4
+ "target": "ES2020",
5
5
  "allowJs": false,
6
6
  "module": "commonjs",
7
7
  "moduleResolution": "node",
package/tsconfig.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
- "target": "ES2019",
4
+ "target": "ES2020",
5
5
  "allowJs": false,
6
6
  "module": "ESNext",
7
- "moduleResolution": "node",
7
+ "moduleResolution": "Bundler",
8
8
  "resolveJsonModule": true,
9
9
  "isolatedModules": true,
10
10
  "outDir": "./lib/mjs",