feat: account linking and merge UI for cabinet

Add Connected Accounts page (link/unlink OAuth providers), Link OAuth
Callback handler, and Merge Accounts page with subscription comparison
and user choice. Includes API methods, TypeScript types, routes in
App.tsx, navigation from Profile, and i18n for all 4 locales (ru, en,
zh, fa). Merge page works without JWT auth (validated by merge token).
This commit is contained in:
Fringg
2026-03-04 07:25:45 +03:00
parent 8157ca5f02
commit 93f97d45be
12 changed files with 1253 additions and 2 deletions

View File

@@ -636,3 +636,57 @@ export interface PromoGroupSimple {
id: number;
name: string;
}
// Account Linking
export interface LinkedProvider {
provider: string;
linked: boolean;
identifier: string | null;
}
export interface LinkedProvidersResponse {
providers: LinkedProvider[];
}
export interface LinkCallbackResponse {
success: boolean;
message: string | null;
merge_required: boolean;
merge_token: string | null;
}
// Account Merge
export interface MergeSubscriptionPreview {
status: string;
is_trial: boolean;
end_date: string | null;
traffic_limit_gb: number;
traffic_used_gb: number;
device_limit: number;
tariff_name: string | null;
autopay_enabled: boolean;
}
export interface MergeAccountPreview {
id: number;
username: string | null;
first_name: string | null;
email: string | null;
auth_methods: string[];
balance_kopeks: number;
subscription: MergeSubscriptionPreview | null;
created_at: string | null;
}
export interface MergePreviewResponse {
primary: MergeAccountPreview;
secondary: MergeAccountPreview;
expires_in_seconds: number;
}
export interface MergeResponse {
success: boolean;
access_token: string | null;
refresh_token: string | null;
user: User | null;
}