@asgardeo/react 0.5.20 → 0.5.22

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, Storage } from '@asgardeo/browser';
18
+ import { AsgardeoBrowserClient, UserProfile, SignInOptions, SignOutOptions, User, EmbeddedFlowExecuteResponse, SignUpOptions, EmbeddedFlowExecuteRequestPayload, EmbeddedSignInFlowHandleRequestPayload, Organization, IdToken, EmbeddedFlowExecuteRequestConfig, AllOrganizationsApiResponse, TokenResponse, HttpRequestConfig, HttpResponse, Storage, TokenExchangeRequestConfig } from '@asgardeo/browser';
19
19
  import { AsgardeoReactConfig } from './models/config';
20
20
  /**
21
21
  * Client for mplementing Asgardeo in React applications.
@@ -51,6 +51,7 @@ declare class AsgardeoReactClient<T extends AsgardeoReactConfig = AsgardeoReactC
51
51
  isInitialized(): Promise<boolean>;
52
52
  isSignedIn(): Promise<boolean>;
53
53
  getConfiguration(): T;
54
+ exchangeToken(config: TokenExchangeRequestConfig, sessionId?: string): Promise<TokenResponse | Response>;
54
55
  signIn(options?: SignInOptions, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
55
56
  signIn(payload: EmbeddedSignInFlowHandleRequestPayload, request: EmbeddedFlowExecuteRequestConfig, sessionId?: string, onSignInSuccess?: (afterSignInUrl: string) => void): Promise<User>;
56
57
  signInSilently(options?: SignInOptions): Promise<User | boolean>;
package/dist/cjs/index.js CHANGED
@@ -179,7 +179,9 @@ var AsgardeoContext = (0, import_react.createContext)({
179
179
  requestAll: () => null
180
180
  },
181
181
  signInOptions: {},
182
- getDecodedIdToken: null
182
+ getDecodedIdToken: null,
183
+ getAccessToken: null,
184
+ exchangeToken: null
183
185
  });
184
186
  AsgardeoContext.displayName = "AsgardeoContext";
185
187
  var AsgardeoContext_default = AsgardeoContext;
@@ -800,6 +802,12 @@ var AsgardeoReactClient = class extends import_browser6.AsgardeoBrowserClient {
800
802
  getConfiguration() {
801
803
  return this.asgardeo.getConfigData();
802
804
  }
805
+ async exchangeToken(config, sessionId) {
806
+ return this.withLoading(async () => {
807
+ return this.asgardeo.exchangeToken(config, (user) => {
808
+ });
809
+ });
810
+ }
803
811
  async signIn(...args) {
804
812
  return this.withLoading(async () => {
805
813
  const arg1 = args[0];
@@ -1785,6 +1793,7 @@ var AsgardeoProvider = ({
1785
1793
  },
1786
1794
  signInOptions,
1787
1795
  getDecodedIdToken: asgardeo.getDecodedIdToken.bind(asgardeo),
1796
+ exchangeToken: asgardeo.exchangeToken.bind(asgardeo),
1788
1797
  syncSession
1789
1798
  }),
1790
1799
  [