react-native-appodeal
Version:
React Native Module created to support Appodeal SDK for iOS and Android platforms
210 lines (209 loc) • 6.53 kB
TypeScript
import { AppodealLogLevel, AppodealConsentStatus, AppodealIOSPurchase, AppodealAndroidPurchase, AppodealReward } from "./RNAppodealTypes";
type Map = {
[key: string]: any;
};
type EventHandler = (params?: any) => void;
type Event = string;
type AdType = number;
/**
* Appodeal SDK interface
*/
export interface Appodeal {
/**
* Adds event listeners to Appodeal SDK
* @param event Event name
* @param handler Event listener callback handler
*/
addEventListener(event: Event, handler: EventHandler): 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: AdType): void;
/**
* Check that Appodeal SDK has been initialized for a given ad type mask
* @param adTypes Ad type mask
*/
isInitialized(adTypes: AdType): boolean;
/**
* Shows an ad if it has been loaded
* @param adTypes Ad type to be shown
* @param placement Optional placement name
*/
show(adTypes: AdType, placement?: string): void;
/**
* Check if an ad is loaded
* @param adTypes Ad types
*/
isLoaded(adTypes: AdType): boolean;
/**
* Check if an ad can be shown for placement
* @param adTypes Ad types
* @param placement Optional placement name
*/
canShow(adTypes: AdType, placement?: string): boolean;
/**
* Hides presented ad
* @param adTypes Ad type mask
*/
hide(adTypes: AdType): void;
/**
* Starting cache of an ad for specific ad type
* @param adTypes Ad types mask
*/
cache(adTypes: AdType): void;
/**
* Enables or disables autocache for specific ad type
* @param adTypes Ad types masl
* @param value Boolean flag indicating whether the autocache should be enabled or not
*/
setAutoCache(adTypes: AdType, value: boolean): void;
/**
* Check that loaded ad is precache or not
* @param adTypes Ad type
*/
isPrecache(adTypes: AdType): 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: AdType, value: boolean): void;
/**
* Disables ad network for specific ad types
* @param network Network status
* @param adTypes Ad type mask
*/
disableNetwork(network: string, adTypes: AdType): void;
/**
* Get Appodeal SDK version
*/
getVersion(): string;
/**
* Set user identifier
* @param id App specific user id
*/
setUserId(id: string): void;
/**
* Set extras value in Appodeal SDK
* @param value Nullable extras value
* @param key Nonnull extras key
*/
setExtrasValue(value: any | null, key: string): void;
/**
* Get Appodeal SDK extras
*/
getExtras(): Map;
/**
* Set custom state value in Appodeal SDK
* @param value Nullable custom state value
* @param key Nonnull custom state key
*/
setCustomStateValue(value: any | null, key: string): void;
/**
* Get Appodeal SDK custom state
*/
getCustomState(): Map;
/**
* 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
* @param callback Callback returning predicted eCPM
*/
predictedEcpm(adType: AdType): 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
*/
validateAndTrackInAppPurchase(purchase: AppodealAndroidPurchase | AppodealIOSPurchase, callback?: EventHandler): void;
/**
* Track in app event
* @param name Event name
* @param parameters Optional additional 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;
}
declare const appodeal: Appodeal;
export default appodeal;