@etsoo/appscript 1.2.67 → 1.2.70
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 +7 -1
- package/lib/cjs/app/CoreApp.js +10 -2
- package/lib/cjs/i18n/en-US.json +1 -0
- package/lib/cjs/i18n/zh-CN.json +1 -0
- package/lib/cjs/i18n/zh-HK.json +1 -0
- package/lib/mjs/app/CoreApp.d.ts +7 -1
- package/lib/mjs/app/CoreApp.js +10 -2
- package/lib/mjs/i18n/en-US.json +1 -0
- package/lib/mjs/i18n/zh-CN.json +1 -0
- package/lib/mjs/i18n/zh-HK.json +1 -0
- package/package.json +1 -1
- package/src/app/CoreApp.ts +20 -2
- package/src/i18n/en-US.json +1 -0
- package/src/i18n/zh-CN.json +1 -0
- package/src/i18n/zh-HK.json +1 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -139,6 +139,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
139
139
|
* @param culture New culture definition
|
|
140
140
|
*/
|
|
141
141
|
changeCulture(culture: DataTypes.CultureDefinition): void;
|
|
142
|
+
/**
|
|
143
|
+
* Check the action result is about device invalid
|
|
144
|
+
* @param result Action result
|
|
145
|
+
* @returns true means device is invalid
|
|
146
|
+
*/
|
|
147
|
+
checkDeviceResult(result: IActionResult): boolean;
|
|
142
148
|
/**
|
|
143
149
|
* Clear cache data
|
|
144
150
|
*/
|
|
@@ -533,7 +539,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
533
539
|
* @param result Action result
|
|
534
540
|
* @returns true means device is invalid
|
|
535
541
|
*/
|
|
536
|
-
|
|
542
|
+
checkDeviceResult(result: IActionResult): boolean;
|
|
537
543
|
/**
|
|
538
544
|
* Init call
|
|
539
545
|
* @param callback Callback
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -727,10 +727,18 @@ class CoreApp {
|
|
|
727
727
|
doRefreshTokenResult(result, initCallCallback, silent = false) {
|
|
728
728
|
if (result === true)
|
|
729
729
|
return;
|
|
730
|
-
if (
|
|
731
|
-
typeof result === 'object' &&
|
|
730
|
+
if (typeof result === 'object' &&
|
|
732
731
|
!(result instanceof restclient_1.ApiDataError) &&
|
|
733
732
|
this.checkDeviceResult(result)) {
|
|
733
|
+
initCallCallback !== null && initCallCallback !== void 0 ? initCallCallback : (initCallCallback = (result) => {
|
|
734
|
+
var _a;
|
|
735
|
+
if (!result)
|
|
736
|
+
return;
|
|
737
|
+
this.notifier.alert((_a = this.get('environmentChanged')) !== null && _a !== void 0 ? _a : 'Environment changed', () => {
|
|
738
|
+
// Reload the page
|
|
739
|
+
history.go(0);
|
|
740
|
+
});
|
|
741
|
+
});
|
|
734
742
|
this.initCall(initCallCallback, true);
|
|
735
743
|
return;
|
|
736
744
|
}
|
package/lib/cjs/i18n/en-US.json
CHANGED
package/lib/cjs/i18n/zh-CN.json
CHANGED
package/lib/cjs/i18n/zh-HK.json
CHANGED
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -139,6 +139,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
|
|
|
139
139
|
* @param culture New culture definition
|
|
140
140
|
*/
|
|
141
141
|
changeCulture(culture: DataTypes.CultureDefinition): void;
|
|
142
|
+
/**
|
|
143
|
+
* Check the action result is about device invalid
|
|
144
|
+
* @param result Action result
|
|
145
|
+
* @returns true means device is invalid
|
|
146
|
+
*/
|
|
147
|
+
checkDeviceResult(result: IActionResult): boolean;
|
|
142
148
|
/**
|
|
143
149
|
* Clear cache data
|
|
144
150
|
*/
|
|
@@ -533,7 +539,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
|
|
|
533
539
|
* @param result Action result
|
|
534
540
|
* @returns true means device is invalid
|
|
535
541
|
*/
|
|
536
|
-
|
|
542
|
+
checkDeviceResult(result: IActionResult): boolean;
|
|
537
543
|
/**
|
|
538
544
|
* Init call
|
|
539
545
|
* @param callback Callback
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -724,10 +724,18 @@ export class CoreApp {
|
|
|
724
724
|
doRefreshTokenResult(result, initCallCallback, silent = false) {
|
|
725
725
|
if (result === true)
|
|
726
726
|
return;
|
|
727
|
-
if (
|
|
728
|
-
typeof result === 'object' &&
|
|
727
|
+
if (typeof result === 'object' &&
|
|
729
728
|
!(result instanceof ApiDataError) &&
|
|
730
729
|
this.checkDeviceResult(result)) {
|
|
730
|
+
initCallCallback !== null && initCallCallback !== void 0 ? initCallCallback : (initCallCallback = (result) => {
|
|
731
|
+
var _a;
|
|
732
|
+
if (!result)
|
|
733
|
+
return;
|
|
734
|
+
this.notifier.alert((_a = this.get('environmentChanged')) !== null && _a !== void 0 ? _a : 'Environment changed', () => {
|
|
735
|
+
// Reload the page
|
|
736
|
+
history.go(0);
|
|
737
|
+
});
|
|
738
|
+
});
|
|
731
739
|
this.initCall(initCallCallback, true);
|
|
732
740
|
return;
|
|
733
741
|
}
|
package/lib/mjs/i18n/en-US.json
CHANGED
package/lib/mjs/i18n/zh-CN.json
CHANGED
package/lib/mjs/i18n/zh-HK.json
CHANGED
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -212,6 +212,13 @@ export interface ICoreApp<
|
|
|
212
212
|
*/
|
|
213
213
|
changeCulture(culture: DataTypes.CultureDefinition): void;
|
|
214
214
|
|
|
215
|
+
/**
|
|
216
|
+
* Check the action result is about device invalid
|
|
217
|
+
* @param result Action result
|
|
218
|
+
* @returns true means device is invalid
|
|
219
|
+
*/
|
|
220
|
+
checkDeviceResult(result: IActionResult): boolean;
|
|
221
|
+
|
|
215
222
|
/**
|
|
216
223
|
* Clear cache data
|
|
217
224
|
*/
|
|
@@ -901,7 +908,7 @@ export abstract class CoreApp<
|
|
|
901
908
|
* @param result Action result
|
|
902
909
|
* @returns true means device is invalid
|
|
903
910
|
*/
|
|
904
|
-
|
|
911
|
+
checkDeviceResult(result: IActionResult): boolean {
|
|
905
912
|
if (result.type === 'NoValidData' && result.field === 'Device')
|
|
906
913
|
return true;
|
|
907
914
|
return false;
|
|
@@ -1470,11 +1477,22 @@ export abstract class CoreApp<
|
|
|
1470
1477
|
if (result === true) return;
|
|
1471
1478
|
|
|
1472
1479
|
if (
|
|
1473
|
-
initCallCallback &&
|
|
1474
1480
|
typeof result === 'object' &&
|
|
1475
1481
|
!(result instanceof ApiDataError) &&
|
|
1476
1482
|
this.checkDeviceResult(result)
|
|
1477
1483
|
) {
|
|
1484
|
+
initCallCallback ??= (result) => {
|
|
1485
|
+
if (!result) return;
|
|
1486
|
+
this.notifier.alert(
|
|
1487
|
+
this.get<string>('environmentChanged') ??
|
|
1488
|
+
'Environment changed',
|
|
1489
|
+
() => {
|
|
1490
|
+
// Reload the page
|
|
1491
|
+
history.go(0);
|
|
1492
|
+
}
|
|
1493
|
+
);
|
|
1494
|
+
};
|
|
1495
|
+
|
|
1478
1496
|
this.initCall(initCallCallback, true);
|
|
1479
1497
|
return;
|
|
1480
1498
|
}
|
package/src/i18n/en-US.json
CHANGED
package/src/i18n/zh-CN.json
CHANGED