@adapty/capacitor
Version:
Official Adapty SDK for Capacitor
37 lines (36 loc) • 1.59 kB
TypeScript
import type { LogContext } from '../shared/logger';
import type { AdaptyPaywallProduct, AdaptyProfile, AdaptyPurchaseResult } from '../shared/types';
import type { AdaptyError } from '../shared/types/method-types';
import { BaseViewEmitter, type BaseEventConfig } from './base-view-emitter';
import type { EventHandlers } from './types';
interface ParsedEventData {
view?: {
id: string;
placement_id?: string;
variation_id?: string;
};
action?: {
type: string;
value?: unknown;
};
product?: AdaptyPaywallProduct;
product_id?: string;
purchased_result?: AdaptyPurchaseResult;
error?: AdaptyError;
profile?: AdaptyProfile;
id: string;
}
/**
* PaywallViewEmitter manages event handlers for paywall view events.
* Each event type can have only one handler - new handlers replace existing ones.
*/
export declare class PaywallViewEmitter extends BaseViewEmitter<EventHandlers, ParsedEventData> {
protected getEventConfig(event: keyof EventHandlers): BaseEventConfig | undefined;
protected parseEventData(rawEventData: string, ctx: LogContext): ParsedEventData;
protected getPossibleHandlers(nativeEvent: string): (keyof EventHandlers)[];
protected extractCallbackArgs(handlerName: keyof EventHandlers, eventData: ParsedEventData): unknown[];
protected getEventViewId(eventData: ParsedEventData): string | null;
protected shouldCallHandler(_handlerName: keyof EventHandlers, config: BaseEventConfig, eventData: ParsedEventData): boolean;
protected getEmitterName(): string;
}
export {};