@djangocfg/api 2.1.356 → 2.1.358

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 (113) hide show
  1. package/README.md +53 -632
  2. package/dist/auth-server.cjs +717 -200
  3. package/dist/auth-server.cjs.map +1 -1
  4. package/dist/auth-server.mjs +717 -200
  5. package/dist/auth-server.mjs.map +1 -1
  6. package/dist/auth.cjs +843 -783
  7. package/dist/auth.cjs.map +1 -1
  8. package/dist/auth.d.cts +58 -37
  9. package/dist/auth.d.ts +58 -37
  10. package/dist/auth.mjs +846 -784
  11. package/dist/auth.mjs.map +1 -1
  12. package/dist/clients.cjs +1427 -0
  13. package/dist/clients.cjs.map +1 -1
  14. package/dist/clients.d.cts +1686 -0
  15. package/dist/clients.d.ts +1686 -0
  16. package/dist/clients.mjs +1427 -0
  17. package/dist/clients.mjs.map +1 -1
  18. package/dist/hooks.cjs +1277 -1924
  19. package/dist/hooks.cjs.map +1 -1
  20. package/dist/hooks.d.cts +18 -1206
  21. package/dist/hooks.d.ts +18 -1206
  22. package/dist/hooks.mjs +1253 -1900
  23. package/dist/hooks.mjs.map +1 -1
  24. package/dist/index.cjs +545 -1232
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +1389 -1455
  27. package/dist/index.d.ts +1389 -1455
  28. package/dist/index.mjs +545 -1232
  29. package/dist/index.mjs.map +1 -1
  30. package/package.json +7 -2
  31. package/src/_api/generated/_cfg_accounts/api.ts +11 -3
  32. package/src/_api/generated/_cfg_accounts/hooks/index.ts +3 -0
  33. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts +64 -0
  34. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts +65 -0
  35. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts +64 -0
  36. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts +43 -3
  37. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts +43 -3
  38. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +43 -3
  39. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +43 -3
  40. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts +43 -3
  41. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts +43 -3
  42. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts +43 -3
  43. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts +43 -3
  44. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts +43 -3
  45. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +43 -3
  46. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts +43 -3
  47. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts +43 -3
  48. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +43 -3
  49. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts +43 -3
  50. package/src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts +43 -3
  51. package/src/_api/generated/_cfg_accounts/index.ts +1 -1
  52. package/src/_api/generated/_cfg_accounts/schemas/APIKey.ts +13 -0
  53. package/src/_api/generated/_cfg_accounts/schemas/APIKeyRegenerate.ts +12 -0
  54. package/src/_api/generated/_cfg_accounts/schemas/APIKeyRequest.ts +13 -0
  55. package/src/_api/generated/{_cfg_totp/schemas/DeviceListStatusEnum.ts → _cfg_accounts/schemas/APIKeyTestRequest.ts} +4 -2
  56. package/src/_api/generated/_cfg_accounts/schemas/APIKeyTestResult.ts +12 -0
  57. package/src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts +1 -1
  58. package/src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts +2 -2
  59. package/src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts +3 -2
  60. package/src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts +1 -1
  61. package/src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts +6 -6
  62. package/src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts +2 -2
  63. package/src/_api/generated/_cfg_accounts/schemas/{ProviderEnum.ts → OAuthProviderEnum.ts} +2 -2
  64. package/src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts +5 -5
  65. package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts +1 -1
  66. package/src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts +3 -3
  67. package/src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts +3 -2
  68. package/src/_api/generated/_cfg_accounts/schemas/User.ts +12 -10
  69. package/src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_connections_response_200_AutoRef.ts +10 -0
  70. package/src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_disconnect_response_200_AutoRef.ts +11 -0
  71. package/src/_api/generated/_cfg_accounts/schemas/index.ts +8 -1
  72. package/src/_api/generated/_cfg_centrifugo/api.ts +3 -3
  73. package/src/_api/generated/_cfg_centrifugo/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +43 -3
  74. package/src/_api/generated/_cfg_centrifugo/index.ts +1 -1
  75. package/src/_api/generated/_cfg_centrifugo/schemas/ConnectionTokenResponse.ts +2 -2
  76. package/src/_api/generated/_cfg_totp/api.ts +9 -3
  77. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +43 -3
  78. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpBackupCodesRetrieve.ts +43 -3
  79. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesDestroy.ts +7 -3
  80. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDevicesRetrieve.ts +43 -3
  81. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpDisableCreate.ts +43 -3
  82. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupConfirmCreate.ts +43 -3
  83. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpSetupCreate.ts +43 -3
  84. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyBackupCreate.ts +43 -3
  85. package/src/_api/generated/_cfg_totp/hooks/useCfgTotpVerifyCreate.ts +43 -3
  86. package/src/_api/generated/_cfg_totp/index.ts +1 -1
  87. package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupRequest.ts +1 -1
  88. package/src/_api/generated/_cfg_totp/schemas/ConfirmSetupResponse.ts +1 -1
  89. package/src/_api/generated/_cfg_totp/schemas/DeviceList.ts +5 -5
  90. package/src/_api/generated/_cfg_totp/schemas/DeviceStatusEnum.ts +9 -0
  91. package/src/_api/generated/_cfg_totp/schemas/SetupResponse.ts +2 -2
  92. package/src/_api/generated/_cfg_totp/schemas/TotpVerifyUser.ts +11 -9
  93. package/src/_api/generated/_cfg_totp/schemas/VerifyBackupRequest.ts +1 -1
  94. package/src/_api/generated/_cfg_totp/schemas/VerifyRequest.ts +1 -1
  95. package/src/_api/generated/_cfg_totp/schemas/VerifyResponse.ts +2 -2
  96. package/src/_api/generated/_cfg_totp/schemas/cfg_totp_disable_response_200_AutoRef.ts +9 -0
  97. package/src/_api/generated/_cfg_totp/schemas/index.ts +2 -1
  98. package/src/_api/generated/index.ts +3 -1
  99. package/src/_api/generated/sdk.gen.ts +80 -813
  100. package/src/_api/generated/types.gen.ts +320 -159
  101. package/src/auth/context/AccountsContext.tsx +18 -6
  102. package/src/auth/context/AuthContext.tsx +11 -3
  103. package/src/auth/hooks/useDeleteAccount.ts +2 -2
  104. package/src/auth/hooks/useGithubAuth.ts +3 -3
  105. package/src/auth/hooks/useTokenRefresh.ts +2 -2
  106. package/src/auth/hooks/useTwoFactor.ts +3 -3
  107. package/src/auth/hooks/useTwoFactorSetup.ts +3 -3
  108. package/src/auth/hooks/useTwoFactorStatus.ts +3 -3
  109. package/src/auth/middlewares/tokenRefresh.ts +2 -2
  110. package/src/hooks/index.ts +1 -0
  111. package/src/hooks/useApiKey.ts +73 -0
  112. package/src/index.ts +12 -16
  113. package/src/lib/env.ts +10 -0
package/dist/auth.cjs CHANGED
@@ -89,7 +89,7 @@ var isBrowser = typeof window !== "undefined";
89
89
  // src/auth/context/AuthContext.tsx
90
90
  var import_navigation4 = require("next/navigation");
91
91
  var import_react17 = require("react");
92
- var import_swr4 = require("swr");
92
+ var import_swr5 = require("swr");
93
93
 
94
94
  // src/auth/hooks/useCfgRouter.ts
95
95
  var import_navigation = require("next/navigation");
@@ -705,260 +705,6 @@ var APILogger = class {
705
705
  };
706
706
  var defaultLogger = new APILogger();
707
707
 
