ironsource-mediation
Version:
IronSource ad mediation React-Native plugin. Monetize apps with rewarded video, interstitial, banner, and native ads.
80 lines (73 loc) • 2.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.LevelPlayInterstitialAd = void 0;
var _reactNative = require("react-native");
var _LevelPlayAdObjectManager = require("../utils/LevelPlayAdObjectManager");
const {
LevelPlayMediation
} = _reactNative.NativeModules;
const levelPlayObjectManager = _LevelPlayAdObjectManager.LevelPlayAdObjectManager.getInstance();
/**
* Represents a LevelPlay interstitial ad.
*/
class LevelPlayInterstitialAd {
adId = '';
constructor(adUnitId) {
this.adUnitId = adUnitId;
}
setListener(listener) {
this.listener = listener;
}
getListener() {
return this.listener;
}
setBidFloor(bidFloor) {
this.bidFloor = bidFloor;
}
getBidFloor() {
return this.bidFloor;
}
/**
* Checks if a specific ad placement is capped.
* @param placementName - The name of the ad placement to check.
* @returns A promise that resolves to a boolean indicating whether the placement is capped.
*/
static async isPlacementCapped(placementName) {
return await LevelPlayMediation.isInterstitialAdPlacementCapped({
placementName: placementName
});
}
/**
* Loads the interstitial ad.
* @returns A promise that resolves when the ad is loaded.
*/
async loadAd() {
await levelPlayObjectManager.loadInterstitialAd(this);
}
/**
* Shows the interstitial ad.
* @param placementName - The name of the ad placement, or null for the default placement.
* @returns A promise that resolves when the ad is shown.
*/
async showAd(placementName = '') {
await levelPlayObjectManager.showInterstitialAd(this.adId, placementName ?? '');
}
/**
* Checks if the interstitial ad is ready to be shown.
* @returns A promise that resolves to a boolean indicating whether the ad is ready.
*/
async isAdReady() {
return await levelPlayObjectManager.isInterstitialAdReady(this.adId);
}
/**
* Removes the interstitial ad.
* @returns A promise that resolves when the ad is removed.
*/
async remove() {
await levelPlayObjectManager.removeAd(this.adId);
}
}
exports.LevelPlayInterstitialAd = LevelPlayInterstitialAd;
//# sourceMappingURL=LevelPlayInterstitialAd.js.map