@djangocfg/layouts 1.4.29 → 1.4.30

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "1.4.29",
3
+ "version": "1.4.30",
4
4
  "description": "Pre-built dashboard layouts, authentication pages, and admin templates for Next.js applications with Tailwind CSS",
5
5
  "keywords": [
6
6
  "layouts",
@@ -85,9 +85,9 @@
85
85
  "check": "tsc --noEmit"
86
86
  },
87
87
  "peerDependencies": {
88
- "@djangocfg/api": "^1.4.29",
89
- "@djangocfg/og-image": "^1.4.29",
90
- "@djangocfg/ui": "^1.4.29",
88
+ "@djangocfg/api": "^1.4.30",
89
+ "@djangocfg/og-image": "^1.4.30",
90
+ "@djangocfg/ui": "^1.4.30",
91
91
  "@hookform/resolvers": "^5.2.0",
92
92
  "consola": "^3.4.2",
93
93
  "lucide-react": "^0.468.0",
@@ -109,7 +109,7 @@
109
109
  "vidstack": "next"
110
110
  },
111
111
  "devDependencies": {
112
- "@djangocfg/typescript-config": "^1.4.29",
112
+ "@djangocfg/typescript-config": "^1.4.30",
113
113
  "@types/node": "^24.7.2",
114
114
  "@types/react": "19.2.2",
115
115
  "@types/react-dom": "19.2.1",
@@ -1,7 +1,7 @@
1
1
  // @ts-nocheck
2
2
  'use client';
3
3
 
4
- import { useRouter } from 'next/navigation';
4
+ import { useRouter, usePathname, useSearchParams } from 'next/navigation';
5
5
  import React, {
6
6
  createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState
7
7
  } from 'react';
@@ -51,6 +51,8 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
51
51
 
52
52
  const [initialized, setInitialized] = useState(false);
53
53
  const router = useRouter();
54
+ const pathname = usePathname();
55
+ const searchParams = useSearchParams();
54
56
 
55
57
  // Use localStorage hooks for email, phone, and redirect
56
58
  const [storedEmail, setStoredEmail, clearStoredEmail] = useLocalStorage<string | null>(EMAIL_STORAGE_KEY, null);
@@ -229,15 +231,16 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
229
231
  // Consider authenticated if we have valid tokens, even without profile
230
232
  const isAuthenticated = api.isAuthenticated();
231
233
  const authRoute = config?.routes?.auth || defaultRoutes.auth;
232
- const isAuthPage = router.pathname === authRoute;
234
+ const isAuthPage = pathname === authRoute;
235
+ const flowParam = searchParams?.get('flow');
233
236
 
234
237
  // Only redirect authenticated users away from auth page if they're not in a flow
235
238
  // This prevents interference with OTP verification flow
236
- if (isAuthenticated && isAuthPage && !router.query.flow) {
239
+ if (isAuthenticated && isAuthPage && !flowParam) {
237
240
  const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;
238
241
  window.location.href = callbackUrl;
239
242
  }
240
- }, [initialized, router.pathname, config?.routes, router.query.flow]);
243
+ }, [initialized, pathname, searchParams, config?.routes]);
241
244
 
242
245
  const pushToDefaultCallbackUrl = useCallback(() => {
243
246
  const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;