@djangocfg/api 2.1.192 → 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 +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/hooks.d.cts
CHANGED
|
@@ -188,6 +188,7 @@ interface User$2 {
|
|
|
188
188
|
company?: string;
|
|
189
189
|
phone?: string;
|
|
190
190
|
position?: string;
|
|
191
|
+
language?: string;
|
|
191
192
|
avatar?: string | null;
|
|
192
193
|
/** Designates whether the user can log into this admin site. */
|
|
193
194
|
is_staff: boolean;
|
|
@@ -228,6 +229,7 @@ interface UserProfileUpdateRequest$1 {
|
|
|
228
229
|
company?: string;
|
|
229
230
|
phone?: string;
|
|
230
231
|
position?: string;
|
|
232
|
+
language?: string;
|
|
231
233
|
}
|
|
232
234
|
/**
|
|
233
235
|
* Serializer for updating user profile.
|
|
@@ -240,6 +242,7 @@ interface PatchedUserProfileUpdateRequest$1 {
|
|
|
240
242
|
company?: string;
|
|
241
243
|
phone?: string;
|
|
242
244
|
position?: string;
|
|
245
|
+
language?: string;
|
|
243
246
|
}
|
|
244
247
|
/**
|
|
245
248
|
* Nested serializer for Centrifugo WebSocket connection token.
|
|
@@ -396,6 +399,7 @@ interface User$1 {
|
|
|
396
399
|
company?: string;
|
|
397
400
|
phone?: string;
|
|
398
401
|
position?: string;
|
|
402
|
+
language?: string;
|
|
399
403
|
avatar?: string | null;
|
|
400
404
|
/** Designates whether the user can log into this admin site. */
|
|
401
405
|
is_staff: boolean;
|
|
@@ -801,6 +805,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
801
805
|
company: z.ZodOptional<z.ZodString>;
|
|
802
806
|
phone: z.ZodOptional<z.ZodString>;
|
|
803
807
|
position: z.ZodOptional<z.ZodString>;
|
|
808
|
+
language: z.ZodOptional<z.ZodString>;
|
|
804
809
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
805
810
|
is_staff: z.ZodBoolean;
|
|
806
811
|
is_superuser: z.ZodBoolean;
|
|
@@ -837,6 +842,7 @@ declare const PatchedUserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
837
842
|
company: z.ZodOptional<z.ZodString>;
|
|
838
843
|
phone: z.ZodOptional<z.ZodString>;
|
|
839
844
|
position: z.ZodOptional<z.ZodString>;
|
|
845
|
+
language: z.ZodOptional<z.ZodString>;
|
|
840
846
|
}, z.core.$strip>;
|
|
841
847
|
/**
|
|
842
848
|
* Infer TypeScript type from Zod schema
|
|
@@ -893,6 +899,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
893
899
|
company: z.ZodOptional<z.ZodString>;
|
|
894
900
|
phone: z.ZodOptional<z.ZodString>;
|
|
895
901
|
position: z.ZodOptional<z.ZodString>;
|
|
902
|
+
language: z.ZodOptional<z.ZodString>;
|
|
896
903
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
897
904
|
is_staff: z.ZodBoolean;
|
|
898
905
|
is_superuser: z.ZodBoolean;
|
|
@@ -927,6 +934,7 @@ declare const UserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
927
934
|
company: z.ZodOptional<z.ZodString>;
|
|
928
935
|
phone: z.ZodOptional<z.ZodString>;
|
|
929
936
|
position: z.ZodOptional<z.ZodString>;
|
|
937
|
+
language: z.ZodOptional<z.ZodString>;
|
|
930
938
|
}, z.core.$strip>;
|
|
931
939
|
/**
|
|
932
940
|
* Infer TypeScript type from Zod schema
|
|
@@ -974,12 +982,15 @@ interface APIOptions {
|
|
|
974
982
|
retryConfig?: RetryConfig;
|
|
975
983
|
/** Logger configuration */
|
|
976
984
|
loggerConfig?: Partial<LoggerConfig>;
|
|
985
|
+
/** Locale for Accept-Language header (e.g. 'en', 'ko', 'ru') */
|
|
986
|
+
locale?: string;
|
|
977
987
|
}
|
|
978
988
|
declare class API {
|
|
979
989
|
private baseUrl;
|
|
980
990
|
private _client;
|
|
981
991
|
private _token;
|
|
982
992
|
private _refreshToken;
|
|
993
|
+
private _locale;
|
|
983
994
|
private storage;
|
|
984
995
|
private options?;
|
|
985
996
|
auth: Auth;
|
|
@@ -1021,6 +1032,15 @@ declare class API {
|
|
|
1021
1032
|
* Get current base URL
|
|
1022
1033
|
*/
|
|
1023
1034
|
getBaseUrl(): string;
|
|
1035
|
+
/**
|
|
1036
|
+
* Set locale for Accept-Language header
|
|
1037
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1038
|
+
*/
|
|
1039
|
+
setLocale(locale: string | null): void;
|
|
1040
|
+
/**
|
|
1041
|
+
* Get current locale
|
|
1042
|
+
*/
|
|
1043
|
+
getLocale(): string | null;
|
|
1024
1044
|
/**
|
|
1025
1045
|
* Get OpenAPI schema path
|
|
1026
1046
|
* @returns Path to the OpenAPI schema JSON file
|
package/dist/hooks.d.ts
CHANGED
|
@@ -188,6 +188,7 @@ interface User$2 {
|
|
|
188
188
|
company?: string;
|
|
189
189
|
phone?: string;
|
|
190
190
|
position?: string;
|
|
191
|
+
language?: string;
|
|
191
192
|
avatar?: string | null;
|
|
192
193
|
/** Designates whether the user can log into this admin site. */
|
|
193
194
|
is_staff: boolean;
|
|
@@ -228,6 +229,7 @@ interface UserProfileUpdateRequest$1 {
|
|
|
228
229
|
company?: string;
|
|
229
230
|
phone?: string;
|
|
230
231
|
position?: string;
|
|
232
|
+
language?: string;
|
|
231
233
|
}
|
|
232
234
|
/**
|
|
233
235
|
* Serializer for updating user profile.
|
|
@@ -240,6 +242,7 @@ interface PatchedUserProfileUpdateRequest$1 {
|
|
|
240
242
|
company?: string;
|
|
241
243
|
phone?: string;
|
|
242
244
|
position?: string;
|
|
245
|
+
language?: string;
|
|
243
246
|
}
|
|
244
247
|
/**
|
|
245
248
|
* Nested serializer for Centrifugo WebSocket connection token.
|
|
@@ -396,6 +399,7 @@ interface User$1 {
|
|
|
396
399
|
company?: string;
|
|
397
400
|
phone?: string;
|
|
398
401
|
position?: string;
|
|
402
|
+
language?: string;
|
|
399
403
|
avatar?: string | null;
|
|
400
404
|
/** Designates whether the user can log into this admin site. */
|
|
401
405
|
is_staff: boolean;
|
|
@@ -801,6 +805,7 @@ declare const OTPVerifyResponseSchema: z.ZodObject<{
|
|
|
801
805
|
company: z.ZodOptional<z.ZodString>;
|
|
802
806
|
phone: z.ZodOptional<z.ZodString>;
|
|
803
807
|
position: z.ZodOptional<z.ZodString>;
|
|
808
|
+
language: z.ZodOptional<z.ZodString>;
|
|
804
809
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
805
810
|
is_staff: z.ZodBoolean;
|
|
806
811
|
is_superuser: z.ZodBoolean;
|
|
@@ -837,6 +842,7 @@ declare const PatchedUserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
837
842
|
company: z.ZodOptional<z.ZodString>;
|
|
838
843
|
phone: z.ZodOptional<z.ZodString>;
|
|
839
844
|
position: z.ZodOptional<z.ZodString>;
|
|
845
|
+
language: z.ZodOptional<z.ZodString>;
|
|
840
846
|
}, z.core.$strip>;
|
|
841
847
|
/**
|
|
842
848
|
* Infer TypeScript type from Zod schema
|
|
@@ -893,6 +899,7 @@ declare const UserSchema: z.ZodObject<{
|
|
|
893
899
|
company: z.ZodOptional<z.ZodString>;
|
|
894
900
|
phone: z.ZodOptional<z.ZodString>;
|
|
895
901
|
position: z.ZodOptional<z.ZodString>;
|
|
902
|
+
language: z.ZodOptional<z.ZodString>;
|
|
896
903
|
avatar: z.ZodNullable<z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>>;
|
|
897
904
|
is_staff: z.ZodBoolean;
|
|
898
905
|
is_superuser: z.ZodBoolean;
|
|
@@ -927,6 +934,7 @@ declare const UserProfileUpdateRequestSchema: z.ZodObject<{
|
|
|
927
934
|
company: z.ZodOptional<z.ZodString>;
|
|
928
935
|
phone: z.ZodOptional<z.ZodString>;
|
|
929
936
|
position: z.ZodOptional<z.ZodString>;
|
|
937
|
+
language: z.ZodOptional<z.ZodString>;
|
|
930
938
|
}, z.core.$strip>;
|
|
931
939
|
/**
|
|
932
940
|
* Infer TypeScript type from Zod schema
|
|
@@ -974,12 +982,15 @@ interface APIOptions {
|
|
|
974
982
|
retryConfig?: RetryConfig;
|
|
975
983
|
/** Logger configuration */
|
|
976
984
|
loggerConfig?: Partial<LoggerConfig>;
|
|
985
|
+
/** Locale for Accept-Language header (e.g. 'en', 'ko', 'ru') */
|
|
986
|
+
locale?: string;
|
|
977
987
|
}
|
|
978
988
|
declare class API {
|
|
979
989
|
private baseUrl;
|
|
980
990
|
private _client;
|
|
981
991
|
private _token;
|
|
982
992
|
private _refreshToken;
|
|
993
|
+
private _locale;
|
|
983
994
|
private storage;
|
|
984
995
|
private options?;
|
|
985
996
|
auth: Auth;
|
|
@@ -1021,6 +1032,15 @@ declare class API {
|
|
|
1021
1032
|
* Get current base URL
|
|
1022
1033
|
*/
|
|
1023
1034
|
getBaseUrl(): string;
|
|
1035
|
+
/**
|
|
1036
|
+
* Set locale for Accept-Language header
|
|
1037
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1038
|
+
*/
|
|
1039
|
+
setLocale(locale: string | null): void;
|
|
1040
|
+
/**
|
|
1041
|
+
* Get current locale
|
|
1042
|
+
*/
|
|
1043
|
+
getLocale(): string | null;
|
|
1024
1044
|
/**
|
|
1025
1045
|
* Get OpenAPI schema path
|
|
1026
1046
|
* @returns Path to the OpenAPI schema JSON file
|
package/dist/hooks.mjs
CHANGED
|
@@ -966,6 +966,7 @@ var UserSchema = z17.object({
|
|
|
966
966
|
company: z17.string().max(100).optional(),
|
|
967
967
|
phone: z17.string().max(20).optional(),
|
|
968
968
|
position: z17.string().max(100).optional(),
|
|
969
|
+
language: z17.string().max(10).optional(),
|
|
969
970
|
avatar: z17.union([z17.url(), z17.literal("")]).nullable(),
|
|
970
971
|
is_staff: z17.boolean(),
|
|
971
972
|
is_superuser: z17.boolean(),
|
|
@@ -992,7 +993,8 @@ var PatchedUserProfileUpdateRequestSchema = z19.object({
|
|
|
992
993
|
last_name: z19.string().max(50).optional(),
|
|
993
994
|
company: z19.string().max(100).optional(),
|
|
994
995
|
phone: z19.string().max(20).optional(),
|
|
995
|
-
position: z19.string().max(100).optional()
|
|
996
|
+
position: z19.string().max(100).optional(),
|
|
997
|
+
language: z19.string().max(10).optional()
|
|
996
998
|
});
|
|
997
999
|
|
|
998
1000
|
// src/generated/cfg_accounts/_utils/schemas/TokenRefreshRequest.schema.ts
|
|
@@ -1008,7 +1010,8 @@ var UserProfileUpdateRequestSchema = z21.object({
|
|
|
1008
1010
|
last_name: z21.string().max(50).optional(),
|
|
1009
1011
|
company: z21.string().max(100).optional(),
|
|
1010
1012
|
phone: z21.string().max(20).optional(),
|
|
1011
|
-
position: z21.string().max(100).optional()
|
|
1013
|
+
position: z21.string().max(100).optional(),
|
|
1014
|
+
language: z21.string().max(10).optional()
|
|
1012
1015
|
});
|
|
1013
1016
|
|
|
1014
1017
|
// src/generated/cfg_accounts/_utils/fetchers/accounts.ts
|
|
@@ -1551,14 +1554,30 @@ __name(partialUpdateAccountsProfileUpdatePartialUpdate, "partialUpdateAccountsPr
|
|
|
1551
1554
|
// src/generated/cfg_accounts/index.ts
|
|
1552
1555
|
var TOKEN_KEY = "auth_token";
|
|
1553
1556
|
var REFRESH_TOKEN_KEY = "refresh_token";
|
|
1557
|
+
function detectLocale() {
|
|
1558
|
+
try {
|
|
1559
|
+
if (typeof document !== "undefined") {
|
|
1560
|
+
const match = document.cookie.match(/(?:^|;\s*)NEXT_LOCALE=([^;]*)/);
|
|
1561
|
+
if (match) return match[1];
|
|
1562
|
+
}
|
|
1563
|
+
if (typeof navigator !== "undefined" && navigator.language) {
|
|
1564
|
+
return navigator.language;
|
|
1565
|
+
}
|
|
1566
|
+
} catch {
|
|
1567
|
+
}
|
|
1568
|
+
return null;
|
|
1569
|
+
}
|
|
1570
|
+
__name(detectLocale, "detectLocale");
|
|
1554
1571
|
var API = class {
|
|
1555
1572
|
constructor(baseUrl, options) {
|
|
1556
1573
|
this._token = null;
|
|
1557
1574
|
this._refreshToken = null;
|
|
1575
|
+
this._locale = null;
|
|
1558
1576
|
this.baseUrl = baseUrl;
|
|
1559
1577
|
this.options = options;
|
|
1560
1578
|
const logger = options?.loggerConfig ? new APILogger(options.loggerConfig) : void 0;
|
|
1561
1579
|
this.storage = options?.storage || new LocalStorageAdapter(logger);
|
|
1580
|
+
this._locale = options?.locale || null;
|
|
1562
1581
|
this._loadTokensFromStorage();
|
|
1563
1582
|
this._client = new APIClient(this.baseUrl, {
|
|
1564
1583
|
retryConfig: this.options?.retryConfig,
|
|
@@ -1594,11 +1613,13 @@ var API = class {
|
|
|
1594
1613
|
const originalRequest = this._client.request.bind(this._client);
|
|
1595
1614
|
this._client.request = async (method, path, options) => {
|
|
1596
1615
|
const token = this.getToken();
|
|
1616
|
+
const locale = this._locale || detectLocale();
|
|
1597
1617
|
const mergedOptions = {
|
|
1598
1618
|
...options,
|
|
1599
1619
|
headers: {
|
|
1600
1620
|
...options?.headers || {},
|
|
1601
|
-
...token ? { "Authorization": `Bearer ${token}` } : {}
|
|
1621
|
+
...token ? { "Authorization": `Bearer ${token}` } : {},
|
|
1622
|
+
...locale ? { "Accept-Language": locale } : {}
|
|
1602
1623
|
}
|
|
1603
1624
|
};
|
|
1604
1625
|
return originalRequest(method, path, mergedOptions);
|
|
@@ -1660,6 +1681,19 @@ var API = class {
|
|
|
1660
1681
|
getBaseUrl() {
|
|
1661
1682
|
return this.baseUrl;
|
|
1662
1683
|
}
|
|
1684
|
+
/**
|
|
1685
|
+
* Set locale for Accept-Language header
|
|
1686
|
+
* @param locale - Locale string (e.g. 'en', 'ko', 'ru') or null to clear
|
|
1687
|
+
*/
|
|
1688
|
+
setLocale(locale) {
|
|
1689
|
+
this._locale = locale;
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Get current locale
|
|
1693
|
+
*/
|
|
1694
|
+
getLocale() {
|
|
1695
|
+
return this._locale;
|
|
1696
|
+
}
|
|
1663
1697
|
/**
|
|
1664
1698
|
* Get OpenAPI schema path
|
|
1665
1699
|
* @returns Path to the OpenAPI schema JSON file
|