export enum IOSApphudAttributionProvider { AppsFlyer, Adjust, Facebook, AppleSearchAds, } export enum AndroidApphudAttributionProvider { appsFlyer = 'appsFlyer', adjust = 'adjust', facebook = 'facebook', } export enum ApphudUserPropertyKey { Age = '$age', Email = '$email', Name = '$name', Cohort = '$cohort', Gender = '$gender', Phone = '$phone', } export interface StartProperties { apiKey: string; userId?: string; deviceId?: string; observerMode?: boolean; } export interface AttributionProperties { data: any; identifier: string; attributionProviderId: | IOSApphudAttributionProvider | AndroidApphudAttributionProvider; } export interface ApphudNonRenewingPurchase { productId: string; purchasedAt: string; canceledAt?: string; isLocal: string; isSandbox: string; } export interface PurchaseResponse { /* Android: Purchase class */ orderId?: string; originalJson?: string; packageName?: string; purchaseState?: number; purchaseTime?: number; purchaseToken?: string; signature?: string; sku?: string; /* iOS: ApphudPurchaseResult class */ subscription?: ApphudSubscription; nonRenewingPurchase?: ApphudNonRenewingPurchase; transaction?: object; error?: any; } export interface ApphudSubscription { status: string; productId: string; expiresAt: string; startedAt: string; cancelledAt?: string; isInRetryBilling: Boolean; isAutoRenewEnabled: Boolean; isIntroductoryActivated: Boolean; isActive: Boolean; kind: string; } export interface RestorePurchase { subscriptions: Array; purchases: Array; error: any; } export interface ApphudProduct { id: string; price: string; localizeTitle?: string; localizedDescription?: string; priceLocale?: { currencySymbol: string; currencyCode: string; countryCode: string; }; subscriptionPeriod?: any; introductoryPrice?: any; regionCode?: string; currencyCode?: string; description?: string; freeTrialPeriod?: string; introductoryPriceAmountMicros?: number; introductoryPriceCycles?: number; introductoryPricePeriod?: string; priceAmountMicros?: number; priceCurrencyCode?: string; title?: string; originalPrice?: string; type?: string; originalPriceAmountMicros?: string; } export type ApphudSdkType = { start(options: StartProperties): Promise; startManually(options: StartProperties): Promise; logout(): Promise; hasActiveSubscription(): Promise; products(): Promise>; subscription(): Promise; subscriptions(): Promise>; purchase(productIdentifier: string): Promise; isNonRenewingPurchaseActive(productIdentifier: string): Promise; nonRenewingPurchases(): Promise; restorePurchases(): Promise; syncPurchases(): Promise; addAttribution(options: AttributionProperties): Promise; userId(): Promise; setUserProperty( key: ApphudUserPropertyKey | String, value: string, setOnce: boolean ): Promise; incrementUserProperty( key: ApphudUserPropertyKey | String, by: string ): Promise; };