@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.
- package/__tests__/tsconfig.json +2 -2
- package/lib/cjs/app/CoreApp.js +32 -48
- package/lib/cjs/bridges/FlutterHost.js +5 -9
- package/lib/cjs/business/BusinessUtils.js +1 -2
- package/lib/cjs/business/ShoppingCart.js +7 -9
- package/lib/cjs/erp/AddressApi.js +18 -26
- package/lib/cjs/erp/AuthApi.js +2 -2
- package/lib/cjs/erp/EntityApi.js +1 -1
- package/lib/cjs/erp/OrgApi.js +2 -2
- package/lib/cjs/erp/PublicApi.js +16 -26
- package/lib/mjs/app/CoreApp.js +32 -48
- package/lib/mjs/bridges/FlutterHost.js +5 -9
- package/lib/mjs/business/BusinessUtils.js +1 -2
- package/lib/mjs/business/ShoppingCart.js +7 -9
- package/lib/mjs/erp/AddressApi.js +18 -26
- package/lib/mjs/erp/AuthApi.js +2 -2
- package/lib/mjs/erp/EntityApi.js +1 -1
- package/lib/mjs/erp/OrgApi.js +2 -2
- package/lib/mjs/erp/PublicApi.js +16 -26
- package/package.json +4 -4
- package/src/app/CoreApp.ts +8 -7
- package/tsconfig.cjs.json +1 -1
- package/tsconfig.json +2 -2
package/lib/mjs/erp/EntityApi.js
CHANGED
|
@@ -70,7 +70,7 @@ export class EntityApi extends BaseApi {
|
|
|
70
70
|
* @returns Result
|
|
71
71
|
*/
|
|
72
72
|
async queryFavoredCountryIdsBase(api) {
|
|
73
|
-
api
|
|
73
|
+
api ?? (api = `${this.flag}/QueryFavoredCountryIds`);
|
|
74
74
|
const result = await this.api.get(api, undefined, {
|
|
75
75
|
showLoading: false
|
|
76
76
|
});
|
package/lib/mjs/erp/OrgApi.js
CHANGED
|
@@ -18,7 +18,7 @@ export class OrgApi extends EntityApi {
|
|
|
18
18
|
* @returns Result
|
|
19
19
|
*/
|
|
20
20
|
checkApiService(api, payload) {
|
|
21
|
-
payload
|
|
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
|
|
69
|
+
payload ?? (payload = { showLoading: false });
|
|
70
70
|
return this.api.post('System/SendActionMessage', { ...rq, appId }, payload);
|
|
71
71
|
}
|
|
72
72
|
/**
|
package/lib/mjs/erp/PublicApi.js
CHANGED
|
@@ -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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
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
|
|
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
|
|
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 =
|
|
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
|
-
?
|
|
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
|
-
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
56
|
-
"@etsoo/restclient": "^1.0.
|
|
57
|
-
"@etsoo/shared": "^1.2.
|
|
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": {
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -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
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
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": "
|
|
4
|
+
"target": "ES2020",
|
|
5
5
|
"allowJs": false,
|
|
6
6
|
"module": "ESNext",
|
|
7
|
-
"moduleResolution": "
|
|
7
|
+
"moduleResolution": "Bundler",
|
|
8
8
|
"resolveJsonModule": true,
|
|
9
9
|
"isolatedModules": true,
|
|
10
10
|
"outDir": "./lib/mjs",
|