@djangocfg/api 2.1.87 → 2.1.89

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 (59) hide show
  1. package/dist/auth-server.cjs +1963 -4
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.d.cts +35 -1
  4. package/dist/auth-server.d.ts +35 -1
  5. package/dist/auth-server.mjs +1953 -4
  6. package/dist/auth-server.mjs.map +1 -1
  7. package/dist/auth.cjs +692 -497
  8. package/dist/auth.cjs.map +1 -1
  9. package/dist/auth.d.cts +18 -2
  10. package/dist/auth.d.ts +18 -2
  11. package/dist/auth.mjs +655 -460
  12. package/dist/auth.mjs.map +1 -1
  13. package/dist/clients.cjs +460 -383
  14. package/dist/clients.cjs.map +1 -1
  15. package/dist/clients.d.cts +26 -6
  16. package/dist/clients.d.ts +26 -6
  17. package/dist/clients.mjs +460 -383
  18. package/dist/clients.mjs.map +1 -1
  19. package/dist/hooks.cjs +130 -105
  20. package/dist/hooks.cjs.map +1 -1
  21. package/dist/hooks.d.cts +24 -4
  22. package/dist/hooks.d.ts +24 -4
  23. package/dist/hooks.mjs +130 -105
  24. package/dist/hooks.mjs.map +1 -1
  25. package/dist/index.cjs +373 -311
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +54 -8
  28. package/dist/index.d.ts +54 -8
  29. package/dist/index.mjs +373 -311
  30. package/dist/index.mjs.map +1 -1
  31. package/package.json +3 -3
  32. package/src/auth/context/AccountsContext.tsx +3 -3
  33. package/src/auth/context/AuthContext.tsx +56 -10
  34. package/src/auth/hooks/index.ts +3 -0
  35. package/src/auth/hooks/useProfileCache.ts +1 -1
  36. package/src/auth/hooks/useTokenRefresh.ts +161 -0
  37. package/src/auth/middlewares/index.ts +8 -1
  38. package/src/auth/middlewares/tokenRefresh.ts +158 -0
  39. package/src/generated/cfg_accounts/CLAUDE.md +2 -9
  40. package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +2 -1
  41. package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +2 -1
  42. package/src/generated/cfg_accounts/_utils/schemas/CfgAccountsProfileAvatarCreateRequest.schema.ts +15 -0
  43. package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -0
  44. package/src/generated/cfg_accounts/accounts/models.ts +0 -1
  45. package/src/generated/cfg_accounts/accounts__user_profile/client.ts +4 -2
  46. package/src/generated/cfg_accounts/accounts__user_profile/models.ts +9 -1
  47. package/src/generated/cfg_accounts/client.ts +18 -0
  48. package/src/generated/cfg_accounts/index.ts +3 -1
  49. package/src/generated/cfg_accounts/schema.json +2 -2
  50. package/src/generated/cfg_centrifugo/CLAUDE.md +1 -8
  51. package/src/generated/cfg_centrifugo/client.ts +18 -0
  52. package/src/generated/cfg_centrifugo/index.ts +3 -1
  53. package/src/generated/cfg_totp/CLAUDE.md +1 -8
  54. package/src/generated/cfg_totp/client.ts +18 -0
  55. package/src/generated/cfg_totp/index.ts +3 -1
  56. package/src/generated/cfg_totp/totp/models.ts +2 -0
  57. package/src/generated/cfg_webpush/CLAUDE.md +1 -8
  58. package/src/generated/cfg_webpush/client.ts +18 -0
  59. package/src/generated/cfg_webpush/index.ts +3 -1
