@asgardeo/react 0.17.0 → 0.18.1

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.
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User, EmbeddedFlowExecuteResponse, SignUpOptions, EmbeddedFlowExecuteRequestPayload, EmbeddedSignInFlowHandleRequestPayload, Organization, IdToken, EmbeddedFlowExecuteRequestConfig, AllOrganizationsApiResponse, TokenResponse, HttpRequestConfig, HttpResponse, TokenExchangeRequestConfig } from '@asgardeo/browser';
18
+ import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User, EmbeddedFlowExecuteResponse, SignUpOptions, EmbeddedFlowExecuteRequestPayload, EmbeddedSignInFlowHandleRequestPayload, Organization, IdToken, EmbeddedFlowExecuteRequestConfig, AllOrganizationsApiResponse, TokenResponse, HttpRequestConfig, HttpResponse, TokenExchangeRequestConfig, OIDCDiscoveryApiResponse } from '@asgardeo/browser';
19
19
  import { AsgardeoReactConfig } from './models/config';
20
20
  /**
21
21
  * Client for mplementing Asgardeo in React applications.
@@ -72,6 +72,7 @@ declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactC
72
72
  signOut(options?: SignOutOptions, sessionId?: string, afterSignOut?: (afterSignOutUrl: string) => void): Promise<string>;
73
73
  signUp(options?: SignUpOptions): Promise<void>;
74
74
  signUp(payload: EmbeddedFlowExecuteRequestPayload): Promise<EmbeddedFlowExecuteResponse>;
75
+ getDiscoveryResponse(): Promise<OIDCDiscoveryApiResponse | null>;
75
76
  request(requestConfig?: HttpRequestConfig): Promise<HttpResponse<any>>;
76
77
  requestAll(requestConfigs?: HttpRequestConfig[]): Promise<HttpResponse<any>[]>;
77
78
  getAccessToken(sessionId?: string): Promise<string>;
package/dist/cjs/index.js CHANGED
@@ -185,6 +185,9 @@ var AsgardeoContext = (0, import_react.createContext)({
185
185
  clearSession: () => {
186
186
  },
187
187
  clientId: void 0,
188
+ discovery: {
189
+ wellKnown: null
190
+ },
188
191
  exchangeToken: null,
189
192
  getAccessToken: null,
190
193
  getDecodedIdToken: null,
@@ -743,9 +746,10 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
743
746
  if (!resolvedOrganizationHandle) {
744
747
  resolvedOrganizationHandle = (0, import_browser6.deriveOrganizationHandleFromBaseUrl)(config?.baseUrl);
745
748
  }
746
- return this.withLoading(
747
- async () => this.asgardeo.init({ ...config, organizationHandle: resolvedOrganizationHandle })
748
- );
749
+ return this.withLoading(async () => {
750
+ this.initializeConfig = { ...config, organizationHandle: resolvedOrganizationHandle };
751
+ return this.asgardeo.init(this.initializeConfig);
752
+ });
749
753
  }
750
754
  reInitialize(config) {
751
755
  return this.withLoading(async () => {
@@ -1017,6 +1021,10 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
1017
1021
  (0, import_browser6.navigate)((0, import_browser6.getRedirectBasedSignUpUrl)(config));
1018
1022
  return void 0;
1019
1023
  }
1024
+ async getDiscoveryResponse() {
1025
+ const storageManager = await this.asgardeo.getStorageManager();
1026
+ return storageManager.loadOpenIDProviderConfiguration();
1027
+ }
1020
1028
  async request(requestConfig) {
1021
1029
  return this.asgardeo.httpRequest(requestConfig);
1022
1030
  }
@@ -2150,6 +2158,7 @@ var AsgardeoProvider = ({
2150
2158
  ...rest
2151
2159
  });
2152
2160
  const [isUpdatingSession, setIsUpdatingSession] = (0, import_react20.useState)(false);
2161
+ const [wellKnown, setWellKnown] = (0, import_react20.useState)(null);
2153
2162
  const [brandingPreference, setBrandingPreference] = (0, import_react20.useState)(null);
2154
2163
  const [isBrandingLoading, setIsBrandingLoading] = (0, import_react20.useState)(false);
2155
2164
  const [brandingError, setBrandingError] = (0, import_react20.useState)(null);
@@ -2167,6 +2176,7 @@ var AsgardeoProvider = ({
2167
2176
  await asgardeo.initialize(config);
2168
2177
  const initializedConfig = await asgardeo.getConfiguration();
2169
2178
  setConfig(initializedConfig);
2179
+ setWellKnown(await asgardeo.getDiscoveryResponse());
2170
2180
  })();
2171
2181
  }, []);
2172
2182
  async function updateSession() {
@@ -2491,6 +2501,9 @@ var AsgardeoProvider = ({
2491
2501
  baseUrl,
2492
2502
  clearSession,
2493
2503
  clientId,
2504
+ discovery: {
2505
+ wellKnown
2506
+ },
2494
2507
  exchangeToken,
2495
2508
  getAccessToken,
2496
2509
  getDecodedIdToken,
@@ -2527,6 +2540,7 @@ var AsgardeoProvider = ({
2527
2540
  afterSignInUrl,
2528
2541
  baseUrl,
2529
2542
  clientId,
2543
+ wellKnown,
2530
2544
  isInitializedSync,
2531
2545
  isLoadingSync,
2532
2546
  isSignedInSync,