@asgardeo/react 0.5.24 → 0.5.26

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.
@@ -109,6 +109,16 @@ export type AsgardeoContextProps = {
109
109
  * @returns A promise that resolves to the token response or the raw response.
110
110
  */
111
111
  exchangeToken: (config: TokenExchangeRequestConfig) => Promise<TokenResponse | Response>;
112
+ /**
113
+ * Re-initializes the client with a new configuration.
114
+ *
115
+ * @remarks
116
+ * This can be partial configuration to update only specific fields.
117
+ *
118
+ * @param config - New configuration to re-initialize the client with.
119
+ * @returns Promise resolving to boolean indicating success.
120
+ */
121
+ reInitialize: (config: Partial<AsgardeoReactConfig>) => Promise<boolean>;
112
122
  } & Pick<AsgardeoReactConfig, 'storage'>;
113
123
  /**
114
124
  * Context object for managing the Authentication flow builder core context.
@@ -15,7 +15,7 @@
15
15
  * specific language governing permissions and limitations
16
16
  * under the License.
17
17
  */
18
- import { I18nBundle } from '@asgardeo/browser';
18
+ import { I18nBundle } from '@asgardeo/i18n';
19
19
  export interface I18nContextValue {
20
20
  /**
21
21
  * The current language code (e.g., 'en-US', 'fr-FR')
package/dist/index.js CHANGED
@@ -37,7 +37,8 @@ var AsgardeoContext = createContext({
37
37
  getDecodedIdToken: null,
38
38
  getAccessToken: null,
39
39
  exchangeToken: null,
40
- storage: "sessionStorage"
40
+ storage: "sessionStorage",
41
+ reInitialize: null
41
42
  });
42
43
  AsgardeoContext.displayName = "AsgardeoContext";
43
44
  var AsgardeoContext_default = AsgardeoContext;
@@ -544,6 +545,23 @@ var AsgardeoReactClient = class extends AsgardeoBrowserClient {
544
545
  return this.asgardeo.init({ ...config, organizationHandle: resolvedOrganizationHandle });
545
546
  });
546
547
  }
548
+ reInitialize(config) {
549
+ return this.withLoading(async () => {
550
+ let isInitialized;
551
+ try {
552
+ await this.asgardeo.reInitialize(config);
553
+ isInitialized = true;
554
+ } catch (error) {
555
+ throw new AsgardeoRuntimeError(
556
+ `Failed to check if the client is initialized: ${error instanceof Error ? error.message : String(error)}`,
557
+ "AsgardeoReactClient-reInitialize-RuntimeError-001",
558
+ "react",
559
+ "An error occurred while checking the initialization status of the client."
560
+ );
561
+ }
562
+ return isInitialized;
563
+ });
564
+ }
547
565
  async updateUserProfile(payload, userId) {
548
566
  throw new Error("Not implemented");
549
567
  }
@@ -876,8 +894,8 @@ var FlowProvider_default = FlowProvider;
876
894
 
877
895
  // src/contexts/I18n/I18nProvider.tsx
878
896
  import { useCallback as useCallback2, useEffect, useMemo as useMemo2, useState as useState2 } from "react";
897
+ import { getDefaultI18nBundles } from "@asgardeo/i18n";
879
898
  import { deepMerge } from "@asgardeo/browser";
880
- import { getI18nBundles } from "@asgardeo/browser";
881
899
 
882
900
  // src/contexts/I18n/I18nContext.ts
883
901
  import { createContext as createContext3 } from "react";
@@ -917,7 +935,7 @@ var I18nProvider = ({
917
935
  children,
918
936
  preferences
919
937
  }) => {
920
- const defaultBundles = getI18nBundles();
938
+ const defaultBundles = getDefaultI18nBundles();
921
939
  const determineInitialLanguage = () => {
922
940
  const configLanguage = preferences?.language;
923
941
  const storedLanguage = getStoredLanguage();
@@ -1663,6 +1681,7 @@ var AsgardeoProvider = ({
1663
1681
  request: asgardeo.request.bind(asgardeo),
1664
1682
  requestAll: asgardeo.requestAll.bind(asgardeo)
1665
1683
  },
1684
+ reInitialize: asgardeo.reInitialize.bind(asgardeo),
1666
1685
  signInOptions,
1667
1686
  getDecodedIdToken: asgardeo.getDecodedIdToken.bind(asgardeo),
1668
1687
  exchangeToken: asgardeo.exchangeToken.bind(asgardeo),