708
- // src/_api/generated/_cfg_accounts/api.ts
709
- var API = class {
710
- static {
711
- __name(this, "API");
712
- }
713
- logger;
714
- constructor(_baseUrl, opts = {}) {
715
- this.logger = new APILogger(opts.logger);
716
- if (_baseUrl) auth.setBaseUrl(_baseUrl);
717
- if (opts.locale !== void 0) auth.setLocale(opts.locale);
718
- if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
719
- if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
720
- }
721
- // ── Base URL ────────────────────────────────────────────────────────────
722
- getBaseUrl() {
723
- return auth.getBaseUrl();
724
- }
725
- setBaseUrl(url) {
726
- auth.setBaseUrl(url);
727
- }
728
- // ── Tokens ──────────────────────────────────────────────────────────────
729
- getToken() {
730
- return auth.getToken();
731
- }
732
- setToken(token) {
733
- auth.setToken(token);
734
- }
735
- getRefreshToken() {
736
- return auth.getRefreshToken();
737
- }
738
- setRefreshToken(token) {
739
- auth.setRefreshToken(token);
740
- }
741
- clearToken() {
742
- auth.clearTokens();
743
- }
744
- isAuthenticated() {
745
- return auth.isAuthenticated();
746
- }
747
- // ── Locale / API key ────────────────────────────────────────────────────
748
- getLocale() {
749
- return auth.getLocale();
750
- }
751
- setLocale(locale) {
752
- auth.setLocale(locale);
753
- }
754
- getApiKey() {
755
- return auth.getApiKey();
756
- }
757
- setApiKey(key) {
758
- auth.setApiKey(key);
759
- }
760
- // ── 401 handling ────────────────────────────────────────────────────────
761
- /** Fired only on terminal 401 (after refresh+retry path is exhausted). */
762
- onUnauthorized(cb) {
763
- auth.onUnauthorized(cb);
764
- }
765
- /** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
766
- setRefreshHandler(fn) {
767
- auth.setRefreshHandler(fn);
768
- }
769
- };
770
-
771
- // src/_api/generated/helpers/errors.ts
772
- var APIError = class extends Error {
773
- constructor(statusCode, statusText, response, url, message) {
774
- super(message || `HTTP ${statusCode}: ${statusText}`);
775
- this.statusCode = statusCode;
776
- this.statusText = statusText;
777
- this.response = response;
778
- this.url = url;
779
- this.name = "APIError";
780
- }
781
- static {
782
- __name(this, "APIError");
783
- }
784
- get details() {
785
- if (typeof this.response === "object" && this.response !== null) {
786
- return this.response;
787
- }
788
- return null;
789
- }
790
- get fieldErrors() {
791
- const details = this.details;
792
- if (!details) return null;
793
- const fieldErrors = {};
794
- for (const [key, value] of Object.entries(details)) {
795
- if (Array.isArray(value)) fieldErrors[key] = value;
796
- }
797
- return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
798
- }
799
- get errorMessage() {
800
- const details = this.details;
801
- if (!details) return this.message;
802
- if (details.detail) {
803
- return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
804
- }
805
- if (details.error) return String(details.error);
806
- if (details.message) return String(details.message);
807
- const fieldErrors = this.fieldErrors;
808
- if (fieldErrors) {
809
- const firstField = Object.keys(fieldErrors)[0];
810
- if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
811
- }
812
- return this.message;
813
- }
814
- get isValidationError() {
815
- return this.statusCode === 400;
816
- }
817
- get isAuthError() {
818
- return this.statusCode === 401;
819
- }
820
- get isPermissionError() {
821
- return this.statusCode === 403;
822
- }
823
- get isNotFoundError() {
824
- return this.statusCode === 404;
825
- }
826
- get isServerError() {
827
- return this.statusCode >= 500 && this.statusCode < 600;
828
- }
829
- };
830
-
831
- // src/_api/generated/_cfg_centrifugo/api.ts
832
- var API2 = class {
833
- static {
834
- __name(this, "API");
835
- }
836
- logger;
837
- constructor(_baseUrl, opts = {}) {
838
- this.logger = new APILogger(opts.logger);
839
- if (_baseUrl) auth.setBaseUrl(_baseUrl);
840
- if (opts.locale !== void 0) auth.setLocale(opts.locale);
841
- if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
842
- if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
843
- }
844
- // ── Base URL ────────────────────────────────────────────────────────────
845
- getBaseUrl() {
846
- return auth.getBaseUrl();
847
- }
848
- setBaseUrl(url) {
849
- auth.setBaseUrl(url);
850
- }
851
- // ── Tokens ──────────────────────────────────────────────────────────────
852
- getToken() {
853
- return auth.getToken();
854
- }
855
- setToken(token) {
856
- auth.setToken(token);
857
- }
858
- getRefreshToken() {
859
- return auth.getRefreshToken();
860
- }
861
- setRefreshToken(token) {
862
- auth.setRefreshToken(token);
863
- }
864
- clearToken() {
865
- auth.clearTokens();
866
- }
867
- isAuthenticated() {
868
- return auth.isAuthenticated();
869
- }
870
- // ── Locale / API key ────────────────────────────────────────────────────
871
- getLocale() {
872
- return auth.getLocale();
873
- }
874
- setLocale(locale) {
875
- auth.setLocale(locale);
876
- }
877
- getApiKey() {
878
- return auth.getApiKey();
879
- }
880
- setApiKey(key) {
881
- auth.setApiKey(key);
882
- }
883
- // ── 401 handling ────────────────────────────────────────────────────────
884
- /** Fired only on terminal 401 (after refresh+retry path is exhausted). */
885
- onUnauthorized(cb) {
886
- auth.onUnauthorized(cb);
887
- }
888
- /** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
889
- setRefreshHandler(fn) {
890
- auth.setRefreshHandler(fn);
891
- }
892
- };
893
-
894
- // src/_api/generated/_cfg_totp/api.ts
895
- var API3 = class {
896
- static {
897
- __name(this, "API");
898
- }
899
- logger;
900
- constructor(_baseUrl, opts = {}) {
901
- this.logger = new APILogger(opts.logger);
902
- if (_baseUrl) auth.setBaseUrl(_baseUrl);
903
- if (opts.locale !== void 0) auth.setLocale(opts.locale);
904
- if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
905
- if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
906
- }
907
- // ── Base URL ────────────────────────────────────────────────────────────
908
- getBaseUrl() {
909
- return auth.getBaseUrl();
910
- }
911
- setBaseUrl(url) {
912
- auth.setBaseUrl(url);
913
- }
914
- // ── Tokens ──────────────────────────────────────────────────────────────
915
- getToken() {
916
- return auth.getToken();
917
- }
918
- setToken(token) {
919
- auth.setToken(token);
920
- }
921
- getRefreshToken() {
922
- return auth.getRefreshToken();
923
- }
924
- setRefreshToken(token) {
925
- auth.setRefreshToken(token);
926
- }
927
- clearToken() {
928
- auth.clearTokens();
929
- }
930
- isAuthenticated() {
931
- return auth.isAuthenticated();
932
- }
933
- // ── Locale / API key ────────────────────────────────────────────────────
934
- getLocale() {
935
- return auth.getLocale();
936
- }
937
- setLocale(locale) {
938
- auth.setLocale(locale);
939
- }
940
- getApiKey() {
941
- return auth.getApiKey();
942
- }
943
- setApiKey(key) {
944
- auth.setApiKey(key);
945
- }
946
- // ── 401 handling ────────────────────────────────────────────────────────
947
- /** Fired only on terminal 401 (after refresh+retry path is exhausted). */
948
- onUnauthorized(cb) {
949
- auth.onUnauthorized(cb);
950
- }
951
- /** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
952
- setRefreshHandler(fn) {
953
- auth.setRefreshHandler(fn);
954
- }
955
- };
956
-
957
- // src/_api/generated/index.ts
958
- var CfgAccountsApi = new API();
959
- var CfgCentrifugoApi = new API2();
960
- var CfgTotpApi = new API3();
961
-
962
708
  // src/_api/generated/core/bodySerializer.gen.ts
963
709
  var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
964
710
  if (typeof value === "string" || value instanceof Blob) {
@@ -1785,18 +1531,79 @@ var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
1785
1531
  installAuthOnClient(client);
1786
1532
 
1787
1533
  // src/_api/generated/sdk.gen.ts
1788
- var Cfg = class {
1534
+ var CfgAccountsApiKey = class {
1789
1535
  static {
1790
- __name(this, "Cfg");
1536
+ __name(this, "CfgAccountsApiKey");
1791
1537
  }
1792
1538
  /**
1793
- * List OAuth connections
1539
+ * Get API key details
1794
1540
  *
1795
- * Get all OAuth connections for the current user.
1541
+ * Retrieve the current user's API key (masked) and metadata.
1542
+ */
1543
+ static cfgAccountsApiKeyRetrieve(options) {
1544
+ return (options?.client ?? client).get({
1545
+ security: [{ scheme: "bearer", type: "http" }, {
1546
+ in: "cookie",
1547
+ name: "sessionid",
1548
+ type: "apiKey"
1549
+ }],
1550
+ url: "/cfg/accounts/api-key/",
1551
+ ...options
1552
+ });
1553
+ }
1554
+ /**
1555
+ * Regenerate API key
1556
+ *
1557
+ * Generate a new API key. The full key is returned only once.
1558
+ */
1559
+ static cfgAccountsApiKeyRegenerateCreate(options) {
1560
+ return (options.client ?? client).post({
1561
+ security: [{ scheme: "bearer", type: "http" }, {
1562
+ in: "cookie",
1563
+ name: "sessionid",
1564
+ type: "apiKey"
1565
+ }],
1566
+ url: "/cfg/accounts/api-key/regenerate/",
1567
+ ...options,
1568
+ headers: {
1569
+ "Content-Type": "application/json",
1570
+ ...options.headers
1571
+ }
1572
+ });
1573
+ }
1574
+ /**
1575
+ * Test API key
1576
+ *
1577
+ * Test whether an API key is valid without consuming it.
1578
+ */
1579
+ static cfgAccountsApiKeyTestCreate(options) {
1580
+ return (options.client ?? client).post({
1581
+ security: [{ scheme: "bearer", type: "http" }, {
1582
+ in: "cookie",
1583
+ name: "sessionid",
1584
+ type: "apiKey"
1585
+ }],
1586
+ url: "/cfg/accounts/api-key/test/",
1587
+ ...options,
1588
+ headers: {
1589
+ "Content-Type": "application/json",
1590
+ ...options.headers
1591
+ }
1592
+ });
1593
+ }
1594
+ };
1595
+ var CfgAccountsOauth = class {
1596
+ static {
1597
+ __name(this, "CfgAccountsOauth");
1598
+ }
1599
+ /**
1600
+ * List OAuth connections
1601
+ *
1602
+ * Get all OAuth connections for the current user.
1796
1603
  */
1797
1604
  static cfgAccountsOauthConnectionsList(options) {
1798
1605
  return (options?.client ?? client).get({
1799
- security: [{ scheme: "bearer", type: "http" }],
1606
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1800
1607
  url: "/cfg/accounts/oauth/connections/",
1801
1608
  ...options
1802
1609
  });
@@ -1808,7 +1615,7 @@ var Cfg = class {
1808
1615
  */
1809
1616
  static cfgAccountsOauthDisconnectCreate(options) {
1810
1617
  return (options.client ?? client).post({
1811
- security: [{ scheme: "bearer", type: "http" }],
1618
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1812
1619
  url: "/cfg/accounts/oauth/disconnect/",
1813
1620
  ...options,
1814
1621
  headers: {
@@ -1855,12 +1662,17 @@ var Cfg = class {
1855
1662
  static cfgAccountsOauthProvidersRetrieve(options) {
1856
1663
  return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1857
1664
  }
1665
+ };
1666
+ var CfgAccounts = class {
1667
+ static {
1668
+ __name(this, "CfgAccounts");
1669
+ }
1858
1670
  /**
1859
1671
  * Request OTP code to email.
1860
1672
  */
1861
1673
  static cfgAccountsOtpRequestCreate(options) {
1862
1674
  return (options.client ?? client).post({
1863
- security: [{ scheme: "bearer", type: "http" }],
1675
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1864
1676
  url: "/cfg/accounts/otp/request/",
1865
1677
  ...options,
1866
1678
  headers: {
@@ -1881,7 +1693,7 @@ var Cfg = class {
1881
1693
  */
1882
1694
  static cfgAccountsOtpVerifyCreate(options) {
1883
1695
  return (options.client ?? client).post({
1884
- security: [{ scheme: "bearer", type: "http" }],
1696
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1885
1697
  url: "/cfg/accounts/otp/verify/",
1886
1698
  ...options,
1887
1699
  headers: {
@@ -1890,6 +1702,11 @@ var Cfg = class {
1890
1702
  }
1891
1703
  });
1892
1704
  }
1705
+ };
1706
+ var CfgAccountsProfile = class {
1707
+ static {
1708
+ __name(this, "CfgAccountsProfile");
1709
+ }
1893
1710
  /**
1894
1711
  * Get current user profile
1895
1712
  *
@@ -1914,7 +1731,7 @@ var Cfg = class {
1914
1731
  static cfgAccountsProfileAvatarCreate(options) {
1915
1732
  return (options?.client ?? client).post({
1916
1733
  ...formDataBodySerializer,
1917
- security: [{ scheme: "bearer", type: "http" }],
1734
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
1918
1735
  url: "/cfg/accounts/profile/avatar/",
1919
1736
  ...options,
1920
1737
  headers: {
@@ -2029,6 +1846,11 @@ var Cfg = class {
2029
1846
  }
2030
1847
  });
2031
1848
  }
1849
+ };
1850
+ var CfgAccountsAuth = class {
1851
+ static {
1852
+ __name(this, "CfgAccountsAuth");
1853
+ }
2032
1854
  /**
2033
1855
  * Refresh JWT token.
2034
1856
  */
@@ -2042,6 +1864,11 @@ var Cfg = class {
2042
1864
  }
2043
1865
  });
2044
1866
  }
1867
+ };
1868
+ var CfgCentrifugo = class {
1869
+ static {
1870
+ __name(this, "CfgCentrifugo");
1871
+ }
2045
1872
  /**
2046
1873
  * Get Centrifugo connection token
2047
1874
  *
@@ -2049,17 +1876,22 @@ var Cfg = class {
2049
1876
  */
2050
1877
  static cfgCentrifugoAuthTokenRetrieve(options) {
2051
1878
  return (options?.client ?? client).get({
2052
- security: [{ scheme: "bearer", type: "http" }],
1879
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2053
1880
  url: "/cfg/centrifugo/auth/token/",
2054
1881
  ...options
2055
1882
  });
2056
1883
  }
1884
+ };
1885
+ var CfgTotpBackupCodes = class {
1886
+ static {
1887
+ __name(this, "CfgTotpBackupCodes");
1888
+ }
2057
1889
  /**
2058
1890
  * Get backup codes status for user.
2059
1891
  */
2060
1892
  static cfgTotpBackupCodesRetrieve(options) {
2061
1893
  return (options?.client ?? client).get({
2062
- security: [{ scheme: "bearer", type: "http" }],
1894
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2063
1895
  url: "/cfg/totp/backup-codes/",
2064
1896
  ...options
2065
1897
  });
@@ -2072,7 +1904,7 @@ var Cfg = class {
2072
1904
  */
2073
1905
  static cfgTotpBackupCodesRegenerateCreate(options) {
2074
1906
  return (options.client ?? client).post({
2075
- security: [{ scheme: "bearer", type: "http" }],
1907
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2076
1908
  url: "/cfg/totp/backup-codes/regenerate/",
2077
1909
  ...options,
2078
1910
  headers: {
@@ -2081,12 +1913,17 @@ var Cfg = class {
2081
1913
  }
2082
1914
  });
2083
1915
  }
1916
+ };
1917
+ var CfgTotp = class {
1918
+ static {
1919
+ __name(this, "CfgTotp");
1920
+ }
2084
1921
  /**
2085
1922
  * List all TOTP devices for user.
2086
1923
  */
2087
1924
  static cfgTotpDevicesRetrieve(options) {
2088
1925
  return (options?.client ?? client).get({
2089
- security: [{ scheme: "bearer", type: "http" }],
1926
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2090
1927
  url: "/cfg/totp/devices/",
2091
1928
  ...options
2092
1929
  });
@@ -2098,7 +1935,7 @@ var Cfg = class {
2098
1935
  */
2099
1936
  static cfgTotpDevicesDestroy(options) {
2100
1937
  return (options.client ?? client).delete({
2101
- security: [{ scheme: "bearer", type: "http" }],
1938
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2102
1939
  url: "/cfg/totp/devices/{id}/",
2103
1940
  ...options
2104
1941
  });
@@ -2110,7 +1947,7 @@ var Cfg = class {
2110
1947
  */
2111
1948
  static cfgTotpDisableCreate(options) {
2112
1949
  return (options.client ?? client).post({
2113
- security: [{ scheme: "bearer", type: "http" }],
1950
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2114
1951
  url: "/cfg/totp/disable/",
2115
1952
  ...options,
2116
1953
  headers: {
@@ -2119,6 +1956,11 @@ var Cfg = class {
2119
1956
  }
2120
1957
  });
2121
1958
  }
1959
+ };
1960
+ var CfgTotpSetup = class {
1961
+ static {
1962
+ __name(this, "CfgTotpSetup");
1963
+ }
2122
1964
  /**
2123
1965
  * Start 2FA setup process.
2124
1966
  *
@@ -2126,7 +1968,7 @@ var Cfg = class {
2126
1968
  */
2127
1969
  static cfgTotpSetupCreate(options) {
2128
1970
  return (options?.client ?? client).post({
2129
- security: [{ scheme: "bearer", type: "http" }],
1971
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2130
1972
  url: "/cfg/totp/setup/",
2131
1973
  ...options,
2132
1974
  headers: {
@@ -2142,7 +1984,7 @@ var Cfg = class {
2142
1984
  */
2143
1985
  static cfgTotpSetupConfirmCreate(options) {
2144
1986
  return (options.client ?? client).post({
2145
- security: [{ scheme: "bearer", type: "http" }],
1987
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2146
1988
  url: "/cfg/totp/setup/confirm/",
2147
1989
  ...options,
2148
1990
  headers: {
@@ -2151,6 +1993,11 @@ var Cfg = class {
2151
1993
  }
2152
1994
  });
2153
1995
  }
1996
+ };
1997
+ var CfgTotpVerify = class {
1998
+ static {
1999
+ __name(this, "CfgTotpVerify");
2000
+ }
2154
2001
  /**
2155
2002
  * Verify TOTP code for 2FA session.
2156
2003
  *
@@ -2158,7 +2005,7 @@ var Cfg = class {
2158
2005
  */
2159
2006
  static cfgTotpVerifyCreate(options) {
2160
2007
  return (options.client ?? client).post({
2161
- security: [{ scheme: "bearer", type: "http" }],
2008
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2162
2009
  url: "/cfg/totp/verify/",
2163
2010
  ...options,
2164
2011
  headers: {
@@ -2174,7 +2021,7 @@ var Cfg = class {
2174
2021
  */
2175
2022
  static cfgTotpVerifyBackupCreate(options) {
2176
2023
  return (options.client ?? client).post({
2177
- security: [{ scheme: "bearer", type: "http" }],
2024
+ security: [{ name: "X-API-Key", type: "apiKey" }, { scheme: "bearer", type: "http" }],
2178
2025
  url: "/cfg/totp/verify/backup/",
2179
2026
  ...options,
2180
2027
  headers: {
@@ -2184,345 +2031,271 @@ var Cfg = class {
2184
2031
  });
2185
2032
  }
2186
2033
  };
2187
- var OAuth = class {
2034
+
2035
+ // src/_api/generated/_cfg_accounts/api.ts
2036
+ var API = class {
2188
2037
  static {
2189
- __name(this, "OAuth");
2038
+ __name(this, "API");
2190
2039
  }
2191
- /**
2192
- * List OAuth connections
2193
- *
2194
- * Get all OAuth connections for the current user.
2195
- */
2196
- static cfgAccountsOauthConnectionsList(options) {
2197
- return (options?.client ?? client).get({
2198
- security: [{ scheme: "bearer", type: "http" }],
2199
- url: "/cfg/accounts/oauth/connections/",
2200
- ...options
2201
- });
2040
+ logger;
2041
+ cfgAccountsApiKey = CfgAccountsApiKey;
2042
+ cfgAccountsOauth = CfgAccountsOauth;
2043
+ cfgAccounts = CfgAccounts;
2044
+ cfgAccountsProfile = CfgAccountsProfile;
2045
+ cfgAccountsAuth = CfgAccountsAuth;
2046
+ constructor(_baseUrl, opts = {}) {
2047
+ this.logger = new APILogger(opts.logger);
2048
+ if (_baseUrl) auth.setBaseUrl(_baseUrl);
2049
+ if (opts.locale !== void 0) auth.setLocale(opts.locale);
2050
+ if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
2051
+ if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
2202
2052
  }
2203
- /**
2204
- * Disconnect OAuth provider
2205
- *
2206
- * Remove OAuth connection for the specified provider.
2207
- */
2208
- static cfgAccountsOauthDisconnectCreate(options) {
2209
- return (options.client ?? client).post({
2210
- security: [{ scheme: "bearer", type: "http" }],
2211
- url: "/cfg/accounts/oauth/disconnect/",
2212
- ...options,
2213
- headers: {
2214
- "Content-Type": "application/json",
2215
- ...options.headers
2216
- }
2217
- });
2053
+ // ── Base URL ────────────────────────────────────────────────────────────
2054
+ getBaseUrl() {
2055
+ return auth.getBaseUrl();
2218
2056
  }
2219
- /**
2220
- * Start GitHub OAuth
2221
- *
2222
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
2223
- */
2224
- static cfgAccountsOauthGithubAuthorizeCreate(options) {
2225
- return (options?.client ?? client).post({
2226
- url: "/cfg/accounts/oauth/github/authorize/",
2227
- ...options,
2228
- headers: {
2229
- "Content-Type": "application/json",
2230
- ...options?.headers
2231
- }
2232
- });
2057
+ setBaseUrl(url) {
2058
+ auth.setBaseUrl(url);
2233
2059
  }
2234
- /**
2235
- * Complete GitHub OAuth
2236
- *
2237
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
2238
- */
2239
- static cfgAccountsOauthGithubCallbackCreate(options) {
2240
- return (options.client ?? client).post({
2241
- url: "/cfg/accounts/oauth/github/callback/",
2242
- ...options,
2243
- headers: {
2244
- "Content-Type": "application/json",
2245
- ...options.headers
2246
- }
2247
- });
2060
+ // ── Tokens ──────────────────────────────────────────────────────────────
2061
+ getToken() {
2062
+ return auth.getToken();
2248
2063
  }
2249
- /**
2250
- * List OAuth providers
2251
- *
2252
- * Get list of available OAuth providers for authentication.
2253
- */
2254
- static cfgAccountsOauthProvidersRetrieve(options) {
2255
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
2064
+ setToken(token) {
2065
+ auth.setToken(token);
2256
2066
  }
2257
- };
2258
- var UserProfile = class {
2259
- static {
2260
- __name(this, "UserProfile");
2067
+ getRefreshToken() {
2068
+ return auth.getRefreshToken();
2261
2069
  }
2262
- /**
2263
- * Get current user profile
2264
- *
2265
- * Retrieve the current authenticated user's profile information.
2266
- */
2267
- static cfgAccountsProfileRetrieve(options) {
2268
- return (options?.client ?? client).get({
2269
- security: [{ scheme: "bearer", type: "http" }, {
2270
- in: "cookie",
2271
- name: "sessionid",
2272
- type: "apiKey"
2273
- }],
2274
- url: "/cfg/accounts/profile/",
2275
- ...options
2276
- });
2070
+ setRefreshToken(token) {
2071
+ auth.setRefreshToken(token);
2277
2072
  }
2278
- /**
2279
- * Upload user avatar
2280
- *
2281
- * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
2282
- */
2283
- static cfgAccountsProfileAvatarCreate(options) {
2284
- return (options?.client ?? client).post({
2285
- ...formDataBodySerializer,
2286
- security: [{ scheme: "bearer", type: "http" }],
2287
- url: "/cfg/accounts/profile/avatar/",
2288
- ...options,
2289
- headers: {
2290
- "Content-Type": null,
2291
- ...options?.headers
2292
- }
2293
- });
2073
+ clearToken() {
2074
+ auth.clearTokens();
2294
2075
  }
2295
- /**
2296
- * Delete user account
2297
- *
2298
- *
2299
- * Permanently delete the current user's account.
2300
- *
2301
- * This operation:
2302
- * - Deactivates the account (user cannot log in)
2303
- * - Anonymizes personal data (GDPR compliance)
2304
- * - Frees up the email address for re-registration
2305
- * - Preserves audit trail
2306
- *
2307
- * The account can be restored by an administrator if needed.
2308
- *
2309
- */
2310
- static cfgAccountsProfileDeleteCreate(options) {
2311
- return (options?.client ?? client).post({
2312
- security: [{ scheme: "bearer", type: "http" }, {
2313
- in: "cookie",
2314
- name: "sessionid",
2315
- type: "apiKey"
2316
- }],
2317
- url: "/cfg/accounts/profile/delete/",
2318
- ...options
2319
- });
2076
+ isAuthenticated() {
2077
+ return auth.isAuthenticated();
2320
2078
  }
2321
- /**
2322
- * Partial update user profile
2323
- *
2324
- * Partially update the current authenticated user's profile information. Supports avatar upload.
2325
- */
2326
- static cfgAccountsProfilePartialPartialUpdate(options) {
2327
- return (options?.client ?? client).patch({
2328
- security: [{ scheme: "bearer", type: "http" }, {
2329
- in: "cookie",
2330
- name: "sessionid",
2331
- type: "apiKey"
2332
- }],
2333
- url: "/cfg/accounts/profile/partial/",
2334
- ...options,
2335
- headers: {
2336
- "Content-Type": "application/json",
2337
- ...options?.headers
2338
- }
2339
- });
2079
+ // ── Locale / API key ────────────────────────────────────────────────────
2080
+ getLocale() {
2081
+ return auth.getLocale();
2340
2082
  }
2341
- /**
2342
- * Partial update user profile
2343
- *
2344
- * Partially update the current authenticated user's profile information. Supports avatar upload.
2345
- */
2346
- static cfgAccountsProfilePartialUpdate(options) {
2347
- return (options?.client ?? client).put({
2348
- security: [{ scheme: "bearer", type: "http" }, {
2349
- in: "cookie",
2350
- name: "sessionid",
2351
- type: "apiKey"
2352
- }],
2353
- url: "/cfg/accounts/profile/partial/",
2354
- ...options,
2355
- headers: {
2356
- "Content-Type": "application/json",
2357
- ...options?.headers
2358
- }
2359
- });
2083
+ setLocale(locale) {
2084
+ auth.setLocale(locale);
2360
2085
  }
2361
- /**
2362
- * Update user profile
2363
- *
2364
- * Update the current authenticated user's profile information.
2365
- */
2366
- static cfgAccountsProfileUpdatePartialUpdate(options) {
2367
- return (options?.client ?? client).patch({
2368
- security: [{ scheme: "bearer", type: "http" }, {
2369
- in: "cookie",
2370
- name: "sessionid",
2371
- type: "apiKey"
2372
- }],
2373
- url: "/cfg/accounts/profile/update/",
2374
- ...options,
2375
- headers: {
2376
- "Content-Type": "application/json",
2377
- ...options?.headers
2378
- }
2379
- });
2086
+ getApiKey() {
2087
+ return auth.getApiKey();
2380
2088
  }
2381
- /**
2382
- * Update user profile
2383
- *
2384
- * Update the current authenticated user's profile information.
2385
- */
2386
- static cfgAccountsProfileUpdateUpdate(options) {
2387
- return (options?.client ?? client).put({
2388
- security: [{ scheme: "bearer", type: "http" }, {
2389
- in: "cookie",
2390
- name: "sessionid",
2391
- type: "apiKey"
2392
- }],
2393
- url: "/cfg/accounts/profile/update/",
2394
- ...options,
2395
- headers: {
2396
- "Content-Type": "application/json",
2397
- ...options?.headers
2398
- }
2399
- });
2089
+ setApiKey(key) {
2090
+ auth.setApiKey(key);
2400
2091
  }
2401
- };
2402
- var Auth = class {
2403
- static {
2404
- __name(this, "Auth");
2092
+ // ── 401 handling ────────────────────────────────────────────────────────
2093
+ /** Fired only on terminal 401 (after refresh+retry path is exhausted). */
2094
+ onUnauthorized(cb) {
2095
+ auth.onUnauthorized(cb);
2405
2096
  }
2406
- /**
2407
- * Refresh JWT token.
2408
- */
2409
- static cfgAccountsTokenRefreshCreate(options) {
2410
- return (options.client ?? client).post({
2411
- url: "/cfg/accounts/token/refresh/",
2412
- ...options,
2413
- headers: {
2414
- "Content-Type": "application/json",
2415
- ...options.headers
2416
- }
2417
- });
2097
+ /** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
2098
+ setRefreshHandler(fn) {
2099
+ auth.setRefreshHandler(fn);
2418
2100
  }
2419
2101
  };
2420
- var TotpManagement = class {
2102
+
2103
+ // src/_api/generated/helpers/errors.ts
2104
+ var APIError = class extends Error {
2105
+ constructor(statusCode, statusText, response, url, message) {
2106
+ super(message || `HTTP ${statusCode}: ${statusText}`);
2107
+ this.statusCode = statusCode;
2108
+ this.statusText = statusText;
2109
+ this.response = response;
2110
+ this.url = url;
2111
+ this.name = "APIError";
2112
+ }
2421
2113
  static {
2422
- __name(this, "TotpManagement");
2114
+ __name(this, "APIError");
2423
2115
  }
2424
- /**
2425
- * List all TOTP devices for user.
2426
- */
2427
- static cfgTotpDevicesRetrieve(options) {
2428
- return (options?.client ?? client).get({
2429
- security: [{ scheme: "bearer", type: "http" }],
2430
- url: "/cfg/totp/devices/",
2431
- ...options
2432
- });
2116
+ get details() {
2117
+ if (typeof this.response === "object" && this.response !== null) {
2118
+ return this.response;
2119
+ }
2120
+ return null;
2433
2121
  }
2434
- /**
2435
- * Completely disable 2FA for account.
2436
- *
2437
- * Requires verification code.
2438
- */
2439
- static cfgTotpDisableCreate(options) {
2440
- return (options.client ?? client).post({
2441
- security: [{ scheme: "bearer", type: "http" }],
2442
- url: "/cfg/totp/disable/",
2443
- ...options,
2444
- headers: {
2445
- "Content-Type": "application/json",
2446
- ...options.headers
2447
- }
2448
- });
2122
+ get fieldErrors() {
2123
+ const details = this.details;
2124
+ if (!details) return null;
2125
+ const fieldErrors = {};
2126
+ for (const [key, value] of Object.entries(details)) {
2127
+ if (Array.isArray(value)) fieldErrors[key] = value;
2128
+ }
2129
+ return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
2130
+ }
2131
+ get errorMessage() {
2132
+ const details = this.details;
2133
+ if (!details) return this.message;
2134
+ if (details.detail) {
2135
+ return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
2136
+ }
2137
+ if (details.error) return String(details.error);
2138
+ if (details.message) return String(details.message);
2139
+ const fieldErrors = this.fieldErrors;
2140
+ if (fieldErrors) {
2141
+ const firstField = Object.keys(fieldErrors)[0];
2142
+ if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
2143
+ }
2144
+ return this.message;
2145
+ }
2146
+ get isValidationError() {
2147
+ return this.statusCode === 400;
2148
+ }
2149
+ get isAuthError() {
2150
+ return this.statusCode === 401;
2151
+ }
2152
+ get isPermissionError() {
2153
+ return this.statusCode === 403;
2154
+ }
2155
+ get isNotFoundError() {
2156
+ return this.statusCode === 404;
2157
+ }
2158
+ get isServerError() {
2159
+ return this.statusCode >= 500 && this.statusCode < 600;
2449
2160
  }
2450
2161
  };
2451
- var TotpSetup = class {
2162
+
2163
+ // src/_api/generated/_cfg_centrifugo/api.ts
2164
+ var API2 = class {
2452
2165
  static {
2453
- __name(this, "TotpSetup");
2166
+ __name(this, "API");
2454
2167
  }
2455
- /**
2456
- * Start 2FA setup process.
2457
- *
2458
- * Creates a new TOTP device and returns QR code for scanning.
2459
- */
2460
- static cfgTotpSetupCreate(options) {
2461
- return (options?.client ?? client).post({
2462
- security: [{ scheme: "bearer", type: "http" }],
2463
- url: "/cfg/totp/setup/",
2464
- ...options,
2465
- headers: {
2466
- "Content-Type": "application/json",
2467
- ...options?.headers
2468
- }
2469
- });
2168
+ logger;
2169
+ cfgCentrifugo = CfgCentrifugo;
2170
+ constructor(_baseUrl, opts = {}) {
2171
+ this.logger = new APILogger(opts.logger);
2172
+ if (_baseUrl) auth.setBaseUrl(_baseUrl);
2173
+ if (opts.locale !== void 0) auth.setLocale(opts.locale);
2174
+ if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
2175
+ if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
2470
2176
  }
2471
- /**
2472
- * Confirm 2FA setup with first valid code.
2473
- *
2474
- * Activates the device and generates backup codes.
2475
- */
2476
- static cfgTotpSetupConfirmCreate(options) {
2477
- return (options.client ?? client).post({
2478
- security: [{ scheme: "bearer", type: "http" }],
2479
- url: "/cfg/totp/setup/confirm/",
2480
- ...options,
2481
- headers: {
2482
- "Content-Type": "application/json",
2483
- ...options.headers
2484
- }
2485
- });
2177
+ // ── Base URL ────────────────────────────────────────────────────────────
2178
+ getBaseUrl() {
2179
+ return auth.getBaseUrl();
2180
+ }
2181
+ setBaseUrl(url) {
2182
+ auth.setBaseUrl(url);
2183
+ }
2184
+ // ── Tokens ──────────────────────────────────────────────────────────────
2185
+ getToken() {
2186
+ return auth.getToken();
2187
+ }
2188
+ setToken(token) {
2189
+ auth.setToken(token);
2190
+ }
2191
+ getRefreshToken() {
2192
+ return auth.getRefreshToken();
2193
+ }
2194
+ setRefreshToken(token) {
2195
+ auth.setRefreshToken(token);
2196
+ }
2197
+ clearToken() {
2198
+ auth.clearTokens();
2199
+ }
2200
+ isAuthenticated() {
2201
+ return auth.isAuthenticated();
2202
+ }
2203
+ // ── Locale / API key ────────────────────────────────────────────────────
2204
+ getLocale() {
2205
+ return auth.getLocale();
2206
+ }
2207
+ setLocale(locale) {
2208
+ auth.setLocale(locale);
2209
+ }
2210
+ getApiKey() {
2211
+ return auth.getApiKey();
2212
+ }
2213
+ setApiKey(key) {
2214
+ auth.setApiKey(key);
2215
+ }
2216
+ // ── 401 handling ────────────────────────────────────────────────────────
2217
+ /** Fired only on terminal 401 (after refresh+retry path is exhausted). */
2218
+ onUnauthorized(cb) {
2219
+ auth.onUnauthorized(cb);
2220
+ }
2221
+ /** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
2222
+ setRefreshHandler(fn) {
2223
+ auth.setRefreshHandler(fn);
2486
2224
  }
2487
2225
  };
2488
- var TotpVerification = class {
2226
+
2227
+ // src/_api/generated/_cfg_totp/api.ts
2228
+ var API3 = class {
2489
2229
  static {
2490
- __name(this, "TotpVerification");
2230
+ __name(this, "API");
2491
2231
  }
2492
- /**
2493
- * Verify TOTP code for 2FA session.
2494
- *
2495
- * Completes authentication and returns JWT tokens on success.
2496
- */
2497
- static cfgTotpVerifyCreate(options) {
2498
- return (options.client ?? client).post({
2499
- security: [{ scheme: "bearer", type: "http" }],
2500
- url: "/cfg/totp/verify/",
2501
- ...options,
2502
- headers: {
2503
- "Content-Type": "application/json",
2504
- ...options.headers
2505
- }
2506
- });
2232
+ logger;
2233
+ cfgTotpBackupCodes = CfgTotpBackupCodes;
2234
+ cfgTotp = CfgTotp;
2235
+ cfgTotpSetup = CfgTotpSetup;
2236
+ cfgTotpVerify = CfgTotpVerify;
2237
+ constructor(_baseUrl, opts = {}) {
2238
+ this.logger = new APILogger(opts.logger);
2239
+ if (_baseUrl) auth.setBaseUrl(_baseUrl);
2240
+ if (opts.locale !== void 0) auth.setLocale(opts.locale);
2241
+ if (opts.apiKey !== void 0) auth.setApiKey(opts.apiKey);
2242
+ if (opts.withCredentials !== void 0) auth.setWithCredentials(opts.withCredentials);
2243
+ }
2244
+ // ── Base URL ────────────────────────────────────────────────────────────
2245
+ getBaseUrl() {
2246
+ return auth.getBaseUrl();
2247
+ }
2248
+ setBaseUrl(url) {
2249
+ auth.setBaseUrl(url);
2250
+ }
2251
+ // ── Tokens ──────────────────────────────────────────────────────────────
2252
+ getToken() {
2253
+ return auth.getToken();
2254
+ }
2255
+ setToken(token) {
2256
+ auth.setToken(token);
2257
+ }
2258
+ getRefreshToken() {
2259
+ return auth.getRefreshToken();
2260
+ }
2261
+ setRefreshToken(token) {
2262
+ auth.setRefreshToken(token);
2263
+ }
2264
+ clearToken() {
2265
+ auth.clearTokens();
2266
+ }
2267
+ isAuthenticated() {
2268
+ return auth.isAuthenticated();
2269
+ }
2270
+ // ── Locale / API key ────────────────────────────────────────────────────
2271
+ getLocale() {
2272
+ return auth.getLocale();
2273
+ }
2274
+ setLocale(locale) {
2275
+ auth.setLocale(locale);
2276
+ }
2277
+ getApiKey() {
2278
+ return auth.getApiKey();
2279
+ }
2280
+ setApiKey(key) {
2281
+ auth.setApiKey(key);
2282
+ }
2283
+ // ── 401 handling ────────────────────────────────────────────────────────
2284
+ /** Fired only on terminal 401 (after refresh+retry path is exhausted). */
2285
+ onUnauthorized(cb) {
2286
+ auth.onUnauthorized(cb);
2507
2287
  }
2508
- /**
2509
- * Verify backup recovery code for 2FA session.
2510
- *
2511
- * Alternative verification method when TOTP device unavailable.
2512
- */
2513
- static cfgTotpVerifyBackupCreate(options) {
2514
- return (options.client ?? client).post({
2515
- security: [{ scheme: "bearer", type: "http" }],
2516
- url: "/cfg/totp/verify/backup/",
2517
- ...options,
2518
- headers: {
2519
- "Content-Type": "application/json",
2520
- ...options.headers
2521
- }
2522
- });
2288
+ /** Provide a refresh strategy. See `auth.setRefreshHandler` for the contract. */
2289
+ setRefreshHandler(fn) {
2290
+ auth.setRefreshHandler(fn);
2523
2291
  }
2524
2292
  };
2525
2293
 
2294
+ // src/_api/generated/index.ts
2295
+ var CfgAccountsApi = new API();
2296
+ var CfgCentrifugoApi = new API2();
2297
+ var CfgTotpApi = new API3();
2298
+
2526
2299
  // src/auth/utils/analytics.ts
2527
2300
  var AnalyticsEvent = /* @__PURE__ */ ((AnalyticsEvent2) => {
2528
2301
  AnalyticsEvent2["AUTH_OTP_REQUEST"] = "auth_otp_request";
@@ -2611,7 +2384,7 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
2611
2384
  setError(null);
2612
2385
  try {
2613
2386
  authLogger.info("Verifying TOTP code...");
2614
- const result = await TotpVerification.cfgTotpVerifyCreate({
2387
+ const result = await CfgTotpVerify.cfgTotpVerifyCreate({
2615
2388
  body: { session_id: sessionId, code },
2616
2389
  throwOnError: true
2617
2390
  });
@@ -2655,7 +2428,7 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
2655
2428
  setError(null);
2656
2429
  try {
2657
2430
  authLogger.info("Verifying backup code...");
2658
- const result = await TotpVerification.cfgTotpVerifyBackupCreate({
2431
+ const result = await CfgTotpVerify.cfgTotpVerifyBackupCreate({
2659
2432
  body: {
2660
2433
  session_id: sessionId,
2661
2434
  backup_code: backupCode.replace(/\s+/g, "")
@@ -2999,7 +2772,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
2999
2772
  category: "auth" /* AUTH */,
3000
2773
  label: "github"
3001
2774
  });
3002
- const result = await OAuth.cfgAccountsOauthGithubAuthorizeCreate({
2775
+ const result = await CfgAccountsOauth.cfgAccountsOauthGithubAuthorizeCreate({
3003
2776
  body: {
3004
2777
  source_url: sourceUrl || (typeof window !== "undefined" ? window.location.href : "")
3005
2778
  },
@@ -3041,7 +2814,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
3041
2814
  sessionStorage.removeItem("oauth_state");
3042
2815
  sessionStorage.removeItem("oauth_provider");
3043
2816
  }
3044
- const result = await OAuth.cfgAccountsOauthGithubCallbackCreate({
2817
+ const result = await CfgAccountsOauth.cfgAccountsOauthGithubCallbackCreate({
3045
2818
  body: { code, state },
3046
2819
  throwOnError: true
3047
2820
  });
@@ -3120,7 +2893,7 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
3120
2893
  setSetupStep("scanning");
3121
2894
  try {
3122
2895
  authLogger.info("Starting 2FA setup...");
3123
- const result = await TotpSetup.cfgTotpSetupCreate({
2896
+ const result = await CfgTotpSetup.cfgTotpSetupCreate({
3124
2897
  body: { device_name: deviceName },
3125
2898
  throwOnError: true
3126
2899
  });
@@ -3164,7 +2937,7 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
3164
2937
  setSetupStep("confirming");
3165
2938
  try {
3166
2939
  authLogger.info("Confirming 2FA setup...");
3167
- const result = await TotpSetup.cfgTotpSetupConfirmCreate({
2940
+ const result = await CfgTotpSetup.cfgTotpSetupConfirmCreate({
3168
2941
  body: { device_id: setupData.deviceId, code },
3169
2942
  throwOnError: true
3170
2943
  });
@@ -3227,7 +3000,7 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
3227
3000
  setError(null);
3228
3001
  try {
3229
3002
  authLogger.info("Fetching 2FA status...");
3230
- const result = await TotpManagement.cfgTotpDevicesRetrieve({ throwOnError: true });
3003
+ const result = await CfgTotp.cfgTotpDevicesRetrieve({ throwOnError: true });
3231
3004
  const response = result.data;
3232
3005
  const mappedDevices = response.devices.map((device) => ({
3233
3006
  id: device.id,
@@ -3256,7 +3029,7 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
3256
3029
  setError(null);
3257
3030
  try {
3258
3031
  authLogger.info("Disabling 2FA...");
3259
- await TotpManagement.cfgTotpDisableCreate({ body: { code }, throwOnError: true });
3032
+ await CfgTotp.cfgTotpDisableCreate({ body: { code }, throwOnError: true });
3260
3033
  setHas2FAEnabled(false);
3261
3034
  setDevices([]);
3262
3035
  authLogger.info("2FA disabled successfully");
@@ -3835,7 +3608,7 @@ function useTokenRefresh(options = {}) {
3835
3608
  isRefreshingRef.current = true;
3836
3609
  authLogger.info("Refreshing token...");
3837
3610
  try {
3838
- const result = await Auth.cfgAccountsTokenRefreshCreate({
3611
+ const result = await CfgAccountsAuth.cfgAccountsTokenRefreshCreate({
3839
3612
  body: { refresh: refreshTokenValue },
3840
3613
  throwOnError: true
3841
3614
  });
@@ -3909,7 +3682,7 @@ var useDeleteAccount = /* @__PURE__ */ __name(() => {
3909
3682
  setError(null);
3910
3683
  try {
3911
3684
  authLogger.info("Deleting account...");
3912
- const result = await UserProfile.cfgAccountsProfileDeleteCreate({ throwOnError: true });
3685
+ const result = await CfgAccountsProfile.cfgAccountsProfileDeleteCreate({ throwOnError: true });
3913
3686
  const response = result.data;
3914
3687
  if (!response.success) {
3915
3688
  authLogger.error("Failed to delete account:", response.message);
@@ -3936,29 +3709,159 @@ var useDeleteAccount = /* @__PURE__ */ __name(() => {
3936
3709
  // src/auth/context/AccountsContext.tsx
3937
3710
  var import_react16 = require("react");
3938
3711
 
3939
- // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts
3712
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRegenerateCreate.ts
3713
+ var import_mutation = __toESM(require("swr/mutation"), 1);
3714
+
3715
+ // src/_api/generated/_cfg_accounts/schemas/APIKeyRegenerate.ts
3716
+ var import_zod = require("zod");
3717
+ var APIKeyRegenerateSchema = import_zod.z.object({
3718
+ key: import_zod.z.string(),
3719
+ reissued_at: import_zod.z.string().datetime({ offset: true })
3720
+ });
3721
+
3722
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyRetrieve.ts
3940
3723
  var import_swr = __toESM(require("swr"), 1);
3941
3724
 
3725
+ // src/_api/generated/_cfg_accounts/schemas/APIKey.ts
3726
+ var import_zod2 = require("zod");
3727
+ var APIKeySchema = import_zod2.z.object({
3728
+ key: import_zod2.z.string(),
3729
+ reissued_at: import_zod2.z.string().datetime({ offset: true }).nullable(),
3730
+ created_at: import_zod2.z.string().datetime({ offset: true })
3731
+ });
3732
+
3733
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsApiKeyTestCreate.ts
3734
+ var import_mutation2 = __toESM(require("swr/mutation"), 1);
3735
+
3736
+ // src/_api/generated/_cfg_accounts/schemas/APIKeyTestResult.ts
3737
+ var import_zod3 = require("zod");
3738
+ var APIKeyTestResultSchema = import_zod3.z.object({
3739
+ valid: import_zod3.z.boolean(),
3740
+ user_id: import_zod3.z.string().nullable()
3741
+ });
3742
+
3743
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts
3744
+ var import_swr2 = __toESM(require("swr"), 1);
3745
+
3746
+ // src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_connections_response_200_AutoRef.ts
3747
+ var import_zod6 = require("zod");
3748
+
3749
+ // src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts
3750
+ var import_zod5 = require("zod");
3751
+
3752
+ // src/_api/generated/_cfg_accounts/schemas/OAuthProviderEnum.ts
3753
+ var import_zod4 = require("zod");
3754
+ var OAuthProviderEnumSchema = import_zod4.z.enum(["github"]);
3755
+
3756
+ // src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts
3757
+ var OAuthConnectionSchema = import_zod5.z.object({
3758
+ id: import_zod5.z.number().int(),
3759
+ provider: OAuthProviderEnumSchema,
3760
+ provider_display: import_zod5.z.string(),
3761
+ provider_username: import_zod5.z.string(),
3762
+ provider_email: import_zod5.z.email(),
3763
+ provider_avatar_url: import_zod5.z.string(),
3764
+ connected_at: import_zod5.z.string().datetime({ offset: true }),
3765
+ last_login_at: import_zod5.z.string().datetime({ offset: true })
3766
+ });
3767
+
3768
+ // src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_connections_response_200_AutoRef.ts
3769
+ var cfg_accounts_oauth_connections_response_200_AutoRefSchema = import_zod6.z.array(OAuthConnectionSchema);
3770
+
3942
3771
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts
3943
- var import_mutation = __toESM(require("swr/mutation"), 1);
3772
+ var import_mutation3 = __toESM(require("swr/mutation"), 1);
3773
+
3774
+ // src/_api/generated/_cfg_accounts/schemas/cfg_accounts_oauth_disconnect_response_200_AutoRef.ts
3775
+ var import_zod7 = require("zod");
3776
+ var cfg_accounts_oauth_disconnect_response_200_AutoRefSchema = import_zod7.z.object({
3777
+ message: import_zod7.z.string().optional()
3778
+ });
3944
3779
 
3945
3780
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts
3946
- var import_mutation2 = __toESM(require("swr/mutation"), 1);
3781
+ var import_mutation4 = __toESM(require("swr/mutation"), 1);
3782
+
3783
+ // src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeResponse.ts
3784
+ var import_zod8 = require("zod");
3785
+ var OAuthAuthorizeResponseSchema = import_zod8.z.object({
3786
+ authorization_url: import_zod8.z.string(),
3787
+ state: import_zod8.z.string()
3788
+ });
3947
3789
 
3948
3790
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts
3949
- var import_mutation3 = __toESM(require("swr/mutation"), 1);
3791
+ var import_mutation5 = __toESM(require("swr/mutation"), 1);
3792
+
3793
+ // src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts
3794
+ var import_zod9 = require("zod");
3795
+ var OAuthTokenResponseSchema = import_zod9.z.object({
3796
+ requires_2fa: import_zod9.z.boolean().default(false).optional(),
3797
+ 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(),
3798
+ access: import_zod9.z.string().nullable().optional(),
3799
+ refresh: import_zod9.z.string().nullable().optional(),
3800
+ user: import_zod9.z.object({}).passthrough().nullable().optional(),
3801
+ is_new_user: import_zod9.z.boolean(),
3802
+ is_new_connection: import_zod9.z.boolean(),
3803
+ should_prompt_2fa: import_zod9.z.boolean().optional()
3804
+ });
3950
3805
 
3951
3806
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts
3952
- var import_swr2 = __toESM(require("swr"), 1);
3807
+ var import_swr3 = __toESM(require("swr"), 1);
3808
+
3809
+ // src/_api/generated/_cfg_accounts/schemas/OAuthProvidersResponse.ts
3810
+ var import_zod10 = require("zod");
3811
+ var OAuthProvidersResponseSchema = import_zod10.z.object({
3812
+ providers: import_zod10.z.array(import_zod10.z.object({}).passthrough())
3813
+ });
3814
+
3815
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts
3816
+ var import_mutation6 = __toESM(require("swr/mutation"), 1);
3817
+
3818
+ // src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts
3819
+ var import_zod11 = require("zod");
3820
+ var OTPRequestResponseSchema = import_zod11.z.object({
3821
+ message: import_zod11.z.string()
3822
+ });
3953
3823
 
3954
3824
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts
3955
- var import_mutation4 = __toESM(require("swr/mutation"), 1);
3956
3825
  function useCfgAccountsOtpRequestCreate(config) {
3957
- return (0, import_mutation4.default)(
3826
+ return (0, import_mutation6.default)(
3958
3827
  ["cfg_accounts_otp_request_create"],
3959
3828
  async (_key, { arg }) => {
3960
- const res = await Cfg.cfgAccountsOtpRequestCreate({ ...arg, throwOnError: true });
3961
- return res.data;
3829
+ const res = await CfgAccounts.cfgAccountsOtpRequestCreate({ ...arg, throwOnError: true });
3830
+ const data = res.data;
3831
+ const parsed = OTPRequestResponseSchema.safeParse(data);
3832
+ if (!parsed.success) {
3833
+ console.warn(
3834
+ "[zod] response did not match schema",
3835
+ {
3836
+ operation: "cfg_accounts_otp_request_create",
3837
+ method: "POST",
3838
+ path: "/cfg/accounts/otp/request/",
3839
+ issues: parsed.error.issues,
3840
+ data
3841
+ }
3842
+ );
3843
+ if (typeof window !== "undefined") {
3844
+ try {
3845
+ window.dispatchEvent(
3846
+ new CustomEvent("zod-validation-error", {
3847
+ detail: {
3848
+ operation: "cfg_accounts_otp_request_create",
3849
+ method: "POST",
3850
+ path: "/cfg/accounts/otp/request/",
3851
+ issues: parsed.error.issues,
3852
+ data,
3853
+ timestamp: /* @__PURE__ */ new Date()
3854
+ },
3855
+ bubbles: true,
3856
+ cancelable: false
3857
+ })
3858
+ );
3859
+ } catch {
3860
+ }
3861
+ }
3862
+ return data;
3863
+ }
3864
+ return parsed.data;
3962
3865
  },
3963
3866
  config
3964
3867
  );
@@ -3966,13 +3869,98 @@ function useCfgAccountsOtpRequestCreate(config) {
3966
3869
  __name(useCfgAccountsOtpRequestCreate, "useCfgAccountsOtpRequestCreate");
3967
3870
 
3968
3871
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts
3969
- var import_mutation5 = __toESM(require("swr/mutation"), 1);
3872
+ var import_mutation7 = __toESM(require("swr/mutation"), 1);
3873
+
3874
+ // src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
3875
+ var import_zod14 = require("zod");
3876
+
3877
+ // src/_api/generated/_cfg_accounts/schemas/User.ts
3878
+ var import_zod13 = require("zod");
3879
+
3880
+ // src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts
3881
+ var import_zod12 = require("zod");
3882
+ var CentrifugoTokenSchema = import_zod12.z.object({
3883
+ token: import_zod12.z.string(),
3884
+ centrifugo_url: import_zod12.z.string(),
3885
+ expires_at: import_zod12.z.string().datetime({ offset: true }),
3886
+ channels: import_zod12.z.array(import_zod12.z.string())
3887
+ });
3888
+
3889
+ // src/_api/generated/_cfg_accounts/schemas/User.ts
3890
+ var UserSchema = import_zod13.z.object({
3891
+ id: import_zod13.z.number().int(),
3892
+ email: import_zod13.z.email(),
3893
+ first_name: import_zod13.z.string().max(50).optional(),
3894
+ last_name: import_zod13.z.string().max(50).optional(),
3895
+ full_name: import_zod13.z.string(),
3896
+ initials: import_zod13.z.string(),
3897
+ display_username: import_zod13.z.string(),
3898
+ company: import_zod13.z.string().max(100).optional(),
3899
+ phone: import_zod13.z.string().max(20).optional(),
3900
+ position: import_zod13.z.string().max(100).optional(),
3901
+ language: import_zod13.z.string().max(10).optional(),
3902
+ timezone: import_zod13.z.string().max(64).optional(),
3903
+ avatar: import_zod13.z.string().nullable(),
3904
+ is_staff: import_zod13.z.boolean(),
3905
+ is_superuser: import_zod13.z.boolean(),
3906
+ date_joined: import_zod13.z.string().datetime({ offset: true }),
3907
+ last_login: import_zod13.z.string().datetime({ offset: true }).nullable(),
3908
+ unanswered_messages_count: import_zod13.z.number().int().default(0),
3909
+ centrifugo: CentrifugoTokenSchema.nullable(),
3910
+ api_key: import_zod13.z.string().nullable()
3911
+ });
3912
+
3913
+ // src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
3914
+ var OTPVerifyResponseSchema = import_zod14.z.object({
3915
+ requires_2fa: import_zod14.z.boolean().default(false).optional(),
3916
+ session_id: import_zod14.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(),
3917
+ refresh: import_zod14.z.string().nullable().optional(),
3918
+ access: import_zod14.z.string().nullable().optional(),
3919
+ user: UserSchema.nullable().optional(),
3920
+ should_prompt_2fa: import_zod14.z.boolean().optional()
3921
+ });
3922
+
3923
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts
3970
3924
  function useCfgAccountsOtpVerifyCreate(config) {
3971
- return (0, import_mutation5.default)(
3925
+ return (0, import_mutation7.default)(
3972
3926
  ["cfg_accounts_otp_verify_create"],
3973
3927
  async (_key, { arg }) => {
3974
- const res = await Cfg.cfgAccountsOtpVerifyCreate({ ...arg, throwOnError: true });
3975
- return res.data;
3928
+ const res = await CfgAccounts.cfgAccountsOtpVerifyCreate({ ...arg, throwOnError: true });
3929
+ const data = res.data;
3930
+ const parsed = OTPVerifyResponseSchema.safeParse(data);
3931
+ if (!parsed.success) {
3932
+ console.warn(
3933
+ "[zod] response did not match schema",
3934
+ {
3935
+ operation: "cfg_accounts_otp_verify_create",
3936
+ method: "POST",
3937
+ path: "/cfg/accounts/otp/verify/",
3938
+ issues: parsed.error.issues,
3939
+ data
3940
+ }
3941
+ );
3942
+ if (typeof window !== "undefined") {
3943
+ try {
3944
+ window.dispatchEvent(
3945
+ new CustomEvent("zod-validation-error", {
3946
+ detail: {
3947
+ operation: "cfg_accounts_otp_verify_create",
3948
+ method: "POST",
3949
+ path: "/cfg/accounts/otp/verify/",
3950
+ issues: parsed.error.issues,
3951
+ data,
3952
+ timestamp: /* @__PURE__ */ new Date()
3953
+ },
3954
+ bubbles: true,
3955
+ cancelable: false
3956
+ })
3957
+ );
3958
+ } catch {
3959
+ }
3960
+ }
3961
+ return data;
3962
+ }
3963
+ return parsed.data;
3976
3964
  },
3977
3965
  config
3978
3966
  );
@@ -3980,13 +3968,47 @@ function useCfgAccountsOtpVerifyCreate(config) {
3980
3968
  __name(useCfgAccountsOtpVerifyCreate, "useCfgAccountsOtpVerifyCreate");
3981
3969
 
3982
3970
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts
3983
- var import_mutation6 = __toESM(require("swr/mutation"), 1);
3971
+ var import_mutation8 = __toESM(require("swr/mutation"), 1);
3984
3972
  function useCfgAccountsProfileAvatarCreate(config) {
3985
- return (0, import_mutation6.default)(
3973
+ return (0, import_mutation8.default)(
3986
3974
  ["cfg_accounts_profile_avatar_create"],
3987
3975
  async (_key, { arg }) => {
3988
- const res = await Cfg.cfgAccountsProfileAvatarCreate({ ...arg, throwOnError: true });
3989
- return res.data;
3976
+ const res = await CfgAccountsProfile.cfgAccountsProfileAvatarCreate({ ...arg, throwOnError: true });
3977
+ const data = res.data;
3978
+ const parsed = UserSchema.safeParse(data);
3979
+ if (!parsed.success) {
3980
+ console.warn(
3981
+ "[zod] response did not match schema",
3982
+ {
3983
+ operation: "cfg_accounts_profile_avatar_create",
3984
+ method: "POST",
3985
+ path: "/cfg/accounts/profile/avatar/",
3986
+ issues: parsed.error.issues,
3987
+ data
3988
+ }
3989
+ );
3990
+ if (typeof window !== "undefined") {
3991
+ try {
3992
+ window.dispatchEvent(
3993
+ new CustomEvent("zod-validation-error", {
3994
+ detail: {
3995
+ operation: "cfg_accounts_profile_avatar_create",
3996
+ method: "POST",
3997
+ path: "/cfg/accounts/profile/avatar/",
3998
+ issues: parsed.error.issues,
3999
+ data,
4000
+ timestamp: /* @__PURE__ */ new Date()
4001
+ },
4002
+ bubbles: true,
4003
+ cancelable: false
4004
+ })
4005
+ );
4006
+ } catch {
4007
+ }
4008
+ }
4009
+ return data;
4010
+ }
4011
+ return parsed.data;
3990
4012
  },
3991
4013
  config
3992
4014
  );
@@ -3994,19 +4016,60 @@ function useCfgAccountsProfileAvatarCreate(config) {
3994
4016
  __name(useCfgAccountsProfileAvatarCreate, "useCfgAccountsProfileAvatarCreate");
3995
4017
 
3996
4018
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts
3997
- var import_mutation7 = __toESM(require("swr/mutation"), 1);
4019
+ var import_mutation9 = __toESM(require("swr/mutation"), 1);
4020
+
4021
+ // src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts
4022
+ var import_zod15 = require("zod");
4023
+ var AccountDeleteResponseSchema = import_zod15.z.object({
4024
+ success: import_zod15.z.boolean(),
4025
+ message: import_zod15.z.string()
4026
+ });
3998
4027
 
3999
4028
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts
4000
- var import_mutation8 = __toESM(require("swr/mutation"), 1);
4029
+ var import_mutation10 = __toESM(require("swr/mutation"), 1);
4001
4030
 
4002
4031
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts
4003
- var import_mutation9 = __toESM(require("swr/mutation"), 1);
4032
+ var import_mutation11 = __toESM(require("swr/mutation"), 1);
4004
4033
  function useCfgAccountsProfilePartialUpdate(config) {
4005
- return (0, import_mutation9.default)(
4034
+ return (0, import_mutation11.default)(
4006
4035
  ["cfg_accounts_profile_partial_update"],
4007
4036
  async (_key, { arg }) => {
4008
- const res = await Cfg.cfgAccountsProfilePartialUpdate({ ...arg, throwOnError: true });
4009
- return res.data;
4037
+ const res = await CfgAccountsProfile.cfgAccountsProfilePartialUpdate({ ...arg, throwOnError: true });
4038
+ const data = res.data;
4039
+ const parsed = UserSchema.safeParse(data);
4040
+ if (!parsed.success) {
4041
+ console.warn(
4042
+ "[zod] response did not match schema",
4043
+ {
4044
+ operation: "cfg_accounts_profile_partial_update",
4045
+ method: "PUT",
4046
+ path: "/cfg/accounts/profile/partial/",
4047
+ issues: parsed.error.issues,
4048
+ data
4049
+ }
4050
+ );
4051
+ if (typeof window !== "undefined") {
4052
+ try {
4053
+ window.dispatchEvent(
4054
+ new CustomEvent("zod-validation-error", {
4055
+ detail: {
4056
+ operation: "cfg_accounts_profile_partial_update",
4057
+ method: "PUT",
4058
+ path: "/cfg/accounts/profile/partial/",
4059
+ issues: parsed.error.issues,
4060
+ data,
4061
+ timestamp: /* @__PURE__ */ new Date()
4062
+ },
4063
+ bubbles: true,
4064
+ cancelable: false
4065
+ })
4066
+ );
4067
+ } catch {
4068
+ }
4069
+ }
4070
+ return data;
4071
+ }
4072
+ return parsed.data;
4010
4073
  },
4011
4074
  config
4012
4075
  );
@@ -4014,19 +4077,53 @@ function useCfgAccountsProfilePartialUpdate(config) {
4014
4077
  __name(useCfgAccountsProfilePartialUpdate, "useCfgAccountsProfilePartialUpdate");
4015
4078
 
4016
4079
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts
4017
- var import_swr3 = __toESM(require("swr"), 1);
4080
+ var import_swr4 = __toESM(require("swr"), 1);
4018
4081
 
4019
4082
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts
4020
- var import_mutation10 = __toESM(require("swr/mutation"), 1);
4083
+ var import_mutation12 = __toESM(require("swr/mutation"), 1);
4021
4084
 
4022
4085
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts
4023
- var import_mutation11 = __toESM(require("swr/mutation"), 1);
4086
+ var import_mutation13 = __toESM(require("swr/mutation"), 1);
4024
4087
  function useCfgAccountsProfileUpdateUpdate(config) {
4025
- return (0, import_mutation11.default)(
4088
+ return (0, import_mutation13.default)(
4026
4089
  ["cfg_accounts_profile_update_update"],
4027
4090
  async (_key, { arg }) => {
4028
- const res = await Cfg.cfgAccountsProfileUpdateUpdate({ ...arg, throwOnError: true });
4029
- return res.data;
4091
+ const res = await CfgAccountsProfile.cfgAccountsProfileUpdateUpdate({ ...arg, throwOnError: true });
4092
+ const data = res.data;
4093
+ const parsed = UserSchema.safeParse(data);
4094
+ if (!parsed.success) {
4095
+ console.warn(
4096
+ "[zod] response did not match schema",
4097
+ {
4098
+ operation: "cfg_accounts_profile_update_update",
4099
+ method: "PUT",
4100
+ path: "/cfg/accounts/profile/update/",
4101
+ issues: parsed.error.issues,
4102
+ data
4103
+ }
4104
+ );
4105
+ if (typeof window !== "undefined") {
4106
+ try {
4107
+ window.dispatchEvent(
4108
+ new CustomEvent("zod-validation-error", {
4109
+ detail: {
4110
+ operation: "cfg_accounts_profile_update_update",
4111
+ method: "PUT",
4112
+ path: "/cfg/accounts/profile/update/",
4113
+ issues: parsed.error.issues,
4114
+ data,
4115
+ timestamp: /* @__PURE__ */ new Date()
4116
+ },
4117
+ bubbles: true,
4118
+ cancelable: false
4119
+ })
4120
+ );
4121
+ } catch {
4122
+ }
4123
+ }
4124
+ return data;
4125
+ }
4126
+ return parsed.data;
4030
4127
  },
4031
4128
  config
4032
4129
  );
@@ -4034,206 +4131,155 @@ function useCfgAccountsProfileUpdateUpdate(config) {
4034
4131
  __name(useCfgAccountsProfileUpdateUpdate, "useCfgAccountsProfileUpdateUpdate");
4035
4132
 
4036
4133
  // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts
4037
- var import_mutation12 = __toESM(require("swr/mutation"), 1);
4134
+ var import_mutation14 = __toESM(require("swr/mutation"), 1);
4135
+
4136
+ // src/_api/generated/_cfg_accounts/schemas/TokenRefresh.ts
4137
+ var import_zod16 = require("zod");
4138
+ var TokenRefreshSchema = import_zod16.z.object({
4139
+ access: import_zod16.z.string(),
4140
+ refresh: import_zod16.z.string()
4141
+ });
4142
+
4143
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts
4038
4144
  function useCfgAccountsTokenRefreshCreate(config) {
4039
- return (0, import_mutation12.default)(
4145
+ return (0, import_mutation14.default)(
4040
4146
  ["cfg_accounts_token_refresh_create"],
4041
4147
  async (_key, { arg }) => {
4042
- const res = await Cfg.cfgAccountsTokenRefreshCreate({ ...arg, throwOnError: true });
4043
- return res.data;
4148
+ const res = await CfgAccountsAuth.cfgAccountsTokenRefreshCreate({ ...arg, throwOnError: true });
4149
+ const data = res.data;
4150
+ const parsed = TokenRefreshSchema.safeParse(data);
4151
+ if (!parsed.success) {
4152
+ console.warn(
4153
+ "[zod] response did not match schema",
4154
+ {
4155
+ operation: "cfg_accounts_token_refresh_create",
4156
+ method: "POST",
4157
+ path: "/cfg/accounts/token/refresh/",
4158
+ issues: parsed.error.issues,
4159
+ data
4160
+ }
4161
+ );
4162
+ if (typeof window !== "undefined") {
4163
+ try {
4164
+ window.dispatchEvent(
4165
+ new CustomEvent("zod-validation-error", {
4166
+ detail: {
4167
+ operation: "cfg_accounts_token_refresh_create",
4168
+ method: "POST",
4169
+ path: "/cfg/accounts/token/refresh/",
4170
+ issues: parsed.error.issues,
4171
+ data,
4172
+ timestamp: /* @__PURE__ */ new Date()
4173
+ },
4174
+ bubbles: true,
4175
+ cancelable: false
4176
+ })
4177
+ );
4178
+ } catch {
4179
+ }
4180
+ }
4181
+ return data;
4182
+ }
4183
+ return parsed.data;
4044
4184
  },
4045
4185
  config
4046
4186
  );
4047
4187
  }
4048
4188
  __name(useCfgAccountsTokenRefreshCreate, "useCfgAccountsTokenRefreshCreate");
4049
4189
 
4050
- // src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts
4051
- var import_zod = require("zod");
4052
- var AccountDeleteResponseSchema = import_zod.z.object({
4053
- message: import_zod.z.string(),
4054
- success: import_zod.z.boolean()
4190
+ // src/_api/generated/_cfg_accounts/schemas/APIKeyRequest.ts
4191
+ var import_zod17 = require("zod");
4192
+ var APIKeyRequestSchema = import_zod17.z.object({
4193
+ key: import_zod17.z.string().min(1),
4194
+ reissued_at: import_zod17.z.string().datetime({ offset: true }).nullable(),
4195
+ created_at: import_zod17.z.string().datetime({ offset: true })
4055
4196
  });
4056
4197
 
4057
- // src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts
4058
- var import_zod2 = require("zod");
4059
- var CentrifugoTokenSchema = import_zod2.z.object({
4060
- centrifugo_url: import_zod2.z.string(),
4061
- channels: import_zod2.z.array(import_zod2.z.string()),
4062
- expires_at: import_zod2.z.string().datetime({ offset: true }),
4063
- token: import_zod2.z.string()
4198
+ // src/_api/generated/_cfg_accounts/schemas/APIKeyTestRequest.ts
4199
+ var import_zod18 = require("zod");
4200
+ var APIKeyTestRequestSchema = import_zod18.z.object({
4201
+ key: import_zod18.z.string().min(1)
4064
4202
  });
4065
4203
 
4066
4204
  // src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts
4067
- var import_zod3 = require("zod");
4068
- var CfgUserUpdateRequestSchema = import_zod3.z.object({
4069
- company: import_zod3.z.string().max(100).optional(),
4070
- first_name: import_zod3.z.string().max(50).optional(),
4071
- language: import_zod3.z.string().max(10).optional(),
4072
- last_name: import_zod3.z.string().max(50).optional(),
4073
- phone: import_zod3.z.string().max(20).optional(),
4074
- position: import_zod3.z.string().max(100).optional()
4205
+ var import_zod19 = require("zod");
4206
+ var CfgUserUpdateRequestSchema = import_zod19.z.object({
4207
+ first_name: import_zod19.z.string().max(50).optional(),
4208
+ last_name: import_zod19.z.string().max(50).optional(),
4209
+ company: import_zod19.z.string().max(100).optional(),
4210
+ phone: import_zod19.z.string().max(20).optional(),
4211
+ position: import_zod19.z.string().max(100).optional(),
4212
+ language: import_zod19.z.string().max(10).optional(),
4213
+ timezone: import_zod19.z.string().max(64).optional()
4075
4214
  });
4076
4215
 
4077
4216
  // src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts
4078
- var import_zod4 = require("zod");
4079
- var OAuthAuthorizeRequestRequestSchema = import_zod4.z.object({
4080
- redirect_uri: import_zod4.z.string().optional(),
4081
- source_url: import_zod4.z.string().optional()
4082
- });
4083
-
4084
- // src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeResponse.ts
4085
- var import_zod5 = require("zod");
4086
- var OAuthAuthorizeResponseSchema = import_zod5.z.object({
4087
- authorization_url: import_zod5.z.string(),
4088
- state: import_zod5.z.string()
4217
+ var import_zod20 = require("zod");
4218
+ var OAuthAuthorizeRequestRequestSchema = import_zod20.z.object({
4219
+ redirect_uri: import_zod20.z.string().optional(),
4220
+ source_url: import_zod20.z.string().optional()
4089
4221
  });
4090
4222
 
4091
4223
  // src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts
4092
- var import_zod6 = require("zod");
4093
- var OAuthCallbackRequestRequestSchema = import_zod6.z.object({
4094
- code: import_zod6.z.string().min(10).max(500),
4095
- redirect_uri: import_zod6.z.string().optional(),
4096
- state: import_zod6.z.string().min(20).max(100)
4097
- });
4098
-
4099
- // src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts
4100
- var import_zod8 = require("zod");
4101
-
4102
- // src/_api/generated/_cfg_accounts/schemas/ProviderEnum.ts
4103
- var import_zod7 = require("zod");
4104
- var ProviderEnumSchema = import_zod7.z.enum(["github"]);
4105
-
4106
- // src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts
4107
- var OAuthConnectionSchema = import_zod8.z.object({
4108
- connected_at: import_zod8.z.string().datetime({ offset: true }),
4109
- id: import_zod8.z.number().int(),
4110
- last_login_at: import_zod8.z.string().datetime({ offset: true }),
4111
- provider: ProviderEnumSchema,
4112
- provider_avatar_url: import_zod8.z.string(),
4113
- provider_display: import_zod8.z.string(),
4114
- provider_email: import_zod8.z.email(),
4115
- provider_username: import_zod8.z.string()
4224
+ var import_zod21 = require("zod");
4225
+ var OAuthCallbackRequestRequestSchema = import_zod21.z.object({
4226
+ code: import_zod21.z.string().min(10).max(500),
4227
+ state: import_zod21.z.string().min(20).max(100),
4228
+ redirect_uri: import_zod21.z.string().optional()
4116
4229
  });
4117
4230
 
4118
4231
  // src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts
4119
- var import_zod9 = require("zod");
4120
- var OAuthDisconnectRequestRequestSchema = import_zod9.z.object({
4121
- provider: ProviderEnumSchema
4232
+ var import_zod22 = require("zod");
4233
+ var OAuthDisconnectRequestRequestSchema = import_zod22.z.object({
4234
+ provider: OAuthProviderEnumSchema
4122
4235
  });
4123
4236
 
4124
4237
  // src/_api/generated/_cfg_accounts/schemas/OAuthError.ts
4125
- var import_zod10 = require("zod");
4126
- var OAuthErrorSchema = import_zod10.z.object({
4127
- error: import_zod10.z.string(),
4128
- error_description: import_zod10.z.string().optional()
4129
- });
4130
-
4131
- // src/_api/generated/_cfg_accounts/schemas/OAuthProvidersResponse.ts
4132
- var import_zod11 = require("zod");
4133
- var OAuthProvidersResponseSchema = import_zod11.z.object({
4134
- providers: import_zod11.z.array(import_zod11.z.object({}).passthrough())
4135
- });
4136
-
4137
- // src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts
4138
- var import_zod12 = require("zod");
4139
- var OAuthTokenResponseSchema = import_zod12.z.object({
4140
- access: import_zod12.z.string().nullable().optional(),
4141
- is_new_connection: import_zod12.z.boolean(),
4142
- is_new_user: import_zod12.z.boolean(),
4143
- refresh: import_zod12.z.string().nullable().optional(),
4144
- requires_2fa: import_zod12.z.boolean().default(false).optional(),
4145
- session_id: import_zod12.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(),
4146
- should_prompt_2fa: import_zod12.z.boolean().optional(),
4147
- user: import_zod12.z.object({}).passthrough().nullable().optional()
4238
+ var import_zod23 = require("zod");
4239
+ var OAuthErrorSchema = import_zod23.z.object({
4240
+ error: import_zod23.z.string(),
4241
+ error_description: import_zod23.z.string().optional()
4148
4242
  });
4149
4243
 
4150
4244
  // src/_api/generated/_cfg_accounts/schemas/OTPErrorResponse.ts
4151
- var import_zod13 = require("zod");
4152
- var OTPErrorResponseSchema = import_zod13.z.object({
4153
- error: import_zod13.z.string(),
4154
- error_code: import_zod13.z.string().nullable().optional(),
4155
- retry_after: import_zod13.z.number().int().nullable().optional()
4245
+ var import_zod24 = require("zod");
4246
+ var OTPErrorResponseSchema = import_zod24.z.object({
4247
+ error: import_zod24.z.string(),
4248
+ error_code: import_zod24.z.string().nullable().optional(),
4249
+ retry_after: import_zod24.z.number().int().nullable().optional()
4156
4250
  });
4157
4251
 
4158
4252
  // src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts
4159
- var import_zod14 = require("zod");
4160
- var OTPRequestRequestSchema = import_zod14.z.object({
4161
- identifier: import_zod14.z.string().min(1),
4162
- source_url: import_zod14.z.string().optional()
4163
- });
4164
-
4165
- // src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts
4166
- var import_zod15 = require("zod");
4167
- var OTPRequestResponseSchema = import_zod15.z.object({
4168
- message: import_zod15.z.string()
4253
+ var import_zod25 = require("zod");
4254
+ var OTPRequestRequestSchema = import_zod25.z.object({
4255
+ identifier: import_zod25.z.string().min(1),
4256
+ source_url: import_zod25.z.string().optional()
4169
4257
  });
4170
4258
 
4171
4259
  // src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts
4172
- var import_zod16 = require("zod");
4173
- var OTPVerifyRequestSchema = import_zod16.z.object({
4174
- identifier: import_zod16.z.string().min(1),
4175
- otp: import_zod16.z.string().min(6).max(6),
4176
- source_url: import_zod16.z.string().optional()
4177
- });
4178
-
4179
- // src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
4180
- var import_zod18 = require("zod");
4181
-
4182
- // src/_api/generated/_cfg_accounts/schemas/User.ts
4183
- var import_zod17 = require("zod");
4184
- var UserSchema = import_zod17.z.object({
4185
- avatar: import_zod17.z.string().nullable(),
4186
- centrifugo: CentrifugoTokenSchema.nullable(),
4187
- company: import_zod17.z.string().max(100).optional(),
4188
- date_joined: import_zod17.z.string().datetime({ offset: true }),
4189
- display_username: import_zod17.z.string(),
4190
- email: import_zod17.z.email(),
4191
- first_name: import_zod17.z.string().max(50).optional(),
4192
- full_name: import_zod17.z.string(),
4193
- id: import_zod17.z.number().int(),
4194
- initials: import_zod17.z.string(),
4195
- is_staff: import_zod17.z.boolean(),
4196
- is_superuser: import_zod17.z.boolean(),
4197
- language: import_zod17.z.string().max(10).optional(),
4198
- last_login: import_zod17.z.string().datetime({ offset: true }).nullable(),
4199
- last_name: import_zod17.z.string().max(50).optional(),
4200
- phone: import_zod17.z.string().max(20).optional(),
4201
- position: import_zod17.z.string().max(100).optional(),
4202
- unanswered_messages_count: import_zod17.z.number().int().default(0)
4203
- });
4204
-
4205
- // src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
4206
- var OTPVerifyResponseSchema = import_zod18.z.object({
4207
- access: import_zod18.z.string().nullable().optional(),
4208
- refresh: import_zod18.z.string().nullable().optional(),
4209
- requires_2fa: import_zod18.z.boolean().default(false).optional(),
4210
- session_id: import_zod18.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(),
4211
- should_prompt_2fa: import_zod18.z.boolean().optional(),
4212
- user: UserSchema.nullable().optional()
4260
+ var import_zod26 = require("zod");
4261
+ var OTPVerifyRequestSchema = import_zod26.z.object({
4262
+ identifier: import_zod26.z.string().min(1),
4263
+ otp: import_zod26.z.string().min(4).max(4),
4264
+ source_url: import_zod26.z.string().optional()
4213
4265
  });
4214
4266
 
4215
4267
  // src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts
4216
- var import_zod19 = require("zod");
4217
- var PatchedCfgUserUpdateRequestSchema = import_zod19.z.object({
4218
- company: import_zod19.z.string().max(100).optional(),
4219
- first_name: import_zod19.z.string().max(50).optional(),
4220
- language: import_zod19.z.string().max(10).optional(),
4221
- last_name: import_zod19.z.string().max(50).optional(),
4222
- phone: import_zod19.z.string().max(20).optional(),
4223
- position: import_zod19.z.string().max(100).optional()
4224
- });
4225
-
4226
- // src/_api/generated/_cfg_accounts/schemas/TokenRefresh.ts
4227
- var import_zod20 = require("zod");
4228
- var TokenRefreshSchema = import_zod20.z.object({
4229
- access: import_zod20.z.string(),
4230
- refresh: import_zod20.z.string()
4268
+ var import_zod27 = require("zod");
4269
+ var PatchedCfgUserUpdateRequestSchema = import_zod27.z.object({
4270
+ first_name: import_zod27.z.string().max(50).optional(),
4271
+ last_name: import_zod27.z.string().max(50).optional(),
4272
+ company: import_zod27.z.string().max(100).optional(),
4273
+ phone: import_zod27.z.string().max(20).optional(),
4274
+ position: import_zod27.z.string().max(100).optional(),
4275
+ language: import_zod27.z.string().max(10).optional(),
4276
+ timezone: import_zod27.z.string().max(64).optional()
4231
4277
  });
4232
4278
 
4233
4279
  // src/_api/generated/_cfg_accounts/schemas/TokenRefreshRequest.ts
4234
- var import_zod21 = require("zod");
4235
- var TokenRefreshRequestSchema = import_zod21.z.object({
4236
- refresh: import_zod21.z.string().min(1)
4280
+ var import_zod28 = require("zod");
4281
+ var TokenRefreshRequestSchema = import_zod28.z.object({
4282
+ refresh: import_zod28.z.string().min(1)
4237
4283
  });
4238
4284
 
4239
4285
  // src/auth/context/AccountsContext.tsx
@@ -4271,7 +4317,7 @@ function AccountsProvider({ children }) {
4271
4317
  setProfileError(null);
4272
4318
  try {
4273
4319
  authLogger.debug(`Fetching profile from API (caller: ${callerId}, force: ${force})`);
4274
- const res = await UserProfile.cfgAccountsProfileRetrieve({ throwOnError: true });
4320
+ const res = await CfgAccountsProfile.cfgAccountsProfileRetrieve({ throwOnError: true });
4275
4321
  const result = res.data;
4276
4322
  setProfile(result);
4277
4323
  profileRef.current = result;
@@ -4337,7 +4383,7 @@ function AccountsProvider({ children }) {
4337
4383
  setProfileError(null);
4338
4384
  clearProfileCache();
4339
4385
  }, []);
4340
- const value = {
4386
+ const value = (0, import_react16.useMemo)(() => ({
4341
4387
  profile,
4342
4388
  isLoadingProfile,
4343
4389
  profileError,
@@ -4349,7 +4395,19 @@ function AccountsProvider({ children }) {
4349
4395
  verifyOTP,
4350
4396
  refreshToken,
4351
4397
  logout
4352
- };
4398
+ }), [
4399
+ profile,
4400
+ isLoadingProfile,
4401
+ profileError,
4402
+ updateProfile,
4403
+ partialUpdateProfile,
4404
+ uploadAvatar,
4405
+ refreshProfile,
4406
+ requestOTP,
4407
+ verifyOTP,
4408
+ refreshToken,
4409
+ logout
4410
+ ]);
4353
4411
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AccountsContext.Provider, { value, children });
4354
4412
  }
4355
4413
  __name(AccountsProvider, "AccountsProvider");
@@ -4788,11 +4846,13 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
4788
4846
  uploadAvatar
4789
4847
  ]
4790
4848
  );
4791
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_swr4.SWRConfig, { value: swrConfig, children }) });
4849
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_swr5.SWRConfig, { value: swrConfig, children }) });
4792
4850
  }, "AuthProviderInternal");
4793
- var AuthProvider = /* @__PURE__ */ __name(({ children, config }) => {
4851
+ function AuthProviderRaw({ children, config }) {
4794
4852
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AccountsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthProviderInternal, { config, children }) });
4795
- }, "AuthProvider");
4853
+ }
4854
+ __name(AuthProviderRaw, "AuthProviderRaw");
4855
+ var AuthProvider = (0, import_react17.memo)(AuthProviderRaw);
4796
4856
  var defaultAuthState = {
4797
4857
  user: null,
4798
4858
  isLoading: false,