@iblai/web-utils 1.6.0 → 1.6.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.
package/dist/index.d.ts CHANGED
@@ -1557,7 +1557,7 @@ type Props$2 = {
1557
1557
  * 4. Handles redirects to auth SPA when needed
1558
1558
  * 5. Manages public route access state
1559
1559
  */
1560
- declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1560
+ declare function AuthProvider({ children, fallback, middleware, onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, storageService, token, enableStorageSync, skip, }: Props$2): string | number | bigint | boolean | Iterable<React__default.ReactNode> | Promise<string | number | bigint | boolean | React__default.ReactPortal | React__default.ReactElement<unknown, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
1561
1561
 
1562
1562
  /**
1563
1563
  * Props for the MentorProvider component
package/dist/index.esm.js CHANGED
@@ -2859,6 +2859,10 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
2859
2859
  * Skipped if enableStorageSync is false
2860
2860
  */
2861
2861
  useEffect(() => {
2862
+ if (skipAuthCheck) {
2863
+ setInitialSyncComplete(true);
2864
+ return;
2865
+ }
2862
2866
  console.log("[AuthProvider] cookie-sync effect running", {
2863
2867
  pathname,
2864
2868
  enableStorageSync,
@@ -2967,7 +2971,7 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
2967
2971
  * Skipped if enableStorageSync is false
2968
2972
  */
2969
2973
  useEffect(() => {
2970
- if (!storageService || !isWeb$1() || !enableStorageSync)
2974
+ if (!storageService || !isWeb$1() || !enableStorageSync || skipAuthCheck)
2971
2975
  return;
2972
2976
  const handleStorageChange = async (event) => {
2973
2977
  // Only handle changes to our auth-related keys
@@ -3067,6 +3071,11 @@ function useAuthProvider({ middleware = new Map(), onAuthSuccess, onAuthFailure,
3067
3071
  }
3068
3072
  }
3069
3073
  useEffect(() => {
3074
+ if (skipAuthCheck) {
3075
+ setIsAuthenticating(false);
3076
+ setUserIsAccessingPublicRoute(true);
3077
+ return;
3078
+ }
3070
3079
  // Wait for initial sync to complete before performing auth check
3071
3080
  if (!initialSyncComplete) {
3072
3081
  console.log("[useAuthProvider] Waiting for initial sync to complete...");
@@ -3144,7 +3153,7 @@ async function determineAuthRequired(middleware, pathname) {
3144
3153
  * 4. Handles redirects to auth SPA when needed
3145
3154
  * 5. Manages public route access state
3146
3155
  */
3147
- function AuthProvider({ children, fallback, middleware = new Map(), onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, skipAuthCheck = false, storageService, token, enableStorageSync = true, skip = false, }) {
3156
+ function AuthProvider({ children, fallback, middleware = new Map(), onAuthSuccess, onAuthFailure, redirectToAuthSpa, hasNonExpiredAuthToken, username, pathname, storageService, token, enableStorageSync = true, skip = false, }) {
3148
3157
  const { isAuthenticating, userIsAccessingPublicRoute, setUserIsAccessingPublicRoute, } = useAuthProvider({
3149
3158
  middleware,
3150
3159
  onAuthSuccess,
@@ -3154,7 +3163,7 @@ function AuthProvider({ children, fallback, middleware = new Map(), onAuthSucces
3154
3163
  username,
3155
3164
  pathname,
3156
3165
  storageService,
3157
- skipAuthCheck,
3166
+ skip,
3158
3167
  token,
3159
3168
  enableStorageSync,
3160
3169
  });