@etsoo/appscript 1.2.53 → 1.2.56

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
@@ -23,9 +23,11 @@ export declare class FlutterHost implements IBridgeHost {
23
23
  });
24
24
  cacheCommand(name: string, ...args: unknown[]): void;
25
25
  changeCulture(locale: string): void;
26
+ closable(): boolean;
26
27
  exit(): void;
27
28
  getLabels<T extends string>(...keys: T[]): Promise<any>;
28
29
  getStartUrl(): string | null | undefined;
29
30
  loadApp(name: string, startUrl?: string): void;
31
+ userAuthorization(authorized: boolean): void;
30
32
  }
31
33
  export {};
@@ -39,6 +39,9 @@ class FlutterHost {
39
39
  else
40
40
  this.cacheCommand('changeCulture', locale);
41
41
  }
42
+ closable() {
43
+ return false;
44
+ }
42
45
  exit() {
43
46
  if (this.host.callHandler)
44
47
  this.host.callHandler('exit');
@@ -77,5 +80,11 @@ class FlutterHost {
77
80
  else
78
81
  this.cacheCommand('loadApp', name, startUrl);
79
82
  }
83
+ userAuthorization(authorized) {
84
+ if (this.host.callHandler)
85
+ this.host.callHandler('userAuthorization', authorized);
86
+ else
87
+ this.cacheCommand('userAuthorization', authorized);
88
+ }
80
89
  }
81
90
  exports.FlutterHost = FlutterHost;
@@ -7,6 +7,10 @@ export interface IBridgeHost {
7
7
  * @param locale Locale
8
8
  */
9
9
  changeCulture(locale: string): void;
10
+ /**
11
+ * Closable from client
12
+ */
13
+ closable(): boolean;
10
14
  /**
11
15
  * Exit the application
12
16
  */
@@ -28,4 +32,9 @@ export interface IBridgeHost {
28
32
  * @param startUrl Start Url / router Url
29
33
  */
30
34
  loadApp(name: string, startUrl?: string): void;
35
+ /**
36
+ * User authorization notice
37
+ * @param authorized Authorized or not
38
+ */
39
+ userAuthorization(authorized: boolean): void;
31
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
@@ -23,9 +23,11 @@ export declare class FlutterHost implements IBridgeHost {
23
23
  });
24
24
  cacheCommand(name: string, ...args: unknown[]): void;
25
25
  changeCulture(locale: string): void;
26
+ closable(): boolean;
26
27
  exit(): void;
27
28
  getLabels<T extends string>(...keys: T[]): Promise<any>;
28
29
  getStartUrl(): string | null | undefined;
29
30
  loadApp(name: string, startUrl?: string): void;
31
+ userAuthorization(authorized: boolean): void;
30
32
  }
31
33
  export {};
@@ -36,6 +36,9 @@ export class FlutterHost {
36
36
  else
37
37
  this.cacheCommand('changeCulture', locale);
38
38
  }
39
+ closable() {
40
+ return false;
41
+ }
39
42
  exit() {
40
43
  if (this.host.callHandler)
41
44
  this.host.callHandler('exit');
@@ -74,4 +77,10 @@ export class FlutterHost {
74
77
  else
75
78
  this.cacheCommand('loadApp', name, startUrl);
76
79
  }
80
+ userAuthorization(authorized) {
81
+ if (this.host.callHandler)
82
+ this.host.callHandler('userAuthorization', authorized);
83
+ else
84
+ this.cacheCommand('userAuthorization', authorized);
85
+ }
77
86
  }
@@ -7,6 +7,10 @@ export interface IBridgeHost {
7
7
  * @param locale Locale
8
8
  */
9
9
  changeCulture(locale: string): void;
10
+ /**
11
+ * Closable from client
12
+ */
13
+ closable(): boolean;
10
14
  /**
11
15
  * Exit the application
12
16
  */
@@ -28,4 +32,9 @@ export interface IBridgeHost {
28
32
  * @param startUrl Start Url / router Url
29
33
  */
30
34
  loadApp(name: string, startUrl?: string): void;
35
+ /**
36
+ * User authorization notice
37
+ * @param authorized Authorized or not
38
+ */
39
+ userAuthorization(authorized: boolean): void;
31
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.53",
3
+ "version": "1.2.56",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -52,22 +52,22 @@
52
52
  },
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
- "@etsoo/notificationbase": "^1.1.1",
56
- "@etsoo/restclient": "^1.0.64",
57
- "@etsoo/shared": "^1.1.11",
58
- "@types/crypto-js": "^4.1.0",
55
+ "@etsoo/notificationbase": "^1.1.2",
56
+ "@etsoo/restclient": "^1.0.65",
57
+ "@etsoo/shared": "^1.1.12",
58
+ "@types/crypto-js": "^4.1.1",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/cli": "^7.17.0",
63
- "@babel/core": "^7.17.2",
62
+ "@babel/cli": "^7.17.6",
63
+ "@babel/core": "^7.17.5",
64
64
  "@babel/plugin-transform-runtime": "^7.17.0",
65
65
  "@babel/preset-env": "^7.16.11",
66
66
  "@babel/runtime-corejs3": "^7.17.2",
67
- "@types/jest": "^27.4.0",
68
- "@typescript-eslint/eslint-plugin": "^5.11.0",
69
- "@typescript-eslint/parser": "^5.11.0",
70
- "eslint": "^8.8.0",
67
+ "@types/jest": "^27.4.1",
68
+ "@typescript-eslint/eslint-plugin": "^5.12.1",
69
+ "@typescript-eslint/parser": "^5.12.1",
70
+ "eslint": "^8.10.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.25.4",
73
73
  "jest": "^27.5.1",
@@ -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
  /**
@@ -56,6 +56,10 @@ export class FlutterHost implements IBridgeHost {
56
56
  else this.cacheCommand('changeCulture', locale);
57
57
  }
58
58
 
59
+ closable(): boolean {
60
+ return false;
61
+ }
62
+
59
63
  exit(): void {
60
64
  if (this.host.callHandler) this.host.callHandler('exit');
61
65
  else this.cacheCommand('exit');
@@ -96,4 +100,10 @@ export class FlutterHost implements IBridgeHost {
96
100
  this.host.callHandler('loadApp', name, startUrl);
97
101
  else this.cacheCommand('loadApp', name, startUrl);
98
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
+ }
99
109
  }
@@ -8,6 +8,11 @@ export interface IBridgeHost {
8
8
  */
9
9
  changeCulture(locale: string): void;
10
10
 
11
+ /**
12
+ * Closable from client
13
+ */
14
+ closable(): boolean;
15
+
11
16
  /**
12
17
  * Exit the application
13
18
  */
@@ -32,4 +37,10 @@ export interface IBridgeHost {
32
37
  * @param startUrl Start Url / router Url
33
38
  */
34
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;
35
46
  }