@multiplatform.one/keycloak 7.34.3 → 7.35.0

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.
Files changed (40) hide show
  1. package/dist/cjs/index.cjs +120 -70
  2. package/dist/cjs/index.native.cjs +283 -148
  3. package/dist/esm/index.js +78 -28
  4. package/dist/esm/index.native.js +270 -135
  5. package/package.json +9 -9
  6. package/src/betterAuth/expoAuthFlow.deadline.spec.ts +230 -0
  7. package/src/betterAuth/expoAuthFlow.native.ts +67 -27
  8. package/src/keycloak/base.ts +3 -2
  9. package/src/keycloak/context.ts +2 -2
  10. package/src/keycloak/index.ts +26 -13
  11. package/src/keycloak/login.error.spec.tsx +85 -0
  12. package/src/provider/KeycloakProvider.loading.spec.tsx +37 -0
  13. package/src/provider/KeycloakProvider.tsx +16 -9
  14. package/src/provider/authProvider/index.native.tsx +170 -108
  15. package/src/provider/authProvider/nonblocking.native.spec.tsx +303 -0
  16. package/src/session/authError.ts +30 -0
  17. package/src/session/index.native.ts +6 -1
  18. package/src/session/index.ts +11 -4
  19. package/types/betterAuth/expoAuthFlow.native.d.ts +3 -1
  20. package/types/betterAuth/expoAuthFlow.native.d.ts.map +1 -1
  21. package/types/keycloak/base.d.ts +1 -1
  22. package/types/keycloak/base.d.ts.map +1 -1
  23. package/types/keycloak/context.d.ts +2 -2
  24. package/types/keycloak/context.d.ts.map +1 -1
  25. package/types/keycloak/index.d.ts +1 -1
  26. package/types/keycloak/index.d.ts.map +1 -1
  27. package/types/keycloak/index.native.d.ts +1 -1
  28. package/types/keycloak/index.native.d.ts.map +1 -1
  29. package/types/keycloak/index.webext.d.ts +1 -1
  30. package/types/keycloak/index.webext.d.ts.map +1 -1
  31. package/types/provider/KeycloakProvider.d.ts +3 -2
  32. package/types/provider/KeycloakProvider.d.ts.map +1 -1
  33. package/types/provider/authProvider/index.native.d.ts +1 -1
  34. package/types/provider/authProvider/index.native.d.ts.map +1 -1
  35. package/types/session/authError.d.ts +7 -0
  36. package/types/session/authError.d.ts.map +1 -0
  37. package/types/session/index.d.ts +2 -0
  38. package/types/session/index.d.ts.map +1 -1
  39. package/types/session/index.native.d.ts +1 -0
  40. package/types/session/index.native.d.ts.map +1 -1
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  AfterAuth: () => AfterAuth,
34
34
  AuthConfigContext: () => AuthConfigContext,
35
35
  AuthProvider: () => AuthProvider,
36
+ AuthTimeoutError: () => AuthTimeoutError,
36
37
  Authenticated: () => Authenticated,
37
38
  BaseKeycloak: () => BaseKeycloak,
38
39
  Keycloak: () => Keycloak,
