@djangocfg/api 2.1.263 → 2.1.264

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 (31) hide show
  1. package/dist/auth.cjs +49 -72
  2. package/dist/auth.cjs.map +1 -1
  3. package/dist/auth.mjs +49 -72
  4. package/dist/auth.mjs.map +1 -1
  5. package/dist/clients.cjs +57 -79
  6. package/dist/clients.cjs.map +1 -1
  7. package/dist/clients.d.cts +113 -179
  8. package/dist/clients.d.ts +113 -179
  9. package/dist/clients.mjs +57 -79
  10. package/dist/clients.mjs.map +1 -1
  11. package/dist/hooks.d.cts +72 -72
  12. package/dist/hooks.d.ts +72 -72
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +97 -97
  15. package/dist/index.d.ts +97 -97
  16. package/dist/index.mjs.map +1 -1
  17. package/package.json +2 -2
  18. package/src/_api/generated/cfg_accounts/accounts/models.ts +31 -31
  19. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +40 -40
  20. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +31 -31
  21. package/src/_api/generated/cfg_totp/CLAUDE.md +3 -3
  22. package/src/_api/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +7 -7
  23. package/src/_api/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +5 -5
  24. package/src/_api/generated/cfg_totp/_utils/schemas/index.ts +0 -1
  25. package/src/_api/generated/cfg_totp/schema.json +2 -103
  26. package/src/_api/generated/cfg_totp/totp__backup_codes/models.ts +14 -14
  27. package/src/_api/generated/cfg_totp/totp__totp_management/client.ts +2 -13
  28. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +4 -29
  29. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +13 -13
  30. package/src/auth/hooks/useTwoFactorStatus.ts +5 -11
  31. package/src/_api/generated/cfg_totp/_utils/schemas/PaginatedDeviceListResponseList.schema.ts +0 -24
@@ -68,13 +68,10 @@ export const useTwoFactorStatus = (): UseTwoFactorStatusReturn => {
68
68
  try {
69
69
  authLogger.info('Fetching 2FA status...');
70
70
 
71
- const response = await apiTotp.totp_management.totpDevicesList();
71
+ // API returns { devices: [...], has_2fa_enabled: bool }
72
+ const response = await apiTotp.totp_management.totpDevicesRetrieve();
72
73
 
73
- // Map devices to our format
74
-
75
- // Join all devices into a single array
76
- const devices = response.results.flatMap((device) => device.devices);
77
- const mappedDevices: TwoFactorDevice[] = devices.map((device) => ({
74
+ const mappedDevices: TwoFactorDevice[] = response.devices.map((device) => ({
78
75
  id: device.id,
79
76
  name: device.name,
80
77
  createdAt: device.created_at,
@@ -83,12 +80,9 @@ export const useTwoFactorStatus = (): UseTwoFactorStatusReturn => {
83
80
  }));
84
81
 
85
82
  setDevices(mappedDevices);
86
-
87
- // 2FA is enabled if there are any devices
88
- const enabled = mappedDevices.length > 0;
89
- setHas2FAEnabled(enabled);
83
+ setHas2FAEnabled(response.has_2fa_enabled);
90
84
 
91
- authLogger.info('2FA status:', enabled ? 'enabled' : 'disabled');
85
+ authLogger.info('2FA status:', response.has_2fa_enabled ? 'enabled' : 'disabled');
92
86
 
93
87
  } catch (err) {
94
88
  const errorMessage = err instanceof Error ? err.message : 'Failed to fetch 2FA status';
@@ -1,24 +0,0 @@
1
- /**
2
- * Zod schema for PaginatedDeviceListResponseList
3
- *
4
- * This schema provides runtime validation and type inference.
5
- * */
6
- import { z } from 'zod'
7
- import { DeviceListResponseSchema } from './DeviceListResponse.schema'
8
-
9
- export const PaginatedDeviceListResponseListSchema = z.object({
10
- count: z.number().int(),
11
- page: z.number().int(),
12
- pages: z.number().int(),
13
- page_size: z.number().int(),
14
- has_next: z.boolean(),
15
- has_previous: z.boolean(),
16
- next_page: z.number().int().nullable().optional(),
17
- previous_page: z.number().int().nullable().optional(),
18
- results: z.array(DeviceListResponseSchema),
19
- })
20
-
21
- /**
22
- * Infer TypeScript type from Zod schema
23
- */
24
- export type PaginatedDeviceListResponseList = z.infer<typeof PaginatedDeviceListResponseListSchema>