@djangocfg/api 2.1.327 → 2.1.331

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 (170) hide show
  1. package/dist/auth-server.cjs +185 -3471
  2. package/dist/auth-server.cjs.map +1 -1
  3. package/dist/auth-server.mjs +185 -3471
  4. package/dist/auth-server.mjs.map +1 -1
  5. package/dist/auth.cjs +952 -3305
  6. package/dist/auth.cjs.map +1 -1
  7. package/dist/auth.d.cts +35 -35
  8. package/dist/auth.d.ts +35 -35
  9. package/dist/auth.mjs +952 -3305
  10. package/dist/auth.mjs.map +1 -1
  11. package/dist/clients.cjs +90 -3396
  12. package/dist/clients.cjs.map +1 -1
  13. package/dist/clients.d.cts +4 -2508
  14. package/dist/clients.d.ts +4 -2508
  15. package/dist/clients.mjs +90 -3396
  16. package/dist/clients.mjs.map +1 -1
  17. package/dist/index.cjs +985 -3052
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1544 -1938
  20. package/dist/index.d.ts +1544 -1938
  21. package/dist/index.mjs +985 -3052
  22. package/dist/index.mjs.map +1 -1
  23. package/package.json +2 -2
  24. package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/api.ts +11 -55
  25. package/src/_api/generated/{cfg_totp → _cfg_accounts}/events.ts +3 -3
  26. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/index.ts +1 -1
  27. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthConnectionsList.ts +5 -6
  28. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthDisconnectCreate.ts +3 -3
  29. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts +3 -3
  30. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthGithubCallbackCreate.ts +3 -3
  31. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOauthProvidersRetrieve.ts +5 -6
  32. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpRequestCreate.ts +3 -3
  33. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsOtpVerifyCreate.ts +3 -3
  34. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileAvatarCreate.ts +3 -3
  35. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileDeleteCreate.ts +3 -3
  36. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialPartialUpdate.ts +3 -3
  37. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfilePartialUpdate.ts +3 -3
  38. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileRetrieve.ts +5 -6
  39. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts +3 -3
  40. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsProfileUpdateUpdate.ts +3 -3
  41. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/hooks/useCfgAccountsTokenRefreshCreate.ts +3 -3
  42. package/src/_api/generated/{cfg_centrifugo → _cfg_accounts}/index.ts +3 -3
  43. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/AccountDeleteResponse.ts +3 -3
  44. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CentrifugoToken.ts +4 -4
  45. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/CfgUserUpdateRequest.ts +4 -4
  46. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeRequestRequest.ts +2 -2
  47. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthAuthorizeResponse.ts +2 -2
  48. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthCallbackRequestRequest.ts +3 -3
  49. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthConnection.ts +6 -6
  50. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthDisconnectRequestRequest.ts +2 -2
  51. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthError.ts +2 -2
  52. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthProvidersResponse.ts +3 -3
  53. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OAuthTokenResponse.ts +7 -7
  54. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPErrorResponse.ts +2 -2
  55. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestRequest.ts +2 -2
  56. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPRequestResponse.ts +2 -2
  57. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyRequest.ts +2 -2
  58. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/OTPVerifyResponse.ts +6 -6
  59. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/PatchedCfgUserUpdateRequest.ts +4 -4
  60. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/ProviderEnum.ts +2 -2
  61. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefresh.ts +2 -2
  62. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/TokenRefreshRequest.ts +2 -2
  63. package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/User.ts +13 -13
  64. package/src/_api/generated/_cfg_accounts/sdk.gen.ts +5 -0
  65. package/src/_api/generated/_cfg_accounts/types.gen.ts +5 -0
  66. package/src/_api/generated/{cfg_totp → _cfg_centrifugo}/api.ts +11 -72
  67. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/events.ts +3 -3
  68. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/index.ts +1 -1
  69. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/hooks/useCfgCentrifugoAuthTokenRetrieve.ts +5 -6
  70. package/src/_api/generated/{cfg_accounts → _cfg_centrifugo}/index.ts +3 -3
  71. package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/ConnectionTokenResponse.ts +4 -4
  72. package/src/_api/generated/_cfg_centrifugo/sdk.gen.ts +5 -0
  73. package/src/_api/generated/_cfg_centrifugo/types.gen.ts +5 -0
  74. package/src/_api/generated/{cfg_accounts → _cfg_totp}/api.ts +11 -78
  75. package/src/_api/generated/{cfg_accounts → _cfg_totp}/events.ts +3 -3
  76. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/index.ts +1 -1
  77. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRegenerateCreate.ts +3 -3
  78. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpBackupCodesRetrieve.ts +5 -6
  79. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesDestroy.ts +3 -3
  80. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDevicesRetrieve.ts +5 -6
  81. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpDisableCreate.ts +3 -3
  82. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupConfirmCreate.ts +3 -3
  83. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpSetupCreate.ts +3 -3
  84. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyBackupCreate.ts +3 -3
  85. package/src/_api/generated/{cfg_totp → _cfg_totp}/hooks/useCfgTotpVerifyCreate.ts +3 -3
  86. package/src/_api/generated/{cfg_totp → _cfg_totp}/index.ts +3 -3
  87. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateRequest.ts +2 -2
  88. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesRegenerateResponse.ts +2 -2
  89. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/BackupCodesStatus.ts +2 -2
  90. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupRequest.ts +3 -3
  91. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/ConfirmSetupResponse.ts +3 -3
  92. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceList.ts +6 -6
  93. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListResponse.ts +2 -2
  94. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DeviceListStatusEnum.ts +2 -2
  95. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/DisableRequest.ts +2 -2
  96. package/src/_api/generated/_cfg_totp/schemas/SetupRequest.ts +11 -0
  97. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/SetupResponse.ts +4 -4
  98. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/TotpVerifyUser.ts +12 -12
  99. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyBackupRequest.ts +3 -3
  100. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyRequest.ts +3 -3
  101. package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/VerifyResponse.ts +4 -4
  102. package/src/_api/generated/_cfg_totp/sdk.gen.ts +5 -0
  103. package/src/_api/generated/_cfg_totp/types.gen.ts +5 -0
  104. package/src/_api/generated/index.ts +11 -13
  105. package/src/_api/generated/{cfg_accounts/sdk.gen.ts → sdk.gen.ts} +455 -1
  106. package/src/_api/generated/{cfg_accounts/types.gen.ts → types.gen.ts} +607 -77
  107. package/src/auth/context/AccountsContext.tsx +10 -10
  108. package/src/auth/context/AuthContext.tsx +1 -1
  109. package/src/auth/hooks/useDeleteAccount.ts +2 -1
  110. package/src/auth/hooks/useGithubAuth.ts +3 -2
  111. package/src/auth/hooks/useTokenRefresh.ts +2 -1
  112. package/src/auth/hooks/useTwoFactor.ts +4 -3
  113. package/src/auth/hooks/useTwoFactorSetup.ts +3 -2
  114. package/src/auth/hooks/useTwoFactorStatus.ts +4 -3
  115. package/src/auth/middlewares/tokenRefresh.ts +2 -1
  116. package/src/clients.ts +3 -3
  117. package/src/index.ts +22 -5
  118. package/src/server.ts +9 -9
  119. package/src/_api/generated/cfg_centrifugo/client/client.gen.ts +0 -280
  120. package/src/_api/generated/cfg_centrifugo/client/index.ts +0 -25
  121. package/src/_api/generated/cfg_centrifugo/client/types.gen.ts +0 -217
  122. package/src/_api/generated/cfg_centrifugo/client/utils.gen.ts +0 -318
  123. package/src/_api/generated/cfg_centrifugo/client.gen.ts +0 -16
  124. package/src/_api/generated/cfg_centrifugo/core/auth.gen.ts +0 -41
  125. package/src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts +0 -82
  126. package/src/_api/generated/cfg_centrifugo/core/params.gen.ts +0 -169
  127. package/src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts +0 -171
  128. package/src/_api/generated/cfg_centrifugo/core/queryKeySerializer.gen.ts +0 -117
  129. package/src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts +0 -242
  130. package/src/_api/generated/cfg_centrifugo/core/types.gen.ts +0 -104
  131. package/src/_api/generated/cfg_centrifugo/core/utils.gen.ts +0 -140
  132. package/src/_api/generated/cfg_centrifugo/sdk.gen.ts +0 -64
  133. package/src/_api/generated/cfg_centrifugo/types.gen.ts +0 -61
  134. package/src/_api/generated/cfg_totp/client/client.gen.ts +0 -280
  135. package/src/_api/generated/cfg_totp/client/index.ts +0 -25
  136. package/src/_api/generated/cfg_totp/client/types.gen.ts +0 -217
  137. package/src/_api/generated/cfg_totp/client/utils.gen.ts +0 -318
  138. package/src/_api/generated/cfg_totp/client.gen.ts +0 -16
  139. package/src/_api/generated/cfg_totp/core/auth.gen.ts +0 -41
  140. package/src/_api/generated/cfg_totp/core/bodySerializer.gen.ts +0 -82
  141. package/src/_api/generated/cfg_totp/core/params.gen.ts +0 -169
  142. package/src/_api/generated/cfg_totp/core/pathSerializer.gen.ts +0 -171
  143. package/src/_api/generated/cfg_totp/core/queryKeySerializer.gen.ts +0 -117
  144. package/src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts +0 -242
  145. package/src/_api/generated/cfg_totp/core/types.gen.ts +0 -104
  146. package/src/_api/generated/cfg_totp/core/utils.gen.ts +0 -140
  147. package/src/_api/generated/cfg_totp/schemas/SetupRequest.ts +0 -11
  148. package/src/_api/generated/cfg_totp/sdk.gen.ts +0 -432
  149. package/src/_api/generated/cfg_totp/types.gen.ts +0 -479
  150. /package/src/_api/generated/{cfg_accounts → _cfg_accounts}/schemas/index.ts +0 -0
  151. /package/src/_api/generated/{cfg_centrifugo → _cfg_centrifugo}/schemas/index.ts +0 -0
  152. /package/src/_api/generated/{cfg_totp → _cfg_totp}/schemas/index.ts +0 -0
  153. /package/src/_api/generated/{cfg_accounts/client → client}/client.gen.ts +0 -0
  154. /package/src/_api/generated/{cfg_accounts/client → client}/index.ts +0 -0
  155. /package/src/_api/generated/{cfg_accounts/client → client}/types.gen.ts +0 -0
  156. /package/src/_api/generated/{cfg_accounts/client → client}/utils.gen.ts +0 -0
  157. /package/src/_api/generated/{cfg_accounts/client.gen.ts → client.gen.ts} +0 -0
  158. /package/src/_api/generated/{cfg_accounts/core → core}/auth.gen.ts +0 -0
  159. /package/src/_api/generated/{cfg_accounts/core → core}/bodySerializer.gen.ts +0 -0
  160. /package/src/_api/generated/{cfg_accounts/core → core}/params.gen.ts +0 -0
  161. /package/src/_api/generated/{cfg_accounts/core → core}/pathSerializer.gen.ts +0 -0
  162. /package/src/_api/generated/{cfg_accounts/core → core}/queryKeySerializer.gen.ts +0 -0
  163. /package/src/_api/generated/{cfg_accounts/core → core}/serverSentEvents.gen.ts +0 -0
  164. /package/src/_api/generated/{cfg_accounts/core → core}/types.gen.ts +0 -0
  165. /package/src/_api/generated/{cfg_accounts/core → core}/utils.gen.ts +0 -0
  166. /package/src/_api/generated/{_shared → helpers}/errors.ts +0 -0
  167. /package/src/_api/generated/{_shared → helpers}/index.ts +0 -0
  168. /package/src/_api/generated/{_shared → helpers}/logger.ts +0 -0
  169. /package/src/_api/generated/{_shared → helpers}/storage.ts +0 -0
  170. /package/src/_api/generated/{_shared → helpers}/validation-events.ts +0 -0
