UNPKG

react-native-appodeal

Version:

React Native Module created to support Appodeal SDK for iOS and Android platforms

227 lines 7.55 kB
/** * Appodeal SDK for React Native * * This module provides a complete interface to the Appodeal SDK for React Native applications. * It includes functionality for: * - Ad management (banner, interstitial, rewarded video, MREC) * - Analytics and revenue tracking * - In-app purchase validation * - Consent management (GDPR compliance) * - Event handling and callbacks * * The module uses React Native TurboModules for optimal performance and type safety. */ import { AppodealAdType, AppodealLogLevel } from './types'; import type { AppodealAndroidPurchase, AppodealConsentStatus, AppodealIOSPurchase, AppodealReward, Map } from './types'; import type { AppodealPurchaseValidationResult } from './types/AppodealPurchaseValidationResult'; type EventHandler = (params?: any) => void; type Event = string; /** * Appodeal SDK interface using Turbo modules */ export interface Appodeal { /** * Adds event listeners to Appodeal SDK * @param event Event name * @param handler Event listener callback handler * @returns Subscription object with remove method */ addEventListener(event: Event, handler: EventHandler): { remove: () => void; }; /** * Removes listener for specific event * @param event Event name * @param handler Event handler */ removeEventListener(event: Event, handler: EventHandler): void; /** * Removes all event listener */ removeAllListeners(): void; /** * Initialize Appodeal SDK * @param appKey Application app key * @param adTypes Ad types mask */ initialize(appKey: string, adTypes: AppodealAdType): void; /** * Check that Appodeal SDK has been initialized for a given ad type mask * @param adTypes Ad type mask */ isInitialized(adTypes: AppodealAdType): boolean; /** * Shows an ad if it has been loaded * @param adTypes Ad type to be shown * @param placement Optional placement name */ show(adTypes: AppodealAdType, placement?: string): void; /** * Check if an ad is loaded * @param adTypes Ad types */ isLoaded(adTypes: AppodealAdType): boolean; /** * Check if an ad can be shown for placement * @param adTypes Ad types * @param placement Optional placement name */ canShow(adTypes: AppodealAdType, placement?: string): boolean; /** * Hides presented ad * @param adTypes Ad type mask */ hide(adTypes: AppodealAdType): void; /** * Starting cache of an ad for specific ad type * @param adTypes Ad types mask */ cache(adTypes: AppodealAdType): void; /** * Enables or disables autocache for specific ad type * @param adTypes Ad types mask * @param value Boolean flag indicating whether the autocache should be enabled or not */ setAutoCache(adTypes: AppodealAdType, value: boolean): void; /** * Check that loaded ad is precache or not * @param adTypes Ad type */ isPrecache(adTypes: AppodealAdType): boolean; /** * Force SDK use 728x90 or 320x50 banner size for top and bottom banner presentation size * @param value Boolean flag indicating tablet or phone banner size */ setTabletBanners(value: boolean): void; /** * Enables or disables smart sizing that fills full width for banners * @param value Boolean flag indicating smart sizing supported */ setSmartBanners(value: boolean): void; /** * Enables or disables banners refresh animation * @param value Boolean flag indicating banner refresh animation enabled */ setBannerAnimation(value: boolean): void; /** * Sets that application is for kids * @param value Boolean flag indicating child directed treatment */ setChildDirectedTreatment(value: boolean): void; /** * Returns current user consent status */ consentStatus(): AppodealConsentStatus; /** * Revokes user consent */ revokeConsent(): void; /** * Request consent parameters * @param appKey Appodeal app key */ requestConsentInfoUpdate(appKey: string): Promise<AppodealConsentStatus>; /** * Shows consent form if consent status is REQUIRED */ showConsentFormIfNeeded(): Promise<AppodealConsentStatus>; /** * Shows consent form */ showConsentForm(): Promise<AppodealConsentStatus>; /** * Enables or disables test mode * @param value Boolean flag indicating test mode */ setTesting(value: boolean): void; /** * Sets level of logged messages * @param value Log level */ setLogLevel(value: AppodealLogLevel): void; /** * Enables or disables firing of callback on load in case precache ad was loaded * @param adTypes Ad type * @param value Boolean flag indicating precache callbacks activity */ setTriggerPrecacheCallbacks(adTypes: AppodealAdType, value: boolean): void; /** * Disables ad network for specific ad types * @param network Network status * @param adTypes Ad type mask (defaults to ALL if not specified) */ disableNetwork(network: string, adTypes?: AppodealAdType): void; /** * Get Appodeal SDK Plugin version */ getVersion(): string; /** * Get Appodeal SDK Native Platform version */ getPlatformSdkVersion(): string; /** * Set user identifier * @param id App specific user id */ setUserId(id: string): void; /** * Set extras value in Appodeal SDK * @param key Nonnull extras key * @param value Nullable extras value */ setExtrasValue(key: string, value: any | null): void; /** * Set custom state value in Appodeal SDK * @param key Nonnull custom state key * @param value Nullable custom state value */ setCustomStateValue(key: string, value: any | null): void; /** * Returns reward parameters for given placement * @param placement Placement name */ getRewardParameters(placement?: string): AppodealReward; /** * Returns predicted eCPM of loaded ad for ad type * @param adType Ad type */ predictedEcpm(adType: AppodealAdType): number; /** * Track in app purchase * @param amount Purchase amount * @param currency Purchase currency */ trackInAppPurchase(amount: number, currency: string): void; /** * Validate and track in app purchase * @param purchase Purchased product info * @returns Promise with validation result */ validateAndTrackInAppPurchase(purchase: AppodealAndroidPurchase | AppodealIOSPurchase): Promise<AppodealPurchaseValidationResult>; /** * Track in app event * @param name Event name * @param parameters Optional event parameters */ trackEvent(name: string, parameters?: Map): void; /** * Set self-hosted Bidon environment endpoint * @param endpoint Bidon environment endpoint */ setBidonEndpoint(endpoint: string): void; /** * Get self-hosted Bidon environment endpoint * @returns Bidon environment endpoint */ getBidonEndpoint(): string | null; } /** * Appodeal SDK implementation * * This object implements all the methods defined in the Appodeal interface. * Each method delegates to the corresponding native module method with proper * parameter handling and type conversion. */ declare const appodeal: Appodeal; export default appodeal; //# sourceMappingURL=RNAppodeal.d.ts.map