@etsoo/appscript 1.2.54 → 1.2.55

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.
@@ -7,6 +7,7 @@ const shared_1 = require("@etsoo/shared");
7
7
  const crypto_js_1 = require("crypto-js");
8
8
  const AddressRegion_1 = require("../address/AddressRegion");
9
9
  const AddressUtils_1 = require("../address/AddressUtils");
10
+ const BridgeUtils_1 = require("../bridges/BridgeUtils");
10
11
  const BusinessUtils_1 = require("../business/BusinessUtils");
11
12
  const ActionResultError_1 = require("../result/ActionResultError");
12
13
  /**
@@ -383,6 +384,7 @@ class CoreApp {
383
384
  * @param refreshToken Refresh token
384
385
  */
385
386
  authorize(token, refreshToken) {
387
+ var _a;
386
388
  // State, when token is null, means logout
387
389
  this.authorized = token != null;
388
390
  // Token
@@ -402,6 +404,8 @@ class CoreApp {
402
404
  this.cachedRefreshToken = undefined;
403
405
  this.refreshCountdownClear();
404
406
  }
407
+ // Host notice
408
+ (_a = BridgeUtils_1.BridgeUtils.host) === null || _a === void 0 ? void 0 : _a.userAuthorization(this.authorized);
405
409
  }
406
410
  /**
407
411
  * Change country or region
@@ -28,5 +28,6 @@ export declare class FlutterHost implements IBridgeHost {
28
28
  getLabels<T extends string>(...keys: T[]): Promise<any>;
29
29
  getStartUrl(): string | null | undefined;
30
30
  loadApp(name: string, startUrl?: string): void;
31
+ userAuthorization(authorized: boolean): void;
31
32
  }
32
33
  export {};
@@ -80,5 +80,11 @@ class FlutterHost {
80
80
  else
81
81
  this.cacheCommand('loadApp', name, startUrl);
82
82
  }
83
+ userAuthorization(authorized) {
84
+ if (this.host.callHandler)
85
+ this.host.callHandler('userAuthorization', authorized);
86
+ else
87
+ this.cacheCommand('userAuthorization', authorized);
88
+ }
83
89
  }
84
90
  exports.FlutterHost = FlutterHost;
@@ -32,4 +32,9 @@ export interface IBridgeHost {
32
32
  * @param startUrl Start Url / router Url
33
33
  */
34
34
  loadApp(name: string, startUrl?: string): void;
35
+ /**
36
+ * User authorization notice
37
+ * @param authorized Authorized or not
38
+ */
39
+ userAuthorization(authorized: boolean): void;
35
40
  }
@@ -4,6 +4,7 @@ import { DateUtils, DomUtils, NumberUtils, Utils } from '@etsoo/shared';
4
4
  import { AES, algo, enc, HmacSHA512, lib, mode, pad, PBKDF2, SHA3 } from 'crypto-js';
5
5
  import { AddressRegion } from '../address/AddressRegion';
6
6
  import { AddressUtils } from '../address/AddressUtils';
7
+ import { BridgeUtils } from '../bridges/BridgeUtils';
7
8
  import { BusinessUtils } from '../business/BusinessUtils';
8
9
  import { ActionResultError } from '../result/ActionResultError';
9
10
  /**
@@ -380,6 +381,7 @@ export class CoreApp {
380
381
  * @param refreshToken Refresh token
381
382
  */
382
383
  authorize(token, refreshToken) {
384
+ var _a;
383
385
  // State, when token is null, means logout
384
386
  this.authorized = token != null;
385
387
  // Token
@@ -399,6 +401,8 @@ export class CoreApp {
399
401
  this.cachedRefreshToken = undefined;
400
402
  this.refreshCountdownClear();
401
403
  }
404
+ // Host notice
405
+ (_a = BridgeUtils.host) === null || _a === void 0 ? void 0 : _a.userAuthorization(this.authorized);
402
406
  }
403
407
  /**
404
408
  * Change country or region
@@ -28,5 +28,6 @@ export declare class FlutterHost implements IBridgeHost {
28
28
  getLabels<T extends string>(...keys: T[]): Promise<any>;
29
29
  getStartUrl(): string | null | undefined;
30
30
  loadApp(name: string, startUrl?: string): void;
31
+ userAuthorization(authorized: boolean): void;
31
32
  }
32
33
  export {};
@@ -77,4 +77,10 @@ export class FlutterHost {
77
77
  else
78
78
  this.cacheCommand('loadApp', name, startUrl);
79
79
  }
80
+ userAuthorization(authorized) {
81
+ if (this.host.callHandler)
82
+ this.host.callHandler('userAuthorization', authorized);
83
+ else
84
+ this.cacheCommand('userAuthorization', authorized);
85
+ }
80
86
  }
@@ -32,4 +32,9 @@ export interface IBridgeHost {
32
32
  * @param startUrl Start Url / router Url
33
33
  */
34
34
  loadApp(name: string, startUrl?: string): void;
35
+ /**
36
+ * User authorization notice
37
+ * @param authorized Authorized or not
38
+ */
39
+ userAuthorization(authorized: boolean): void;
35
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.54",
3
+ "version": "1.2.55",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -29,6 +29,7 @@ import {
29
29
  } from 'crypto-js';
30
30
  import { AddressRegion } from '../address/AddressRegion';
31
31
  import { AddressUtils } from '../address/AddressUtils';
32
+ import { BridgeUtils } from '../bridges/BridgeUtils';
32
33
  import { BusinessUtils } from '../business/BusinessUtils';
33
34
  import { ProductUnit } from '../business/ProductUnit';
34
35
  import { IdLabelDto } from '../dto/IdLabelDto';
@@ -1041,6 +1042,9 @@ export abstract class CoreApp<
1041
1042
  this.cachedRefreshToken = undefined;
1042
1043
  this.refreshCountdownClear();
1043
1044
  }
1045
+
1046
+ // Host notice
1047
+ BridgeUtils.host?.userAuthorization(this.authorized);
1044
1048
  }
1045
1049
 
1046
1050
  /**
@@ -100,4 +100,10 @@ export class FlutterHost implements IBridgeHost {
100
100
  this.host.callHandler('loadApp', name, startUrl);
101
101
  else this.cacheCommand('loadApp', name, startUrl);
102
102
  }
103
+
104
+ userAuthorization(authorized: boolean): void {
105
+ if (this.host.callHandler)
106
+ this.host.callHandler('userAuthorization', authorized);
107
+ else this.cacheCommand('userAuthorization', authorized);
108
+ }
103
109
  }
@@ -37,4 +37,10 @@ export interface IBridgeHost {
37
37
  * @param startUrl Start Url / router Url
38
38
  */
39
39
  loadApp(name: string, startUrl?: string): void;
40
+
41
+ /**
42
+ * User authorization notice
43
+ * @param authorized Authorized or not
44
+ */
45
+ userAuthorization(authorized: boolean): void;
40
46
  }