@revenuecat/purchases-ui-js
Version:
Web components for Paywalls. Powered by RevenueCat
49 lines (48 loc) • 1.87 kB
TypeScript
import type { ColorMode } from "../types";
import type { Background, BackgroundVideo } from "../types/background";
import type { ColorGradientScheme } from "../types/colors";
import type { ImageInfo, VideoFiles, VideoInfo } from "../types/media";
import type { PaywallData } from "../types/paywall";
export type PaywallRootBackgroundModel = {
kind: "none";
} | {
kind: "style";
style: Record<string, string>;
overlay: string;
} | {
kind: "image";
src: string;
fit: string;
position: string;
overlay: string;
} | {
kind: "video";
url: string;
url_low_res: string | null;
fit: string;
position: string;
overlay: string;
mute: boolean;
loop: boolean;
posterWebp: string | null;
};
/** Resolved primary + optional low-res URL for theme video assets. */
export declare function resolveVideoBackgroundFiles(colorMode: ColorMode, info: VideoInfo): Pick<VideoFiles, "url"> & {
url_low_res: string | null;
};
export type ResolvedBackgroundVideoSurface = {
url: string;
url_low_res: string | null;
fit: string;
position: string;
overlay: string;
mute: boolean;
loop: boolean;
posterWebp: string | null;
};
export declare function resolveBackgroundVideoForSurface(colorMode: ColorMode, background: BackgroundVideo): ResolvedBackgroundVideoSurface;
export declare function normalizeBackgroundVideo(background: BackgroundVideo): Required<Pick<BackgroundVideo, "fit_mode" | "mute_audio" | "loop">> & {
fallback_image: ImageInfo | null;
};
export declare function paywallRootBackgroundModel(paywallData: PaywallData | null | undefined, colorMode: ColorMode): PaywallRootBackgroundModel;
export declare function mapBackground(colorMode: ColorMode, background_color: ColorGradientScheme | null | undefined, background: Background | null | undefined): Record<string, string>;