@etsoo/appscript 1.5.67 → 1.5.69
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 +12 -0
- package/lib/cjs/app/CoreApp.d.ts +15 -15
- package/lib/cjs/app/CoreApp.js +97 -109
- package/lib/cjs/app/ExternalSettings.d.ts +1 -1
- package/lib/cjs/app/ExternalSettings.js +8 -8
- package/lib/cjs/app/IApp.d.ts +12 -12
- package/lib/cjs/app/IApp.js +8 -8
- package/lib/cjs/bridges/BridgeUtils.d.ts +2 -2
- package/lib/cjs/bridges/BridgeUtils.js +2 -2
- package/lib/cjs/i18n/en.json +1 -0
- package/lib/cjs/i18n/zh-Hans.json +1 -0
- package/lib/cjs/i18n/zh-Hant.json +1 -0
- package/lib/mjs/app/CoreApp.d.ts +15 -15
- package/lib/mjs/app/CoreApp.js +108 -120
- package/lib/mjs/app/ExternalSettings.d.ts +1 -1
- package/lib/mjs/app/ExternalSettings.js +8 -8
- package/lib/mjs/app/IApp.d.ts +12 -12
- package/lib/mjs/app/IApp.js +8 -8
- package/lib/mjs/bridges/BridgeUtils.d.ts +2 -2
- package/lib/mjs/bridges/BridgeUtils.js +3 -3
- package/lib/mjs/i18n/en.json +1 -0
- package/lib/mjs/i18n/zh-Hans.json +1 -0
- package/lib/mjs/i18n/zh-Hant.json +1 -0
- package/package.json +4 -4
- package/src/app/CoreApp.ts +2246 -2303
- package/src/app/ExternalSettings.ts +61 -61
- package/src/app/IApp.ts +760 -766
- package/src/bridges/BridgeUtils.ts +12 -12
- package/src/i18n/en.json +1 -0
- package/src/i18n/zh-Hans.json +1 -0
- package/src/i18n/zh-Hant.json +1 -0
package/src/app/IApp.ts
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import { ApiDataError, IApi, IPData } from
|
|
2
|
+
INotifier,
|
|
3
|
+
NotificationAlign,
|
|
4
|
+
NotificationCallProps,
|
|
5
|
+
NotificationContent,
|
|
6
|
+
NotificationReturn
|
|
7
|
+
} from "@etsoo/notificationbase";
|
|
8
|
+
import { ApiDataError, IApi, IPData } from "@etsoo/restclient";
|
|
9
9
|
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
} from
|
|
19
|
-
import { AddressRegion } from
|
|
20
|
-
import { IUser } from
|
|
21
|
-
import { IAppSettings } from
|
|
22
|
-
import { UserRole } from
|
|
23
|
-
import { EntityStatus } from
|
|
24
|
-
import { Currency } from
|
|
25
|
-
import { ExternalEndpoint } from
|
|
26
|
-
import { ApiRefreshTokenDto } from
|
|
27
|
-
import { ApiRefreshTokenRQ } from
|
|
10
|
+
DataTypes,
|
|
11
|
+
DateUtils,
|
|
12
|
+
ErrorData,
|
|
13
|
+
ErrorType,
|
|
14
|
+
IActionResult,
|
|
15
|
+
IStorage,
|
|
16
|
+
ListType,
|
|
17
|
+
ListType1
|
|
18
|
+
} from "@etsoo/shared";
|
|
19
|
+
import { AddressRegion } from "../address/AddressRegion";
|
|
20
|
+
import { IUser } from "../state/User";
|
|
21
|
+
import { IAppSettings } from "./AppSettings";
|
|
22
|
+
import { UserRole } from "./UserRole";
|
|
23
|
+
import { EntityStatus } from "../business/EntityStatus";
|
|
24
|
+
import { Currency } from "../business/Currency";
|
|
25
|
+
import { ExternalEndpoint } from "./ExternalSettings";
|
|
26
|
+
import { ApiRefreshTokenDto } from "../api/dto/ApiRefreshTokenDto";
|
|
27
|
+
import { ApiRefreshTokenRQ } from "../api/rq/ApiRefreshTokenRQ";
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Detect IP callback interface
|
|
31
31
|
*/
|
|
32
32
|
export interface IDetectIPCallback {
|
|
33
|
-
|
|
33
|
+
(): void;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Navigate options
|
|
38
38
|
*/
|
|
39
39
|
export interface NavigateOptions {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
replace?: boolean;
|
|
41
|
+
state?: any;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
/**
|
|
@@ -52,95 +52,95 @@ export type RefreshTokenResult<R> = IActionResult | [string | null, R];
|
|
|
52
52
|
* Format result custom type
|
|
53
53
|
*/
|
|
54
54
|
export type FormatResultCustom = {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
title?: string;
|
|
56
|
+
type?: string;
|
|
57
|
+
field?: string;
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
61
|
* Format result custom callback type
|
|
62
62
|
*/
|
|
63
63
|
export type FormatResultCustomCallback =
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
| ((data: FormatResultCustom) => string | null | undefined)
|
|
65
|
+
| boolean;
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* Login parameters
|
|
69
69
|
*/
|
|
70
70
|
export type AppLoginParams = {
|
|
71
|
+
/**
|
|
72
|
+
* Login parameters to pass
|
|
73
|
+
*/
|
|
74
|
+
params?: DataTypes.SimpleObject & {
|
|
71
75
|
/**
|
|
72
|
-
*
|
|
76
|
+
* Try login with cached refresh token
|
|
73
77
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
* Try login with cached refresh token
|
|
77
|
-
*/
|
|
78
|
-
tryLogin?: boolean;
|
|
79
|
-
};
|
|
78
|
+
tryLogin?: boolean;
|
|
79
|
+
};
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Don't cache current URL instead of the default page
|
|
83
|
+
*/
|
|
84
|
+
removeUrl?: boolean;
|
|
85
85
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Show loading bar or not
|
|
88
|
+
*/
|
|
89
|
+
showLoading?: boolean;
|
|
90
90
|
};
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* App try login parameters
|
|
94
94
|
*/
|
|
95
95
|
export type AppTryLoginParams = AppLoginParams & {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
/**
|
|
97
|
+
* Callback on failure
|
|
98
|
+
*/
|
|
99
|
+
onFailure?: () => void;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Callback on success
|
|
103
|
+
*/
|
|
104
|
+
onSuccess?: () => void;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
107
|
/**
|
|
108
108
|
* Refresh token props
|
|
109
109
|
*/
|
|
110
110
|
export interface RefreshTokenProps {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Refresh token
|
|
113
|
+
*/
|
|
114
|
+
token?: string;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* API URL
|
|
118
|
+
*/
|
|
119
|
+
api?: string;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Show loading bar or not
|
|
123
|
+
*/
|
|
124
|
+
showLoading?: boolean;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Header token field name
|
|
128
|
+
*/
|
|
129
|
+
tokenField?: string;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/**
|
|
133
133
|
* App fields
|
|
134
134
|
*/
|
|
135
135
|
export const appFields = [
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
136
|
+
"headerToken",
|
|
137
|
+
"serversideDeviceId",
|
|
138
|
+
"deviceId",
|
|
139
|
+
"devices",
|
|
140
|
+
"devicePassphrase",
|
|
141
|
+
"cachedUrl",
|
|
142
|
+
"embedded",
|
|
143
|
+
"keepLogin"
|
|
144
144
|
] as const;
|
|
145
145
|
|
|
146
146
|
/**
|
|
@@ -152,686 +152,680 @@ export type IAppFields = { [key in (typeof appFields)[number]]: string };
|
|
|
152
152
|
* Application interface, for generic version, see ICoreApp
|
|
153
153
|
*/
|
|
154
154
|
export interface IApp {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
* @param align Align, default as TopRight
|
|
832
|
-
*/
|
|
833
|
-
warning(
|
|
834
|
-
message: NotificationContent<unknown>,
|
|
835
|
-
align?: NotificationAlign
|
|
836
|
-
): void;
|
|
155
|
+
/**
|
|
156
|
+
* Settings
|
|
157
|
+
*/
|
|
158
|
+
readonly settings: IAppSettings;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Default region
|
|
162
|
+
*/
|
|
163
|
+
readonly defaultRegion: AddressRegion;
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Fields
|
|
167
|
+
*/
|
|
168
|
+
readonly fields: IAppFields;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* API, not recommend to use it directly in code, wrap to separate methods
|
|
172
|
+
*/
|
|
173
|
+
readonly api: IApi;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Notifier
|
|
177
|
+
*/
|
|
178
|
+
readonly notifier: INotifier<unknown, NotificationCallProps>;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Label delegate
|
|
182
|
+
*/
|
|
183
|
+
readonly labelDelegate: <T = string>(key: string) => T | undefined;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Culture, like zh-CN
|
|
187
|
+
*/
|
|
188
|
+
readonly culture: string;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Currency, like USD for US dollar
|
|
192
|
+
*/
|
|
193
|
+
readonly currency: Currency;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Device id
|
|
197
|
+
*/
|
|
198
|
+
readonly deviceId: string;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Country or region, like CN
|
|
202
|
+
*/
|
|
203
|
+
readonly region: string;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Storage
|
|
207
|
+
*/
|
|
208
|
+
readonly storage: IStorage;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Is current authorized
|
|
212
|
+
*/
|
|
213
|
+
readonly authorized: boolean;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Is the app ready
|
|
217
|
+
*/
|
|
218
|
+
readonly isReady: boolean;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Is trying to login
|
|
222
|
+
*/
|
|
223
|
+
readonly isTryingLogin: boolean;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Application name
|
|
227
|
+
*/
|
|
228
|
+
readonly name: string;
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Pending actions
|
|
232
|
+
*/
|
|
233
|
+
readonly pendings: (() => any)[];
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Is debug mode
|
|
237
|
+
*/
|
|
238
|
+
readonly debug: boolean;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* Is embedded mode
|
|
242
|
+
*/
|
|
243
|
+
readonly embedded: boolean;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Cached URL
|
|
247
|
+
*/
|
|
248
|
+
cachedUrl: string | undefined | null;
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Keep login or not
|
|
252
|
+
*/
|
|
253
|
+
keepLogin: boolean;
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* IP data
|
|
257
|
+
*/
|
|
258
|
+
ipData?: IPData;
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* User data
|
|
262
|
+
*/
|
|
263
|
+
userData?: IUser;
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Search input element
|
|
267
|
+
*/
|
|
268
|
+
searchInput?: HTMLInputElement;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Is screen size down 'sm'
|
|
272
|
+
*/
|
|
273
|
+
smDown?: boolean;
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Is screen size up 'md'
|
|
277
|
+
*/
|
|
278
|
+
mdUp?: boolean;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Add root (homepage) to the URL
|
|
282
|
+
* @param url URL to add
|
|
283
|
+
* @returns Result
|
|
284
|
+
*/
|
|
285
|
+
addRootUrl(url: string): string;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Add scheduled task
|
|
289
|
+
* @param task Task, return false to stop
|
|
290
|
+
* @param interval Interval in milliseconds
|
|
291
|
+
*/
|
|
292
|
+
addTask(task: () => PromiseLike<void | false>, interval: number): void;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Alert result
|
|
296
|
+
* @param result Result message
|
|
297
|
+
* @param callback Callback
|
|
298
|
+
*/
|
|
299
|
+
alertResult(result: string, callback?: NotificationReturn<void>): void;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Alert action result
|
|
303
|
+
* @param result Action result
|
|
304
|
+
* @param callback Callback
|
|
305
|
+
* @param forceToLocal Force to local labels
|
|
306
|
+
*/
|
|
307
|
+
alertResult(
|
|
308
|
+
result: IActionResult,
|
|
309
|
+
callback?: NotificationReturn<void>,
|
|
310
|
+
forceToLocal?: FormatResultCustomCallback
|
|
311
|
+
): void;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* Authorize
|
|
315
|
+
* @param token New access token
|
|
316
|
+
* @param schema Access token schema
|
|
317
|
+
* @param refreshToken Refresh token
|
|
318
|
+
*/
|
|
319
|
+
authorize(token?: string, schema?: string, refreshToken?: string): void;
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Change country or region
|
|
323
|
+
* @param region New country or region
|
|
324
|
+
*/
|
|
325
|
+
changeRegion(region: string | AddressRegion): void;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Change culture
|
|
329
|
+
* @param culture New culture definition
|
|
330
|
+
*/
|
|
331
|
+
changeCulture(
|
|
332
|
+
culture: DataTypes.CultureDefinition
|
|
333
|
+
): Promise<DataTypes.StringRecord>;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Check the action result is about device invalid
|
|
337
|
+
* @param result Action result
|
|
338
|
+
* @returns true means device is invalid
|
|
339
|
+
*/
|
|
340
|
+
checkDeviceResult(result: IActionResult): boolean;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Check language is supported or not
|
|
344
|
+
* @param language Language
|
|
345
|
+
* @returns Result
|
|
346
|
+
*/
|
|
347
|
+
checkLanguage(language?: string): string;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Clear cache data
|
|
351
|
+
*/
|
|
352
|
+
clearCacheData(): void;
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Clear cached token
|
|
356
|
+
*/
|
|
357
|
+
clearCacheToken(): void;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Clear device id
|
|
361
|
+
*/
|
|
362
|
+
clearDeviceId(): void;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Create API client, override to implement custom client creation by name
|
|
366
|
+
* @param name Client name
|
|
367
|
+
* @param item External endpoint item
|
|
368
|
+
* @returns Result
|
|
369
|
+
*/
|
|
370
|
+
createApi(
|
|
371
|
+
name: string,
|
|
372
|
+
item: ExternalEndpoint,
|
|
373
|
+
refresh?: (
|
|
374
|
+
api: IApi,
|
|
375
|
+
rq: ApiRefreshTokenRQ
|
|
376
|
+
) => Promise<[string, number] | undefined>
|
|
377
|
+
): IApi;
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* Decrypt message
|
|
381
|
+
* @param messageEncrypted Encrypted message
|
|
382
|
+
* @param passphrase Secret passphrase
|
|
383
|
+
* @returns Pure text
|
|
384
|
+
*/
|
|
385
|
+
decrypt(messageEncrypted: string, passphrase?: string): string | undefined;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Enhanced decrypt message
|
|
389
|
+
* @param messageEncrypted Encrypted message
|
|
390
|
+
* @param passphrase Secret passphrase
|
|
391
|
+
* @param durationSeconds Duration seconds, <= 12 will be considered as month
|
|
392
|
+
* @returns Pure text
|
|
393
|
+
*/
|
|
394
|
+
decryptEnhanced(
|
|
395
|
+
messageEncrypted: string,
|
|
396
|
+
passphrase?: string,
|
|
397
|
+
durationSeconds?: number
|
|
398
|
+
): string | undefined;
|
|
399
|
+
|
|
400
|
+
/**
|
|
401
|
+
* Detect IP data, call only one time
|
|
402
|
+
* @param callback Callback will be called when the IP is ready
|
|
403
|
+
*/
|
|
404
|
+
detectIP(callback?: IDetectIPCallback): void;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Dispose the application
|
|
408
|
+
*/
|
|
409
|
+
dispose(): void;
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Download file
|
|
413
|
+
* @param stream File stream
|
|
414
|
+
* @param filename File name
|
|
415
|
+
* @param callback callback
|
|
416
|
+
*/
|
|
417
|
+
download(
|
|
418
|
+
stream: ReadableStream,
|
|
419
|
+
filename?: string,
|
|
420
|
+
callback?: (success: boolean | undefined) => void
|
|
421
|
+
): Promise<void>;
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* Encrypt message
|
|
425
|
+
* @param message Message
|
|
426
|
+
* @param passphrase Secret passphrase
|
|
427
|
+
* @param iterations Iterations, 1000 times, 1 - 99
|
|
428
|
+
* @returns Result
|
|
429
|
+
*/
|
|
430
|
+
encrypt(message: string, passphrase?: string, iterations?: number): string;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Enhanced encrypt message
|
|
434
|
+
* @param message Message
|
|
435
|
+
* @param passphrase Secret passphrase
|
|
436
|
+
* @param iterations Iterations, 1000 times, 1 - 99
|
|
437
|
+
* @returns Result
|
|
438
|
+
*/
|
|
439
|
+
encryptEnhanced(
|
|
440
|
+
message: string,
|
|
441
|
+
passphrase?: string,
|
|
442
|
+
iterations?: number
|
|
443
|
+
): string;
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Exchange token data
|
|
447
|
+
* @param api API
|
|
448
|
+
* @param token Core system's refresh token to exchange
|
|
449
|
+
* @returns Result
|
|
450
|
+
*/
|
|
451
|
+
exchangeToken(api: IApi, token: string): Promise<void>;
|
|
452
|
+
|
|
453
|
+
/**
|
|
454
|
+
* Exchange intergration tokens for all APIs
|
|
455
|
+
* @param coreData Core system's token data to exchange
|
|
456
|
+
* @param coreName Core system's name, default is 'core'
|
|
457
|
+
*/
|
|
458
|
+
exchangeTokenAll(coreData: ApiRefreshTokenDto, coreName?: string): void;
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Format date to string
|
|
462
|
+
* @param input Input date
|
|
463
|
+
* @param options Options
|
|
464
|
+
* @param timeZone Time zone
|
|
465
|
+
* @returns string
|
|
466
|
+
*/
|
|
467
|
+
formatDate(
|
|
468
|
+
input?: Date | string,
|
|
469
|
+
options?: DateUtils.FormatOptions,
|
|
470
|
+
timeZone?: string
|
|
471
|
+
): string | undefined;
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Format action
|
|
475
|
+
* @param action Action
|
|
476
|
+
* @param target Target name or title
|
|
477
|
+
* @param items More items
|
|
478
|
+
* @returns Result
|
|
479
|
+
*/
|
|
480
|
+
formatAction(action: string, target: string, ...items: string[]): string;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Format error
|
|
484
|
+
* @param error Error
|
|
485
|
+
* @returns Error message
|
|
486
|
+
*/
|
|
487
|
+
formatError(error: ApiDataError): string;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Format money number
|
|
491
|
+
* @param input Input money number
|
|
492
|
+
* @param isInteger Is integer
|
|
493
|
+
* @param options Options
|
|
494
|
+
* @returns Result
|
|
495
|
+
*/
|
|
496
|
+
formatMoney(
|
|
497
|
+
input: number | bigint,
|
|
498
|
+
isInteger?: boolean,
|
|
499
|
+
options?: Intl.NumberFormatOptions
|
|
500
|
+
): string;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Format number
|
|
504
|
+
* @param input Input number
|
|
505
|
+
* @param options Options
|
|
506
|
+
* @returns Result
|
|
507
|
+
*/
|
|
508
|
+
formatNumber(
|
|
509
|
+
input: number | bigint,
|
|
510
|
+
options?: Intl.NumberFormatOptions
|
|
511
|
+
): string;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Format as full name
|
|
515
|
+
* @param familyName Family name
|
|
516
|
+
* @param givenName Given name
|
|
517
|
+
*/
|
|
518
|
+
formatFullName(
|
|
519
|
+
familyName: string | undefined | null,
|
|
520
|
+
givenName: string | undefined | null
|
|
521
|
+
): string;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Format result text
|
|
525
|
+
* @param result Action result
|
|
526
|
+
* @param forceToLocal Force to local labels
|
|
527
|
+
* @returns Message
|
|
528
|
+
*/
|
|
529
|
+
formatResult(
|
|
530
|
+
result: IActionResult,
|
|
531
|
+
forceToLocal?: FormatResultCustomCallback
|
|
532
|
+
): string;
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Fresh countdown UI
|
|
536
|
+
* @param callback Callback
|
|
537
|
+
*/
|
|
538
|
+
freshCountdownUI(callback?: () => PromiseLike<unknown>): void;
|
|
539
|
+
|
|
540
|
+
/**
|
|
541
|
+
* Get culture resource
|
|
542
|
+
* @param key key
|
|
543
|
+
* @returns Resource
|
|
544
|
+
*/
|
|
545
|
+
get<T = string>(key: string): T | undefined;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Get multiple culture labels
|
|
549
|
+
* @param keys Keys
|
|
550
|
+
*/
|
|
551
|
+
getLabels<T extends string>(...keys: T[]): { [K in T]: string };
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* Get bool items
|
|
555
|
+
* @returns Bool items
|
|
556
|
+
*/
|
|
557
|
+
getBools(): ListType1[];
|
|
558
|
+
|
|
559
|
+
/**
|
|
560
|
+
* Get cached token
|
|
561
|
+
* @returns Cached token
|
|
562
|
+
*/
|
|
563
|
+
getCacheToken(): string | undefined;
|
|
564
|
+
|
|
565
|
+
/**
|
|
566
|
+
* Get data privacies
|
|
567
|
+
* @returns Result
|
|
568
|
+
*/
|
|
569
|
+
getDataPrivacies(): ListType[];
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* Get enum item number id list
|
|
573
|
+
* @param em Enum
|
|
574
|
+
* @param prefix Label prefix or callback
|
|
575
|
+
* @param filter Filter
|
|
576
|
+
* @returns List
|
|
577
|
+
*/
|
|
578
|
+
getEnumList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(
|
|
579
|
+
em: E,
|
|
580
|
+
prefix: string | ((key: string) => string),
|
|
581
|
+
filter?: (id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined
|
|
582
|
+
): ListType[];
|
|
583
|
+
|
|
584
|
+
/**
|
|
585
|
+
* Get enum item string id list
|
|
586
|
+
* @param em Enum
|
|
587
|
+
* @param prefix Label prefix or callback
|
|
588
|
+
* @param filter Filter
|
|
589
|
+
* @returns List
|
|
590
|
+
*/
|
|
591
|
+
getEnumStrList<E extends DataTypes.EnumBase = DataTypes.EnumBase>(
|
|
592
|
+
em: E,
|
|
593
|
+
prefix: string | ((key: string) => string),
|
|
594
|
+
filter?:
|
|
595
|
+
| ((id: E[keyof E], key: keyof E & string) => E[keyof E] | undefined)
|
|
596
|
+
| E[keyof E][]
|
|
597
|
+
): ListType1[];
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Get region label
|
|
601
|
+
* @param id Region id
|
|
602
|
+
* @returns Label
|
|
603
|
+
*/
|
|
604
|
+
getRegionLabel(id: string): string;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Get all regions
|
|
608
|
+
* @returns Regions
|
|
609
|
+
*/
|
|
610
|
+
getRegions(): AddressRegion[];
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Get roles
|
|
614
|
+
* @param role Combination role value
|
|
615
|
+
*/
|
|
616
|
+
getRoles(role: number): ListType[];
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Get status label
|
|
620
|
+
* @param status Status value
|
|
621
|
+
*/
|
|
622
|
+
getStatusLabel(status: number | null | undefined): string;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Get status list
|
|
626
|
+
* @param ids Limited ids
|
|
627
|
+
* @returns list
|
|
628
|
+
*/
|
|
629
|
+
getStatusList(ids?: EntityStatus[]): ListType[];
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* Get refresh token from response headers
|
|
633
|
+
* @param rawResponse Raw response from API call
|
|
634
|
+
* @param tokenKey Refresh token key
|
|
635
|
+
* @returns response refresh token
|
|
636
|
+
*/
|
|
637
|
+
getResponseToken(rawResponse: any, tokenKey: string): string | null;
|
|
638
|
+
|
|
639
|
+
/**
|
|
640
|
+
* Get time zone
|
|
641
|
+
* @returns Time zone
|
|
642
|
+
*/
|
|
643
|
+
getTimeZone(): string | undefined;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Hash message, SHA3 or HmacSHA512, 512 as Base64
|
|
647
|
+
* https://cryptojs.gitbook.io/docs/
|
|
648
|
+
* @param message Message
|
|
649
|
+
* @param passphrase Secret passphrase
|
|
650
|
+
*/
|
|
651
|
+
hash(message: string, passphrase?: string): string;
|
|
652
|
+
|
|
653
|
+
/**
|
|
654
|
+
* Hash message Hex, SHA3 or HmacSHA512, 512 as Base64
|
|
655
|
+
* https://cryptojs.gitbook.io/docs/
|
|
656
|
+
* @param message Message
|
|
657
|
+
* @param passphrase Secret passphrase
|
|
658
|
+
*/
|
|
659
|
+
hashHex(message: string, passphrase?: string): string;
|
|
660
|
+
|
|
661
|
+
/**
|
|
662
|
+
* Check use has the specific role permission or not
|
|
663
|
+
* @param roles Roles to check
|
|
664
|
+
* @returns Result
|
|
665
|
+
*/
|
|
666
|
+
hasPermission(roles: number | UserRole | number[] | UserRole[]): boolean;
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Init call
|
|
670
|
+
* @param callback Callback
|
|
671
|
+
* @param resetKeys Reset all keys first
|
|
672
|
+
* @returns Result
|
|
673
|
+
*/
|
|
674
|
+
initCall(
|
|
675
|
+
callback?: (result: boolean) => void,
|
|
676
|
+
resetKeys?: boolean
|
|
677
|
+
): Promise<void>;
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Is admin user
|
|
681
|
+
* @returns Result
|
|
682
|
+
*/
|
|
683
|
+
isAdminUser(): boolean;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Is Finance user
|
|
687
|
+
* @returns Result
|
|
688
|
+
*/
|
|
689
|
+
isFinanceUser(): boolean;
|
|
690
|
+
|
|
691
|
+
/**
|
|
692
|
+
* Is HR user
|
|
693
|
+
* @returns Result
|
|
694
|
+
*/
|
|
695
|
+
isHRUser(): boolean;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* Is valid password, override to implement custom check
|
|
699
|
+
* @param password Input password
|
|
700
|
+
*/
|
|
701
|
+
isValidPassword(password: string): boolean;
|
|
702
|
+
|
|
703
|
+
/**
|
|
704
|
+
* Navigate to Url or delta
|
|
705
|
+
* @param url Url or delta
|
|
706
|
+
* @param options Options
|
|
707
|
+
*/
|
|
708
|
+
navigate<T extends number | string | URL>(
|
|
709
|
+
to: T,
|
|
710
|
+
options?: T extends number ? never : NavigateOptions
|
|
711
|
+
): void;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Notify user with success message
|
|
715
|
+
* @param message Success message
|
|
716
|
+
* @param callback Popup close callback
|
|
717
|
+
*/
|
|
718
|
+
ok(
|
|
719
|
+
callback?: NotificationReturn<void>,
|
|
720
|
+
message?: NotificationContent<unknown>
|
|
721
|
+
): void;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Callback where exit a page
|
|
725
|
+
*/
|
|
726
|
+
pageExit(): void;
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* Refresh token with result
|
|
730
|
+
* @param props Props
|
|
731
|
+
* @param callback Callback
|
|
732
|
+
* @param api API
|
|
733
|
+
*/
|
|
734
|
+
refreshToken(
|
|
735
|
+
props?: RefreshTokenProps,
|
|
736
|
+
callback?: (result?: boolean | IActionResult) => boolean | void
|
|
737
|
+
): Promise<void>;
|
|
738
|
+
|
|
739
|
+
/**
|
|
740
|
+
* Setup Api error handler
|
|
741
|
+
* @param api Api
|
|
742
|
+
* @param handlerFor401 Handler for 401 error
|
|
743
|
+
*/
|
|
744
|
+
setApiErrorHandler(
|
|
745
|
+
api: IApi,
|
|
746
|
+
handlerFor401?: boolean | (() => Promise<void>)
|
|
747
|
+
): void;
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Setup Api loading
|
|
751
|
+
* @param api Api
|
|
752
|
+
*/
|
|
753
|
+
setApiLoading(api: IApi): void;
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* Setup frontend logging
|
|
757
|
+
* @param action Custom action
|
|
758
|
+
* @param preventDefault Is prevent default action
|
|
759
|
+
*/
|
|
760
|
+
setupLogging(
|
|
761
|
+
action?: (data: ErrorData) => void | Promise<void>,
|
|
762
|
+
preventDefault?: ((type: ErrorType) => boolean) | boolean
|
|
763
|
+
): void;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Signout, with userLogout and toLoginPage
|
|
767
|
+
* @param action Callback
|
|
768
|
+
*/
|
|
769
|
+
signout(action?: () => void | boolean): Promise<void>;
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Persist settings to source when application exit
|
|
773
|
+
*/
|
|
774
|
+
persist(): void;
|
|
775
|
+
|
|
776
|
+
/**
|
|
777
|
+
* Go to the login page
|
|
778
|
+
* @param data Login parameters
|
|
779
|
+
*/
|
|
780
|
+
toLoginPage(data?: AppLoginParams): void;
|
|
781
|
+
|
|
782
|
+
/**
|
|
783
|
+
* Try login, returning false means is loading
|
|
784
|
+
* UI get involved while refreshToken not intended
|
|
785
|
+
* @param data Login parameters
|
|
786
|
+
*/
|
|
787
|
+
tryLogin(data?: AppLoginParams): Promise<boolean>;
|
|
788
|
+
|
|
789
|
+
/**
|
|
790
|
+
* Update API token and expires
|
|
791
|
+
* @param name Api name
|
|
792
|
+
* @param token Refresh token
|
|
793
|
+
* @param seconds Access token expires in seconds
|
|
794
|
+
*/
|
|
795
|
+
updateApi(name: string, token: string | undefined, seconds: number): void;
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* Update embedded status
|
|
799
|
+
* @param embedded New embedded status
|
|
800
|
+
*/
|
|
801
|
+
updateEmbedded(embedded?: boolean): void;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* User login
|
|
805
|
+
* @param user User data
|
|
806
|
+
* @param refreshToken Refresh token
|
|
807
|
+
*/
|
|
808
|
+
userLogin(user: IUser, refreshToken: string): void;
|
|
809
|
+
|
|
810
|
+
/**
|
|
811
|
+
* User logout
|
|
812
|
+
* @param clearToken Clear refresh token or not
|
|
813
|
+
* @param noTrigger No trigger for state change
|
|
814
|
+
*/
|
|
815
|
+
userLogout(clearToken: boolean, noTrigger?: boolean): void;
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* User unauthorized
|
|
819
|
+
*/
|
|
820
|
+
userUnauthorized(): void;
|
|
821
|
+
|
|
822
|
+
/**
|
|
823
|
+
* Show warning message
|
|
824
|
+
* @param message Message
|
|
825
|
+
* @param align Align, default as TopRight
|
|
826
|
+
*/
|
|
827
|
+
warning(
|
|
828
|
+
message: NotificationContent<unknown>,
|
|
829
|
+
align?: NotificationAlign
|
|
830
|
+
): void;
|
|
837
831
|
}
|