@djangocfg/layouts 2.0.1 → 2.0.3

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": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -77,9 +77,9 @@
77
77
  "check": "tsc --noEmit"
78
78
  },
79
79
  "peerDependencies": {
80
- "@djangocfg/api": "^1.4.31",
81
- "@djangocfg/centrifugo": "^1.4.31",
82
- "@djangocfg/ui": "^1.4.31",
80
+ "@djangocfg/api": "^1.4.33",
81
+ "@djangocfg/centrifugo": "^1.4.33",
82
+ "@djangocfg/ui": "^1.4.33",
83
83
  "@hookform/resolvers": "^5.2.0",
84
84
  "consola": "^3.4.2",
85
85
  "lucide-react": "^0.468.0",
@@ -98,8 +98,8 @@
98
98
  "react-ga4": "^2.1.0"
99
99
  },
100
100
  "devDependencies": {
101
- "@djangocfg/centrifugo": "^1.4.31",
102
- "@djangocfg/typescript-config": "^1.4.31",
101
+ "@djangocfg/centrifugo": "^1.4.33",
102
+ "@djangocfg/typescript-config": "^1.4.33",
103
103
  "@types/node": "^24.7.2",
104
104
  "@types/react": "19.2.2",
105
105
  "@types/react-dom": "19.2.1",
@@ -1,14 +1,14 @@
1
1
  // @ts-nocheck
2
2
  'use client';
3
3
 
4
- import { useRouter, usePathname } from 'next/navigation';
4
+ import { usePathname } from 'next/navigation';
5
5
  import React, {
6
6
  createContext, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState
7
7
  } from 'react';
8
8
 
9
9
  import { api, Enums } from '@djangocfg/api';
10
10
  import { useAccountsContext, AccountsProvider } from './AccountsContext';
11
- import { useLocalStorage, useQueryParams } from '@djangocfg/ui/hooks';
11
+ import { useLocalStorage, useQueryParams, useRouter } from '@djangocfg/ui/hooks';
12
12
  import { getCachedProfile, clearProfileCache } from '../hooks/useProfileCache';
13
13
 
14
14
  import { authLogger } from '../../utils/logger';
@@ -238,19 +238,19 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
238
238
  // This prevents interference with OTP verification flow
239
239
  if (isAuthenticated && isAuthPage && !flowParam) {
240
240
  const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;
241
- window.location.href = callbackUrl;
241
+ router.push(callbackUrl);
242
242
  }
243
243
  }, [initialized, pathname, queryParams, config?.routes]);
244
244
 
245
245
  const pushToDefaultCallbackUrl = useCallback(() => {
246
246
  const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;
247
- window.location.href = callbackUrl;
248
- }, [config?.routes]);
247
+ router.push(callbackUrl);
248
+ }, [config?.routes, router]);
249
249
 
250
250
  const pushToDefaultAuthCallbackUrl = useCallback(() => {
251
251
  const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;
252
- window.location.href = authCallbackUrl;
253
- }, [config?.routes]);
252
+ router.push(authCallbackUrl);
253
+ }, [config?.routes, router]);
254
254
 
255
255
  // Memoized checkAuthAndRedirect function
256
256
  const checkAuthAndRedirect = useCallback(async () => {
@@ -366,9 +366,9 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
366
366
 
367
367
  if (redirectUrl && redirectUrl !== defaultCallback) {
368
368
  clearRedirectUrl();
369
- window.location.href = redirectUrl;
369
+ router.push(redirectUrl);
370
370
  } else {
371
- window.location.href = defaultCallback;
371
+ router.push(defaultCallback);
372
372
  }
373
373
 
374
374
  return {
@@ -1,9 +1,9 @@
1
1
  "use client"
2
2
 
3
- import { useRouter } from 'next/navigation';
4
3
  import { useEffect } from 'react';
5
4
 
6
5
  import { useAuth } from '../context';
6
+ import { useRouter } from '@djangocfg/ui/hooks';
7
7
 
8
8
  interface UseAuthGuardOptions {
9
9
  redirectTo?: string;
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { useEffect } from 'react';
4
- import { usePathname, useRouter } from 'next/navigation';
5
- import { useQueryParams } from '@djangocfg/ui/hooks';
4
+ import { usePathname } from 'next/navigation';
5
+ import { useQueryParams, useRouter } from '@djangocfg/ui/hooks';
6
6
  import { authLogger } from '../../utils/logger';
7
7
 
8
8
  export interface UseAutoAuthOptions {
@@ -1,7 +1,6 @@
1
1
  'use client';
2
2
 
3
3
  import { LogIn } from 'lucide-react';
4
- import { useRouter } from 'next/navigation';
5
4
  import React, { useState } from 'react';
6
5
 
7
6
  import {
@@ -11,7 +10,7 @@ import {
11
10
  DialogHeader,
12
11
  DialogTitle,
13
12
  } from '@djangocfg/ui/components';
14
- import { useEventListener } from '@djangocfg/ui/hooks';
13
+ import { useEventListener, useRouter } from '@djangocfg/ui/hooks';
15
14
 
16
15
  // Re-export events for backwards compatibility
17
16
  export const DIALOG_EVENTS = {