@djangocfg/api 2.1.227 → 2.1.229

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 (55) hide show
  1. package/README.md +8 -9
  2. package/dist/auth-server.cjs +4 -9
  3. package/dist/auth-server.cjs.map +1 -1
  4. package/dist/auth-server.mjs +4 -9
  5. package/dist/auth-server.mjs.map +1 -1
  6. package/dist/auth.cjs +120 -158
  7. package/dist/auth.cjs.map +1 -1
  8. package/dist/auth.d.cts +120 -177
  9. package/dist/auth.d.ts +120 -177
  10. package/dist/auth.mjs +149 -191
  11. package/dist/auth.mjs.map +1 -1
  12. package/dist/clients.cjs +5 -11
  13. package/dist/clients.cjs.map +1 -1
  14. package/dist/clients.d.cts +253 -254
  15. package/dist/clients.d.ts +253 -254
  16. package/dist/clients.mjs +5 -11
  17. package/dist/clients.mjs.map +1 -1
  18. package/dist/hooks.cjs +4 -9
  19. package/dist/hooks.cjs.map +1 -1
  20. package/dist/hooks.d.cts +64 -85
  21. package/dist/hooks.d.ts +64 -85
  22. package/dist/hooks.mjs +4 -9
  23. package/dist/hooks.mjs.map +1 -1
  24. package/dist/index.cjs +5 -11
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +109 -99
  27. package/dist/index.d.ts +109 -99
  28. package/dist/index.mjs +5 -11
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +2 -2
  31. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts +24 -2
  32. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts +0 -2
  33. package/src/_api/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts +0 -2
  34. package/src/_api/generated/cfg_accounts/accounts/client.ts +1 -1
  35. package/src/_api/generated/cfg_accounts/accounts/models.ts +37 -38
  36. package/src/_api/generated/cfg_accounts/accounts__oauth/models.ts +36 -36
  37. package/src/_api/generated/cfg_accounts/accounts__user_profile/models.ts +15 -15
  38. package/src/_api/generated/cfg_accounts/enums.ts +0 -10
  39. package/src/_api/generated/cfg_accounts/schema.json +31 -25
  40. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +74 -74
  41. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +36 -36
  42. package/src/_api/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +22 -22
  43. package/src/_api/generated/cfg_totp/totp__totp_management/models.ts +10 -10
  44. package/src/_api/generated/cfg_totp/totp__totp_setup/models.ts +22 -22
  45. package/src/_api/generated/cfg_totp/totp__totp_verification/models.ts +8 -8
  46. package/src/auth/context/AccountsContext.tsx +6 -2
  47. package/src/auth/context/AuthContext.tsx +32 -39
  48. package/src/auth/context/types.ts +5 -9
  49. package/src/auth/hooks/index.ts +1 -1
  50. package/src/auth/hooks/useAuthForm.ts +42 -75
  51. package/src/auth/hooks/useAuthFormState.ts +35 -6
  52. package/src/auth/hooks/useAuthValidation.ts +5 -65
  53. package/src/auth/hooks/useTwoFactor.ts +17 -2
  54. package/src/auth/types/form.ts +25 -70
  55. package/src/auth/types/index.ts +2 -6