package/dist/auth.cjs CHANGED
@@ -59,6 +59,7 @@ __export(auth_exports, {
59
59
  useGithubAuth: () => useGithubAuth,
60
60
  useLocalStorage: () => useLocalStorage2,
61
61
  useSessionStorage: () => useSessionStorage,
62
+ useTokenRefresh: () => useTokenRefresh,
62
63
  useTwoFactor: () => useTwoFactor,
63
64
  useTwoFactorSetup: () => useTwoFactorSetup,
64
65
  useTwoFactorStatus: () => useTwoFactorStatus,
@@ -69,7 +70,7 @@ module.exports = __toCommonJS(auth_exports);
69
70
 
70
71
  // src/auth/context/AuthContext.tsx
71
72
  var import_navigation = require("next/navigation");
72
- var import_react3 = require("react");
73
+ var import_react4 = require("react");
73
74
  var import_hooks2 = require("@djangocfg/ui-nextjs/hooks");
74
75
 
75
76
  // src/generated/cfg_accounts/accounts__auth/client.ts
@@ -170,7 +171,9 @@ var UserProfile = class {
170
171
  * multipart/form-data with 'avatar' field.
171
172
  */
172
173
  async accountsProfileAvatarCreate(data) {
173
- const response = await this.client.request("POST", "/cfg/accounts/profile/avatar/", { formData: data });
174
+ const formData = new FormData();
175
+ formData.append("avatar", data.avatar);
176
+ const response = await this.client.request("POST", "/cfg/accounts/profile/avatar/", { formData });
174
177
  return response;
175
178
  }
176
179
  /**
@@ -606,8 +609,10 @@ var APIClient = class {
606
609
  constructor(baseUrl, options) {
607
610
  this.logger = null;
608
611
  this.retryConfig = null;
612
+ this.tokenGetter = null;
609
613
  this.baseUrl = baseUrl.replace(/\/$/, "");
610
614
  this.httpClient = options?.httpClient || new FetchAdapter();
615
+ this.tokenGetter = options?.tokenGetter || null;
611
616
  if (options?.loggerConfig !== void 0) {
612
617
  this.logger = new APILogger(options.loggerConfig);
613
618
  }
@@ -636,6 +641,19 @@ var APIClient = class {
636
641
  }
637
642
  return null;
638
643
  }
644
+ /**
645
+ * Get the base URL for building streaming/download URLs.
646
+ */
647
+ getBaseUrl() {
648
+ return this.baseUrl;
649
+ }
650
+ /**
651
+ * Get JWT token for URL authentication (used in streaming endpoints).
652
+ * Returns null if no token getter is configured or no token is available.
653
+ */
654
+ getToken() {
655
+ return this.tokenGetter ? this.tokenGetter() : null;
656
+ }
639
657
  /**
640
658
  * Make HTTP request with Django CSRF and session handling.
641
659
  * Automatically retries on network errors and 5xx server errors.
@@ -883,168 +901,174 @@ var CentrifugoTokenSchema = import_zod.z.object({
883
901
  channels: import_zod.z.array(import_zod.z.string())
884
902
  });
885
903
 
886
- // src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts
904
+ // src/generated/cfg_accounts/_utils/schemas/CfgAccountsProfileAvatarCreateRequest.schema.ts
887
905
  var import_zod2 = require("zod");
888
- var OAuthAuthorizeRequestRequestSchema = import_zod2.z.object({
889
- redirect_uri: import_zod2.z.union([import_zod2.z.url(), import_zod2.z.literal("")]).optional(),
890
- source_url: import_zod2.z.union([import_zod2.z.url(), import_zod2.z.literal("")]).optional()
906
+ var CfgAccountsProfileAvatarCreateRequestSchema = import_zod2.z.object({
907
+ avatar: import_zod2.z.union([import_zod2.z.instanceof(File), import_zod2.z.instanceof(Blob)])
891
908
  });
892
909
 
893
- // src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts
910
+ // src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeRequestRequest.schema.ts
894
911
  var import_zod3 = require("zod");
895
- var OAuthAuthorizeResponseSchema = import_zod3.z.object({
896
- authorization_url: import_zod3.z.union([import_zod3.z.url(), import_zod3.z.literal("")]),
897
- state: import_zod3.z.string()
912
+ var OAuthAuthorizeRequestRequestSchema = import_zod3.z.object({
913
+ redirect_uri: import_zod3.z.union([import_zod3.z.url(), import_zod3.z.literal("")]).optional(),
914
+ source_url: import_zod3.z.union([import_zod3.z.url(), import_zod3.z.literal("")]).optional()
898
915
  });
899
916
 
900
- // src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts
917
+ // src/generated/cfg_accounts/_utils/schemas/OAuthAuthorizeResponse.schema.ts
901
918
  var import_zod4 = require("zod");
902
- var OAuthCallbackRequestRequestSchema = import_zod4.z.object({
903
- code: import_zod4.z.string().min(10).max(500),
904
- state: import_zod4.z.string().min(20).max(100),
905
- redirect_uri: import_zod4.z.union([import_zod4.z.url(), import_zod4.z.literal("")]).optional()
919
+ var OAuthAuthorizeResponseSchema = import_zod4.z.object({
920
+ authorization_url: import_zod4.z.union([import_zod4.z.url(), import_zod4.z.literal("")]),
921
+ state: import_zod4.z.string()
906
922
  });
907
923
 
908
- // src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts
924
+ // src/generated/cfg_accounts/_utils/schemas/OAuthCallbackRequestRequest.schema.ts
909
925
  var import_zod5 = require("zod");
910
- var OAuthConnectionSchema = import_zod5.z.object({
911
- id: import_zod5.z.int(),
912
- provider: import_zod5.z.nativeEnum(OAuthConnectionProvider),
913
- provider_display: import_zod5.z.string(),
914
- provider_username: import_zod5.z.string(),
915
- provider_email: import_zod5.z.email(),
916
- provider_avatar_url: import_zod5.z.union([import_zod5.z.url(), import_zod5.z.literal("")]),
917
- connected_at: import_zod5.z.iso.datetime(),
918
- last_login_at: import_zod5.z.iso.datetime()
926
+ var OAuthCallbackRequestRequestSchema = import_zod5.z.object({
927
+ code: import_zod5.z.string().min(10).max(500),
928
+ state: import_zod5.z.string().min(20).max(100),
929
+ redirect_uri: import_zod5.z.union([import_zod5.z.url(), import_zod5.z.literal("")]).optional()
919
930
  });
920
931
 
921
- // src/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts
932
+ // src/generated/cfg_accounts/_utils/schemas/OAuthConnection.schema.ts
922
933
  var import_zod6 = require("zod");
923
- var OAuthDisconnectRequestRequestSchema = import_zod6.z.object({
924
- provider: import_zod6.z.nativeEnum(OAuthDisconnectRequestRequestProvider)
934
+ var OAuthConnectionSchema = import_zod6.z.object({
935
+ id: import_zod6.z.int(),
936
+ provider: import_zod6.z.nativeEnum(OAuthConnectionProvider),
937
+ provider_display: import_zod6.z.string(),
938
+ provider_username: import_zod6.z.string(),
939
+ provider_email: import_zod6.z.email(),
940
+ provider_avatar_url: import_zod6.z.union([import_zod6.z.url(), import_zod6.z.literal("")]),
941
+ connected_at: import_zod6.z.iso.datetime(),
942
+ last_login_at: import_zod6.z.iso.datetime()
925
943
  });
926
944
 
927
- // src/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts
945
+ // src/generated/cfg_accounts/_utils/schemas/OAuthDisconnectRequestRequest.schema.ts
928
946
  var import_zod7 = require("zod");
929
- var OAuthErrorSchema = import_zod7.z.object({
930
- error: import_zod7.z.string(),
931
- error_description: import_zod7.z.string().optional()
947
+ var OAuthDisconnectRequestRequestSchema = import_zod7.z.object({
948
+ provider: import_zod7.z.nativeEnum(OAuthDisconnectRequestRequestProvider)
932
949
  });
933
950
 
934
- // src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts
951
+ // src/generated/cfg_accounts/_utils/schemas/OAuthError.schema.ts
935
952
  var import_zod8 = require("zod");
936
- var OAuthProvidersResponseSchema = import_zod8.z.object({
937
- providers: import_zod8.z.array(import_zod8.z.record(import_zod8.z.string(), import_zod8.z.any()))
953
+ var OAuthErrorSchema = import_zod8.z.object({
954
+ error: import_zod8.z.string(),
955
+ error_description: import_zod8.z.string().optional()
938
956
  });
939
957
 
940
- // src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts
958
+ // src/generated/cfg_accounts/_utils/schemas/OAuthProvidersResponse.schema.ts
941
959
  var import_zod9 = require("zod");
942
- var OAuthTokenResponseSchema = import_zod9.z.object({
943
- requires_2fa: import_zod9.z.boolean().optional(),
944
- session_id: import_zod9.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
945
- access: import_zod9.z.string().nullable().optional(),
946
- refresh: import_zod9.z.string().nullable().optional(),
947
- user: import_zod9.z.record(import_zod9.z.string(), import_zod9.z.any()).nullable().optional(),
948
- is_new_user: import_zod9.z.boolean(),
949
- is_new_connection: import_zod9.z.boolean(),
950
- should_prompt_2fa: import_zod9.z.boolean().optional()
960
+ var OAuthProvidersResponseSchema = import_zod9.z.object({
961
+ providers: import_zod9.z.array(import_zod9.z.record(import_zod9.z.string(), import_zod9.z.any()))
951
962
  });
952
963
 
953
- // src/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts
964
+ // src/generated/cfg_accounts/_utils/schemas/OAuthTokenResponse.schema.ts
954
965
  var import_zod10 = require("zod");
955
- var OTPErrorResponseSchema = import_zod10.z.object({
956
- error: import_zod10.z.string()
966
+ var OAuthTokenResponseSchema = import_zod10.z.object({
967
+ requires_2fa: import_zod10.z.boolean().optional(),
968
+ session_id: import_zod10.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
969
+ access: import_zod10.z.string().nullable().optional(),
970
+ refresh: import_zod10.z.string().nullable().optional(),
971
+ user: import_zod10.z.record(import_zod10.z.string(), import_zod10.z.any()).nullable().optional(),
972
+ is_new_user: import_zod10.z.boolean(),
973
+ is_new_connection: import_zod10.z.boolean(),
974
+ should_prompt_2fa: import_zod10.z.boolean().optional()
957
975
  });
958
976
 
959
- // src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts
977
+ // src/generated/cfg_accounts/_utils/schemas/OTPErrorResponse.schema.ts
960
978
  var import_zod11 = require("zod");
961
- var OTPRequestRequestSchema = import_zod11.z.object({
962
- identifier: import_zod11.z.string().min(1),
963
- channel: import_zod11.z.nativeEnum(OTPRequestRequestChannel).optional(),
964
- source_url: import_zod11.z.union([import_zod11.z.url(), import_zod11.z.literal("")]).optional()
979
+ var OTPErrorResponseSchema = import_zod11.z.object({
980
+ error: import_zod11.z.string()
965
981
  });
966
982
 
967
- // src/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts
983
+ // src/generated/cfg_accounts/_utils/schemas/OTPRequestRequest.schema.ts
968
984
  var import_zod12 = require("zod");
969
- var OTPRequestResponseSchema = import_zod12.z.object({
970
- message: import_zod12.z.string()
985
+ var OTPRequestRequestSchema = import_zod12.z.object({
986
+ identifier: import_zod12.z.string().min(1),
987
+ channel: import_zod12.z.nativeEnum(OTPRequestRequestChannel).optional(),
988
+ source_url: import_zod12.z.union([import_zod12.z.url(), import_zod12.z.literal("")]).optional()
971
989
  });
972
990
 
973
- // src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts
991
+ // src/generated/cfg_accounts/_utils/schemas/OTPRequestResponse.schema.ts
974
992
  var import_zod13 = require("zod");
975
- var OTPVerifyRequestSchema = import_zod13.z.object({
976
- identifier: import_zod13.z.string().min(1),
977
- otp: import_zod13.z.string().min(6).max(6),
978
- channel: import_zod13.z.nativeEnum(OTPVerifyRequestChannel).optional(),
979
- source_url: import_zod13.z.union([import_zod13.z.url(), import_zod13.z.literal("")]).optional()
993
+ var OTPRequestResponseSchema = import_zod13.z.object({
994
+ message: import_zod13.z.string()
995
+ });
996
+
997
+ // src/generated/cfg_accounts/_utils/schemas/OTPVerifyRequest.schema.ts
998
+ var import_zod14 = require("zod");
999
+ var OTPVerifyRequestSchema = import_zod14.z.object({
1000
+ identifier: import_zod14.z.string().min(1),
1001
+ otp: import_zod14.z.string().min(6).max(6),
1002
+ channel: import_zod14.z.nativeEnum(OTPVerifyRequestChannel).optional(),
1003
+ source_url: import_zod14.z.union([import_zod14.z.url(), import_zod14.z.literal("")]).optional()
980
1004
  });
981
1005
 
982
1006
  // src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts
983
- var import_zod15 = require("zod");
1007
+ var import_zod16 = require("zod");
984
1008
 
985
1009
  // src/generated/cfg_accounts/_utils/schemas/User.schema.ts
986
- var import_zod14 = require("zod");
987
- var UserSchema = import_zod14.z.object({
988
- id: import_zod14.z.int(),
989
- email: import_zod14.z.email(),
990
- first_name: import_zod14.z.string().max(50).optional(),
991
- last_name: import_zod14.z.string().max(50).optional(),
992
- full_name: import_zod14.z.string(),
993
- initials: import_zod14.z.string(),
994
- display_username: import_zod14.z.string(),
995
- company: import_zod14.z.string().max(100).optional(),
996
- phone: import_zod14.z.string().max(20).optional(),
997
- position: import_zod14.z.string().max(100).optional(),
998
- avatar: import_zod14.z.union([import_zod14.z.url(), import_zod14.z.literal("")]).nullable(),
999
- is_staff: import_zod14.z.boolean(),
1000
- is_superuser: import_zod14.z.boolean(),
1001
- date_joined: import_zod14.z.iso.datetime(),
1002
- last_login: import_zod14.z.iso.datetime().nullable(),
1003
- unanswered_messages_count: import_zod14.z.int(),
1010
+ var import_zod15 = require("zod");
1011
+ var UserSchema = import_zod15.z.object({
1012
+ id: import_zod15.z.int(),
1013
+ email: import_zod15.z.email(),
1014
+ first_name: import_zod15.z.string().max(50).optional(),
1015
+ last_name: import_zod15.z.string().max(50).optional(),
1016
+ full_name: import_zod15.z.string(),
1017
+ initials: import_zod15.z.string(),
1018
+ display_username: import_zod15.z.string(),
1019
+ company: import_zod15.z.string().max(100).optional(),
1020
+ phone: import_zod15.z.string().max(20).optional(),
1021
+ position: import_zod15.z.string().max(100).optional(),
1022
+ avatar: import_zod15.z.union([import_zod15.z.url(), import_zod15.z.literal("")]).nullable(),
1023
+ is_staff: import_zod15.z.boolean(),
1024
+ is_superuser: import_zod15.z.boolean(),
1025
+ date_joined: import_zod15.z.iso.datetime(),
1026
+ last_login: import_zod15.z.iso.datetime().nullable(),
1027
+ unanswered_messages_count: import_zod15.z.int(),
1004
1028
  centrifugo: CentrifugoTokenSchema.nullable()
1005
1029
  });
1006
1030
 
1007
1031
  // src/generated/cfg_accounts/_utils/schemas/OTPVerifyResponse.schema.ts
1008
- var OTPVerifyResponseSchema = import_zod15.z.object({
1009
- requires_2fa: import_zod15.z.boolean().optional(),
1010
- session_id: import_zod15.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
1011
- refresh: import_zod15.z.string().nullable().optional(),
1012
- access: import_zod15.z.string().nullable().optional(),
1032
+ var OTPVerifyResponseSchema = import_zod16.z.object({
1033
+ requires_2fa: import_zod16.z.boolean().optional(),
1034
+ session_id: import_zod16.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i).nullable().optional(),
1035
+ refresh: import_zod16.z.string().nullable().optional(),
1036
+ access: import_zod16.z.string().nullable().optional(),
1013
1037
  user: UserSchema.nullable().optional(),
1014
- should_prompt_2fa: import_zod15.z.boolean().optional()
1038
+ should_prompt_2fa: import_zod16.z.boolean().optional()
1015
1039
  });
1016
1040
 
1017
1041
  // src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts
1018
- var import_zod16 = require("zod");
1019
- var PatchedUserProfileUpdateRequestSchema = import_zod16.z.object({
1020
- first_name: import_zod16.z.string().max(50).optional(),
1021
- last_name: import_zod16.z.string().max(50).optional(),
1022
- company: import_zod16.z.string().max(100).optional(),
1023
- phone: import_zod16.z.string().max(20).optional(),
1024
- position: import_zod16.z.string().max(100).optional()
1042
+ var import_zod17 = require("zod");
1043
+ var PatchedUserProfileUpdateRequestSchema = import_zod17.z.object({
1044
+ first_name: import_zod17.z.string().max(50).optional(),
1045
+ last_name: import_zod17.z.string().max(50).optional(),
1046
+ company: import_zod17.z.string().max(100).optional(),
1047
+ phone: import_zod17.z.string().max(20).optional(),
1048
+ position: import_zod17.z.string().max(100).optional()
1025
1049
  });
1026
1050
 
1027
1051
  // src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
1028
- var import_zod17 = require("zod");
1029
- var TokenRefreshSchema = import_zod17.z.object({
1030
- access: import_zod17.z.string(),
1031
- refresh: import_zod17.z.string()
1052
+ var import_zod18 = require("zod");
1053
+ var TokenRefreshSchema = import_zod18.z.object({
1054
+ access: import_zod18.z.string(),
1055
+ refresh: import_zod18.z.string()
1032
1056
  });
1033
1057
 
1034
1058
  // src/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts
1035
- var import_zod18 = require("zod");
1036
- var TokenRefreshRequestSchema = import_zod18.z.object({
1037
- refresh: import_zod18.z.string().min(1)
1059
+ var import_zod19 = require("zod");
1060
+ var TokenRefreshRequestSchema = import_zod19.z.object({
1061
+ refresh: import_zod19.z.string().min(1)
1038
1062
  });
1039
1063
 
1040
1064
  // src/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts
1041
- var import_zod19 = require("zod");
1042
- var UserProfileUpdateRequestSchema = import_zod19.z.object({
1043
- first_name: import_zod19.z.string().max(50).optional(),
1044
- last_name: import_zod19.z.string().max(50).optional(),
1045
- company: import_zod19.z.string().max(100).optional(),
1046
- phone: import_zod19.z.string().max(20).optional(),
1047
- position: import_zod19.z.string().max(100).optional()
1065
+ var import_zod20 = require("zod");
1066
+ var UserProfileUpdateRequestSchema = import_zod20.z.object({
1067
+ first_name: import_zod20.z.string().max(50).optional(),
1068
+ last_name: import_zod20.z.string().max(50).optional(),
1069
+ company: import_zod20.z.string().max(100).optional(),
1070
+ phone: import_zod20.z.string().max(20).optional(),
1071
+ position: import_zod20.z.string().max(100).optional()
1048
1072
  });
1049
1073
 
1050
1074
  // src/generated/cfg_accounts/_utils/fetchers/accounts.ts
@@ -1401,7 +1425,8 @@ var API = class {
1401
1425
  this._loadTokensFromStorage();
1402
1426
  this._client = new APIClient(this.baseUrl, {
1403
1427
  retryConfig: this.options?.retryConfig,
1404
- loggerConfig: this.options?.loggerConfig
1428
+ loggerConfig: this.options?.loggerConfig,
1429
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
1405
1430
  });
1406
1431
  this._injectAuthHeader();
1407
1432
  this.auth = this._client.auth;
@@ -1419,7 +1444,8 @@ var API = class {
1419
1444
  _reinitClients() {
1420
1445
  this._client = new APIClient(this.baseUrl, {
1421
1446
  retryConfig: this.options?.retryConfig,
1422
- loggerConfig: this.options?.loggerConfig
1447
+ loggerConfig: this.options?.loggerConfig,
1448
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
1423
1449
  });
1424
1450
  this._injectAuthHeader();
1425
1451
  this.auth = this._client.auth;
@@ -2090,8 +2116,10 @@ var APIClient2 = class {
2090
2116
  constructor(baseUrl, options) {
2091
2117
  this.logger = null;
2092
2118
  this.retryConfig = null;
2119
+ this.tokenGetter = null;
2093
2120
  this.baseUrl = baseUrl.replace(/\/$/, "");
2094
2121
  this.httpClient = options?.httpClient || new FetchAdapter2();
2122
+ this.tokenGetter = options?.tokenGetter || null;
2095
2123
  if (options?.loggerConfig !== void 0) {
2096
2124
  this.logger = new APILogger2(options.loggerConfig);
2097
2125
  }
@@ -2120,6 +2148,19 @@ var APIClient2 = class {
2120
2148
  }
2121
2149
  return null;
2122
2150
  }
2151
+ /**
2152
+ * Get the base URL for building streaming/download URLs.
2153
+ */
2154
+ getBaseUrl() {
2155
+ return this.baseUrl;
2156
+ }
2157
+ /**
2158
+ * Get JWT token for URL authentication (used in streaming endpoints).
2159
+ * Returns null if no token getter is configured or no token is available.
2160
+ */
2161
+ getToken() {
2162
+ return this.tokenGetter ? this.tokenGetter() : null;
2163
+ }
2123
2164
  /**
2124
2165
  * Make HTTP request with Django CSRF and session handling.
2125
2166
  * Automatically retries on network errors and 5xx server errors.
@@ -2332,320 +2373,320 @@ var LocalStorageAdapter2 = class {
2332
2373
  };
2333
2374
 
2334
2375
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelInfo.schema.ts
2335
- var import_zod20 = require("zod");
2336
- var CentrifugoChannelInfoSchema = import_zod20.z.object({
2337
- num_clients: import_zod20.z.int()
2376
+ var import_zod21 = require("zod");
2377
+ var CentrifugoChannelInfoSchema = import_zod21.z.object({
2378
+ num_clients: import_zod21.z.int()
2338
2379
  });
2339
2380
 
2340
2381
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsRequestRequest.schema.ts
2341
- var import_zod21 = require("zod");
2342
- var CentrifugoChannelsRequestRequestSchema = import_zod21.z.object({
2343
- pattern: import_zod21.z.string().nullable().optional()
2382
+ var import_zod22 = require("zod");
2383
+ var CentrifugoChannelsRequestRequestSchema = import_zod22.z.object({
2384
+ pattern: import_zod22.z.string().nullable().optional()
2344
2385
  });
2345
2386
 
2346
2387
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts
2347
- var import_zod24 = require("zod");
2388
+ var import_zod25 = require("zod");
2348
2389
 
2349
2390
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResult.schema.ts
2350
- var import_zod22 = require("zod");
2351
- var CentrifugoChannelsResultSchema = import_zod22.z.object({
2352
- channels: import_zod22.z.record(import_zod22.z.string(), CentrifugoChannelInfoSchema)
2391
+ var import_zod23 = require("zod");
2392
+ var CentrifugoChannelsResultSchema = import_zod23.z.object({
2393
+ channels: import_zod23.z.record(import_zod23.z.string(), CentrifugoChannelInfoSchema)
2353
2394
  });
2354
2395
 
2355
2396
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoError.schema.ts
2356
- var import_zod23 = require("zod");
2357
- var CentrifugoErrorSchema = import_zod23.z.object({
2358
- code: import_zod23.z.int().optional(),
2359
- message: import_zod23.z.string().optional()
2397
+ var import_zod24 = require("zod");
2398
+ var CentrifugoErrorSchema = import_zod24.z.object({
2399
+ code: import_zod24.z.int().optional(),
2400
+ message: import_zod24.z.string().optional()
2360
2401
  });
2361
2402
 
2362
2403
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoChannelsResponse.schema.ts
2363
- var CentrifugoChannelsResponseSchema = import_zod24.z.object({
2404
+ var CentrifugoChannelsResponseSchema = import_zod25.z.object({
2364
2405
  error: CentrifugoErrorSchema.optional(),
2365
2406
  result: CentrifugoChannelsResultSchema.optional()
2366
2407
  });
2367
2408
 
2368
2409
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoClientInfo.schema.ts
2369
- var import_zod25 = require("zod");
2370
- var CentrifugoClientInfoSchema = import_zod25.z.object({
2371
- user: import_zod25.z.string(),
2372
- client: import_zod25.z.string(),
2373
- conn_info: import_zod25.z.record(import_zod25.z.string(), import_zod25.z.any()).nullable().optional(),
2374
- chan_info: import_zod25.z.record(import_zod25.z.string(), import_zod25.z.any()).nullable().optional()
2410
+ var import_zod26 = require("zod");
2411
+ var CentrifugoClientInfoSchema = import_zod26.z.object({
2412
+ user: import_zod26.z.string(),
2413
+ client: import_zod26.z.string(),
2414
+ conn_info: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).nullable().optional(),
2415
+ chan_info: import_zod26.z.record(import_zod26.z.string(), import_zod26.z.any()).nullable().optional()
2375
2416
  });
2376
2417
 
2377
2418
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHealthCheck.schema.ts
2378
- var import_zod26 = require("zod");
2379
- var CentrifugoHealthCheckSchema = import_zod26.z.object({
2380
- status: import_zod26.z.string(),
2381
- wrapper_url: import_zod26.z.string(),
2382
- has_api_key: import_zod26.z.boolean(),
2383
- timestamp: import_zod26.z.string()
2419
+ var import_zod27 = require("zod");
2420
+ var CentrifugoHealthCheckSchema = import_zod27.z.object({
2421
+ status: import_zod27.z.string(),
2422
+ wrapper_url: import_zod27.z.string(),
2423
+ has_api_key: import_zod27.z.boolean(),
2424
+ timestamp: import_zod27.z.string()
2384
2425
  });
2385
2426
 
2386
2427
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts
2387
- var import_zod28 = require("zod");
2428
+ var import_zod29 = require("zod");
2388
2429
 
2389
2430
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoStreamPosition.schema.ts
2390
- var import_zod27 = require("zod");
2391
- var CentrifugoStreamPositionSchema = import_zod27.z.object({
2392
- offset: import_zod27.z.int(),
2393
- epoch: import_zod27.z.string()
2431
+ var import_zod28 = require("zod");
2432
+ var CentrifugoStreamPositionSchema = import_zod28.z.object({
2433
+ offset: import_zod28.z.int(),
2434
+ epoch: import_zod28.z.string()
2394
2435
  });
2395
2436
 
2396
2437
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryRequestRequest.schema.ts
2397
- var CentrifugoHistoryRequestRequestSchema = import_zod28.z.object({
2398
- channel: import_zod28.z.string(),
2399
- limit: import_zod28.z.int().nullable().optional(),
2438
+ var CentrifugoHistoryRequestRequestSchema = import_zod29.z.object({
2439
+ channel: import_zod29.z.string(),
2440
+ limit: import_zod29.z.int().nullable().optional(),
2400
2441
  since: CentrifugoStreamPositionSchema.optional(),
2401
- reverse: import_zod28.z.boolean().nullable().optional()
2442
+ reverse: import_zod29.z.boolean().nullable().optional()
2402
2443
  });
2403
2444
 
2404
2445
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts
2405
- var import_zod31 = require("zod");
2446
+ var import_zod32 = require("zod");
2406
2447
 
2407
2448
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts
2408
- var import_zod30 = require("zod");
2449
+ var import_zod31 = require("zod");
2409
2450
 
2410
2451
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPublication.schema.ts
2411
- var import_zod29 = require("zod");
2412
- var CentrifugoPublicationSchema = import_zod29.z.object({
2413
- data: import_zod29.z.record(import_zod29.z.string(), import_zod29.z.any()),
2452
+ var import_zod30 = require("zod");
2453
+ var CentrifugoPublicationSchema = import_zod30.z.object({
2454
+ data: import_zod30.z.record(import_zod30.z.string(), import_zod30.z.any()),
2414
2455
  info: CentrifugoClientInfoSchema.optional(),
2415
- offset: import_zod29.z.int(),
2416
- tags: import_zod29.z.record(import_zod29.z.string(), import_zod29.z.any()).nullable().optional()
2456
+ offset: import_zod30.z.int(),
2457
+ tags: import_zod30.z.record(import_zod30.z.string(), import_zod30.z.any()).nullable().optional()
2417
2458
  });
2418
2459
 
2419
2460
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResult.schema.ts
2420
- var CentrifugoHistoryResultSchema = import_zod30.z.object({
2421
- publications: import_zod30.z.array(CentrifugoPublicationSchema),
2422
- epoch: import_zod30.z.string(),
2423
- offset: import_zod30.z.int()
2461
+ var CentrifugoHistoryResultSchema = import_zod31.z.object({
2462
+ publications: import_zod31.z.array(CentrifugoPublicationSchema),
2463
+ epoch: import_zod31.z.string(),
2464
+ offset: import_zod31.z.int()
2424
2465
  });
2425
2466
 
2426
2467
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoHistoryResponse.schema.ts
2427
- var CentrifugoHistoryResponseSchema = import_zod31.z.object({
2468
+ var CentrifugoHistoryResponseSchema = import_zod32.z.object({
2428
2469
  error: CentrifugoErrorSchema.optional(),
2429
2470
  result: CentrifugoHistoryResultSchema.optional()
2430
2471
  });
2431
2472
 
2432
2473
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts
2433
- var import_zod36 = require("zod");
2474
+ var import_zod37 = require("zod");
2434
2475
 
2435
2476
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts
2436
- var import_zod35 = require("zod");
2477
+ var import_zod36 = require("zod");
2437
2478
 
2438
2479
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts
2439
- var import_zod34 = require("zod");
2480
+ var import_zod35 = require("zod");
2440
2481
 
2441
2482
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoMetrics.schema.ts
2442
- var import_zod32 = require("zod");
2443
- var CentrifugoMetricsSchema = import_zod32.z.object({
2444
- interval: import_zod32.z.number(),
2445
- items: import_zod32.z.record(import_zod32.z.string(), import_zod32.z.number())
2483
+ var import_zod33 = require("zod");
2484
+ var CentrifugoMetricsSchema = import_zod33.z.object({
2485
+ interval: import_zod33.z.number(),
2486
+ items: import_zod33.z.record(import_zod33.z.string(), import_zod33.z.number())
2446
2487
  });
2447
2488
 
2448
2489
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoProcess.schema.ts
2449
- var import_zod33 = require("zod");
2450
- var CentrifugoProcessSchema = import_zod33.z.object({
2451
- cpu: import_zod33.z.number(),
2452
- rss: import_zod33.z.int()
2490
+ var import_zod34 = require("zod");
2491
+ var CentrifugoProcessSchema = import_zod34.z.object({
2492
+ cpu: import_zod34.z.number(),
2493
+ rss: import_zod34.z.int()
2453
2494
  });
2454
2495
 
2455
2496
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoNodeInfo.schema.ts
2456
- var CentrifugoNodeInfoSchema = import_zod34.z.object({
2457
- uid: import_zod34.z.string(),
2458
- name: import_zod34.z.string(),
2459
- version: import_zod34.z.string(),
2460
- num_clients: import_zod34.z.int(),
2461
- num_users: import_zod34.z.int(),
2462
- num_channels: import_zod34.z.int(),
2463
- uptime: import_zod34.z.int(),
2464
- num_subs: import_zod34.z.int(),
2497
+ var CentrifugoNodeInfoSchema = import_zod35.z.object({
2498
+ uid: import_zod35.z.string(),
2499
+ name: import_zod35.z.string(),
2500
+ version: import_zod35.z.string(),
2501
+ num_clients: import_zod35.z.int(),
2502
+ num_users: import_zod35.z.int(),
2503
+ num_channels: import_zod35.z.int(),
2504
+ uptime: import_zod35.z.int(),
2505
+ num_subs: import_zod35.z.int(),
2465
2506
  metrics: CentrifugoMetricsSchema.optional(),
2466
2507
  process: CentrifugoProcessSchema.optional()
2467
2508
  });
2468
2509
 
2469
2510
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResult.schema.ts
2470
- var CentrifugoInfoResultSchema = import_zod35.z.object({
2471
- nodes: import_zod35.z.array(CentrifugoNodeInfoSchema)
2511
+ var CentrifugoInfoResultSchema = import_zod36.z.object({
2512
+ nodes: import_zod36.z.array(CentrifugoNodeInfoSchema)
2472
2513
  });
2473
2514
 
2474
2515
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoInfoResponse.schema.ts
2475
- var CentrifugoInfoResponseSchema = import_zod36.z.object({
2516
+ var CentrifugoInfoResponseSchema = import_zod37.z.object({
2476
2517
  error: CentrifugoErrorSchema.optional(),
2477
2518
  result: CentrifugoInfoResultSchema.optional()
2478
2519
  });
2479
2520
 
2480
2521
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoOverviewStats.schema.ts
2481
- var import_zod37 = require("zod");
2482
- var CentrifugoOverviewStatsSchema = import_zod37.z.object({
2483
- total: import_zod37.z.int(),
2484
- successful: import_zod37.z.int(),
2485
- failed: import_zod37.z.int(),
2486
- timeout: import_zod37.z.int(),
2487
- success_rate: import_zod37.z.number(),
2488
- avg_duration_ms: import_zod37.z.number(),
2489
- avg_acks_received: import_zod37.z.number(),
2490
- period_hours: import_zod37.z.int()
2522
+ var import_zod38 = require("zod");
2523
+ var CentrifugoOverviewStatsSchema = import_zod38.z.object({
2524
+ total: import_zod38.z.int(),
2525
+ successful: import_zod38.z.int(),
2526
+ failed: import_zod38.z.int(),
2527
+ timeout: import_zod38.z.int(),
2528
+ success_rate: import_zod38.z.number(),
2529
+ avg_duration_ms: import_zod38.z.number(),
2530
+ avg_acks_received: import_zod38.z.number(),
2531
+ period_hours: import_zod38.z.int()
2491
2532
  });
2492
2533
 
2493
2534
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceRequestRequest.schema.ts
2494
- var import_zod38 = require("zod");
2495
- var CentrifugoPresenceRequestRequestSchema = import_zod38.z.object({
2496
- channel: import_zod38.z.string()
2535
+ var import_zod39 = require("zod");
2536
+ var CentrifugoPresenceRequestRequestSchema = import_zod39.z.object({
2537
+ channel: import_zod39.z.string()
2497
2538
  });
2498
2539
 
2499
2540
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts
2500
- var import_zod40 = require("zod");
2541
+ var import_zod41 = require("zod");
2501
2542
 
2502
2543
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResult.schema.ts
2503
- var import_zod39 = require("zod");
2504
- var CentrifugoPresenceResultSchema = import_zod39.z.object({
2505
- presence: import_zod39.z.record(import_zod39.z.string(), CentrifugoClientInfoSchema)
2544
+ var import_zod40 = require("zod");
2545
+ var CentrifugoPresenceResultSchema = import_zod40.z.object({
2546
+ presence: import_zod40.z.record(import_zod40.z.string(), CentrifugoClientInfoSchema)
2506
2547
  });
2507
2548
 
2508
2549
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceResponse.schema.ts
2509
- var CentrifugoPresenceResponseSchema = import_zod40.z.object({
2550
+ var CentrifugoPresenceResponseSchema = import_zod41.z.object({
2510
2551
  error: CentrifugoErrorSchema.optional(),
2511
2552
  result: CentrifugoPresenceResultSchema.optional()
2512
2553
  });
2513
2554
 
2514
2555
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsRequestRequest.schema.ts
2515
- var import_zod41 = require("zod");
2516
- var CentrifugoPresenceStatsRequestRequestSchema = import_zod41.z.object({
2517
- channel: import_zod41.z.string()
2556
+ var import_zod42 = require("zod");
2557
+ var CentrifugoPresenceStatsRequestRequestSchema = import_zod42.z.object({
2558
+ channel: import_zod42.z.string()
2518
2559
  });
2519
2560
 
2520
2561
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts
2521
- var import_zod43 = require("zod");
2562
+ var import_zod44 = require("zod");
2522
2563
 
2523
2564
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResult.schema.ts
2524
- var import_zod42 = require("zod");
2525
- var CentrifugoPresenceStatsResultSchema = import_zod42.z.object({
2526
- num_clients: import_zod42.z.int(),
2527
- num_users: import_zod42.z.int()
2565
+ var import_zod43 = require("zod");
2566
+ var CentrifugoPresenceStatsResultSchema = import_zod43.z.object({
2567
+ num_clients: import_zod43.z.int(),
2568
+ num_users: import_zod43.z.int()
2528
2569
  });
2529
2570
 
2530
2571
  // src/generated/cfg_centrifugo/_utils/schemas/CentrifugoPresenceStatsResponse.schema.ts
2531
- var CentrifugoPresenceStatsResponseSchema = import_zod43.z.object({
2572
+ var CentrifugoPresenceStatsResponseSchema = import_zod44.z.object({
2532
2573
  error: CentrifugoErrorSchema.optional(),
2533
2574
  result: CentrifugoPresenceStatsResultSchema.optional()
2534
2575
  });
2535
2576
 
2536
2577
  // src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts
2537
- var import_zod45 = require("zod");
2578
+ var import_zod46 = require("zod");
2538
2579
 
2539
2580
  // src/generated/cfg_centrifugo/_utils/schemas/ChannelStats.schema.ts
2540
- var import_zod44 = require("zod");
2541
- var ChannelStatsSchema = import_zod44.z.object({
2542
- channel: import_zod44.z.string(),
2543
- total: import_zod44.z.int(),
2544
- successful: import_zod44.z.int(),
2545
- failed: import_zod44.z.int(),
2546
- avg_duration_ms: import_zod44.z.number(),
2547
- avg_acks: import_zod44.z.number(),
2548
- last_activity_at: import_zod44.z.string().nullable()
2581
+ var import_zod45 = require("zod");
2582
+ var ChannelStatsSchema = import_zod45.z.object({
2583
+ channel: import_zod45.z.string(),
2584
+ total: import_zod45.z.int(),
2585
+ successful: import_zod45.z.int(),
2586
+ failed: import_zod45.z.int(),
2587
+ avg_duration_ms: import_zod45.z.number(),
2588
+ avg_acks: import_zod45.z.number(),
2589
+ last_activity_at: import_zod45.z.string().nullable()
2549
2590
  });
2550
2591
 
2551
2592
  // src/generated/cfg_centrifugo/_utils/schemas/ChannelList.schema.ts
2552
- var ChannelListSchema = import_zod45.z.object({
2553
- channels: import_zod45.z.array(ChannelStatsSchema),
2554
- total_channels: import_zod45.z.int()
2593
+ var ChannelListSchema = import_zod46.z.object({
2594
+ channels: import_zod46.z.array(ChannelStatsSchema),
2595
+ total_channels: import_zod46.z.int()
2555
2596
  });
2556
2597
 
2557
2598
  // src/generated/cfg_centrifugo/_utils/schemas/ConnectionTokenResponse.schema.ts
2558
- var import_zod46 = require("zod");
2559
- var ConnectionTokenResponseSchema = import_zod46.z.object({
2560
- token: import_zod46.z.string(),
2561
- centrifugo_url: import_zod46.z.string(),
2562
- expires_at: import_zod46.z.string(),
2563
- channels: import_zod46.z.array(import_zod46.z.string())
2599
+ var import_zod47 = require("zod");
2600
+ var ConnectionTokenResponseSchema = import_zod47.z.object({
2601
+ token: import_zod47.z.string(),
2602
+ centrifugo_url: import_zod47.z.string(),
2603
+ expires_at: import_zod47.z.string(),
2604
+ channels: import_zod47.z.array(import_zod47.z.string())
2564
2605
  });
2565
2606
 
2566
2607
  // src/generated/cfg_centrifugo/_utils/schemas/ManualAckRequestRequest.schema.ts
2567
- var import_zod47 = require("zod");
2568
- var ManualAckRequestRequestSchema = import_zod47.z.object({
2569
- message_id: import_zod47.z.string(),
2570
- client_id: import_zod47.z.string()
2608
+ var import_zod48 = require("zod");
2609
+ var ManualAckRequestRequestSchema = import_zod48.z.object({
2610
+ message_id: import_zod48.z.string(),
2611
+ client_id: import_zod48.z.string()
2571
2612
  });
2572
2613
 
2573
2614
  // src/generated/cfg_centrifugo/_utils/schemas/ManualAckResponse.schema.ts
2574
- var import_zod48 = require("zod");
2575
- var ManualAckResponseSchema = import_zod48.z.object({
2576
- success: import_zod48.z.boolean(),
2577
- message_id: import_zod48.z.string(),
2578
- error: import_zod48.z.string().nullable().optional()
2615
+ var import_zod49 = require("zod");
2616
+ var ManualAckResponseSchema = import_zod49.z.object({
2617
+ success: import_zod49.z.boolean(),
2618
+ message_id: import_zod49.z.string(),
2619
+ error: import_zod49.z.string().nullable().optional()
2579
2620
  });
2580
2621
 
2581
2622
  // src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts
2582
- var import_zod50 = require("zod");
2623
+ var import_zod51 = require("zod");
2583
2624
 
2584
2625
  // src/generated/cfg_centrifugo/_utils/schemas/Publish.schema.ts
2585
- var import_zod49 = require("zod");
2586
- var PublishSchema = import_zod49.z.object({
2587
- message_id: import_zod49.z.string(),
2588
- channel: import_zod49.z.string(),
2589
- status: import_zod49.z.string(),
2590
- wait_for_ack: import_zod49.z.boolean(),
2591
- acks_received: import_zod49.z.int(),
2592
- acks_expected: import_zod49.z.int().nullable(),
2593
- duration_ms: import_zod49.z.number().nullable(),
2594
- created_at: import_zod49.z.iso.datetime(),
2595
- completed_at: import_zod49.z.iso.datetime().nullable(),
2596
- error_code: import_zod49.z.string().nullable(),
2597
- error_message: import_zod49.z.string().nullable()
2626
+ var import_zod50 = require("zod");
2627
+ var PublishSchema = import_zod50.z.object({
2628
+ message_id: import_zod50.z.string(),
2629
+ channel: import_zod50.z.string(),
2630
+ status: import_zod50.z.string(),
2631
+ wait_for_ack: import_zod50.z.boolean(),
2632
+ acks_received: import_zod50.z.int(),
2633
+ acks_expected: import_zod50.z.int().nullable(),
2634
+ duration_ms: import_zod50.z.number().nullable(),
2635
+ created_at: import_zod50.z.iso.datetime(),
2636
+ completed_at: import_zod50.z.iso.datetime().nullable(),
2637
+ error_code: import_zod50.z.string().nullable(),
2638
+ error_message: import_zod50.z.string().nullable()
2598
2639
  });
2599
2640
 
2600
2641
  // src/generated/cfg_centrifugo/_utils/schemas/PaginatedPublishList.schema.ts
2601
- var PaginatedPublishListSchema = import_zod50.z.object({
2602
- count: import_zod50.z.int(),
2603
- page: import_zod50.z.int(),
2604
- pages: import_zod50.z.int(),
2605
- page_size: import_zod50.z.int(),
2606
- has_next: import_zod50.z.boolean(),
2607
- has_previous: import_zod50.z.boolean(),
2608
- next_page: import_zod50.z.int().nullable().optional(),
2609
- previous_page: import_zod50.z.int().nullable().optional(),
2610
- results: import_zod50.z.array(PublishSchema)
2642
+ var PaginatedPublishListSchema = import_zod51.z.object({
2643
+ count: import_zod51.z.int(),
2644
+ page: import_zod51.z.int(),
2645
+ pages: import_zod51.z.int(),
2646
+ page_size: import_zod51.z.int(),
2647
+ has_next: import_zod51.z.boolean(),
2648
+ has_previous: import_zod51.z.boolean(),
2649
+ next_page: import_zod51.z.int().nullable().optional(),
2650
+ previous_page: import_zod51.z.int().nullable().optional(),
2651
+ results: import_zod51.z.array(PublishSchema)
2611
2652
  });
2612
2653
 
2613
2654
  // src/generated/cfg_centrifugo/_utils/schemas/PublishTestRequestRequest.schema.ts
2614
- var import_zod51 = require("zod");
2615
- var PublishTestRequestRequestSchema = import_zod51.z.object({
2616
- channel: import_zod51.z.string(),
2617
- data: import_zod51.z.record(import_zod51.z.string(), import_zod51.z.any()),
2618
- wait_for_ack: import_zod51.z.boolean().optional(),
2619
- ack_timeout: import_zod51.z.int().min(1).max(60).optional()
2655
+ var import_zod52 = require("zod");
2656
+ var PublishTestRequestRequestSchema = import_zod52.z.object({
2657
+ channel: import_zod52.z.string(),
2658
+ data: import_zod52.z.record(import_zod52.z.string(), import_zod52.z.any()),
2659
+ wait_for_ack: import_zod52.z.boolean().optional(),
2660
+ ack_timeout: import_zod52.z.int().min(1).max(60).optional()
2620
2661
  });
2621
2662
 
2622
2663
  // src/generated/cfg_centrifugo/_utils/schemas/PublishTestResponse.schema.ts
2623
- var import_zod52 = require("zod");
2624
- var PublishTestResponseSchema = import_zod52.z.object({
2625
- success: import_zod52.z.boolean(),
2626
- message_id: import_zod52.z.string(),
2627
- channel: import_zod52.z.string(),
2628
- acks_received: import_zod52.z.int().optional(),
2629
- delivered: import_zod52.z.boolean().optional(),
2630
- error: import_zod52.z.string().nullable().optional()
2664
+ var import_zod53 = require("zod");
2665
+ var PublishTestResponseSchema = import_zod53.z.object({
2666
+ success: import_zod53.z.boolean(),
2667
+ message_id: import_zod53.z.string(),
2668
+ channel: import_zod53.z.string(),
2669
+ acks_received: import_zod53.z.int().optional(),
2670
+ delivered: import_zod53.z.boolean().optional(),
2671
+ error: import_zod53.z.string().nullable().optional()
2631
2672
  });
2632
2673
 
2633
2674
  // src/generated/cfg_centrifugo/_utils/schemas/TimelineItem.schema.ts
2634
- var import_zod53 = require("zod");
2635
- var TimelineItemSchema = import_zod53.z.object({
2636
- timestamp: import_zod53.z.string(),
2637
- count: import_zod53.z.int(),
2638
- successful: import_zod53.z.int(),
2639
- failed: import_zod53.z.int(),
2640
- timeout: import_zod53.z.int()
2675
+ var import_zod54 = require("zod");
2676
+ var TimelineItemSchema = import_zod54.z.object({
2677
+ timestamp: import_zod54.z.string(),
2678
+ count: import_zod54.z.int(),
2679
+ successful: import_zod54.z.int(),
2680
+ failed: import_zod54.z.int(),
2681
+ timeout: import_zod54.z.int()
2641
2682
  });
2642
2683
 
2643
2684
  // src/generated/cfg_centrifugo/_utils/schemas/TimelineResponse.schema.ts
2644
- var import_zod54 = require("zod");
2645
- var TimelineResponseSchema = import_zod54.z.object({
2646
- timeline: import_zod54.z.array(TimelineItemSchema),
2647
- period_hours: import_zod54.z.int(),
2648
- interval: import_zod54.z.string()
2685
+ var import_zod55 = require("zod");
2686
+ var TimelineResponseSchema = import_zod55.z.object({
2687
+ timeline: import_zod55.z.array(TimelineItemSchema),
2688
+ period_hours: import_zod55.z.int(),
2689
+ interval: import_zod55.z.string()
2649
2690
  });
2650
2691
 
2651
2692
  // src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts
@@ -2674,7 +2715,8 @@ var API2 = class {
2674
2715
  this._loadTokensFromStorage();
2675
2716
  this._client = new APIClient2(this.baseUrl, {
2676
2717
  retryConfig: this.options?.retryConfig,
2677
- loggerConfig: this.options?.loggerConfig
2718
+ loggerConfig: this.options?.loggerConfig,
2719
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
2678
2720
  });
2679
2721
  this._injectAuthHeader();
2680
2722
  this.centrifugo_admin_api = this._client.centrifugo_admin_api;
@@ -2692,7 +2734,8 @@ var API2 = class {
2692
2734
  _reinitClients() {
2693
2735
  this._client = new APIClient2(this.baseUrl, {
2694
2736
  retryConfig: this.options?.retryConfig,
2695
- loggerConfig: this.options?.loggerConfig
2737
+ loggerConfig: this.options?.loggerConfig,
2738
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
2696
2739
  });
2697
2740
  this._injectAuthHeader();
2698
2741
  this.centrifugo_admin_api = this._client.centrifugo_admin_api;
@@ -3191,8 +3234,10 @@ var APIClient3 = class {
3191
3234
  constructor(baseUrl, options) {
3192
3235
  this.logger = null;
3193
3236
  this.retryConfig = null;
3237
+ this.tokenGetter = null;
3194
3238
  this.baseUrl = baseUrl.replace(/\/$/, "");
3195
3239
  this.httpClient = options?.httpClient || new FetchAdapter3();
3240
+ this.tokenGetter = options?.tokenGetter || null;
3196
3241
  if (options?.loggerConfig !== void 0) {
3197
3242
  this.logger = new APILogger3(options.loggerConfig);
3198
3243
  }
@@ -3218,6 +3263,19 @@ var APIClient3 = class {
3218
3263
  }
3219
3264
  return null;
3220
3265
  }
3266
+ /**
3267
+ * Get the base URL for building streaming/download URLs.
3268
+ */
3269
+ getBaseUrl() {
3270
+ return this.baseUrl;
3271
+ }
3272
+ /**
3273
+ * Get JWT token for URL authentication (used in streaming endpoints).
3274
+ * Returns null if no token getter is configured or no token is available.
3275
+ */
3276
+ getToken() {
3277
+ return this.tokenGetter ? this.tokenGetter() : null;
3278
+ }
3221
3279
  /**
3222
3280
  * Make HTTP request with Django CSRF and session handling.
3223
3281
  * Automatically retries on network errors and 5xx server errors.
@@ -3430,40 +3488,40 @@ var LocalStorageAdapter3 = class {
3430
3488
  };
3431
3489
 
3432
3490
  // src/generated/cfg_webpush/_utils/schemas/SendPushRequestRequest.schema.ts
3433
- var import_zod55 = require("zod");
3434
- var SendPushRequestRequestSchema = import_zod55.z.object({
3435
- title: import_zod55.z.string().min(1).max(255),
3436
- body: import_zod55.z.string().min(1),
3437
- icon: import_zod55.z.union([import_zod55.z.url(), import_zod55.z.literal("")]).nullable().optional(),
3438
- url: import_zod55.z.union([import_zod55.z.url(), import_zod55.z.literal("")]).nullable().optional()
3491
+ var import_zod56 = require("zod");
3492
+ var SendPushRequestRequestSchema = import_zod56.z.object({
3493
+ title: import_zod56.z.string().min(1).max(255),
3494
+ body: import_zod56.z.string().min(1),
3495
+ icon: import_zod56.z.union([import_zod56.z.url(), import_zod56.z.literal("")]).nullable().optional(),
3496
+ url: import_zod56.z.union([import_zod56.z.url(), import_zod56.z.literal("")]).nullable().optional()
3439
3497
  });
3440
3498
 
3441
3499
  // src/generated/cfg_webpush/_utils/schemas/SendPushResponse.schema.ts
3442
- var import_zod56 = require("zod");
3443
- var SendPushResponseSchema = import_zod56.z.object({
3444
- success: import_zod56.z.boolean(),
3445
- sent_to: import_zod56.z.int()
3500
+ var import_zod57 = require("zod");
3501
+ var SendPushResponseSchema = import_zod57.z.object({
3502
+ success: import_zod57.z.boolean(),
3503
+ sent_to: import_zod57.z.int()
3446
3504
  });
3447
3505
 
3448
3506
  // src/generated/cfg_webpush/_utils/schemas/SubscribeRequestRequest.schema.ts
3449
- var import_zod57 = require("zod");
3450
- var SubscribeRequestRequestSchema = import_zod57.z.object({
3451
- endpoint: import_zod57.z.union([import_zod57.z.url(), import_zod57.z.literal("")]),
3452
- keys: import_zod57.z.record(import_zod57.z.string(), import_zod57.z.string().min(1))
3507
+ var import_zod58 = require("zod");
3508
+ var SubscribeRequestRequestSchema = import_zod58.z.object({
3509
+ endpoint: import_zod58.z.union([import_zod58.z.url(), import_zod58.z.literal("")]),
3510
+ keys: import_zod58.z.record(import_zod58.z.string(), import_zod58.z.string().min(1))
3453
3511
  });
3454
3512
 
3455
3513
  // src/generated/cfg_webpush/_utils/schemas/SubscribeResponse.schema.ts
3456
- var import_zod58 = require("zod");
3457
- var SubscribeResponseSchema = import_zod58.z.object({
3458
- success: import_zod58.z.boolean(),
3459
- subscription_id: import_zod58.z.int(),
3460
- created: import_zod58.z.boolean()
3514
+ var import_zod59 = require("zod");
3515
+ var SubscribeResponseSchema = import_zod59.z.object({
3516
+ success: import_zod59.z.boolean(),
3517
+ subscription_id: import_zod59.z.int(),
3518
+ created: import_zod59.z.boolean()
3461
3519
  });
3462
3520
 
3463
3521
  // src/generated/cfg_webpush/_utils/schemas/VapidPublicKeyResponse.schema.ts
3464
- var import_zod59 = require("zod");
3465
- var VapidPublicKeyResponseSchema = import_zod59.z.object({
3466
- publicKey: import_zod59.z.string()
3522
+ var import_zod60 = require("zod");
3523
+ var VapidPublicKeyResponseSchema = import_zod60.z.object({
3524
+ publicKey: import_zod60.z.string()
3467
3525
  });
3468
3526
 
3469
3527
  // src/generated/cfg_webpush/_utils/fetchers/webpush__web_push.ts
@@ -3483,7 +3541,8 @@ var API3 = class {
3483
3541
  this._loadTokensFromStorage();
3484
3542
  this._client = new APIClient3(this.baseUrl, {
3485
3543
  retryConfig: this.options?.retryConfig,
3486
- loggerConfig: this.options?.loggerConfig
3544
+ loggerConfig: this.options?.loggerConfig,
3545
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
3487
3546
  });
3488
3547
  this._injectAuthHeader();
3489
3548
  this.web_push = this._client.web_push;
@@ -3498,7 +3557,8 @@ var API3 = class {
3498
3557
  _reinitClients() {
3499
3558
  this._client = new APIClient3(this.baseUrl, {
3500
3559
  retryConfig: this.options?.retryConfig,
3501
- loggerConfig: this.options?.loggerConfig
3560
+ loggerConfig: this.options?.loggerConfig,
3561
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
3502
3562
  });
3503
3563
  this._injectAuthHeader();
3504
3564
  this.web_push = this._client.web_push;
@@ -3672,7 +3732,7 @@ __name(useBase64, "useBase64");
3672
3732
  // src/auth/hooks/useProfileCache.ts
3673
3733
  var CACHE_KEY = "user_profile_cache";
3674
3734
  var CACHE_VERSION = 1;
3675
- var DEFAULT_TTL = 36e5;
3735
+ var DEFAULT_TTL = 144e5;
3676
3736
  function getCachedProfile() {
3677
3737
  try {
3678
3738
  if (typeof window === "undefined") return null;
@@ -3958,6 +4018,100 @@ var useAuthRedirectManager = /* @__PURE__ */ __name((options = {}) => {
3958
4018
  };
3959
4019
  }, "useAuthRedirectManager");
3960
4020
 
4021
+ // src/auth/hooks/useTokenRefresh.ts
4022
+ var import_react2 = require("react");
4023
+ var TOKEN_REFRESH_THRESHOLD_MS = 10 * 60 * 1e3;
4024
+ var CHECK_INTERVAL_MS = 5 * 60 * 1e3;
4025
+ function getTokenExpiry(token) {
4026
+ try {
4027
+ const payload = JSON.parse(atob(token.split(".")[1]));
4028
+ return payload.exp * 1e3;
4029
+ } catch {
4030
+ return null;
4031
+ }
4032
+ }
4033
+ __name(getTokenExpiry, "getTokenExpiry");
4034
+ function isTokenExpiringSoon(token, thresholdMs) {
4035
+ const expiry = getTokenExpiry(token);
4036
+ if (!expiry) return false;
4037
+ const timeUntilExpiry = expiry - Date.now();
4038
+ return timeUntilExpiry < thresholdMs;
4039
+ }
4040
+ __name(isTokenExpiringSoon, "isTokenExpiringSoon");
4041
+ function useTokenRefresh(options = {}) {
4042
+ const { enabled = true, onRefresh, onRefreshError } = options;
4043
+ const isRefreshingRef = (0, import_react2.useRef)(false);
4044
+ const refreshToken = (0, import_react2.useCallback)(async () => {
4045
+ if (isRefreshingRef.current) {
4046
+ authLogger.debug("Token refresh already in progress");
4047
+ return false;
4048
+ }
4049
+ const refreshTokenValue = api.getRefreshToken();
4050
+ if (!refreshTokenValue) {
4051
+ authLogger.warn("No refresh token available");
4052
+ return false;
4053
+ }
4054
+ isRefreshingRef.current = true;
4055
+ authLogger.info("Refreshing token...");
4056
+ try {
4057
+ const result = await api.auth.accountsTokenRefreshCreate({
4058
+ refresh: refreshTokenValue
4059
+ });
4060
+ const newAccessToken = result.access;
4061
+ if (!newAccessToken) {
4062
+ throw new Error("No access token in refresh response");
4063
+ }
4064
+ api.setToken(newAccessToken, refreshTokenValue);
4065
+ authLogger.info("Token refreshed successfully");
4066
+ onRefresh?.(newAccessToken);
4067
+ return true;
4068
+ } catch (error) {
4069
+ authLogger.error("Token refresh error:", error);
4070
+ onRefreshError?.(error instanceof Error ? error : new Error(String(error)));
4071
+ return false;
4072
+ } finally {
4073
+ isRefreshingRef.current = false;
4074
+ }
4075
+ }, [onRefresh, onRefreshError]);
4076
+ const checkAndRefresh = (0, import_react2.useCallback)(async () => {
4077
+ const token = api.getToken();
4078
+ if (!token) return;
4079
+ if (isTokenExpiringSoon(token, TOKEN_REFRESH_THRESHOLD_MS)) {
4080
+ authLogger.info("Token expiring soon, refreshing proactively");
4081
+ await refreshToken();
4082
+ }
4083
+ }, [refreshToken]);
4084
+ (0, import_react2.useEffect)(() => {
4085
+ if (!enabled) return;
4086
+ checkAndRefresh();
4087
+ const intervalId = setInterval(checkAndRefresh, CHECK_INTERVAL_MS);
4088
+ return () => clearInterval(intervalId);
4089
+ }, [enabled, checkAndRefresh]);
4090
+ (0, import_react2.useEffect)(() => {
4091
+ if (!enabled) return;
4092
+ const handleFocus = /* @__PURE__ */ __name(() => {
4093
+ authLogger.debug("Window focused, checking token...");
4094
+ checkAndRefresh();
4095
+ }, "handleFocus");
4096
+ window.addEventListener("focus", handleFocus);
4097
+ return () => window.removeEventListener("focus", handleFocus);
4098
+ }, [enabled, checkAndRefresh]);
4099
+ (0, import_react2.useEffect)(() => {
4100
+ if (!enabled) return;
4101
+ const handleOnline = /* @__PURE__ */ __name(() => {
4102
+ authLogger.info("Network reconnected, checking token...");
4103
+ checkAndRefresh();
4104
+ }, "handleOnline");
4105
+ window.addEventListener("online", handleOnline);
4106
+ return () => window.removeEventListener("online", handleOnline);
4107
+ }, [enabled, checkAndRefresh]);
4108
+ return {
4109
+ refreshToken,
4110
+ checkAndRefresh
4111
+ };
4112
+ }
4113
+ __name(useTokenRefresh, "useTokenRefresh");
4114
+
3961
4115
  // src/auth/utils/analytics.ts
3962
4116
  var AnalyticsEvent = /* @__PURE__ */ ((AnalyticsEvent2) => {
3963
4117
  AnalyticsEvent2["AUTH_OTP_REQUEST"] = "auth_otp_request";
@@ -3995,7 +4149,7 @@ var Analytics = {
3995
4149
  };
3996
4150
 
3997
4151
  // src/auth/context/AccountsContext.tsx
3998
- var import_react2 = require("react");
4152
+ var import_react3 = require("react");
3999
4153
 
4000
4154
  // src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts
4001
4155
  var import_swr = require("swr");
@@ -4067,20 +4221,20 @@ __name(useCreateAccountsOtpVerifyCreate, "useCreateAccountsOtpVerifyCreate");
4067
4221
 
4068
4222
  // src/auth/context/AccountsContext.tsx
4069
4223
  var import_jsx_runtime = require("react/jsx-runtime");
4070
- var AccountsContext = (0, import_react2.createContext)(void 0);
4224
+ var AccountsContext = (0, import_react3.createContext)(void 0);
4071
4225
  function AccountsProvider({ children }) {
4072
- const [profile, setProfile] = (0, import_react2.useState)(() => {
4226
+ const [profile, setProfile] = (0, import_react3.useState)(() => {
4073
4227
  const cached = getCachedProfile();
4074
4228
  return cached || void 0;
4075
4229
  });
4076
- const [isLoadingProfile, setIsLoadingProfile] = (0, import_react2.useState)(false);
4077
- const [profileError, setProfileError] = (0, import_react2.useState)(null);
4078
- const profileRef = (0, import_react2.useRef)(profile);
4079
- const isLoadingRef = (0, import_react2.useRef)(false);
4080
- (0, import_react2.useEffect)(() => {
4230
+ const [isLoadingProfile, setIsLoadingProfile] = (0, import_react3.useState)(false);
4231
+ const [profileError, setProfileError] = (0, import_react3.useState)(null);
4232
+ const profileRef = (0, import_react3.useRef)(profile);
4233
+ const isLoadingRef = (0, import_react3.useRef)(false);
4234
+ (0, import_react3.useEffect)(() => {
4081
4235
  profileRef.current = profile;
4082
4236
  }, [profile]);
4083
- (0, import_react2.useEffect)(() => {
4237
+ (0, import_react3.useEffect)(() => {
4084
4238
  isLoadingRef.current = isLoadingProfile;
4085
4239
  }, [isLoadingProfile]);
4086
4240
  const updateMutation = useUpdateAccountsProfileUpdateUpdate();
@@ -4089,7 +4243,7 @@ function AccountsProvider({ children }) {
4089
4243
  const otpRequestMutation = useCreateAccountsOtpRequestCreate();
4090
4244
  const otpVerifyMutation = useCreateAccountsOtpVerifyCreate();
4091
4245
  const tokenRefreshMutation = useCreateAccountsTokenRefreshCreate();
4092
- const refreshProfile = (0, import_react2.useCallback)(async (callerId) => {
4246
+ const refreshProfile = (0, import_react3.useCallback)(async (callerId) => {
4093
4247
  const currentProfile = profileRef.current;
4094
4248
  const currentLoading = isLoadingRef.current;
4095
4249
  if (currentProfile && !currentLoading) {
@@ -4127,8 +4281,8 @@ function AccountsProvider({ children }) {
4127
4281
  await refreshProfile("AccountsContext.partialUpdateProfile");
4128
4282
  return result;
4129
4283
  }, "partialUpdateProfile");
4130
- const uploadAvatar = /* @__PURE__ */ __name(async (formData) => {
4131
- const result = await avatarMutation(formData, api);
4284
+ const uploadAvatar = /* @__PURE__ */ __name(async (avatar) => {
4285
+ const result = await avatarMutation({ avatar }, api);
4132
4286
  await refreshProfile("AccountsContext.uploadAvatar");
4133
4287
  return result;
4134
4288
  }, "uploadAvatar");
@@ -4155,7 +4309,7 @@ function AccountsProvider({ children }) {
4155
4309
  }
4156
4310
  return result;
4157
4311
  }, "refreshToken");
4158
- const logout = (0, import_react2.useCallback)(() => {
4312
+ const logout = (0, import_react3.useCallback)(() => {
4159
4313
  api.clearTokens();
4160
4314
  setProfile(void 0);
4161
4315
  setProfileError(null);
@@ -4178,7 +4332,7 @@ function AccountsProvider({ children }) {
4178
4332
  }
4179
4333
  __name(AccountsProvider, "AccountsProvider");
4180
4334
  function useAccountsContext() {
4181
- const context = (0, import_react2.useContext)(AccountsContext);
4335
+ const context = (0, import_react3.useContext)(AccountsContext);
4182
4336
  if (!context) {
4183
4337
  throw new Error("useAccountsContext must be used within AccountsProvider");
4184
4338
  }
@@ -4193,7 +4347,7 @@ var defaultRoutes = {
4193
4347
  defaultCallback: "/dashboard",
4194
4348
  defaultAuthCallback: "/auth"
4195
4349
  };
4196
- var AuthContext = (0, import_react3.createContext)(void 0);
4350
+ var AuthContext = (0, import_react4.createContext)(void 0);
4197
4351
  var EMAIL_STORAGE_KEY = "auth_email";
4198
4352
  var PHONE_STORAGE_KEY = "auth_phone";
4199
4353
  var hasValidTokens = /* @__PURE__ */ __name(() => {
@@ -4206,45 +4360,58 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4206
4360
  fallbackUrl: config?.routes?.defaultCallback || defaultRoutes.defaultCallback,
4207
4361
  clearOnUse: true
4208
4362
  });
4209
- const [isLoading, setIsLoading] = (0, import_react3.useState)(() => {
4363
+ const [isLoading, setIsLoading] = (0, import_react4.useState)(() => {
4210
4364
  if (typeof window !== "undefined") {
4211
4365
  const hasTokens = hasValidTokens();
4212
4366
  return !hasTokens;
4213
4367
  }
4214
4368
  return true;
4215
4369
  });
4216
- const [initialized, setInitialized] = (0, import_react3.useState)(false);
4370
+ const [initialized, setInitialized] = (0, import_react4.useState)(false);
4217
4371
  const router = (0, import_hooks2.useCfgRouter)();
4218
4372
  const pathname = (0, import_navigation.usePathname)();
4219
4373
  const queryParams = (0, import_hooks2.useQueryParams)();
4220
4374
  const [storedEmail, setStoredEmail, clearStoredEmail] = (0, import_hooks2.useLocalStorage)(EMAIL_STORAGE_KEY, null);
4221
4375
  const [storedPhone, setStoredPhone, clearStoredPhone] = (0, import_hooks2.useLocalStorage)(PHONE_STORAGE_KEY, null);
4376
+ useTokenRefresh({
4377
+ enabled: true,
4378
+ onRefresh: /* @__PURE__ */ __name((newToken) => {
4379
+ authLogger.info("Token auto-refreshed successfully");
4380
+ }, "onRefresh"),
4381
+ onRefreshError: /* @__PURE__ */ __name((error) => {
4382
+ authLogger.warn("Token auto-refresh failed:", error.message);
4383
+ }, "onRefreshError")
4384
+ });
4222
4385
  const user = accounts.profile;
4223
- const userRef = (0, import_react3.useRef)(user);
4224
- const configRef = (0, import_react3.useRef)(config);
4225
- const isLoadingProfileRef = (0, import_react3.useRef)(false);
4226
- (0, import_react3.useEffect)(() => {
4386
+ const userRef = (0, import_react4.useRef)(user);
4387
+ const configRef = (0, import_react4.useRef)(config);
4388
+ const isLoadingProfileRef = (0, import_react4.useRef)(false);
4389
+ (0, import_react4.useEffect)(() => {
4227
4390
  userRef.current = user;
4228
4391
  }, [user]);
4229
- (0, import_react3.useEffect)(() => {
4392
+ (0, import_react4.useEffect)(() => {
4230
4393
  configRef.current = config;
4231
4394
  }, [config]);
4232
- const clearAuthState = (0, import_react3.useCallback)((caller) => {
4395
+ const clearAuthState = (0, import_react4.useCallback)((caller) => {
4233
4396
  authLogger.info("clearAuthState >> caller", caller);
4234
4397
  api.clearTokens();
4235
4398
  clearProfileCache();
4236
4399
  setInitialized(true);
4237
4400
  setIsLoading(false);
4238
4401
  }, []);
4239
- const handleGlobalAuthError = (0, import_react3.useCallback)((error, context = "API Request") => {
4240
- if (error?.success === false) {
4241
- authLogger.warn(`Error detected in ${context}, clearing tokens`);
4402
+ const handleGlobalAuthError = (0, import_react4.useCallback)((error, context = "API Request") => {
4403
+ const isAuthError = error?.status === 401 || error?.statusCode === 401 || error?.code === "token_not_valid" || error?.code === "authentication_failed";
4404
+ if (isAuthError) {
4405
+ authLogger.warn(`Authentication error in ${context}, clearing tokens`);
4242
4406
  clearAuthState(`globalAuthError:${context}`);
4243
4407
  return true;
4244
4408
  }
4409
+ if (error?.success === false) {
4410
+ authLogger.warn(`Non-auth error in ${context} (not clearing session):`, error?.message || error);
4411
+ }
4245
4412
  return false;
4246
4413
  }, [clearAuthState]);
4247
- const loadCurrentProfile = (0, import_react3.useCallback)(async (callerId) => {
4414
+ const loadCurrentProfile = (0, import_react4.useCallback)(async (callerId) => {
4248
4415
  const finalCallerId = callerId || "AuthContext.loadCurrentProfile";
4249
4416
  if (isLoadingProfileRef.current) {
4250
4417
  authLogger.debug(`Profile loading already in progress, skipping duplicate call from: ${finalCallerId}`);
@@ -4273,14 +4440,19 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4273
4440
  setInitialized(true);
4274
4441
  } catch (error) {
4275
4442
  authLogger.error("Failed to load profile:", error);
4276
- if (!handleGlobalAuthError(error, "loadCurrentProfile")) {
4277
- clearAuthState("loadCurrentProfile:error");
4443
+ const isAuthError = error?.status === 401 || error?.statusCode === 401 || error?.code === "token_not_valid" || error?.code === "authentication_failed";
4444
+ if (isAuthError) {
4445
+ authLogger.warn("Authentication error, clearing session");
4446
+ clearAuthState("loadCurrentProfile:authError");
4447
+ } else {
4448
+ authLogger.warn("Profile load failed but keeping session (non-auth error)");
4449
+ setInitialized(true);
4278
4450
  }
4279
4451
  } finally {
4280
4452
  isLoadingProfileRef.current = false;
4281
4453
  }
4282
4454
  }, [clearAuthState, handleGlobalAuthError, accounts]);
4283
- (0, import_react3.useEffect)(() => {
4455
+ (0, import_react4.useEffect)(() => {
4284
4456
  if (initialized) return;
4285
4457
  const initializeAuth = /* @__PURE__ */ __name(async () => {
4286
4458
  authLogger.info("Initializing auth...");
@@ -4320,7 +4492,13 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4320
4492
  await loadCurrentProfile("AuthContext.initializeAuth");
4321
4493
  } catch (error) {
4322
4494
  authLogger.error("Failed to load profile during initialization:", error);
4323
- clearAuthState("initializeAuth:loadProfileFailed");
4495
+ const isAuthError = error?.status === 401 || error?.statusCode === 401 || error?.code === "token_not_valid" || error?.code === "authentication_failed";
4496
+ if (isAuthError) {
4497
+ clearAuthState("initializeAuth:authError");
4498
+ } else {
4499
+ authLogger.warn("Init profile load failed but keeping session");
4500
+ setInitialized(true);
4501
+ }
4324
4502
  }
4325
4503
  setIsLoading(false);
4326
4504
  } else {
@@ -4330,7 +4508,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4330
4508
  }, "initializeAuth");
4331
4509
  initializeAuth();
4332
4510
  }, [initialized]);
4333
- (0, import_react3.useEffect)(() => {
4511
+ (0, import_react4.useEffect)(() => {
4334
4512
  if (!initialized) return;
4335
4513
  const isAuthenticated = api.isAuthenticated();
4336
4514
  const authRoute = config?.routes?.auth || defaultRoutes.auth;
@@ -4341,15 +4519,15 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4341
4519
  router.push(callbackUrl);
4342
4520
  }
4343
4521
  }, [initialized, pathname, queryParams, config?.routes]);
4344
- const pushToDefaultCallbackUrl = (0, import_react3.useCallback)(() => {
4522
+ const pushToDefaultCallbackUrl = (0, import_react4.useCallback)(() => {
4345
4523
  const callbackUrl = config?.routes?.defaultCallback || defaultRoutes.defaultCallback;
4346
4524
  router.push(callbackUrl);
4347
4525
  }, [config?.routes, router]);
4348
- const pushToDefaultAuthCallbackUrl = (0, import_react3.useCallback)(() => {
4526
+ const pushToDefaultAuthCallbackUrl = (0, import_react4.useCallback)(() => {
4349
4527
  const authCallbackUrl = config?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;
4350
4528
  router.push(authCallbackUrl);
4351
4529
  }, [config?.routes, router]);
4352
- const checkAuthAndRedirect = (0, import_react3.useCallback)(async () => {
4530
+ const checkAuthAndRedirect = (0, import_react4.useCallback)(async () => {
4353
4531
  try {
4354
4532
  setIsLoading(true);
4355
4533
  const isAuthenticated = api.isAuthenticated();
@@ -4371,7 +4549,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4371
4549
  setIsLoading(false);
4372
4550
  }
4373
4551
  }, [loadCurrentProfile, clearAuthState, pushToDefaultCallbackUrl, pushToDefaultAuthCallbackUrl, handleGlobalAuthError]);
4374
- const requestOTP = (0, import_react3.useCallback)(
4552
+ const requestOTP = (0, import_react4.useCallback)(
4375
4553
  async (identifier, channel, sourceUrl) => {
4376
4554
  api.clearTokens();
4377
4555
  try {
@@ -4399,7 +4577,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4399
4577
  },
4400
4578
  [accounts]
4401
4579
  );
4402
- const verifyOTP = (0, import_react3.useCallback)(
4580
+ const verifyOTP = (0, import_react4.useCallback)(
4403
4581
  async (identifier, otpCode, channel, sourceUrl, redirectUrl, skipRedirect) => {
4404
4582
  try {
4405
4583
  const channelValue = channel === "phone" ? enums_exports.OTPVerifyRequestChannel.PHONE : enums_exports.OTPVerifyRequestChannel.EMAIL;
@@ -4466,7 +4644,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4466
4644
  },
4467
4645
  [setStoredEmail, setStoredPhone, clearStoredEmail, clearStoredPhone, config?.routes?.defaultCallback, accounts, router]
4468
4646
  );
4469
- const refreshToken = (0, import_react3.useCallback)(async () => {
4647
+ const refreshToken = (0, import_react4.useCallback)(async () => {
4470
4648
  try {
4471
4649
  const refreshTokenValue = api.getRefreshToken();
4472
4650
  if (!refreshTokenValue) {
@@ -4499,7 +4677,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4499
4677
  };
4500
4678
  }
4501
4679
  }, [clearAuthState, accounts]);
4502
- const logout = (0, import_react3.useCallback)(async () => {
4680
+ const logout = (0, import_react4.useCallback)(async () => {
4503
4681
  const performLogout = /* @__PURE__ */ __name(() => {
4504
4682
  Analytics.event("auth_logout" /* AUTH_LOGOUT */, {
4505
4683
  category: "auth" /* AUTH */
@@ -4528,10 +4706,10 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4528
4706
  }
4529
4707
  }
4530
4708
  }, [accounts, config?.routes?.defaultAuthCallback, router]);
4531
- const isAdminUser = (0, import_react3.useMemo)(() => {
4709
+ const isAdminUser = (0, import_react4.useMemo)(() => {
4532
4710
  return Boolean(user?.is_staff || user?.is_superuser);
4533
4711
  }, [user]);
4534
- const value = (0, import_react3.useMemo)(
4712
+ const value = (0, import_react4.useMemo)(
4535
4713
  () => ({
4536
4714
  user,
4537
4715
  isLoading,
@@ -4583,7 +4761,7 @@ var AuthProvider = /* @__PURE__ */ __name(({ children, config }) => {
4583
4761
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AccountsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthProviderInternal, { config, children }) });
4584
4762
  }, "AuthProvider");
4585
4763
  var useAuth = /* @__PURE__ */ __name(() => {
4586
- const context = (0, import_react3.useContext)(AuthContext);
4764
+ const context = (0, import_react4.useContext)(AuthContext);
4587
4765
  if (context === void 0) {
4588
4766
  throw new Error("useAuth must be used within an AuthProvider");
4589
4767
  }
@@ -4591,20 +4769,20 @@ var useAuth = /* @__PURE__ */ __name(() => {
4591
4769
  }, "useAuth");
4592
4770
 
4593
4771
  // src/auth/hooks/useAuthFormState.ts
4594
- var import_react4 = require("react");
4772
+ var import_react5 = require("react");
4595
4773
  var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "", initialChannel = "email") => {
4596
- const [identifier, setIdentifier] = (0, import_react4.useState)(initialIdentifier);
4597
- const [channel, setChannel] = (0, import_react4.useState)(initialChannel);
4598
- const [otp, setOtp] = (0, import_react4.useState)("");
4599
- const [isLoading, setIsLoading] = (0, import_react4.useState)(false);
4600
- const [acceptedTerms, setAcceptedTerms] = (0, import_react4.useState)(false);
4601
- const [step, setStep] = (0, import_react4.useState)("identifier");
4602
- const [error, setError] = (0, import_react4.useState)("");
4603
- const [twoFactorSessionId, setTwoFactorSessionId] = (0, import_react4.useState)(null);
4604
- const [shouldPrompt2FA, setShouldPrompt2FA] = (0, import_react4.useState)(false);
4605
- const [twoFactorCode, setTwoFactorCode] = (0, import_react4.useState)("");
4606
- const [useBackupCode, setUseBackupCode] = (0, import_react4.useState)(false);
4607
- const clearError = (0, import_react4.useCallback)(() => setError(""), []);
4774
+ const [identifier, setIdentifier] = (0, import_react5.useState)(initialIdentifier);
4775
+ const [channel, setChannel] = (0, import_react5.useState)(initialChannel);
4776
+ const [otp, setOtp] = (0, import_react5.useState)("");
4777
+ const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
4778
+ const [acceptedTerms, setAcceptedTerms] = (0, import_react5.useState)(false);
4779
+ const [step, setStep] = (0, import_react5.useState)("identifier");
4780
+ const [error, setError] = (0, import_react5.useState)("");
4781
+ const [twoFactorSessionId, setTwoFactorSessionId] = (0, import_react5.useState)(null);
4782
+ const [shouldPrompt2FA, setShouldPrompt2FA] = (0, import_react5.useState)(false);
4783
+ const [twoFactorCode, setTwoFactorCode] = (0, import_react5.useState)("");
4784
+ const [useBackupCode, setUseBackupCode] = (0, import_react5.useState)(false);
4785
+ const clearError = (0, import_react5.useCallback)(() => setError(""), []);
4608
4786
  return {
4609
4787
  // State
4610
4788
  identifier,
@@ -4635,11 +4813,11 @@ var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "", initialCh
4635
4813
  }, "useAuthFormState");
4636
4814
 
4637
4815
  // src/auth/hooks/useAuthValidation.ts
4638
- var import_react5 = require("react");
4816
+ var import_react6 = require("react");
4639
4817
  var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
4640
4818
  var PHONE_REGEX = /^\+[1-9]\d{6,14}$/;
4641
4819
  var useAuthValidation = /* @__PURE__ */ __name(() => {
4642
- const detectChannelFromIdentifier2 = (0, import_react5.useCallback)((id) => {
4820
+ const detectChannelFromIdentifier2 = (0, import_react6.useCallback)((id) => {
4643
4821
  if (!id) return null;
4644
4822
  if (id.includes("@")) {
4645
4823
  return "email";
@@ -4649,7 +4827,7 @@ var useAuthValidation = /* @__PURE__ */ __name(() => {
4649
4827
  }
4650
4828
  return null;
4651
4829
  }, []);
4652
- const validateIdentifier2 = (0, import_react5.useCallback)((id, channelType) => {
4830
+ const validateIdentifier2 = (0, import_react6.useCallback)((id, channelType) => {
4653
4831
  if (!id) return false;
4654
4832
  const channel = channelType || detectChannelFromIdentifier2(id);
4655
4833
  if (channel === "email") {
@@ -4680,11 +4858,11 @@ var validateIdentifier = /* @__PURE__ */ __name((id, channelType) => {
4680
4858
  }, "validateIdentifier");
4681
4859
 
4682
4860
  // src/auth/hooks/useAuthForm.ts
4683
- var import_react8 = require("react");
4861
+ var import_react9 = require("react");
4684
4862
 
4685
4863
  // src/auth/hooks/useAutoAuth.ts
4686
4864
  var import_navigation2 = require("next/navigation");
4687
- var import_react6 = require("react");
4865
+ var import_react7 = require("react");
4688
4866
  var import_hooks3 = require("@djangocfg/ui-nextjs/hooks");
4689
4867
  var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
4690
4868
  const { onOTPDetected, cleanupUrl = true, allowedPaths = ["/auth"] } = options;
@@ -4694,7 +4872,7 @@ var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
4694
4872
  const isAllowedPath = allowedPaths.some((path) => pathname === path || pathname?.startsWith(path + "/"));
4695
4873
  const hasOTP = !!queryParams.get("otp");
4696
4874
  const isReady = !!pathname && hasOTP && isAllowedPath;
4697
- (0, import_react6.useEffect)(() => {
4875
+ (0, import_react7.useEffect)(() => {
4698
4876
  if (!isReady) return;
4699
4877
  const queryOtp = queryParams.get("otp");
4700
4878
  if (queryOtp && typeof queryOtp === "string" && queryOtp.length === 6) {
@@ -4716,7 +4894,7 @@ var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
4716
4894
  }, "useAutoAuth");
4717
4895
 
4718
4896
  // src/auth/hooks/useTwoFactor.ts
4719
- var import_react7 = require("react");
4897
+ var import_react8 = require("react");
4720
4898
  var import_hooks4 = require("@djangocfg/ui-nextjs/hooks");
4721
4899
 
4722
4900
  // src/generated/cfg_totp/totp__backup_codes/client.ts
@@ -5211,8 +5389,10 @@ var APIClient4 = class {
5211
5389
  constructor(baseUrl, options) {
5212
5390
  this.logger = null;
5213
5391
  this.retryConfig = null;
5392
+ this.tokenGetter = null;
5214
5393
  this.baseUrl = baseUrl.replace(/\/$/, "");
5215
5394
  this.httpClient = options?.httpClient || new FetchAdapter4();
5395
+ this.tokenGetter = options?.tokenGetter || null;
5216
5396
  if (options?.loggerConfig !== void 0) {
5217
5397
  this.logger = new APILogger4(options.loggerConfig);
5218
5398
  }
@@ -5242,6 +5422,19 @@ var APIClient4 = class {
5242
5422
  }
5243
5423
  return null;
5244
5424
  }
5425
+ /**
5426
+ * Get the base URL for building streaming/download URLs.
5427
+ */
5428
+ getBaseUrl() {
5429
+ return this.baseUrl;
5430
+ }
5431
+ /**
5432
+ * Get JWT token for URL authentication (used in streaming endpoints).
5433
+ * Returns null if no token getter is configured or no token is available.
5434
+ */
5435
+ getToken() {
5436
+ return this.tokenGetter ? this.tokenGetter() : null;
5437
+ }
5245
5438
  /**
5246
5439
  * Make HTTP request with Django CSRF and session handling.
5247
5440
  * Automatically retries on network errors and 5xx server errors.
@@ -5462,112 +5655,112 @@ var DeviceListStatus = /* @__PURE__ */ ((DeviceListStatus2) => {
5462
5655
  })(DeviceListStatus || {});
5463
5656
 
5464
5657
  // src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateRequest.schema.ts
5465
- var import_zod60 = require("zod");
5466
- var BackupCodesRegenerateRequestSchema = import_zod60.z.object({
5467
- code: import_zod60.z.string().min(6).max(6)
5658
+ var import_zod61 = require("zod");
5659
+ var BackupCodesRegenerateRequestSchema = import_zod61.z.object({
5660
+ code: import_zod61.z.string().min(6).max(6)
5468
5661
  });
5469
5662
 
5470
5663
  // src/generated/cfg_totp/_utils/schemas/BackupCodesRegenerateResponse.schema.ts
5471
- var import_zod61 = require("zod");
5472
- var BackupCodesRegenerateResponseSchema = import_zod61.z.object({
5473
- backup_codes: import_zod61.z.array(import_zod61.z.string()),
5474
- warning: import_zod61.z.string()
5664
+ var import_zod62 = require("zod");
5665
+ var BackupCodesRegenerateResponseSchema = import_zod62.z.object({
5666
+ backup_codes: import_zod62.z.array(import_zod62.z.string()),
5667
+ warning: import_zod62.z.string()
5475
5668
  });
5476
5669
 
5477
5670
  // src/generated/cfg_totp/_utils/schemas/BackupCodesStatus.schema.ts
5478
- var import_zod62 = require("zod");
5479
- var BackupCodesStatusSchema = import_zod62.z.object({
5480
- remaining_count: import_zod62.z.int(),
5481
- total_generated: import_zod62.z.int(),
5482
- warning: import_zod62.z.string().nullable().optional()
5671
+ var import_zod63 = require("zod");
5672
+ var BackupCodesStatusSchema = import_zod63.z.object({
5673
+ remaining_count: import_zod63.z.int(),
5674
+ total_generated: import_zod63.z.int(),
5675
+ warning: import_zod63.z.string().nullable().optional()
5483
5676
  });
5484
5677
 
5485
5678
  // src/generated/cfg_totp/_utils/schemas/ConfirmSetupRequest.schema.ts
5486
- var import_zod63 = require("zod");
5487
- var ConfirmSetupRequestSchema = import_zod63.z.object({
5488
- device_id: import_zod63.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5489
- code: import_zod63.z.string().min(6).max(6)
5679
+ var import_zod64 = require("zod");
5680
+ var ConfirmSetupRequestSchema = import_zod64.z.object({
5681
+ device_id: import_zod64.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5682
+ code: import_zod64.z.string().min(6).max(6)
5490
5683
  });
5491
5684
 
5492
5685
  // src/generated/cfg_totp/_utils/schemas/ConfirmSetupResponse.schema.ts
5493
- var import_zod64 = require("zod");
5494
- var ConfirmSetupResponseSchema = import_zod64.z.object({
5495
- message: import_zod64.z.string(),
5496
- backup_codes: import_zod64.z.array(import_zod64.z.string()),
5497
- backup_codes_warning: import_zod64.z.string()
5686
+ var import_zod65 = require("zod");
5687
+ var ConfirmSetupResponseSchema = import_zod65.z.object({
5688
+ message: import_zod65.z.string(),
5689
+ backup_codes: import_zod65.z.array(import_zod65.z.string()),
5690
+ backup_codes_warning: import_zod65.z.string()
5498
5691
  });
5499
5692
 
5500
5693
  // src/generated/cfg_totp/_utils/schemas/DeviceList.schema.ts
5501
- var import_zod65 = require("zod");
5502
- var DeviceListSchema = import_zod65.z.object({
5503
- id: import_zod65.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5504
- name: import_zod65.z.string(),
5505
- is_primary: import_zod65.z.boolean(),
5506
- status: import_zod65.z.nativeEnum(DeviceListStatus),
5507
- created_at: import_zod65.z.iso.datetime(),
5508
- confirmed_at: import_zod65.z.iso.datetime().nullable(),
5509
- last_used_at: import_zod65.z.iso.datetime().nullable()
5694
+ var import_zod66 = require("zod");
5695
+ var DeviceListSchema = import_zod66.z.object({
5696
+ id: import_zod66.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5697
+ name: import_zod66.z.string(),
5698
+ is_primary: import_zod66.z.boolean(),
5699
+ status: import_zod66.z.nativeEnum(DeviceListStatus),
5700
+ created_at: import_zod66.z.iso.datetime(),
5701
+ confirmed_at: import_zod66.z.iso.datetime().nullable(),
5702
+ last_used_at: import_zod66.z.iso.datetime().nullable()
5510
5703
  });
5511
5704
 
5512
5705
  // src/generated/cfg_totp/_utils/schemas/DisableRequest.schema.ts
5513
- var import_zod66 = require("zod");
5514
- var DisableRequestSchema = import_zod66.z.object({
5515
- code: import_zod66.z.string().min(6).max(6)
5706
+ var import_zod67 = require("zod");
5707
+ var DisableRequestSchema = import_zod67.z.object({
5708
+ code: import_zod67.z.string().min(6).max(6)
5516
5709
  });
5517
5710
 
5518
5711
  // src/generated/cfg_totp/_utils/schemas/PaginatedDeviceListList.schema.ts
5519
- var import_zod67 = require("zod");
5520
- var PaginatedDeviceListListSchema = import_zod67.z.object({
5521
- count: import_zod67.z.int(),
5522
- page: import_zod67.z.int(),
5523
- pages: import_zod67.z.int(),
5524
- page_size: import_zod67.z.int(),
5525
- has_next: import_zod67.z.boolean(),
5526
- has_previous: import_zod67.z.boolean(),
5527
- next_page: import_zod67.z.int().nullable().optional(),
5528
- previous_page: import_zod67.z.int().nullable().optional(),
5529
- results: import_zod67.z.array(DeviceListSchema)
5712
+ var import_zod68 = require("zod");
5713
+ var PaginatedDeviceListListSchema = import_zod68.z.object({
5714
+ count: import_zod68.z.int(),
5715
+ page: import_zod68.z.int(),
5716
+ pages: import_zod68.z.int(),
5717
+ page_size: import_zod68.z.int(),
5718
+ has_next: import_zod68.z.boolean(),
5719
+ has_previous: import_zod68.z.boolean(),
5720
+ next_page: import_zod68.z.int().nullable().optional(),
5721
+ previous_page: import_zod68.z.int().nullable().optional(),
5722
+ results: import_zod68.z.array(DeviceListSchema)
5530
5723
  });
5531
5724
 
5532
5725
  // src/generated/cfg_totp/_utils/schemas/SetupRequest.schema.ts
5533
- var import_zod68 = require("zod");
5534
- var SetupRequestSchema = import_zod68.z.object({
5535
- device_name: import_zod68.z.string().min(1).max(100).optional()
5726
+ var import_zod69 = require("zod");
5727
+ var SetupRequestSchema = import_zod69.z.object({
5728
+ device_name: import_zod69.z.string().min(1).max(100).optional()
5536
5729
  });
5537
5730
 
5538
5731
  // src/generated/cfg_totp/_utils/schemas/SetupResponse.schema.ts
5539
- var import_zod69 = require("zod");
5540
- var SetupResponseSchema = import_zod69.z.object({
5541
- device_id: import_zod69.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5542
- secret: import_zod69.z.string(),
5543
- provisioning_uri: import_zod69.z.string(),
5544
- qr_code_base64: import_zod69.z.string(),
5545
- expires_in: import_zod69.z.int()
5732
+ var import_zod70 = require("zod");
5733
+ var SetupResponseSchema = import_zod70.z.object({
5734
+ device_id: import_zod70.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5735
+ secret: import_zod70.z.string(),
5736
+ provisioning_uri: import_zod70.z.string(),
5737
+ qr_code_base64: import_zod70.z.string(),
5738
+ expires_in: import_zod70.z.int()
5546
5739
  });
5547
5740
 
5548
5741
  // src/generated/cfg_totp/_utils/schemas/VerifyBackupRequest.schema.ts
5549
- var import_zod70 = require("zod");
5550
- var VerifyBackupRequestSchema = import_zod70.z.object({
5551
- session_id: import_zod70.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5552
- backup_code: import_zod70.z.string().min(8).max(8)
5742
+ var import_zod71 = require("zod");
5743
+ var VerifyBackupRequestSchema = import_zod71.z.object({
5744
+ session_id: import_zod71.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5745
+ backup_code: import_zod71.z.string().min(8).max(8)
5553
5746
  });
5554
5747
 
5555
5748
  // src/generated/cfg_totp/_utils/schemas/VerifyRequest.schema.ts
5556
- var import_zod71 = require("zod");
5557
- var VerifyRequestSchema = import_zod71.z.object({
5558
- session_id: import_zod71.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5559
- code: import_zod71.z.string().min(6).max(6)
5749
+ var import_zod72 = require("zod");
5750
+ var VerifyRequestSchema = import_zod72.z.object({
5751
+ session_id: import_zod72.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
5752
+ code: import_zod72.z.string().min(6).max(6)
5560
5753
  });
5561
5754
 
5562
5755
  // src/generated/cfg_totp/_utils/schemas/VerifyResponse.schema.ts
5563
- var import_zod72 = require("zod");
5564
- var VerifyResponseSchema = import_zod72.z.object({
5565
- message: import_zod72.z.string(),
5566
- access_token: import_zod72.z.string(),
5567
- refresh_token: import_zod72.z.string(),
5568
- user: import_zod72.z.record(import_zod72.z.string(), import_zod72.z.any()),
5569
- remaining_backup_codes: import_zod72.z.int().optional(),
5570
- warning: import_zod72.z.string().optional()
5756
+ var import_zod73 = require("zod");
5757
+ var VerifyResponseSchema = import_zod73.z.object({
5758
+ message: import_zod73.z.string(),
5759
+ access_token: import_zod73.z.string(),
5760
+ refresh_token: import_zod73.z.string(),
5761
+ user: import_zod73.z.record(import_zod73.z.string(), import_zod73.z.any()),
5762
+ remaining_backup_codes: import_zod73.z.int().optional(),
5763
+ warning: import_zod73.z.string().optional()
5571
5764
  });
5572
5765
 
5573
5766
  // src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts
@@ -5596,7 +5789,8 @@ var API4 = class {
5596
5789
  this._loadTokensFromStorage();
5597
5790
  this._client = new APIClient4(this.baseUrl, {
5598
5791
  retryConfig: this.options?.retryConfig,
5599
- loggerConfig: this.options?.loggerConfig
5792
+ loggerConfig: this.options?.loggerConfig,
5793
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
5600
5794
  });
5601
5795
  this._injectAuthHeader();
5602
5796
  this.backup_codes = this._client.backup_codes;
@@ -5615,7 +5809,8 @@ var API4 = class {
5615
5809
  _reinitClients() {
5616
5810
  this._client = new APIClient4(this.baseUrl, {
5617
5811
  retryConfig: this.options?.retryConfig,
5618
- loggerConfig: this.options?.loggerConfig
5812
+ loggerConfig: this.options?.loggerConfig,
5813
+ tokenGetter: /* @__PURE__ */ __name(() => this.getToken(), "tokenGetter")
5619
5814
  });
5620
5815
  this._injectAuthHeader();
5621
5816
  this.backup_codes = this._client.backup_codes;
@@ -5757,14 +5952,14 @@ var apiCentrifugo = new API2(apiUrl2, { storage });
5757
5952
  var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
5758
5953
  const { onSuccess, onError, redirectUrl, skipRedirect = false } = options;
5759
5954
  const router = (0, import_hooks4.useCfgRouter)();
5760
- const [isLoading, setIsLoading] = (0, import_react7.useState)(false);
5761
- const [error, setError] = (0, import_react7.useState)(null);
5762
- const [warning, setWarning] = (0, import_react7.useState)(null);
5763
- const [remainingBackupCodes, setRemainingBackupCodes] = (0, import_react7.useState)(null);
5764
- const clearError = (0, import_react7.useCallback)(() => {
5955
+ const [isLoading, setIsLoading] = (0, import_react8.useState)(false);
5956
+ const [error, setError] = (0, import_react8.useState)(null);
5957
+ const [warning, setWarning] = (0, import_react8.useState)(null);
5958
+ const [remainingBackupCodes, setRemainingBackupCodes] = (0, import_react8.useState)(null);
5959
+ const clearError = (0, import_react8.useCallback)(() => {
5765
5960
  setError(null);
5766
5961
  }, []);
5767
- const handleSuccess = (0, import_react7.useCallback)((response) => {
5962
+ const handleSuccess = (0, import_react8.useCallback)((response) => {
5768
5963
  apiAccounts.setToken(response.access_token, response.refresh_token);
5769
5964
  if (response.warning) {
5770
5965
  setWarning(response.warning);
@@ -5786,7 +5981,7 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
5786
5981
  router.hardPush(finalRedirectUrl);
5787
5982
  }
5788
5983
  }, [onSuccess, redirectUrl, router, skipRedirect]);
5789
- const verifyTOTP = (0, import_react7.useCallback)(async (sessionId, code) => {
5984
+ const verifyTOTP = (0, import_react8.useCallback)(async (sessionId, code) => {
5790
5985
  if (!sessionId) {
5791
5986
  const msg = "Missing 2FA session ID";
5792
5987
  setError(msg);
@@ -5826,7 +6021,7 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
5826
6021
  setIsLoading(false);
5827
6022
  }
5828
6023
  }, [handleSuccess, onError]);
5829
- const verifyBackupCode = (0, import_react7.useCallback)(async (sessionId, backupCode) => {
6024
+ const verifyBackupCode = (0, import_react8.useCallback)(async (sessionId, backupCode) => {
5830
6025
  if (!sessionId) {
5831
6026
  const msg = "Missing 2FA session ID";
5832
6027
  setError(msg);
@@ -5892,7 +6087,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
5892
6087
  } = options;
5893
6088
  const formState = useAuthFormState();
5894
6089
  const validation = useAuthValidation();
5895
- const isAutoSubmitFromUrlRef = (0, import_react8.useRef)(false);
6090
+ const isAutoSubmitFromUrlRef = (0, import_react9.useRef)(false);
5896
6091
  const {
5897
6092
  requestOTP,
5898
6093
  verifyOTP,
@@ -5939,7 +6134,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
5939
6134
  // We handle navigation via success step
5940
6135
  });
5941
6136
  const { detectChannelFromIdentifier: detectChannelFromIdentifier2, validateIdentifier: validateIdentifier2 } = validation;
5942
- const saveIdentifierToStorage = (0, import_react8.useCallback)((id, ch) => {
6137
+ const saveIdentifierToStorage = (0, import_react9.useCallback)((id, ch) => {
5943
6138
  if (ch === "email") {
5944
6139
  saveEmail(id);
5945
6140
  clearSavedPhone();
@@ -5948,7 +6143,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
5948
6143
  clearSavedEmail();
5949
6144
  }
5950
6145
  }, [saveEmail, savePhone, clearSavedEmail, clearSavedPhone]);
5951
- (0, import_react8.useEffect)(() => {
6146
+ (0, import_react9.useEffect)(() => {
5952
6147
  const savedPhone = getSavedPhone();
5953
6148
  const savedEmail = getSavedEmail();
5954
6149
  if (savedPhone) {
@@ -5959,7 +6154,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
5959
6154
  setChannel("email");
5960
6155
  }
5961
6156
  }, [getSavedEmail, getSavedPhone, setIdentifier, setChannel]);
5962
- (0, import_react8.useEffect)(() => {
6157
+ (0, import_react9.useEffect)(() => {
5963
6158
  if (identifier) {
5964
6159
  const detected = detectChannelFromIdentifier2(identifier);
5965
6160
  if (detected && detected !== channel) {
@@ -5967,7 +6162,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
5967
6162
  }
5968
6163
  }
5969
6164
  }, [identifier, channel, detectChannelFromIdentifier2, setChannel]);
5970
- const handleIdentifierSubmit = (0, import_react8.useCallback)(async (e) => {
6165
+ const handleIdentifierSubmit = (0, import_react9.useCallback)(async (e) => {
5971
6166
  e.preventDefault();
5972
6167
  if (!identifier) {
5973
6168
  const msg = channel === "phone" ? "Please enter your phone number" : "Please enter your email address";
@@ -6022,7 +6217,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
6022
6217
  onError,
6023
6218
  sourceUrl
6024
6219
  ]);
6025
- const submitOTP = (0, import_react8.useCallback)(async (submitIdentifier, submitOtp, submitChannel) => {
6220
+ const submitOTP = (0, import_react9.useCallback)(async (submitIdentifier, submitOtp, submitChannel) => {
6026
6221
  if (!submitOtp || submitOtp.length < 6) {
6027
6222
  const msg = "Please enter the 6-digit verification code";
6028
6223
  setError(msg);
@@ -6072,11 +6267,11 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
6072
6267
  setIsLoading(false);
6073
6268
  }
6074
6269
  }, [verifyOTP, saveIdentifierToStorage, setError, setIsLoading, clearError, onOTPSuccess, onError, sourceUrl, redirectUrl, setTwoFactorSessionId, setShouldPrompt2FA, setStep, enable2FASetup]);
6075
- const handleOTPSubmit = (0, import_react8.useCallback)(async (e) => {
6270
+ const handleOTPSubmit = (0, import_react9.useCallback)(async (e) => {
6076
6271
  e.preventDefault();
6077
6272
  await submitOTP(identifier, otp, channel);
6078
6273
  }, [identifier, otp, channel, submitOTP]);
6079
- const handleResendOTP = (0, import_react8.useCallback)(async () => {
6274
+ const handleResendOTP = (0, import_react9.useCallback)(async () => {
6080
6275
  setIsLoading(true);
6081
6276
  clearError();
6082
6277
  try {
@@ -6096,15 +6291,15 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
6096
6291
  setIsLoading(false);
6097
6292
  }
6098
6293
  }, [identifier, channel, requestOTP, saveIdentifierToStorage, setOtp, setError, setIsLoading, clearError, onError, sourceUrl]);
6099
- const handleBackToIdentifier = (0, import_react8.useCallback)(() => {
6294
+ const handleBackToIdentifier = (0, import_react9.useCallback)(() => {
6100
6295
  setStep("identifier");
6101
6296
  clearError();
6102
6297
  }, [setStep, clearError]);
6103
- const forceOTPStep = (0, import_react8.useCallback)(() => {
6298
+ const forceOTPStep = (0, import_react9.useCallback)(() => {
6104
6299
  setStep("otp");
6105
6300
  clearError();
6106
6301
  }, [setStep, clearError]);
6107
- const handle2FASubmit = (0, import_react8.useCallback)(async (e) => {
6302
+ const handle2FASubmit = (0, import_react9.useCallback)(async (e) => {
6108
6303
  e.preventDefault();
6109
6304
  if (!twoFactorSessionId) {
6110
6305
  const msg = "Missing 2FA session";
@@ -6118,12 +6313,12 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
6118
6313
  await twoFactor.verifyTOTP(twoFactorSessionId, twoFactorCode);
6119
6314
  }
6120
6315
  }, [twoFactorSessionId, twoFactorCode, useBackupCode, twoFactor, setError, onError]);
6121
- const handleUseBackupCode = (0, import_react8.useCallback)(() => {
6316
+ const handleUseBackupCode = (0, import_react9.useCallback)(() => {
6122
6317
  setUseBackupCode(true);
6123
6318
  setTwoFactorCode("");
6124
6319
  clearError();
6125
6320
  }, [setUseBackupCode, setTwoFactorCode, clearError]);
6126
- const handleUseTOTP = (0, import_react8.useCallback)(() => {
6321
+ const handleUseTOTP = (0, import_react9.useCallback)(() => {
6127
6322
  setUseBackupCode(false);
6128
6323
  setTwoFactorCode("");
6129
6324
  clearError();
@@ -6188,14 +6383,14 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
6188
6383
  }, "useAuthForm");
6189
6384
 
6190
6385
  // src/auth/hooks/useGithubAuth.ts
6191
- var import_react9 = require("react");
6386
+ var import_react10 = require("react");
6192
6387
  var import_hooks5 = require("@djangocfg/ui-nextjs/hooks");
6193
6388
  var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
6194
6389
  const { sourceUrl, onSuccess, onError, onRequires2FA, redirectUrl, skipRedirect = false } = options;
6195
6390
  const router = (0, import_hooks5.useCfgRouter)();
6196
- const [isLoading, setIsLoading] = (0, import_react9.useState)(false);
6197
- const [error, setError] = (0, import_react9.useState)(null);
6198
- const startGithubAuth = (0, import_react9.useCallback)(async () => {
6391
+ const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
6392
+ const [error, setError] = (0, import_react10.useState)(null);
6393
+ const startGithubAuth = (0, import_react10.useCallback)(async () => {
6199
6394
  setIsLoading(true);
6200
6395
  setError(null);
6201
6396
  try {
@@ -6229,7 +6424,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
6229
6424
  setIsLoading(false);
6230
6425
  }
6231
6426
  }, [sourceUrl, onError]);
6232
- const handleGithubCallback = (0, import_react9.useCallback)(async (code, state) => {
6427
+ const handleGithubCallback = (0, import_react10.useCallback)(async (code, state) => {
6233
6428
  setIsLoading(true);
6234
6429
  setError(null);
6235
6430
  try {
@@ -6294,26 +6489,26 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
6294
6489
  }, "useGithubAuth");
6295
6490
 
6296
6491
  // src/auth/hooks/useTwoFactorSetup.ts
6297
- var import_react10 = require("react");
6492
+ var import_react11 = require("react");
6298
6493
  var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
6299
6494
  const { onComplete, onError } = options;
6300
- const [isLoading, setIsLoading] = (0, import_react10.useState)(false);
6301
- const [error, setError] = (0, import_react10.useState)(null);
6302
- const [setupData, setSetupData] = (0, import_react10.useState)(null);
6303
- const [backupCodes, setBackupCodes] = (0, import_react10.useState)(null);
6304
- const [backupCodesWarning, setBackupCodesWarning] = (0, import_react10.useState)(null);
6305
- const [setupStep, setSetupStep] = (0, import_react10.useState)("idle");
6306
- const clearError = (0, import_react10.useCallback)(() => {
6495
+ const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
6496
+ const [error, setError] = (0, import_react11.useState)(null);
6497
+ const [setupData, setSetupData] = (0, import_react11.useState)(null);
6498
+ const [backupCodes, setBackupCodes] = (0, import_react11.useState)(null);
6499
+ const [backupCodesWarning, setBackupCodesWarning] = (0, import_react11.useState)(null);
6500
+ const [setupStep, setSetupStep] = (0, import_react11.useState)("idle");
6501
+ const clearError = (0, import_react11.useCallback)(() => {
6307
6502
  setError(null);
6308
6503
  }, []);
6309
- const resetSetup = (0, import_react10.useCallback)(() => {
6504
+ const resetSetup = (0, import_react11.useCallback)(() => {
6310
6505
  setSetupData(null);
6311
6506
  setBackupCodes(null);
6312
6507
  setBackupCodesWarning(null);
6313
6508
  setSetupStep("idle");
6314
6509
  setError(null);
6315
6510
  }, []);
6316
- const startSetup = (0, import_react10.useCallback)(async (deviceName) => {
6511
+ const startSetup = (0, import_react11.useCallback)(async (deviceName) => {
6317
6512
  setIsLoading(true);
6318
6513
  setError(null);
6319
6514
  setSetupStep("scanning");
@@ -6343,7 +6538,7 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
6343
6538
  setIsLoading(false);
6344
6539
  }
6345
6540
  }, [onError]);
6346
- const confirmSetup = (0, import_react10.useCallback)(async (code) => {
6541
+ const confirmSetup = (0, import_react11.useCallback)(async (code) => {
6347
6542
  if (!setupData) {
6348
6543
  const msg = "Setup not started. Call startSetup() first.";
6349
6544
  setError(msg);
@@ -6398,16 +6593,16 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
6398
6593
  }, "useTwoFactorSetup");
6399
6594
 
6400
6595
  // src/auth/hooks/useTwoFactorStatus.ts
6401
- var import_react11 = require("react");
6596
+ var import_react12 = require("react");
6402
6597
  var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
6403
- const [isLoading, setIsLoading] = (0, import_react11.useState)(false);
6404
- const [error, setError] = (0, import_react11.useState)(null);
6405
- const [has2FAEnabled, setHas2FAEnabled] = (0, import_react11.useState)(null);
6406
- const [devices, setDevices] = (0, import_react11.useState)([]);
6407
- const clearError = (0, import_react11.useCallback)(() => {
6598
+ const [isLoading, setIsLoading] = (0, import_react12.useState)(false);
6599
+ const [error, setError] = (0, import_react12.useState)(null);
6600
+ const [has2FAEnabled, setHas2FAEnabled] = (0, import_react12.useState)(null);
6601
+ const [devices, setDevices] = (0, import_react12.useState)([]);
6602
+ const clearError = (0, import_react12.useCallback)(() => {
6408
6603
  setError(null);
6409
6604
  }, []);
6410
- const fetchStatus = (0, import_react11.useCallback)(async () => {
6605
+ const fetchStatus = (0, import_react12.useCallback)(async () => {
6411
6606
  setIsLoading(true);
6412
6607
  setError(null);
6413
6608
  try {
@@ -6432,7 +6627,7 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
6432
6627
  setIsLoading(false);
6433
6628
  }
6434
6629
  }, []);
6435
- const disable2FA = (0, import_react11.useCallback)(async (code) => {
6630
+ const disable2FA = (0, import_react12.useCallback)(async (code) => {
6436
6631
  if (!code || code.length !== 6) {
6437
6632
  setError("Please enter a 6-digit code");
6438
6633
  return false;
@@ -6467,14 +6662,14 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
6467
6662
  }, "useTwoFactorStatus");
6468
6663
 
6469
6664
  // src/auth/hooks/useAuthGuard.ts
6470
- var import_react12 = require("react");
6665
+ var import_react13 = require("react");
6471
6666
  var import_hooks6 = require("@djangocfg/ui-nextjs/hooks");
6472
6667
  var useAuthGuard = /* @__PURE__ */ __name((options = {}) => {
6473
6668
  const { redirectTo = "/auth", requireAuth = true, saveRedirectUrl: shouldSaveUrl = true } = options;
6474
6669
  const { isAuthenticated, isLoading, saveRedirectUrl } = useAuth();
6475
6670
  const router = (0, import_hooks6.useCfgRouter)();
6476
- const [isRedirecting, setIsRedirecting] = (0, import_react12.useState)(false);
6477
- (0, import_react12.useEffect)(() => {
6671
+ const [isRedirecting, setIsRedirecting] = (0, import_react13.useState)(false);
6672
+ (0, import_react13.useEffect)(() => {
6478
6673
  if (!isLoading && requireAuth && !isAuthenticated && !isRedirecting) {
6479
6674
  if (shouldSaveUrl && typeof window !== "undefined") {
6480
6675
  const currentUrl = window.location.pathname + window.location.search;
@@ -6488,9 +6683,9 @@ var useAuthGuard = /* @__PURE__ */ __name((options = {}) => {
6488
6683
  }, "useAuthGuard");
6489
6684
 
6490
6685
  // src/auth/hooks/useLocalStorage.ts
6491
- var import_react13 = require("react");
6686
+ var import_react14 = require("react");
6492
6687
  function useLocalStorage2(key, initialValue) {
6493
- const [storedValue, setStoredValue] = (0, import_react13.useState)(() => {
6688
+ const [storedValue, setStoredValue] = (0, import_react14.useState)(() => {
6494
6689
  if (typeof window === "undefined") {
6495
6690
  return initialValue;
6496
6691
  }