package/dist/auth.cjs CHANGED
@@ -312,7 +312,7 @@ var useAutoAuth = /* @__PURE__ */ __name((options = {}) => {
312
312
  // src/auth/hooks/useTwoFactor.ts
313
313
  var import_react6 = require("react");
314
314
 
315
- // src/_api/generated/cfg_accounts/core/bodySerializer.gen.ts
315
+ // src/_api/generated/core/bodySerializer.gen.ts
316
316
  var serializeFormDataPair = /* @__PURE__ */ __name((data, key, value) => {
317
317
  if (typeof value === "string" || value instanceof Blob) {
318
318
  data.append(key, value);
@@ -342,7 +342,7 @@ var jsonBodySerializer = {
342
342
  bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
343
343
  };
344
344
 
345
- // src/_api/generated/cfg_accounts/core/params.gen.ts
345
+ // src/_api/generated/core/params.gen.ts
346
346
  var extraPrefixesMap = {
347
347
  $body_: "body",
348
348
  $headers_: "headers",
@@ -351,7 +351,7 @@ var extraPrefixesMap = {
351
351
  };
352
352
  var extraPrefixes = Object.entries(extraPrefixesMap);
353
353
 
354
- // src/_api/generated/cfg_accounts/core/serverSentEvents.gen.ts
354
+ // src/_api/generated/core/serverSentEvents.gen.ts
355
355
  function createSseClient({
356
356
  onRequest,
357
357
  onSseError,
@@ -479,7 +479,7 @@ function createSseClient({
479
479
  }
480
480
  __name(createSseClient, "createSseClient");
481
481
 
482
- // src/_api/generated/cfg_accounts/core/pathSerializer.gen.ts
482
+ // src/_api/generated/core/pathSerializer.gen.ts
483
483
  var separatorArrayExplode = /* @__PURE__ */ __name((style) => {
484
484
  switch (style) {
485
485
  case "label":
@@ -603,7 +603,7 @@ var serializeObjectParam = /* @__PURE__ */ __name(({
603
603
  return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
604
604
  }, "serializeObjectParam");
605
605
 
606
- // src/_api/generated/cfg_accounts/core/utils.gen.ts
606
+ // src/_api/generated/core/utils.gen.ts
607
607
  var PATH_PARAM_RE = /\{[^{}]+\}/g;
608
608
  var defaultPathSerializer = /* @__PURE__ */ __name(({ path, url: _url }) => {
609
609
  let url = _url;
@@ -701,7 +701,7 @@ function getValidRequestBody(options) {
701
701
  }
702
702
  __name(getValidRequestBody, "getValidRequestBody");
703
703
 
704
- // src/_api/generated/cfg_accounts/core/auth.gen.ts
704
+ // src/_api/generated/core/auth.gen.ts
705
705
  var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
706
706
  const token = typeof callback === "function" ? await callback(auth) : callback;
707
707
  if (!token) {
@@ -716,7 +716,7 @@ var getAuthToken = /* @__PURE__ */ __name(async (auth, callback) => {
716
716
  return token;
717
717
  }, "getAuthToken");
718
718
 
719
- // src/_api/generated/cfg_accounts/client/utils.gen.ts
719
+ // src/_api/generated/client/utils.gen.ts
720
720
  var createQuerySerializer = /* @__PURE__ */ __name(({
721
721
  parameters = {},
722
722
  ...args
@@ -935,7 +935,7 @@ var createConfig = /* @__PURE__ */ __name((override = {}) => ({
935
935
  ...override
936
936
  }), "createConfig");
937
937
 
938
- // src/_api/generated/cfg_accounts/client/client.gen.ts
938
+ // src/_api/generated/client/client.gen.ts
939
939
  var createClient = /* @__PURE__ */ __name((config = {}) => {
940
940
  let _config = mergeConfigs(createConfig(), config);
941
941
  const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
@@ -1133,10 +1133,10 @@ var createClient = /* @__PURE__ */ __name((config = {}) => {
1133
1133
  };
1134
1134
  }, "createClient");
1135
1135
 
1136
- // src/_api/generated/cfg_accounts/client.gen.ts
1136
+ // src/_api/generated/client.gen.ts
1137
1137
  var client = createClient(createConfig({ baseUrl: "http://localhost:8000" }));
1138
1138
 
1139
- // src/_api/generated/_shared/storage.ts
1139
+ // src/_api/generated/helpers/storage.ts
1140
1140
  var LocalStorageAdapter = class {
1141
1141
  static {
1142
1142
  __name(this, "LocalStorageAdapter");
@@ -1172,7 +1172,7 @@ var LocalStorageAdapter = class {
1172
1172
  }
1173
1173
  };
1174
1174
 
1175
- // src/_api/generated/_shared/logger.ts
1175
+ // src/_api/generated/helpers/logger.ts
1176
1176
  var import_consola2 = require("consola");
1177
1177
  var DEFAULT_CONFIG = {
1178
1178
  enabled: typeof process !== "undefined" && process.env.NODE_ENV !== "production",
@@ -1266,526 +1266,341 @@ var APILogger = class {
1266
1266
  };
1267
1267
  var defaultLogger = new APILogger();
1268
1268
 
1269
- // src/_api/generated/cfg_accounts/sdk.gen.ts
1270
- var Cfg = class {
1269
+ // src/_api/generated/_cfg_accounts/api.ts
1270
+ var ACCESS_KEY = "cfg.access_token";
1271
+ var REFRESH_KEY = "cfg.refresh_token";
1272
+ function detectLocale() {
1273
+ try {
1274
+ if (typeof document !== "undefined") {
1275
+ const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1276
+ if (m) return decodeURIComponent(m[1]);
1277
+ }
1278
+ if (typeof navigator !== "undefined" && navigator.language) {
1279
+ return navigator.language;
1280
+ }
1281
+ } catch {
1282
+ }
1283
+ return null;
1284
+ }
1285
+ __name(detectLocale, "detectLocale");
1286
+ var API = class {
1271
1287
  static {
1272
- __name(this, "Cfg");
1288
+ __name(this, "API");
1273
1289
  }
1274
- /**
1275
- * List OAuth connections
1276
- *
1277
- * Get all OAuth connections for the current user.
1278
- */
1279
- static cfgAccountsOauthConnectionsList(options) {
1280
- return (options?.client ?? client).get({
1281
- security: [{ scheme: "bearer", type: "http" }],
1282
- url: "/cfg/accounts/oauth/connections/",
1283
- ...options
1290
+ baseUrl;
1291
+ storage;
1292
+ locale;
1293
+ apiKey;
1294
+ logger;
1295
+ constructor(baseUrl2, opts = {}) {
1296
+ this.baseUrl = baseUrl2.replace(/\/$/, "");
1297
+ this.storage = opts.storage ?? new LocalStorageAdapter();
1298
+ this.logger = new APILogger(opts.logger);
1299
+ this.locale = opts.locale ?? null;
1300
+ this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
1301
+ const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
1302
+ client.setConfig({ baseUrl: this.baseUrl, credentials });
1303
+ client.interceptors.request.use((request) => {
1304
+ const access = this.getToken();
1305
+ if (access) request.headers.set("Authorization", `Bearer ${access}`);
1306
+ const locale = this.locale ?? detectLocale();
1307
+ if (locale) request.headers.set("Accept-Language", locale);
1308
+ if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
1309
+ return request;
1284
1310
  });
1285
1311
  }
1286
- /**
1287
- * Disconnect OAuth provider
1288
- *
1289
- * Remove OAuth connection for the specified provider.
1290
- */
1291
- static cfgAccountsOauthDisconnectCreate(options) {
1292
- return (options.client ?? client).post({
1293
- security: [{ scheme: "bearer", type: "http" }],
1294
- url: "/cfg/accounts/oauth/disconnect/",
1295
- ...options,
1296
- headers: {
1297
- "Content-Type": "application/json",
1298
- ...options.headers
1299
- }
1300
- });
1312
+ // ── Base URL ────────────────────────────────────────────────────────────
1313
+ getBaseUrl() {
1314
+ return this.baseUrl;
1301
1315
  }
1302
- /**
1303
- * Start GitHub OAuth
1304
- *
1305
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1306
- */
1307
- static cfgAccountsOauthGithubAuthorizeCreate(options) {
1308
- return (options?.client ?? client).post({
1309
- url: "/cfg/accounts/oauth/github/authorize/",
1310
- ...options,
1311
- headers: {
1312
- "Content-Type": "application/json",
1313
- ...options?.headers
1314
- }
1315
- });
1316
+ setBaseUrl(url) {
1317
+ this.baseUrl = url.replace(/\/$/, "");
1318
+ client.setConfig({ baseUrl: this.baseUrl });
1316
1319
  }
1317
- /**
1318
- * Complete GitHub OAuth
1319
- *
1320
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1321
- */
1322
- static cfgAccountsOauthGithubCallbackCreate(options) {
1323
- return (options.client ?? client).post({
1324
- url: "/cfg/accounts/oauth/github/callback/",
1325
- ...options,
1326
- headers: {
1327
- "Content-Type": "application/json",
1328
- ...options.headers
1329
- }
1330
- });
1320
+ // ── Tokens ──────────────────────────────────────────────────────────────
1321
+ getToken() {
1322
+ return this.storage.getItem(ACCESS_KEY);
1331
1323
  }
1332
- /**
1333
- * List OAuth providers
1334
- *
1335
- * Get list of available OAuth providers for authentication.
1336
- */
1337
- static cfgAccountsOauthProvidersRetrieve(options) {
1338
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1324
+ setToken(token) {
1325
+ if (token) this.storage.setItem(ACCESS_KEY, token);
1326
+ else this.storage.removeItem(ACCESS_KEY);
1339
1327
  }
1340
- /**
1341
- * Request OTP code to email.
1342
- */
1343
- static cfgAccountsOtpRequestCreate(options) {
1344
- return (options.client ?? client).post({
1345
- security: [{ scheme: "bearer", type: "http" }],
1346
- url: "/cfg/accounts/otp/request/",
1347
- ...options,
1348
- headers: {
1349
- "Content-Type": "application/json",
1350
- ...options.headers
1351
- }
1352
- });
1328
+ getRefreshToken() {
1329
+ return this.storage.getItem(REFRESH_KEY);
1353
1330
  }
1354
- /**
1355
- * Verify OTP code and return JWT tokens or 2FA session.
1356
- *
1357
- * If user has 2FA enabled:
1358
- * - Returns requires_2fa=True with session_id
1359
- * - Client must complete 2FA verification at /cfg/totp/verify/
1360
- *
1361
- * If user has no 2FA:
1362
- * - Returns JWT tokens and user data directly
1363
- */
1364
- static cfgAccountsOtpVerifyCreate(options) {
1365
- return (options.client ?? client).post({
1366
- security: [{ scheme: "bearer", type: "http" }],
1367
- url: "/cfg/accounts/otp/verify/",
1368
- ...options,
1369
- headers: {
1370
- "Content-Type": "application/json",
1371
- ...options.headers
1372
- }
1373
- });
1331
+ setRefreshToken(token) {
1332
+ if (token) this.storage.setItem(REFRESH_KEY, token);
1333
+ else this.storage.removeItem(REFRESH_KEY);
1374
1334
  }
1375
- /**
1376
- * Get current user profile
1377
- *
1378
- * Retrieve the current authenticated user's profile information.
1379
- */
1380
- static cfgAccountsProfileRetrieve(options) {
1381
- return (options?.client ?? client).get({
1382
- security: [{ scheme: "bearer", type: "http" }, {
1383
- in: "cookie",
1384
- name: "sessionid",
1385
- type: "apiKey"
1386
- }],
1387
- url: "/cfg/accounts/profile/",
1388
- ...options
1389
- });
1335
+ clearToken() {
1336
+ this.storage.removeItem(ACCESS_KEY);
1337
+ this.storage.removeItem(REFRESH_KEY);
1390
1338
  }
1391
- /**
1392
- * Upload user avatar
1393
- *
1394
- * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1395
- */
1396
- static cfgAccountsProfileAvatarCreate(options) {
1397
- return (options?.client ?? client).post({
1398
- ...formDataBodySerializer,
1399
- security: [{ scheme: "bearer", type: "http" }],
1400
- url: "/cfg/accounts/profile/avatar/",
1401
- ...options,
1402
- headers: {
1403
- "Content-Type": null,
1404
- ...options?.headers
1405
- }
1406
- });
1339
+ isAuthenticated() {
1340
+ return this.getToken() !== null;
1407
1341
  }
1408
- /**
1409
- * Delete user account
1410
- *
1411
- *
1412
- * Permanently delete the current user's account.
1413
- *
1414
- * This operation:
1415
- * - Deactivates the account (user cannot log in)
1416
- * - Anonymizes personal data (GDPR compliance)
1417
- * - Frees up the email address for re-registration
1418
- * - Preserves audit trail
1419
- *
1420
- * The account can be restored by an administrator if needed.
1421
- *
1422
- */
1423
- static cfgAccountsProfileDeleteCreate(options) {
1424
- return (options?.client ?? client).post({
1425
- security: [{ scheme: "bearer", type: "http" }, {
1426
- in: "cookie",
1427
- name: "sessionid",
1428
- type: "apiKey"
1429
- }],
1430
- url: "/cfg/accounts/profile/delete/",
1431
- ...options
1432
- });
1342
+ // ── Locale / API key ────────────────────────────────────────────────────
1343
+ getLocale() {
1344
+ return this.locale ?? detectLocale();
1433
1345
  }
1434
- /**
1435
- * Partial update user profile
1436
- *
1437
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1438
- */
1439
- static cfgAccountsProfilePartialPartialUpdate(options) {
1440
- return (options?.client ?? client).patch({
1441
- security: [{ scheme: "bearer", type: "http" }, {
1442
- in: "cookie",
1443
- name: "sessionid",
1444
- type: "apiKey"
1445
- }],
1446
- url: "/cfg/accounts/profile/partial/",
1447
- ...options,
1448
- headers: {
1449
- "Content-Type": "application/json",
1450
- ...options?.headers
1451
- }
1452
- });
1346
+ setLocale(locale) {
1347
+ this.locale = locale;
1453
1348
  }
1454
- /**
1455
- * Partial update user profile
1456
- *
1457
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1458
- */
1459
- static cfgAccountsProfilePartialUpdate(options) {
1460
- return (options?.client ?? client).put({
1461
- security: [{ scheme: "bearer", type: "http" }, {
1462
- in: "cookie",
1463
- name: "sessionid",
1464
- type: "apiKey"
1465
- }],
1466
- url: "/cfg/accounts/profile/partial/",
1467
- ...options,
1468
- headers: {
1469
- "Content-Type": "application/json",
1470
- ...options?.headers
1471
- }
1472
- });
1349
+ getApiKey() {
1350
+ return this.apiKey;
1473
1351
  }
1474
- /**
1475
- * Update user profile
1476
- *
1477
- * Update the current authenticated user's profile information.
1478
- */
1479
- static cfgAccountsProfileUpdatePartialUpdate(options) {
1480
- return (options?.client ?? client).patch({
1481
- security: [{ scheme: "bearer", type: "http" }, {
1482
- in: "cookie",
1483
- name: "sessionid",
1484
- type: "apiKey"
1485
- }],
1486
- url: "/cfg/accounts/profile/update/",
1487
- ...options,
1488
- headers: {
1489
- "Content-Type": "application/json",
1490
- ...options?.headers
1491
- }
1492
- });
1493
- }
1494
- /**
1495
- * Update user profile
1496
- *
1497
- * Update the current authenticated user's profile information.
1498
- */
1499
- static cfgAccountsProfileUpdateUpdate(options) {
1500
- return (options?.client ?? client).put({
1501
- security: [{ scheme: "bearer", type: "http" }, {
1502
- in: "cookie",
1503
- name: "sessionid",
1504
- type: "apiKey"
1505
- }],
1506
- url: "/cfg/accounts/profile/update/",
1507
- ...options,
1508
- headers: {
1509
- "Content-Type": "application/json",
1510
- ...options?.headers
1511
- }
1512
- });
1513
- }
1514
- /**
1515
- * Refresh JWT token.
1516
- */
1517
- static cfgAccountsTokenRefreshCreate(options) {
1518
- return (options.client ?? client).post({
1519
- url: "/cfg/accounts/token/refresh/",
1520
- ...options,
1521
- headers: {
1522
- "Content-Type": "application/json",
1523
- ...options.headers
1524
- }
1525
- });
1352
+ setApiKey(key) {
1353
+ this.apiKey = key;
1526
1354
  }
1527
1355
  };
1528
- var Accounts = class {
1356
+
1357
+ // src/_api/generated/helpers/errors.ts
1358
+ var APIError = class extends Error {
1359
+ constructor(statusCode, statusText, response, url, message) {
1360
+ super(message || `HTTP ${statusCode}: ${statusText}`);
1361
+ this.statusCode = statusCode;
1362
+ this.statusText = statusText;
1363
+ this.response = response;
1364
+ this.url = url;
1365
+ this.name = "APIError";
1366
+ }
1529
1367
  static {
1530
- __name(this, "Accounts");
1368
+ __name(this, "APIError");
1531
1369
  }
1532
- /**
1533
- * List OAuth connections
1534
- *
1535
- * Get all OAuth connections for the current user.
1536
- */
1537
- static cfgAccountsOauthConnectionsList(options) {
1538
- return (options?.client ?? client).get({
1539
- security: [{ scheme: "bearer", type: "http" }],
1540
- url: "/cfg/accounts/oauth/connections/",
1541
- ...options
1542
- });
1370
+ get details() {
1371
+ if (typeof this.response === "object" && this.response !== null) {
1372
+ return this.response;
1373
+ }
1374
+ return null;
1543
1375
  }
1544
- /**
1545
- * Disconnect OAuth provider
1546
- *
1547
- * Remove OAuth connection for the specified provider.
1548
- */
1549
- static cfgAccountsOauthDisconnectCreate(options) {
1550
- return (options.client ?? client).post({
1551
- security: [{ scheme: "bearer", type: "http" }],
1552
- url: "/cfg/accounts/oauth/disconnect/",
1553
- ...options,
1554
- headers: {
1555
- "Content-Type": "application/json",
1556
- ...options.headers
1557
- }
1558
- });
1376
+ get fieldErrors() {
1377
+ const details = this.details;
1378
+ if (!details) return null;
1379
+ const fieldErrors = {};
1380
+ for (const [key, value] of Object.entries(details)) {
1381
+ if (Array.isArray(value)) fieldErrors[key] = value;
1382
+ }
1383
+ return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
1559
1384
  }
1560
- /**
1561
- * Start GitHub OAuth
1562
- *
1563
- * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
1564
- */
1565
- static cfgAccountsOauthGithubAuthorizeCreate(options) {
1566
- return (options?.client ?? client).post({
1567
- url: "/cfg/accounts/oauth/github/authorize/",
1568
- ...options,
1569
- headers: {
1570
- "Content-Type": "application/json",
1571
- ...options?.headers
1572
- }
1573
- });
1385
+ get errorMessage() {
1386
+ const details = this.details;
1387
+ if (!details) return this.message;
1388
+ if (details.detail) {
1389
+ return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
1390
+ }
1391
+ if (details.error) return String(details.error);
1392
+ if (details.message) return String(details.message);
1393
+ const fieldErrors = this.fieldErrors;
1394
+ if (fieldErrors) {
1395
+ const firstField = Object.keys(fieldErrors)[0];
1396
+ if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
1397
+ }
1398
+ return this.message;
1574
1399
  }
1575
- /**
1576
- * Complete GitHub OAuth
1577
- *
1578
- * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
1579
- */
1580
- static cfgAccountsOauthGithubCallbackCreate(options) {
1581
- return (options.client ?? client).post({
1582
- url: "/cfg/accounts/oauth/github/callback/",
1583
- ...options,
1584
- headers: {
1585
- "Content-Type": "application/json",
1586
- ...options.headers
1587
- }
1588
- });
1400
+ get isValidationError() {
1401
+ return this.statusCode === 400;
1589
1402
  }
1590
- /**
1591
- * List OAuth providers
1592
- *
1593
- * Get list of available OAuth providers for authentication.
1594
- */
1595
- static cfgAccountsOauthProvidersRetrieve(options) {
1596
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1403
+ get isAuthError() {
1404
+ return this.statusCode === 401;
1597
1405
  }
1598
- /**
1599
- * Request OTP code to email.
1600
- */
1601
- static cfgAccountsOtpRequestCreate(options) {
1602
- return (options.client ?? client).post({
1603
- security: [{ scheme: "bearer", type: "http" }],
1604
- url: "/cfg/accounts/otp/request/",
1605
- ...options,
1606
- headers: {
1607
- "Content-Type": "application/json",
1608
- ...options.headers
1609
- }
1610
- });
1406
+ get isPermissionError() {
1407
+ return this.statusCode === 403;
1611
1408
  }
1612
- /**
1613
- * Verify OTP code and return JWT tokens or 2FA session.
1614
- *
1615
- * If user has 2FA enabled:
1616
- * - Returns requires_2fa=True with session_id
1617
- * - Client must complete 2FA verification at /cfg/totp/verify/
1618
- *
1619
- * If user has no 2FA:
1620
- * - Returns JWT tokens and user data directly
1621
- */
1622
- static cfgAccountsOtpVerifyCreate(options) {
1623
- return (options.client ?? client).post({
1624
- security: [{ scheme: "bearer", type: "http" }],
1625
- url: "/cfg/accounts/otp/verify/",
1626
- ...options,
1627
- headers: {
1628
- "Content-Type": "application/json",
1629
- ...options.headers
1630
- }
1631
- });
1409
+ get isNotFoundError() {
1410
+ return this.statusCode === 404;
1632
1411
  }
1633
- /**
1634
- * Get current user profile
1635
- *
1636
- * Retrieve the current authenticated user's profile information.
1637
- */
1638
- static cfgAccountsProfileRetrieve(options) {
1639
- return (options?.client ?? client).get({
1640
- security: [{ scheme: "bearer", type: "http" }, {
1641
- in: "cookie",
1642
- name: "sessionid",
1643
- type: "apiKey"
1644
- }],
1645
- url: "/cfg/accounts/profile/",
1646
- ...options
1647
- });
1412
+ get isServerError() {
1413
+ return this.statusCode >= 500 && this.statusCode < 600;
1648
1414
  }
1649
- /**
1650
- * Upload user avatar
1651
- *
1652
- * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1653
- */
1654
- static cfgAccountsProfileAvatarCreate(options) {
1655
- return (options?.client ?? client).post({
1656
- ...formDataBodySerializer,
1657
- security: [{ scheme: "bearer", type: "http" }],
1658
- url: "/cfg/accounts/profile/avatar/",
1659
- ...options,
1660
- headers: {
1661
- "Content-Type": null,
1662
- ...options?.headers
1663
- }
1664
- });
1415
+ };
1416
+
1417
+ // src/_api/generated/_cfg_centrifugo/api.ts
1418
+ var ACCESS_KEY2 = "cfg.access_token";
1419
+ var REFRESH_KEY2 = "cfg.refresh_token";
1420
+ function detectLocale2() {
1421
+ try {
1422
+ if (typeof document !== "undefined") {
1423
+ const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1424
+ if (m) return decodeURIComponent(m[1]);
1425
+ }
1426
+ if (typeof navigator !== "undefined" && navigator.language) {
1427
+ return navigator.language;
1428
+ }
1429
+ } catch {
1665
1430
  }
1666
- /**
1667
- * Delete user account
1668
- *
1669
- *
1670
- * Permanently delete the current user's account.
1671
- *
1672
- * This operation:
1673
- * - Deactivates the account (user cannot log in)
1674
- * - Anonymizes personal data (GDPR compliance)
1675
- * - Frees up the email address for re-registration
1676
- * - Preserves audit trail
1677
- *
1678
- * The account can be restored by an administrator if needed.
1679
- *
1680
- */
1681
- static cfgAccountsProfileDeleteCreate(options) {
1682
- return (options?.client ?? client).post({
1683
- security: [{ scheme: "bearer", type: "http" }, {
1684
- in: "cookie",
1685
- name: "sessionid",
1686
- type: "apiKey"
1687
- }],
1688
- url: "/cfg/accounts/profile/delete/",
1689
- ...options
1690
- });
1431
+ return null;
1432
+ }
1433
+ __name(detectLocale2, "detectLocale");
1434
+ var API2 = class {
1435
+ static {
1436
+ __name(this, "API");
1691
1437
  }
1692
- /**
1693
- * Partial update user profile
1694
- *
1695
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1696
- */
1697
- static cfgAccountsProfilePartialPartialUpdate(options) {
1698
- return (options?.client ?? client).patch({
1699
- security: [{ scheme: "bearer", type: "http" }, {
1700
- in: "cookie",
1701
- name: "sessionid",
1702
- type: "apiKey"
1703
- }],
1704
- url: "/cfg/accounts/profile/partial/",
1705
- ...options,
1706
- headers: {
1707
- "Content-Type": "application/json",
1708
- ...options?.headers
1709
- }
1438
+ baseUrl;
1439
+ storage;
1440
+ locale;
1441
+ apiKey;
1442
+ logger;
1443
+ constructor(baseUrl2, opts = {}) {
1444
+ this.baseUrl = baseUrl2.replace(/\/$/, "");
1445
+ this.storage = opts.storage ?? new LocalStorageAdapter();
1446
+ this.logger = new APILogger(opts.logger);
1447
+ this.locale = opts.locale ?? null;
1448
+ this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
1449
+ const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
1450
+ client.setConfig({ baseUrl: this.baseUrl, credentials });
1451
+ client.interceptors.request.use((request) => {
1452
+ const access = this.getToken();
1453
+ if (access) request.headers.set("Authorization", `Bearer ${access}`);
1454
+ const locale = this.locale ?? detectLocale2();
1455
+ if (locale) request.headers.set("Accept-Language", locale);
1456
+ if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
1457
+ return request;
1710
1458
  });
1711
1459
  }
1712
- /**
1713
- * Partial update user profile
1714
- *
1715
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1716
- */
1717
- static cfgAccountsProfilePartialUpdate(options) {
1718
- return (options?.client ?? client).put({
1719
- security: [{ scheme: "bearer", type: "http" }, {
1720
- in: "cookie",
1721
- name: "sessionid",
1722
- type: "apiKey"
1723
- }],
1724
- url: "/cfg/accounts/profile/partial/",
1725
- ...options,
1726
- headers: {
1727
- "Content-Type": "application/json",
1728
- ...options?.headers
1729
- }
1730
- });
1460
+ // ── Base URL ────────────────────────────────────────────────────────────
1461
+ getBaseUrl() {
1462
+ return this.baseUrl;
1731
1463
  }
1732
- /**
1733
- * Update user profile
1734
- *
1735
- * Update the current authenticated user's profile information.
1736
- */
1737
- static cfgAccountsProfileUpdatePartialUpdate(options) {
1738
- return (options?.client ?? client).patch({
1739
- security: [{ scheme: "bearer", type: "http" }, {
1740
- in: "cookie",
1741
- name: "sessionid",
1742
- type: "apiKey"
1743
- }],
1744
- url: "/cfg/accounts/profile/update/",
1745
- ...options,
1746
- headers: {
1747
- "Content-Type": "application/json",
1748
- ...options?.headers
1749
- }
1750
- });
1464
+ setBaseUrl(url) {
1465
+ this.baseUrl = url.replace(/\/$/, "");
1466
+ client.setConfig({ baseUrl: this.baseUrl });
1751
1467
  }
1752
- /**
1753
- * Update user profile
1754
- *
1755
- * Update the current authenticated user's profile information.
1756
- */
1757
- static cfgAccountsProfileUpdateUpdate(options) {
1758
- return (options?.client ?? client).put({
1759
- security: [{ scheme: "bearer", type: "http" }, {
1760
- in: "cookie",
1761
- name: "sessionid",
1762
- type: "apiKey"
1763
- }],
1764
- url: "/cfg/accounts/profile/update/",
1765
- ...options,
1766
- headers: {
1767
- "Content-Type": "application/json",
1768
- ...options?.headers
1769
- }
1770
- });
1468
+ // ── Tokens ──────────────────────────────────────────────────────────────
1469
+ getToken() {
1470
+ return this.storage.getItem(ACCESS_KEY2);
1771
1471
  }
1772
- /**
1773
- * Refresh JWT token.
1774
- */
1775
- static cfgAccountsTokenRefreshCreate(options) {
1776
- return (options.client ?? client).post({
1777
- url: "/cfg/accounts/token/refresh/",
1778
- ...options,
1779
- headers: {
1780
- "Content-Type": "application/json",
1781
- ...options.headers
1782
- }
1472
+ setToken(token) {
1473
+ if (token) this.storage.setItem(ACCESS_KEY2, token);
1474
+ else this.storage.removeItem(ACCESS_KEY2);
1475
+ }
1476
+ getRefreshToken() {
1477
+ return this.storage.getItem(REFRESH_KEY2);
1478
+ }
1479
+ setRefreshToken(token) {
1480
+ if (token) this.storage.setItem(REFRESH_KEY2, token);
1481
+ else this.storage.removeItem(REFRESH_KEY2);
1482
+ }
1483
+ clearToken() {
1484
+ this.storage.removeItem(ACCESS_KEY2);
1485
+ this.storage.removeItem(REFRESH_KEY2);
1486
+ }
1487
+ isAuthenticated() {
1488
+ return this.getToken() !== null;
1489
+ }
1490
+ // ── Locale / API key ────────────────────────────────────────────────────
1491
+ getLocale() {
1492
+ return this.locale ?? detectLocale2();
1493
+ }
1494
+ setLocale(locale) {
1495
+ this.locale = locale;
1496
+ }
1497
+ getApiKey() {
1498
+ return this.apiKey;
1499
+ }
1500
+ setApiKey(key) {
1501
+ this.apiKey = key;
1502
+ }
1503
+ };
1504
+
1505
+ // src/_api/generated/_cfg_totp/api.ts
1506
+ var ACCESS_KEY3 = "cfg.access_token";
1507
+ var REFRESH_KEY3 = "cfg.refresh_token";
1508
+ function detectLocale3() {
1509
+ try {
1510
+ if (typeof document !== "undefined") {
1511
+ const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
1512
+ if (m) return decodeURIComponent(m[1]);
1513
+ }
1514
+ if (typeof navigator !== "undefined" && navigator.language) {
1515
+ return navigator.language;
1516
+ }
1517
+ } catch {
1518
+ }
1519
+ return null;
1520
+ }
1521
+ __name(detectLocale3, "detectLocale");
1522
+ var API3 = class {
1523
+ static {
1524
+ __name(this, "API");
1525
+ }
1526
+ baseUrl;
1527
+ storage;
1528
+ locale;
1529
+ apiKey;
1530
+ logger;
1531
+ constructor(baseUrl2, opts = {}) {
1532
+ this.baseUrl = baseUrl2.replace(/\/$/, "");
1533
+ this.storage = opts.storage ?? new LocalStorageAdapter();
1534
+ this.logger = new APILogger(opts.logger);
1535
+ this.locale = opts.locale ?? null;
1536
+ this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
1537
+ const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
1538
+ client.setConfig({ baseUrl: this.baseUrl, credentials });
1539
+ client.interceptors.request.use((request) => {
1540
+ const access = this.getToken();
1541
+ if (access) request.headers.set("Authorization", `Bearer ${access}`);
1542
+ const locale = this.locale ?? detectLocale3();
1543
+ if (locale) request.headers.set("Accept-Language", locale);
1544
+ if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
1545
+ return request;
1783
1546
  });
1784
1547
  }
1548
+ // ── Base URL ────────────────────────────────────────────────────────────
1549
+ getBaseUrl() {
1550
+ return this.baseUrl;
1551
+ }
1552
+ setBaseUrl(url) {
1553
+ this.baseUrl = url.replace(/\/$/, "");
1554
+ client.setConfig({ baseUrl: this.baseUrl });
1555
+ }
1556
+ // ── Tokens ──────────────────────────────────────────────────────────────
1557
+ getToken() {
1558
+ return this.storage.getItem(ACCESS_KEY3);
1559
+ }
1560
+ setToken(token) {
1561
+ if (token) this.storage.setItem(ACCESS_KEY3, token);
1562
+ else this.storage.removeItem(ACCESS_KEY3);
1563
+ }
1564
+ getRefreshToken() {
1565
+ return this.storage.getItem(REFRESH_KEY3);
1566
+ }
1567
+ setRefreshToken(token) {
1568
+ if (token) this.storage.setItem(REFRESH_KEY3, token);
1569
+ else this.storage.removeItem(REFRESH_KEY3);
1570
+ }
1571
+ clearToken() {
1572
+ this.storage.removeItem(ACCESS_KEY3);
1573
+ this.storage.removeItem(REFRESH_KEY3);
1574
+ }
1575
+ isAuthenticated() {
1576
+ return this.getToken() !== null;
1577
+ }
1578
+ // ── Locale / API key ────────────────────────────────────────────────────
1579
+ getLocale() {
1580
+ return this.locale ?? detectLocale3();
1581
+ }
1582
+ setLocale(locale) {
1583
+ this.locale = locale;
1584
+ }
1585
+ getApiKey() {
1586
+ return this.apiKey;
1587
+ }
1588
+ setApiKey(key) {
1589
+ this.apiKey = key;
1590
+ }
1785
1591
  };
1786
- var OAuth = class {
1592
+
1593
+ // src/_api/generated/index.ts
1594
+ var isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
1595
+ var baseUrl = isStaticBuild2 ? "" : process.env.NEXT_PUBLIC_API_URL || "";
1596
+ var CfgAccountsApi = new API(baseUrl, { storage: new LocalStorageAdapter() });
1597
+ var CfgCentrifugoApi = new API2(baseUrl, { storage: new LocalStorageAdapter() });
1598
+ var CfgTotpApi = new API3(baseUrl, { storage: new LocalStorageAdapter() });
1599
+
1600
+ // src/_api/generated/sdk.gen.ts
1601
+ var Cfg = class {
1787
1602
  static {
1788
- __name(this, "OAuth");
1603
+ __name(this, "Cfg");
1789
1604
  }
1790
1605
  /**
1791
1606
  * List OAuth connections
@@ -1838,2395 +1653,49 @@ var OAuth = class {
1838
1653
  static cfgAccountsOauthGithubCallbackCreate(options) {
1839
1654
  return (options.client ?? client).post({
1840
1655
  url: "/cfg/accounts/oauth/github/callback/",
1841
- ...options,
1842
- headers: {
1843
- "Content-Type": "application/json",
1844
- ...options.headers
1845
- }
1846
- });
1847
- }
1848
- /**
1849
- * List OAuth providers
1850
- *
1851
- * Get list of available OAuth providers for authentication.
1852
- */
1853
- static cfgAccountsOauthProvidersRetrieve(options) {
1854
- return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1855
- }
1856
- };
1857
- var UserProfile = class {
1858
- static {
1859
- __name(this, "UserProfile");
1860
- }
1861
- /**
1862
- * Get current user profile
1863
- *
1864
- * Retrieve the current authenticated user's profile information.
1865
- */
1866
- static cfgAccountsProfileRetrieve(options) {
1867
- return (options?.client ?? client).get({
1868
- security: [{ scheme: "bearer", type: "http" }, {
1869
- in: "cookie",
1870
- name: "sessionid",
1871
- type: "apiKey"
1872
- }],
1873
- url: "/cfg/accounts/profile/",
1874
- ...options
1875
- });
1876
- }
1877
- /**
1878
- * Upload user avatar
1879
- *
1880
- * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
1881
- */
1882
- static cfgAccountsProfileAvatarCreate(options) {
1883
- return (options?.client ?? client).post({
1884
- ...formDataBodySerializer,
1885
- security: [{ scheme: "bearer", type: "http" }],
1886
- url: "/cfg/accounts/profile/avatar/",
1887
- ...options,
1888
- headers: {
1889
- "Content-Type": null,
1890
- ...options?.headers
1891
- }
1892
- });
1893
- }
1894
- /**
1895
- * Delete user account
1896
- *
1897
- *
1898
- * Permanently delete the current user's account.
1899
- *
1900
- * This operation:
1901
- * - Deactivates the account (user cannot log in)
1902
- * - Anonymizes personal data (GDPR compliance)
1903
- * - Frees up the email address for re-registration
1904
- * - Preserves audit trail
1905
- *
1906
- * The account can be restored by an administrator if needed.
1907
- *
1908
- */
1909
- static cfgAccountsProfileDeleteCreate(options) {
1910
- return (options?.client ?? client).post({
1911
- security: [{ scheme: "bearer", type: "http" }, {
1912
- in: "cookie",
1913
- name: "sessionid",
1914
- type: "apiKey"
1915
- }],
1916
- url: "/cfg/accounts/profile/delete/",
1917
- ...options
1918
- });
1919
- }
1920
- /**
1921
- * Partial update user profile
1922
- *
1923
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1924
- */
1925
- static cfgAccountsProfilePartialPartialUpdate(options) {
1926
- return (options?.client ?? client).patch({
1927
- security: [{ scheme: "bearer", type: "http" }, {
1928
- in: "cookie",
1929
- name: "sessionid",
1930
- type: "apiKey"
1931
- }],
1932
- url: "/cfg/accounts/profile/partial/",
1933
- ...options,
1934
- headers: {
1935
- "Content-Type": "application/json",
1936
- ...options?.headers
1937
- }
1938
- });
1939
- }
1940
- /**
1941
- * Partial update user profile
1942
- *
1943
- * Partially update the current authenticated user's profile information. Supports avatar upload.
1944
- */
1945
- static cfgAccountsProfilePartialUpdate(options) {
1946
- return (options?.client ?? client).put({
1947
- security: [{ scheme: "bearer", type: "http" }, {
1948
- in: "cookie",
1949
- name: "sessionid",
1950
- type: "apiKey"
1951
- }],
1952
- url: "/cfg/accounts/profile/partial/",
1953
- ...options,
1954
- headers: {
1955
- "Content-Type": "application/json",
1956
- ...options?.headers
1957
- }
1958
- });
1959
- }
1960
- /**
1961
- * Update user profile
1962
- *
1963
- * Update the current authenticated user's profile information.
1964
- */
1965
- static cfgAccountsProfileUpdatePartialUpdate(options) {
1966
- return (options?.client ?? client).patch({
1967
- security: [{ scheme: "bearer", type: "http" }, {
1968
- in: "cookie",
1969
- name: "sessionid",
1970
- type: "apiKey"
1971
- }],
1972
- url: "/cfg/accounts/profile/update/",
1973
- ...options,
1974
- headers: {
1975
- "Content-Type": "application/json",
1976
- ...options?.headers
1977
- }
1978
- });
1979
- }
1980
- /**
1981
- * Update user profile
1982
- *
1983
- * Update the current authenticated user's profile information.
1984
- */
1985
- static cfgAccountsProfileUpdateUpdate(options) {
1986
- return (options?.client ?? client).put({
1987
- security: [{ scheme: "bearer", type: "http" }, {
1988
- in: "cookie",
1989
- name: "sessionid",
1990
- type: "apiKey"
1991
- }],
1992
- url: "/cfg/accounts/profile/update/",
1993
- ...options,
1994
- headers: {
1995
- "Content-Type": "application/json",
1996
- ...options?.headers
1997
- }
1998
- });
1999
- }
2000
- };
2001
- var Auth = class {
2002
- static {
2003
- __name(this, "Auth");
2004
- }
2005
- /**
2006
- * Refresh JWT token.
2007
- */
2008
- static cfgAccountsTokenRefreshCreate(options) {
2009
- return (options.client ?? client).post({
2010
- url: "/cfg/accounts/token/refresh/",
2011
- ...options,
2012
- headers: {
2013
- "Content-Type": "application/json",
2014
- ...options.headers
2015
- }
2016
- });
2017
- }
2018
- };
2019
-
2020
- // src/_api/generated/cfg_accounts/schemas/AccountDeleteResponse.ts
2021
- var import_zod = require("zod");
2022
- var AccountDeleteResponseSchema = import_zod.z.object({
2023
- success: import_zod.z.boolean(),
2024
- message: import_zod.z.string()
2025
- });
2026
-
2027
- // src/_api/generated/cfg_accounts/schemas/CentrifugoToken.ts
2028
- var import_zod2 = require("zod");
2029
- var CentrifugoTokenSchema = import_zod2.z.object({
2030
- token: import_zod2.z.string(),
2031
- centrifugo_url: import_zod2.z.string(),
2032
- expires_at: import_zod2.z.string().datetime({ offset: true }),
2033
- channels: import_zod2.z.array(import_zod2.z.string())
2034
- });
2035
-
2036
- // src/_api/generated/cfg_accounts/schemas/CfgUserUpdateRequest.ts
2037
- var import_zod3 = require("zod");
2038
- var CfgUserUpdateRequestSchema = import_zod3.z.object({
2039
- first_name: import_zod3.z.string().max(50).optional(),
2040
- last_name: import_zod3.z.string().max(50).optional(),
2041
- company: import_zod3.z.string().max(100).optional(),
2042
- phone: import_zod3.z.string().max(20).optional(),
2043
- position: import_zod3.z.string().max(100).optional(),
2044
- language: import_zod3.z.string().max(10).optional()
2045
- });
2046
-
2047
- // src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts
2048
- var import_zod4 = require("zod");
2049
- var OAuthAuthorizeRequestRequestSchema = import_zod4.z.object({
2050
- redirect_uri: import_zod4.z.string().optional(),
2051
- source_url: import_zod4.z.string().optional()
2052
- });
2053
-
2054
- // src/_api/generated/cfg_accounts/schemas/OAuthAuthorizeResponse.ts
2055
- var import_zod5 = require("zod");
2056
- var OAuthAuthorizeResponseSchema = import_zod5.z.object({
2057
- authorization_url: import_zod5.z.string(),
2058
- state: import_zod5.z.string()
2059
- });
2060
-
2061
- // src/_api/generated/cfg_accounts/schemas/OAuthCallbackRequestRequest.ts
2062
- var import_zod6 = require("zod");
2063
- var OAuthCallbackRequestRequestSchema = import_zod6.z.object({
2064
- code: import_zod6.z.string().min(10).max(500),
2065
- state: import_zod6.z.string().min(20).max(100),
2066
- redirect_uri: import_zod6.z.string().optional()
2067
- });
2068
-
2069
- // src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts
2070
- var import_zod8 = require("zod");
2071
-
2072
- // src/_api/generated/cfg_accounts/schemas/ProviderEnum.ts
2073
- var import_zod7 = require("zod");
2074
- var ProviderEnumSchema = import_zod7.z.enum(["github"]);
2075
-
2076
- // src/_api/generated/cfg_accounts/schemas/OAuthConnection.ts
2077
- var OAuthConnectionSchema = import_zod8.z.object({
2078
- id: import_zod8.z.number().int(),
2079
- provider: ProviderEnumSchema,
2080
- provider_display: import_zod8.z.string(),
2081
- provider_username: import_zod8.z.string(),
2082
- provider_email: import_zod8.z.email(),
2083
- provider_avatar_url: import_zod8.z.string(),
2084
- connected_at: import_zod8.z.string().datetime({ offset: true }),
2085
- last_login_at: import_zod8.z.string().datetime({ offset: true })
2086
- });
2087
-
2088
- // src/_api/generated/cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts
2089
- var import_zod9 = require("zod");
2090
- var OAuthDisconnectRequestRequestSchema = import_zod9.z.object({
2091
- provider: ProviderEnumSchema
2092
- });
2093
-
2094
- // src/_api/generated/cfg_accounts/schemas/OAuthError.ts
2095
- var import_zod10 = require("zod");
2096
- var OAuthErrorSchema = import_zod10.z.object({
2097
- error: import_zod10.z.string(),
2098
- error_description: import_zod10.z.string().optional()
2099
- });
2100
-
2101
- // src/_api/generated/cfg_accounts/schemas/OAuthProvidersResponse.ts
2102
- var import_zod11 = require("zod");
2103
- var OAuthProvidersResponseSchema = import_zod11.z.object({
2104
- providers: import_zod11.z.array(import_zod11.z.object({}))
2105
- });
2106
-
2107
- // src/_api/generated/cfg_accounts/schemas/OAuthTokenResponse.ts
2108
- var import_zod12 = require("zod");
2109
- var OAuthTokenResponseSchema = import_zod12.z.object({
2110
- requires_2fa: import_zod12.z.boolean().optional(),
2111
- 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(),
2112
- access: import_zod12.z.string().nullable().optional(),
2113
- refresh: import_zod12.z.string().nullable().optional(),
2114
- user: import_zod12.z.object({}).nullable().optional(),
2115
- is_new_user: import_zod12.z.boolean(),
2116
- is_new_connection: import_zod12.z.boolean(),
2117
- should_prompt_2fa: import_zod12.z.boolean().optional()
2118
- });
2119
-
2120
- // src/_api/generated/cfg_accounts/schemas/OTPErrorResponse.ts
2121
- var import_zod13 = require("zod");
2122
- var OTPErrorResponseSchema = import_zod13.z.object({
2123
- error: import_zod13.z.string(),
2124
- error_code: import_zod13.z.string().nullable().optional(),
2125
- retry_after: import_zod13.z.number().int().nullable().optional()
2126
- });
2127
-
2128
- // src/_api/generated/cfg_accounts/schemas/OTPRequestRequest.ts
2129
- var import_zod14 = require("zod");
2130
- var OTPRequestRequestSchema = import_zod14.z.object({
2131
- identifier: import_zod14.z.string().min(1),
2132
- source_url: import_zod14.z.string().optional()
2133
- });
2134
-
2135
- // src/_api/generated/cfg_accounts/schemas/OTPRequestResponse.ts
2136
- var import_zod15 = require("zod");
2137
- var OTPRequestResponseSchema = import_zod15.z.object({
2138
- message: import_zod15.z.string()
2139
- });
2140
-
2141
- // src/_api/generated/cfg_accounts/schemas/OTPVerifyRequest.ts
2142
- var import_zod16 = require("zod");
2143
- var OTPVerifyRequestSchema = import_zod16.z.object({
2144
- identifier: import_zod16.z.string().min(1),
2145
- otp: import_zod16.z.string().min(6).max(6),
2146
- source_url: import_zod16.z.string().optional()
2147
- });
2148
-
2149
- // src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts
2150
- var import_zod18 = require("zod");
2151
-
2152
- // src/_api/generated/cfg_accounts/schemas/User.ts
2153
- var import_zod17 = require("zod");
2154
- var UserSchema = import_zod17.z.object({
2155
- id: import_zod17.z.number().int(),
2156
- email: import_zod17.z.email(),
2157
- first_name: import_zod17.z.string().max(50).optional(),
2158
- last_name: import_zod17.z.string().max(50).optional(),
2159
- full_name: import_zod17.z.string(),
2160
- initials: import_zod17.z.string(),
2161
- display_username: import_zod17.z.string(),
2162
- company: import_zod17.z.string().max(100).optional(),
2163
- phone: import_zod17.z.string().max(20).optional(),
2164
- position: import_zod17.z.string().max(100).optional(),
2165
- language: import_zod17.z.string().max(10).optional(),
2166
- avatar: import_zod17.z.string().nullable(),
2167
- is_staff: import_zod17.z.boolean(),
2168
- is_superuser: import_zod17.z.boolean(),
2169
- date_joined: import_zod17.z.string().datetime({ offset: true }),
2170
- last_login: import_zod17.z.string().datetime({ offset: true }).nullable(),
2171
- unanswered_messages_count: import_zod17.z.number().int(),
2172
- centrifugo: CentrifugoTokenSchema.nullable()
2173
- });
2174
-
2175
- // src/_api/generated/cfg_accounts/schemas/OTPVerifyResponse.ts
2176
- var OTPVerifyResponseSchema = import_zod18.z.object({
2177
- requires_2fa: import_zod18.z.boolean().optional(),
2178
- 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(),
2179
- refresh: import_zod18.z.string().nullable().optional(),
2180
- access: import_zod18.z.string().nullable().optional(),
2181
- user: UserSchema.nullable().optional(),
2182
- should_prompt_2fa: import_zod18.z.boolean().optional()
2183
- });
2184
-
2185
- // src/_api/generated/cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts
2186
- var import_zod19 = require("zod");
2187
- var PatchedCfgUserUpdateRequestSchema = import_zod19.z.object({
2188
- first_name: import_zod19.z.string().max(50).optional(),
2189
- last_name: import_zod19.z.string().max(50).optional(),
2190
- company: import_zod19.z.string().max(100).optional(),
2191
- phone: import_zod19.z.string().max(20).optional(),
2192
- position: import_zod19.z.string().max(100).optional(),
2193
- language: import_zod19.z.string().max(10).optional()
2194
- });
2195
-
2196
- // src/_api/generated/cfg_accounts/schemas/TokenRefresh.ts
2197
- var import_zod20 = require("zod");
2198
- var TokenRefreshSchema = import_zod20.z.object({
2199
- access: import_zod20.z.string(),
2200
- refresh: import_zod20.z.string()
2201
- });
2202
-
2203
- // src/_api/generated/cfg_accounts/schemas/TokenRefreshRequest.ts
2204
- var import_zod21 = require("zod");
2205
- var TokenRefreshRequestSchema = import_zod21.z.object({
2206
- refresh: import_zod21.z.string().min(1)
2207
- });
2208
-
2209
- // src/_api/generated/_shared/validation-events.ts
2210
- function dispatchValidationError(detail) {
2211
- if (typeof window === "undefined") return;
2212
- try {
2213
- const event = new CustomEvent("zod-validation-error", {
2214
- detail,
2215
- bubbles: true,
2216
- cancelable: false
2217
- });
2218
- window.dispatchEvent(event);
2219
- } catch (error) {
2220
- console.warn("Failed to dispatch validation error event:", error);
2221
- }
2222
- }
2223
- __name(dispatchValidationError, "dispatchValidationError");
2224
-
2225
- // src/_api/generated/cfg_accounts/api.ts
2226
- var ACCESS_KEY = "cfg.access_token";
2227
- var REFRESH_KEY = "cfg.refresh_token";
2228
- var VALIDATION_ROUTES = [
2229
- { method: "POST", re: new RegExp("^/cfg/accounts/oauth/github/authorize/?$"), schema: OAuthAuthorizeResponseSchema, path: "/cfg/accounts/oauth/github/authorize/" },
2230
- { method: "POST", re: new RegExp("^/cfg/accounts/oauth/github/callback/?$"), schema: OAuthTokenResponseSchema, path: "/cfg/accounts/oauth/github/callback/" },
2231
- { method: "GET", re: new RegExp("^/cfg/accounts/oauth/providers/?$"), schema: OAuthProvidersResponseSchema, path: "/cfg/accounts/oauth/providers/" },
2232
- { method: "POST", re: new RegExp("^/cfg/accounts/otp/request/?$"), schema: OTPRequestResponseSchema, path: "/cfg/accounts/otp/request/" },
2233
- { method: "POST", re: new RegExp("^/cfg/accounts/otp/verify/?$"), schema: OTPVerifyResponseSchema, path: "/cfg/accounts/otp/verify/" },
2234
- { method: "GET", re: new RegExp("^/cfg/accounts/profile/?$"), schema: UserSchema, path: "/cfg/accounts/profile/" },
2235
- { method: "POST", re: new RegExp("^/cfg/accounts/profile/avatar/?$"), schema: UserSchema, path: "/cfg/accounts/profile/avatar/" },
2236
- { method: "POST", re: new RegExp("^/cfg/accounts/profile/delete/?$"), schema: AccountDeleteResponseSchema, path: "/cfg/accounts/profile/delete/" },
2237
- { method: "PUT", re: new RegExp("^/cfg/accounts/profile/partial/?$"), schema: UserSchema, path: "/cfg/accounts/profile/partial/" },
2238
- { method: "PATCH", re: new RegExp("^/cfg/accounts/profile/partial/?$"), schema: UserSchema, path: "/cfg/accounts/profile/partial/" },
2239
- { method: "PUT", re: new RegExp("^/cfg/accounts/profile/update/?$"), schema: UserSchema, path: "/cfg/accounts/profile/update/" },
2240
- { method: "PATCH", re: new RegExp("^/cfg/accounts/profile/update/?$"), schema: UserSchema, path: "/cfg/accounts/profile/update/" },
2241
- { method: "POST", re: new RegExp("^/cfg/accounts/token/refresh/?$"), schema: TokenRefreshSchema, path: "/cfg/accounts/token/refresh/" }
2242
- ];
2243
- function detectLocale() {
2244
- try {
2245
- if (typeof document !== "undefined") {
2246
- const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
2247
- if (m) return decodeURIComponent(m[1]);
2248
- }
2249
- if (typeof navigator !== "undefined" && navigator.language) {
2250
- return navigator.language;
2251
- }
2252
- } catch {
2253
- }
2254
- return null;
2255
- }
2256
- __name(detectLocale, "detectLocale");
2257
- var API = class {
2258
- static {
2259
- __name(this, "API");
2260
- }
2261
- baseUrl;
2262
- storage;
2263
- locale;
2264
- apiKey;
2265
- logger;
2266
- cfg = Cfg;
2267
- accounts = Accounts;
2268
- oAuth = OAuth;
2269
- userProfile = UserProfile;
2270
- auth = Auth;
2271
- constructor(baseUrl2, opts = {}) {
2272
- this.baseUrl = baseUrl2.replace(/\/$/, "");
2273
- this.storage = opts.storage ?? new LocalStorageAdapter();
2274
- this.logger = new APILogger(opts.logger);
2275
- this.locale = opts.locale ?? null;
2276
- this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
2277
- const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
2278
- client.setConfig({ baseUrl: this.baseUrl, credentials });
2279
- client.interceptors.request.use((request) => {
2280
- const access = this.getToken();
2281
- if (access) request.headers.set("Authorization", `Bearer ${access}`);
2282
- const locale = this.locale ?? detectLocale();
2283
- if (locale) request.headers.set("Accept-Language", locale);
2284
- if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
2285
- return request;
2286
- });
2287
- client.interceptors.response.use(async (response, request) => {
2288
- if (!response.ok) return response;
2289
- const ct = response.headers.get("content-type") || "";
2290
- if (!ct.includes("application/json")) return response;
2291
- const url = new URL(request.url);
2292
- const method = request.method.toUpperCase();
2293
- const route = VALIDATION_ROUTES.find(
2294
- (r) => r.method === method && r.re.test(url.pathname)
2295
- );
2296
- if (!route) return response;
2297
- let payload;
2298
- try {
2299
- payload = await response.clone().json();
2300
- } catch {
2301
- return response;
2302
- }
2303
- const result = route.schema.safeParse(payload);
2304
- if (!result.success) {
2305
- dispatchValidationError({
2306
- operation: `${method} ${route.path}`,
2307
- path: route.path,
2308
- method,
2309
- error: result.error,
2310
- response: payload,
2311
- timestamp: /* @__PURE__ */ new Date()
2312
- });
2313
- }
2314
- return response;
2315
- });
2316
- }
2317
- // ── Base URL ────────────────────────────────────────────────────────────
2318
- getBaseUrl() {
2319
- return this.baseUrl;
2320
- }
2321
- setBaseUrl(url) {
2322
- this.baseUrl = url.replace(/\/$/, "");
2323
- client.setConfig({ baseUrl: this.baseUrl });
2324
- }
2325
- // ── Tokens ──────────────────────────────────────────────────────────────
2326
- getToken() {
2327
- return this.storage.getItem(ACCESS_KEY);
2328
- }
2329
- setToken(token) {
2330
- if (token) this.storage.setItem(ACCESS_KEY, token);
2331
- else this.storage.removeItem(ACCESS_KEY);
2332
- }
2333
- getRefreshToken() {
2334
- return this.storage.getItem(REFRESH_KEY);
2335
- }
2336
- setRefreshToken(token) {
2337
- if (token) this.storage.setItem(REFRESH_KEY, token);
2338
- else this.storage.removeItem(REFRESH_KEY);
2339
- }
2340
- clearToken() {
2341
- this.storage.removeItem(ACCESS_KEY);
2342
- this.storage.removeItem(REFRESH_KEY);
2343
- }
2344
- isAuthenticated() {
2345
- return this.getToken() !== null;
2346
- }
2347
- // ── Locale / API key ────────────────────────────────────────────────────
2348
- getLocale() {
2349
- return this.locale ?? detectLocale();
2350
- }
2351
- setLocale(locale) {
2352
- this.locale = locale;
2353
- }
2354
- getApiKey() {
2355
- return this.apiKey;
2356
- }
2357
- setApiKey(key) {
2358
- this.apiKey = key;
2359
- }
2360
- };
2361
-
2362
- // src/_api/generated/_shared/errors.ts
2363
- var APIError = class extends Error {
2364
- constructor(statusCode, statusText, response, url, message) {
2365
- super(message || `HTTP ${statusCode}: ${statusText}`);
2366
- this.statusCode = statusCode;
2367
- this.statusText = statusText;
2368
- this.response = response;
2369
- this.url = url;
2370
- this.name = "APIError";
2371
- }
2372
- static {
2373
- __name(this, "APIError");
2374
- }
2375
- get details() {
2376
- if (typeof this.response === "object" && this.response !== null) {
2377
- return this.response;
2378
- }
2379
- return null;
2380
- }
2381
- get fieldErrors() {
2382
- const details = this.details;
2383
- if (!details) return null;
2384
- const fieldErrors = {};
2385
- for (const [key, value] of Object.entries(details)) {
2386
- if (Array.isArray(value)) fieldErrors[key] = value;
2387
- }
2388
- return Object.keys(fieldErrors).length > 0 ? fieldErrors : null;
2389
- }
2390
- get errorMessage() {
2391
- const details = this.details;
2392
- if (!details) return this.message;
2393
- if (details.detail) {
2394
- return Array.isArray(details.detail) ? details.detail.join(", ") : String(details.detail);
2395
- }
2396
- if (details.error) return String(details.error);
2397
- if (details.message) return String(details.message);
2398
- const fieldErrors = this.fieldErrors;
2399
- if (fieldErrors) {
2400
- const firstField = Object.keys(fieldErrors)[0];
2401
- if (firstField) return `${firstField}: ${fieldErrors[firstField]?.join(", ")}`;
2402
- }
2403
- return this.message;
2404
- }
2405
- get isValidationError() {
2406
- return this.statusCode === 400;
2407
- }
2408
- get isAuthError() {
2409
- return this.statusCode === 401;
2410
- }
2411
- get isPermissionError() {
2412
- return this.statusCode === 403;
2413
- }
2414
- get isNotFoundError() {
2415
- return this.statusCode === 404;
2416
- }
2417
- get isServerError() {
2418
- return this.statusCode >= 500 && this.statusCode < 600;
2419
- }
2420
- };
2421
-
2422
- // src/_api/generated/cfg_centrifugo/core/bodySerializer.gen.ts
2423
- var jsonBodySerializer2 = {
2424
- bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
2425
- };
2426
-
2427
- // src/_api/generated/cfg_centrifugo/core/params.gen.ts
2428
- var extraPrefixesMap2 = {
2429
- $body_: "body",
2430
- $headers_: "headers",
2431
- $path_: "path",
2432
- $query_: "query"
2433
- };
2434
- var extraPrefixes2 = Object.entries(extraPrefixesMap2);
2435
-
2436
- // src/_api/generated/cfg_centrifugo/core/serverSentEvents.gen.ts
2437
- function createSseClient2({
2438
- onRequest,
2439
- onSseError,
2440
- onSseEvent,
2441
- responseTransformer,
2442
- responseValidator,
2443
- sseDefaultRetryDelay,
2444
- sseMaxRetryAttempts,
2445
- sseMaxRetryDelay,
2446
- sseSleepFn,
2447
- url,
2448
- ...options
2449
- }) {
2450
- let lastEventId;
2451
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
2452
- const createStream = /* @__PURE__ */ __name(async function* () {
2453
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
2454
- let attempt = 0;
2455
- const signal = options.signal ?? new AbortController().signal;
2456
- while (true) {
2457
- if (signal.aborted) break;
2458
- attempt++;
2459
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
2460
- if (lastEventId !== void 0) {
2461
- headers.set("Last-Event-ID", lastEventId);
2462
- }
2463
- try {
2464
- const requestInit = {
2465
- redirect: "follow",
2466
- ...options,
2467
- body: options.serializedBody,
2468
- headers,
2469
- signal
2470
- };
2471
- let request = new Request(url, requestInit);
2472
- if (onRequest) {
2473
- request = await onRequest(url, requestInit);
2474
- }
2475
- const _fetch = options.fetch ?? globalThis.fetch;
2476
- const response = await _fetch(request);
2477
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
2478
- if (!response.body) throw new Error("No body in SSE response");
2479
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
2480
- let buffer = "";
2481
- const abortHandler = /* @__PURE__ */ __name(() => {
2482
- try {
2483
- reader.cancel();
2484
- } catch {
2485
- }
2486
- }, "abortHandler");
2487
- signal.addEventListener("abort", abortHandler);
2488
- try {
2489
- while (true) {
2490
- const { done, value } = await reader.read();
2491
- if (done) break;
2492
- buffer += value;
2493
- buffer = buffer.replace(/\r\n?/g, "\n");
2494
- const chunks = buffer.split("\n\n");
2495
- buffer = chunks.pop() ?? "";
2496
- for (const chunk of chunks) {
2497
- const lines = chunk.split("\n");
2498
- const dataLines = [];
2499
- let eventName;
2500
- for (const line of lines) {
2501
- if (line.startsWith("data:")) {
2502
- dataLines.push(line.replace(/^data:\s*/, ""));
2503
- } else if (line.startsWith("event:")) {
2504
- eventName = line.replace(/^event:\s*/, "");
2505
- } else if (line.startsWith("id:")) {
2506
- lastEventId = line.replace(/^id:\s*/, "");
2507
- } else if (line.startsWith("retry:")) {
2508
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
2509
- if (!Number.isNaN(parsed)) {
2510
- retryDelay = parsed;
2511
- }
2512
- }
2513
- }
2514
- let data;
2515
- let parsedJson = false;
2516
- if (dataLines.length) {
2517
- const rawData = dataLines.join("\n");
2518
- try {
2519
- data = JSON.parse(rawData);
2520
- parsedJson = true;
2521
- } catch {
2522
- data = rawData;
2523
- }
2524
- }
2525
- if (parsedJson) {
2526
- if (responseValidator) {
2527
- await responseValidator(data);
2528
- }
2529
- if (responseTransformer) {
2530
- data = await responseTransformer(data);
2531
- }
2532
- }
2533
- onSseEvent?.({
2534
- data,
2535
- event: eventName,
2536
- id: lastEventId,
2537
- retry: retryDelay
2538
- });
2539
- if (dataLines.length) {
2540
- yield data;
2541
- }
2542
- }
2543
- }
2544
- } finally {
2545
- signal.removeEventListener("abort", abortHandler);
2546
- reader.releaseLock();
2547
- }
2548
- break;
2549
- } catch (error) {
2550
- onSseError?.(error);
2551
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
2552
- break;
2553
- }
2554
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
2555
- await sleep(backoff);
2556
- }
2557
- }
2558
- }, "createStream");
2559
- const stream = createStream();
2560
- return { stream };
2561
- }
2562
- __name(createSseClient2, "createSseClient");
2563
-
2564
- // src/_api/generated/cfg_centrifugo/core/pathSerializer.gen.ts
2565
- var separatorArrayExplode2 = /* @__PURE__ */ __name((style) => {
2566
- switch (style) {
2567
- case "label":
2568
- return ".";
2569
- case "matrix":
2570
- return ";";
2571
- case "simple":
2572
- return ",";
2573
- default:
2574
- return "&";
2575
- }
2576
- }, "separatorArrayExplode");
2577
- var separatorArrayNoExplode2 = /* @__PURE__ */ __name((style) => {
2578
- switch (style) {
2579
- case "form":
2580
- return ",";
2581
- case "pipeDelimited":
2582
- return "|";
2583
- case "spaceDelimited":
2584
- return "%20";
2585
- default:
2586
- return ",";
2587
- }
2588
- }, "separatorArrayNoExplode");
2589
- var separatorObjectExplode2 = /* @__PURE__ */ __name((style) => {
2590
- switch (style) {
2591
- case "label":
2592
- return ".";
2593
- case "matrix":
2594
- return ";";
2595
- case "simple":
2596
- return ",";
2597
- default:
2598
- return "&";
2599
- }
2600
- }, "separatorObjectExplode");
2601
- var serializeArrayParam2 = /* @__PURE__ */ __name(({
2602
- allowReserved,
2603
- explode,
2604
- name,
2605
- style,
2606
- value
2607
- }) => {
2608
- if (!explode) {
2609
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode2(style));
2610
- switch (style) {
2611
- case "label":
2612
- return `.${joinedValues2}`;
2613
- case "matrix":
2614
- return `;${name}=${joinedValues2}`;
2615
- case "simple":
2616
- return joinedValues2;
2617
- default:
2618
- return `${name}=${joinedValues2}`;
2619
- }
2620
- }
2621
- const separator = separatorArrayExplode2(style);
2622
- const joinedValues = value.map((v) => {
2623
- if (style === "label" || style === "simple") {
2624
- return allowReserved ? v : encodeURIComponent(v);
2625
- }
2626
- return serializePrimitiveParam2({
2627
- allowReserved,
2628
- name,
2629
- value: v
2630
- });
2631
- }).join(separator);
2632
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
2633
- }, "serializeArrayParam");
2634
- var serializePrimitiveParam2 = /* @__PURE__ */ __name(({
2635
- allowReserved,
2636
- name,
2637
- value
2638
- }) => {
2639
- if (value === void 0 || value === null) {
2640
- return "";
2641
- }
2642
- if (typeof value === "object") {
2643
- throw new Error(
2644
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
2645
- );
2646
- }
2647
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
2648
- }, "serializePrimitiveParam");
2649
- var serializeObjectParam2 = /* @__PURE__ */ __name(({
2650
- allowReserved,
2651
- explode,
2652
- name,
2653
- style,
2654
- value,
2655
- valueOnly
2656
- }) => {
2657
- if (value instanceof Date) {
2658
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
2659
- }
2660
- if (style !== "deepObject" && !explode) {
2661
- let values = [];
2662
- Object.entries(value).forEach(([key, v]) => {
2663
- values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
2664
- });
2665
- const joinedValues2 = values.join(",");
2666
- switch (style) {
2667
- case "form":
2668
- return `${name}=${joinedValues2}`;
2669
- case "label":
2670
- return `.${joinedValues2}`;
2671
- case "matrix":
2672
- return `;${name}=${joinedValues2}`;
2673
- default:
2674
- return joinedValues2;
2675
- }
2676
- }
2677
- const separator = separatorObjectExplode2(style);
2678
- const joinedValues = Object.entries(value).map(
2679
- ([key, v]) => serializePrimitiveParam2({
2680
- allowReserved,
2681
- name: style === "deepObject" ? `${name}[${key}]` : key,
2682
- value: v
2683
- })
2684
- ).join(separator);
2685
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
2686
- }, "serializeObjectParam");
2687
-
2688
- // src/_api/generated/cfg_centrifugo/core/utils.gen.ts
2689
- var PATH_PARAM_RE2 = /\{[^{}]+\}/g;
2690
- var defaultPathSerializer2 = /* @__PURE__ */ __name(({ path, url: _url }) => {
2691
- let url = _url;
2692
- const matches = _url.match(PATH_PARAM_RE2);
2693
- if (matches) {
2694
- for (const match of matches) {
2695
- let explode = false;
2696
- let name = match.substring(1, match.length - 1);
2697
- let style = "simple";
2698
- if (name.endsWith("*")) {
2699
- explode = true;
2700
- name = name.substring(0, name.length - 1);
2701
- }
2702
- if (name.startsWith(".")) {
2703
- name = name.substring(1);
2704
- style = "label";
2705
- } else if (name.startsWith(";")) {
2706
- name = name.substring(1);
2707
- style = "matrix";
2708
- }
2709
- const value = path[name];
2710
- if (value === void 0 || value === null) {
2711
- continue;
2712
- }
2713
- if (Array.isArray(value)) {
2714
- url = url.replace(match, serializeArrayParam2({ explode, name, style, value }));
2715
- continue;
2716
- }
2717
- if (typeof value === "object") {
2718
- url = url.replace(
2719
- match,
2720
- serializeObjectParam2({
2721
- explode,
2722
- name,
2723
- style,
2724
- value,
2725
- valueOnly: true
2726
- })
2727
- );
2728
- continue;
2729
- }
2730
- if (style === "matrix") {
2731
- url = url.replace(
2732
- match,
2733
- `;${serializePrimitiveParam2({
2734
- name,
2735
- value
2736
- })}`
2737
- );
2738
- continue;
2739
- }
2740
- const replaceValue = encodeURIComponent(
2741
- style === "label" ? `.${value}` : value
2742
- );
2743
- url = url.replace(match, replaceValue);
2744
- }
2745
- }
2746
- return url;
2747
- }, "defaultPathSerializer");
2748
- var getUrl2 = /* @__PURE__ */ __name(({
2749
- baseUrl: baseUrl2,
2750
- path,
2751
- query,
2752
- querySerializer,
2753
- url: _url
2754
- }) => {
2755
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
2756
- let url = (baseUrl2 ?? "") + pathUrl;
2757
- if (path) {
2758
- url = defaultPathSerializer2({ path, url });
2759
- }
2760
- let search = query ? querySerializer(query) : "";
2761
- if (search.startsWith("?")) {
2762
- search = search.substring(1);
2763
- }
2764
- if (search) {
2765
- url += `?${search}`;
2766
- }
2767
- return url;
2768
- }, "getUrl");
2769
- function getValidRequestBody2(options) {
2770
- const hasBody = options.body !== void 0;
2771
- const isSerializedBody = hasBody && options.bodySerializer;
2772
- if (isSerializedBody) {
2773
- if ("serializedBody" in options) {
2774
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
2775
- return hasSerializedBody ? options.serializedBody : null;
2776
- }
2777
- return options.body !== "" ? options.body : null;
2778
- }
2779
- if (hasBody) {
2780
- return options.body;
2781
- }
2782
- return void 0;
2783
- }
2784
- __name(getValidRequestBody2, "getValidRequestBody");
2785
-
2786
- // src/_api/generated/cfg_centrifugo/core/auth.gen.ts
2787
- var getAuthToken2 = /* @__PURE__ */ __name(async (auth, callback) => {
2788
- const token = typeof callback === "function" ? await callback(auth) : callback;
2789
- if (!token) {
2790
- return;
2791
- }
2792
- if (auth.scheme === "bearer") {
2793
- return `Bearer ${token}`;
2794
- }
2795
- if (auth.scheme === "basic") {
2796
- return `Basic ${btoa(token)}`;
2797
- }
2798
- return token;
2799
- }, "getAuthToken");
2800
-
2801
- // src/_api/generated/cfg_centrifugo/client/utils.gen.ts
2802
- var createQuerySerializer2 = /* @__PURE__ */ __name(({
2803
- parameters = {},
2804
- ...args
2805
- } = {}) => {
2806
- const querySerializer = /* @__PURE__ */ __name((queryParams) => {
2807
- const search = [];
2808
- if (queryParams && typeof queryParams === "object") {
2809
- for (const name in queryParams) {
2810
- const value = queryParams[name];
2811
- if (value === void 0 || value === null) {
2812
- continue;
2813
- }
2814
- const options = parameters[name] || args;
2815
- if (Array.isArray(value)) {
2816
- const serializedArray = serializeArrayParam2({
2817
- allowReserved: options.allowReserved,
2818
- explode: true,
2819
- name,
2820
- style: "form",
2821
- value,
2822
- ...options.array
2823
- });
2824
- if (serializedArray) search.push(serializedArray);
2825
- } else if (typeof value === "object") {
2826
- const serializedObject = serializeObjectParam2({
2827
- allowReserved: options.allowReserved,
2828
- explode: true,
2829
- name,
2830
- style: "deepObject",
2831
- value,
2832
- ...options.object
2833
- });
2834
- if (serializedObject) search.push(serializedObject);
2835
- } else {
2836
- const serializedPrimitive = serializePrimitiveParam2({
2837
- allowReserved: options.allowReserved,
2838
- name,
2839
- value
2840
- });
2841
- if (serializedPrimitive) search.push(serializedPrimitive);
2842
- }
2843
- }
2844
- }
2845
- return search.join("&");
2846
- }, "querySerializer");
2847
- return querySerializer;
2848
- }, "createQuerySerializer");
2849
- var getParseAs2 = /* @__PURE__ */ __name((contentType) => {
2850
- if (!contentType) {
2851
- return "stream";
2852
- }
2853
- const cleanContent = contentType.split(";")[0]?.trim();
2854
- if (!cleanContent) {
2855
- return;
2856
- }
2857
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
2858
- return "json";
2859
- }
2860
- if (cleanContent === "multipart/form-data") {
2861
- return "formData";
2862
- }
2863
- if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
2864
- return "blob";
2865
- }
2866
- if (cleanContent.startsWith("text/")) {
2867
- return "text";
2868
- }
2869
- return;
2870
- }, "getParseAs");
2871
- var checkForExistence2 = /* @__PURE__ */ __name((options, name) => {
2872
- if (!name) {
2873
- return false;
2874
- }
2875
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
2876
- return true;
2877
- }
2878
- return false;
2879
- }, "checkForExistence");
2880
- var setAuthParams2 = /* @__PURE__ */ __name(async ({
2881
- security,
2882
- ...options
2883
- }) => {
2884
- for (const auth of security) {
2885
- if (checkForExistence2(options, auth.name)) {
2886
- continue;
2887
- }
2888
- const token = await getAuthToken2(auth, options.auth);
2889
- if (!token) {
2890
- continue;
2891
- }
2892
- const name = auth.name ?? "Authorization";
2893
- switch (auth.in) {
2894
- case "query":
2895
- if (!options.query) {
2896
- options.query = {};
2897
- }
2898
- options.query[name] = token;
2899
- break;
2900
- case "cookie":
2901
- options.headers.append("Cookie", `${name}=${token}`);
2902
- break;
2903
- case "header":
2904
- default:
2905
- options.headers.set(name, token);
2906
- break;
2907
- }
2908
- }
2909
- }, "setAuthParams");
2910
- var buildUrl2 = /* @__PURE__ */ __name((options) => getUrl2({
2911
- baseUrl: options.baseUrl,
2912
- path: options.path,
2913
- query: options.query,
2914
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer2(options.querySerializer),
2915
- url: options.url
2916
- }), "buildUrl");
2917
- var mergeConfigs2 = /* @__PURE__ */ __name((a, b) => {
2918
- const config = { ...a, ...b };
2919
- if (config.baseUrl?.endsWith("/")) {
2920
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
2921
- }
2922
- config.headers = mergeHeaders2(a.headers, b.headers);
2923
- return config;
2924
- }, "mergeConfigs");
2925
- var headersEntries2 = /* @__PURE__ */ __name((headers) => {
2926
- const entries = [];
2927
- headers.forEach((value, key) => {
2928
- entries.push([key, value]);
2929
- });
2930
- return entries;
2931
- }, "headersEntries");
2932
- var mergeHeaders2 = /* @__PURE__ */ __name((...headers) => {
2933
- const mergedHeaders = new Headers();
2934
- for (const header of headers) {
2935
- if (!header) {
2936
- continue;
2937
- }
2938
- const iterator = header instanceof Headers ? headersEntries2(header) : Object.entries(header);
2939
- for (const [key, value] of iterator) {
2940
- if (value === null) {
2941
- mergedHeaders.delete(key);
2942
- } else if (Array.isArray(value)) {
2943
- for (const v of value) {
2944
- mergedHeaders.append(key, v);
2945
- }
2946
- } else if (value !== void 0) {
2947
- mergedHeaders.set(
2948
- key,
2949
- typeof value === "object" ? JSON.stringify(value) : value
2950
- );
2951
- }
2952
- }
2953
- }
2954
- return mergedHeaders;
2955
- }, "mergeHeaders");
2956
- var Interceptors2 = class {
2957
- static {
2958
- __name(this, "Interceptors");
2959
- }
2960
- fns = [];
2961
- clear() {
2962
- this.fns = [];
2963
- }
2964
- eject(id) {
2965
- const index = this.getInterceptorIndex(id);
2966
- if (this.fns[index]) {
2967
- this.fns[index] = null;
2968
- }
2969
- }
2970
- exists(id) {
2971
- const index = this.getInterceptorIndex(id);
2972
- return Boolean(this.fns[index]);
2973
- }
2974
- getInterceptorIndex(id) {
2975
- if (typeof id === "number") {
2976
- return this.fns[id] ? id : -1;
2977
- }
2978
- return this.fns.indexOf(id);
2979
- }
2980
- update(id, fn) {
2981
- const index = this.getInterceptorIndex(id);
2982
- if (this.fns[index]) {
2983
- this.fns[index] = fn;
2984
- return id;
2985
- }
2986
- return false;
2987
- }
2988
- use(fn) {
2989
- this.fns.push(fn);
2990
- return this.fns.length - 1;
2991
- }
2992
- };
2993
- var createInterceptors2 = /* @__PURE__ */ __name(() => ({
2994
- error: new Interceptors2(),
2995
- request: new Interceptors2(),
2996
- response: new Interceptors2()
2997
- }), "createInterceptors");
2998
- var defaultQuerySerializer2 = createQuerySerializer2({
2999
- allowReserved: false,
3000
- array: {
3001
- explode: true,
3002
- style: "form"
3003
- },
3004
- object: {
3005
- explode: true,
3006
- style: "deepObject"
3007
- }
3008
- });
3009
- var defaultHeaders2 = {
3010
- "Content-Type": "application/json"
3011
- };
3012
- var createConfig2 = /* @__PURE__ */ __name((override = {}) => ({
3013
- ...jsonBodySerializer2,
3014
- headers: defaultHeaders2,
3015
- parseAs: "auto",
3016
- querySerializer: defaultQuerySerializer2,
3017
- ...override
3018
- }), "createConfig");
3019
-
3020
- // src/_api/generated/cfg_centrifugo/client/client.gen.ts
3021
- var createClient2 = /* @__PURE__ */ __name((config = {}) => {
3022
- let _config = mergeConfigs2(createConfig2(), config);
3023
- const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
3024
- const setConfig = /* @__PURE__ */ __name((config2) => {
3025
- _config = mergeConfigs2(_config, config2);
3026
- return getConfig();
3027
- }, "setConfig");
3028
- const interceptors = createInterceptors2();
3029
- const beforeRequest = /* @__PURE__ */ __name(async (options) => {
3030
- const opts = {
3031
- ..._config,
3032
- ...options,
3033
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
3034
- headers: mergeHeaders2(_config.headers, options.headers),
3035
- serializedBody: void 0
3036
- };
3037
- if (opts.security) {
3038
- await setAuthParams2({
3039
- ...opts,
3040
- security: opts.security
3041
- });
3042
- }
3043
- if (opts.requestValidator) {
3044
- await opts.requestValidator(opts);
3045
- }
3046
- if (opts.body !== void 0 && opts.bodySerializer) {
3047
- opts.serializedBody = opts.bodySerializer(opts.body);
3048
- }
3049
- if (opts.body === void 0 || opts.serializedBody === "") {
3050
- opts.headers.delete("Content-Type");
3051
- }
3052
- const resolvedOpts = opts;
3053
- const url = buildUrl2(resolvedOpts);
3054
- return { opts: resolvedOpts, url };
3055
- }, "beforeRequest");
3056
- const request = /* @__PURE__ */ __name(async (options) => {
3057
- const throwOnError = options.throwOnError ?? _config.throwOnError;
3058
- const responseStyle = options.responseStyle ?? _config.responseStyle;
3059
- let request2;
3060
- let response;
3061
- try {
3062
- const { opts, url } = await beforeRequest(options);
3063
- const requestInit = {
3064
- redirect: "follow",
3065
- ...opts,
3066
- body: getValidRequestBody2(opts)
3067
- };
3068
- request2 = new Request(url, requestInit);
3069
- for (const fn of interceptors.request.fns) {
3070
- if (fn) {
3071
- request2 = await fn(request2, opts);
3072
- }
3073
- }
3074
- const _fetch = opts.fetch;
3075
- response = await _fetch(request2);
3076
- for (const fn of interceptors.response.fns) {
3077
- if (fn) {
3078
- response = await fn(response, request2, opts);
3079
- }
3080
- }
3081
- const result = {
3082
- request: request2,
3083
- response
3084
- };
3085
- if (response.ok) {
3086
- const parseAs = (opts.parseAs === "auto" ? getParseAs2(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
3087
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
3088
- let emptyData;
3089
- switch (parseAs) {
3090
- case "arrayBuffer":
3091
- case "blob":
3092
- case "text":
3093
- emptyData = await response[parseAs]();
3094
- break;
3095
- case "formData":
3096
- emptyData = new FormData();
3097
- break;
3098
- case "stream":
3099
- emptyData = response.body;
3100
- break;
3101
- case "json":
3102
- default:
3103
- emptyData = {};
3104
- break;
3105
- }
3106
- return opts.responseStyle === "data" ? emptyData : {
3107
- data: emptyData,
3108
- ...result
3109
- };
3110
- }
3111
- let data;
3112
- switch (parseAs) {
3113
- case "arrayBuffer":
3114
- case "blob":
3115
- case "formData":
3116
- case "text":
3117
- data = await response[parseAs]();
3118
- break;
3119
- case "json": {
3120
- const text = await response.text();
3121
- data = text ? JSON.parse(text) : {};
3122
- break;
3123
- }
3124
- case "stream":
3125
- return opts.responseStyle === "data" ? response.body : {
3126
- data: response.body,
3127
- ...result
3128
- };
3129
- }
3130
- if (parseAs === "json") {
3131
- if (opts.responseValidator) {
3132
- await opts.responseValidator(data);
3133
- }
3134
- if (opts.responseTransformer) {
3135
- data = await opts.responseTransformer(data);
3136
- }
3137
- }
3138
- return opts.responseStyle === "data" ? data : {
3139
- data,
3140
- ...result
3141
- };
3142
- }
3143
- const textError = await response.text();
3144
- let jsonError;
3145
- try {
3146
- jsonError = JSON.parse(textError);
3147
- } catch {
3148
- }
3149
- throw jsonError ?? textError;
3150
- } catch (error) {
3151
- let finalError = error;
3152
- for (const fn of interceptors.error.fns) {
3153
- if (fn) {
3154
- finalError = await fn(finalError, response, request2, options);
3155
- }
3156
- }
3157
- finalError = finalError || {};
3158
- if (throwOnError) {
3159
- throw finalError;
3160
- }
3161
- return responseStyle === "data" ? void 0 : {
3162
- error: finalError,
3163
- request: request2,
3164
- response
3165
- };
3166
- }
3167
- }, "request");
3168
- const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
3169
- const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
3170
- const { opts, url } = await beforeRequest(options);
3171
- return createSseClient2({
3172
- ...opts,
3173
- body: opts.body,
3174
- method,
3175
- onRequest: /* @__PURE__ */ __name(async (url2, init) => {
3176
- let request2 = new Request(url2, init);
3177
- for (const fn of interceptors.request.fns) {
3178
- if (fn) {
3179
- request2 = await fn(request2, opts);
3180
- }
3181
- }
3182
- return request2;
3183
- }, "onRequest"),
3184
- serializedBody: getValidRequestBody2(opts),
3185
- url
3186
- });
3187
- }, "makeSseFn");
3188
- const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl2({ ..._config, ...options }), "_buildUrl");
3189
- return {
3190
- buildUrl: _buildUrl,
3191
- connect: makeMethodFn("CONNECT"),
3192
- delete: makeMethodFn("DELETE"),
3193
- get: makeMethodFn("GET"),
3194
- getConfig,
3195
- head: makeMethodFn("HEAD"),
3196
- interceptors,
3197
- options: makeMethodFn("OPTIONS"),
3198
- patch: makeMethodFn("PATCH"),
3199
- post: makeMethodFn("POST"),
3200
- put: makeMethodFn("PUT"),
3201
- request,
3202
- setConfig,
3203
- sse: {
3204
- connect: makeSseFn("CONNECT"),
3205
- delete: makeSseFn("DELETE"),
3206
- get: makeSseFn("GET"),
3207
- head: makeSseFn("HEAD"),
3208
- options: makeSseFn("OPTIONS"),
3209
- patch: makeSseFn("PATCH"),
3210
- post: makeSseFn("POST"),
3211
- put: makeSseFn("PUT"),
3212
- trace: makeSseFn("TRACE")
3213
- },
3214
- trace: makeMethodFn("TRACE")
3215
- };
3216
- }, "createClient");
3217
-
3218
- // src/_api/generated/cfg_centrifugo/client.gen.ts
3219
- var client2 = createClient2(createConfig2({ baseUrl: "http://localhost:8000" }));
3220
-
3221
- // src/_api/generated/cfg_centrifugo/sdk.gen.ts
3222
- var Cfg2 = class {
3223
- static {
3224
- __name(this, "Cfg");
3225
- }
3226
- /**
3227
- * Get Centrifugo connection token
3228
- *
3229
- * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
3230
- */
3231
- static cfgCentrifugoAuthTokenRetrieve(options) {
3232
- return (options?.client ?? client2).get({
3233
- security: [{ scheme: "bearer", type: "http" }],
3234
- url: "/cfg/centrifugo/auth/token/",
3235
- ...options
3236
- });
3237
- }
3238
- };
3239
- var Centrifugo = class {
3240
- static {
3241
- __name(this, "Centrifugo");
3242
- }
3243
- /**
3244
- * Get Centrifugo connection token
3245
- *
3246
- * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
3247
- */
3248
- static cfgCentrifugoAuthTokenRetrieve(options) {
3249
- return (options?.client ?? client2).get({
3250
- security: [{ scheme: "bearer", type: "http" }],
3251
- url: "/cfg/centrifugo/auth/token/",
3252
- ...options
3253
- });
3254
- }
3255
- };
3256
- var CentrifugoAuth = class {
3257
- static {
3258
- __name(this, "CentrifugoAuth");
3259
- }
3260
- /**
3261
- * Get Centrifugo connection token
3262
- *
3263
- * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
3264
- */
3265
- static cfgCentrifugoAuthTokenRetrieve(options) {
3266
- return (options?.client ?? client2).get({
3267
- security: [{ scheme: "bearer", type: "http" }],
3268
- url: "/cfg/centrifugo/auth/token/",
3269
- ...options
3270
- });
3271
- }
3272
- };
3273
-
3274
- // src/_api/generated/cfg_centrifugo/schemas/ConnectionTokenResponse.ts
3275
- var import_zod22 = require("zod");
3276
- var ConnectionTokenResponseSchema = import_zod22.z.object({
3277
- token: import_zod22.z.string(),
3278
- centrifugo_url: import_zod22.z.string(),
3279
- expires_at: import_zod22.z.string(),
3280
- channels: import_zod22.z.array(import_zod22.z.string())
3281
- });
3282
-
3283
- // src/_api/generated/cfg_centrifugo/api.ts
3284
- var ACCESS_KEY2 = "cfg.access_token";
3285
- var REFRESH_KEY2 = "cfg.refresh_token";
3286
- var VALIDATION_ROUTES2 = [
3287
- { method: "GET", re: new RegExp("^/cfg/centrifugo/auth/token/?$"), schema: ConnectionTokenResponseSchema, path: "/cfg/centrifugo/auth/token/" }
3288
- ];
3289
- function detectLocale2() {
3290
- try {
3291
- if (typeof document !== "undefined") {
3292
- const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
3293
- if (m) return decodeURIComponent(m[1]);
3294
- }
3295
- if (typeof navigator !== "undefined" && navigator.language) {
3296
- return navigator.language;
3297
- }
3298
- } catch {
3299
- }
3300
- return null;
3301
- }
3302
- __name(detectLocale2, "detectLocale");
3303
- var API2 = class {
3304
- static {
3305
- __name(this, "API");
3306
- }
3307
- baseUrl;
3308
- storage;
3309
- locale;
3310
- apiKey;
3311
- logger;
3312
- cfg = Cfg2;
3313
- centrifugo = Centrifugo;
3314
- centrifugoAuth = CentrifugoAuth;
3315
- constructor(baseUrl2, opts = {}) {
3316
- this.baseUrl = baseUrl2.replace(/\/$/, "");
3317
- this.storage = opts.storage ?? new LocalStorageAdapter();
3318
- this.logger = new APILogger(opts.logger);
3319
- this.locale = opts.locale ?? null;
3320
- this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
3321
- const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
3322
- client2.setConfig({ baseUrl: this.baseUrl, credentials });
3323
- client2.interceptors.request.use((request) => {
3324
- const access = this.getToken();
3325
- if (access) request.headers.set("Authorization", `Bearer ${access}`);
3326
- const locale = this.locale ?? detectLocale2();
3327
- if (locale) request.headers.set("Accept-Language", locale);
3328
- if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
3329
- return request;
3330
- });
3331
- client2.interceptors.response.use(async (response, request) => {
3332
- if (!response.ok) return response;
3333
- const ct = response.headers.get("content-type") || "";
3334
- if (!ct.includes("application/json")) return response;
3335
- const url = new URL(request.url);
3336
- const method = request.method.toUpperCase();
3337
- const route = VALIDATION_ROUTES2.find(
3338
- (r) => r.method === method && r.re.test(url.pathname)
3339
- );
3340
- if (!route) return response;
3341
- let payload;
3342
- try {
3343
- payload = await response.clone().json();
3344
- } catch {
3345
- return response;
3346
- }
3347
- const result = route.schema.safeParse(payload);
3348
- if (!result.success) {
3349
- dispatchValidationError({
3350
- operation: `${method} ${route.path}`,
3351
- path: route.path,
3352
- method,
3353
- error: result.error,
3354
- response: payload,
3355
- timestamp: /* @__PURE__ */ new Date()
3356
- });
3357
- }
3358
- return response;
3359
- });
3360
- }
3361
- // ── Base URL ────────────────────────────────────────────────────────────
3362
- getBaseUrl() {
3363
- return this.baseUrl;
3364
- }
3365
- setBaseUrl(url) {
3366
- this.baseUrl = url.replace(/\/$/, "");
3367
- client2.setConfig({ baseUrl: this.baseUrl });
3368
- }
3369
- // ── Tokens ──────────────────────────────────────────────────────────────
3370
- getToken() {
3371
- return this.storage.getItem(ACCESS_KEY2);
3372
- }
3373
- setToken(token) {
3374
- if (token) this.storage.setItem(ACCESS_KEY2, token);
3375
- else this.storage.removeItem(ACCESS_KEY2);
3376
- }
3377
- getRefreshToken() {
3378
- return this.storage.getItem(REFRESH_KEY2);
3379
- }
3380
- setRefreshToken(token) {
3381
- if (token) this.storage.setItem(REFRESH_KEY2, token);
3382
- else this.storage.removeItem(REFRESH_KEY2);
3383
- }
3384
- clearToken() {
3385
- this.storage.removeItem(ACCESS_KEY2);
3386
- this.storage.removeItem(REFRESH_KEY2);
3387
- }
3388
- isAuthenticated() {
3389
- return this.getToken() !== null;
3390
- }
3391
- // ── Locale / API key ────────────────────────────────────────────────────
3392
- getLocale() {
3393
- return this.locale ?? detectLocale2();
3394
- }
3395
- setLocale(locale) {
3396
- this.locale = locale;
3397
- }
3398
- getApiKey() {
3399
- return this.apiKey;
3400
- }
3401
- setApiKey(key) {
3402
- this.apiKey = key;
3403
- }
3404
- };
3405
-
3406
- // src/_api/generated/cfg_totp/core/bodySerializer.gen.ts
3407
- var jsonBodySerializer3 = {
3408
- bodySerializer: /* @__PURE__ */ __name((body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value), "bodySerializer")
3409
- };
3410
-
3411
- // src/_api/generated/cfg_totp/core/params.gen.ts
3412
- var extraPrefixesMap3 = {
3413
- $body_: "body",
3414
- $headers_: "headers",
3415
- $path_: "path",
3416
- $query_: "query"
3417
- };
3418
- var extraPrefixes3 = Object.entries(extraPrefixesMap3);
3419
-
3420
- // src/_api/generated/cfg_totp/core/serverSentEvents.gen.ts
3421
- function createSseClient3({
3422
- onRequest,
3423
- onSseError,
3424
- onSseEvent,
3425
- responseTransformer,
3426
- responseValidator,
3427
- sseDefaultRetryDelay,
3428
- sseMaxRetryAttempts,
3429
- sseMaxRetryDelay,
3430
- sseSleepFn,
3431
- url,
3432
- ...options
3433
- }) {
3434
- let lastEventId;
3435
- const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
3436
- const createStream = /* @__PURE__ */ __name(async function* () {
3437
- let retryDelay = sseDefaultRetryDelay ?? 3e3;
3438
- let attempt = 0;
3439
- const signal = options.signal ?? new AbortController().signal;
3440
- while (true) {
3441
- if (signal.aborted) break;
3442
- attempt++;
3443
- const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
3444
- if (lastEventId !== void 0) {
3445
- headers.set("Last-Event-ID", lastEventId);
3446
- }
3447
- try {
3448
- const requestInit = {
3449
- redirect: "follow",
3450
- ...options,
3451
- body: options.serializedBody,
3452
- headers,
3453
- signal
3454
- };
3455
- let request = new Request(url, requestInit);
3456
- if (onRequest) {
3457
- request = await onRequest(url, requestInit);
3458
- }
3459
- const _fetch = options.fetch ?? globalThis.fetch;
3460
- const response = await _fetch(request);
3461
- if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
3462
- if (!response.body) throw new Error("No body in SSE response");
3463
- const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
3464
- let buffer = "";
3465
- const abortHandler = /* @__PURE__ */ __name(() => {
3466
- try {
3467
- reader.cancel();
3468
- } catch {
3469
- }
3470
- }, "abortHandler");
3471
- signal.addEventListener("abort", abortHandler);
3472
- try {
3473
- while (true) {
3474
- const { done, value } = await reader.read();
3475
- if (done) break;
3476
- buffer += value;
3477
- buffer = buffer.replace(/\r\n?/g, "\n");
3478
- const chunks = buffer.split("\n\n");
3479
- buffer = chunks.pop() ?? "";
3480
- for (const chunk of chunks) {
3481
- const lines = chunk.split("\n");
3482
- const dataLines = [];
3483
- let eventName;
3484
- for (const line of lines) {
3485
- if (line.startsWith("data:")) {
3486
- dataLines.push(line.replace(/^data:\s*/, ""));
3487
- } else if (line.startsWith("event:")) {
3488
- eventName = line.replace(/^event:\s*/, "");
3489
- } else if (line.startsWith("id:")) {
3490
- lastEventId = line.replace(/^id:\s*/, "");
3491
- } else if (line.startsWith("retry:")) {
3492
- const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
3493
- if (!Number.isNaN(parsed)) {
3494
- retryDelay = parsed;
3495
- }
3496
- }
3497
- }
3498
- let data;
3499
- let parsedJson = false;
3500
- if (dataLines.length) {
3501
- const rawData = dataLines.join("\n");
3502
- try {
3503
- data = JSON.parse(rawData);
3504
- parsedJson = true;
3505
- } catch {
3506
- data = rawData;
3507
- }
3508
- }
3509
- if (parsedJson) {
3510
- if (responseValidator) {
3511
- await responseValidator(data);
3512
- }
3513
- if (responseTransformer) {
3514
- data = await responseTransformer(data);
3515
- }
3516
- }
3517
- onSseEvent?.({
3518
- data,
3519
- event: eventName,
3520
- id: lastEventId,
3521
- retry: retryDelay
3522
- });
3523
- if (dataLines.length) {
3524
- yield data;
3525
- }
3526
- }
3527
- }
3528
- } finally {
3529
- signal.removeEventListener("abort", abortHandler);
3530
- reader.releaseLock();
3531
- }
3532
- break;
3533
- } catch (error) {
3534
- onSseError?.(error);
3535
- if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
3536
- break;
3537
- }
3538
- const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
3539
- await sleep(backoff);
3540
- }
3541
- }
3542
- }, "createStream");
3543
- const stream = createStream();
3544
- return { stream };
3545
- }
3546
- __name(createSseClient3, "createSseClient");
3547
-
3548
- // src/_api/generated/cfg_totp/core/pathSerializer.gen.ts
3549
- var separatorArrayExplode3 = /* @__PURE__ */ __name((style) => {
3550
- switch (style) {
3551
- case "label":
3552
- return ".";
3553
- case "matrix":
3554
- return ";";
3555
- case "simple":
3556
- return ",";
3557
- default:
3558
- return "&";
3559
- }
3560
- }, "separatorArrayExplode");
3561
- var separatorArrayNoExplode3 = /* @__PURE__ */ __name((style) => {
3562
- switch (style) {
3563
- case "form":
3564
- return ",";
3565
- case "pipeDelimited":
3566
- return "|";
3567
- case "spaceDelimited":
3568
- return "%20";
3569
- default:
3570
- return ",";
3571
- }
3572
- }, "separatorArrayNoExplode");
3573
- var separatorObjectExplode3 = /* @__PURE__ */ __name((style) => {
3574
- switch (style) {
3575
- case "label":
3576
- return ".";
3577
- case "matrix":
3578
- return ";";
3579
- case "simple":
3580
- return ",";
3581
- default:
3582
- return "&";
3583
- }
3584
- }, "separatorObjectExplode");
3585
- var serializeArrayParam3 = /* @__PURE__ */ __name(({
3586
- allowReserved,
3587
- explode,
3588
- name,
3589
- style,
3590
- value
3591
- }) => {
3592
- if (!explode) {
3593
- const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode3(style));
3594
- switch (style) {
3595
- case "label":
3596
- return `.${joinedValues2}`;
3597
- case "matrix":
3598
- return `;${name}=${joinedValues2}`;
3599
- case "simple":
3600
- return joinedValues2;
3601
- default:
3602
- return `${name}=${joinedValues2}`;
3603
- }
3604
- }
3605
- const separator = separatorArrayExplode3(style);
3606
- const joinedValues = value.map((v) => {
3607
- if (style === "label" || style === "simple") {
3608
- return allowReserved ? v : encodeURIComponent(v);
3609
- }
3610
- return serializePrimitiveParam3({
3611
- allowReserved,
3612
- name,
3613
- value: v
3614
- });
3615
- }).join(separator);
3616
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
3617
- }, "serializeArrayParam");
3618
- var serializePrimitiveParam3 = /* @__PURE__ */ __name(({
3619
- allowReserved,
3620
- name,
3621
- value
3622
- }) => {
3623
- if (value === void 0 || value === null) {
3624
- return "";
3625
- }
3626
- if (typeof value === "object") {
3627
- throw new Error(
3628
- "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
3629
- );
3630
- }
3631
- return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
3632
- }, "serializePrimitiveParam");
3633
- var serializeObjectParam3 = /* @__PURE__ */ __name(({
3634
- allowReserved,
3635
- explode,
3636
- name,
3637
- style,
3638
- value,
3639
- valueOnly
3640
- }) => {
3641
- if (value instanceof Date) {
3642
- return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
3643
- }
3644
- if (style !== "deepObject" && !explode) {
3645
- let values = [];
3646
- Object.entries(value).forEach(([key, v]) => {
3647
- values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
3648
- });
3649
- const joinedValues2 = values.join(",");
3650
- switch (style) {
3651
- case "form":
3652
- return `${name}=${joinedValues2}`;
3653
- case "label":
3654
- return `.${joinedValues2}`;
3655
- case "matrix":
3656
- return `;${name}=${joinedValues2}`;
3657
- default:
3658
- return joinedValues2;
3659
- }
3660
- }
3661
- const separator = separatorObjectExplode3(style);
3662
- const joinedValues = Object.entries(value).map(
3663
- ([key, v]) => serializePrimitiveParam3({
3664
- allowReserved,
3665
- name: style === "deepObject" ? `${name}[${key}]` : key,
3666
- value: v
3667
- })
3668
- ).join(separator);
3669
- return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
3670
- }, "serializeObjectParam");
3671
-
3672
- // src/_api/generated/cfg_totp/core/utils.gen.ts
3673
- var PATH_PARAM_RE3 = /\{[^{}]+\}/g;
3674
- var defaultPathSerializer3 = /* @__PURE__ */ __name(({ path, url: _url }) => {
3675
- let url = _url;
3676
- const matches = _url.match(PATH_PARAM_RE3);
3677
- if (matches) {
3678
- for (const match of matches) {
3679
- let explode = false;
3680
- let name = match.substring(1, match.length - 1);
3681
- let style = "simple";
3682
- if (name.endsWith("*")) {
3683
- explode = true;
3684
- name = name.substring(0, name.length - 1);
3685
- }
3686
- if (name.startsWith(".")) {
3687
- name = name.substring(1);
3688
- style = "label";
3689
- } else if (name.startsWith(";")) {
3690
- name = name.substring(1);
3691
- style = "matrix";
3692
- }
3693
- const value = path[name];
3694
- if (value === void 0 || value === null) {
3695
- continue;
3696
- }
3697
- if (Array.isArray(value)) {
3698
- url = url.replace(match, serializeArrayParam3({ explode, name, style, value }));
3699
- continue;
3700
- }
3701
- if (typeof value === "object") {
3702
- url = url.replace(
3703
- match,
3704
- serializeObjectParam3({
3705
- explode,
3706
- name,
3707
- style,
3708
- value,
3709
- valueOnly: true
3710
- })
3711
- );
3712
- continue;
3713
- }
3714
- if (style === "matrix") {
3715
- url = url.replace(
3716
- match,
3717
- `;${serializePrimitiveParam3({
3718
- name,
3719
- value
3720
- })}`
3721
- );
3722
- continue;
3723
- }
3724
- const replaceValue = encodeURIComponent(
3725
- style === "label" ? `.${value}` : value
3726
- );
3727
- url = url.replace(match, replaceValue);
3728
- }
3729
- }
3730
- return url;
3731
- }, "defaultPathSerializer");
3732
- var getUrl3 = /* @__PURE__ */ __name(({
3733
- baseUrl: baseUrl2,
3734
- path,
3735
- query,
3736
- querySerializer,
3737
- url: _url
3738
- }) => {
3739
- const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
3740
- let url = (baseUrl2 ?? "") + pathUrl;
3741
- if (path) {
3742
- url = defaultPathSerializer3({ path, url });
3743
- }
3744
- let search = query ? querySerializer(query) : "";
3745
- if (search.startsWith("?")) {
3746
- search = search.substring(1);
3747
- }
3748
- if (search) {
3749
- url += `?${search}`;
3750
- }
3751
- return url;
3752
- }, "getUrl");
3753
- function getValidRequestBody3(options) {
3754
- const hasBody = options.body !== void 0;
3755
- const isSerializedBody = hasBody && options.bodySerializer;
3756
- if (isSerializedBody) {
3757
- if ("serializedBody" in options) {
3758
- const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
3759
- return hasSerializedBody ? options.serializedBody : null;
3760
- }
3761
- return options.body !== "" ? options.body : null;
3762
- }
3763
- if (hasBody) {
3764
- return options.body;
3765
- }
3766
- return void 0;
3767
- }
3768
- __name(getValidRequestBody3, "getValidRequestBody");
3769
-
3770
- // src/_api/generated/cfg_totp/core/auth.gen.ts
3771
- var getAuthToken3 = /* @__PURE__ */ __name(async (auth, callback) => {
3772
- const token = typeof callback === "function" ? await callback(auth) : callback;
3773
- if (!token) {
3774
- return;
3775
- }
3776
- if (auth.scheme === "bearer") {
3777
- return `Bearer ${token}`;
3778
- }
3779
- if (auth.scheme === "basic") {
3780
- return `Basic ${btoa(token)}`;
3781
- }
3782
- return token;
3783
- }, "getAuthToken");
3784
-
3785
- // src/_api/generated/cfg_totp/client/utils.gen.ts
3786
- var createQuerySerializer3 = /* @__PURE__ */ __name(({
3787
- parameters = {},
3788
- ...args
3789
- } = {}) => {
3790
- const querySerializer = /* @__PURE__ */ __name((queryParams) => {
3791
- const search = [];
3792
- if (queryParams && typeof queryParams === "object") {
3793
- for (const name in queryParams) {
3794
- const value = queryParams[name];
3795
- if (value === void 0 || value === null) {
3796
- continue;
3797
- }
3798
- const options = parameters[name] || args;
3799
- if (Array.isArray(value)) {
3800
- const serializedArray = serializeArrayParam3({
3801
- allowReserved: options.allowReserved,
3802
- explode: true,
3803
- name,
3804
- style: "form",
3805
- value,
3806
- ...options.array
3807
- });
3808
- if (serializedArray) search.push(serializedArray);
3809
- } else if (typeof value === "object") {
3810
- const serializedObject = serializeObjectParam3({
3811
- allowReserved: options.allowReserved,
3812
- explode: true,
3813
- name,
3814
- style: "deepObject",
3815
- value,
3816
- ...options.object
3817
- });
3818
- if (serializedObject) search.push(serializedObject);
3819
- } else {
3820
- const serializedPrimitive = serializePrimitiveParam3({
3821
- allowReserved: options.allowReserved,
3822
- name,
3823
- value
3824
- });
3825
- if (serializedPrimitive) search.push(serializedPrimitive);
3826
- }
3827
- }
3828
- }
3829
- return search.join("&");
3830
- }, "querySerializer");
3831
- return querySerializer;
3832
- }, "createQuerySerializer");
3833
- var getParseAs3 = /* @__PURE__ */ __name((contentType) => {
3834
- if (!contentType) {
3835
- return "stream";
3836
- }
3837
- const cleanContent = contentType.split(";")[0]?.trim();
3838
- if (!cleanContent) {
3839
- return;
3840
- }
3841
- if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
3842
- return "json";
3843
- }
3844
- if (cleanContent === "multipart/form-data") {
3845
- return "formData";
3846
- }
3847
- if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
3848
- return "blob";
3849
- }
3850
- if (cleanContent.startsWith("text/")) {
3851
- return "text";
3852
- }
3853
- return;
3854
- }, "getParseAs");
3855
- var checkForExistence3 = /* @__PURE__ */ __name((options, name) => {
3856
- if (!name) {
3857
- return false;
3858
- }
3859
- if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
3860
- return true;
3861
- }
3862
- return false;
3863
- }, "checkForExistence");
3864
- var setAuthParams3 = /* @__PURE__ */ __name(async ({
3865
- security,
3866
- ...options
3867
- }) => {
3868
- for (const auth of security) {
3869
- if (checkForExistence3(options, auth.name)) {
3870
- continue;
3871
- }
3872
- const token = await getAuthToken3(auth, options.auth);
3873
- if (!token) {
3874
- continue;
3875
- }
3876
- const name = auth.name ?? "Authorization";
3877
- switch (auth.in) {
3878
- case "query":
3879
- if (!options.query) {
3880
- options.query = {};
3881
- }
3882
- options.query[name] = token;
3883
- break;
3884
- case "cookie":
3885
- options.headers.append("Cookie", `${name}=${token}`);
3886
- break;
3887
- case "header":
3888
- default:
3889
- options.headers.set(name, token);
3890
- break;
3891
- }
3892
- }
3893
- }, "setAuthParams");
3894
- var buildUrl3 = /* @__PURE__ */ __name((options) => getUrl3({
3895
- baseUrl: options.baseUrl,
3896
- path: options.path,
3897
- query: options.query,
3898
- querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer3(options.querySerializer),
3899
- url: options.url
3900
- }), "buildUrl");
3901
- var mergeConfigs3 = /* @__PURE__ */ __name((a, b) => {
3902
- const config = { ...a, ...b };
3903
- if (config.baseUrl?.endsWith("/")) {
3904
- config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
3905
- }
3906
- config.headers = mergeHeaders3(a.headers, b.headers);
3907
- return config;
3908
- }, "mergeConfigs");
3909
- var headersEntries3 = /* @__PURE__ */ __name((headers) => {
3910
- const entries = [];
3911
- headers.forEach((value, key) => {
3912
- entries.push([key, value]);
3913
- });
3914
- return entries;
3915
- }, "headersEntries");
3916
- var mergeHeaders3 = /* @__PURE__ */ __name((...headers) => {
3917
- const mergedHeaders = new Headers();
3918
- for (const header of headers) {
3919
- if (!header) {
3920
- continue;
3921
- }
3922
- const iterator = header instanceof Headers ? headersEntries3(header) : Object.entries(header);
3923
- for (const [key, value] of iterator) {
3924
- if (value === null) {
3925
- mergedHeaders.delete(key);
3926
- } else if (Array.isArray(value)) {
3927
- for (const v of value) {
3928
- mergedHeaders.append(key, v);
3929
- }
3930
- } else if (value !== void 0) {
3931
- mergedHeaders.set(
3932
- key,
3933
- typeof value === "object" ? JSON.stringify(value) : value
3934
- );
3935
- }
3936
- }
3937
- }
3938
- return mergedHeaders;
3939
- }, "mergeHeaders");
3940
- var Interceptors3 = class {
3941
- static {
3942
- __name(this, "Interceptors");
3943
- }
3944
- fns = [];
3945
- clear() {
3946
- this.fns = [];
3947
- }
3948
- eject(id) {
3949
- const index = this.getInterceptorIndex(id);
3950
- if (this.fns[index]) {
3951
- this.fns[index] = null;
3952
- }
3953
- }
3954
- exists(id) {
3955
- const index = this.getInterceptorIndex(id);
3956
- return Boolean(this.fns[index]);
3957
- }
3958
- getInterceptorIndex(id) {
3959
- if (typeof id === "number") {
3960
- return this.fns[id] ? id : -1;
3961
- }
3962
- return this.fns.indexOf(id);
3963
- }
3964
- update(id, fn) {
3965
- const index = this.getInterceptorIndex(id);
3966
- if (this.fns[index]) {
3967
- this.fns[index] = fn;
3968
- return id;
3969
- }
3970
- return false;
3971
- }
3972
- use(fn) {
3973
- this.fns.push(fn);
3974
- return this.fns.length - 1;
3975
- }
3976
- };
3977
- var createInterceptors3 = /* @__PURE__ */ __name(() => ({
3978
- error: new Interceptors3(),
3979
- request: new Interceptors3(),
3980
- response: new Interceptors3()
3981
- }), "createInterceptors");
3982
- var defaultQuerySerializer3 = createQuerySerializer3({
3983
- allowReserved: false,
3984
- array: {
3985
- explode: true,
3986
- style: "form"
3987
- },
3988
- object: {
3989
- explode: true,
3990
- style: "deepObject"
3991
- }
3992
- });
3993
- var defaultHeaders3 = {
3994
- "Content-Type": "application/json"
3995
- };
3996
- var createConfig3 = /* @__PURE__ */ __name((override = {}) => ({
3997
- ...jsonBodySerializer3,
3998
- headers: defaultHeaders3,
3999
- parseAs: "auto",
4000
- querySerializer: defaultQuerySerializer3,
4001
- ...override
4002
- }), "createConfig");
4003
-
4004
- // src/_api/generated/cfg_totp/client/client.gen.ts
4005
- var createClient3 = /* @__PURE__ */ __name((config = {}) => {
4006
- let _config = mergeConfigs3(createConfig3(), config);
4007
- const getConfig = /* @__PURE__ */ __name(() => ({ ..._config }), "getConfig");
4008
- const setConfig = /* @__PURE__ */ __name((config2) => {
4009
- _config = mergeConfigs3(_config, config2);
4010
- return getConfig();
4011
- }, "setConfig");
4012
- const interceptors = createInterceptors3();
4013
- const beforeRequest = /* @__PURE__ */ __name(async (options) => {
4014
- const opts = {
4015
- ..._config,
4016
- ...options,
4017
- fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
4018
- headers: mergeHeaders3(_config.headers, options.headers),
4019
- serializedBody: void 0
4020
- };
4021
- if (opts.security) {
4022
- await setAuthParams3({
4023
- ...opts,
4024
- security: opts.security
4025
- });
4026
- }
4027
- if (opts.requestValidator) {
4028
- await opts.requestValidator(opts);
4029
- }
4030
- if (opts.body !== void 0 && opts.bodySerializer) {
4031
- opts.serializedBody = opts.bodySerializer(opts.body);
4032
- }
4033
- if (opts.body === void 0 || opts.serializedBody === "") {
4034
- opts.headers.delete("Content-Type");
4035
- }
4036
- const resolvedOpts = opts;
4037
- const url = buildUrl3(resolvedOpts);
4038
- return { opts: resolvedOpts, url };
4039
- }, "beforeRequest");
4040
- const request = /* @__PURE__ */ __name(async (options) => {
4041
- const throwOnError = options.throwOnError ?? _config.throwOnError;
4042
- const responseStyle = options.responseStyle ?? _config.responseStyle;
4043
- let request2;
4044
- let response;
4045
- try {
4046
- const { opts, url } = await beforeRequest(options);
4047
- const requestInit = {
4048
- redirect: "follow",
4049
- ...opts,
4050
- body: getValidRequestBody3(opts)
4051
- };
4052
- request2 = new Request(url, requestInit);
4053
- for (const fn of interceptors.request.fns) {
4054
- if (fn) {
4055
- request2 = await fn(request2, opts);
4056
- }
4057
- }
4058
- const _fetch = opts.fetch;
4059
- response = await _fetch(request2);
4060
- for (const fn of interceptors.response.fns) {
4061
- if (fn) {
4062
- response = await fn(response, request2, opts);
4063
- }
4064
- }
4065
- const result = {
4066
- request: request2,
4067
- response
4068
- };
4069
- if (response.ok) {
4070
- const parseAs = (opts.parseAs === "auto" ? getParseAs3(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
4071
- if (response.status === 204 || response.headers.get("Content-Length") === "0") {
4072
- let emptyData;
4073
- switch (parseAs) {
4074
- case "arrayBuffer":
4075
- case "blob":
4076
- case "text":
4077
- emptyData = await response[parseAs]();
4078
- break;
4079
- case "formData":
4080
- emptyData = new FormData();
4081
- break;
4082
- case "stream":
4083
- emptyData = response.body;
4084
- break;
4085
- case "json":
4086
- default:
4087
- emptyData = {};
4088
- break;
4089
- }
4090
- return opts.responseStyle === "data" ? emptyData : {
4091
- data: emptyData,
4092
- ...result
4093
- };
4094
- }
4095
- let data;
4096
- switch (parseAs) {
4097
- case "arrayBuffer":
4098
- case "blob":
4099
- case "formData":
4100
- case "text":
4101
- data = await response[parseAs]();
4102
- break;
4103
- case "json": {
4104
- const text = await response.text();
4105
- data = text ? JSON.parse(text) : {};
4106
- break;
4107
- }
4108
- case "stream":
4109
- return opts.responseStyle === "data" ? response.body : {
4110
- data: response.body,
4111
- ...result
4112
- };
4113
- }
4114
- if (parseAs === "json") {
4115
- if (opts.responseValidator) {
4116
- await opts.responseValidator(data);
4117
- }
4118
- if (opts.responseTransformer) {
4119
- data = await opts.responseTransformer(data);
4120
- }
4121
- }
4122
- return opts.responseStyle === "data" ? data : {
4123
- data,
4124
- ...result
4125
- };
4126
- }
4127
- const textError = await response.text();
4128
- let jsonError;
4129
- try {
4130
- jsonError = JSON.parse(textError);
4131
- } catch {
4132
- }
4133
- throw jsonError ?? textError;
4134
- } catch (error) {
4135
- let finalError = error;
4136
- for (const fn of interceptors.error.fns) {
4137
- if (fn) {
4138
- finalError = await fn(finalError, response, request2, options);
4139
- }
4140
- }
4141
- finalError = finalError || {};
4142
- if (throwOnError) {
4143
- throw finalError;
4144
- }
4145
- return responseStyle === "data" ? void 0 : {
4146
- error: finalError,
4147
- request: request2,
4148
- response
4149
- };
4150
- }
4151
- }, "request");
4152
- const makeMethodFn = /* @__PURE__ */ __name((method) => (options) => request({ ...options, method }), "makeMethodFn");
4153
- const makeSseFn = /* @__PURE__ */ __name((method) => async (options) => {
4154
- const { opts, url } = await beforeRequest(options);
4155
- return createSseClient3({
4156
- ...opts,
4157
- body: opts.body,
4158
- method,
4159
- onRequest: /* @__PURE__ */ __name(async (url2, init) => {
4160
- let request2 = new Request(url2, init);
4161
- for (const fn of interceptors.request.fns) {
4162
- if (fn) {
4163
- request2 = await fn(request2, opts);
4164
- }
4165
- }
4166
- return request2;
4167
- }, "onRequest"),
4168
- serializedBody: getValidRequestBody3(opts),
4169
- url
4170
- });
4171
- }, "makeSseFn");
4172
- const _buildUrl = /* @__PURE__ */ __name((options) => buildUrl3({ ..._config, ...options }), "_buildUrl");
4173
- return {
4174
- buildUrl: _buildUrl,
4175
- connect: makeMethodFn("CONNECT"),
4176
- delete: makeMethodFn("DELETE"),
4177
- get: makeMethodFn("GET"),
4178
- getConfig,
4179
- head: makeMethodFn("HEAD"),
4180
- interceptors,
4181
- options: makeMethodFn("OPTIONS"),
4182
- patch: makeMethodFn("PATCH"),
4183
- post: makeMethodFn("POST"),
4184
- put: makeMethodFn("PUT"),
4185
- request,
4186
- setConfig,
4187
- sse: {
4188
- connect: makeSseFn("CONNECT"),
4189
- delete: makeSseFn("DELETE"),
4190
- get: makeSseFn("GET"),
4191
- head: makeSseFn("HEAD"),
4192
- options: makeSseFn("OPTIONS"),
4193
- patch: makeSseFn("PATCH"),
4194
- post: makeSseFn("POST"),
4195
- put: makeSseFn("PUT"),
4196
- trace: makeSseFn("TRACE")
4197
- },
4198
- trace: makeMethodFn("TRACE")
4199
- };
4200
- }, "createClient");
4201
-
4202
- // src/_api/generated/cfg_totp/client.gen.ts
4203
- var client3 = createClient3(createConfig3({ baseUrl: "http://localhost:8000" }));
4204
-
4205
- // src/_api/generated/cfg_totp/sdk.gen.ts
4206
- var Cfg3 = class {
4207
- static {
4208
- __name(this, "Cfg");
1656
+ ...options,
1657
+ headers: {
1658
+ "Content-Type": "application/json",
1659
+ ...options.headers
1660
+ }
1661
+ });
4209
1662
  }
4210
1663
  /**
4211
- * Get backup codes status for user.
1664
+ * List OAuth providers
1665
+ *
1666
+ * Get list of available OAuth providers for authentication.
4212
1667
  */
4213
- static cfgTotpBackupCodesRetrieve(options) {
4214
- return (options?.client ?? client3).get({
1668
+ static cfgAccountsOauthProvidersRetrieve(options) {
1669
+ return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
1670
+ }
1671
+ /**
1672
+ * Request OTP code to email.
1673
+ */
1674
+ static cfgAccountsOtpRequestCreate(options) {
1675
+ return (options.client ?? client).post({
4215
1676
  security: [{ scheme: "bearer", type: "http" }],
4216
- url: "/cfg/totp/backup-codes/",
4217
- ...options
1677
+ url: "/cfg/accounts/otp/request/",
1678
+ ...options,
1679
+ headers: {
1680
+ "Content-Type": "application/json",
1681
+ ...options.headers
1682
+ }
4218
1683
  });
4219
1684
  }
4220
1685
  /**
4221
- * Regenerate backup codes.
1686
+ * Verify OTP code and return JWT tokens or 2FA session.
4222
1687
  *
4223
- * Requires TOTP code for verification.
4224
- * Invalidates all existing codes.
1688
+ * If user has 2FA enabled:
1689
+ * - Returns requires_2fa=True with session_id
1690
+ * - Client must complete 2FA verification at /cfg/totp/verify/
1691
+ *
1692
+ * If user has no 2FA:
1693
+ * - Returns JWT tokens and user data directly
4225
1694
  */
4226
- static cfgTotpBackupCodesRegenerateCreate(options) {
4227
- return (options.client ?? client3).post({
1695
+ static cfgAccountsOtpVerifyCreate(options) {
1696
+ return (options.client ?? client).post({
4228
1697
  security: [{ scheme: "bearer", type: "http" }],
4229
- url: "/cfg/totp/backup-codes/regenerate/",
1698
+ url: "/cfg/accounts/otp/verify/",
4230
1699
  ...options,
4231
1700
  headers: {
4232
1701
  "Content-Type": "application/json",
@@ -4235,52 +1704,97 @@ var Cfg3 = class {
4235
1704
  });
4236
1705
  }
4237
1706
  /**
4238
- * List all TOTP devices for user.
1707
+ * Get current user profile
1708
+ *
1709
+ * Retrieve the current authenticated user's profile information.
4239
1710
  */
4240
- static cfgTotpDevicesRetrieve(options) {
4241
- return (options?.client ?? client3).get({
4242
- security: [{ scheme: "bearer", type: "http" }],
4243
- url: "/cfg/totp/devices/",
1711
+ static cfgAccountsProfileRetrieve(options) {
1712
+ return (options?.client ?? client).get({
1713
+ security: [{ scheme: "bearer", type: "http" }, {
1714
+ in: "cookie",
1715
+ name: "sessionid",
1716
+ type: "apiKey"
1717
+ }],
1718
+ url: "/cfg/accounts/profile/",
4244
1719
  ...options
4245
1720
  });
4246
1721
  }
4247
1722
  /**
4248
- * Delete a TOTP device.
1723
+ * Upload user avatar
4249
1724
  *
4250
- * Requires verification code if removing the last/primary device.
1725
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
4251
1726
  */
4252
- static cfgTotpDevicesDestroy(options) {
4253
- return (options.client ?? client3).delete({
1727
+ static cfgAccountsProfileAvatarCreate(options) {
1728
+ return (options?.client ?? client).post({
1729
+ ...formDataBodySerializer,
4254
1730
  security: [{ scheme: "bearer", type: "http" }],
4255
- url: "/cfg/totp/devices/{id}/",
1731
+ url: "/cfg/accounts/profile/avatar/",
1732
+ ...options,
1733
+ headers: {
1734
+ "Content-Type": null,
1735
+ ...options?.headers
1736
+ }
1737
+ });
1738
+ }
1739
+ /**
1740
+ * Delete user account
1741
+ *
1742
+ *
1743
+ * Permanently delete the current user's account.
1744
+ *
1745
+ * This operation:
1746
+ * - Deactivates the account (user cannot log in)
1747
+ * - Anonymizes personal data (GDPR compliance)
1748
+ * - Frees up the email address for re-registration
1749
+ * - Preserves audit trail
1750
+ *
1751
+ * The account can be restored by an administrator if needed.
1752
+ *
1753
+ */
1754
+ static cfgAccountsProfileDeleteCreate(options) {
1755
+ return (options?.client ?? client).post({
1756
+ security: [{ scheme: "bearer", type: "http" }, {
1757
+ in: "cookie",
1758
+ name: "sessionid",
1759
+ type: "apiKey"
1760
+ }],
1761
+ url: "/cfg/accounts/profile/delete/",
4256
1762
  ...options
4257
1763
  });
4258
1764
  }
4259
1765
  /**
4260
- * Completely disable 2FA for account.
1766
+ * Partial update user profile
4261
1767
  *
4262
- * Requires verification code.
1768
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
4263
1769
  */
4264
- static cfgTotpDisableCreate(options) {
4265
- return (options.client ?? client3).post({
4266
- security: [{ scheme: "bearer", type: "http" }],
4267
- url: "/cfg/totp/disable/",
1770
+ static cfgAccountsProfilePartialPartialUpdate(options) {
1771
+ return (options?.client ?? client).patch({
1772
+ security: [{ scheme: "bearer", type: "http" }, {
1773
+ in: "cookie",
1774
+ name: "sessionid",
1775
+ type: "apiKey"
1776
+ }],
1777
+ url: "/cfg/accounts/profile/partial/",
4268
1778
  ...options,
4269
1779
  headers: {
4270
1780
  "Content-Type": "application/json",
4271
- ...options.headers
1781
+ ...options?.headers
4272
1782
  }
4273
1783
  });
4274
1784
  }
4275
1785
  /**
4276
- * Start 2FA setup process.
1786
+ * Partial update user profile
4277
1787
  *
4278
- * Creates a new TOTP device and returns QR code for scanning.
1788
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
4279
1789
  */
4280
- static cfgTotpSetupCreate(options) {
4281
- return (options?.client ?? client3).post({
4282
- security: [{ scheme: "bearer", type: "http" }],
4283
- url: "/cfg/totp/setup/",
1790
+ static cfgAccountsProfilePartialUpdate(options) {
1791
+ return (options?.client ?? client).put({
1792
+ security: [{ scheme: "bearer", type: "http" }, {
1793
+ in: "cookie",
1794
+ name: "sessionid",
1795
+ type: "apiKey"
1796
+ }],
1797
+ url: "/cfg/accounts/profile/partial/",
4284
1798
  ...options,
4285
1799
  headers: {
4286
1800
  "Content-Type": "application/json",
@@ -4289,46 +1803,51 @@ var Cfg3 = class {
4289
1803
  });
4290
1804
  }
4291
1805
  /**
4292
- * Confirm 2FA setup with first valid code.
1806
+ * Update user profile
4293
1807
  *
4294
- * Activates the device and generates backup codes.
1808
+ * Update the current authenticated user's profile information.
4295
1809
  */
4296
- static cfgTotpSetupConfirmCreate(options) {
4297
- return (options.client ?? client3).post({
4298
- security: [{ scheme: "bearer", type: "http" }],
4299
- url: "/cfg/totp/setup/confirm/",
1810
+ static cfgAccountsProfileUpdatePartialUpdate(options) {
1811
+ return (options?.client ?? client).patch({
1812
+ security: [{ scheme: "bearer", type: "http" }, {
1813
+ in: "cookie",
1814
+ name: "sessionid",
1815
+ type: "apiKey"
1816
+ }],
1817
+ url: "/cfg/accounts/profile/update/",
4300
1818
  ...options,
4301
1819
  headers: {
4302
1820
  "Content-Type": "application/json",
4303
- ...options.headers
1821
+ ...options?.headers
4304
1822
  }
4305
1823
  });
4306
1824
  }
4307
1825
  /**
4308
- * Verify TOTP code for 2FA session.
1826
+ * Update user profile
4309
1827
  *
4310
- * Completes authentication and returns JWT tokens on success.
1828
+ * Update the current authenticated user's profile information.
4311
1829
  */
4312
- static cfgTotpVerifyCreate(options) {
4313
- return (options.client ?? client3).post({
4314
- security: [{ scheme: "bearer", type: "http" }],
4315
- url: "/cfg/totp/verify/",
1830
+ static cfgAccountsProfileUpdateUpdate(options) {
1831
+ return (options?.client ?? client).put({
1832
+ security: [{ scheme: "bearer", type: "http" }, {
1833
+ in: "cookie",
1834
+ name: "sessionid",
1835
+ type: "apiKey"
1836
+ }],
1837
+ url: "/cfg/accounts/profile/update/",
4316
1838
  ...options,
4317
1839
  headers: {
4318
1840
  "Content-Type": "application/json",
4319
- ...options.headers
1841
+ ...options?.headers
4320
1842
  }
4321
1843
  });
4322
1844
  }
4323
1845
  /**
4324
- * Verify backup recovery code for 2FA session.
4325
- *
4326
- * Alternative verification method when TOTP device unavailable.
1846
+ * Refresh JWT token.
4327
1847
  */
4328
- static cfgTotpVerifyBackupCreate(options) {
4329
- return (options.client ?? client3).post({
4330
- security: [{ scheme: "bearer", type: "http" }],
4331
- url: "/cfg/totp/verify/backup/",
1848
+ static cfgAccountsTokenRefreshCreate(options) {
1849
+ return (options.client ?? client).post({
1850
+ url: "/cfg/accounts/token/refresh/",
4332
1851
  ...options,
4333
1852
  headers: {
4334
1853
  "Content-Type": "application/json",
@@ -4336,16 +1855,23 @@ var Cfg3 = class {
4336
1855
  }
4337
1856
  });
4338
1857
  }
4339
- };
4340
- var Totp = class {
4341
- static {
4342
- __name(this, "Totp");
1858
+ /**
1859
+ * Get Centrifugo connection token
1860
+ *
1861
+ * Generate JWT token for WebSocket connection to Centrifugo. Token includes user's allowed channels based on their permissions. Requires authentication.
1862
+ */
1863
+ static cfgCentrifugoAuthTokenRetrieve(options) {
1864
+ return (options?.client ?? client).get({
1865
+ security: [{ scheme: "bearer", type: "http" }],
1866
+ url: "/cfg/centrifugo/auth/token/",
1867
+ ...options
1868
+ });
4343
1869
  }
4344
1870
  /**
4345
1871
  * Get backup codes status for user.
4346
1872
  */
4347
1873
  static cfgTotpBackupCodesRetrieve(options) {
4348
- return (options?.client ?? client3).get({
1874
+ return (options?.client ?? client).get({
4349
1875
  security: [{ scheme: "bearer", type: "http" }],
4350
1876
  url: "/cfg/totp/backup-codes/",
4351
1877
  ...options
@@ -4358,7 +1884,7 @@ var Totp = class {
4358
1884
  * Invalidates all existing codes.
4359
1885
  */
4360
1886
  static cfgTotpBackupCodesRegenerateCreate(options) {
4361
- return (options.client ?? client3).post({
1887
+ return (options.client ?? client).post({
4362
1888
  security: [{ scheme: "bearer", type: "http" }],
4363
1889
  url: "/cfg/totp/backup-codes/regenerate/",
4364
1890
  ...options,
@@ -4372,7 +1898,7 @@ var Totp = class {
4372
1898
  * List all TOTP devices for user.
4373
1899
  */
4374
1900
  static cfgTotpDevicesRetrieve(options) {
4375
- return (options?.client ?? client3).get({
1901
+ return (options?.client ?? client).get({
4376
1902
  security: [{ scheme: "bearer", type: "http" }],
4377
1903
  url: "/cfg/totp/devices/",
4378
1904
  ...options
@@ -4384,7 +1910,7 @@ var Totp = class {
4384
1910
  * Requires verification code if removing the last/primary device.
4385
1911
  */
4386
1912
  static cfgTotpDevicesDestroy(options) {
4387
- return (options.client ?? client3).delete({
1913
+ return (options.client ?? client).delete({
4388
1914
  security: [{ scheme: "bearer", type: "http" }],
4389
1915
  url: "/cfg/totp/devices/{id}/",
4390
1916
  ...options
@@ -4396,7 +1922,7 @@ var Totp = class {
4396
1922
  * Requires verification code.
4397
1923
  */
4398
1924
  static cfgTotpDisableCreate(options) {
4399
- return (options.client ?? client3).post({
1925
+ return (options.client ?? client).post({
4400
1926
  security: [{ scheme: "bearer", type: "http" }],
4401
1927
  url: "/cfg/totp/disable/",
4402
1928
  ...options,
@@ -4412,7 +1938,7 @@ var Totp = class {
4412
1938
  * Creates a new TOTP device and returns QR code for scanning.
4413
1939
  */
4414
1940
  static cfgTotpSetupCreate(options) {
4415
- return (options?.client ?? client3).post({
1941
+ return (options?.client ?? client).post({
4416
1942
  security: [{ scheme: "bearer", type: "http" }],
4417
1943
  url: "/cfg/totp/setup/",
4418
1944
  ...options,
@@ -4428,7 +1954,7 @@ var Totp = class {
4428
1954
  * Activates the device and generates backup codes.
4429
1955
  */
4430
1956
  static cfgTotpSetupConfirmCreate(options) {
4431
- return (options.client ?? client3).post({
1957
+ return (options.client ?? client).post({
4432
1958
  security: [{ scheme: "bearer", type: "http" }],
4433
1959
  url: "/cfg/totp/setup/confirm/",
4434
1960
  ...options,
@@ -4444,7 +1970,7 @@ var Totp = class {
4444
1970
  * Completes authentication and returns JWT tokens on success.
4445
1971
  */
4446
1972
  static cfgTotpVerifyCreate(options) {
4447
- return (options.client ?? client3).post({
1973
+ return (options.client ?? client).post({
4448
1974
  security: [{ scheme: "bearer", type: "http" }],
4449
1975
  url: "/cfg/totp/verify/",
4450
1976
  ...options,
@@ -4460,7 +1986,7 @@ var Totp = class {
4460
1986
  * Alternative verification method when TOTP device unavailable.
4461
1987
  */
4462
1988
  static cfgTotpVerifyBackupCreate(options) {
4463
- return (options.client ?? client3).post({
1989
+ return (options.client ?? client).post({
4464
1990
  security: [{ scheme: "bearer", type: "http" }],
4465
1991
  url: "/cfg/totp/verify/backup/",
4466
1992
  ...options,
@@ -4471,82 +1997,173 @@ var Totp = class {
4471
1997
  });
4472
1998
  }
4473
1999
  };
4474
- var BackupCodes = class {
2000
+ var OAuth = class {
2001
+ static {
2002
+ __name(this, "OAuth");
2003
+ }
2004
+ /**
2005
+ * List OAuth connections
2006
+ *
2007
+ * Get all OAuth connections for the current user.
2008
+ */
2009
+ static cfgAccountsOauthConnectionsList(options) {
2010
+ return (options?.client ?? client).get({
2011
+ security: [{ scheme: "bearer", type: "http" }],
2012
+ url: "/cfg/accounts/oauth/connections/",
2013
+ ...options
2014
+ });
2015
+ }
2016
+ /**
2017
+ * Disconnect OAuth provider
2018
+ *
2019
+ * Remove OAuth connection for the specified provider.
2020
+ */
2021
+ static cfgAccountsOauthDisconnectCreate(options) {
2022
+ return (options.client ?? client).post({
2023
+ security: [{ scheme: "bearer", type: "http" }],
2024
+ url: "/cfg/accounts/oauth/disconnect/",
2025
+ ...options,
2026
+ headers: {
2027
+ "Content-Type": "application/json",
2028
+ ...options.headers
2029
+ }
2030
+ });
2031
+ }
2032
+ /**
2033
+ * Start GitHub OAuth
2034
+ *
2035
+ * Generate GitHub OAuth authorization URL. Redirect user to this URL to start authentication.
2036
+ */
2037
+ static cfgAccountsOauthGithubAuthorizeCreate(options) {
2038
+ return (options?.client ?? client).post({
2039
+ url: "/cfg/accounts/oauth/github/authorize/",
2040
+ ...options,
2041
+ headers: {
2042
+ "Content-Type": "application/json",
2043
+ ...options?.headers
2044
+ }
2045
+ });
2046
+ }
2047
+ /**
2048
+ * Complete GitHub OAuth
2049
+ *
2050
+ * Exchange authorization code for JWT tokens. Call this after GitHub redirects back with code.
2051
+ */
2052
+ static cfgAccountsOauthGithubCallbackCreate(options) {
2053
+ return (options.client ?? client).post({
2054
+ url: "/cfg/accounts/oauth/github/callback/",
2055
+ ...options,
2056
+ headers: {
2057
+ "Content-Type": "application/json",
2058
+ ...options.headers
2059
+ }
2060
+ });
2061
+ }
2062
+ /**
2063
+ * List OAuth providers
2064
+ *
2065
+ * Get list of available OAuth providers for authentication.
2066
+ */
2067
+ static cfgAccountsOauthProvidersRetrieve(options) {
2068
+ return (options?.client ?? client).get({ url: "/cfg/accounts/oauth/providers/", ...options });
2069
+ }
2070
+ };
2071
+ var UserProfile = class {
4475
2072
  static {
4476
- __name(this, "BackupCodes");
2073
+ __name(this, "UserProfile");
4477
2074
  }
4478
2075
  /**
4479
- * Get backup codes status for user.
2076
+ * Get current user profile
2077
+ *
2078
+ * Retrieve the current authenticated user's profile information.
4480
2079
  */
4481
- static cfgTotpBackupCodesRetrieve(options) {
4482
- return (options?.client ?? client3).get({
4483
- security: [{ scheme: "bearer", type: "http" }],
4484
- url: "/cfg/totp/backup-codes/",
2080
+ static cfgAccountsProfileRetrieve(options) {
2081
+ return (options?.client ?? client).get({
2082
+ security: [{ scheme: "bearer", type: "http" }, {
2083
+ in: "cookie",
2084
+ name: "sessionid",
2085
+ type: "apiKey"
2086
+ }],
2087
+ url: "/cfg/accounts/profile/",
4485
2088
  ...options
4486
2089
  });
4487
2090
  }
4488
2091
  /**
4489
- * Regenerate backup codes.
2092
+ * Upload user avatar
4490
2093
  *
4491
- * Requires TOTP code for verification.
4492
- * Invalidates all existing codes.
2094
+ * Upload avatar image for the current authenticated user. Accepts multipart/form-data with 'avatar' field.
4493
2095
  */
4494
- static cfgTotpBackupCodesRegenerateCreate(options) {
4495
- return (options.client ?? client3).post({
2096
+ static cfgAccountsProfileAvatarCreate(options) {
2097
+ return (options?.client ?? client).post({
2098
+ ...formDataBodySerializer,
4496
2099
  security: [{ scheme: "bearer", type: "http" }],
4497
- url: "/cfg/totp/backup-codes/regenerate/",
2100
+ url: "/cfg/accounts/profile/avatar/",
4498
2101
  ...options,
4499
2102
  headers: {
4500
- "Content-Type": "application/json",
4501
- ...options.headers
2103
+ "Content-Type": null,
2104
+ ...options?.headers
4502
2105
  }
4503
2106
  });
4504
2107
  }
4505
- };
4506
- var TotpManagement = class {
4507
- static {
4508
- __name(this, "TotpManagement");
4509
- }
4510
2108
  /**
4511
- * List all TOTP devices for user.
2109
+ * Delete user account
2110
+ *
2111
+ *
2112
+ * Permanently delete the current user's account.
2113
+ *
2114
+ * This operation:
2115
+ * - Deactivates the account (user cannot log in)
2116
+ * - Anonymizes personal data (GDPR compliance)
2117
+ * - Frees up the email address for re-registration
2118
+ * - Preserves audit trail
2119
+ *
2120
+ * The account can be restored by an administrator if needed.
2121
+ *
4512
2122
  */
4513
- static cfgTotpDevicesRetrieve(options) {
4514
- return (options?.client ?? client3).get({
4515
- security: [{ scheme: "bearer", type: "http" }],
4516
- url: "/cfg/totp/devices/",
2123
+ static cfgAccountsProfileDeleteCreate(options) {
2124
+ return (options?.client ?? client).post({
2125
+ security: [{ scheme: "bearer", type: "http" }, {
2126
+ in: "cookie",
2127
+ name: "sessionid",
2128
+ type: "apiKey"
2129
+ }],
2130
+ url: "/cfg/accounts/profile/delete/",
4517
2131
  ...options
4518
2132
  });
4519
2133
  }
4520
2134
  /**
4521
- * Completely disable 2FA for account.
2135
+ * Partial update user profile
4522
2136
  *
4523
- * Requires verification code.
2137
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
4524
2138
  */
4525
- static cfgTotpDisableCreate(options) {
4526
- return (options.client ?? client3).post({
4527
- security: [{ scheme: "bearer", type: "http" }],
4528
- url: "/cfg/totp/disable/",
2139
+ static cfgAccountsProfilePartialPartialUpdate(options) {
2140
+ return (options?.client ?? client).patch({
2141
+ security: [{ scheme: "bearer", type: "http" }, {
2142
+ in: "cookie",
2143
+ name: "sessionid",
2144
+ type: "apiKey"
2145
+ }],
2146
+ url: "/cfg/accounts/profile/partial/",
4529
2147
  ...options,
4530
2148
  headers: {
4531
2149
  "Content-Type": "application/json",
4532
- ...options.headers
2150
+ ...options?.headers
4533
2151
  }
4534
2152
  });
4535
2153
  }
4536
- };
4537
- var TotpSetup = class {
4538
- static {
4539
- __name(this, "TotpSetup");
4540
- }
4541
2154
  /**
4542
- * Start 2FA setup process.
2155
+ * Partial update user profile
4543
2156
  *
4544
- * Creates a new TOTP device and returns QR code for scanning.
2157
+ * Partially update the current authenticated user's profile information. Supports avatar upload.
4545
2158
  */
4546
- static cfgTotpSetupCreate(options) {
4547
- return (options?.client ?? client3).post({
4548
- security: [{ scheme: "bearer", type: "http" }],
4549
- url: "/cfg/totp/setup/",
2159
+ static cfgAccountsProfilePartialUpdate(options) {
2160
+ return (options?.client ?? client).put({
2161
+ security: [{ scheme: "bearer", type: "http" }, {
2162
+ in: "cookie",
2163
+ name: "sessionid",
2164
+ type: "apiKey"
2165
+ }],
2166
+ url: "/cfg/accounts/profile/partial/",
4550
2167
  ...options,
4551
2168
  headers: {
4552
2169
  "Content-Type": "application/json",
@@ -4555,51 +2172,56 @@ var TotpSetup = class {
4555
2172
  });
4556
2173
  }
4557
2174
  /**
4558
- * Confirm 2FA setup with first valid code.
2175
+ * Update user profile
4559
2176
  *
4560
- * Activates the device and generates backup codes.
2177
+ * Update the current authenticated user's profile information.
4561
2178
  */
4562
- static cfgTotpSetupConfirmCreate(options) {
4563
- return (options.client ?? client3).post({
4564
- security: [{ scheme: "bearer", type: "http" }],
4565
- url: "/cfg/totp/setup/confirm/",
2179
+ static cfgAccountsProfileUpdatePartialUpdate(options) {
2180
+ return (options?.client ?? client).patch({
2181
+ security: [{ scheme: "bearer", type: "http" }, {
2182
+ in: "cookie",
2183
+ name: "sessionid",
2184
+ type: "apiKey"
2185
+ }],
2186
+ url: "/cfg/accounts/profile/update/",
4566
2187
  ...options,
4567
2188
  headers: {
4568
2189
  "Content-Type": "application/json",
4569
- ...options.headers
2190
+ ...options?.headers
4570
2191
  }
4571
2192
  });
4572
2193
  }
4573
- };
4574
- var TotpVerification = class {
4575
- static {
4576
- __name(this, "TotpVerification");
4577
- }
4578
2194
  /**
4579
- * Verify TOTP code for 2FA session.
2195
+ * Update user profile
4580
2196
  *
4581
- * Completes authentication and returns JWT tokens on success.
2197
+ * Update the current authenticated user's profile information.
4582
2198
  */
4583
- static cfgTotpVerifyCreate(options) {
4584
- return (options.client ?? client3).post({
4585
- security: [{ scheme: "bearer", type: "http" }],
4586
- url: "/cfg/totp/verify/",
2199
+ static cfgAccountsProfileUpdateUpdate(options) {
2200
+ return (options?.client ?? client).put({
2201
+ security: [{ scheme: "bearer", type: "http" }, {
2202
+ in: "cookie",
2203
+ name: "sessionid",
2204
+ type: "apiKey"
2205
+ }],
2206
+ url: "/cfg/accounts/profile/update/",
4587
2207
  ...options,
4588
2208
  headers: {
4589
2209
  "Content-Type": "application/json",
4590
- ...options.headers
2210
+ ...options?.headers
4591
2211
  }
4592
2212
  });
4593
2213
  }
2214
+ };
2215
+ var Auth = class {
2216
+ static {
2217
+ __name(this, "Auth");
2218
+ }
4594
2219
  /**
4595
- * Verify backup recovery code for 2FA session.
4596
- *
4597
- * Alternative verification method when TOTP device unavailable.
2220
+ * Refresh JWT token.
4598
2221
  */
4599
- static cfgTotpVerifyBackupCreate(options) {
4600
- return (options.client ?? client3).post({
4601
- security: [{ scheme: "bearer", type: "http" }],
4602
- url: "/cfg/totp/verify/backup/",
2222
+ static cfgAccountsTokenRefreshCreate(options) {
2223
+ return (options.client ?? client).post({
2224
+ url: "/cfg/accounts/token/refresh/",
4603
2225
  ...options,
4604
2226
  headers: {
4605
2227
  "Content-Type": "application/json",
@@ -4608,276 +2230,112 @@ var TotpVerification = class {
4608
2230
  });
4609
2231
  }
4610
2232
  };
4611
-
4612
- // src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateRequest.ts
4613
- var import_zod23 = require("zod");
4614
- var BackupCodesRegenerateRequestSchema = import_zod23.z.object({
4615
- code: import_zod23.z.string().min(6).max(6)
4616
- });
4617
-
4618
- // src/_api/generated/cfg_totp/schemas/BackupCodesRegenerateResponse.ts
4619
- var import_zod24 = require("zod");
4620
- var BackupCodesRegenerateResponseSchema = import_zod24.z.object({
4621
- backup_codes: import_zod24.z.array(import_zod24.z.string()),
4622
- warning: import_zod24.z.string()
4623
- });
4624
-
4625
- // src/_api/generated/cfg_totp/schemas/BackupCodesStatus.ts
4626
- var import_zod25 = require("zod");
4627
- var BackupCodesStatusSchema = import_zod25.z.object({
4628
- remaining_count: import_zod25.z.number().int(),
4629
- total_generated: import_zod25.z.number().int(),
4630
- warning: import_zod25.z.string().nullable().optional()
4631
- });
4632
-
4633
- // src/_api/generated/cfg_totp/schemas/ConfirmSetupRequest.ts
4634
- var import_zod26 = require("zod");
4635
- var ConfirmSetupRequestSchema = import_zod26.z.object({
4636
- device_id: import_zod26.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4637
- code: import_zod26.z.string().min(6).max(6)
4638
- });
4639
-
4640
- // src/_api/generated/cfg_totp/schemas/ConfirmSetupResponse.ts
4641
- var import_zod27 = require("zod");
4642
- var ConfirmSetupResponseSchema = import_zod27.z.object({
4643
- message: import_zod27.z.string(),
4644
- backup_codes: import_zod27.z.array(import_zod27.z.string()),
4645
- backup_codes_warning: import_zod27.z.string()
4646
- });
4647
-
4648
- // src/_api/generated/cfg_totp/schemas/DeviceList.ts
4649
- var import_zod29 = require("zod");
4650
-
4651
- // src/_api/generated/cfg_totp/schemas/DeviceListStatusEnum.ts
4652
- var import_zod28 = require("zod");
4653
- var DeviceListStatusEnumSchema = import_zod28.z.enum(["pending", "active", "disabled"]);
4654
-
4655
- // src/_api/generated/cfg_totp/schemas/DeviceList.ts
4656
- var DeviceListSchema = import_zod29.z.object({
4657
- id: import_zod29.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4658
- name: import_zod29.z.string(),
4659
- is_primary: import_zod29.z.boolean(),
4660
- status: DeviceListStatusEnumSchema,
4661
- created_at: import_zod29.z.string().datetime({ offset: true }),
4662
- confirmed_at: import_zod29.z.string().datetime({ offset: true }).nullable(),
4663
- last_used_at: import_zod29.z.string().datetime({ offset: true }).nullable()
4664
- });
4665
-
4666
- // src/_api/generated/cfg_totp/schemas/DeviceListResponse.ts
4667
- var import_zod30 = require("zod");
4668
- var DeviceListResponseSchema = import_zod30.z.object({
4669
- devices: import_zod30.z.array(DeviceListSchema),
4670
- has_2fa_enabled: import_zod30.z.boolean()
4671
- });
4672
-
4673
- // src/_api/generated/cfg_totp/schemas/DisableRequest.ts
4674
- var import_zod31 = require("zod");
4675
- var DisableRequestSchema = import_zod31.z.object({
4676
- code: import_zod31.z.string().min(6).max(6)
4677
- });
4678
-
4679
- // src/_api/generated/cfg_totp/schemas/SetupRequest.ts
4680
- var import_zod32 = require("zod");
4681
- var SetupRequestSchema = import_zod32.z.object({
4682
- device_name: import_zod32.z.string().min(1).max(100).optional()
4683
- });
4684
-
4685
- // src/_api/generated/cfg_totp/schemas/SetupResponse.ts
4686
- var import_zod33 = require("zod");
4687
- var SetupResponseSchema = import_zod33.z.object({
4688
- device_id: import_zod33.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4689
- secret: import_zod33.z.string(),
4690
- provisioning_uri: import_zod33.z.string(),
4691
- qr_code_base64: import_zod33.z.string(),
4692
- expires_in: import_zod33.z.number().int()
4693
- });
4694
-
4695
- // src/_api/generated/cfg_totp/schemas/TotpVerifyUser.ts
4696
- var import_zod34 = require("zod");
4697
- var TotpVerifyUserSchema = import_zod34.z.object({
4698
- id: import_zod34.z.number().int(),
4699
- email: import_zod34.z.email(),
4700
- first_name: import_zod34.z.string().max(50).optional(),
4701
- last_name: import_zod34.z.string().max(50).optional(),
4702
- full_name: import_zod34.z.string(),
4703
- initials: import_zod34.z.string(),
4704
- display_username: import_zod34.z.string(),
4705
- company: import_zod34.z.string().max(100).optional(),
4706
- phone: import_zod34.z.string().max(20).optional(),
4707
- position: import_zod34.z.string().max(100).optional(),
4708
- language: import_zod34.z.string().max(10).optional(),
4709
- avatar: import_zod34.z.string().nullable(),
4710
- is_staff: import_zod34.z.boolean(),
4711
- is_superuser: import_zod34.z.boolean(),
4712
- date_joined: import_zod34.z.string().datetime({ offset: true }),
4713
- last_login: import_zod34.z.string().datetime({ offset: true }).nullable(),
4714
- unanswered_messages_count: import_zod34.z.number().int()
4715
- });
4716
-
4717
- // src/_api/generated/cfg_totp/schemas/VerifyBackupRequest.ts
4718
- var import_zod35 = require("zod");
4719
- var VerifyBackupRequestSchema = import_zod35.z.object({
4720
- session_id: import_zod35.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4721
- backup_code: import_zod35.z.string().min(8).max(8)
4722
- });
4723
-
4724
- // src/_api/generated/cfg_totp/schemas/VerifyRequest.ts
4725
- var import_zod36 = require("zod");
4726
- var VerifyRequestSchema = import_zod36.z.object({
4727
- session_id: import_zod36.z.string().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i),
4728
- code: import_zod36.z.string().min(6).max(6)
4729
- });
4730
-
4731
- // src/_api/generated/cfg_totp/schemas/VerifyResponse.ts
4732
- var import_zod37 = require("zod");
4733
- var VerifyResponseSchema = import_zod37.z.object({
4734
- message: import_zod37.z.string(),
4735
- access_token: import_zod37.z.string(),
4736
- refresh_token: import_zod37.z.string(),
4737
- user: TotpVerifyUserSchema,
4738
- remaining_backup_codes: import_zod37.z.number().int().optional(),
4739
- warning: import_zod37.z.string().optional()
4740
- });
4741
-
4742
- // src/_api/generated/cfg_totp/api.ts
4743
- var ACCESS_KEY3 = "cfg.access_token";
4744
- var REFRESH_KEY3 = "cfg.refresh_token";
4745
- var VALIDATION_ROUTES3 = [
4746
- { method: "GET", re: new RegExp("^/cfg/totp/backup\\-codes/?$"), schema: BackupCodesStatusSchema, path: "/cfg/totp/backup-codes/" },
4747
- { method: "POST", re: new RegExp("^/cfg/totp/backup\\-codes/regenerate/?$"), schema: BackupCodesRegenerateResponseSchema, path: "/cfg/totp/backup-codes/regenerate/" },
4748
- { method: "GET", re: new RegExp("^/cfg/totp/devices/?$"), schema: DeviceListResponseSchema, path: "/cfg/totp/devices/" },
4749
- { method: "POST", re: new RegExp("^/cfg/totp/setup/?$"), schema: SetupResponseSchema, path: "/cfg/totp/setup/" },
4750
- { method: "POST", re: new RegExp("^/cfg/totp/setup/confirm/?$"), schema: ConfirmSetupResponseSchema, path: "/cfg/totp/setup/confirm/" },
4751
- { method: "POST", re: new RegExp("^/cfg/totp/verify/?$"), schema: VerifyResponseSchema, path: "/cfg/totp/verify/" },
4752
- { method: "POST", re: new RegExp("^/cfg/totp/verify/backup/?$"), schema: VerifyResponseSchema, path: "/cfg/totp/verify/backup/" }
4753
- ];
4754
- function detectLocale3() {
4755
- try {
4756
- if (typeof document !== "undefined") {
4757
- const m = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
4758
- if (m) return decodeURIComponent(m[1]);
4759
- }
4760
- if (typeof navigator !== "undefined" && navigator.language) {
4761
- return navigator.language;
4762
- }
4763
- } catch {
4764
- }
4765
- return null;
4766
- }
4767
- __name(detectLocale3, "detectLocale");
4768
- var API3 = class {
2233
+ var TotpManagement = class {
4769
2234
  static {
4770
- __name(this, "API");
2235
+ __name(this, "TotpManagement");
4771
2236
  }
4772
- baseUrl;
4773
- storage;
4774
- locale;
4775
- apiKey;
4776
- logger;
4777
- cfg = Cfg3;
4778
- totp = Totp;
4779
- backupCodes = BackupCodes;
4780
- totpManagement = TotpManagement;
4781
- totpSetup = TotpSetup;
4782
- totpVerification = TotpVerification;
4783
- constructor(baseUrl2, opts = {}) {
4784
- this.baseUrl = baseUrl2.replace(/\/$/, "");
4785
- this.storage = opts.storage ?? new LocalStorageAdapter();
4786
- this.logger = new APILogger(opts.logger);
4787
- this.locale = opts.locale ?? null;
4788
- this.apiKey = opts.apiKey ?? (typeof process !== "undefined" ? process.env?.NEXT_PUBLIC_API_KEY ?? null : null);
4789
- const credentials = opts.withCredentials ?? true ? "include" : "same-origin";
4790
- client3.setConfig({ baseUrl: this.baseUrl, credentials });
4791
- client3.interceptors.request.use((request) => {
4792
- const access = this.getToken();
4793
- if (access) request.headers.set("Authorization", `Bearer ${access}`);
4794
- const locale = this.locale ?? detectLocale3();
4795
- if (locale) request.headers.set("Accept-Language", locale);
4796
- if (this.apiKey) request.headers.set("X-API-Key", this.apiKey);
4797
- return request;
2237
+ /**
2238
+ * List all TOTP devices for user.
2239
+ */
2240
+ static cfgTotpDevicesRetrieve(options) {
2241
+ return (options?.client ?? client).get({
2242
+ security: [{ scheme: "bearer", type: "http" }],
2243
+ url: "/cfg/totp/devices/",
2244
+ ...options
4798
2245
  });
4799
- client3.interceptors.response.use(async (response, request) => {
4800
- if (!response.ok) return response;
4801
- const ct = response.headers.get("content-type") || "";
4802
- if (!ct.includes("application/json")) return response;
4803
- const url = new URL(request.url);
4804
- const method = request.method.toUpperCase();
4805
- const route = VALIDATION_ROUTES3.find(
4806
- (r) => r.method === method && r.re.test(url.pathname)
4807
- );
4808
- if (!route) return response;
4809
- let payload;
4810
- try {
4811
- payload = await response.clone().json();
4812
- } catch {
4813
- return response;
4814
- }
4815
- const result = route.schema.safeParse(payload);
4816
- if (!result.success) {
4817
- dispatchValidationError({
4818
- operation: `${method} ${route.path}`,
4819
- path: route.path,
4820
- method,
4821
- error: result.error,
4822
- response: payload,
4823
- timestamp: /* @__PURE__ */ new Date()
4824
- });
2246
+ }
2247
+ /**
2248
+ * Completely disable 2FA for account.
2249
+ *
2250
+ * Requires verification code.
2251
+ */
2252
+ static cfgTotpDisableCreate(options) {
2253
+ return (options.client ?? client).post({
2254
+ security: [{ scheme: "bearer", type: "http" }],
2255
+ url: "/cfg/totp/disable/",
2256
+ ...options,
2257
+ headers: {
2258
+ "Content-Type": "application/json",
2259
+ ...options.headers
4825
2260
  }
4826
- return response;
4827
2261
  });
4828
2262
  }
4829
- // ── Base URL ────────────────────────────────────────────────────────────
4830
- getBaseUrl() {
4831
- return this.baseUrl;
4832
- }
4833
- setBaseUrl(url) {
4834
- this.baseUrl = url.replace(/\/$/, "");
4835
- client3.setConfig({ baseUrl: this.baseUrl });
4836
- }
4837
- // ── Tokens ──────────────────────────────────────────────────────────────
4838
- getToken() {
4839
- return this.storage.getItem(ACCESS_KEY3);
4840
- }
4841
- setToken(token) {
4842
- if (token) this.storage.setItem(ACCESS_KEY3, token);
4843
- else this.storage.removeItem(ACCESS_KEY3);
4844
- }
4845
- getRefreshToken() {
4846
- return this.storage.getItem(REFRESH_KEY3);
4847
- }
4848
- setRefreshToken(token) {
4849
- if (token) this.storage.setItem(REFRESH_KEY3, token);
4850
- else this.storage.removeItem(REFRESH_KEY3);
4851
- }
4852
- clearToken() {
4853
- this.storage.removeItem(ACCESS_KEY3);
4854
- this.storage.removeItem(REFRESH_KEY3);
2263
+ };
2264
+ var TotpSetup = class {
2265
+ static {
2266
+ __name(this, "TotpSetup");
4855
2267
  }
4856
- isAuthenticated() {
4857
- return this.getToken() !== null;
2268
+ /**
2269
+ * Start 2FA setup process.
2270
+ *
2271
+ * Creates a new TOTP device and returns QR code for scanning.
2272
+ */
2273
+ static cfgTotpSetupCreate(options) {
2274
+ return (options?.client ?? client).post({
2275
+ security: [{ scheme: "bearer", type: "http" }],
2276
+ url: "/cfg/totp/setup/",
2277
+ ...options,
2278
+ headers: {
2279
+ "Content-Type": "application/json",
2280
+ ...options?.headers
2281
+ }
2282
+ });
4858
2283
  }
4859
- // ── Locale / API key ────────────────────────────────────────────────────
4860
- getLocale() {
4861
- return this.locale ?? detectLocale3();
2284
+ /**
2285
+ * Confirm 2FA setup with first valid code.
2286
+ *
2287
+ * Activates the device and generates backup codes.
2288
+ */
2289
+ static cfgTotpSetupConfirmCreate(options) {
2290
+ return (options.client ?? client).post({
2291
+ security: [{ scheme: "bearer", type: "http" }],
2292
+ url: "/cfg/totp/setup/confirm/",
2293
+ ...options,
2294
+ headers: {
2295
+ "Content-Type": "application/json",
2296
+ ...options.headers
2297
+ }
2298
+ });
4862
2299
  }
4863
- setLocale(locale) {
4864
- this.locale = locale;
2300
+ };
2301
+ var TotpVerification = class {
2302
+ static {
2303
+ __name(this, "TotpVerification");
4865
2304
  }
4866
- getApiKey() {
4867
- return this.apiKey;
2305
+ /**
2306
+ * Verify TOTP code for 2FA session.
2307
+ *
2308
+ * Completes authentication and returns JWT tokens on success.
2309
+ */
2310
+ static cfgTotpVerifyCreate(options) {
2311
+ return (options.client ?? client).post({
2312
+ security: [{ scheme: "bearer", type: "http" }],
2313
+ url: "/cfg/totp/verify/",
2314
+ ...options,
2315
+ headers: {
2316
+ "Content-Type": "application/json",
2317
+ ...options.headers
2318
+ }
2319
+ });
4868
2320
  }
4869
- setApiKey(key) {
4870
- this.apiKey = key;
2321
+ /**
2322
+ * Verify backup recovery code for 2FA session.
2323
+ *
2324
+ * Alternative verification method when TOTP device unavailable.
2325
+ */
2326
+ static cfgTotpVerifyBackupCreate(options) {
2327
+ return (options.client ?? client).post({
2328
+ security: [{ scheme: "bearer", type: "http" }],
2329
+ url: "/cfg/totp/verify/backup/",
2330
+ ...options,
2331
+ headers: {
2332
+ "Content-Type": "application/json",
2333
+ ...options.headers
2334
+ }
2335
+ });
4871
2336
  }
4872
2337
  };
4873
2338
 
4874
- // src/_api/generated/index.ts
4875
- var isStaticBuild2 = process.env.NEXT_PUBLIC_STATIC_BUILD === "true";
4876
- var baseUrl = isStaticBuild2 ? "" : process.env.NEXT_PUBLIC_API_URL || "";
4877
- var cfgAccountsApi = new API(baseUrl, { storage: new LocalStorageAdapter() });
4878
- var cfgCentrifugoApi = new API2(baseUrl, { storage: new LocalStorageAdapter() });
4879
- var cfgTotpApi = new API3(baseUrl, { storage: new LocalStorageAdapter() });
4880
-
4881
2339
  // src/auth/utils/analytics.ts
4882
2340
  var AnalyticsEvent = /* @__PURE__ */ ((AnalyticsEvent2) => {
4883
2341
  AnalyticsEvent2["AUTH_OTP_REQUEST"] = "auth_otp_request";
@@ -4927,8 +2385,8 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
4927
2385
  setError(null);
4928
2386
  }, []);
4929
2387
  const handleSuccess = (0, import_react6.useCallback)((response) => {
4930
- cfgAccountsApi.setToken(response.access_token);
4931
- cfgAccountsApi.setRefreshToken(response.refresh_token);
2388
+ CfgAccountsApi.setToken(response.access_token);
2389
+ CfgAccountsApi.setRefreshToken(response.refresh_token);
4932
2390
  if (response.warning) {
4933
2391
  setWarning(response.warning);
4934
2392
  }
@@ -4966,7 +2424,7 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
4966
2424
  setError(null);
4967
2425
  try {
4968
2426
  authLogger.info("Verifying TOTP code...");
4969
- const result = await cfgTotpApi.totpVerification.cfgTotpVerifyCreate({
2427
+ const result = await TotpVerification.cfgTotpVerifyCreate({
4970
2428
  body: { session_id: sessionId, code },
4971
2429
  throwOnError: true
4972
2430
  });
@@ -5010,7 +2468,7 @@ var useTwoFactor = /* @__PURE__ */ __name((options = {}) => {
5010
2468
  setError(null);
5011
2469
  try {
5012
2470
  authLogger.info("Verifying backup code...");
5013
- const result = await cfgTotpApi.totpVerification.cfgTotpVerifyBackupCreate({
2471
+ const result = await TotpVerification.cfgTotpVerifyBackupCreate({
5014
2472
  body: {
5015
2473
  session_id: sessionId,
5016
2474
  backup_code: backupCode.replace(/\s+/g, "")
@@ -5354,7 +2812,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
5354
2812
  category: "auth" /* AUTH */,
5355
2813
  label: "github"
5356
2814
  });
5357
- const result = await cfgAccountsApi.oAuth.cfgAccountsOauthGithubAuthorizeCreate({
2815
+ const result = await OAuth.cfgAccountsOauthGithubAuthorizeCreate({
5358
2816
  body: {
5359
2817
  source_url: sourceUrl || (typeof window !== "undefined" ? window.location.href : "")
5360
2818
  },
@@ -5396,7 +2854,7 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
5396
2854
  sessionStorage.removeItem("oauth_state");
5397
2855
  sessionStorage.removeItem("oauth_provider");
5398
2856
  }
5399
- const result = await cfgAccountsApi.oAuth.cfgAccountsOauthGithubCallbackCreate({
2857
+ const result = await OAuth.cfgAccountsOauthGithubCallbackCreate({
5400
2858
  body: { code, state },
5401
2859
  throwOnError: true
5402
2860
  });
@@ -5414,8 +2872,8 @@ var useGithubAuth = /* @__PURE__ */ __name((options = {}) => {
5414
2872
  throw new Error("Invalid response from OAuth callback");
5415
2873
  }
5416
2874
  authLogger.info("GitHub OAuth successful, user:", response.user);
5417
- cfgAccountsApi.setToken(response.access);
5418
- cfgAccountsApi.setRefreshToken(response.refresh);
2875
+ CfgAccountsApi.setToken(response.access);
2876
+ CfgAccountsApi.setRefreshToken(response.refresh);
5419
2877
  Analytics.event("auth_login_success" /* AUTH_LOGIN_SUCCESS */, {
5420
2878
  category: "auth" /* AUTH */,
5421
2879
  label: "github"
@@ -5475,7 +2933,7 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
5475
2933
  setSetupStep("scanning");
5476
2934
  try {
5477
2935
  authLogger.info("Starting 2FA setup...");
5478
- const result = await cfgTotpApi.totpSetup.cfgTotpSetupCreate({
2936
+ const result = await TotpSetup.cfgTotpSetupCreate({
5479
2937
  body: { device_name: deviceName },
5480
2938
  throwOnError: true
5481
2939
  });
@@ -5519,7 +2977,7 @@ var useTwoFactorSetup = /* @__PURE__ */ __name((options = {}) => {
5519
2977
  setSetupStep("confirming");
5520
2978
  try {
5521
2979
  authLogger.info("Confirming 2FA setup...");
5522
- const result = await cfgTotpApi.totpSetup.cfgTotpSetupConfirmCreate({
2980
+ const result = await TotpSetup.cfgTotpSetupConfirmCreate({
5523
2981
  body: { device_id: setupData.deviceId, code },
5524
2982
  throwOnError: true
5525
2983
  });
@@ -5582,7 +3040,7 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
5582
3040
  setError(null);
5583
3041
  try {
5584
3042
  authLogger.info("Fetching 2FA status...");
5585
- const result = await cfgTotpApi.totpManagement.cfgTotpDevicesRetrieve({ throwOnError: true });
3043
+ const result = await TotpManagement.cfgTotpDevicesRetrieve({ throwOnError: true });
5586
3044
  const response = result.data;
5587
3045
  const mappedDevices = response.devices.map((device) => ({
5588
3046
  id: device.id,
@@ -5611,7 +3069,7 @@ var useTwoFactorStatus = /* @__PURE__ */ __name(() => {
5611
3069
  setError(null);
5612
3070
  try {
5613
3071
  authLogger.info("Disabling 2FA...");
5614
- await cfgTotpApi.totpManagement.cfgTotpDisableCreate({ body: { code }, throwOnError: true });
3072
+ await TotpManagement.cfgTotpDisableCreate({ body: { code }, throwOnError: true });
5615
3073
  setHas2FAEnabled(false);
5616
3074
  setDevices([]);
5617
3075
  authLogger.info("2FA disabled successfully");
@@ -6182,7 +3640,7 @@ function useTokenRefresh(options = {}) {
6182
3640
  authLogger.debug("Token refresh already in progress");
6183
3641
  return false;
6184
3642
  }
6185
- const refreshTokenValue = cfgAccountsApi.getRefreshToken();
3643
+ const refreshTokenValue = CfgAccountsApi.getRefreshToken();
6186
3644
  if (!refreshTokenValue) {
6187
3645
  authLogger.warn("No refresh token available");
6188
3646
  return false;
@@ -6190,7 +3648,7 @@ function useTokenRefresh(options = {}) {
6190
3648
  isRefreshingRef.current = true;
6191
3649
  authLogger.info("Refreshing token...");
6192
3650
  try {
6193
- const result = await cfgAccountsApi.auth.cfgAccountsTokenRefreshCreate({
3651
+ const result = await Auth.cfgAccountsTokenRefreshCreate({
6194
3652
  body: { refresh: refreshTokenValue },
6195
3653
  throwOnError: true
6196
3654
  });
@@ -6198,8 +3656,8 @@ function useTokenRefresh(options = {}) {
6198
3656
  if (!newAccessToken) {
6199
3657
  throw new Error("No access token in refresh response");
6200
3658
  }
6201
- cfgAccountsApi.setToken(newAccessToken);
6202
- cfgAccountsApi.setRefreshToken(refreshTokenValue);
3659
+ CfgAccountsApi.setToken(newAccessToken);
3660
+ CfgAccountsApi.setRefreshToken(refreshTokenValue);
6203
3661
  authLogger.info("Token refreshed successfully");
6204
3662
  onRefresh?.(newAccessToken);
6205
3663
  return true;
@@ -6212,7 +3670,7 @@ function useTokenRefresh(options = {}) {
6212
3670
  }
6213
3671
  }, [onRefresh, onRefreshError]);
6214
3672
  const checkAndRefresh = (0, import_react14.useCallback)(async () => {
6215
- const token = cfgAccountsApi.getToken();
3673
+ const token = CfgAccountsApi.getToken();
6216
3674
  if (!token) return;
6217
3675
  if (isTokenExpiringSoon(token, TOKEN_REFRESH_THRESHOLD_MS)) {
6218
3676
  authLogger.info("Token expiring soon, refreshing proactively");
@@ -6264,7 +3722,7 @@ var useDeleteAccount = /* @__PURE__ */ __name(() => {
6264
3722
  setError(null);
6265
3723
  try {
6266
3724
  authLogger.info("Deleting account...");
6267
- const result = await cfgAccountsApi.userProfile.cfgAccountsProfileDeleteCreate({ throwOnError: true });
3725
+ const result = await UserProfile.cfgAccountsProfileDeleteCreate({ throwOnError: true });
6268
3726
  const response = result.data;
6269
3727
  if (!response.success) {
6270
3728
  authLogger.error("Failed to delete account:", response.message);
@@ -6291,22 +3749,22 @@ var useDeleteAccount = /* @__PURE__ */ __name(() => {
6291
3749
  // src/auth/context/AccountsContext.tsx
6292
3750
  var import_react16 = require("react");
6293
3751
 
6294
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts
3752
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthConnectionsList.ts
6295
3753
  var import_swr = __toESM(require("swr"), 1);
6296
3754
 
6297
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts
3755
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthDisconnectCreate.ts
6298
3756
  var import_mutation = __toESM(require("swr/mutation"), 1);
6299
3757
 
6300
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts
3758
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubAuthorizeCreate.ts
6301
3759
  var import_mutation2 = __toESM(require("swr/mutation"), 1);
6302
3760
 
6303
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts
3761
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthGithubCallbackCreate.ts
6304
3762
  var import_mutation3 = __toESM(require("swr/mutation"), 1);
6305
3763
 
6306
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts
3764
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOauthProvidersRetrieve.ts
6307
3765
  var import_swr2 = __toESM(require("swr"), 1);
6308
3766
 
6309
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts
3767
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpRequestCreate.ts
6310
3768
  var import_mutation4 = __toESM(require("swr/mutation"), 1);
6311
3769
  function useCfgAccountsOtpRequestCreate(config) {
6312
3770
  return (0, import_mutation4.default)(
@@ -6320,7 +3778,7 @@ function useCfgAccountsOtpRequestCreate(config) {
6320
3778
  }
6321
3779
  __name(useCfgAccountsOtpRequestCreate, "useCfgAccountsOtpRequestCreate");
6322
3780
 
6323
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts
3781
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsOtpVerifyCreate.ts
6324
3782
  var import_mutation5 = __toESM(require("swr/mutation"), 1);
6325
3783
  function useCfgAccountsOtpVerifyCreate(config) {
6326
3784
  return (0, import_mutation5.default)(
@@ -6334,7 +3792,7 @@ function useCfgAccountsOtpVerifyCreate(config) {
6334
3792
  }
6335
3793
  __name(useCfgAccountsOtpVerifyCreate, "useCfgAccountsOtpVerifyCreate");
6336
3794
 
6337
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts
3795
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileAvatarCreate.ts
6338
3796
  var import_mutation6 = __toESM(require("swr/mutation"), 1);
6339
3797
  function useCfgAccountsProfileAvatarCreate(config) {
6340
3798
  return (0, import_mutation6.default)(
@@ -6348,13 +3806,13 @@ function useCfgAccountsProfileAvatarCreate(config) {
6348
3806
  }
6349
3807
  __name(useCfgAccountsProfileAvatarCreate, "useCfgAccountsProfileAvatarCreate");
6350
3808
 
6351
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts
3809
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileDeleteCreate.ts
6352
3810
  var import_mutation7 = __toESM(require("swr/mutation"), 1);
6353
3811
 
6354
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts
3812
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialPartialUpdate.ts
6355
3813
  var import_mutation8 = __toESM(require("swr/mutation"), 1);
6356
3814
 
6357
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts
3815
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfilePartialUpdate.ts
6358
3816
  var import_mutation9 = __toESM(require("swr/mutation"), 1);
6359
3817
  function useCfgAccountsProfilePartialUpdate(config) {
6360
3818
  return (0, import_mutation9.default)(
@@ -6368,13 +3826,13 @@ function useCfgAccountsProfilePartialUpdate(config) {
6368
3826
  }
6369
3827
  __name(useCfgAccountsProfilePartialUpdate, "useCfgAccountsProfilePartialUpdate");
6370
3828
 
6371
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts
3829
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileRetrieve.ts
6372
3830
  var import_swr3 = __toESM(require("swr"), 1);
6373
3831
 
6374
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts
3832
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdatePartialUpdate.ts
6375
3833
  var import_mutation10 = __toESM(require("swr/mutation"), 1);
6376
3834
 
6377
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts
3835
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsProfileUpdateUpdate.ts
6378
3836
  var import_mutation11 = __toESM(require("swr/mutation"), 1);
6379
3837
  function useCfgAccountsProfileUpdateUpdate(config) {
6380
3838
  return (0, import_mutation11.default)(
@@ -6388,7 +3846,7 @@ function useCfgAccountsProfileUpdateUpdate(config) {
6388
3846
  }
6389
3847
  __name(useCfgAccountsProfileUpdateUpdate, "useCfgAccountsProfileUpdateUpdate");
6390
3848
 
6391
- // src/_api/generated/cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts
3849
+ // src/_api/generated/_cfg_accounts/hooks/useCfgAccountsTokenRefreshCreate.ts
6392
3850
  var import_mutation12 = __toESM(require("swr/mutation"), 1);
6393
3851
  function useCfgAccountsTokenRefreshCreate(config) {
6394
3852
  return (0, import_mutation12.default)(
@@ -6402,6 +3860,195 @@ function useCfgAccountsTokenRefreshCreate(config) {
6402
3860
  }
6403
3861
  __name(useCfgAccountsTokenRefreshCreate, "useCfgAccountsTokenRefreshCreate");
6404
3862
 
3863
+ // src/_api/generated/_cfg_accounts/schemas/AccountDeleteResponse.ts
3864
+ var import_zod = require("zod");
3865
+ var AccountDeleteResponseSchema = import_zod.z.object({
3866
+ message: import_zod.z.string(),
3867
+ success: import_zod.z.boolean()
3868
+ });
3869
+
3870
+ // src/_api/generated/_cfg_accounts/schemas/CentrifugoToken.ts
3871
+ var import_zod2 = require("zod");
3872
+ var CentrifugoTokenSchema = import_zod2.z.object({
3873
+ centrifugo_url: import_zod2.z.string(),
3874
+ channels: import_zod2.z.array(import_zod2.z.string()),
3875
+ expires_at: import_zod2.z.string().datetime({ offset: true }),
3876
+ token: import_zod2.z.string()
3877
+ });
3878
+
3879
+ // src/_api/generated/_cfg_accounts/schemas/CfgUserUpdateRequest.ts
3880
+ var import_zod3 = require("zod");
3881
+ var CfgUserUpdateRequestSchema = import_zod3.z.object({
3882
+ company: import_zod3.z.string().max(100).optional(),
3883
+ first_name: import_zod3.z.string().max(50).optional(),
3884
+ language: import_zod3.z.string().max(10).optional(),
3885
+ last_name: import_zod3.z.string().max(50).optional(),
3886
+ phone: import_zod3.z.string().max(20).optional(),
3887
+ position: import_zod3.z.string().max(100).optional()
3888
+ });
3889
+
3890
+ // src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeRequestRequest.ts
3891
+ var import_zod4 = require("zod");
3892
+ var OAuthAuthorizeRequestRequestSchema = import_zod4.z.object({
3893
+ redirect_uri: import_zod4.z.string().optional(),
3894
+ source_url: import_zod4.z.string().optional()
3895
+ });
3896
+
3897
+ // src/_api/generated/_cfg_accounts/schemas/OAuthAuthorizeResponse.ts
3898
+ var import_zod5 = require("zod");
3899
+ var OAuthAuthorizeResponseSchema = import_zod5.z.object({
3900
+ authorization_url: import_zod5.z.string(),
3901
+ state: import_zod5.z.string()
3902
+ });
3903
+
3904
+ // src/_api/generated/_cfg_accounts/schemas/OAuthCallbackRequestRequest.ts
3905
+ var import_zod6 = require("zod");
3906
+ var OAuthCallbackRequestRequestSchema = import_zod6.z.object({
3907
+ code: import_zod6.z.string().min(10).max(500),
3908
+ redirect_uri: import_zod6.z.string().optional(),
3909
+ state: import_zod6.z.string().min(20).max(100)
3910
+ });
3911
+
3912
+ // src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts
3913
+ var import_zod8 = require("zod");
3914
+
3915
+ // src/_api/generated/_cfg_accounts/schemas/ProviderEnum.ts
3916
+ var import_zod7 = require("zod");
3917
+ var ProviderEnumSchema = import_zod7.z.enum(["github"]);
3918
+
3919
+ // src/_api/generated/_cfg_accounts/schemas/OAuthConnection.ts
3920
+ var OAuthConnectionSchema = import_zod8.z.object({
3921
+ connected_at: import_zod8.z.string().datetime({ offset: true }),
3922
+ id: import_zod8.z.number().int(),
3923
+ last_login_at: import_zod8.z.string().datetime({ offset: true }),
3924
+ provider: ProviderEnumSchema,
3925
+ provider_avatar_url: import_zod8.z.string(),
3926
+ provider_display: import_zod8.z.string(),
3927
+ provider_email: import_zod8.z.email(),
3928
+ provider_username: import_zod8.z.string()
3929
+ });
3930
+
3931
+ // src/_api/generated/_cfg_accounts/schemas/OAuthDisconnectRequestRequest.ts
3932
+ var import_zod9 = require("zod");
3933
+ var OAuthDisconnectRequestRequestSchema = import_zod9.z.object({
3934
+ provider: ProviderEnumSchema
3935
+ });
3936
+
3937
+ // src/_api/generated/_cfg_accounts/schemas/OAuthError.ts
3938
+ var import_zod10 = require("zod");
3939
+ var OAuthErrorSchema = import_zod10.z.object({
3940
+ error: import_zod10.z.string(),
3941
+ error_description: import_zod10.z.string().optional()
3942
+ });
3943
+
3944
+ // src/_api/generated/_cfg_accounts/schemas/OAuthProvidersResponse.ts
3945
+ var import_zod11 = require("zod");
3946
+ var OAuthProvidersResponseSchema = import_zod11.z.object({
3947
+ providers: import_zod11.z.array(import_zod11.z.object({}).passthrough())
3948
+ });
3949
+
3950
+ // src/_api/generated/_cfg_accounts/schemas/OAuthTokenResponse.ts
3951
+ var import_zod12 = require("zod");
3952
+ var OAuthTokenResponseSchema = import_zod12.z.object({
3953
+ access: import_zod12.z.string().nullable().optional(),
3954
+ is_new_connection: import_zod12.z.boolean(),
3955
+ is_new_user: import_zod12.z.boolean(),
3956
+ refresh: import_zod12.z.string().nullable().optional(),
3957
+ requires_2fa: import_zod12.z.boolean().default(false).optional(),
3958
+ 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(),
3959
+ should_prompt_2fa: import_zod12.z.boolean().optional(),
3960
+ user: import_zod12.z.object({}).passthrough().nullable().optional()
3961
+ });
3962
+
3963
+ // src/_api/generated/_cfg_accounts/schemas/OTPErrorResponse.ts
3964
+ var import_zod13 = require("zod");
3965
+ var OTPErrorResponseSchema = import_zod13.z.object({
3966
+ error: import_zod13.z.string(),
3967
+ error_code: import_zod13.z.string().nullable().optional(),
3968
+ retry_after: import_zod13.z.number().int().nullable().optional()
3969
+ });
3970
+
3971
+ // src/_api/generated/_cfg_accounts/schemas/OTPRequestRequest.ts
3972
+ var import_zod14 = require("zod");
3973
+ var OTPRequestRequestSchema = import_zod14.z.object({
3974
+ identifier: import_zod14.z.string().min(1),
3975
+ source_url: import_zod14.z.string().optional()
3976
+ });
3977
+
3978
+ // src/_api/generated/_cfg_accounts/schemas/OTPRequestResponse.ts
3979
+ var import_zod15 = require("zod");
3980
+ var OTPRequestResponseSchema = import_zod15.z.object({
3981
+ message: import_zod15.z.string()
3982
+ });
3983
+
3984
+ // src/_api/generated/_cfg_accounts/schemas/OTPVerifyRequest.ts
3985
+ var import_zod16 = require("zod");
3986
+ var OTPVerifyRequestSchema = import_zod16.z.object({
3987
+ identifier: import_zod16.z.string().min(1),
3988
+ otp: import_zod16.z.string().min(6).max(6),
3989
+ source_url: import_zod16.z.string().optional()
3990
+ });
3991
+
3992
+ // src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
3993
+ var import_zod18 = require("zod");
3994
+
3995
+ // src/_api/generated/_cfg_accounts/schemas/User.ts
3996
+ var import_zod17 = require("zod");
3997
+ var UserSchema = import_zod17.z.object({
3998
+ avatar: import_zod17.z.string().nullable(),
3999
+ centrifugo: CentrifugoTokenSchema.nullable(),
4000
+ company: import_zod17.z.string().max(100).optional(),
4001
+ date_joined: import_zod17.z.string().datetime({ offset: true }),
4002
+ display_username: import_zod17.z.string(),
4003
+ email: import_zod17.z.email(),
4004
+ first_name: import_zod17.z.string().max(50).optional(),
4005
+ full_name: import_zod17.z.string(),
4006
+ id: import_zod17.z.number().int(),
4007
+ initials: import_zod17.z.string(),
4008
+ is_staff: import_zod17.z.boolean(),
4009
+ is_superuser: import_zod17.z.boolean(),
4010
+ language: import_zod17.z.string().max(10).optional(),
4011
+ last_login: import_zod17.z.string().datetime({ offset: true }).nullable(),
4012
+ last_name: import_zod17.z.string().max(50).optional(),
4013
+ phone: import_zod17.z.string().max(20).optional(),
4014
+ position: import_zod17.z.string().max(100).optional(),
4015
+ unanswered_messages_count: import_zod17.z.number().int().default(0)
4016
+ });
4017
+
4018
+ // src/_api/generated/_cfg_accounts/schemas/OTPVerifyResponse.ts
4019
+ var OTPVerifyResponseSchema = import_zod18.z.object({
4020
+ access: import_zod18.z.string().nullable().optional(),
4021
+ refresh: import_zod18.z.string().nullable().optional(),
4022
+ requires_2fa: import_zod18.z.boolean().default(false).optional(),
4023
+ 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(),
4024
+ should_prompt_2fa: import_zod18.z.boolean().optional(),
4025
+ user: UserSchema.nullable().optional()
4026
+ });
4027
+
4028
+ // src/_api/generated/_cfg_accounts/schemas/PatchedCfgUserUpdateRequest.ts
4029
+ var import_zod19 = require("zod");
4030
+ var PatchedCfgUserUpdateRequestSchema = import_zod19.z.object({
4031
+ company: import_zod19.z.string().max(100).optional(),
4032
+ first_name: import_zod19.z.string().max(50).optional(),
4033
+ language: import_zod19.z.string().max(10).optional(),
4034
+ last_name: import_zod19.z.string().max(50).optional(),
4035
+ phone: import_zod19.z.string().max(20).optional(),
4036
+ position: import_zod19.z.string().max(100).optional()
4037
+ });
4038
+
4039
+ // src/_api/generated/_cfg_accounts/schemas/TokenRefresh.ts
4040
+ var import_zod20 = require("zod");
4041
+ var TokenRefreshSchema = import_zod20.z.object({
4042
+ access: import_zod20.z.string(),
4043
+ refresh: import_zod20.z.string()
4044
+ });
4045
+
4046
+ // src/_api/generated/_cfg_accounts/schemas/TokenRefreshRequest.ts
4047
+ var import_zod21 = require("zod");
4048
+ var TokenRefreshRequestSchema = import_zod21.z.object({
4049
+ refresh: import_zod21.z.string().min(1)
4050
+ });
4051
+
6405
4052
  // src/auth/context/AccountsContext.tsx
6406
4053
  var import_jsx_runtime = require("react/jsx-runtime");
6407
4054
  var AccountsContext = (0, import_react16.createContext)(void 0);
@@ -6478,8 +4125,8 @@ function AccountsProvider({ children }) {
6478
4125
  return result;
6479
4126
  }
6480
4127
  if (result.access && result.refresh) {
6481
- cfgAccountsApi.setToken(result.access);
6482
- cfgAccountsApi.setRefreshToken(result.refresh);
4128
+ CfgAccountsApi.setToken(result.access);
4129
+ CfgAccountsApi.setRefreshToken(result.refresh);
6483
4130
  try {
6484
4131
  await refreshProfile({ callerId: "verifyOTP", force: true });
6485
4132
  } catch (profileError2) {
@@ -6492,13 +4139,13 @@ function AccountsProvider({ children }) {
6492
4139
  const body = { refresh };
6493
4140
  const result = await triggerTokenRefresh({ body });
6494
4141
  if (result.access) {
6495
- cfgAccountsApi.setToken(result.access);
6496
- cfgAccountsApi.setRefreshToken(refresh);
4142
+ CfgAccountsApi.setToken(result.access);
4143
+ CfgAccountsApi.setRefreshToken(refresh);
6497
4144
  }
6498
4145
  return result;
6499
4146
  }, "refreshToken");
6500
4147
  const logout = (0, import_react16.useCallback)(() => {
6501
- cfgAccountsApi.clearToken();
4148
+ CfgAccountsApi.clearToken();
6502
4149
  setProfile(void 0);
6503
4150
  setProfileError(null);
6504
4151
  clearProfileCache();
@@ -6539,7 +4186,7 @@ var AuthContext = (0, import_react17.createContext)(void 0);
6539
4186
  var EMAIL_STORAGE_KEY = "auth_email";
6540
4187
  var hasValidTokens = /* @__PURE__ */ __name(() => {
6541
4188
  if (typeof window === "undefined") return false;
6542
- return cfgAccountsApi.isAuthenticated();
4189
+ return CfgAccountsApi.isAuthenticated();
6543
4190
  }, "hasValidTokens");
6544
4191
  var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6545
4192
  const accounts = useAccountsContext();
@@ -6580,7 +4227,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6580
4227
  }, [config]);
6581
4228
  const clearAuthState = (0, import_react17.useCallback)((caller) => {
6582
4229
  authLogger.info("clearAuthState >> caller", caller);
6583
- cfgAccountsApi.clearToken();
4230
+ CfgAccountsApi.clearToken();
6584
4231
  clearProfileCache();
6585
4232
  setInitialized(true);
6586
4233
  setIsLoading(false);
@@ -6618,8 +4265,8 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6618
4265
  authLogger.debug(`loadCurrentProfile called by: ${finalCallerId}`);
6619
4266
  try {
6620
4267
  isLoadingProfileRef.current = true;
6621
- const isAuth = cfgAccountsApi.isAuthenticated();
6622
- const token = cfgAccountsApi.getToken();
4268
+ const isAuth = CfgAccountsApi.isAuthenticated();
4269
+ const token = CfgAccountsApi.getToken();
6623
4270
  if (!isAuth) {
6624
4271
  authLogger.warn("No valid authentication token, throwing error");
6625
4272
  throw new Error("No valid authentication token");
@@ -6656,8 +4303,8 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6656
4303
  authLogger.info("Initializing auth...");
6657
4304
  const isInIframe = typeof window !== "undefined" && window.self !== window.top;
6658
4305
  authLogger.info("Is in iframe:", isInIframe);
6659
- const token = cfgAccountsApi.getToken();
6660
- const refreshToken2 = cfgAccountsApi.getRefreshToken();
4306
+ const token = CfgAccountsApi.getToken();
4307
+ const refreshToken2 = CfgAccountsApi.getRefreshToken();
6661
4308
  authLogger.info("Token from API:", token ? `${token.substring(0, 20)}...` : "null");
6662
4309
  authLogger.info("Refresh token from API:", refreshToken2 ? `${refreshToken2.substring(0, 20)}...` : "null");
6663
4310
  authLogger.info("localStorage keys:", Object.keys(localStorage).filter((k) => k.includes("token") || k.includes("auth")));
@@ -6708,7 +4355,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6708
4355
  }, [initialized]);
6709
4356
  (0, import_react17.useEffect)(() => {
6710
4357
  if (!initialized) return;
6711
- const isAuthenticated = cfgAccountsApi.isAuthenticated();
4358
+ const isAuthenticated = CfgAccountsApi.isAuthenticated();
6712
4359
  const authRoute = config?.routes?.auth || defaultRoutes.auth;
6713
4360
  const isAuthPage = pathname === authRoute;
6714
4361
  const flowParam = queryParams.get("flow");
@@ -6728,7 +4375,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6728
4375
  const checkAuthAndRedirect = (0, import_react17.useCallback)(async () => {
6729
4376
  try {
6730
4377
  setIsLoading(true);
6731
- const isAuthenticated = cfgAccountsApi.isAuthenticated();
4378
+ const isAuthenticated = CfgAccountsApi.isAuthenticated();
6732
4379
  if (isAuthenticated) {
6733
4380
  await loadCurrentProfile();
6734
4381
  if (userRef.current) {
@@ -6749,7 +4396,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6749
4396
  }, [loadCurrentProfile, clearAuthState, pushToDefaultCallbackUrl, pushToDefaultAuthCallbackUrl, handleGlobalAuthError]);
6750
4397
  const requestOTP = (0, import_react17.useCallback)(
6751
4398
  async (identifier, sourceUrl) => {
6752
- cfgAccountsApi.clearToken();
4399
+ CfgAccountsApi.clearToken();
6753
4400
  try {
6754
4401
  const result = await accounts.requestOTP({
6755
4402
  identifier,
@@ -6851,7 +4498,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6851
4498
  );
6852
4499
  const refreshToken = (0, import_react17.useCallback)(async () => {
6853
4500
  try {
6854
- const refreshTokenValue = cfgAccountsApi.getRefreshToken();
4501
+ const refreshTokenValue = CfgAccountsApi.getRefreshToken();
6855
4502
  if (!refreshTokenValue) {
6856
4503
  clearAuthState("refreshToken:noToken");
6857
4504
  Analytics.event("auth_session_expired" /* AUTH_SESSION_EXPIRED */, {
@@ -6914,12 +4561,12 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
6914
4561
  user,
6915
4562
  isLoading,
6916
4563
  // Consider authenticated if we have valid tokens, even without user profile
6917
- isAuthenticated: cfgAccountsApi.isAuthenticated(),
4564
+ isAuthenticated: CfgAccountsApi.isAuthenticated(),
6918
4565
  isAdminUser,
6919
4566
  loadCurrentProfile,
6920
4567
  checkAuthAndRedirect,
6921
- getToken: /* @__PURE__ */ __name(() => cfgAccountsApi.getToken(), "getToken"),
6922
- getRefreshToken: /* @__PURE__ */ __name(() => cfgAccountsApi.getRefreshToken(), "getRefreshToken"),
4568
+ getToken: /* @__PURE__ */ __name(() => CfgAccountsApi.getToken(), "getToken"),
4569
+ getRefreshToken: /* @__PURE__ */ __name(() => CfgAccountsApi.getRefreshToken(), "getRefreshToken"),
6923
4570
  getSavedEmail: /* @__PURE__ */ __name(() => storedEmail, "getSavedEmail"),
6924
4571
  saveEmail: setStoredEmail,
6925
4572
  clearSavedEmail: clearStoredEmail,