@etsoo/appscript 1.5.1 → 1.5.3
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 +0 -1
- package/lib/cjs/app/CoreApp.js +13 -10
- package/lib/mjs/app/CoreApp.d.ts +0 -1
- package/lib/mjs/app/CoreApp.js +13 -10
- package/package.json +1 -1
- package/src/app/CoreApp.ts +34 -12
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -152,7 +152,6 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
152
152
|
* @param name Application name
|
|
153
153
|
*/
|
|
154
154
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
155
|
-
private debugIt;
|
|
156
155
|
private getDeviceId;
|
|
157
156
|
private resetKeys;
|
|
158
157
|
/**
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -154,8 +154,6 @@ class CoreApp {
|
|
|
154
154
|
this.fields = IApp_1.appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
|
|
155
155
|
// Device id
|
|
156
156
|
this._deviceId = storage.getData(this.fields.deviceId, '');
|
|
157
|
-
// Debug
|
|
158
|
-
this.debugIt('constructor', this.fields, this._deviceId);
|
|
159
157
|
this.setApi(api);
|
|
160
158
|
const { currentCulture, currentRegion } = settings;
|
|
161
159
|
// Load resources
|
|
@@ -165,11 +163,6 @@ class CoreApp {
|
|
|
165
163
|
this.setup();
|
|
166
164
|
});
|
|
167
165
|
}
|
|
168
|
-
debugIt(...args) {
|
|
169
|
-
if (this.debug) {
|
|
170
|
-
console.debug('CoreApp', ...args);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
166
|
getDeviceId() {
|
|
174
167
|
return this.deviceId.substring(0, 15);
|
|
175
168
|
}
|
|
@@ -295,7 +288,9 @@ class CoreApp {
|
|
|
295
288
|
setApiErrorHandler(api, handlerFor401) {
|
|
296
289
|
api.onError = (error) => {
|
|
297
290
|
// Debug
|
|
298
|
-
this.
|
|
291
|
+
if (this.debug) {
|
|
292
|
+
console.debug('CoreApp.setApiErrorHandler', api, error, handlerFor401);
|
|
293
|
+
}
|
|
299
294
|
// Error code
|
|
300
295
|
const status = error.response
|
|
301
296
|
? api.transformResponse(error.response).status
|
|
@@ -335,7 +330,9 @@ class CoreApp {
|
|
|
335
330
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
336
331
|
api.onRequest = (data) => {
|
|
337
332
|
// Debug
|
|
338
|
-
this.
|
|
333
|
+
if (this.debug) {
|
|
334
|
+
console.debug('CoreApp.setApiLoading.onRequest', api, data, this.notifier.loadingCount);
|
|
335
|
+
}
|
|
339
336
|
if (data.showLoading == null || data.showLoading) {
|
|
340
337
|
this.notifier.showLoading();
|
|
341
338
|
}
|
|
@@ -343,9 +340,15 @@ class CoreApp {
|
|
|
343
340
|
// onComplete, hide loading, rewrite the property to override default action
|
|
344
341
|
api.onComplete = (data) => {
|
|
345
342
|
// Debug
|
|
346
|
-
this.
|
|
343
|
+
if (this.debug) {
|
|
344
|
+
console.debug('CoreApp.setApiLoading.onComplete', api, data, this.notifier.loadingCount, this.lastCalled);
|
|
345
|
+
}
|
|
347
346
|
if (data.showLoading == null || data.showLoading) {
|
|
348
347
|
this.notifier.hideLoading();
|
|
348
|
+
// Debug
|
|
349
|
+
if (this.debug) {
|
|
350
|
+
console.debug('CoreApp.setApiLoading.onComplete.showLoading', api, this.notifier.loadingCount);
|
|
351
|
+
}
|
|
349
352
|
}
|
|
350
353
|
this.lastCalled = true;
|
|
351
354
|
};
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -152,7 +152,6 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
152
152
|
* @param name Application name
|
|
153
153
|
*/
|
|
154
154
|
protected constructor(settings: S, api: IApi, notifier: INotifier<N, C>, storage: IStorage, name: string);
|
|
155
|
-
private debugIt;
|
|
156
155
|
private getDeviceId;
|
|
157
156
|
private resetKeys;
|
|
158
157
|
/**
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -151,8 +151,6 @@ export class CoreApp {
|
|
|
151
151
|
this.fields = appFields.reduce((a, v) => ({ ...a, [v]: 'smarterp-' + v + '-' + name }), {});
|
|
152
152
|
// Device id
|
|
153
153
|
this._deviceId = storage.getData(this.fields.deviceId, '');
|
|
154
|
-
// Debug
|
|
155
|
-
this.debugIt('constructor', this.fields, this._deviceId);
|
|
156
154
|
this.setApi(api);
|
|
157
155
|
const { currentCulture, currentRegion } = settings;
|
|
158
156
|
// Load resources
|
|
@@ -162,11 +160,6 @@ export class CoreApp {
|
|
|
162
160
|
this.setup();
|
|
163
161
|
});
|
|
164
162
|
}
|
|
165
|
-
debugIt(...args) {
|
|
166
|
-
if (this.debug) {
|
|
167
|
-
console.debug('CoreApp', ...args);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
163
|
getDeviceId() {
|
|
171
164
|
return this.deviceId.substring(0, 15);
|
|
172
165
|
}
|
|
@@ -292,7 +285,9 @@ export class CoreApp {
|
|
|
292
285
|
setApiErrorHandler(api, handlerFor401) {
|
|
293
286
|
api.onError = (error) => {
|
|
294
287
|
// Debug
|
|
295
|
-
this.
|
|
288
|
+
if (this.debug) {
|
|
289
|
+
console.debug('CoreApp.setApiErrorHandler', api, error, handlerFor401);
|
|
290
|
+
}
|
|
296
291
|
// Error code
|
|
297
292
|
const status = error.response
|
|
298
293
|
? api.transformResponse(error.response).status
|
|
@@ -332,7 +327,9 @@ export class CoreApp {
|
|
|
332
327
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
333
328
|
api.onRequest = (data) => {
|
|
334
329
|
// Debug
|
|
335
|
-
this.
|
|
330
|
+
if (this.debug) {
|
|
331
|
+
console.debug('CoreApp.setApiLoading.onRequest', api, data, this.notifier.loadingCount);
|
|
332
|
+
}
|
|
336
333
|
if (data.showLoading == null || data.showLoading) {
|
|
337
334
|
this.notifier.showLoading();
|
|
338
335
|
}
|
|
@@ -340,9 +337,15 @@ export class CoreApp {
|
|
|
340
337
|
// onComplete, hide loading, rewrite the property to override default action
|
|
341
338
|
api.onComplete = (data) => {
|
|
342
339
|
// Debug
|
|
343
|
-
this.
|
|
340
|
+
if (this.debug) {
|
|
341
|
+
console.debug('CoreApp.setApiLoading.onComplete', api, data, this.notifier.loadingCount, this.lastCalled);
|
|
342
|
+
}
|
|
344
343
|
if (data.showLoading == null || data.showLoading) {
|
|
345
344
|
this.notifier.hideLoading();
|
|
345
|
+
// Debug
|
|
346
|
+
if (this.debug) {
|
|
347
|
+
console.debug('CoreApp.setApiLoading.onComplete.showLoading', api, this.notifier.loadingCount);
|
|
348
|
+
}
|
|
346
349
|
}
|
|
347
350
|
this.lastCalled = true;
|
|
348
351
|
};
|
package/package.json
CHANGED
package/src/app/CoreApp.ts
CHANGED
|
@@ -305,9 +305,6 @@ export abstract class CoreApp<
|
|
|
305
305
|
// Device id
|
|
306
306
|
this._deviceId = storage.getData(this.fields.deviceId, '');
|
|
307
307
|
|
|
308
|
-
// Debug
|
|
309
|
-
this.debugIt('constructor', this.fields, this._deviceId);
|
|
310
|
-
|
|
311
308
|
this.setApi(api);
|
|
312
309
|
|
|
313
310
|
const { currentCulture, currentRegion } = settings;
|
|
@@ -322,12 +319,6 @@ export abstract class CoreApp<
|
|
|
322
319
|
);
|
|
323
320
|
}
|
|
324
321
|
|
|
325
|
-
private debugIt(...args: any[]) {
|
|
326
|
-
if (this.debug) {
|
|
327
|
-
console.debug('CoreApp', ...args);
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
|
|
331
322
|
private getDeviceId() {
|
|
332
323
|
return this.deviceId.substring(0, 15);
|
|
333
324
|
}
|
|
@@ -490,7 +481,14 @@ export abstract class CoreApp<
|
|
|
490
481
|
) {
|
|
491
482
|
api.onError = (error: ApiDataError) => {
|
|
492
483
|
// Debug
|
|
493
|
-
this.
|
|
484
|
+
if (this.debug) {
|
|
485
|
+
console.debug(
|
|
486
|
+
'CoreApp.setApiErrorHandler',
|
|
487
|
+
api,
|
|
488
|
+
error,
|
|
489
|
+
handlerFor401
|
|
490
|
+
);
|
|
491
|
+
}
|
|
494
492
|
|
|
495
493
|
// Error code
|
|
496
494
|
const status = error.response
|
|
@@ -532,7 +530,14 @@ export abstract class CoreApp<
|
|
|
532
530
|
// onRequest, show loading or not, rewrite the property to override default action
|
|
533
531
|
api.onRequest = (data) => {
|
|
534
532
|
// Debug
|
|
535
|
-
this.
|
|
533
|
+
if (this.debug) {
|
|
534
|
+
console.debug(
|
|
535
|
+
'CoreApp.setApiLoading.onRequest',
|
|
536
|
+
api,
|
|
537
|
+
data,
|
|
538
|
+
this.notifier.loadingCount
|
|
539
|
+
);
|
|
540
|
+
}
|
|
536
541
|
|
|
537
542
|
if (data.showLoading == null || data.showLoading) {
|
|
538
543
|
this.notifier.showLoading();
|
|
@@ -542,10 +547,27 @@ export abstract class CoreApp<
|
|
|
542
547
|
// onComplete, hide loading, rewrite the property to override default action
|
|
543
548
|
api.onComplete = (data) => {
|
|
544
549
|
// Debug
|
|
545
|
-
this.
|
|
550
|
+
if (this.debug) {
|
|
551
|
+
console.debug(
|
|
552
|
+
'CoreApp.setApiLoading.onComplete',
|
|
553
|
+
api,
|
|
554
|
+
data,
|
|
555
|
+
this.notifier.loadingCount,
|
|
556
|
+
this.lastCalled
|
|
557
|
+
);
|
|
558
|
+
}
|
|
546
559
|
|
|
547
560
|
if (data.showLoading == null || data.showLoading) {
|
|
548
561
|
this.notifier.hideLoading();
|
|
562
|
+
|
|
563
|
+
// Debug
|
|
564
|
+
if (this.debug) {
|
|
565
|
+
console.debug(
|
|
566
|
+
'CoreApp.setApiLoading.onComplete.showLoading',
|
|
567
|
+
api,
|
|
568
|
+
this.notifier.loadingCount
|
|
569
|
+
);
|
|
570
|
+
}
|
|
549
571
|
}
|
|
550
572
|
this.lastCalled = true;
|
|
551
573
|
};
|