unified-video-framework
Version:
Cross-platform video player framework supporting iOS, Android, Web, Smart TVs (Samsung/LG), Roku, and more
77 lines • 2.38 kB
TypeScript
import { PaywallConfig } from '@unified-video/core';
export type PaywallGateway = {
id: string;
name: string;
description?: string;
icon?: string;
color?: string;
};
export type PaymentLinkConfig = {
endpoint: string;
method?: 'POST' | 'GET';
headers?: Record<string, string>;
mapRequest?: (paymentData: any) => any;
mapResponse?: (response: any) => {
url: string;
orderId?: string;
};
popup?: {
width?: number;
height?: number;
features?: string;
};
};
export type PaywallControllerOptions = {
getOverlayContainer: () => HTMLElement | null;
onResume: (accessInfo?: {
accessGranted?: boolean;
paymentSuccessful?: boolean;
freeDuration?: number;
}) => void;
onShow?: () => void;
onClose?: () => void;
onPaymentRequested?: (gateway: PaywallGateway, paymentData: any) => Promise<void> | void;
onPaymentSuccess?: (gateway: PaywallGateway, result: any) => void;
onPaymentError?: (gateway: PaywallGateway, error: any) => void;
onPaymentCancel?: (gateway: PaywallGateway) => void;
};
export declare class PaywallController {
private config;
private opts;
private overlayEl;
private gatewayStepEl;
private popup;
private emailAuth;
private authenticatedUserId;
private sessionToken;
private currentGateway;
constructor(config: PaywallConfig | null, opts: PaywallControllerOptions);
updateConfig(config: PaywallConfig | null): void;
openOverlay(): void;
closeOverlay(): void;
private ensureOverlay;
destroyOverlays(): void;
private hideLoginButton;
private openRentDestination;
private showGateways;
private getGateways;
private getLegacyGateway;
private createGatewayButton;
private adjustBrightness;
private openGateway;
private startPolling;
private handleGatewayClick;
private handlePaymentLink;
private onMessage;
private findGatewayById;
private initializeEmailAuth;
private openPaymentOverlay;
isAuthenticated(): boolean;
getAuthenticatedUserId(): string | null;
logout(): Promise<void>;
addGateway(gateway: PaywallGateway): void;
removeGateway(gatewayId: string): void;
getConfiguredGateways(): PaywallGateway[];
destroy(): void;
}
//# sourceMappingURL=PaywallController.d.ts.map