@etsoo/materialui 1.2.99 → 1.3.0

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.
@@ -1,6 +1,7 @@
1
- import { IApi } from "@etsoo/appscript";
1
+ import { IApi, RefreshTokenResult } from "@etsoo/appscript";
2
2
  import { IServiceUser } from "./IServiceUser";
3
3
  import { ReactAppType } from "./ReactApp";
4
+ import { IAppApi } from "./IAppApi";
4
5
  /**
5
6
  * Service application interface
6
7
  */
@@ -13,6 +14,12 @@ export interface IServiceApp extends ReactAppType {
13
14
  * Service user
14
15
  */
15
16
  readonly serviceUser?: IServiceUser;
17
+ /**
18
+ * Service application API login
19
+ * @param appApi Service application API
20
+ * @param callback Callback
21
+ */
22
+ apiLogin(appApi: IAppApi, callback?: (result: RefreshTokenResult, successData?: string) => void): Promise<boolean>;
16
23
  /**
17
24
  * Load SmartERP core
18
25
  */
@@ -1,4 +1,4 @@
1
- import { IApi, RefreshTokenProps, RefreshTokenRQ } from "@etsoo/appscript";
1
+ import { IApi, RefreshTokenProps, RefreshTokenResult, RefreshTokenRQ } from "@etsoo/appscript";
2
2
  import { IServiceApp } from "./IServiceApp";
3
3
  import { IServiceAppSettings } from "./IServiceAppSettings";
4
4
  import { IServicePageData } from "./IServicePage";
@@ -39,6 +39,12 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
39
39
  * @param name Application name
40
40
  */
41
41
  constructor(settings: S, name: string);
42
+ /**
43
+ * Service application API login
44
+ * @param appApi Service application API
45
+ * @param callback Callback
46
+ */
47
+ apiLogin(appApi: IAppApi, callback?: (result: RefreshTokenResult, successData?: string) => void): Promise<boolean>;
42
48
  /**
43
49
  * Load SmartERP core
44
50
  */
@@ -40,6 +40,20 @@ export class ServiceApp extends ReactApp {
40
40
  api.baseUrl = settings.serviceEndpoint;
41
41
  this.serviceApi = api;
42
42
  }
43
+ /**
44
+ * Service application API login
45
+ * @param appApi Service application API
46
+ * @param callback Callback
47
+ */
48
+ apiLogin(appApi, callback) {
49
+ return this.refreshToken({
50
+ callback,
51
+ data: appApi.getrefreshTokenData(),
52
+ relogin: false,
53
+ showLoading: false,
54
+ appApi
55
+ });
56
+ }
43
57
  /**
44
58
  * Load SmartERP core
45
59
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.2.99",
3
+ "version": "1.3.0",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,6 +1,7 @@
1
- import { IApi } from "@etsoo/appscript";
1
+ import { IApi, RefreshTokenResult } from "@etsoo/appscript";
2
2
  import { IServiceUser } from "./IServiceUser";
3
3
  import { ReactAppType } from "./ReactApp";
4
+ import { IAppApi } from "./IAppApi";
4
5
 
5
6
  /**
6
7
  * Service application interface
@@ -16,6 +17,16 @@ export interface IServiceApp extends ReactAppType {
16
17
  */
17
18
  readonly serviceUser?: IServiceUser;
18
19
 
20
+ /**
21
+ * Service application API login
22
+ * @param appApi Service application API
23
+ * @param callback Callback
24
+ */
25
+ apiLogin(
26
+ appApi: IAppApi,
27
+ callback?: (result: RefreshTokenResult, successData?: string) => void
28
+ ): Promise<boolean>;
29
+
19
30
  /**
20
31
  * Load SmartERP core
21
32
  */
@@ -84,6 +84,24 @@ export class ServiceApp<
84
84
  this.serviceApi = api;
85
85
  }
86
86
 
87
+ /**
88
+ * Service application API login
89
+ * @param appApi Service application API
90
+ * @param callback Callback
91
+ */
92
+ apiLogin(
93
+ appApi: IAppApi,
94
+ callback?: (result: RefreshTokenResult, successData?: string) => void
95
+ ) {
96
+ return this.refreshToken({
97
+ callback,
98
+ data: appApi.getrefreshTokenData(),
99
+ relogin: false,
100
+ showLoading: false,
101
+ appApi
102
+ });
103
+ }
104
+
87
105
  /**
88
106
  * Load SmartERP core
89
107
  */