@asgardeo/auth-spa 3.0.1 → 3.0.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/dist/asgardeo-spa.production.esm.js +12 -12
- package/dist/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/asgardeo-spa.production.js +5 -5
- package/dist/asgardeo-spa.production.js.map +1 -1
- package/dist/asgardeo-spa.production.min.js +1 -1
- package/dist/asgardeo-spa.production.min.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.esm.js +13 -13
- package/dist/polyfilled/asgardeo-spa.production.esm.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.js +38 -38
- package/dist/polyfilled/asgardeo-spa.production.js.map +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js +1 -1
- package/dist/polyfilled/asgardeo-spa.production.min.js.map +1 -1
- package/dist/src/client.d.ts +1 -1
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/client.js +3 -2
- package/dist/src/client.js.map +1 -1
- package/dist/src/clients/main-thread-client.d.ts.map +1 -1
- package/dist/src/clients/main-thread-client.js +4 -7
- package/dist/src/clients/main-thread-client.js.map +1 -1
- package/dist/src/clients/web-worker-client.d.ts.map +1 -1
- package/dist/src/clients/web-worker-client.js +4 -7
- package/dist/src/clients/web-worker-client.js.map +1 -1
- package/dist/src/helpers/authentication-helper.d.ts +5 -3
- package/dist/src/helpers/authentication-helper.d.ts.map +1 -1
- package/dist/src/helpers/authentication-helper.js +43 -3
- package/dist/src/helpers/authentication-helper.js.map +1 -1
- package/dist/src/helpers/spa-helper.d.ts.map +1 -1
- package/dist/src/helpers/spa-helper.js +5 -0
- package/dist/src/helpers/spa-helper.js.map +1 -1
- package/dist/src/models/client-config.d.ts +1 -0
- package/dist/src/models/client-config.d.ts.map +1 -1
- package/dist/src/models/client.d.ts +2 -2
- package/dist/src/models/client.d.ts.map +1 -1
- package/dist/src/models/http-client.d.ts +11 -2
- package/dist/src/models/http-client.d.ts.map +1 -1
- package/dist/src/models/http-client.js +1 -1
- package/dist/src/utils/spa-utils.d.ts +8 -1
- package/dist/src/utils/spa-utils.d.ts.map +1 -1
- package/dist/src/utils/spa-utils.js +11 -1
- package/dist/src/utils/spa-utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/client.ts +5 -2
- package/src/clients/main-thread-client.ts +10 -4
- package/src/clients/web-worker-client.ts +10 -4
- package/src/helpers/authentication-helper.ts +52 -4
- package/src/helpers/spa-helper.ts +7 -0
- package/src/models/client-config.ts +1 -0
- package/src/models/client.ts +2 -2
- package/src/models/http-client.ts +12 -2
- package/src/utils/spa-utils.ts +16 -1
package/src/models/client.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface MainThreadClientInterface {
|
|
|
65
65
|
getDataLayer(): Promise<DataLayer<MainThreadClientConfig>>;
|
|
66
66
|
isAuthenticated(): Promise<boolean>;
|
|
67
67
|
updateConfig(config: Partial<AuthClientConfig<MainThreadClientConfig>>): Promise<void>;
|
|
68
|
-
trySignInSilently(): Promise<BasicUserInfo | boolean>;
|
|
68
|
+
trySignInSilently(additionalParams?: Record<string, string | boolean>): Promise<BasicUserInfo | boolean>;
|
|
69
69
|
isSessionActive(): Promise<boolean>;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -97,5 +97,5 @@ export interface WebWorkerClientInterface {
|
|
|
97
97
|
setHttpRequestFinishCallback(callback: () => void): void;
|
|
98
98
|
refreshAccessToken(): Promise<BasicUserInfo>;
|
|
99
99
|
updateConfig(config: Partial<AuthClientConfig<WebWorkerClientConfig>>): Promise<void>;
|
|
100
|
-
trySignInSilently(): Promise<BasicUserInfo | boolean>;
|
|
100
|
+
trySignInSilently(additionalParams?: Record<string, string | boolean>): Promise<BasicUserInfo | boolean>;
|
|
101
101
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
2
|
+
* Copyright (c) 2020-2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
3
|
*
|
|
4
4
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { AxiosRequestConfig } from "axios";
|
|
20
|
-
import { HttpError, HttpResponse } from ".";
|
|
20
|
+
import { HttpClientInstance, HttpError, HttpResponse } from ".";
|
|
21
|
+
import { SPACustomGrantConfig } from "..";
|
|
21
22
|
|
|
22
23
|
export interface HttpClient {
|
|
23
24
|
requestStartCallback: () => void;
|
|
@@ -26,6 +27,15 @@ export interface HttpClient {
|
|
|
26
27
|
requestFinishCallback: () => void;
|
|
27
28
|
}
|
|
28
29
|
|
|
30
|
+
export interface HttpRequestInterface {
|
|
31
|
+
httpClient: HttpClientInstance,
|
|
32
|
+
requestConfig: HttpRequestConfig,
|
|
33
|
+
isHttpHandlerEnabled?: boolean,
|
|
34
|
+
httpErrorCallback?: (error: HttpError) => void | Promise<void>,
|
|
35
|
+
httpFinishCallback?: () => void,
|
|
36
|
+
enableRetrievingSignOutURLFromSession?: (config: SPACustomGrantConfig) => void
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
export interface HttpRequestConfig extends AxiosRequestConfig {
|
|
30
40
|
attachToken?: boolean;
|
|
31
41
|
shouldEncodeToFormData?: boolean;
|
package/src/utils/spa-utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
2
|
+
* Copyright (c) 2020-2024, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
|
3
3
|
*
|
|
4
4
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
|
5
5
|
* Version 2.0 (the "License"); you may not use this file except
|
|
@@ -215,4 +215,19 @@ export class SPAUtils {
|
|
|
215
215
|
|
|
216
216
|
await new Promise((resolve) => setTimeout(resolve, timeToWait * 1000));
|
|
217
217
|
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Waits for a condition before executing the rest of the code in non-blocking manner.
|
|
221
|
+
*
|
|
222
|
+
* @param condition {() => boolean} - Condition to be checked.
|
|
223
|
+
* @param timeout {number} - Time in miliseconds.
|
|
224
|
+
*/
|
|
225
|
+
public static until = (
|
|
226
|
+
condition: () => boolean,
|
|
227
|
+
timeout: number = 500
|
|
228
|
+
) => {
|
|
229
|
+
const poll = (done) => (condition() ? done() : setTimeout(() => poll(done), timeout));
|
|
230
|
+
|
|
231
|
+
return new Promise(poll);
|
|
232
|
+
};
|
|
218
233
|
}
|