import { PurchasesPackage } from '../revenuecat-types'; import { PurchasesConfig } from '../types'; import { StoreProduct } from './commerceState'; export type PurchaseBase = { id: string; transactionId?: string; }; export type PurchaseResult = IOSPurchaseResult | AndroidPurchaseResult | WebPurchaseResult; export type WebPurchaseResult = PurchaseBase & { platform: 'web'; }; export type IOSPurchaseResult = PurchaseBase & { platform: 'ios'; transactionReceipt: string; originalTransactionId?: string; }; export type AndroidPurchaseResult = PurchaseBase & { platform: 'android'; packageName: string; purchaseToken: string; transactionReceipt: string; }; export interface IPlatformAdapter { readonly name: string; /** * Check if this adapter can run on the current platform */ isSupported(): boolean; /** * Initialize the adapter (connect to native IAP, init Stripe, etc.) */ init(config?: PurchasesConfig): Promise; /** * Fetch platform-specific store products for the given SKUs * Returns empty array on web/unsupported platforms */ fetchStoreProducts(skus: string[]): Promise; /** * Execute a purchase for the given package * This should handle the platform-specific purchase flow */ purchase(pkg: PurchasesPackage, userId?: string): Promise; /** * Restore previous purchases (native only) * Web implementation can be a no-op */ restore(userId?: string): Promise; /** * Clean up resources, remove listeners, etc. */ dispose(): void; } export declare abstract class BasePlatformAdapter implements IPlatformAdapter { abstract readonly name: string; protected config: PurchasesConfig; abstract isSupported(): boolean; abstract init(config?: PurchasesConfig): Promise; abstract purchase(pkg: PurchasesPackage, userId?: string): Promise; fetchStoreProducts(_skus: string[]): Promise; restore(_userId?: string): Promise; dispose(): void; } //# sourceMappingURL=adapters.d.ts.map