@@ -40,12 +41,15 @@ __export(index_exports, {
40
41
  KeycloakProvider: () => KeycloakProvider,
41
42
  defaultAuthConfig: () => defaultAuthConfig,
42
43
  getAllWalletAddresses: () => getAllWalletAddresses,
44
+ getAuthError: () => getAuthError,
43
45
  getKeycloakBearerToken: () => getKeycloakBearerToken,
44
46
  getWalletAddresses: () => getWalletAddresses,
45
47
  getWalletsFromToken: () => getWalletsFromToken,
46
48
  hasWallets: () => hasWallets,
47
49
  isTokenExpired: () => isTokenExpired,
50
+ setAuthError: () => setAuthError,
48
51
  useAuthConfig: () => useAuthConfig,
52
+ useAuthError: () => useAuthError,
49
53
  useKeycloak: () => useKeycloak,
50
54
  useSession: () => useSession,
51
55
  useTokensFromQuery: () => useTokensFromQuery,
@@ -178,7 +182,7 @@ var {
178
182
  } = platform;
179
183
 
180
184
  // src/Authenticated.tsx
181
- var import_react8 = require("react");
185
+ var import_react9 = require("react");
182
186
  var import_react_native = require("react-native");
183
187
 
184
188
  // src/hooks/useAuthConfig.ts
@@ -346,7 +350,7 @@ function useTokensFromStore() {
346
350
  }
347
351
 
348
352
  // src/keycloak/index.ts
349
- var import_react7 = require("react");
353
+ var import_react8 = require("react");
350
354
 
351
355
  // src/betterAuth/client.ts
352
356
  var import_react3 = require("better-auth/react");
@@ -502,37 +506,66 @@ function watchKeycloakBearerTokenRevalidate() {
502
506
  };
503
507
  }
504
508
 
509
+ // src/session/authError.ts
510
+ var import_react4 = require("react");
511
+ var error;
512
+ var listeners = /* @__PURE__ */ new Set();
513
+ var AuthTimeoutError = class extends Error {
514
+ constructor(timeoutMs = 1e4) {
515
+ super(`Authentication request timed out after ${timeoutMs}ms`);
516
+ this.name = "AuthTimeoutError";
517
+ }
518
+ };
519
+ function setAuthError(next) {
520
+ if (error === next) return;
521
+ error = next;
522
+ for (const listener of listeners) listener();
523
+ }
524
+ function getAuthError() {
525
+ return error;
526
+ }
527
+ function subscribe(listener) {
528
+ listeners.add(listener);
529
+ return () => listeners.delete(listener);
530
+ }
531
+ function useAuthError() {
532
+ return (0, import_react4.useSyncExternalStore)(subscribe, getAuthError, getAuthError);
533
+ }
534
+
505
535
  // src/session/index.ts
506
536
  var useSession = (_options) => {
507
- return { session: null, status: "unauthenticated" };
537
+ return { session: null, status: "unauthenticated", error: useAuthError() };
508
538
  };
509
539
  if (isBrowser) {
510
540
  useSession = (_options) => {
511
541
  const client = getAuthClient();
512
- const { data, isPending, error: _error } = client.useSession();
542
+ const { data, isPending, error: sessionError } = client.useSession();
543
+ const authError = useAuthError();
544
+ const error2 = sessionError ?? authError;
513
545
  if (isPending) {
514
- return { session: null, status: "loading" };
546
+ return { session: null, status: "loading", error: error2 };
515
547
  }
516
548
  if (!data?.user) {
517
- return { session: null, status: "unauthenticated" };
549
+ return { session: null, status: "unauthenticated", error: error2 };
518
550
  }
519
551
  return {
520
552
  session: {
521
553
  user: data.user,
522
554
  expires: data.session?.expiresAt?.toString()
523
555
  },
524
- status: "authenticated"
556
+ status: "authenticated",
557
+ error: error2
525
558
  };
526
559
  };
527
560
  }
528
561
 
529
562
  // src/keycloak/base.ts
530
563
  var import_jwt_decode2 = require("jwt-decode");
531
- var import_react5 = require("react");
564
+ var import_react6 = require("react");
532
565
 
533
566
  // src/keycloak/context.ts
534
- var import_react4 = require("react");
535
- var KeycloakContext = (0, import_react4.createContext)(void 0);
567
+ var import_react5 = require("react");
568
+ var KeycloakContext = (0, import_react5.createContext)(void 0);
536
569
 
537
570
  // src/keycloak/base.ts
538
571
  var BaseKeycloak = class {
@@ -641,8 +674,9 @@ var BaseKeycloak = class {
641
674
  this._clear();
642
675
  if (this._keycloakClient) {
643
676
  await this._keycloakClient.login(options);
644
- } else {
645
- await this._login?.(options);
677
+ } else if (this._login) {
678
+ await this._login(options);
679
+ return;
646
680
  }
647
681
  this._sync();
648
682
  }
@@ -657,8 +691,8 @@ var BaseKeycloak = class {
657
691
  };
658
692
 
659
693
  // src/keycloak/config.ts
660
- var import_react6 = require("react");
661
- var KeycloakConfigContext = (0, import_react6.createContext)({
694
+ var import_react7 = require("react");
695
+ var KeycloakConfigContext = (0, import_react7.createContext)({
662
696
  clientId: "",
663
697
  realm: "",
664
698
  url: ""
@@ -680,19 +714,29 @@ var Keycloak = class extends BaseKeycloak {
680
714
  }
681
715
  }
682
716
  async login(options = {}) {
683
- this._clear();
684
- if (this._keycloakClient) {
685
- await this._keycloakClient.login(options);
686
- } else if (isBrowser && !isServer2) {
687
- const client = getAuthClient();
688
- await client.signIn.social({
689
- provider: "keycloak",
690
- callbackURL: options.redirectUri || (isWeb2 ? window.location.href : "")
691
- });
692
- } else {
693
- await this._login?.(options);
717
+ setAuthError();
718
+ try {
719
+ this._clear();
720
+ if (this._keycloakClient) {
721
+ await this._keycloakClient.login(options);
722
+ this._sync();
723
+ } else if (this._login) {
724
+ await this._login(options);
725
+ } else if (isBrowser && !isServer2) {
726
+ const client = getAuthClient();
727
+ const result = await client.signIn.social({
728
+ provider: "keycloak",
729
+ callbackURL: options.redirectUri || (isWeb2 ? window.location.href : "")
730
+ });
731
+ if (result?.error) {
732
+ throw result.error instanceof Error ? result.error : new Error(result.error.message || "Sign-in failed");
733
+ }
734
+ }
735
+ } catch (cause) {
736
+ const error2 = cause instanceof Error ? cause : new Error(String(cause));
737
+ setAuthError(error2);
738
+ throw error2;
694
739
  }
695
- this._sync();
696
740
  }
697
741
  async logout(options = {}) {
698
742
  if (this._keycloakClient) {
@@ -725,12 +769,12 @@ var Keycloak = class extends BaseKeycloak {
725
769
  }
726
770
  };
727
771
  function useKeycloak() {
728
- const keycloak = (0, import_react7.useContext)(KeycloakContext);
729
- const keycloakConfig = (0, import_react7.useContext)(KeycloakConfigContext);
772
+ const keycloak = (0, import_react8.useContext)(KeycloakContext);
773
+ const keycloakConfig = (0, import_react8.useContext)(KeycloakConfigContext);
730
774
  const { disabled } = useAuthConfig();
775
+ const { session, status } = useSession();
731
776
  if (disabled) return null;
732
777
  if (keycloak) return keycloak;
733
- const { session, status } = useSession();
734
778
  if (isStorybook) {
735
779
  return new Keycloak(keycloakConfig, {
736
780
  email: "storybook@example.com",
@@ -759,7 +803,7 @@ function Authenticated({
759
803
  const authConfig = useAuthConfig();
760
804
  const keycloak = useKeycloak();
761
805
  const tokensFromQuery = useTokensFromQuery();
762
- (0, import_react8.useEffect)(() => {
806
+ (0, import_react9.useEffect)(() => {
763
807
  if (!keycloak || !authConfig.iframeSso && isIframe2 || isServer2 || keycloak.authenticated || tokensFromQuery) {
764
808
  return;
765
809
  }
@@ -861,13 +905,13 @@ var Logger = class extends BaseLogger {
861
905
  var logger = new Logger();
862
906
 
863
907
  // src/provider/AfterAuth.tsx
864
- var import_react9 = require("react");
908
+ var import_react10 = require("react");
865
909
  var import_jsx_runtime2 = require("react/jsx-runtime");
866
910
  function AfterAuth({ children, loadingComponent: _loadingComponent }) {
867
911
  const authConfig = useAuthConfig();
868
912
  const authStore2 = useAuthStore();
869
913
  const keycloak = useKeycloak();
870
- (0, import_react9.useEffect)(() => {
914
+ (0, import_react10.useEffect)(() => {
871
915
  if (!persist || !keycloak?.authenticated) return;
872
916
  if (keycloak.token) {
873
917
  authStore2.setTokens({
@@ -886,38 +930,38 @@ function AfterAuth({ children, loadingComponent: _loadingComponent }) {
886
930
  keycloak?.idToken,
887
931
  keycloak?.refreshToken
888
932
  ]);
889
- (0, import_react9.useEffect)(() => {
933
+ (0, import_react10.useEffect)(() => {
890
934
  if (authConfig.debug && keycloak?.token) {
891
935
  logger.debug("token", keycloak.token);
892
936
  }
893
937
  }, [authConfig.debug, keycloak?.token]);
894
- (0, import_react9.useEffect)(() => {
938
+ (0, import_react10.useEffect)(() => {
895
939
  if (authConfig.debug && keycloak?.idToken) {
896
940
  logger.debug("idToken", keycloak.idToken);
897
941
  }
898
942
  }, [authConfig.debug, keycloak?.idToken]);
899
- (0, import_react9.useEffect)(() => {
943
+ (0, import_react10.useEffect)(() => {
900
944
  if (authConfig.debug && keycloak?.refreshToken) {
901
945
  logger.debug("refreshToken", keycloak.refreshToken);
902
946
  }
903
947
  }, [authConfig.debug, keycloak?.refreshToken]);
904
- (0, import_react9.useEffect)(() => {
948
+ (0, import_react10.useEffect)(() => {
905
949
  if (authConfig.debug && keycloak?.authenticated) {
906
950
  logger.debug("authenticated", keycloak.authenticated);
907
951
  }
908
952
  }, [authConfig.debug, keycloak?.authenticated]);
909
- (0, import_react9.useEffect)(() => {
953
+ (0, import_react10.useEffect)(() => {
910
954
  if (authConfig.debug && keycloak === null) {
911
955
  logger.debug("keycloak disabled");
912
956
  }
913
957
  }, [authConfig.debug, keycloak]);
914
- (0, import_react9.useEffect)(() => watchKeycloakBearerTokenRevalidate(), []);
958
+ (0, import_react10.useEffect)(() => watchKeycloakBearerTokenRevalidate(), []);
915
959
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children });
916
960
  }
917
961
 
918
962
  // src/provider/authProvider/index.tsx
919
963
  var import_keycloak_js = __toESM(require("@multiplatform.one/keycloak-js"));
920
- var import_react10 = require("react");
964
+ var import_react11 = require("react");
921
965
 
922
966
  // src/Loading.tsx
923
967
  var import_react_native2 = require("react-native");
@@ -955,47 +999,47 @@ function AuthProvider({
955
999
  const { debug, messageHandlerKeys, iframeSso } = useAuthConfig();
956
1000
  const query = new URLSearchParams(isWindowDefined2 ? window?.location?.search || "" : "");
957
1001
  const authStore2 = useAuthStore();
958
- const [keycloak, setKeycloak] = (0, import_react10.useState)();
1002
+ const [keycloak, setKeycloak] = (0, import_react11.useState)();
959
1003
  const idTokenQuery = query.get("idToken");
960
1004
  const refreshTokenQuery = query.get("refreshToken");
961
1005
  const tokenQuery = query.get("token");
962
- const [listeningRefreshToken, setListeningRefreshToken] = (0, import_react10.useState)(false);
963
- const [listeningToken, setListeningToken] = (0, import_react10.useState)(false);
964
- const [listeningIdToken, setListeningIdToken] = (0, import_react10.useState)(false);
965
- const [loadedMessagePosted, setLoadedMessagePosted] = (0, import_react10.useState)(false);
966
- const initialRefreshTokenQuery = (0, import_react10.useMemo)(
1006
+ const [listeningRefreshToken, setListeningRefreshToken] = (0, import_react11.useState)(false);
1007
+ const [listeningToken, setListeningToken] = (0, import_react11.useState)(false);
1008
+ const [listeningIdToken, setListeningIdToken] = (0, import_react11.useState)(false);
1009
+ const [loadedMessagePosted, setLoadedMessagePosted] = (0, import_react11.useState)(false);
1010
+ const initialRefreshTokenQuery = (0, import_react11.useMemo)(
967
1011
  () => validOrRefreshableToken(
968
1012
  !iframeSso && isIframe2 || typeof refreshTokenQuery === "string" ? refreshTokenQuery || true : void 0
969
1013
  ),
970
1014
  [refreshTokenQuery, iframeSso]
971
1015
  );
972
- const initialIdTokenQuery = (0, import_react10.useMemo)(
1016
+ const initialIdTokenQuery = (0, import_react11.useMemo)(
973
1017
  () => validOrRefreshableToken(
974
1018
  !iframeSso && isIframe2 || typeof idTokenQuery === "string" ? idTokenQuery || true : void 0,
975
1019
  initialRefreshTokenQuery
976
1020
  ),
977
1021
  [idTokenQuery, initialRefreshTokenQuery, iframeSso]
978
1022
  );
979
- const initialTokenQuery = (0, import_react10.useMemo)(
1023
+ const initialTokenQuery = (0, import_react11.useMemo)(
980
1024
  () => validOrRefreshableToken(
981
1025
  isIframe2 ? typeof tokenQuery === "string" ? tokenQuery || true : void 0 : void 0,
982
1026
  initialRefreshTokenQuery
983
1027
  ),
984
1028
  [tokenQuery, initialRefreshTokenQuery, iframeSso]
985
1029
  );
986
- const [tokens, setTokens] = (0, import_react10.useState)({
1030
+ const [tokens, setTokens] = (0, import_react11.useState)({
987
1031
  refreshToken: initialRefreshTokenQuery,
988
1032
  token: initialTokenQuery,
989
1033
  idToken: initialIdTokenQuery
990
1034
  });
991
- const authSource = (0, import_react10.useMemo)(() => {
1035
+ const authSource = (0, import_react11.useMemo)(() => {
992
1036
  if (!iframeSso && isIframe2) {
993
1037
  if (initialTokenQuery) return "query" /* Query */;
994
1038
  return "store" /* Store */;
995
1039
  }
996
1040
  return "session" /* Session */;
997
1041
  }, [initialTokenQuery, iframeSso]);
998
- const authStrategy = (0, import_react10.useMemo)(() => {
1042
+ const authStrategy = (0, import_react11.useMemo)(() => {
999
1043
  if (authSource === "session" /* Session */) return "better-auth" /* BetterAuth */;
1000
1044
  if (authSource === "query" /* Query */) {
1001
1045
  return "keycloak-client-implicit" /* KeycloakClientImplicit */;
@@ -1006,7 +1050,7 @@ function AuthProvider({
1006
1050
  }
1007
1051
  return "keycloak-client-standard" /* KeycloakClientStandard */;
1008
1052
  }, [authSource, authStore2.token, tokens.token]);
1009
- const isLoading = (0, import_react10.useMemo)(() => {
1053
+ const isLoading = (0, import_react11.useMemo)(() => {
1010
1054
  if (!authStrategy) return true;
1011
1055
  if (authStrategy === "keycloak-client-implicit" /* KeycloakClientImplicit */) {
1012
1056
  if (authSource === "query" /* Query */ && (initialRefreshTokenQuery === true || initialTokenQuery === true || initialIdTokenQuery === true)) {
@@ -1024,7 +1068,7 @@ function AuthProvider({
1024
1068
  initialRefreshTokenQuery,
1025
1069
  initialTokenQuery
1026
1070
  ]);
1027
- (0, import_react10.useEffect)(() => {
1071
+ (0, import_react11.useEffect)(() => {
1028
1072
  if (!persist || tokens.idToken || tokens.refreshToken || tokens.token) {
1029
1073
  return;
1030
1074
  }
@@ -1038,7 +1082,7 @@ function AuthProvider({
1038
1082
  token
1039
1083
  });
1040
1084
  }, [authStore2, persist]);
1041
- (0, import_react10.useEffect)(() => {
1085
+ (0, import_react11.useEffect)(() => {
1042
1086
  if (disabled || authSource !== "query" /* Query */ || tokens.token === true || tokens.refreshToken === true || tokens.idToken === true || loadedMessagePosted) {
1043
1087
  return;
1044
1088
  }
@@ -1050,7 +1094,7 @@ function AuthProvider({
1050
1094
  window?.parent?.postMessage(JSON.stringify({ type: "LOADED" }));
1051
1095
  setLoadedMessagePosted(true);
1052
1096
  }, [disabled, authSource, tokens.token, tokens.refreshToken, tokens.idToken]);
1053
- (0, import_react10.useEffect)(() => {
1097
+ (0, import_react11.useEffect)(() => {
1054
1098
  if (disabled || tokens.refreshToken !== true || listeningRefreshToken) {
1055
1099
  return;
1056
1100
  }
@@ -1090,7 +1134,7 @@ function AuthProvider({
1090
1134
  window.removeEventListener("message", messageCallback);
1091
1135
  };
1092
1136
  }, [disabled, tokens.refreshToken, listeningRefreshToken]);
1093
- (0, import_react10.useEffect)(() => {
1137
+ (0, import_react11.useEffect)(() => {
1094
1138
  if (disabled || tokens.token !== true || listeningToken) return;
1095
1139
  setListeningToken(true);
1096
1140
  function messageCallback(e) {
@@ -1128,7 +1172,7 @@ function AuthProvider({
1128
1172
  window.removeEventListener("message", messageCallback);
1129
1173
  };
1130
1174
  }, [disabled, tokens.token, listeningToken]);
1131
- (0, import_react10.useEffect)(() => {
1175
+ (0, import_react11.useEffect)(() => {
1132
1176
  if (disabled || tokens.idToken !== true || listeningIdToken) return;
1133
1177
  setListeningIdToken(true);
1134
1178
  function messageCallback(e) {
@@ -1166,7 +1210,7 @@ function AuthProvider({
1166
1210
  window.removeEventListener("message", messageCallback);
1167
1211
  };
1168
1212
  }, [disabled, tokens.idToken, listeningIdToken]);
1169
- const keycloakClient = (0, import_react10.useMemo)(
1213
+ const keycloakClient = (0, import_react11.useMemo)(
1170
1214
  () => !disabled && !isLoading && (authStrategy === "keycloak-client-standard" /* KeycloakClientStandard */ || authStrategy === "keycloak-client-implicit" /* KeycloakClientImplicit */) && keycloakConfig ? new import_keycloak_js.default({
1171
1215
  clientId: keycloakConfig.publicClientId || keycloakConfig.clientId,
1172
1216
  realm: keycloakConfig.realm,
@@ -1183,7 +1227,7 @@ function AuthProvider({
1183
1227
  tokens.token
1184
1228
  ]
1185
1229
  );
1186
- const initOptions = (0, import_react10.useMemo)(() => {
1230
+ const initOptions = (0, import_react11.useMemo)(() => {
1187
1231
  if (!keycloakClient) return;
1188
1232
  const initOptions2 = {
1189
1233
  ...defaultKeycloakInitOptions,
@@ -1226,7 +1270,7 @@ function AuthProvider({
1226
1270
  tokens.refreshToken,
1227
1271
  iframeSso
1228
1272
  ]);
1229
- (0, import_react10.useEffect)(() => {
1273
+ (0, import_react11.useEffect)(() => {
1230
1274
  if (!keycloakClient || !initOptions || authStrategy === "keycloak-client-implicit" /* KeycloakClientImplicit */ && (typeof tokens.token !== "string" || !tokens.token)) {
1231
1275
  return;
1232
1276
  }
@@ -1259,7 +1303,7 @@ function AuthProvider({
1259
1303
  setKeycloak(new Keycloak(keycloakConfig, keycloakClient));
1260
1304
  })();
1261
1305
  }, [keycloakClient, initOptions, authStrategy, tokens.token]);
1262
- const render = (0, import_react10.useCallback)(
1306
+ const render = (0, import_react11.useCallback)(
1263
1307
  () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(KeycloakConfigContext.Provider, { value: keycloakConfig, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(KeycloakContext.Provider, { value: keycloak, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AfterAuth, { loadingComponent, children }) }) }),
1264
1308
  [children, keycloak, keycloakConfig]
1265
1309
  );
@@ -1272,7 +1316,7 @@ function AuthProvider({
1272
1316
  }
1273
1317
 
1274
1318
  // src/provider/KeycloakProvider.tsx
1275
- var import_react11 = require("react");
1319
+ var import_react12 = require("react");
1276
1320
  var import_jsx_runtime5 = require("react/jsx-runtime");
1277
1321
  function KeycloakProvider({
1278
1322
  baseUrl,
@@ -1281,28 +1325,34 @@ function KeycloakProvider({
1281
1325
  clientId,
1282
1326
  expoScheme,
1283
1327
  loginRedirectUri,
1328
+ loadingComponent,
1284
1329
  debug,
1285
1330
  disabled,
1286
1331
  iframeSso,
1287
1332
  publicClientId,
1288
1333
  realm
1289
1334
  }) {
1290
- const authConfig = (0, import_react11.useMemo)(
1335
+ const authConfig = (0, import_react12.useMemo)(
1291
1336
  () => ({ debug, disabled, iframeSso, loginRedirectUri }),
1292
1337
  [debug, disabled, iframeSso, loginRedirectUri]
1293
1338
  );
1339
+ const keycloakConfig = (0, import_react12.useMemo)(
1340
+ () => ({
1341
+ clientId: clientId || "app",
1342
+ publicClientId,
1343
+ realm: realm || "main",
1344
+ url: baseUrl ?? "",
1345
+ betterAuthBaseUrl,
1346
+ expoScheme
1347
+ }),
1348
+ [clientId, publicClientId, realm, baseUrl, betterAuthBaseUrl, expoScheme]
1349
+ );
1294
1350
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(AuthConfigContext.Provider, { value: authConfig, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1295
1351
  AuthProvider,
1296
1352
  {
1297
1353
  disabled,
1298
- keycloakConfig: {
1299
- clientId: clientId || "app",
1300
- publicClientId,
1301
- realm: realm || "main",
1302
- url: baseUrl ?? "",
1303
- betterAuthBaseUrl,
1304
- expoScheme
1305
- },
1354
+ keycloakConfig,
1355
+ loadingComponent,
1306
1356
  children
1307
1357
  }
1308
1358
  ) });