feat: add web campaign links — capture, auth integration, bonus UI

- Add campaign.ts utility (capture from URL, localStorage with TTL, validation)
- Pass campaign_slug in all auth API methods (telegram, widget, email, oauth)
- Consume slug in auth store login methods, set pendingCampaignBonus state
- Add CampaignBonusNotifier component (toast on bonus, mounted in AppShell)
- Show web_link alongside bot deep_link in AdminCampaignStats
- Add CampaignBonusInfo type with union bonus_type
- Fix VerifyEmail: ref guard against StrictMode double-fire, setTimeout cleanup
- Fix AdminCampaignStats: setTimeout refs with cleanup, i18n-aware locale
- Wrap all localStorage access in try/catch (Safari private browsing safety)
- Add campaignBonus translations (ru/en/fa/zh)
This commit is contained in:
Fringg
2026-02-17 06:44:10 +03:00
parent 850124f469
commit e0dd21fd0b
13 changed files with 332 additions and 49 deletions

View File

@@ -21,6 +21,15 @@ export interface OAuthProvider {
display_name: string;
}
// Campaign bonus info (returned during auth)
export interface CampaignBonusInfo {
campaign_name: string;
bonus_type: 'balance' | 'subscription' | 'tariff' | 'none';
balance_kopeks: number;
subscription_days: number | null;
tariff_name: string | null;
}
// Auth types
export interface AuthResponse {
access_token: string;
@@ -28,6 +37,7 @@ export interface AuthResponse {
token_type: string;
expires_in: number;
user: User;
campaign_bonus?: CampaignBonusInfo | null;
}
export interface TokenResponse {