@djangocfg/api 2.1.591 → 2.1.592

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/auth.mjs CHANGED
@@ -20,7 +20,7 @@ import { usePathname as usePathname3 } from "next/navigation";
20
20
  import {
21
21
  createContext as createContext2,
22
22
  memo,
23
- useCallback as useCallback11,
23
+ useCallback as useCallback12,
24
24
  useContext as useContext2,
25
25
  useEffect as useEffect6,
26
26
  useMemo as useMemo3,
@@ -390,6 +390,14 @@ function defaultBaseUrl() {
390
390
  return "";
391
391
  }
392
392
  __name(defaultBaseUrl, "defaultBaseUrl");
393
+ function detectTimezone() {
394
+ try {
395
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || null;
396
+ } catch {
397
+ return null;
398
+ }
399
+ }
400
+ __name(detectTimezone, "detectTimezone");
393
401
  function defaultApiKey() {
394
402
  try {
395
403
  if (typeof process !== "undefined" && process.env?.NEXT_PUBLIC_API_KEY) {
@@ -401,6 +409,7 @@ function defaultApiKey() {
401
409
  }
402
410
  __name(defaultApiKey, "defaultApiKey");
403
411
  var _localeOverride = null;
412
+ var _timezoneOverride = null;
404
413
  var _apiKeyOverride = null;
405
414
  var _baseUrlOverride = null;
406
415
  var _withCredentials = true;
@@ -627,6 +636,14 @@ var auth = {
627
636
  setLocale(locale) {
628
637
  _localeOverride = locale;
629
638
  },
639
+ // ── Time zone ─────────────────────────────────────────────────────
640
+ // IANA name sent as `X-Timezone`. `null` override = follow the browser.
641
+ getTimezone() {
642
+ return _timezoneOverride ?? detectTimezone();
643
+ },
644
+ setTimezone(timezone) {
645
+ _timezoneOverride = timezone;
646
+ },
630
647
  // ── Base URL ──────────────────────────────────────────────────────
631
648
  getBaseUrl() {
632
649
  const url = _baseUrlOverride ?? defaultBaseUrl();
@@ -834,11 +851,8 @@ function installAuthOnClient(client2) {
834
851
  if (locale) request.headers.set("Accept-Language", locale);
835
852
  const apiKey = auth.getApiKey();
836
853
  if (apiKey && !request.headers.has("X-API-Key")) request.headers.set("X-API-Key", apiKey);
837
- try {
838
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
839
- if (tz) request.headers.set("X-Timezone", tz);
840
- } catch {
841
- }
854
+ const tz = auth.getTimezone();
855
+ if (tz) request.headers.set("X-Timezone", tz);
842
856
  request.headers.set("X-Client-Time", (/* @__PURE__ */ new Date()).toISOString());
843
857
  if (dpopEnabled() && typeof window !== "undefined") {
844
858
  const proof = await _makeDpopProof(request.method, request.url);
@@ -1049,9 +1063,54 @@ function useSession() {
1049
1063
  }
1050
1064
  __name(useSession, "useSession");
1051
1065
 
1066
+ // src/auth/hooks/useTimezone.ts
1067
+ import { useCallback, useSyncExternalStore as useSyncExternalStore2 } from "react";
1068
+ var STORAGE_KEY = "djangocfg.timezone";
1069
+ var listeners = /* @__PURE__ */ new Set();
1070
+ function read() {
1071
+ try {
1072
+ return localStorage.getItem(STORAGE_KEY) || null;
1073
+ } catch {
1074
+ return null;
1075
+ }
1076
+ }
1077
+ __name(read, "read");
1078
+ function hydrate() {
1079
+ if (typeof window === "undefined") return;
1080
+ auth.setTimezone(read());
1081
+ }
1082
+ __name(hydrate, "hydrate");
1083
+ hydrate();
1084
+ function write(timezone) {
1085
+ try {
1086
+ if (timezone) localStorage.setItem(STORAGE_KEY, timezone);
1087
+ else localStorage.removeItem(STORAGE_KEY);
1088
+ } catch {
1089
+ }
1090
+ auth.setTimezone(timezone);
1091
+ listeners.forEach((l) => l());
1092
+ }
1093
+ __name(write, "write");
1094
+ function subscribe(listener) {
1095
+ listeners.add(listener);
1096
+ return () => listeners.delete(listener);
1097
+ }
1098
+ __name(subscribe, "subscribe");
1099
+ function useTimezone() {
1100
+ const preference = useSyncExternalStore2(subscribe, read, () => null);
1101
+ const setTimezone = useCallback((tz) => write(tz), []);
1102
+ return {
1103
+ timezone: preference ?? auth.getTimezone(),
1104
+ preference,
1105
+ isAuto: preference === null,
1106
+ setTimezone
1107
+ };
1108
+ }
1109
+ __name(useTimezone, "useTimezone");
1110
+
1052
1111
  // src/auth/hooks/useCfgRouter.ts
1053
1112
  import { useRouter as useNextRouter } from "next/navigation";
1054
- import { useCallback, useMemo } from "react";
1113
+ import { useCallback as useCallback2, useMemo } from "react";
1055
1114
  function getBasePath() {
1056
1115
  if (typeof process === "undefined") {
1057
1116
  return "";
@@ -1071,36 +1130,36 @@ __name(withBasePath, "withBasePath");
1071
1130
  function useCfgRouter() {
1072
1131
  const router = useNextRouter();
1073
1132
  const basePath = useMemo(() => getBasePath(), []);
1074
- const push = useCallback((href, options) => {
1133
+ const push = useCallback2((href, options) => {
1075
1134
  if (basePath) {
1076
1135
  window.location.href = withBasePath(href, basePath);
1077
1136
  } else {
1078
1137
  router.push(href, options);
1079
1138
  }
1080
1139
  }, [router, basePath]);
1081
- const replace = useCallback((href, options) => {
1140
+ const replace = useCallback2((href, options) => {
1082
1141
  if (basePath) {
1083
1142
  window.location.replace(withBasePath(href, basePath));
1084
1143
  } else {
1085
1144
  router.replace(href, options);
1086
1145
  }
1087
1146
  }, [router, basePath]);
1088
- const hardPush = useCallback((href) => {
1147
+ const hardPush = useCallback2((href) => {
1089
1148
  window.location.href = withBasePath(href, basePath);
1090
1149
  }, [basePath]);
1091
- const hardReplace = useCallback((href) => {
1150
+ const hardReplace = useCallback2((href) => {
1092
1151
  window.location.replace(withBasePath(href, basePath));
1093
1152
  }, [basePath]);
1094
- const prefetch = useCallback((href) => {
1153
+ const prefetch = useCallback2((href) => {
1095
1154
  router.prefetch(href);
1096
1155
  }, [router]);
1097
- const back = useCallback(() => {
1156
+ const back = useCallback2(() => {
1098
1157
  router.back();
1099
1158
  }, [router]);
1100
- const forward = useCallback(() => {
1159
+ const forward = useCallback2(() => {
1101
1160
  router.forward();
1102
1161
  }, [router]);
1103
- const refresh = useCallback(() => {
1162
+ const refresh = useCallback2(() => {
1104
1163
  router.refresh();
1105
1164
  }, [router]);
1106
1165
  return {
@@ -1162,7 +1221,7 @@ function useQueryParams() {
1162
1221
  __name(useQueryParams, "useQueryParams");
1163
1222
 
1164
1223
  // src/auth/hooks/useAuthFormState.ts
1165
- import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
1224
+ import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
1166
1225
  var formatCountdown = /* @__PURE__ */ __name((s) => {
1167
1226
  if (s <= 0) return "";
1168
1227
  const m = Math.floor(s / 60);
@@ -1171,7 +1230,7 @@ var formatCountdown = /* @__PURE__ */ __name((s) => {
1171
1230
  var useCountdown = /* @__PURE__ */ __name(() => {
1172
1231
  const [seconds, setSeconds] = useState2(0);
1173
1232
  const timerRef = useRef2(null);
1174
- const start = useCallback2((from) => {
1233
+ const start = useCallback3((from) => {
1175
1234
  if (timerRef.current) clearInterval(timerRef.current);
1176
1235
  setSeconds(from);
1177
1236
  timerRef.current = setInterval(() => {
@@ -1202,7 +1261,7 @@ var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "") => {
1202
1261
  const [webmail, setWebmail] = useState2(null);
1203
1262
  const rateLimit = useCountdown();
1204
1263
  const resend = useCountdown();
1205
- const clearError = useCallback2(() => setError(""), []);
1264
+ const clearError = useCallback3(() => setError(""), []);
1206
1265
  return {
1207
1266
  // State
1208
1267
  identifier,
@@ -1236,10 +1295,10 @@ var useAuthFormState = /* @__PURE__ */ __name((initialIdentifier = "") => {
1236
1295
  }, "useAuthFormState");
1237
1296
 
1238
1297
  // src/auth/hooks/useAuthValidation.ts
1239
- import { useCallback as useCallback3 } from "react";
1298
+ import { useCallback as useCallback4 } from "react";
1240
1299
  var EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
1241
1300
  var useAuthValidation = /* @__PURE__ */ __name(() => {
1242
- const validateIdentifier2 = useCallback3((id) => {
1301
+ const validateIdentifier2 = useCallback4((id) => {
1243
1302
  return EMAIL_REGEX.test(id);
1244
1303
  }, []);
1245
1304
  return { validateIdentifier: validateIdentifier2 };
@@ -1247,7 +1306,7 @@ var useAuthValidation = /* @__PURE__ */ __name(() => {
1247
1306
  var validateIdentifier = /* @__PURE__ */ __name((id) => EMAIL_REGEX.test(id), "validateIdentifier");
1248
1307
 
1249
1308
  // src/auth/hooks/useAuthForm.ts
1250
- import { useCallback as useCallback4, useEffect as useEffect4, useRef as useRef4 } from "react";
1309
+ import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef4 } from "react";
1251
1310
 
1252
1311
  // src/auth/utils/logger.ts
1253
1312
  import { createConsola as createConsola2 } from "consola";
@@ -1313,22 +1372,22 @@ var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
1313
1372
  }, "useAutoAuth");
1314
1373
 
1315
1374
  // src/auth/hooks/useTwoFactorChallenge.ts
1316
- import { useSyncExternalStore as useSyncExternalStore2 } from "react";
1375
+ import { useSyncExternalStore as useSyncExternalStore3 } from "react";
1317
1376
  var current = null;
1318
- var listeners = /* @__PURE__ */ new Set();
1377
+ var listeners2 = /* @__PURE__ */ new Set();
1319
1378
  var set = /* @__PURE__ */ __name((next) => {
1320
1379
  current = next;
1321
- for (const listener of [...listeners]) listener();
1380
+ for (const listener of [...listeners2]) listener();
1322
1381
  }, "set");
1323
- var subscribe = /* @__PURE__ */ __name((listener) => {
1324
- listeners.add(listener);
1382
+ var subscribe2 = /* @__PURE__ */ __name((listener) => {
1383
+ listeners2.add(listener);
1325
1384
  return () => {
1326
- listeners.delete(listener);
1385
+ listeners2.delete(listener);
1327
1386
  };
1328
1387
  }, "subscribe");
1329
1388
  var beginTwoFactorChallenge = /* @__PURE__ */ __name((challenge) => set(challenge), "beginTwoFactorChallenge");
1330
1389
  var endTwoFactorChallenge = /* @__PURE__ */ __name(() => set(null), "endTwoFactorChallenge");
1331
- var useTwoFactorChallenge = /* @__PURE__ */ __name(() => useSyncExternalStore2(subscribe, () => current, () => null), "useTwoFactorChallenge");
1390
+ var useTwoFactorChallenge = /* @__PURE__ */ __name(() => useSyncExternalStore3(subscribe2, () => current, () => null), "useTwoFactorChallenge");
1332
1391
 
1333
1392
  // src/auth/hooks/useAuthForm.ts
1334
1393
  var useAuthForm = /* @__PURE__ */ __name((options) => {
@@ -1370,7 +1429,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1370
1429
  setWebmail
1371
1430
  } = formState;
1372
1431
  const { validateIdentifier: validateIdentifier2 } = validation;
1373
- const saveIdentifierToStorage = useCallback4((id) => {
1432
+ const saveIdentifierToStorage = useCallback5((id) => {
1374
1433
  saveEmail(id);
1375
1434
  }, [saveEmail]);
1376
1435
  useEffect4(() => {
@@ -1379,7 +1438,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1379
1438
  setIdentifier(savedEmail);
1380
1439
  }
1381
1440
  }, []);
1382
- const handleIdentifierSubmit = useCallback4(async (e) => {
1441
+ const handleIdentifierSubmit = useCallback5(async (e) => {
1383
1442
  e.preventDefault();
1384
1443
  if (!identifier) {
1385
1444
  const msg = "Please enter your email address";
@@ -1445,7 +1504,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1445
1504
  onError,
1446
1505
  sourceUrl
1447
1506
  ]);
1448
- const submitOTP = useCallback4(async (submitIdentifier, submitOtp) => {
1507
+ const submitOTP = useCallback5(async (submitIdentifier, submitOtp) => {
1449
1508
  if (!submitOtp || submitOtp.length < AUTH_CONSTANTS.EMAIL_OTP_LENGTH) {
1450
1509
  const msg = `Please enter the ${AUTH_CONSTANTS.EMAIL_OTP_LENGTH}-digit verification code`;
1451
1510
  setError(msg);
@@ -1482,11 +1541,11 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1482
1541
  setIsLoading(false);
1483
1542
  }
1484
1543
  }, [verifyOTP, saveIdentifierToStorage, setError, setIsLoading, clearError, onOTPSuccess, onError, sourceUrl, redirectUrl, setStep]);
1485
- const handleOTPSubmit = useCallback4(async (e) => {
1544
+ const handleOTPSubmit = useCallback5(async (e) => {
1486
1545
  e.preventDefault();
1487
1546
  await submitOTP(identifier, otp);
1488
1547
  }, [identifier, otp, submitOTP]);
1489
- const submitPassword = useCallback4(async (submitIdentifier, submitPassword_) => {
1548
+ const submitPassword = useCallback5(async (submitIdentifier, submitPassword_) => {
1490
1549
  if (!submitIdentifier || !validateIdentifier2(submitIdentifier)) {
1491
1550
  const msg = "Please enter a valid email address";
1492
1551
  setError(msg);
@@ -1548,11 +1607,11 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1548
1607
  redirectUrl,
1549
1608
  setStep
1550
1609
  ]);
1551
- const handlePasswordSubmit = useCallback4(async (e) => {
1610
+ const handlePasswordSubmit = useCallback5(async (e) => {
1552
1611
  e.preventDefault();
1553
1612
  await submitPassword(identifier, password);
1554
1613
  }, [identifier, password, submitPassword]);
1555
- const handleResendOTP = useCallback4(async () => {
1614
+ const handleResendOTP = useCallback5(async () => {
1556
1615
  setIsLoading(true);
1557
1616
  clearError();
1558
1617
  try {
@@ -1580,15 +1639,15 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1580
1639
  setIsLoading(false);
1581
1640
  }
1582
1641
  }, [identifier, marketingConsent, marketingConsentOption, requestOTP, saveIdentifierToStorage, setOtp, setError, setIsLoading, clearError, startRateLimitCountdown, startResendCountdown, setWebmail, onError, sourceUrl]);
1583
- const handleBackToIdentifier = useCallback4(() => {
1642
+ const handleBackToIdentifier = useCallback5(() => {
1584
1643
  setStep("identifier");
1585
1644
  clearError();
1586
1645
  }, [setStep, clearError]);
1587
- const forceOTPStep = useCallback4(() => {
1646
+ const forceOTPStep = useCallback5(() => {
1588
1647
  setStep("otp");
1589
1648
  clearError();
1590
1649
  }, [setStep, clearError]);
1591
- const handleOTPFromUrl = useCallback4((detectedOtp, detectedEmail) => {
1650
+ const handleOTPFromUrl = useCallback5((detectedOtp, detectedEmail) => {
1592
1651
  const autoIdentifier = detectedEmail || getSavedEmail() || "";
1593
1652
  if (!autoIdentifier) {
1594
1653
  authLogger.warn("No identifier found for auto-submit (no email in URL or storage)");
@@ -1634,7 +1693,7 @@ var useAuthForm = /* @__PURE__ */ __name((options) => {
1634
1693
  }, "useAuthForm");
1635
1694
 
1636
1695
  // src/auth/hooks/useGithubAuth.ts
1637
- import { useCallback as useCallback5, useState as useState3 } from "react";
1696
+ import { useCallback as useCallback6, useState as useState3 } from "react";
1638
1697
 
1639
1698
  // src/_api/generated/core/bodySerializer.gen.ts
1640
1699
  var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
@@ -3070,7 +3129,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
3070
3129
  const router = useCfgRouter();
3071
3130
  const [isLoading, setIsLoading] = useState3(false);
3072
3131
  const [error, setError] = useState3(null);
3073
- const startGithubAuth = useCallback5(async () => {
3132
+ const startGithubAuth = useCallback6(async () => {
3074
3133
  setIsLoading(true);
3075
3134
  setError(null);
3076
3135
  auth.clearSession();
@@ -3109,7 +3168,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
3109
3168
  setIsLoading(false);
3110
3169
  }
3111
3170
  }, [sourceUrl, onError]);
3112
- const handleGithubCallback = useCallback5(async (code, state) => {
3171
+ const handleGithubCallback = useCallback6(async (code, state) => {
3113
3172
  setIsLoading(true);
3114
3173
  setError(null);
3115
3174
  try {
@@ -3178,7 +3237,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
3178
3237
  }, "useGithubAuth");
3179
3238
 
3180
3239
  // src/auth/hooks/useTwoFactorVerify.ts
3181
- import { useCallback as useCallback6, useState as useState5 } from "react";
3240
+ import { useCallback as useCallback7, useState as useState5 } from "react";
3182
3241
 
3183
3242
  // src/auth/hooks/useSessionStorage.ts
3184
3243
  import { useState as useState4 } from "react";
@@ -3422,10 +3481,10 @@ var useTwoFactorVerify = /* @__PURE__ */ __name((options = {}) => {
3422
3481
  const [warning, setWarning] = useState5(null);
3423
3482
  const [remainingBackupCodes, setRemainingBackupCodes] = useState5(null);
3424
3483
  const [attemptsRemaining, setAttemptsRemaining] = useState5(null);
3425
- const clearError = useCallback6(() => {
3484
+ const clearError = useCallback7(() => {
3426
3485
  setError(null);
3427
3486
  }, []);
3428
- const handleSuccess = useCallback6((response) => {
3487
+ const handleSuccess = useCallback7((response) => {
3429
3488
  auth.setSession({ access: response.access_token, refresh: response.refresh_token });
3430
3489
  if (response.warning) {
3431
3490
  setWarning(response.warning);
@@ -3447,7 +3506,7 @@ var useTwoFactorVerify = /* @__PURE__ */ __name((options = {}) => {
3447
3506
  router.hardPush(finalRedirectUrl);
3448
3507
  }
3449
3508
  }, [onSuccess, redirectUrl, router, skipRedirect]);
3450
- const verifyTOTP = useCallback6(async (sessionId, code) => {
3509
+ const verifyTOTP = useCallback7(async (sessionId, code) => {
3451
3510
  if (!sessionId) {
3452
3511
  const msg = "Missing 2FA session ID";
3453
3512
  setError(msg);
@@ -3490,7 +3549,7 @@ var useTwoFactorVerify = /* @__PURE__ */ __name((options = {}) => {
3490
3549
  setIsLoading(false);
3491
3550
  }
3492
3551
  }, [handleSuccess, onError]);
3493
- const verifyBackupCode = useCallback6(async (sessionId, backupCode) => {
3552
+ const verifyBackupCode = useCallback7(async (sessionId, backupCode) => {
3494
3553
  if (!sessionId) {
3495
3554
  const msg = "Missing 2FA session ID";
3496
3555
  setError(msg);
@@ -3549,7 +3608,7 @@ var useTwoFactorVerify = /* @__PURE__ */ __name((options = {}) => {
3549
3608
  }, "useTwoFactorVerify");
3550
3609
 
3551
3610
  // src/auth/hooks/useTwoFactorSetup.ts
3552
- import { useCallback as useCallback7, useState as useState6 } from "react";
3611
+ import { useCallback as useCallback8, useState as useState6 } from "react";
3553
3612
  var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
3554
3613
  const { onComplete, onError } = options;
3555
3614
  const [isLoading, setIsLoading] = useState6(false);
@@ -3558,17 +3617,17 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
3558
3617
  const [backupCodes, setBackupCodes] = useState6(null);
3559
3618
  const [backupCodesWarning, setBackupCodesWarning] = useState6(null);
3560
3619
  const [setupStep, setSetupStep] = useState6("idle");
3561
- const clearError = useCallback7(() => {
3620
+ const clearError = useCallback8(() => {
3562
3621
  setError(null);
3563
3622
  }, []);
3564
- const resetSetup = useCallback7(() => {
3623
+ const resetSetup = useCallback8(() => {
3565
3624
  setSetupData(null);
3566
3625
  setBackupCodes(null);
3567
3626
  setBackupCodesWarning(null);
3568
3627
  setSetupStep("idle");
3569
3628
  setError(null);
3570
3629
  }, []);
3571
- const startSetup = useCallback7(async (deviceName) => {
3630
+ const startSetup = useCallback8(async (deviceName) => {
3572
3631
  setIsLoading(true);
3573
3632
  setError(null);
3574
3633
  setSetupStep("scanning");
@@ -3600,7 +3659,7 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
3600
3659
  setIsLoading(false);
3601
3660
  }
3602
3661
  }, [onError]);
3603
- const confirmSetup = useCallback7(async (code) => {
3662
+ const confirmSetup = useCallback8(async (code) => {
3604
3663
  if (!setupData) {
3605
3664
  const msg = "Setup not started. Call startSetup() first.";
3606
3665
  setError(msg);
@@ -3656,16 +3715,16 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
3656
3715
  }, "useTwoFactorSetup");
3657
3716
 
3658
3717
  // src/auth/hooks/useTwoFactorStatus.ts
3659
- import { useCallback as useCallback8, useState as useState7 } from "react";
3718
+ import { useCallback as useCallback9, useState as useState7 } from "react";
3660
3719
  var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
3661
3720
  const [isLoading, setIsLoading] = useState7(false);
3662
3721
  const [error, setError] = useState7(null);
3663
3722
  const [has2FAEnabled, setHas2FAEnabled] = useState7(null);
3664
3723
  const [devices, setDevices] = useState7([]);
3665
- const clearError = useCallback8(() => {
3724
+ const clearError = useCallback9(() => {
3666
3725
  setError(null);
3667
3726
  }, []);
3668
- const fetchStatus = useCallback8(async () => {
3727
+ const fetchStatus = useCallback9(async () => {
3669
3728
  setIsLoading(true);
3670
3729
  setError(null);
3671
3730
  try {
@@ -3690,7 +3749,7 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
3690
3749
  setIsLoading(false);
3691
3750
  }
3692
3751
  }, []);
3693
- const disable2FA = useCallback8(async (code) => {
3752
+ const disable2FA = useCallback9(async (code) => {
3694
3753
  if (!isValidTotpCode(code)) {
3695
3754
  setError("Please enter a 6-digit code");
3696
3755
  return false;
@@ -4016,15 +4075,15 @@ function getCacheMetadata() {
4016
4075
  __name(getCacheMetadata, "getCacheMetadata");
4017
4076
 
4018
4077
  // src/auth/hooks/useDeleteAccount.ts
4019
- import { useCallback as useCallback9, useState as useState9 } from "react";
4078
+ import { useCallback as useCallback10, useState as useState9 } from "react";
4020
4079
  var useDeleteAccount = /* @__PURE__ */ __name(() => {
4021
4080
  const [isLoading, setIsLoading] = useState9(false);
4022
4081
  const [error, setError] = useState9(null);
4023
4082
  const { logout } = useAuth();
4024
- const clearError = useCallback9(() => {
4083
+ const clearError = useCallback10(() => {
4025
4084
  setError(null);
4026
4085
  }, []);
4027
- const deleteAccount = useCallback9(async () => {
4086
+ const deleteAccount = useCallback10(async () => {
4028
4087
  setIsLoading(true);
4029
4088
  setError(null);
4030
4089
  try {
@@ -4056,7 +4115,7 @@ var useDeleteAccount = /* @__PURE__ */ __name(() => {
4056
4115
  // src/auth/context/AccountsContext.tsx
4057
4116
  import {
4058
4117
  createContext,
4059
- useCallback as useCallback10,
4118
+ useCallback as useCallback11,
4060
4119
  useContext,
4061
4120
  useEffect as useEffect5,
4062
4121
  useMemo as useMemo2,
@@ -4442,7 +4501,7 @@ function AccountsProvider({ children }) {
4442
4501
  const { trigger: triggerOtpRequest } = useCfgAccountsOtpRequestCreate();
4443
4502
  const { trigger: triggerOtpVerify } = useCfgAccountsOtpVerifyCreate();
4444
4503
  const { trigger: triggerPasswordLogin } = useCfgAccountsTokenCreate();
4445
- const refreshProfile = useCallback10(async (options) => {
4504
+ const refreshProfile = useCallback11(async (options) => {
4446
4505
  const { callerId, force } = options || {};
4447
4506
  if (!hasApiOrigin()) {
4448
4507
  authLogger.debug(`No API origin configured, skipping profile fetch (caller: ${callerId})`);
@@ -4476,26 +4535,26 @@ function AccountsProvider({ children }) {
4476
4535
  }
4477
4536
  }
4478
4537
  }, []);
4479
- const updateProfile = useCallback10(async (data) => {
4538
+ const updateProfile = useCallback11(async (data) => {
4480
4539
  await triggerProfileUpdate({ body: data });
4481
4540
  const user = await refreshProfile({ callerId: "updateProfile", force: true });
4482
4541
  return user;
4483
4542
  }, [triggerProfileUpdate, refreshProfile]);
4484
- const partialUpdateProfile = useCallback10(async (data) => {
4543
+ const partialUpdateProfile = useCallback11(async (data) => {
4485
4544
  await triggerProfilePartialUpdate({ body: data });
4486
4545
  const user = await refreshProfile({ callerId: "partialUpdateProfile", force: true });
4487
4546
  return user;
4488
4547
  }, [triggerProfilePartialUpdate, refreshProfile]);
4489
- const uploadAvatar = useCallback10(async (avatar) => {
4548
+ const uploadAvatar = useCallback11(async (avatar) => {
4490
4549
  await triggerAvatar({ body: { avatar } });
4491
4550
  const user = await refreshProfile({ callerId: "uploadAvatar", force: true });
4492
4551
  return user;
4493
4552
  }, [triggerAvatar, refreshProfile]);
4494
- const requestOTP = useCallback10(async (data) => {
4553
+ const requestOTP = useCallback11(async (data) => {
4495
4554
  const result = await triggerOtpRequest({ body: data });
4496
4555
  return result;
4497
4556
  }, [triggerOtpRequest]);
4498
- const settleLoginEnvelope = useCallback10(async (result, callerId) => {
4557
+ const settleLoginEnvelope = useCallback11(async (result, callerId) => {
4499
4558
  if (result.requires_2fa && result.session_id) {
4500
4559
  authLogger.info("2FA required, session:", result.session_id);
4501
4560
  return;
@@ -4509,17 +4568,17 @@ function AccountsProvider({ children }) {
4509
4568
  }
4510
4569
  }
4511
4570
  }, [refreshProfile]);
4512
- const verifyOTP = useCallback10(async (data) => {
4571
+ const verifyOTP = useCallback11(async (data) => {
4513
4572
  const result = await triggerOtpVerify({ body: data });
4514
4573
  await settleLoginEnvelope(result, "verifyOTP");
4515
4574
  return result;
4516
4575
  }, [triggerOtpVerify, settleLoginEnvelope]);
4517
- const loginWithPassword = useCallback10(async (data) => {
4576
+ const loginWithPassword = useCallback11(async (data) => {
4518
4577
  const result = await triggerPasswordLogin({ body: data });
4519
4578
  await settleLoginEnvelope(result, "loginWithPassword");
4520
4579
  return result;
4521
4580
  }, [triggerPasswordLogin, settleLoginEnvelope]);
4522
- const logout = useCallback10(() => {
4581
+ const logout = useCallback11(() => {
4523
4582
  const refresh = auth.getRefreshToken();
4524
4583
  if (refresh) {
4525
4584
  CfgAccountsAuth.cfgAccountsTokenBlacklistCreate({ body: { refresh } }).catch(() => {
@@ -4664,7 +4723,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4664
4723
  router.push(saved || routes.defaultCallback);
4665
4724
  }
4666
4725
  }, [isAuthenticated, pathname, queryParams, routes, router, redirectManager]);
4667
- const loadCurrentProfile = useCallback11(async (callerId) => {
4726
+ const loadCurrentProfile = useCallback12(async (callerId) => {
4668
4727
  if (!auth.isAuthenticated()) {
4669
4728
  throw new Error("No valid authentication token");
4670
4729
  }
@@ -4672,7 +4731,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4672
4731
  callerId: callerId || "AuthContext.loadCurrentProfile"
4673
4732
  });
4674
4733
  }, []);
4675
- const checkAuthAndRedirect = useCallback11(async () => {
4734
+ const checkAuthAndRedirect = useCallback12(async () => {
4676
4735
  if (auth.isAuthenticated()) {
4677
4736
  try {
4678
4737
  await loadCurrentProfile("checkAuthAndRedirect");
@@ -4684,7 +4743,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4684
4743
  router.push(routesRef.current.defaultAuthCallback);
4685
4744
  }
4686
4745
  }, [loadCurrentProfile, router]);
4687
- const requestOTP = useCallback11(
4746
+ const requestOTP = useCallback12(
4688
4747
  async (identifier, sourceUrl, consent) => {
4689
4748
  auth.clearSession();
4690
4749
  try {
@@ -4726,7 +4785,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4726
4785
  },
4727
4786
  []
4728
4787
  );
4729
- const verifyOTP = useCallback11(
4788
+ const verifyOTP = useCallback12(
4730
4789
  async (identifier, otpCode, sourceUrl, redirectUrl, skipRedirect) => {
4731
4790
  try {
4732
4791
  pendingManualNavRef.current = Boolean(skipRedirect);
@@ -4786,7 +4845,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4786
4845
  },
4787
4846
  [setStoredEmail, redirectManager, router]
4788
4847
  );
4789
- const login = useCallback11(
4848
+ const login = useCallback12(
4790
4849
  async (email, password, options) => {
4791
4850
  const { redirectUrl, skipRedirect } = options || {};
4792
4851
  try {
@@ -4851,7 +4910,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4851
4910
  },
4852
4911
  [setStoredEmail, redirectManager, router]
4853
4912
  );
4854
- const refreshToken = useCallback11(async () => {
4913
+ const refreshToken = useCallback12(async () => {
4855
4914
  const access = await auth.refreshNow();
4856
4915
  if (access) {
4857
4916
  Analytics.event("auth_token_refresh" /* AUTH_TOKEN_REFRESH */, {
@@ -4864,7 +4923,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4864
4923
  });
4865
4924
  return { success: false, message: "Error refreshing token" };
4866
4925
  }, []);
4867
- const logout = useCallback11(() => {
4926
+ const logout = useCallback12(() => {
4868
4927
  Analytics.event("auth_logout" /* AUTH_LOGOUT */, {
4869
4928
  category: "auth" /* AUTH */
4870
4929
  });
@@ -4876,14 +4935,14 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4876
4935
  useEffect6(() => {
4877
4936
  applyRoleLogPolicy({ isAdmin: isAdminUser });
4878
4937
  }, [isAdminUser]);
4879
- const updateProfile = useCallback11(
4938
+ const updateProfile = useCallback12(
4880
4939
  async (data) => {
4881
4940
  const result = await accountsRef.current.partialUpdateProfile(data);
4882
4941
  return result;
4883
4942
  },
4884
4943
  []
4885
4944
  );
4886
- const uploadAvatar = useCallback11(async (avatar) => {
4945
+ const uploadAvatar = useCallback12(async (avatar) => {
4887
4946
  const result = await accountsRef.current.uploadAvatar(avatar);
4888
4947
  return result;
4889
4948
  }, []);
@@ -5085,6 +5144,7 @@ export {
5085
5144
  useQueryParams,
5086
5145
  useSession,
5087
5146
  useSessionStorage,
5147
+ useTimezone,
5088
5148
  useTwoFactor,
5089
5149
  useTwoFactorChallenge,
5090
5150
  useTwoFactorSetup,