mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
Update promo.ts
This commit is contained in:
@@ -34,6 +34,27 @@ export interface ClaimOfferResponse {
|
||||
expires_at: string | null
|
||||
}
|
||||
|
||||
export interface LoyaltyTierInfo {
|
||||
id: number
|
||||
name: string
|
||||
threshold_rubles: number
|
||||
server_discount_percent: number
|
||||
traffic_discount_percent: number
|
||||
device_discount_percent: number
|
||||
period_discounts: Record<string, number>
|
||||
is_current: boolean
|
||||
is_achieved: boolean
|
||||
}
|
||||
|
||||
export interface LoyaltyTiersResponse {
|
||||
tiers: LoyaltyTierInfo[]
|
||||
current_spent_rubles: number
|
||||
current_tier_name: string | null
|
||||
next_tier_name: string | null
|
||||
next_tier_threshold_rubles: number | null
|
||||
progress_percent: number
|
||||
}
|
||||
|
||||
export const promoApi = {
|
||||
// Get available promo offers
|
||||
getOffers: async (): Promise<PromoOffer[]> => {
|
||||
@@ -53,6 +74,12 @@ export const promoApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
// Get loyalty tiers (promo groups with spending thresholds)
|
||||
getLoyaltyTiers: async (): Promise<LoyaltyTiersResponse> => {
|
||||
const response = await apiClient.get<LoyaltyTiersResponse>('/cabinet/promo/loyalty-tiers')
|
||||
return response.data
|
||||
},
|
||||
|
||||
// Claim a promo offer
|
||||
claimOffer: async (offerId: number): Promise<ClaimOfferResponse> => {
|
||||
const response = await apiClient.post<ClaimOfferResponse>('/cabinet/promo/claim', {
|
||||
|
||||
Reference in New Issue
Block a user