@djangocfg/api 2.1.191 → 2.1.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auth-server.cjs +37 -3
- package/dist/auth-server.cjs.map +1 -1
- package/dist/auth-server.mjs +37 -3
- package/dist/auth-server.mjs.map +1 -1
- package/dist/auth.cjs +116 -6
- package/dist/auth.cjs.map +1 -1
- package/dist/auth.d.cts +4 -0
- package/dist/auth.d.ts +4 -0
- package/dist/auth.mjs +116 -6
- package/dist/auth.mjs.map +1 -1
- package/dist/clients.cjs +107 -10
- package/dist/clients.cjs.map +1 -1
- package/dist/clients.d.cts +47 -0
- package/dist/clients.d.ts +47 -0
- package/dist/clients.mjs +107 -10
- package/dist/clients.mjs.map +1 -1
- package/dist/hooks.cjs +37 -3
- package/dist/hooks.cjs.map +1 -1
- package/dist/hooks.d.cts +20 -0
- package/dist/hooks.d.ts +20 -0
- package/dist/hooks.mjs +37 -3
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.cjs +69 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.mjs +69 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/auth/context/AuthContext.tsx +25 -1
- package/src/generated/cfg_accounts/_utils/fetchers/accounts.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__auth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__oauth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/accounts__user_profile.ts +1 -0
- package/src/generated/cfg_accounts/_utils/fetchers/index.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__auth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__oauth.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/accounts__user_profile.ts +1 -0
- package/src/generated/cfg_accounts/_utils/hooks/index.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/PatchedUserProfileUpdateRequest.schema.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/User.schema.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/UserProfileUpdateRequest.schema.ts +1 -0
- package/src/generated/cfg_accounts/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts/models.ts +2 -0
- package/src/generated/cfg_accounts/accounts__auth/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts__auth/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__auth/models.ts +1 -0
- package/src/generated/cfg_accounts/accounts__oauth/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts__oauth/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__oauth/models.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/client.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/index.ts +1 -0
- package/src/generated/cfg_accounts/accounts__user_profile/models.ts +4 -0
- package/src/generated/cfg_accounts/api-instance.ts +1 -0
- package/src/generated/cfg_accounts/enums.ts +1 -0
- package/src/generated/cfg_accounts/errors.ts +1 -0
- package/src/generated/cfg_accounts/http.ts +1 -0
- package/src/generated/cfg_accounts/index.ts +37 -0
- package/src/generated/cfg_accounts/logger.ts +1 -0
- package/src/generated/cfg_accounts/retry.ts +1 -0
- package/src/generated/cfg_accounts/schema.json +12 -0
- package/src/generated/cfg_accounts/storage.ts +1 -0
- package/src/generated/cfg_accounts/validation-events.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_admin_api.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_auth.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_monitoring.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/centrifugo__centrifugo_testing.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/fetchers/index.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_admin_api.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_auth.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_monitoring.ts +5 -4
- package/src/generated/cfg_centrifugo/_utils/hooks/centrifugo__centrifugo_testing.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/hooks/index.ts +1 -0
- package/src/generated/cfg_centrifugo/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_centrifugo/api-instance.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_admin_api/models.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_auth/models.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_monitoring/models.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/client.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/index.ts +1 -0
- package/src/generated/cfg_centrifugo/centrifugo__centrifugo_testing/models.ts +1 -0
- package/src/generated/cfg_centrifugo/errors.ts +1 -0
- package/src/generated/cfg_centrifugo/http.ts +1 -0
- package/src/generated/cfg_centrifugo/index.ts +37 -0
- package/src/generated/cfg_centrifugo/logger.ts +1 -0
- package/src/generated/cfg_centrifugo/retry.ts +1 -0
- package/src/generated/cfg_centrifugo/storage.ts +1 -0
- package/src/generated/cfg_centrifugo/validation-events.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/index.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__backup_codes.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__totp_management.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__totp_setup.ts +1 -0
- package/src/generated/cfg_totp/_utils/fetchers/totp__totp_verification.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/index.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__backup_codes.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__totp_management.ts +2 -1
- package/src/generated/cfg_totp/_utils/hooks/totp__totp_setup.ts +1 -0
- package/src/generated/cfg_totp/_utils/hooks/totp__totp_verification.ts +1 -0
- package/src/generated/cfg_totp/_utils/schemas/TotpVerifyUser.schema.ts +1 -0
- package/src/generated/cfg_totp/_utils/schemas/index.ts +1 -0
- package/src/generated/cfg_totp/api-instance.ts +1 -0
- package/src/generated/cfg_totp/enums.ts +1 -0
- package/src/generated/cfg_totp/errors.ts +1 -0
- package/src/generated/cfg_totp/http.ts +1 -0
- package/src/generated/cfg_totp/index.ts +37 -0
- package/src/generated/cfg_totp/logger.ts +1 -0
- package/src/generated/cfg_totp/retry.ts +1 -0
- package/src/generated/cfg_totp/schema.json +4 -0
- package/src/generated/cfg_totp/storage.ts +1 -0
- package/src/generated/cfg_totp/totp/client.ts +1 -0
- package/src/generated/cfg_totp/totp/index.ts +1 -0
- package/src/generated/cfg_totp/totp/models.ts +1 -0
- package/src/generated/cfg_totp/totp__backup_codes/client.ts +1 -0
- package/src/generated/cfg_totp/totp__backup_codes/index.ts +1 -0
- package/src/generated/cfg_totp/totp__backup_codes/models.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_management/client.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_management/index.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_management/models.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_setup/client.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_setup/index.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_setup/models.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_verification/client.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_verification/index.ts +1 -0
- package/src/generated/cfg_totp/totp__totp_verification/models.ts +2 -0
- package/src/generated/cfg_totp/validation-events.ts +1 -0
package/dist/auth.cjs
CHANGED
|
@@ -75,6 +75,7 @@ module.exports = __toCommonJS(auth_exports);
|
|
|
75
75
|
// src/auth/context/AuthContext.tsx
|
|
76
76
|
var import_navigation4 = require("next/navigation");
|
|
77
77
|
var import_react17 = require("react");
|
|
78
|
+
var import_swr18 = require("swr");
|
|
78
79
|
|
|
79
80
|
// src/auth/hooks/useCfgRouter.ts
|
|
80
81
|
var import_navigation = require("next/navigation");
|
|
@@ -1272,6 +1273,7 @@ var UserSchema = import_zod16.z.object({
|
|
|
1272
1273
|
company: import_zod16.z.string().max(100).optional(),
|
|
1273
1274
|
phone: import_zod16.z.string().max(20).optional(),
|
|
1274
1275
|
position: import_zod16.z.string().max(100).optional(),
|
|
1276
|
+
language: import_zod16.z.string().max(10).optional(),
|
|
1275
1277
|
avatar: import_zod16.z.union([import_zod16.z.url(), import_zod16.z.literal("")]).nullable(),
|
|
1276
1278
|
is_staff: import_zod16.z.boolean(),
|
|
1277
1279
|
is_superuser: import_zod16.z.boolean(),
|
|
@@ -1298,7 +1300,8 @@ var PatchedUserProfileUpdateRequestSchema = import_zod18.z.object({
|
|
|
1298
1300
|
last_name: import_zod18.z.string().max(50).optional(),
|
|
1299
1301
|
company: import_zod18.z.string().max(100).optional(),
|
|
1300
1302
|
phone: import_zod18.z.string().max(20).optional(),
|
|
1301
|
-
position: import_zod18.z.string().max(100).optional()
|
|
1303
|
+
position: import_zod18.z.string().max(100).optional(),
|
|
1304
|
+
language: import_zod18.z.string().max(10).optional()
|
|
1302
1305
|
});
|
|
1303
1306
|
|
|
1304
1307
|
// src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
|
|
@@ -1321,7 +1324,8 @@ var UserProfileUpdateRequestSchema = import_zod21.z.object({
|
|
|
1321
1324
|
last_name: import_zod21.z.string().max(50).optional(),
|
|
1322
1325
|
company: import_zod21.z.string().max(100).optional(),
|
|
1323
1326
|
phone: import_zod21.z.string().max(20).optional(),
|
|
1324
|
-
position: import_zod21.z.string().max(100).optional()
|
|
1327
|
+
position: import_zod21.z.string().max(100).optional(),
|
|
1328
|
+
language: import_zod21.z.string().max(10).optional()
|
|
1325
1329
|
});
|
|
1326
1330
|
|
|
1327
1331
|
// src/generated/cfg_accounts/_utils/fetchers/accounts.ts
|
|
@@ -1667,14 +1671,30 @@ __name(updateAccountsProfileUpdateUpdate, "updateAccountsProfileUpdateUpdate");
|
|
|
1667
1671
|
// src/generated/cfg_accounts/index.ts
|
|
1668
1672
|
var TOKEN_KEY = "auth_token";
|
|
1669
1673
|
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
1674
|
+
function detectLocale() {
|
|
1675
|
+
try {
|
|
1676
|
+
if (typeof document !== "undefined") {
|
|
1677
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1678
|
+
if (match) return match[1];
|
|
1679
|
+
}
|
|
1680
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1681
|
+
return navigator.language;
|
|
1682
|
+
}
|
|
1683
|
+
} catch {
|
|
1684
|
+
}
|
|
1685
|
+
return null;
|
|
1686
|
+
}
|
|
1687
|
+
__name(detectLocale, "detectLocale");
|
|
1670
1688
|
var API = class {
|
|
1671
1689
|
constructor(baseUrl, options) {
|
|
1672
1690
|
this._token = null;
|
|
1673
1691
|
this._refreshToken = null;
|
|
1692
|
+
this._locale = null;
|
|
1674
1693
|
this.baseUrl = baseUrl;
|
|
1675
1694
|
this.options = options;
|
|
1676
1695
|
const logger2 = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
|
|
1677
1696
|
this.storage = options?.storage || new LocalStorageAdapter(logger2);
|
|
1697
|
+
this._locale = options?.locale || null;
|
|
1678
1698
|
this._loadTokensFromStorage();
|
|
1679
1699
|
this._client = new APIClient(this.baseUrl, {
|
|
1680
1700
|
retryConfig: this.options?.retryConfig,
|
|
@@ -1710,11 +1730,13 @@ var API = class {
|
|
|
1710
1730
|
const originalRequest = this._client.request.bind(this._client);
|
|
1711
1731
|
this._client.request = async (method, path, options) => {
|
|
1712
1732
|
const token = this.getToken();
|
|
1733
|
+
const locale = this._locale || detectLocale();
|
|
1713
1734
|
const mergedOptions = {
|
|
1714
1735
|
...options,
|
|
1715
1736
|
headers: {
|
|
1716
1737
|
...options?.headers || {},
|
|
1717
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
1738
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
1739
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
1718
1740
|
}
|
|
1719
1741
|
};
|
|
1720
1742
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -1776,6 +1798,19 @@ var API = class {
|
|
|
1776
1798
|
getBaseUrl() {
|
|
1777
1799
|
return this.baseUrl;
|
|
1778
1800
|
}
|
|
1801
|
+
/**
|
|
1802
|
+
* Set locale for Accept-Language header
|
|
1803
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1804
|
+
*/
|
|
1805
|
+
setLocale(locale) {
|
|
1806
|
+
this._locale = locale;
|
|
1807
|
+
}
|
|
1808
|
+
/**
|
|
1809
|
+
* Get current locale
|
|
1810
|
+
*/
|
|
1811
|
+
getLocale() {
|
|
1812
|
+
return this._locale;
|
|
1813
|
+
}
|
|
1779
1814
|
/**
|
|
1780
1815
|
* Get OpenAPI schema path
|
|
1781
1816
|
* @returns Path to the OpenAPI schema JSON file
|
|
@@ -2957,14 +2992,30 @@ var import_consola11 = require("consola");
|
|
|
2957
2992
|
// src/generated/cfg_centrifugo/index.ts
|
|
2958
2993
|
var TOKEN_KEY2 = "auth_token";
|
|
2959
2994
|
var REFRESH_TOKEN_KEY2 = "refresh_token";
|
|
2995
|
+
function detectLocale2() {
|
|
2996
|
+
try {
|
|
2997
|
+
if (typeof document !== "undefined") {
|
|
2998
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
2999
|
+
if (match) return match[1];
|
|
3000
|
+
}
|
|
3001
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
3002
|
+
return navigator.language;
|
|
3003
|
+
}
|
|
3004
|
+
} catch {
|
|
3005
|
+
}
|
|
3006
|
+
return null;
|
|
3007
|
+
}
|
|
3008
|
+
__name(detectLocale2, "detectLocale");
|
|
2960
3009
|
var API2 = class {
|
|
2961
3010
|
constructor(baseUrl, options) {
|
|
2962
3011
|
this._token = null;
|
|
2963
3012
|
this._refreshToken = null;
|
|
3013
|
+
this._locale = null;
|
|
2964
3014
|
this.baseUrl = baseUrl;
|
|
2965
3015
|
this.options = options;
|
|
2966
3016
|
const logger2 = options?.loggerConfig ? new APILogger2(options.loggerConfig) : void 0;
|
|
2967
3017
|
this.storage = options?.storage || new LocalStorageAdapter2(logger2);
|
|
3018
|
+
this._locale = options?.locale || null;
|
|
2968
3019
|
this._loadTokensFromStorage();
|
|
2969
3020
|
this._client = new APIClient2(this.baseUrl, {
|
|
2970
3021
|
retryConfig: this.options?.retryConfig,
|
|
@@ -3000,11 +3051,13 @@ var API2 = class {
|
|
|
3000
3051
|
const originalRequest = this._client.request.bind(this._client);
|
|
3001
3052
|
this._client.request = async (method, path, options) => {
|
|
3002
3053
|
const token = this.getToken();
|
|
3054
|
+
const locale = this._locale || detectLocale2();
|
|
3003
3055
|
const mergedOptions = {
|
|
3004
3056
|
...options,
|
|
3005
3057
|
headers: {
|
|
3006
3058
|
...options?.headers || {},
|
|
3007
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
3059
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
3060
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
3008
3061
|
}
|
|
3009
3062
|
};
|
|
3010
3063
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -3066,6 +3119,19 @@ var API2 = class {
|
|
|
3066
3119
|
getBaseUrl() {
|
|
3067
3120
|
return this.baseUrl;
|
|
3068
3121
|
}
|
|
3122
|
+
/**
|
|
3123
|
+
* Set locale for Accept-Language header
|
|
3124
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
3125
|
+
*/
|
|
3126
|
+
setLocale(locale) {
|
|
3127
|
+
this._locale = locale;
|
|
3128
|
+
}
|
|
3129
|
+
/**
|
|
3130
|
+
* Get current locale
|
|
3131
|
+
*/
|
|
3132
|
+
getLocale() {
|
|
3133
|
+
return this._locale;
|
|
3134
|
+
}
|
|
3069
3135
|
/**
|
|
3070
3136
|
* Get OpenAPI schema path
|
|
3071
3137
|
* @returns Path to the OpenAPI schema JSON file
|
|
@@ -3944,6 +4010,7 @@ var TotpVerifyUserSchema = import_zod68.z.object({
|
|
|
3944
4010
|
company: import_zod68.z.string().max(100).optional(),
|
|
3945
4011
|
phone: import_zod68.z.string().max(20).optional(),
|
|
3946
4012
|
position: import_zod68.z.string().max(100).optional(),
|
|
4013
|
+
language: import_zod68.z.string().max(10).optional(),
|
|
3947
4014
|
avatar: import_zod68.z.union([import_zod68.z.url(), import_zod68.z.literal("")]).nullable(),
|
|
3948
4015
|
is_staff: import_zod68.z.boolean(),
|
|
3949
4016
|
is_superuser: import_zod68.z.boolean(),
|
|
@@ -3992,14 +4059,30 @@ var import_consola16 = require("consola");
|
|
|
3992
4059
|
// src/generated/cfg_totp/index.ts
|
|
3993
4060
|
var TOKEN_KEY3 = "auth_token";
|
|
3994
4061
|
var REFRESH_TOKEN_KEY3 = "refresh_token";
|
|
4062
|
+
function detectLocale3() {
|
|
4063
|
+
try {
|
|
4064
|
+
if (typeof document !== "undefined") {
|
|
4065
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
4066
|
+
if (match) return match[1];
|
|
4067
|
+
}
|
|
4068
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
4069
|
+
return navigator.language;
|
|
4070
|
+
}
|
|
4071
|
+
} catch {
|
|
4072
|
+
}
|
|
4073
|
+
return null;
|
|
4074
|
+
}
|
|
4075
|
+
__name(detectLocale3, "detectLocale");
|
|
3995
4076
|
var API3 = class {
|
|
3996
4077
|
constructor(baseUrl, options) {
|
|
3997
4078
|
this._token = null;
|
|
3998
4079
|
this._refreshToken = null;
|
|
4080
|
+
this._locale = null;
|
|
3999
4081
|
this.baseUrl = baseUrl;
|
|
4000
4082
|
this.options = options;
|
|
4001
4083
|
const logger2 = options?.loggerConfig ? new APILogger3(options.loggerConfig) : void 0;
|
|
4002
4084
|
this.storage = options?.storage || new LocalStorageAdapter3(logger2);
|
|
4085
|
+
this._locale = options?.locale || null;
|
|
4003
4086
|
this._loadTokensFromStorage();
|
|
4004
4087
|
this._client = new APIClient3(this.baseUrl, {
|
|
4005
4088
|
retryConfig: this.options?.retryConfig,
|
|
@@ -4037,11 +4120,13 @@ var API3 = class {
|
|
|
4037
4120
|
const originalRequest = this._client.request.bind(this._client);
|
|
4038
4121
|
this._client.request = async (method, path, options) => {
|
|
4039
4122
|
const token = this.getToken();
|
|
4123
|
+
const locale = this._locale || detectLocale3();
|
|
4040
4124
|
const mergedOptions = {
|
|
4041
4125
|
...options,
|
|
4042
4126
|
headers: {
|
|
4043
4127
|
...options?.headers || {},
|
|
4044
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
4128
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
4129
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
4045
4130
|
}
|
|
4046
4131
|
};
|
|
4047
4132
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -4103,6 +4188,19 @@ var API3 = class {
|
|
|
4103
4188
|
getBaseUrl() {
|
|
4104
4189
|
return this.baseUrl;
|
|
4105
4190
|
}
|
|
4191
|
+
/**
|
|
4192
|
+
* Set locale for Accept-Language header
|
|
4193
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
4194
|
+
*/
|
|
4195
|
+
setLocale(locale) {
|
|
4196
|
+
this._locale = locale;
|
|
4197
|
+
}
|
|
4198
|
+
/**
|
|
4199
|
+
* Get current locale
|
|
4200
|
+
*/
|
|
4201
|
+
getLocale() {
|
|
4202
|
+
return this._locale;
|
|
4203
|
+
}
|
|
4106
4204
|
/**
|
|
4107
4205
|
* Get OpenAPI schema path
|
|
4108
4206
|
* @returns Path to the OpenAPI schema JSON file
|
|
@@ -5835,6 +5933,18 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
|
|
|
5835
5933
|
}
|
|
5836
5934
|
return false;
|
|
5837
5935
|
}, [clearAuthState]);
|
|
5936
|
+
const isAutoLoggingOutRef = (0, import_react17.useRef)(false);
|
|
5937
|
+
const swrOnError = (0, import_react17.useCallback)((error) => {
|
|
5938
|
+
const isAuthError = error?.status === 401 || error?.statusCode === 401 || error?.code === "token_not_valid" || error?.code === "authentication_failed";
|
|
5939
|
+
if (isAuthError && !isAutoLoggingOutRef.current) {
|
|
5940
|
+
isAutoLoggingOutRef.current = true;
|
|
5941
|
+
authLogger.warn("SWR 401 error detected, auto-logout");
|
|
5942
|
+
clearAuthState("swrOnError:401");
|
|
5943
|
+
const authCallbackUrl = configRef.current?.routes?.defaultAuthCallback || defaultRoutes.defaultAuthCallback;
|
|
5944
|
+
router.hardReplace(authCallbackUrl);
|
|
5945
|
+
}
|
|
5946
|
+
}, [clearAuthState, router]);
|
|
5947
|
+
const swrConfig = (0, import_react17.useMemo)(() => ({ onError: swrOnError }), [swrOnError]);
|
|
5838
5948
|
const loadCurrentProfile = (0, import_react17.useCallback)(async (callerId) => {
|
|
5839
5949
|
const finalCallerId = callerId || "AuthContext.loadCurrentProfile";
|
|
5840
5950
|
if (isLoadingProfileRef.current) {
|
|
@@ -6179,7 +6289,7 @@ var AuthProviderInternal = /* @__PURE__ */ __name(({ children, config }) => {
|
|
|
6179
6289
|
uploadAvatar
|
|
6180
6290
|
]
|
|
6181
6291
|
);
|
|
6182
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthContext.Provider, { value, children });
|
|
6292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthContext.Provider, { value, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_swr18.SWRConfig, { value: swrConfig, children }) });
|
|
6183
6293
|
}, "AuthProviderInternal");
|
|
6184
6294
|
var AuthProvider = /* @__PURE__ */ __name(({ children, config }) => {
|
|
6185
6295
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AccountsProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AuthProviderInternal, { config, children }) });
|