@etsoo/appscript 1.6.15 → 1.6.17

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.
@@ -64,6 +64,14 @@ export declare class AuthApi extends BaseApi {
64
64
  * @returns Result
65
65
  */
66
66
  exchangeToken(rq: TokenInputRQ, payload?: IApiPayload<ApiRefreshTokenDto>): Promise<ApiRefreshTokenDto | undefined>;
67
+ /**
68
+ * Get auth request
69
+ * @param deviceId Device ID
70
+ * @param payload Payload
71
+ * @param apiHost API host
72
+ * @returns Result
73
+ */
74
+ getAuthRequest(deviceId?: string, payload?: IApiPayload<AuthRequest>, apiHost?: string): Promise<AuthRequest | undefined>;
67
75
  /**
68
76
  * Get log in url
69
77
  * @param deviceId Device ID
@@ -76,6 +76,20 @@ class AuthApi extends BaseApi_1.BaseApi {
76
76
  const data = { ...rq, timeZone: this.app.getTimeZone() };
77
77
  return this.api.put("Auth/ExchangeToken", data, payload);
78
78
  }
79
+ /**
80
+ * Get auth request
81
+ * @param deviceId Device ID
82
+ * @param payload Payload
83
+ * @param apiHost API host
84
+ * @returns Result
85
+ */
86
+ getAuthRequest(deviceId, payload, apiHost) {
87
+ const rq = {
88
+ region: this.app.region,
89
+ device: deviceId ?? this.app.deviceId
90
+ };
91
+ return this.api.post(`${apiHost ?? ""}Auth/GetAuthRequest`, rq, payload);
92
+ }
79
93
  /**
80
94
  * Get log in url
81
95
  * @param deviceId Device ID
@@ -1781,7 +1781,7 @@ class CoreApp {
1781
1781
  */
1782
1782
  async tryLogin(data) {
1783
1783
  // Check status
1784
- if (this._isTryingLogin)
1784
+ if (this._isTryingLogin || this.deviceId === "")
1785
1785
  return false;
1786
1786
  this._isTryingLogin = true;
1787
1787
  return true;
@@ -64,6 +64,14 @@ export declare class AuthApi extends BaseApi {
64
64
  * @returns Result
65
65
  */
66
66
  exchangeToken(rq: TokenInputRQ, payload?: IApiPayload<ApiRefreshTokenDto>): Promise<ApiRefreshTokenDto | undefined>;
67
+ /**
68
+ * Get auth request
69
+ * @param deviceId Device ID
70
+ * @param payload Payload
71
+ * @param apiHost API host
72
+ * @returns Result
73
+ */
74
+ getAuthRequest(deviceId?: string, payload?: IApiPayload<AuthRequest>, apiHost?: string): Promise<AuthRequest | undefined>;
67
75
  /**
68
76
  * Get log in url
69
77
  * @param deviceId Device ID
@@ -73,6 +73,20 @@ export class AuthApi extends BaseApi {
73
73
  const data = { ...rq, timeZone: this.app.getTimeZone() };
74
74
  return this.api.put("Auth/ExchangeToken", data, payload);
75
75
  }
76
+ /**
77
+ * Get auth request
78
+ * @param deviceId Device ID
79
+ * @param payload Payload
80
+ * @param apiHost API host
81
+ * @returns Result
82
+ */
83
+ getAuthRequest(deviceId, payload, apiHost) {
84
+ const rq = {
85
+ region: this.app.region,
86
+ device: deviceId ?? this.app.deviceId
87
+ };
88
+ return this.api.post(`${apiHost ?? ""}Auth/GetAuthRequest`, rq, payload);
89
+ }
76
90
  /**
77
91
  * Get log in url
78
92
  * @param deviceId Device ID
@@ -1778,7 +1778,7 @@ export class CoreApp {
1778
1778
  */
1779
1779
  async tryLogin(data) {
1780
1780
  // Check status
1781
- if (this._isTryingLogin)
1781
+ if (this._isTryingLogin || this.deviceId === "")
1782
1782
  return false;
1783
1783
  this._isTryingLogin = true;
1784
1784
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.6.15",
3
+ "version": "1.6.17",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -49,7 +49,7 @@
49
49
  "@types/crypto-js": "^4.2.2",
50
50
  "@vitejs/plugin-react": "^4.3.4",
51
51
  "jsdom": "^26.0.0",
52
- "typescript": "^5.7.3",
52
+ "typescript": "^5.8.2",
53
53
  "vitest": "^3.0.7"
54
54
  }
55
55
  }
@@ -113,6 +113,25 @@ export class AuthApi extends BaseApi {
113
113
  return this.api.put("Auth/ExchangeToken", data, payload);
114
114
  }
115
115
 
116
+ /**
117
+ * Get auth request
118
+ * @param deviceId Device ID
119
+ * @param payload Payload
120
+ * @param apiHost API host
121
+ * @returns Result
122
+ */
123
+ getAuthRequest(
124
+ deviceId?: string,
125
+ payload?: IApiPayload<AuthRequest>,
126
+ apiHost?: string
127
+ ) {
128
+ const rq: GetLogInUrlRQ = {
129
+ region: this.app.region,
130
+ device: deviceId ?? this.app.deviceId
131
+ };
132
+ return this.api.post(`${apiHost ?? ""}Auth/GetAuthRequest`, rq, payload);
133
+ }
134
+
116
135
  /**
117
136
  * Get log in url
118
137
  * @param deviceId Device ID
@@ -2367,7 +2367,7 @@ export abstract class CoreApp<
2367
2367
  */
2368
2368
  async tryLogin(data?: AppTryLoginParams) {
2369
2369
  // Check status
2370
- if (this._isTryingLogin) return false;
2370
+ if (this._isTryingLogin || this.deviceId === "") return false;
2371
2371
  this._isTryingLogin = true;
2372
2372
 
2373
2373
  return true;