@asgardeo/react 0.5.8 → 0.5.9

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.
@@ -16,7 +16,7 @@
16
16
  * under the License.
17
17
  */
18
18
  import { Context } from 'react';
19
- import { Organization } from '@asgardeo/browser';
19
+ import { HttpRequestConfig, HttpResponse, Organization } from '@asgardeo/browser';
20
20
  import AsgardeoReactClient from '../../AsgardeoReactClient';
21
21
  /**
22
22
  * Props interface of {@link AsgardeoContext}
@@ -58,6 +58,13 @@ export type AsgardeoContextProps = {
58
58
  signUp: any;
59
59
  user: any;
60
60
  organization: Organization;
61
+ /**
62
+ * Custom fetch function to make HTTP requests.
63
+ * @param url - The URL to fetch.
64
+ * @param options - Optional configuration for the HTTP request.
65
+ * @returns A promise that resolves to the HTTP response.
66
+ */
67
+ fetch: (url: string, options?: HttpRequestConfig) => Promise<HttpResponse<any>>;
61
68
  };
62
69
  /**
63
70
  * Context object for managing the Authentication flow builder core context.
package/dist/index.js CHANGED
@@ -27,7 +27,8 @@ var AsgardeoContext = createContext({
27
27
  signInSilently: null,
28
28
  signOut: null,
29
29
  signUp: null,
30
- user: null
30
+ user: null,
31
+ fetch: () => null
31
32
  });
32
33
  AsgardeoContext.displayName = "AsgardeoContext";
33
34
  var AsgardeoContext_default = AsgardeoContext;
@@ -723,6 +724,12 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
723
724
  "The signUp method with SignUpOptions is not implemented in the React client."
724
725
  );
725
726
  }
727
+ async fetch(url, options) {
728
+ return this.asgardeo.httpRequest({
729
+ url,
730
+ ...options
731
+ });
732
+ }
726
733
  };
727
734
  var AsgardeoReactClient_default = AsgardeoReactClient;
728
735
 
@@ -1610,6 +1617,9 @@ var AsgardeoProvider = ({
1610
1617
  flattenedProfile: generateFlattenedUserProfile2(payload, prev?.schemas)
1611
1618
  }));
1612
1619
  };
1620
+ const fetch = async (url, options) => {
1621
+ return asgardeo.fetch(url, options);
1622
+ };
1613
1623
  return /* @__PURE__ */ jsx7(
1614
1624
  AsgardeoContext_default.Provider,
1615
1625
  {
@@ -1628,7 +1638,8 @@ var AsgardeoProvider = ({
1628
1638
  signInSilently,
1629
1639
  signOut,
1630
1640
  signUp,
1631
- user
1641
+ user,
1642
+ fetch
1632
1643
  },
1633
1644
  children: /* @__PURE__ */ jsx7(I18nProvider_default, { preferences: preferences?.i18n, children: /* @__PURE__ */ jsx7(
1634
1645
  BrandingProvider_default,