@djangocfg/api 2.1.149 → 2.1.150

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/api",
3
- "version": "2.1.149",
3
+ "version": "2.1.150",
4
4
  "description": "Auto-generated TypeScript API client with React hooks, SWR integration, and Zod validation for Django REST Framework backends",
5
5
  "keywords": [
6
6
  "django",
@@ -74,6 +74,7 @@
74
74
  "check": "tsc --noEmit"
75
75
  },
76
76
  "peerDependencies": {
77
+ "@djangocfg/i18n": "^2.1.150",
77
78
  "consola": "^3.4.2",
78
79
  "next": ">=16.0.0",
79
80
  "p-retry": "^7.0.0",
@@ -84,7 +85,7 @@
84
85
  "devDependencies": {
85
86
  "@types/node": "^24.7.2",
86
87
  "@types/react": "^19.0.0",
87
- "@djangocfg/typescript-config": "^2.1.149",
88
+ "@djangocfg/typescript-config": "^2.1.150",
88
89
  "next": "^16.0.0",
89
90
  "react": "^19.0.0",
90
91
  "tsup": "^8.5.0",
@@ -8,6 +8,7 @@ import React, {
8
8
 
9
9
  import { useCfgRouter, useLocalStorage, useQueryParams } from '../hooks';
10
10
 
11
+ import { getT } from '@djangocfg/i18n';
11
12
  import { api as apiAccounts, Enums } from '../../';
12
13
  import { clearProfileCache, getCachedProfile } from '../hooks/useProfileCache';
13
14
  import { useAuthRedirectManager } from '../hooks/useAuthRedirect';
@@ -533,24 +534,16 @@ const AuthProviderInternal: React.FC<AuthProviderProps> = ({ children, config })
533
534
  return;
534
535
  }
535
536
 
536
- // Use config.onConfirm if provided, otherwise use a simple confirm
537
- if (configRef.current?.onConfirm) {
538
- const { confirmed } = await configRef.current.onConfirm({
539
- title: 'Logout',
540
- description: 'Are you sure you want to logout?',
541
- confirmationButtonText: 'Logout',
542
- cancellationButtonText: 'Cancel',
543
- color: 'error',
544
- });
545
- if (confirmed) {
546
- performLogout();
547
- }
548
- } else {
549
- // Fallback to browser confirm
550
- const confirmed = window.confirm('Are you sure you want to logout?');
551
- if (confirmed) {
552
- performLogout();
553
- }
537
+ // Use global dialog service (from @djangocfg/ui-core/lib/dialog-service)
538
+ const confirmed = await window.dialog.confirm({
539
+ title: getT('layouts.logout.title'),
540
+ message: getT('layouts.logout.message'),
541
+ confirmText: getT('layouts.logout.confirm'),
542
+ cancelText: getT('layouts.logout.cancel'),
543
+ variant: 'destructive',
544
+ });
545
+ if (confirmed) {
546
+ performLogout();
554
547
  }
555
548
  }, [accounts, config?.routes?.defaultAuthCallback, router]);
556
549
 
@@ -14,13 +14,6 @@ export interface AuthConfig {
14
14
  defaultAuthCallback?: string;
15
15
  };
16
16
  onLogout?: () => void;
17
- onConfirm?: (options: {
18
- title: string;
19
- description: string;
20
- confirmationButtonText: string;
21
- cancellationButtonText: string;
22
- color: string;
23
- }) => Promise<{ confirmed: boolean }>;
24
17
  }
25
18
 
26
19
  // Auth context interface