@djangocfg/api 2.1.192 → 2.1.194
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 +102 -5
- 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 +102 -5
- 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/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.d.cts
CHANGED
|
@@ -118,6 +118,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
118
118
|
company: z.ZodOptional<z.ZodString>;
|
|
119
119
|
phone: z.ZodOptional<z.ZodString>;
|
|
120
120
|
position: z.ZodOptional<z.ZodString>;
|
|
121
|
+
language: z.ZodOptional<z.ZodString>;
|
|
121
122
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
122
123
|
is_staff: z.ZodBoolean;
|
|
123
124
|
is_superuser: z.ZodBoolean;
|
|
@@ -154,6 +155,7 @@ declare const PatchedUserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
154
155
|
company: z.ZodOptional<z.ZodString>;
|
|
155
156
|
phone: z.ZodOptional<z.ZodString>;
|
|
156
157
|
position: z.ZodOptional<z.ZodString>;
|
|
158
|
+
language: z.ZodOptional<z.ZodString>;
|
|
157
159
|
}, z.core.$strip>;
|
|
158
160
|
/**
|
|
159
161
|
* Infer TypeScript type from Zod schema
|
|
@@ -196,6 +198,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
196
198
|
company: z.ZodOptional<z.ZodString>;
|
|
197
199
|
phone: z.ZodOptional<z.ZodString>;
|
|
198
200
|
position: z.ZodOptional<z.ZodString>;
|
|
201
|
+
language: z.ZodOptional<z.ZodString>;
|
|
199
202
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
200
203
|
is_staff: z.ZodBoolean;
|
|
201
204
|
is_superuser: z.ZodBoolean;
|
|
@@ -230,6 +233,7 @@ declare const UserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
230
233
|
company: z.ZodOptional<z.ZodString>;
|
|
231
234
|
phone: z.ZodOptional<z.ZodString>;
|
|
232
235
|
position: z.ZodOptional<z.ZodString>;
|
|
236
|
+
language: z.ZodOptional<z.ZodString>;
|
|
233
237
|
}, z.core.$strip>;
|
|
234
238
|
/**
|
|
235
239
|
* Infer TypeScript type from Zod schema
|
package/dist/auth.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
118
118
|
company: z.ZodOptional<z.ZodString>;
|
|
119
119
|
phone: z.ZodOptional<z.ZodString>;
|
|
120
120
|
position: z.ZodOptional<z.ZodString>;
|
|
121
|
+
language: z.ZodOptional<z.ZodString>;
|
|
121
122
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
122
123
|
is_staff: z.ZodBoolean;
|
|
123
124
|
is_superuser: z.ZodBoolean;
|
|
@@ -154,6 +155,7 @@ declare const PatchedUserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
154
155
|
company: z.ZodOptional<z.ZodString>;
|
|
155
156
|
phone: z.ZodOptional<z.ZodString>;
|
|
156
157
|
position: z.ZodOptional<z.ZodString>;
|
|
158
|
+
language: z.ZodOptional<z.ZodString>;
|
|
157
159
|
}, z.core.$strip>;
|
|
158
160
|
/**
|
|
159
161
|
* Infer TypeScript type from Zod schema
|
|
@@ -196,6 +198,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
196
198
|
company: z.ZodOptional<z.ZodString>;
|
|
197
199
|
phone: z.ZodOptional<z.ZodString>;
|
|
198
200
|
position: z.ZodOptional<z.ZodString>;
|
|
201
|
+
language: z.ZodOptional<z.ZodString>;
|
|
199
202
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
200
203
|
is_staff: z.ZodBoolean;
|
|
201
204
|
is_superuser: z.ZodBoolean;
|
|
@@ -230,6 +233,7 @@ declare const UserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
230
233
|
company: z.ZodOptional<z.ZodString>;
|
|
231
234
|
phone: z.ZodOptional<z.ZodString>;
|
|
232
235
|
position: z.ZodOptional<z.ZodString>;
|
|
236
|
+
language: z.ZodOptional<z.ZodString>;
|
|
233
237
|
}, z.core.$strip>;
|
|
234
238
|
/**
|
|
235
239
|
* Infer TypeScript type from Zod schema
|
package/dist/auth.mjs
CHANGED
|
@@ -1215,6 +1215,7 @@ var UserSchema = z16.object({
|
|
|
1215
1215
|
company: z16.string().max(100).optional(),
|
|
1216
1216
|
phone: z16.string().max(20).optional(),
|
|
1217
1217
|
position: z16.string().max(100).optional(),
|
|
1218
|
+
language: z16.string().max(10).optional(),
|
|
1218
1219
|
avatar: z16.union([z16.url(), z16.literal("")]).nullable(),
|
|
1219
1220
|
is_staff: z16.boolean(),
|
|
1220
1221
|
is_superuser: z16.boolean(),
|
|
@@ -1241,7 +1242,8 @@ var PatchedUserProfileUpdateRequestSchema = z18.object({
|
|
|
1241
1242
|
last_name: z18.string().max(50).optional(),
|
|
1242
1243
|
company: z18.string().max(100).optional(),
|
|
1243
1244
|
phone: z18.string().max(20).optional(),
|
|
1244
|
-
position: z18.string().max(100).optional()
|
|
1245
|
+
position: z18.string().max(100).optional(),
|
|
1246
|
+
language: z18.string().max(10).optional()
|
|
1245
1247
|
});
|
|
1246
1248
|
|
|
1247
1249
|
// src/generated/cfg_accounts/_utils/schemas/TokenRefresh.schema.ts
|
|
@@ -1264,7 +1266,8 @@ var UserProfileUpdateRequestSchema = z21.object({
|
|
|
1264
1266
|
last_name: z21.string().max(50).optional(),
|
|
1265
1267
|
company: z21.string().max(100).optional(),
|
|
1266
1268
|
phone: z21.string().max(20).optional(),
|
|
1267
|
-
position: z21.string().max(100).optional()
|
|
1269
|
+
position: z21.string().max(100).optional(),
|
|
1270
|
+
language: z21.string().max(10).optional()
|
|
1268
1271
|
});
|
|
1269
1272
|
|
|
1270
1273
|
// src/generated/cfg_accounts/_utils/fetchers/accounts.ts
|
|
@@ -1610,14 +1613,30 @@ __name(updateAccountsProfileUpdateUpdate, "updateAccountsProfileUpdateUpdate");
|
|
|
1610
1613
|
// src/generated/cfg_accounts/index.ts
|
|
1611
1614
|
var TOKEN_KEY = "auth_token";
|
|
1612
1615
|
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
1616
|
+
function detectLocale() {
|
|
1617
|
+
try {
|
|
1618
|
+
if (typeof document !== "undefined") {
|
|
1619
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1620
|
+
if (match) return match[1];
|
|
1621
|
+
}
|
|
1622
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1623
|
+
return navigator.language;
|
|
1624
|
+
}
|
|
1625
|
+
} catch {
|
|
1626
|
+
}
|
|
1627
|
+
return null;
|
|
1628
|
+
}
|
|
1629
|
+
__name(detectLocale, "detectLocale");
|
|
1613
1630
|
var API = class {
|
|
1614
1631
|
constructor(baseUrl, options) {
|
|
1615
1632
|
this._token = null;
|
|
1616
1633
|
this._refreshToken = null;
|
|
1634
|
+
this._locale = null;
|
|
1617
1635
|
this.baseUrl = baseUrl;
|
|
1618
1636
|
this.options = options;
|
|
1619
1637
|
const logger2 = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
|
|
1620
1638
|
this.storage = options?.storage || new LocalStorageAdapter(logger2);
|
|
1639
|
+
this._locale = options?.locale || null;
|
|
1621
1640
|
this._loadTokensFromStorage();
|
|
1622
1641
|
this._client = new APIClient(this.baseUrl, {
|
|
1623
1642
|
retryConfig: this.options?.retryConfig,
|
|
@@ -1653,11 +1672,13 @@ var API = class {
|
|
|
1653
1672
|
const originalRequest = this._client.request.bind(this._client);
|
|
1654
1673
|
this._client.request = async (method, path, options) => {
|
|
1655
1674
|
const token = this.getToken();
|
|
1675
|
+
const locale = this._locale || detectLocale();
|
|
1656
1676
|
const mergedOptions = {
|
|
1657
1677
|
...options,
|
|
1658
1678
|
headers: {
|
|
1659
1679
|
...options?.headers || {},
|
|
1660
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
1680
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
1681
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
1661
1682
|
}
|
|
1662
1683
|
};
|
|
1663
1684
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -1719,6 +1740,19 @@ var API = class {
|
|
|
1719
1740
|
getBaseUrl() {
|
|
1720
1741
|
return this.baseUrl;
|
|
1721
1742
|
}
|
|
1743
|
+
/**
|
|
1744
|
+
* Set locale for Accept-Language header
|
|
1745
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1746
|
+
*/
|
|
1747
|
+
setLocale(locale) {
|
|
1748
|
+
this._locale = locale;
|
|
1749
|
+
}
|
|
1750
|
+
/**
|
|
1751
|
+
* Get current locale
|
|
1752
|
+
*/
|
|
1753
|
+
getLocale() {
|
|
1754
|
+
return this._locale;
|
|
1755
|
+
}
|
|
1722
1756
|
/**
|
|
1723
1757
|
* Get OpenAPI schema path
|
|
1724
1758
|
* @returns Path to the OpenAPI schema JSON file
|
|
@@ -2900,14 +2934,30 @@ import { consola as consola8 } from "consola";
|
|
|
2900
2934
|
// src/generated/cfg_centrifugo/index.ts
|
|
2901
2935
|
var TOKEN_KEY2 = "auth_token";
|
|
2902
2936
|
var REFRESH_TOKEN_KEY2 = "refresh_token";
|
|
2937
|
+
function detectLocale2() {
|
|
2938
|
+
try {
|
|
2939
|
+
if (typeof document !== "undefined") {
|
|
2940
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
2941
|
+
if (match) return match[1];
|
|
2942
|
+
}
|
|
2943
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
2944
|
+
return navigator.language;
|
|
2945
|
+
}
|
|
2946
|
+
} catch {
|
|
2947
|
+
}
|
|
2948
|
+
return null;
|
|
2949
|
+
}
|
|
2950
|
+
__name(detectLocale2, "detectLocale");
|
|
2903
2951
|
var API2 = class {
|
|
2904
2952
|
constructor(baseUrl, options) {
|
|
2905
2953
|
this._token = null;
|
|
2906
2954
|
this._refreshToken = null;
|
|
2955
|
+
this._locale = null;
|
|
2907
2956
|
this.baseUrl = baseUrl;
|
|
2908
2957
|
this.options = options;
|
|
2909
2958
|
const logger2 = options?.loggerConfig ? new APILogger2(options.loggerConfig) : void 0;
|
|
2910
2959
|
this.storage = options?.storage || new LocalStorageAdapter2(logger2);
|
|
2960
|
+
this._locale = options?.locale || null;
|
|
2911
2961
|
this._loadTokensFromStorage();
|
|
2912
2962
|
this._client = new APIClient2(this.baseUrl, {
|
|
2913
2963
|
retryConfig: this.options?.retryConfig,
|
|
@@ -2943,11 +2993,13 @@ var API2 = class {
|
|
|
2943
2993
|
const originalRequest = this._client.request.bind(this._client);
|
|
2944
2994
|
this._client.request = async (method, path, options) => {
|
|
2945
2995
|
const token = this.getToken();
|
|
2996
|
+
const locale = this._locale || detectLocale2();
|
|
2946
2997
|
const mergedOptions = {
|
|
2947
2998
|
...options,
|
|
2948
2999
|
headers: {
|
|
2949
3000
|
...options?.headers || {},
|
|
2950
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
3001
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
3002
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
2951
3003
|
}
|
|
2952
3004
|
};
|
|
2953
3005
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -3009,6 +3061,19 @@ var API2 = class {
|
|
|
3009
3061
|
getBaseUrl() {
|
|
3010
3062
|
return this.baseUrl;
|
|
3011
3063
|
}
|
|
3064
|
+
/**
|
|
3065
|
+
* Set locale for Accept-Language header
|
|
3066
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
3067
|
+
*/
|
|
3068
|
+
setLocale(locale) {
|
|
3069
|
+
this._locale = locale;
|
|
3070
|
+
}
|
|
3071
|
+
/**
|
|
3072
|
+
* Get current locale
|
|
3073
|
+
*/
|
|
3074
|
+
getLocale() {
|
|
3075
|
+
return this._locale;
|
|
3076
|
+
}
|
|
3012
3077
|
/**
|
|
3013
3078
|
* Get OpenAPI schema path
|
|
3014
3079
|
* @returns Path to the OpenAPI schema JSON file
|
|
@@ -3887,6 +3952,7 @@ var TotpVerifyUserSchema = z68.object({
|
|
|
3887
3952
|
company: z68.string().max(100).optional(),
|
|
3888
3953
|
phone: z68.string().max(20).optional(),
|
|
3889
3954
|
position: z68.string().max(100).optional(),
|
|
3955
|
+
language: z68.string().max(10).optional(),
|
|
3890
3956
|
avatar: z68.union([z68.url(), z68.literal("")]).nullable(),
|
|
3891
3957
|
is_staff: z68.boolean(),
|
|
3892
3958
|
is_superuser: z68.boolean(),
|
|
@@ -3935,14 +4001,30 @@ import { consola as consola12 } from "consola";
|
|
|
3935
4001
|
// src/generated/cfg_totp/index.ts
|
|
3936
4002
|
var TOKEN_KEY3 = "auth_token";
|
|
3937
4003
|
var REFRESH_TOKEN_KEY3 = "refresh_token";
|
|
4004
|
+
function detectLocale3() {
|
|
4005
|
+
try {
|
|
4006
|
+
if (typeof document !== "undefined") {
|
|
4007
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
4008
|
+
if (match) return match[1];
|
|
4009
|
+
}
|
|
4010
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
4011
|
+
return navigator.language;
|
|
4012
|
+
}
|
|
4013
|
+
} catch {
|
|
4014
|
+
}
|
|
4015
|
+
return null;
|
|
4016
|
+
}
|
|
4017
|
+
__name(detectLocale3, "detectLocale");
|
|
3938
4018
|
var API3 = class {
|
|
3939
4019
|
constructor(baseUrl, options) {
|
|
3940
4020
|
this._token = null;
|
|
3941
4021
|
this._refreshToken = null;
|
|
4022
|
+
this._locale = null;
|
|
3942
4023
|
this.baseUrl = baseUrl;
|
|
3943
4024
|
this.options = options;
|
|
3944
4025
|
const logger2 = options?.loggerConfig ? new APILogger3(options.loggerConfig) : void 0;
|
|
3945
4026
|
this.storage = options?.storage || new LocalStorageAdapter3(logger2);
|
|
4027
|
+
this._locale = options?.locale || null;
|
|
3946
4028
|
this._loadTokensFromStorage();
|
|
3947
4029
|
this._client = new APIClient3(this.baseUrl, {
|
|
3948
4030
|
retryConfig: this.options?.retryConfig,
|
|
@@ -3980,11 +4062,13 @@ var API3 = class {
|
|
|
3980
4062
|
const originalRequest = this._client.request.bind(this._client);
|
|
3981
4063
|
this._client.request = async (method, path, options) => {
|
|
3982
4064
|
const token = this.getToken();
|
|
4065
|
+
const locale = this._locale || detectLocale3();
|
|
3983
4066
|
const mergedOptions = {
|
|
3984
4067
|
...options,
|
|
3985
4068
|
headers: {
|
|
3986
4069
|
...options?.headers || {},
|
|
3987
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
4070
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
4071
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
3988
4072
|
}
|
|
3989
4073
|
};
|
|
3990
4074
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -4046,6 +4130,19 @@ var API3 = class {
|
|
|
4046
4130
|
getBaseUrl() {
|
|
4047
4131
|
return this.baseUrl;
|
|
4048
4132
|
}
|
|
4133
|
+
/**
|
|
4134
|
+
* Set locale for Accept-Language header
|
|
4135
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
4136
|
+
*/
|
|
4137
|
+
setLocale(locale) {
|
|
4138
|
+
this._locale = locale;
|
|
4139
|
+
}
|
|
4140
|
+
/**
|
|
4141
|
+
* Get current locale
|
|
4142
|
+
*/
|
|
4143
|
+
getLocale() {
|
|
4144
|
+
return this._locale;
|
|
4145
|
+
}
|
|
4049
4146
|
/**
|
|
4050
4147
|
* Get OpenAPI schema path
|
|
4051
4148
|
* @returns Path to the OpenAPI schema JSON file
|