@etsoo/appscript 1.2.46 → 1.2.50
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/lib/cjs/app/CoreApp.d.ts +27 -29
- package/lib/cjs/app/CoreApp.js +49 -58
- package/lib/cjs/bridges/IBridgeHost.d.ts +5 -1
- package/lib/cjs/business/BusinessUtils.d.ts +8 -0
- package/lib/cjs/business/BusinessUtils.js +17 -0
- package/lib/cjs/i18n/en-US.json +15 -0
- package/lib/cjs/i18n/zh-CN.json +15 -0
- package/lib/cjs/i18n/zh-HK.json +15 -0
- package/lib/mjs/app/CoreApp.d.ts +27 -29
- package/lib/mjs/app/CoreApp.js +49 -58
- package/lib/mjs/bridges/IBridgeHost.d.ts +5 -1
- package/lib/mjs/business/BusinessUtils.d.ts +8 -0
- package/lib/mjs/business/BusinessUtils.js +17 -0
- package/lib/mjs/i18n/en-US.json +15 -0
- package/lib/mjs/i18n/zh-CN.json +15 -0
- package/lib/mjs/i18n/zh-HK.json +15 -0
- package/package.json +1 -1
- package/src/app/CoreApp.ts +70 -75
- package/src/bridges/IBridgeHost.ts +6 -1
- package/src/business/BusinessUtils.ts +20 -0
- package/src/i18n/en-US.json +15 -0
- package/src/i18n/zh-CN.json +15 -0
- package/src/i18n/zh-HK.json +15 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -43,6 +43,16 @@ export interface RefreshTokenProps<D extends {}> {
|
|
|
43
43
|
*/
|
|
44
44
|
showLoading?: boolean;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* App fields
|
|
48
|
+
*/
|
|
49
|
+
declare const appFields: readonly ["headerToken", "serversideDeviceId", "deviceId", "devices", "devicePassphrase"];
|
|
50
|
+
/**
|
|
51
|
+
* Basic type template
|
|
52
|
+
*/
|
|
53
|
+
export declare type IAppFields = {
|
|
54
|
+
[key in typeof appFields[number]]: string;
|
|
55
|
+
};
|
|
46
56
|
/**
|
|
47
57
|
* Core application interface
|
|
48
58
|
*/
|
|
@@ -51,6 +61,10 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
51
61
|
* Settings
|
|
52
62
|
*/
|
|
53
63
|
readonly settings: S;
|
|
64
|
+
/**
|
|
65
|
+
* Fields
|
|
66
|
+
*/
|
|
67
|
+
readonly fields: IAppFields;
|
|
54
68
|
/**
|
|
55
69
|
* API
|
|
56
70
|
*/
|
|
@@ -371,6 +385,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
371
385
|
* Settings
|
|
372
386
|
*/
|
|
373
387
|
readonly settings: S;
|
|
388
|
+
/**
|
|
389
|
+
* Fields
|
|
390
|
+
*/
|
|
391
|
+
readonly fields: IAppFields;
|
|
374
392
|
/**
|
|
375
393
|
* API
|
|
376
394
|
*/
|
|
@@ -467,6 +485,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
467
485
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
468
486
|
private getDeviceId;
|
|
469
487
|
private resetKeys;
|
|
488
|
+
/**
|
|
489
|
+
* Add app name as identifier
|
|
490
|
+
* @param field Field
|
|
491
|
+
* @returns Result
|
|
492
|
+
*/
|
|
493
|
+
protected addIdentifier(field: string): string;
|
|
470
494
|
/**
|
|
471
495
|
* Restore settings from persisted source
|
|
472
496
|
*/
|
|
@@ -475,12 +499,6 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
475
499
|
* Persist settings to source when application exit
|
|
476
500
|
*/
|
|
477
501
|
persist(): void;
|
|
478
|
-
/**
|
|
479
|
-
* Add app name as identifier
|
|
480
|
-
* @param field Field
|
|
481
|
-
* @returns Result
|
|
482
|
-
*/
|
|
483
|
-
protected addIdentifier(field: string): string;
|
|
484
502
|
/**
|
|
485
503
|
* Setup Api
|
|
486
504
|
* @param api Api
|
|
@@ -753,8 +771,9 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
753
771
|
* Try login, returning false means is loading
|
|
754
772
|
* UI get involved while refreshToken not intended
|
|
755
773
|
* @param data Additional request data
|
|
774
|
+
* @param showLoading Show loading bar or not during call
|
|
756
775
|
*/
|
|
757
|
-
tryLogin<D extends {} = {}>(_data?: D): Promise<boolean>;
|
|
776
|
+
tryLogin<D extends {} = {}>(_data?: D, _showLoading?: boolean): Promise<boolean>;
|
|
758
777
|
/**
|
|
759
778
|
* User login
|
|
760
779
|
* @param user User data
|
|
@@ -779,25 +798,4 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
779
798
|
*/
|
|
780
799
|
warning(message: NotificationContent<N>, align?: NotificationAlign): void;
|
|
781
800
|
}
|
|
782
|
-
export
|
|
783
|
-
/**
|
|
784
|
-
* Response token header field name
|
|
785
|
-
*/
|
|
786
|
-
const headerTokenField = "SmartERPRefreshToken";
|
|
787
|
-
/**
|
|
788
|
-
* Serverside device id encrypted field name
|
|
789
|
-
*/
|
|
790
|
-
const serversideDeviceIdField = "SmartERPServersideDeviceId";
|
|
791
|
-
/**
|
|
792
|
-
* Device id field name
|
|
793
|
-
*/
|
|
794
|
-
const deviceIdField = "SmartERPDeviceId";
|
|
795
|
-
/**
|
|
796
|
-
* Devices field name
|
|
797
|
-
*/
|
|
798
|
-
const devicesField = "SmartERPDevices";
|
|
799
|
-
/**
|
|
800
|
-
* Device passphrase field name
|
|
801
|
-
*/
|
|
802
|
-
const devicePassphraseField = "SmartERPDevicePassphrase";
|
|
803
|
-
}
|
|
801
|
+
export {};
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -9,6 +9,16 @@ const AddressRegion_1 = require("../address/AddressRegion");
|
|
|
9
9
|
const AddressUtils_1 = require("../address/AddressUtils");
|
|
10
10
|
const BusinessUtils_1 = require("../business/BusinessUtils");
|
|
11
11
|
const ActionResultError_1 = require("../result/ActionResultError");
|
|
12
|
+
/**
|
|
13
|
+
* App fields
|
|
14
|
+
*/
|
|
15
|
+
const appFields = [
|
|
16
|
+
'headerToken',
|
|
17
|
+
'serversideDeviceId',
|
|
18
|
+
'deviceId',
|
|
19
|
+
'devices',
|
|
20
|
+
'devicePassphrase'
|
|
21
|
+
];
|
|
12
22
|
/**
|
|
13
23
|
* Core application
|
|
14
24
|
*/
|
|
@@ -45,8 +55,10 @@ class CoreApp {
|
|
|
45
55
|
this.notifier = notifier;
|
|
46
56
|
this.storage = storage;
|
|
47
57
|
this.name = name;
|
|
58
|
+
// Fields, attach with the name identifier
|
|
59
|
+
this.fields = appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
|
|
48
60
|
// Device id
|
|
49
|
-
this._deviceId = storage.getData(
|
|
61
|
+
this._deviceId = storage.getData(this.fields.deviceId, '');
|
|
50
62
|
// Restore
|
|
51
63
|
this.restore();
|
|
52
64
|
this.setApi(api);
|
|
@@ -118,10 +130,10 @@ class CoreApp {
|
|
|
118
130
|
*/
|
|
119
131
|
get persistedFields() {
|
|
120
132
|
return [
|
|
121
|
-
|
|
122
|
-
this.
|
|
123
|
-
|
|
124
|
-
this.
|
|
133
|
+
this.fields.deviceId,
|
|
134
|
+
this.fields.devicePassphrase,
|
|
135
|
+
this.fields.serversideDeviceId,
|
|
136
|
+
this.fields.headerToken
|
|
125
137
|
];
|
|
126
138
|
}
|
|
127
139
|
getDeviceId() {
|
|
@@ -129,23 +141,31 @@ class CoreApp {
|
|
|
129
141
|
}
|
|
130
142
|
resetKeys() {
|
|
131
143
|
this.storage.clear([
|
|
132
|
-
this.
|
|
133
|
-
this.
|
|
134
|
-
|
|
144
|
+
this.fields.devicePassphrase,
|
|
145
|
+
this.fields.headerToken,
|
|
146
|
+
this.fields.serversideDeviceId
|
|
135
147
|
], false);
|
|
136
148
|
this.passphrase = '';
|
|
137
149
|
}
|
|
150
|
+
/**
|
|
151
|
+
* Add app name as identifier
|
|
152
|
+
* @param field Field
|
|
153
|
+
* @returns Result
|
|
154
|
+
*/
|
|
155
|
+
addIdentifier(field) {
|
|
156
|
+
return field + '-' + this.name;
|
|
157
|
+
}
|
|
138
158
|
/**
|
|
139
159
|
* Restore settings from persisted source
|
|
140
160
|
*/
|
|
141
161
|
restore() {
|
|
142
162
|
// Devices
|
|
143
|
-
const devices = this.storage.getPersistedData(
|
|
163
|
+
const devices = this.storage.getPersistedData(this.fields.devices, []);
|
|
144
164
|
if (this.deviceId === '') {
|
|
145
165
|
// First vist, restore and keep the source
|
|
146
166
|
this.storage.copyFrom(this.persistedFields, false);
|
|
147
167
|
// Reset device id
|
|
148
|
-
this._deviceId = this.storage.getData(
|
|
168
|
+
this._deviceId = this.storage.getData(this.fields.deviceId, '');
|
|
149
169
|
// Totally new, no data restored
|
|
150
170
|
if (this._deviceId === '')
|
|
151
171
|
return false;
|
|
@@ -159,13 +179,13 @@ class CoreApp {
|
|
|
159
179
|
return false;
|
|
160
180
|
}
|
|
161
181
|
// this.name to identifier different app's secret
|
|
162
|
-
const passphraseEncrypted = this.storage.getData(this.
|
|
182
|
+
const passphraseEncrypted = this.storage.getData(this.fields.devicePassphrase);
|
|
163
183
|
if (passphraseEncrypted) {
|
|
164
184
|
const passphraseDecrypted = this.decrypt(passphraseEncrypted, this.name);
|
|
165
185
|
if (passphraseDecrypted != null) {
|
|
166
186
|
// Add the device to the list
|
|
167
187
|
devices.push(d);
|
|
168
|
-
this.storage.setPersistedData(
|
|
188
|
+
this.storage.setPersistedData(this.fields.devices, devices);
|
|
169
189
|
this.passphrase = passphraseDecrypted;
|
|
170
190
|
return true;
|
|
171
191
|
}
|
|
@@ -179,27 +199,19 @@ class CoreApp {
|
|
|
179
199
|
*/
|
|
180
200
|
persist() {
|
|
181
201
|
// Devices
|
|
182
|
-
const devices = this.storage.getPersistedData(
|
|
202
|
+
const devices = this.storage.getPersistedData(this.fields.devices);
|
|
183
203
|
if (devices != null) {
|
|
184
204
|
const index = devices.indexOf(this.getDeviceId());
|
|
185
205
|
if (index !== -1) {
|
|
186
206
|
// Remove current device from the list
|
|
187
207
|
devices.splice(index, 1);
|
|
188
|
-
this.storage.setPersistedData(
|
|
208
|
+
this.storage.setPersistedData(this.fields.devices, devices);
|
|
189
209
|
}
|
|
190
210
|
}
|
|
191
211
|
if (!this.authorized)
|
|
192
212
|
return;
|
|
193
213
|
this.storage.copyTo(this.persistedFields);
|
|
194
214
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Add app name as identifier
|
|
197
|
-
* @param field Field
|
|
198
|
-
* @returns Result
|
|
199
|
-
*/
|
|
200
|
-
addIdentifier(field) {
|
|
201
|
-
return field + '-' + this.name;
|
|
202
|
-
}
|
|
203
215
|
/**
|
|
204
216
|
* Setup Api
|
|
205
217
|
* @param api Api
|
|
@@ -256,7 +268,7 @@ class CoreApp {
|
|
|
256
268
|
return;
|
|
257
269
|
}
|
|
258
270
|
// Serverside encrypted device id
|
|
259
|
-
const identifier = this.storage.getData(
|
|
271
|
+
const identifier = this.storage.getData(this.fields.serversideDeviceId);
|
|
260
272
|
// Timestamp
|
|
261
273
|
const timestamp = new Date().getTime();
|
|
262
274
|
// Request data
|
|
@@ -292,7 +304,7 @@ class CoreApp {
|
|
|
292
304
|
if (callback)
|
|
293
305
|
callback(false);
|
|
294
306
|
// Clear device id
|
|
295
|
-
this.storage.setData(
|
|
307
|
+
this.storage.setData(this.fields.deviceId, undefined);
|
|
296
308
|
return;
|
|
297
309
|
}
|
|
298
310
|
this.initCallUpdate(result.data, data.timestamp);
|
|
@@ -315,14 +327,14 @@ class CoreApp {
|
|
|
315
327
|
return;
|
|
316
328
|
// Update device id and cache it
|
|
317
329
|
this._deviceId = data.deviceId;
|
|
318
|
-
this.storage.setData(
|
|
330
|
+
this.storage.setData(this.fields.deviceId, this._deviceId);
|
|
319
331
|
// Devices
|
|
320
|
-
const devices = this.storage.getPersistedData(
|
|
332
|
+
const devices = this.storage.getPersistedData(this.fields.devices, []);
|
|
321
333
|
devices.push(this.getDeviceId());
|
|
322
|
-
this.storage.setPersistedData(
|
|
334
|
+
this.storage.setPersistedData(this.fields.devices, devices);
|
|
323
335
|
// Current passphrase
|
|
324
336
|
this.passphrase = passphrase;
|
|
325
|
-
this.storage.setData(this.
|
|
337
|
+
this.storage.setData(this.fields.devicePassphrase, this.encrypt(passphrase, this.name));
|
|
326
338
|
// Previous passphrase
|
|
327
339
|
if (data.previousPassphrase) {
|
|
328
340
|
const prev = this.decrypt(data.previousPassphrase, timestamp.toString());
|
|
@@ -354,7 +366,7 @@ class CoreApp {
|
|
|
354
366
|
* @returns Fields
|
|
355
367
|
*/
|
|
356
368
|
initCallEncryptedUpdateFields() {
|
|
357
|
-
return [this.
|
|
369
|
+
return [this.fields.headerToken];
|
|
358
370
|
}
|
|
359
371
|
/**
|
|
360
372
|
* Alert action result
|
|
@@ -379,7 +391,7 @@ class CoreApp {
|
|
|
379
391
|
if (refreshToken !== '') {
|
|
380
392
|
if (refreshToken != null)
|
|
381
393
|
refreshToken = this.encrypt(refreshToken);
|
|
382
|
-
this.storage.setData(this.
|
|
394
|
+
this.storage.setData(this.fields.headerToken, refreshToken);
|
|
383
395
|
}
|
|
384
396
|
// Reset tryLogin state
|
|
385
397
|
this._isTryingLogin = false;
|
|
@@ -452,14 +464,14 @@ class CoreApp {
|
|
|
452
464
|
*/
|
|
453
465
|
clearCacheData() {
|
|
454
466
|
this.clearCacheToken();
|
|
455
|
-
this.storage.setData(this.
|
|
467
|
+
this.storage.setData(this.fields.devicePassphrase, undefined);
|
|
456
468
|
}
|
|
457
469
|
/**
|
|
458
470
|
* Clear cached token
|
|
459
471
|
*/
|
|
460
472
|
clearCacheToken() {
|
|
461
473
|
this.cachedRefreshToken = undefined;
|
|
462
|
-
this.storage.setPersistedData(this.
|
|
474
|
+
this.storage.setPersistedData(this.fields.headerToken, undefined);
|
|
463
475
|
}
|
|
464
476
|
/**
|
|
465
477
|
* Decrypt message
|
|
@@ -714,7 +726,7 @@ class CoreApp {
|
|
|
714
726
|
// Temp refresh token
|
|
715
727
|
if (this.cachedRefreshToken)
|
|
716
728
|
return this.cachedRefreshToken;
|
|
717
|
-
return this.storage.getData(this.
|
|
729
|
+
return this.storage.getData(this.fields.headerToken);
|
|
718
730
|
}
|
|
719
731
|
/**
|
|
720
732
|
* Get all regions
|
|
@@ -741,7 +753,7 @@ class CoreApp {
|
|
|
741
753
|
*/
|
|
742
754
|
getResponseToken(rawResponse) {
|
|
743
755
|
const response = this.api.transformResponse(rawResponse);
|
|
744
|
-
return this.api.getHeaderValue(response.headers,
|
|
756
|
+
return this.api.getHeaderValue(response.headers, 'SmartERPRefreshToken');
|
|
745
757
|
}
|
|
746
758
|
/**
|
|
747
759
|
* Get time zone
|
|
@@ -944,8 +956,9 @@ class CoreApp {
|
|
|
944
956
|
* Try login, returning false means is loading
|
|
945
957
|
* UI get involved while refreshToken not intended
|
|
946
958
|
* @param data Additional request data
|
|
959
|
+
* @param showLoading Show loading bar or not during call
|
|
947
960
|
*/
|
|
948
|
-
async tryLogin(_data) {
|
|
961
|
+
async tryLogin(_data, _showLoading) {
|
|
949
962
|
if (this._isTryingLogin)
|
|
950
963
|
return false;
|
|
951
964
|
this._isTryingLogin = true;
|
|
@@ -960,7 +973,7 @@ class CoreApp {
|
|
|
960
973
|
userLogin(user, refreshToken, keep) {
|
|
961
974
|
this.userData = user;
|
|
962
975
|
// Cache the encrypted serverside device id
|
|
963
|
-
this.storage.setData(
|
|
976
|
+
this.storage.setData(this.fields.serversideDeviceId, user.deviceId);
|
|
964
977
|
if (keep) {
|
|
965
978
|
this.authorize(user.token, refreshToken);
|
|
966
979
|
}
|
|
@@ -998,25 +1011,3 @@ class CoreApp {
|
|
|
998
1011
|
}
|
|
999
1012
|
}
|
|
1000
1013
|
exports.CoreApp = CoreApp;
|
|
1001
|
-
(function (CoreApp) {
|
|
1002
|
-
/**
|
|
1003
|
-
* Response token header field name
|
|
1004
|
-
*/
|
|
1005
|
-
CoreApp.headerTokenField = 'SmartERPRefreshToken';
|
|
1006
|
-
/**
|
|
1007
|
-
* Serverside device id encrypted field name
|
|
1008
|
-
*/
|
|
1009
|
-
CoreApp.serversideDeviceIdField = 'SmartERPServersideDeviceId';
|
|
1010
|
-
/**
|
|
1011
|
-
* Device id field name
|
|
1012
|
-
*/
|
|
1013
|
-
CoreApp.deviceIdField = 'SmartERPDeviceId';
|
|
1014
|
-
/**
|
|
1015
|
-
* Devices field name
|
|
1016
|
-
*/
|
|
1017
|
-
CoreApp.devicesField = 'SmartERPDevices';
|
|
1018
|
-
/**
|
|
1019
|
-
* Device passphrase field name
|
|
1020
|
-
*/
|
|
1021
|
-
CoreApp.devicePassphraseField = 'SmartERPDevicePassphrase';
|
|
1022
|
-
})(CoreApp = exports.CoreApp || (exports.CoreApp = {}));
|
|
@@ -11,10 +11,14 @@ export interface IBridgeHost {
|
|
|
11
11
|
* Exit the application
|
|
12
12
|
*/
|
|
13
13
|
exit(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Get app start Url / router Url
|
|
16
|
+
*/
|
|
17
|
+
getStartUrl(): string | undefined | null;
|
|
14
18
|
/**
|
|
15
19
|
* Load application
|
|
16
20
|
* @param name App name
|
|
17
|
-
* @param startUrl Start Url
|
|
21
|
+
* @param startUrl Start Url / router Url
|
|
18
22
|
*/
|
|
19
23
|
loadApp(name: string, startUrl?: string): void;
|
|
20
24
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DataTypes } from '@etsoo/shared';
|
|
1
2
|
import { IdLabelDto } from '../dto/IdLabelDto';
|
|
2
3
|
import { ICultureGet } from '../state/Culture';
|
|
3
4
|
import { EntityStatus } from './EntityStatus';
|
|
@@ -31,6 +32,13 @@ export declare namespace BusinessUtils {
|
|
|
31
32
|
id: EntityStatus;
|
|
32
33
|
label: string;
|
|
33
34
|
}[];
|
|
35
|
+
/**
|
|
36
|
+
* Get 12-month items
|
|
37
|
+
* @param monthLabels Month labels
|
|
38
|
+
* @param startMonth Start month, 0 as Jan.
|
|
39
|
+
* @returns 12 months
|
|
40
|
+
*/
|
|
41
|
+
function getMonths(monthLabels: string[], startMonth?: number): DataTypes.IdLabelItem[];
|
|
34
42
|
/**
|
|
35
43
|
* Get product unit's label
|
|
36
44
|
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
@@ -55,6 +55,23 @@ var BusinessUtils;
|
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
BusinessUtils.getEntityStatus = getEntityStatus;
|
|
58
|
+
/**
|
|
59
|
+
* Get 12-month items
|
|
60
|
+
* @param monthLabels Month labels
|
|
61
|
+
* @param startMonth Start month, 0 as Jan.
|
|
62
|
+
* @returns 12 months
|
|
63
|
+
*/
|
|
64
|
+
function getMonths(monthLabels, startMonth = 0) {
|
|
65
|
+
const months = [];
|
|
66
|
+
for (let i = 0; i < 12; i++) {
|
|
67
|
+
if (startMonth >= 12)
|
|
68
|
+
startMonth = 0;
|
|
69
|
+
months.push({ id: startMonth, label: monthLabels[startMonth] });
|
|
70
|
+
startMonth++;
|
|
71
|
+
}
|
|
72
|
+
return months;
|
|
73
|
+
}
|
|
74
|
+
BusinessUtils.getMonths = getMonths;
|
|
58
75
|
/**
|
|
59
76
|
* Get product unit's label
|
|
60
77
|
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
package/lib/cjs/i18n/en-US.json
CHANGED
|
@@ -50,6 +50,20 @@
|
|
|
50
50
|
"message": "Message",
|
|
51
51
|
"mobile": "Mobile number",
|
|
52
52
|
"mobilePhones": "Mobile numbers",
|
|
53
|
+
"months": [
|
|
54
|
+
"Jan.",
|
|
55
|
+
"Feb.",
|
|
56
|
+
"Mar.",
|
|
57
|
+
"Apr.",
|
|
58
|
+
"May.",
|
|
59
|
+
"Jun.",
|
|
60
|
+
"Jul.",
|
|
61
|
+
"Aug.",
|
|
62
|
+
"Sep.",
|
|
63
|
+
"Oct.",
|
|
64
|
+
"Nov.",
|
|
65
|
+
"Dec."
|
|
66
|
+
],
|
|
53
67
|
"more": "More",
|
|
54
68
|
"moreTag": "{0} more",
|
|
55
69
|
"name": "Name",
|
|
@@ -67,6 +81,7 @@
|
|
|
67
81
|
"pageNotFound": "Page Not Found",
|
|
68
82
|
"prompt": "Input",
|
|
69
83
|
"pullToRefresh": "Pull down to refresh",
|
|
84
|
+
"quarters": ["Q1", "Q2", "Q3", "Q4"],
|
|
70
85
|
"record": "Record",
|
|
71
86
|
"refresh": "Refresh",
|
|
72
87
|
"refreshing": "Refreshing",
|
package/lib/cjs/i18n/zh-CN.json
CHANGED
|
@@ -50,6 +50,20 @@
|
|
|
50
50
|
"message": "留言",
|
|
51
51
|
"mobile": "手机号码",
|
|
52
52
|
"mobilePhones": "手机号码",
|
|
53
|
+
"months": [
|
|
54
|
+
"1月",
|
|
55
|
+
"2月",
|
|
56
|
+
"3月",
|
|
57
|
+
"4月",
|
|
58
|
+
"5月",
|
|
59
|
+
"6月",
|
|
60
|
+
"7月",
|
|
61
|
+
"8月",
|
|
62
|
+
"9月",
|
|
63
|
+
"10月",
|
|
64
|
+
"11月",
|
|
65
|
+
"12月"
|
|
66
|
+
],
|
|
53
67
|
"more": "更多",
|
|
54
68
|
"moreTag": "({0}+)",
|
|
55
69
|
"name": "姓名",
|
|
@@ -67,6 +81,7 @@
|
|
|
67
81
|
"pageNotFound": "找不到页面",
|
|
68
82
|
"prompt": "输入",
|
|
69
83
|
"pullToRefresh": "下拉刷新",
|
|
84
|
+
"quarters": ["一季度", "二季度", "三季度", "四季度"],
|
|
70
85
|
"record": "记录",
|
|
71
86
|
"refresh": "刷新",
|
|
72
87
|
"refreshing": "正在刷新",
|
package/lib/cjs/i18n/zh-HK.json
CHANGED
|
@@ -50,6 +50,20 @@
|
|
|
50
50
|
"message": "留言",
|
|
51
51
|
"mobilePhone": "手機號碼",
|
|
52
52
|
"mobilePhones": "手機號碼",
|
|
53
|
+
"months": [
|
|
54
|
+
"1月",
|
|
55
|
+
"2月",
|
|
56
|
+
"3月",
|
|
57
|
+
"4月",
|
|
58
|
+
"5月",
|
|
59
|
+
"6月",
|
|
60
|
+
"7月",
|
|
61
|
+
"8月",
|
|
62
|
+
"9月",
|
|
63
|
+
"10月",
|
|
64
|
+
"11月",
|
|
65
|
+
"12月"
|
|
66
|
+
],
|
|
53
67
|
"more": "更多",
|
|
54
68
|
"moreTag": "({0}+)",
|
|
55
69
|
"name": "姓名",
|
|
@@ -67,6 +81,7 @@
|
|
|
67
81
|
"pageNotFound": "找不到頁面",
|
|
68
82
|
"prompt": "輸入",
|
|
69
83
|
"pullToRefresh": "下拉刷新",
|
|
84
|
+
"quarters": ["一季度", "二季度", "三季度", "四季度"],
|
|
70
85
|
"record": "記錄",
|
|
71
86
|
"refresh": "刷新",
|
|
72
87
|
"refreshing": "正在刷新",
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -43,6 +43,16 @@ export interface RefreshTokenProps<D extends {}> {
|
|
|
43
43
|
*/
|
|
44
44
|
showLoading?: boolean;
|
|
45
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* App fields
|
|
48
|
+
*/
|
|
49
|
+
declare const appFields: readonly ["headerToken", "serversideDeviceId", "deviceId", "devices", "devicePassphrase"];
|
|
50
|
+
/**
|
|
51
|
+
* Basic type template
|
|
52
|
+
*/
|
|
53
|
+
export declare type IAppFields = {
|
|
54
|
+
[key in typeof appFields[number]]: string;
|
|
55
|
+
};
|
|
46
56
|
/**
|
|
47
57
|
* Core application interface
|
|
48
58
|
*/
|
|
@@ -51,6 +61,10 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
51
61
|
* Settings
|
|
52
62
|
*/
|
|
53
63
|
readonly settings: S;
|
|
64
|
+
/**
|
|
65
|
+
* Fields
|
|
66
|
+
*/
|
|
67
|
+
readonly fields: IAppFields;
|
|
54
68
|
/**
|
|
55
69
|
* API
|
|
56
70
|
*/
|
|
@@ -371,6 +385,10 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
371
385
|
* Settings
|
|
372
386
|
*/
|
|
373
387
|
readonly settings: S;
|
|
388
|
+
/**
|
|
389
|
+
* Fields
|
|
390
|
+
*/
|
|
391
|
+
readonly fields: IAppFields;
|
|
374
392
|
/**
|
|
375
393
|
* API
|
|
376
394
|
*/
|
|
@@ -467,6 +485,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
467
485
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
468
486
|
private getDeviceId;
|
|
469
487
|
private resetKeys;
|
|
488
|
+
/**
|
|
489
|
+
* Add app name as identifier
|
|
490
|
+
* @param field Field
|
|
491
|
+
* @returns Result
|
|
492
|
+
*/
|
|
493
|
+
protected addIdentifier(field: string): string;
|
|
470
494
|
/**
|
|
471
495
|
* Restore settings from persisted source
|
|
472
496
|
*/
|
|
@@ -475,12 +499,6 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
475
499
|
* Persist settings to source when application exit
|
|
476
500
|
*/
|
|
477
501
|
persist(): void;
|
|
478
|
-
/**
|
|
479
|
-
* Add app name as identifier
|
|
480
|
-
* @param field Field
|
|
481
|
-
* @returns Result
|
|
482
|
-
*/
|
|
483
|
-
protected addIdentifier(field: string): string;
|
|
484
502
|
/**
|
|
485
503
|
* Setup Api
|
|
486
504
|
* @param api Api
|
|
@@ -753,8 +771,9 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
753
771
|
* Try login, returning false means is loading
|
|
754
772
|
* UI get involved while refreshToken not intended
|
|
755
773
|
* @param data Additional request data
|
|
774
|
+
* @param showLoading Show loading bar or not during call
|
|
756
775
|
*/
|
|
757
|
-
tryLogin<D extends {} = {}>(_data?: D): Promise<boolean>;
|
|
776
|
+
tryLogin<D extends {} = {}>(_data?: D, _showLoading?: boolean): Promise<boolean>;
|
|
758
777
|
/**
|
|
759
778
|
* User login
|
|
760
779
|
* @param user User data
|
|
@@ -779,25 +798,4 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
779
798
|
*/
|
|
780
799
|
warning(message: NotificationContent<N>, align?: NotificationAlign): void;
|
|
781
800
|
}
|
|
782
|
-
export
|
|
783
|
-
/**
|
|
784
|
-
* Response token header field name
|
|
785
|
-
*/
|
|
786
|
-
const headerTokenField = "SmartERPRefreshToken";
|
|
787
|
-
/**
|
|
788
|
-
* Serverside device id encrypted field name
|
|
789
|
-
*/
|
|
790
|
-
const serversideDeviceIdField = "SmartERPServersideDeviceId";
|
|
791
|
-
/**
|
|
792
|
-
* Device id field name
|
|
793
|
-
*/
|
|
794
|
-
const deviceIdField = "SmartERPDeviceId";
|
|
795
|
-
/**
|
|
796
|
-
* Devices field name
|
|
797
|
-
*/
|
|
798
|
-
const devicesField = "SmartERPDevices";
|
|
799
|
-
/**
|
|
800
|
-
* Device passphrase field name
|
|
801
|
-
*/
|
|
802
|
-
const devicePassphraseField = "SmartERPDevicePassphrase";
|
|
803
|
-
}
|
|
801
|
+
export {};
|