mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-30 02:23:47 +00:00
feat: gift subscription redesign — code-only purchase + 3-tab UI
- Remove recipient input from buy flow (code-only gifts) - 3-tab UI: Buy, Activate, My Gifts with animations - After purchase, switch to My Gifts tab to show gift code - Gift code display with copy/share buttons - Activate tab: enter gift code to activate subscription - My Gifts tab: sent/received gifts with status badges - Fix: use navigator.language instead of hardcoded ru-RU for dates - Fix: spread array before sort to prevent React Query cache mutation - Fix: ARIA tab linkage with proper id/aria-labelledby - Fix: guard VITE_BOT_USERNAME against undefined in share URLs - Fix: wrap clipboard/share fallbacks in try/catch - Add error state to MyGiftsTabContent
This commit is contained in:
@@ -45,8 +45,8 @@ export interface GiftConfig {
|
||||
export interface GiftPurchaseRequest {
|
||||
tariff_id: number;
|
||||
period_days: number;
|
||||
recipient_type: 'email' | 'telegram';
|
||||
recipient_value: string;
|
||||
recipient_type?: 'email' | 'telegram';
|
||||
recipient_value?: string;
|
||||
gift_message?: string;
|
||||
payment_mode: 'balance' | 'gateway';
|
||||
payment_method?: string;
|
||||
@@ -86,6 +86,35 @@ export interface PendingGift {
|
||||
created_at: string | null;
|
||||
}
|
||||
|
||||
export interface SentGift {
|
||||
token: string;
|
||||
tariff_name: string | null;
|
||||
period_days: number;
|
||||
device_limit: number;
|
||||
status: string;
|
||||
gift_recipient_value: string | null;
|
||||
gift_message: string | null;
|
||||
activated_by_username: string | null;
|
||||
created_at: string | null;
|
||||
}
|
||||
|
||||
export interface ReceivedGift {
|
||||
token: string;
|
||||
tariff_name: string | null;
|
||||
period_days: number;
|
||||
device_limit: number;
|
||||
status: string;
|
||||
sender_display: string | null;
|
||||
gift_message: string | null;
|
||||
created_at: string | null;
|
||||
}
|
||||
|
||||
export interface ActivateGiftResponse {
|
||||
status: string;
|
||||
tariff_name: string | null;
|
||||
period_days: number | null;
|
||||
}
|
||||
|
||||
// API
|
||||
|
||||
export const giftApi = {
|
||||
@@ -108,4 +137,19 @@ export const giftApi = {
|
||||
const { data } = await apiClient.get<PendingGift[]>('/cabinet/gift/pending');
|
||||
return data;
|
||||
},
|
||||
|
||||
getSentGifts: async (): Promise<SentGift[]> => {
|
||||
const { data } = await apiClient.get<SentGift[]>('/cabinet/gift/sent');
|
||||
return data;
|
||||
},
|
||||
|
||||
getReceivedGifts: async (): Promise<ReceivedGift[]> => {
|
||||
const { data } = await apiClient.get<ReceivedGift[]>('/cabinet/gift/received');
|
||||
return data;
|
||||
},
|
||||
|
||||
activateGiftCode: async (code: string): Promise<ActivateGiftResponse> => {
|
||||
const { data } = await apiClient.post<ActivateGiftResponse>('/cabinet/gift/activate', { code });
|
||||
return data;
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user