package/dist/index.d.cts CHANGED
@@ -40,35 +40,13 @@ declare class Auth {
40
40
  declare enum OAuthConnectionProvider {
41
41
  GITHUB = "github"
42
42
  }
43
- /**
44
- * Delivery channel: 'email' or 'phone'. Auto-detected if not provided.
45
- * * `email` - Email
46
- * * `phone` - Phone
47
- */
48
- declare enum OTPRequestRequestChannel {
49
- EMAIL = "email",
50
- PHONE = "phone"
51
- }
52
43
 
53
44
  type enums_OAuthConnectionProvider = OAuthConnectionProvider;
54
45
  declare const enums_OAuthConnectionProvider: typeof OAuthConnectionProvider;
55
- type enums_OTPRequestRequestChannel = OTPRequestRequestChannel;
56
- declare const enums_OTPRequestRequestChannel: typeof OTPRequestRequestChannel;
57
46
  declare namespace enums {
58
- export { enums_OAuthConnectionProvider as OAuthConnectionProvider, enums_OTPRequestRequestChannel as OTPRequestRequestChannel };
47
+ export { enums_OAuthConnectionProvider as OAuthConnectionProvider };
59
48
  }
60
49
 
61
- /**
62
- * Request to disconnect OAuth provider.
63
- *
64
- * Request model (no read-only fields).
65
- */
66
- interface OAuthDisconnectRequestRequest$1 {
67
- /** OAuth provider to disconnect
68
-
69
- * `github` - GitHub */
70
- provider: OAuthConnectionProvider;
71
- }
72
50
  /**
73
51
  * Response with OAuth authorization URL.
74
52
  *
@@ -81,15 +59,15 @@ interface OAuthAuthorizeResponse$1 {
81
59
  state: string;
82
60
  }
83
61
  /**
84
- * Request to start OAuth flow.
62
+ * Error response for OAuth endpoints.
85
63
  *
86
- * Request model (no read-only fields).
64
+ * Response model (includes read-only fields).
87
65
  */
88
- interface OAuthAuthorizeRequestRequest$1 {
89
- /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
90
- redirect_uri?: string;
91
- /** Optional source URL for registration tracking */
92
- source_url?: string;
66
+ interface OAuthError$1 {
67
+ /** Error code */
68
+ error: string;
69
+ /** Human-readable error description */
70
+ error_description?: string;
93
71
  }
94
72
  /**
95
73
  * Response with JWT tokens after OAuth authentication. When 2FA is required: -
@@ -118,13 +96,15 @@ interface OAuthTokenResponse$1 {
118
96
  should_prompt_2fa?: boolean;
119
97
  }
120
98
  /**
121
- * Response with available OAuth providers.
99
+ * Request to start OAuth flow.
122
100
  *
123
- * Response model (includes read-only fields).
101
+ * Request model (no read-only fields).
124
102
  */
125
- interface OAuthProvidersResponse$1 {
126
- /** List of available OAuth providers */
127
- providers: Array<Record<string, any>>;
103
+ interface OAuthAuthorizeRequestRequest$1 {
104
+ /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
105
+ redirect_uri?: string;
106
+ /** Optional source URL for registration tracking */
107
+ source_url?: string;
128
108
  }
129
109
  /**
130
110
  * Request to complete OAuth flow (callback handler).
@@ -139,6 +119,26 @@ interface OAuthCallbackRequestRequest$1 {
139
119
  /** Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path */
140
120
  redirect_uri?: string;
141
121
  }
122
+ /**
123
+ * Request to disconnect OAuth provider.
124
+ *
125
+ * Request model (no read-only fields).
126
+ */
127
+ interface OAuthDisconnectRequestRequest$1 {
128
+ /** OAuth provider to disconnect
129
+
130
+ * `github` - GitHub */
131
+ provider: OAuthConnectionProvider;
132
+ }
133
+ /**
134
+ * Response with available OAuth providers.
135
+ *
136
+ * Response model (includes read-only fields).
137
+ */
138
+ interface OAuthProvidersResponse$1 {
139
+ /** List of available OAuth providers */
140
+ providers: Array<Record<string, any>>;
141
+ }
142
142
  /**
143
143
  * Serializer for OAuth connection info (user-facing).
144
144
  *
@@ -162,17 +162,6 @@ interface OAuthConnection$1 {
162
162
  /** Last time this OAuth connection was used for login */
163
163
  last_login_at: string;
164
164
  }
165
- /**
166
- * Error response for OAuth endpoints.
167
- *
168
- * Response model (includes read-only fields).
169
- */
170
- interface OAuthError$1 {
171
- /** Error code */
172
- error: string;
173
- /** Human-readable error description */
174
- error_description?: string;
175
- }
176
165
 
177
166
  declare namespace models$2 {
178
167
  export type { OAuthAuthorizeRequestRequest$1 as OAuthAuthorizeRequestRequest, OAuthAuthorizeResponse$1 as OAuthAuthorizeResponse, OAuthCallbackRequestRequest$1 as OAuthCallbackRequestRequest, OAuthConnection$1 as OAuthConnection, OAuthDisconnectRequestRequest$1 as OAuthDisconnectRequestRequest, OAuthError$1 as OAuthError, OAuthProvidersResponse$1 as OAuthProvidersResponse, OAuthTokenResponse$1 as OAuthTokenResponse };
@@ -223,7 +212,7 @@ declare class Oauth {
223
212
  *
224
213
  * Request model (no read-only fields).
225
214
  */
226
- interface UserProfileUpdateRequest$1 {
215
+ interface PatchedUserProfileUpdateRequest$1 {
227
216
  first_name?: string;
228
217
  last_name?: string;
229
218
  company?: string;
@@ -239,6 +228,19 @@ interface CfgAccountsProfileAvatarCreateRequest$1 {
239
228
  /** Avatar image file (JPEG, PNG, GIF, WebP, max 5MB) */
240
229
  avatar: File | Blob;
241
230
  }
231
+ /**
232
+ * Serializer for updating user profile.
233
+ *
234
+ * Request model (no read-only fields).
235
+ */
236
+ interface UserProfileUpdateRequest$1 {
237
+ first_name?: string;
238
+ last_name?: string;
239
+ company?: string;
240
+ phone?: string;
241
+ position?: string;
242
+ language?: string;
243
+ }
242
244
  /**
243
245
  * Serializer for user details.
244
246
  *
@@ -269,19 +271,6 @@ interface User$2 {
269
271
  unanswered_messages_count: number;
270
272
  centrifugo: CentrifugoToken$2 | null;
271
273
  }
272
- /**
273
- * Serializer for updating user profile.
274
- *
275
- * Request model (no read-only fields).
276
- */
277
- interface PatchedUserProfileUpdateRequest$1 {
278
- first_name?: string;
279
- last_name?: string;
280
- company?: string;
281
- phone?: string;
282
- position?: string;
283
- language?: string;
284
- }
285
274
  /**
286
275
  * Response serializer for account deletion.
287
276
  *
@@ -376,24 +365,51 @@ declare class UserProfile {
376
365
  * Request model (no read-only fields).
377
366
  */
378
367
  interface OTPRequestRequest$1 {
379
- /** Email address or phone number for OTP delivery */
368
+ /** Email address for OTP delivery */
380
369
  identifier: string;
381
- /** Delivery channel: 'email' or 'phone'. Auto-detected if not provided.
382
-
383
- * `email` - Email
384
- * `phone` - Phone */
385
- channel?: OTPRequestRequestChannel;
386
370
  /** Source URL for tracking registration (e.g., https://my.djangocfg.com) */
387
371
  source_url?: string;
388
372
  }
389
373
  /**
390
- * Error response for OTP operations.
374
+ * Serializer for OTP verification.
375
+ *
376
+ * Request model (no read-only fields).
377
+ */
378
+ interface OTPVerifyRequest$1 {
379
+ /** Email address used for OTP request */
380
+ identifier: string;
381
+ otp: string;
382
+ /** Source URL for tracking login (e.g., https://my.djangocfg.com) */
383
+ source_url?: string;
384
+ }
385
+ /**
386
+ * OTP request response.
387
+ *
388
+ * Response model (includes read-only fields).
389
+ */
390
+ interface OTPRequestResponse$1 {
391
+ /** Success message */
392
+ message: string;
393
+ }
394
+ /**
395
+ * Typed error response for OTP operations. error_code values: -
396
+ * invalid_identifier — malformed email - cooldown — too soon after last
397
+ * request (retry_after = seconds) - hourly_limit — hourly quota exceeded
398
+ * (retry_after = seconds until reset) - daily_limit — daily quota exceeded
399
+ * (retry_after = seconds until reset) - rate_limited — IP-level rate limit hit
400
+ * (no retry_after) - user_creation_failed — internal error creating account -
401
+ * send_failed — transport error (email / SMS) - internal_error — unexpected
402
+ * server error
391
403
  *
392
404
  * Response model (includes read-only fields).
393
405
  */
394
406
  interface OTPErrorResponse$1 {
395
- /** Error message */
407
+ /** Human-readable error message */
396
408
  error: string;
409
+ /** Machine-readable error code */
410
+ error_code?: string | null;
411
+ /** Seconds until the client may retry (present only for rate-limit errors) */
412
+ retry_after?: number | null;
397
413
  }
398
414
  /**
399
415
  * OTP verification response. When 2FA is required: - requires_2fa: True -
@@ -416,32 +432,6 @@ interface OTPVerifyResponse$1 {
416
432
  /** Whether user should be prompted to enable 2FA */
417
433
  should_prompt_2fa?: boolean;
418
434
  }
419
- /**
420
- * OTP request response.
421
- *
422
- * Response model (includes read-only fields).
423
- */
424
- interface OTPRequestResponse$1 {
425
- /** Success message */
426
- message: string;
427
- }
428
- /**
429
- * Serializer for OTP verification.
430
- *
431
- * Request model (no read-only fields).
432
- */
433
- interface OTPVerifyRequest$1 {
434
- /** Email address or phone number used for OTP request */
435
- identifier: string;
436
- otp: string;
437
- /** Delivery channel: 'email' or 'phone'. Auto-detected if not provided.
438
-
439
- * `email` - Email
440
- * `phone` - Phone */
441
- channel?: OTPRequestRequestChannel;
442
- /** Source URL for tracking login (e.g., https://my.djangocfg.com) */
443
- source_url?: string;
444
- }
445
435
  /**
446
436
  * Serializer for user details.
447
437
  *
@@ -499,7 +489,7 @@ declare class Accounts {
499
489
  private client;
500
490
  constructor(client: any);
501
491
  /**
502
- * Request OTP code to email or phone.
492
+ * Request OTP code to email.
503
493
  */
504
494
  otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
505
495
  /**
@@ -1135,14 +1125,36 @@ type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>;
1135
1125
  * Zod schema for OTPErrorResponse
1136
1126
  *
1137
1127
  * This schema provides runtime validation and type inference.
1138
- * * Error response for OTP operations.
1128
+ * * Typed error response for OTP operations.
1129
+
1130
+ error_code values:
1131
+ - invalid_identifier — malformed email
1132
+ - cooldown — too soon after last request (retry_after = seconds)
1133
+ - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
1134
+ - daily_limit — daily quota exceeded (retry_after = seconds until reset)
1135
+ - rate_limited — IP-level rate limit hit (no retry_after)
1136
+ - user_creation_failed — internal error creating account
1137
+ - send_failed — transport error (email / SMS)
1138
+ - internal_error — unexpected server error
1139
1139
  * */
1140
1140
 
1141
1141
  /**
1142
- * Error response for OTP operations.
1142
+ * Typed error response for OTP operations.
1143
+
1144
+ error_code values:
1145
+ - invalid_identifier — malformed email
1146
+ - cooldown — too soon after last request (retry_after = seconds)
1147
+ - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
1148
+ - daily_limit — daily quota exceeded (retry_after = seconds until reset)
1149
+ - rate_limited — IP-level rate limit hit (no retry_after)
1150
+ - user_creation_failed — internal error creating account
1151
+ - send_failed — transport error (email / SMS)
1152
+ - internal_error — unexpected server error
1143
1153
  */
1144
1154
  declare const OTPErrorResponseSchema: z.ZodObject<{
1145
1155
  error: z.ZodString;
1156
+ error_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1157
+ retry_after: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1146
1158
  }, z.core.$strip>;
1147
1159
  /**
1148
1160
  * Infer TypeScript type from Zod schema
@@ -1161,7 +1173,6 @@ type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>;
1161
1173
  */
1162
1174
  declare const OTPRequestRequestSchema: z.ZodObject<{
1163
1175
  identifier: z.ZodString;
1164
- channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
1165
1176
  source_url: z.ZodOptional<z.ZodString>;
1166
1177
  }, z.core.$strip>;
1167
1178
  /**
@@ -1200,7 +1211,6 @@ type OTPRequestResponse = z.infer<typeof OTPRequestResponseSchema>;
1200
1211
  declare const OTPVerifyRequestSchema: z.ZodObject<{
1201
1212
  identifier: z.ZodString;
1202
1213
  otp: z.ZodString;
1203
- channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
1204
1214
  source_url: z.ZodOptional<z.ZodString>;
1205
1215
  }, z.core.$strip>;
1206
1216
  /**
package/dist/index.d.ts CHANGED
@@ -40,35 +40,13 @@ declare class Auth {
40
40
  declare enum OAuthConnectionProvider {
41
41
  GITHUB = "github"
42
42
  }
43
- /**
44
- * Delivery channel: 'email' or 'phone'. Auto-detected if not provided.
45
- * * `email` - Email
46
- * * `phone` - Phone
47
- */
48
- declare enum OTPRequestRequestChannel {
49
- EMAIL = "email",
50
- PHONE = "phone"
51
- }
52
43
 
53
44
  type enums_OAuthConnectionProvider = OAuthConnectionProvider;
54
45
  declare const enums_OAuthConnectionProvider: typeof OAuthConnectionProvider;
55
- type enums_OTPRequestRequestChannel = OTPRequestRequestChannel;
56
- declare const enums_OTPRequestRequestChannel: typeof OTPRequestRequestChannel;
57
46
  declare namespace enums {
58
- export { enums_OAuthConnectionProvider as OAuthConnectionProvider, enums_OTPRequestRequestChannel as OTPRequestRequestChannel };
47
+ export { enums_OAuthConnectionProvider as OAuthConnectionProvider };
59
48
  }
60
49
 
61
- /**
62
- * Request to disconnect OAuth provider.
63
- *
64
- * Request model (no read-only fields).
65
- */
66
- interface OAuthDisconnectRequestRequest$1 {
67
- /** OAuth provider to disconnect
68
-
69
- * `github` - GitHub */
70
- provider: OAuthConnectionProvider;
71
- }
72
50
  /**
73
51
  * Response with OAuth authorization URL.
74
52
  *
@@ -81,15 +59,15 @@ interface OAuthAuthorizeResponse$1 {
81
59
  state: string;
82
60
  }
83
61
  /**
84
- * Request to start OAuth flow.
62
+ * Error response for OAuth endpoints.
85
63
  *
86
- * Request model (no read-only fields).
64
+ * Response model (includes read-only fields).
87
65
  */
88
- interface OAuthAuthorizeRequestRequest$1 {
89
- /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
90
- redirect_uri?: string;
91
- /** Optional source URL for registration tracking */
92
- source_url?: string;
66
+ interface OAuthError$1 {
67
+ /** Error code */
68
+ error: string;
69
+ /** Human-readable error description */
70
+ error_description?: string;
93
71
  }
94
72
  /**
95
73
  * Response with JWT tokens after OAuth authentication. When 2FA is required: -
@@ -118,13 +96,15 @@ interface OAuthTokenResponse$1 {
118
96
  should_prompt_2fa?: boolean;
119
97
  }
120
98
  /**
121
- * Response with available OAuth providers.
99
+ * Request to start OAuth flow.
122
100
  *
123
- * Response model (includes read-only fields).
101
+ * Request model (no read-only fields).
124
102
  */
125
- interface OAuthProvidersResponse$1 {
126
- /** List of available OAuth providers */
127
- providers: Array<Record<string, any>>;
103
+ interface OAuthAuthorizeRequestRequest$1 {
104
+ /** URL to redirect after OAuth authorization. If not provided, uses config's site_url + callback_path */
105
+ redirect_uri?: string;
106
+ /** Optional source URL for registration tracking */
107
+ source_url?: string;
128
108
  }
129
109
  /**
130
110
  * Request to complete OAuth flow (callback handler).
@@ -139,6 +119,26 @@ interface OAuthCallbackRequestRequest$1 {
139
119
  /** Same redirect_uri used in authorize request. If not provided, uses config's site_url + callback_path */
140
120
  redirect_uri?: string;
141
121
  }
122
+ /**
123
+ * Request to disconnect OAuth provider.
124
+ *
125
+ * Request model (no read-only fields).
126
+ */
127
+ interface OAuthDisconnectRequestRequest$1 {
128
+ /** OAuth provider to disconnect
129
+
130
+ * `github` - GitHub */
131
+ provider: OAuthConnectionProvider;
132
+ }
133
+ /**
134
+ * Response with available OAuth providers.
135
+ *
136
+ * Response model (includes read-only fields).
137
+ */
138
+ interface OAuthProvidersResponse$1 {
139
+ /** List of available OAuth providers */
140
+ providers: Array<Record<string, any>>;
141
+ }
142
142
  /**
143
143
  * Serializer for OAuth connection info (user-facing).
144
144
  *
@@ -162,17 +162,6 @@ interface OAuthConnection$1 {
162
162
  /** Last time this OAuth connection was used for login */
163
163
  last_login_at: string;
164
164
  }
165
- /**
166
- * Error response for OAuth endpoints.
167
- *
168
- * Response model (includes read-only fields).
169
- */
170
- interface OAuthError$1 {
171
- /** Error code */
172
- error: string;
173
- /** Human-readable error description */
174
- error_description?: string;
175
- }
176
165
 
177
166
  declare namespace models$2 {
178
167
  export type { OAuthAuthorizeRequestRequest$1 as OAuthAuthorizeRequestRequest, OAuthAuthorizeResponse$1 as OAuthAuthorizeResponse, OAuthCallbackRequestRequest$1 as OAuthCallbackRequestRequest, OAuthConnection$1 as OAuthConnection, OAuthDisconnectRequestRequest$1 as OAuthDisconnectRequestRequest, OAuthError$1 as OAuthError, OAuthProvidersResponse$1 as OAuthProvidersResponse, OAuthTokenResponse$1 as OAuthTokenResponse };
@@ -223,7 +212,7 @@ declare class Oauth {
223
212
  *
224
213
  * Request model (no read-only fields).
225
214
  */
226
- interface UserProfileUpdateRequest$1 {
215
+ interface PatchedUserProfileUpdateRequest$1 {
227
216
  first_name?: string;
228
217
  last_name?: string;
229
218
  company?: string;
@@ -239,6 +228,19 @@ interface CfgAccountsProfileAvatarCreateRequest$1 {
239
228
  /** Avatar image file (JPEG, PNG, GIF, WebP, max 5MB) */
240
229
  avatar: File | Blob;
241
230
  }
231
+ /**
232
+ * Serializer for updating user profile.
233
+ *
234
+ * Request model (no read-only fields).
235
+ */
236
+ interface UserProfileUpdateRequest$1 {
237
+ first_name?: string;
238
+ last_name?: string;
239
+ company?: string;
240
+ phone?: string;
241
+ position?: string;
242
+ language?: string;
243
+ }
242
244
  /**
243
245
  * Serializer for user details.
244
246
  *
@@ -269,19 +271,6 @@ interface User$2 {
269
271
  unanswered_messages_count: number;
270
272
  centrifugo: CentrifugoToken$2 | null;
271
273
  }
272
- /**
273
- * Serializer for updating user profile.
274
- *
275
- * Request model (no read-only fields).
276
- */
277
- interface PatchedUserProfileUpdateRequest$1 {
278
- first_name?: string;
279
- last_name?: string;
280
- company?: string;
281
- phone?: string;
282
- position?: string;
283
- language?: string;
284
- }
285
274
  /**
286
275
  * Response serializer for account deletion.
287
276
  *
@@ -376,24 +365,51 @@ declare class UserProfile {
376
365
  * Request model (no read-only fields).
377
366
  */
378
367
  interface OTPRequestRequest$1 {
379
- /** Email address or phone number for OTP delivery */
368
+ /** Email address for OTP delivery */
380
369
  identifier: string;
381
- /** Delivery channel: 'email' or 'phone'. Auto-detected if not provided.
382
-
383
- * `email` - Email
384
- * `phone` - Phone */
385
- channel?: OTPRequestRequestChannel;
386
370
  /** Source URL for tracking registration (e.g., https://my.djangocfg.com) */
387
371
  source_url?: string;
388
372
  }
389
373
  /**
390
- * Error response for OTP operations.
374
+ * Serializer for OTP verification.
375
+ *
376
+ * Request model (no read-only fields).
377
+ */
378
+ interface OTPVerifyRequest$1 {
379
+ /** Email address used for OTP request */
380
+ identifier: string;
381
+ otp: string;
382
+ /** Source URL for tracking login (e.g., https://my.djangocfg.com) */
383
+ source_url?: string;
384
+ }
385
+ /**
386
+ * OTP request response.
387
+ *
388
+ * Response model (includes read-only fields).
389
+ */
390
+ interface OTPRequestResponse$1 {
391
+ /** Success message */
392
+ message: string;
393
+ }
394
+ /**
395
+ * Typed error response for OTP operations. error_code values: -
396
+ * invalid_identifier — malformed email - cooldown — too soon after last
397
+ * request (retry_after = seconds) - hourly_limit — hourly quota exceeded
398
+ * (retry_after = seconds until reset) - daily_limit — daily quota exceeded
399
+ * (retry_after = seconds until reset) - rate_limited — IP-level rate limit hit
400
+ * (no retry_after) - user_creation_failed — internal error creating account -
401
+ * send_failed — transport error (email / SMS) - internal_error — unexpected
402
+ * server error
391
403
  *
392
404
  * Response model (includes read-only fields).
393
405
  */
394
406
  interface OTPErrorResponse$1 {
395
- /** Error message */
407
+ /** Human-readable error message */
396
408
  error: string;
409
+ /** Machine-readable error code */
410
+ error_code?: string | null;
411
+ /** Seconds until the client may retry (present only for rate-limit errors) */
412
+ retry_after?: number | null;
397
413
  }
398
414
  /**
399
415
  * OTP verification response. When 2FA is required: - requires_2fa: True -
@@ -416,32 +432,6 @@ interface OTPVerifyResponse$1 {
416
432
  /** Whether user should be prompted to enable 2FA */
417
433
  should_prompt_2fa?: boolean;
418
434
  }
419
- /**
420
- * OTP request response.
421
- *
422
- * Response model (includes read-only fields).
423
- */
424
- interface OTPRequestResponse$1 {
425
- /** Success message */
426
- message: string;
427
- }
428
- /**
429
- * Serializer for OTP verification.
430
- *
431
- * Request model (no read-only fields).
432
- */
433
- interface OTPVerifyRequest$1 {
434
- /** Email address or phone number used for OTP request */
435
- identifier: string;
436
- otp: string;
437
- /** Delivery channel: 'email' or 'phone'. Auto-detected if not provided.
438
-
439
- * `email` - Email
440
- * `phone` - Phone */
441
- channel?: OTPRequestRequestChannel;
442
- /** Source URL for tracking login (e.g., https://my.djangocfg.com) */
443
- source_url?: string;
444
- }
445
435
  /**
446
436
  * Serializer for user details.
447
437
  *
@@ -499,7 +489,7 @@ declare class Accounts {
499
489
  private client;
500
490
  constructor(client: any);
501
491
  /**
502
- * Request OTP code to email or phone.
492
+ * Request OTP code to email.
503
493
  */
504
494
  otpRequestCreate(data: OTPRequestRequest$1): Promise<OTPRequestResponse$1>;
505
495
  /**
@@ -1135,14 +1125,36 @@ type OAuthTokenResponse = z.infer<typeof OAuthTokenResponseSchema>;
1135
1125
  * Zod schema for OTPErrorResponse
1136
1126
  *
1137
1127
  * This schema provides runtime validation and type inference.
1138
- * * Error response for OTP operations.
1128
+ * * Typed error response for OTP operations.
1129
+
1130
+ error_code values:
1131
+ - invalid_identifier — malformed email
1132
+ - cooldown — too soon after last request (retry_after = seconds)
1133
+ - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
1134
+ - daily_limit — daily quota exceeded (retry_after = seconds until reset)
1135
+ - rate_limited — IP-level rate limit hit (no retry_after)
1136
+ - user_creation_failed — internal error creating account
1137
+ - send_failed — transport error (email / SMS)
1138
+ - internal_error — unexpected server error
1139
1139
  * */
1140
1140
 
1141
1141
  /**
1142
- * Error response for OTP operations.
1142
+ * Typed error response for OTP operations.
1143
+
1144
+ error_code values:
1145
+ - invalid_identifier — malformed email
1146
+ - cooldown — too soon after last request (retry_after = seconds)
1147
+ - hourly_limit — hourly quota exceeded (retry_after = seconds until reset)
1148
+ - daily_limit — daily quota exceeded (retry_after = seconds until reset)
1149
+ - rate_limited — IP-level rate limit hit (no retry_after)
1150
+ - user_creation_failed — internal error creating account
1151
+ - send_failed — transport error (email / SMS)
1152
+ - internal_error — unexpected server error
1143
1153
  */
1144
1154
  declare const OTPErrorResponseSchema: z.ZodObject<{
1145
1155
  error: z.ZodString;
1156
+ error_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1157
+ retry_after: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
1146
1158
  }, z.core.$strip>;
1147
1159
  /**
1148
1160
  * Infer TypeScript type from Zod schema
@@ -1161,7 +1173,6 @@ type OTPErrorResponse = z.infer<typeof OTPErrorResponseSchema>;
1161
1173
  */
1162
1174
  declare const OTPRequestRequestSchema: z.ZodObject<{
1163
1175
  identifier: z.ZodString;
1164
- channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
1165
1176
  source_url: z.ZodOptional<z.ZodString>;
1166
1177
  }, z.core.$strip>;
1167
1178
  /**
@@ -1200,7 +1211,6 @@ type OTPRequestResponse = z.infer<typeof OTPRequestResponseSchema>;
1200
1211
  declare const OTPVerifyRequestSchema: z.ZodObject<{
1201
1212
  identifier: z.ZodString;
1202
1213
  otp: z.ZodString;
1203
- channel: z.ZodOptional<z.ZodEnum<typeof OTPRequestRequestChannel>>;
1204
1214
  source_url: z.ZodOptional<z.ZodString>;
1205
1215
  }, z.core.$strip>;
1206
1216
  /**